summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-12-31 13:13:10 -0800
committerLei Zhang <thestig@chromium.org>2015-12-31 13:13:10 -0800
commit453d96b5458db02591aeb0f23ea700f00f0dfd71 (patch)
treec71c883f07d75bd85aa9ba581ed890036a3fd25e /samples
parent1aeeceb45d785fc9cfbc69510220655fdcc9dd63 (diff)
downloadpdfium-453d96b5458db02591aeb0f23ea700f00f0dfd71.tar.xz
Merge to XFA: Reapply "Fix a partial rendering problem"
This reverts commit 054fc955c153eb5c581fd14946848b8b2a77136a. Additionally, this rolls DEPS for the testing corpus to update test expectations. BUG=pdfium:336 TBR=jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/1555833002 . (cherry picked from commit 5594538fcc96c38db34f336223140cf703e3cca0) Review URL: https://codereview.chromium.org/1553013002 .
Diffstat (limited to 'samples')
-rw-r--r--samples/pdfium_test.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index 4fd6b86c62..112e7800c0 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -15,6 +15,7 @@
#include "image_diff_png.h"
#include "public/fpdf_dataavail.h"
+#include "public/fpdf_edit.h"
#include "public/fpdf_ext.h"
#include "public/fpdf_formfill.h"
#include "public/fpdf_text.h"
@@ -350,14 +351,14 @@ bool RenderPage(const std::string& name,
}
int width = static_cast<int>(FPDF_GetPageWidth(page) * scale);
int height = static_cast<int>(FPDF_GetPageHeight(page) * scale);
-
- FPDF_BITMAP bitmap = FPDFBitmap_Create(width, height, 0);
+ int alpha = FPDFPage_HasTransparency(page) ? 1 : 0;
+ FPDF_BITMAP bitmap = FPDFBitmap_Create(width, height, alpha);
if (!bitmap) {
fprintf(stderr, "Page was too large to be rendered.\n");
return false;
}
-
- FPDFBitmap_FillRect(bitmap, 0, 0, width, height, 0xFFFFFFFF);
+ FPDF_DWORD fill_color = alpha ? 0x00000000 : 0xFFFFFFFF;
+ FPDFBitmap_FillRect(bitmap, 0, 0, width, height, fill_color);
FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, 0);
FPDF_FFLDraw(form, bitmap, page, 0, 0, width, height, 0, 0);