| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |