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

Unified Diff: samples/pdfium_test.cc

Issue 477873003: Fix a hang issue due to inconsistent page number in the test file (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 4 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 | « core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/pdfium_test.cc
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index 72c8c5dcd104c85c75dcadbb4cd15c2d971382d4..14dc19ce677f9a5d8083123d21c52d3ffad32404 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -304,8 +304,12 @@ void RenderPdf(const char* name, const char* pBuf, size_t len,
FORM_DoDocumentJSAction(form);
FORM_DoDocumentOpenAction(form);
+ size_t renderedPages = 0;
Tom Sepez 2014/08/22 00:23:31 nit: we use the rendered_pages style for local va
jun_fang 2014/08/22 01:07:25 Got it.
for (int i = 0; i < page_count; ++i) {
FPDF_PAGE page = FPDF_LoadPage(doc, i);
+ if (!page) {
+ continue;
Tom Sepez 2014/08/22 00:23:31 nit: Should we count the bad pages, too, and outpu
jun_fang 2014/08/22 01:07:25 Will add it.
+ }
FPDF_TEXTPAGE text_page = FPDFText_LoadPage(page);
FORM_OnAfterLoadPage(page, form);
FORM_DoPageAAction(page, form, FPDFPAGE_AACTION_OPEN);
@@ -316,6 +320,8 @@ void RenderPdf(const char* name, const char* pBuf, size_t len,
FPDFBitmap_FillRect(bitmap, 0, 0, width, height, 0xFFFFFFFF);
FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, 0);
+ renderedPages ++;
+
FPDF_FFLDraw(form, bitmap, page, 0, 0, width, height, 0, 0);
int stride = FPDFBitmap_GetStride(bitmap);
const char* buffer =
@@ -351,7 +357,7 @@ void RenderPdf(const char* name, const char* pBuf, size_t len,
FPDF_CloseDocument(doc);
FPDFAvail_Destroy(pdf_avail);
- printf("Loaded, parsed and rendered %d pages.\n", page_count);
+ printf("Loaded, parsed and rendered %d pages.\n", renderedPages);
}
int main(int argc, const char* argv[]) {
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698