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

Side by Side 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, 11 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 unified diff | Download patch
« no previous file with comments | « samples/pdfium_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 PDFium Authors. All rights reserved. 1 // Copyright 2015 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "testing/embedder_test.h" 5 #include "testing/embedder_test.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 8
9 #include <list> 9 #include <list>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "public/fpdf_dataavail.h" 14 #include "public/fpdf_dataavail.h"
15 #include "public/fpdf_edit.h"
15 #include "public/fpdf_text.h" 16 #include "public/fpdf_text.h"
16 #include "public/fpdfview.h" 17 #include "public/fpdfview.h"
17 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/test_support.h" 19 #include "testing/test_support.h"
19 #include "testing/utils/path_service.h" 20 #include "testing/utils/path_service.h"
20 21
21 #ifdef PDF_ENABLE_V8 22 #ifdef PDF_ENABLE_V8
22 #include "v8/include/v8.h" 23 #include "v8/include/v8.h"
23 #include "v8/include/v8-platform.h" 24 #include "v8/include/v8-platform.h"
24 #endif // PDF_ENABLE_V8 25 #endif // PDF_ENABLE_V8
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 if (!page) { 228 if (!page) {
228 return nullptr; 229 return nullptr;
229 } 230 }
230 FORM_DoPageAAction(page, form_handle_, FPDFPAGE_AACTION_OPEN); 231 FORM_DoPageAAction(page, form_handle_, FPDFPAGE_AACTION_OPEN);
231 return page; 232 return page;
232 } 233 }
233 234
234 FPDF_BITMAP EmbedderTest::RenderPage(FPDF_PAGE page) { 235 FPDF_BITMAP EmbedderTest::RenderPage(FPDF_PAGE page) {
235 int width = static_cast<int>(FPDF_GetPageWidth(page)); 236 int width = static_cast<int>(FPDF_GetPageWidth(page));
236 int height = static_cast<int>(FPDF_GetPageHeight(page)); 237 int height = static_cast<int>(FPDF_GetPageHeight(page));
237 FPDF_BITMAP bitmap = FPDFBitmap_Create(width, height, 0); 238 int alpha = FPDFPage_HasTransparency(page) ? 1 : 0;
238 FPDFBitmap_FillRect(bitmap, 0, 0, width, height, 0xFFFFFFFF); 239 FPDF_BITMAP bitmap = FPDFBitmap_Create(width, height, alpha);
240 FPDF_DWORD fill_color = alpha ? 0x00000000 : 0xFFFFFFFF;
241 FPDFBitmap_FillRect(bitmap, 0, 0, width, height, fill_color);
239 FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, 0); 242 FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, 0);
240 FPDF_FFLDraw(form_handle_, bitmap, page, 0, 0, width, height, 0, 0); 243 FPDF_FFLDraw(form_handle_, bitmap, page, 0, 0, width, height, 0, 0);
241 return bitmap; 244 return bitmap;
242 } 245 }
243 246
244 void EmbedderTest::UnloadPage(FPDF_PAGE page) { 247 void EmbedderTest::UnloadPage(FPDF_PAGE page) {
245 FORM_DoPageAAction(page, form_handle_, FPDFPAGE_AACTION_CLOSE); 248 FORM_DoPageAAction(page, form_handle_, FPDFPAGE_AACTION_CLOSE);
246 FORM_OnBeforeClosePage(page, form_handle_); 249 FORM_OnBeforeClosePage(page, form_handle_);
247 FPDF_ClosePage(page); 250 FPDF_ClosePage(page);
248 } 251 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 } 306 }
304 307
305 // Can't use gtest-provided main since we need to stash the path to the 308 // Can't use gtest-provided main since we need to stash the path to the
306 // executable in order to find the external V8 binary data files. 309 // executable in order to find the external V8 binary data files.
307 int main(int argc, char** argv) { 310 int main(int argc, char** argv) {
308 g_exe_path_ = argv[0]; 311 g_exe_path_ = argv[0];
309 testing::InitGoogleTest(&argc, argv); 312 testing::InitGoogleTest(&argc, argv);
310 testing::InitGoogleMock(&argc, argv); 313 testing::InitGoogleMock(&argc, argv);
311 return RUN_ALL_TESTS(); 314 return RUN_ALL_TESTS();
312 } 315 }
OLDNEW
« 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