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" | 10 #include "SkBitmapDevice.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 205 |
206 // TODO(edisonn): this will not work in chrome! Find another solution! | 206 // TODO(edisonn): this will not work in chrome! Find another solution! |
207 StringsInit gStringsInit; | 207 StringsInit gStringsInit; |
208 | 208 |
209 // TODO(edisonn): Document SkPdfTokenLooper and subclasses. | 209 // TODO(edisonn): Document SkPdfTokenLooper and subclasses. |
210 class PdfInlineImageLooper : public SkPdfTokenLooper { | 210 class PdfInlineImageLooper : public SkPdfTokenLooper { |
211 public: | 211 public: |
212 explicit PdfInlineImageLooper(SkPdfTokenLooper* parent) | 212 explicit PdfInlineImageLooper(SkPdfTokenLooper* parent) |
213 : INHERITED(parent) {} | 213 : INHERITED(parent) {} |
214 | 214 |
215 SkPdfResult consumeToken(PdfToken& token) SK_OVERRIDE; | 215 SkPdfResult consumeToken(PdfToken& token) override; |
216 void loop() SK_OVERRIDE; | 216 void loop() override; |
217 | 217 |
218 private: | 218 private: |
219 typedef SkPdfTokenLooper INHERITED; | 219 typedef SkPdfTokenLooper INHERITED; |
220 }; | 220 }; |
221 | 221 |
222 class PdfCompatibilitySectionLooper : public SkPdfTokenLooper { | 222 class PdfCompatibilitySectionLooper : public SkPdfTokenLooper { |
223 public: | 223 public: |
224 explicit PdfCompatibilitySectionLooper(SkPdfTokenLooper* parent) | 224 explicit PdfCompatibilitySectionLooper(SkPdfTokenLooper* parent) |
225 : INHERITED (parent) {} | 225 : INHERITED (parent) {} |
226 | 226 |
227 SkPdfResult consumeToken(PdfToken& token) SK_OVERRIDE; | 227 SkPdfResult consumeToken(PdfToken& token) override; |
228 void loop() SK_OVERRIDE; | 228 void loop() override; |
229 | 229 |
230 private: | 230 private: |
231 typedef SkPdfTokenLooper INHERITED; | 231 typedef SkPdfTokenLooper INHERITED; |
232 }; | 232 }; |
233 | 233 |
234 // Utilities | 234 // Utilities |
235 static void setup_bitmap(SkBitmap* bitmap, int width, int height, SkColor color
= SK_ColorWHITE) { | 235 static void setup_bitmap(SkBitmap* bitmap, int width, int height, SkColor color
= SK_ColorWHITE) { |
236 bitmap->allocN32Pixels(width, height); | 236 bitmap->allocN32Pixels(width, height); |
237 bitmap->eraseColor(color); | 237 bitmap->eraseColor(color); |
238 } | 238 } |
(...skipping 2669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2908 | 2908 |
2909 rect = SkRect::MakeWH(width, height); | 2909 rect = SkRect::MakeWH(width, height); |
2910 | 2910 |
2911 setup_bitmap(output, SkScalarCeilToInt(width), SkScalarCeilToInt(height)); | 2911 setup_bitmap(output, SkScalarCeilToInt(width), SkScalarCeilToInt(height)); |
2912 | 2912 |
2913 SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (*output))); | 2913 SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (*output))); |
2914 SkCanvas canvas(device); | 2914 SkCanvas canvas(device); |
2915 | 2915 |
2916 return renderer->renderPage(page, &canvas, rect); | 2916 return renderer->renderPage(page, &canvas, rect); |
2917 } | 2917 } |
OLD | NEW |