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

Side by Side Diff: samples/pdfium_test.cc

Issue 2323203002: Define behaviors of FPDF_RenderPageBitmap_Retail and FPDF_FFLDraw. (Closed)
Patch Set: roll DEPS Created 4 years, 3 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 | « public/fpdfview.h ('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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium 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 <limits.h> 5 #include <limits.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 if (!options.scale_factor_as_string.empty()) 566 if (!options.scale_factor_as_string.empty())
567 std::stringstream(options.scale_factor_as_string) >> scale; 567 std::stringstream(options.scale_factor_as_string) >> scale;
568 568
569 int width = static_cast<int>(FPDF_GetPageWidth(page) * scale); 569 int width = static_cast<int>(FPDF_GetPageWidth(page) * scale);
570 int height = static_cast<int>(FPDF_GetPageHeight(page) * scale); 570 int height = static_cast<int>(FPDF_GetPageHeight(page) * scale);
571 int alpha = FPDFPage_HasTransparency(page) ? 1 : 0; 571 int alpha = FPDFPage_HasTransparency(page) ? 1 : 0;
572 FPDF_BITMAP bitmap = FPDFBitmap_Create(width, height, alpha); 572 FPDF_BITMAP bitmap = FPDFBitmap_Create(width, height, alpha);
573 if (bitmap) { 573 if (bitmap) {
574 FPDF_DWORD fill_color = alpha ? 0x00000000 : 0xFFFFFFFF; 574 FPDF_DWORD fill_color = alpha ? 0x00000000 : 0xFFFFFFFF;
575 FPDFBitmap_FillRect(bitmap, 0, 0, width, height, fill_color); 575 FPDFBitmap_FillRect(bitmap, 0, 0, width, height, fill_color);
576 FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, 0); 576 FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, FPDF_ANNOT);
577 577
578 FPDF_FFLDraw(form, bitmap, page, 0, 0, width, height, 0, 0); 578 FPDF_FFLDraw(form, bitmap, page, 0, 0, width, height, 0, FPDF_ANNOT);
579 int stride = FPDFBitmap_GetStride(bitmap); 579 int stride = FPDFBitmap_GetStride(bitmap);
580 const char* buffer = 580 const char* buffer =
581 reinterpret_cast<const char*>(FPDFBitmap_GetBuffer(bitmap)); 581 reinterpret_cast<const char*>(FPDFBitmap_GetBuffer(bitmap));
582 582
583 switch (options.output_format) { 583 switch (options.output_format) {
584 #ifdef _WIN32 584 #ifdef _WIN32
585 case OUTPUT_BMP: 585 case OUTPUT_BMP:
586 WriteBmp(name.c_str(), page_index, buffer, stride, width, height); 586 WriteBmp(name.c_str(), page_index, buffer, stride, width, height);
587 break; 587 break;
588 588
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 delete platform; 910 delete platform;
911 911
912 #ifdef V8_USE_EXTERNAL_STARTUP_DATA 912 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
913 free(const_cast<char*>(natives.data)); 913 free(const_cast<char*>(natives.data));
914 free(const_cast<char*>(snapshot.data)); 914 free(const_cast<char*>(snapshot.data));
915 #endif // V8_USE_EXTERNAL_STARTUP_DATA 915 #endif // V8_USE_EXTERNAL_STARTUP_DATA
916 #endif // PDF_ENABLE_V8 916 #endif // PDF_ENABLE_V8
917 917
918 return 0; 918 return 0;
919 } 919 }
OLDNEW
« no previous file with comments | « public/fpdfview.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698