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

Side by Side Diff: experimental/PdfViewer/pdf_viewer_main.cpp

Issue 70793003: pdfviewer: remove sqrt from the formula computing the scale (DPI is dots per inch, not dots per squ… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkCommandLineFlags.h" 9 #include "SkCommandLineFlags.h"
10 #include "SkDevice.h" 10 #include "SkDevice.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 if (!FLAGS_config.isEmpty() && strcmp(FLAGS_config[0], "nul") == 0) { 133 if (!FLAGS_config.isEmpty() && strcmp(FLAGS_config[0], "nul") == 0) {
134 SkBitmap bitmap; 134 SkBitmap bitmap;
135 SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (bitmap))); 135 SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (bitmap)));
136 SkNulCanvas canvas(device); 136 SkNulCanvas canvas(device);
137 renderer.renderPage(page < 0 ? 0 : page, &canvas, rect); 137 renderer.renderPage(page < 0 ? 0 : page, &canvas, rect);
138 } else { 138 } else {
139 // 8888 139 // 8888
140 SkRect rect = renderer.MediaBox(page < 0 ? 0 :page); 140 SkRect rect = renderer.MediaBox(page < 0 ? 0 :page);
141 141
142 SkBitmap bitmap; 142 SkBitmap bitmap;
143 SkScalar width = SkScalarMul(rect.width(), SkDoubleToScalar(sqrt(FLAGS_ DPI / 72.0))); 143 SkScalar width = SkScalarMul(rect.width(), SkDoubleToScalar(FLAGS_DPI / 72.0));
144 SkScalar height = SkScalarMul(rect.height(), SkDoubleToScalar(sqrt(FLAG S_DPI / 72.0))); 144 SkScalar height = SkScalarMul(rect.height(), SkDoubleToScalar(FLAGS_DPI / 72.0));
145 145
146 rect = SkRect::MakeWH(width, height); 146 rect = SkRect::MakeWH(width, height);
147 147
148 SkColor background = FLAGS_transparentBackground ? SK_ColorTRANSPARENT : SK_ColorWHITE; 148 SkColor background = FLAGS_transparentBackground ? SK_ColorTRANSPARENT : SK_ColorWHITE;
149 149
150 #ifdef PDF_DEBUG_3X 150 #ifdef PDF_DEBUG_3X
151 setup_bitmap(&bitmap, 3 * (int)SkScalarToDouble(width), 3 * (int)SkScala rToDouble(height), 151 setup_bitmap(&bitmap, 3 * (int)SkScalarToDouble(width), 3 * (int)SkScala rToDouble(height),
152 background); 152 background);
153 #else 153 #else
154 setup_bitmap(&bitmap, (int)SkScalarToDouble(width), (int)SkScalarToDoubl e(height), 154 setup_bitmap(&bitmap, (int)SkScalarToDouble(width), (int)SkScalarToDoubl e(height),
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 } 351 }
352 352
353 return 0; 353 return 0;
354 } 354 }
355 355
356 #if !defined SK_BUILD_FOR_IOS 356 #if !defined SK_BUILD_FOR_IOS
357 int main(int argc, char * const argv[]) { 357 int main(int argc, char * const argv[]) {
358 return tool_main(argc, (char**) argv); 358 return tool_main(argc, (char**) argv);
359 } 359 }
360 #endif 360 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698