Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(609)

Unified Diff: testing/embedder_test.cpp

Issue 1553013002: Merge to XFA: Reapply "Fix a partial rendering problem" (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samples/pdfium_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/embedder_test.cpp
diff --git a/testing/embedder_test.cpp b/testing/embedder_test.cpp
index 23b15a47d115aaecb5b805f8262d90a8d15b9642..8d4682eacfd1cde42cdf78a03c7b12a070743cd4 100644
--- a/testing/embedder_test.cpp
+++ b/testing/embedder_test.cpp
@@ -12,6 +12,7 @@
#include <vector>
#include "public/fpdf_dataavail.h"
+#include "public/fpdf_edit.h"
#include "public/fpdf_text.h"
#include "public/fpdfview.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -234,8 +235,10 @@ FPDF_PAGE EmbedderTest::LoadAndCachePage(int page_number) {
FPDF_BITMAP EmbedderTest::RenderPage(FPDF_PAGE page) {
int width = static_cast<int>(FPDF_GetPageWidth(page));
int height = static_cast<int>(FPDF_GetPageHeight(page));
- FPDF_BITMAP bitmap = FPDFBitmap_Create(width, height, 0);
- FPDFBitmap_FillRect(bitmap, 0, 0, width, height, 0xFFFFFFFF);
+ int alpha = FPDFPage_HasTransparency(page) ? 1 : 0;
+ FPDF_BITMAP bitmap = FPDFBitmap_Create(width, height, alpha);
+ 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_handle_, bitmap, page, 0, 0, width, height, 0, 0);
return bitmap;
« no previous file with comments | « samples/pdfium_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698