| OLD | NEW | 
|---|
| 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 <list> | 10 #include <list> | 
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 439   for (int i = 0; i < page_count; ++i) { | 439   for (int i = 0; i < page_count; ++i) { | 
| 440     FPDF_PAGE page = FPDF_LoadPage(doc, i); | 440     FPDF_PAGE page = FPDF_LoadPage(doc, i); | 
| 441     if (!page) { | 441     if (!page) { | 
| 442         bad_pages ++; | 442         bad_pages ++; | 
| 443         continue; | 443         continue; | 
| 444     } | 444     } | 
| 445     FPDF_TEXTPAGE text_page = FPDFText_LoadPage(page); | 445     FPDF_TEXTPAGE text_page = FPDFText_LoadPage(page); | 
| 446     FORM_OnAfterLoadPage(page, form); | 446     FORM_OnAfterLoadPage(page, form); | 
| 447     FORM_DoPageAAction(page, form, FPDFPAGE_AACTION_OPEN); | 447     FORM_DoPageAAction(page, form, FPDFPAGE_AACTION_OPEN); | 
| 448 | 448 | 
| 449     int width = static_cast<int>(FPDF_GetPageWidth(page)); | 449     double scale = 1.0; | 
| 450     int height = static_cast<int>(FPDF_GetPageHeight(page)); |  | 
| 451     if (!options.scale_factor_as_string.empty()) { | 450     if (!options.scale_factor_as_string.empty()) { | 
| 452       double scale = 1.0; |  | 
| 453       std::stringstream(options.scale_factor_as_string) >> scale; | 451       std::stringstream(options.scale_factor_as_string) >> scale; | 
| 454       width *= scale; |  | 
| 455       height *= scale; |  | 
| 456     } | 452     } | 
|  | 453     int width = static_cast<int>(FPDF_GetPageWidth(page) * scale); | 
|  | 454     int height = static_cast<int>(FPDF_GetPageHeight(page) * scale); | 
| 457 | 455 | 
| 458     FPDF_BITMAP bitmap = FPDFBitmap_Create(width, height, 0); | 456     FPDF_BITMAP bitmap = FPDFBitmap_Create(width, height, 0); | 
| 459     FPDFBitmap_FillRect(bitmap, 0, 0, width, height, 0xFFFFFFFF); | 457     FPDFBitmap_FillRect(bitmap, 0, 0, width, height, 0xFFFFFFFF); | 
| 460     FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, 0); | 458     FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, 0); | 
| 461     rendered_pages ++; | 459     rendered_pages ++; | 
| 462 | 460 | 
| 463     FPDF_FFLDraw(form, bitmap, page, 0, 0, width, height, 0, 0); | 461     FPDF_FFLDraw(form, bitmap, page, 0, 0, width, height, 0, 0); | 
| 464     int stride = FPDFBitmap_GetStride(bitmap); | 462     int stride = FPDFBitmap_GetStride(bitmap); | 
| 465     const char* buffer = | 463     const char* buffer = | 
| 466         reinterpret_cast<const char*>(FPDFBitmap_GetBuffer(bitmap)); | 464         reinterpret_cast<const char*>(FPDFBitmap_GetBuffer(bitmap)); | 
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 553     RenderPdf(filename, file_contents, file_length, options); | 551     RenderPdf(filename, file_contents, file_length, options); | 
| 554     free(file_contents); | 552     free(file_contents); | 
| 555   } | 553   } | 
| 556 | 554 | 
| 557   FPDF_DestroyLibrary(); | 555   FPDF_DestroyLibrary(); | 
| 558   v8::V8::ShutdownPlatform(); | 556   v8::V8::ShutdownPlatform(); | 
| 559   delete platform; | 557   delete platform; | 
| 560 | 558 | 
| 561   return 0; | 559   return 0; | 
| 562 } | 560 } | 
| OLD | NEW | 
|---|