Merge https://codereview.chromium.org/935663003/ to XFA branch.
authorJohn Abd-El-Malek <jam@chromium.org>
Wed, 25 Feb 2015 19:08:16 +0000 (11:08 -0800)
committerJohn Abd-El-Malek <jam@chromium.org>
Wed, 25 Feb 2015 19:08:16 +0000 (11:08 -0800)
TBR=tsepez@chromium.org

Review URL: https://codereview.chromium.org/946103003

samples/pdfium_test.cc

index 1051594..d861f2f 100644 (file)
@@ -501,14 +501,12 @@ void RenderPdf(const std::string& name, const char* pBuf, size_t len,
     FORM_OnAfterLoadPage(page, form);
     FORM_DoPageAAction(page, form, FPDFPAGE_AACTION_OPEN);
 
-    int width = static_cast<int>(FPDF_GetPageWidth(page));
-    int height = static_cast<int>(FPDF_GetPageHeight(page));
+    double scale = 1.0;
     if (!options.scale_factor_as_string.empty()) {
-      double scale = 1.0;
       std::stringstream(options.scale_factor_as_string) >> scale;
-      width *= scale;
-      height *= scale;
     }
+    int width = static_cast<int>(FPDF_GetPageWidth(page) * scale);
+    int height = static_cast<int>(FPDF_GetPageHeight(page) * scale);
 
     FPDF_BITMAP bitmap = FPDFBitmap_Create(width, height, 0);
     FPDFBitmap_FillRect(bitmap, 0, 0, width, height, 0xFFFFFFFF);