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 "SkPdfRenderer.h" | 8 #include "SkPdfRenderer.h" |
9 | 9 |
10 #include "SkBitmapDevice.h" | |
11 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
12 #include "SkColorPriv.h" | 11 #include "SkColorPriv.h" |
13 #include "SkDevice.h" | 12 #include "SkDevice.h" |
14 #include "SkForceLinking.h" | 13 #include "SkForceLinking.h" |
15 #include "SkGraphics.h" | 14 #include "SkGraphics.h" |
16 #include "SkImageDecoder.h" | 15 #include "SkImageDecoder.h" |
17 #include "SkImageEncoder.h" | 16 #include "SkImageEncoder.h" |
18 #include "SkOSFile.h" | 17 #include "SkOSFile.h" |
19 #include "SkPicture.h" | 18 #include "SkPicture.h" |
20 #include "SkPdfFont.h" | 19 #include "SkPdfFont.h" |
(...skipping 2882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2903 | 2902 |
2904 SkRect rect = renderer->MediaBox(page < 0 ? 0 :page); | 2903 SkRect rect = renderer->MediaBox(page < 0 ? 0 :page); |
2905 | 2904 |
2906 SkScalar width = SkScalarMul(rect.width(), SkDoubleToScalar(dpi / 72.0)); | 2905 SkScalar width = SkScalarMul(rect.width(), SkDoubleToScalar(dpi / 72.0)); |
2907 SkScalar height = SkScalarMul(rect.height(), SkDoubleToScalar(dpi / 72.0)); | 2906 SkScalar height = SkScalarMul(rect.height(), SkDoubleToScalar(dpi / 72.0)); |
2908 | 2907 |
2909 rect = SkRect::MakeWH(width, height); | 2908 rect = SkRect::MakeWH(width, height); |
2910 | 2909 |
2911 setup_bitmap(output, SkScalarCeilToInt(width), SkScalarCeilToInt(height)); | 2910 setup_bitmap(output, SkScalarCeilToInt(width), SkScalarCeilToInt(height)); |
2912 | 2911 |
2913 SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (*output))); | 2912 SkCanvas canvas(*output); |
2914 SkCanvas canvas(device); | |
2915 | 2913 |
2916 return renderer->renderPage(page, &canvas, rect); | 2914 return renderer->renderPage(page, &canvas, rect); |
2917 } | 2915 } |
OLD | NEW |