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" |
11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
12 #include "SkDevice.h" | 12 #include "SkDevice.h" |
13 #include "SkForceLinking.h" | |
14 #include "SkGraphics.h" | 13 #include "SkGraphics.h" |
15 #include "SkImageDecoder.h" | 14 #include "SkImageDecoder.h" |
16 #include "SkImageEncoder.h" | 15 #include "SkImageEncoder.h" |
17 #include "SkOSFile.h" | 16 #include "SkOSFile.h" |
18 #include "SkPicture.h" | 17 #include "SkPicture.h" |
19 #include "SkPdfFont.h" | 18 #include "SkPdfFont.h" |
20 #include "SkPdfGraphicsState.h" | 19 #include "SkPdfGraphicsState.h" |
21 #include "SkPdfHeaders_autogen.h" | 20 #include "SkPdfHeaders_autogen.h" |
22 #include "SkPdfMapper_autogen.h" | 21 #include "SkPdfMapper_autogen.h" |
23 #include "SkPdfNativeTokenizer.h" | 22 #include "SkPdfNativeTokenizer.h" |
24 #include "SkPdfRenderer.h" | 23 #include "SkPdfRenderer.h" |
25 #include "SkPdfReporter.h" | 24 #include "SkPdfReporter.h" |
26 #include "SkPdfTokenLooper.h" | 25 #include "SkPdfTokenLooper.h" |
27 #include "SkPdfUtils.h" | 26 #include "SkPdfUtils.h" |
28 #include "SkStream.h" | 27 #include "SkStream.h" |
29 #include "SkTypeface.h" | 28 #include "SkTypeface.h" |
30 #include "SkTArray.h" | 29 #include "SkTArray.h" |
31 #include "SkTDict.h" | 30 #include "SkTDict.h" |
32 | 31 |
33 // TODO(edisonn): #ifdef these ones, as they are used only for debugging. | 32 // TODO(edisonn): #ifdef these ones, as they are used only for debugging. |
34 extern "C" SkPdfContext* gPdfContext; | 33 extern "C" SkPdfContext* gPdfContext; |
35 | 34 |
36 __SK_FORCE_IMAGE_DECODER_LINKING; | |
37 | |
38 // TODO(edisonn): tool, show what objects were read during rendering - will help
to identify | 35 // TODO(edisonn): tool, show what objects were read during rendering - will help
to identify |
39 // features with incomplete implementation | 36 // features with incomplete implementation |
40 // TODO(edisonn): security - validate all the user input, all pdf! | 37 // TODO(edisonn): security - validate all the user input, all pdf! |
41 // TODO(edisonn): testability -add option to render without text, or only render
text | 38 // TODO(edisonn): testability -add option to render without text, or only render
text |
42 | 39 |
43 // Helper macros to load variables from stack, and automatically check their typ
e. | 40 // Helper macros to load variables from stack, and automatically check their typ
e. |
44 #define EXPECT_OPERANDS(name,pdfContext,n) \ | 41 #define EXPECT_OPERANDS(name,pdfContext,n) \ |
45 bool __failed = pdfContext->fObjectStack.count() < n; \ | 42 bool __failed = pdfContext->fObjectStack.count() < n; \ |
46 SkPdfREPORTCODE(const char* __operator_name = name); \ | 43 SkPdfREPORTCODE(const char* __operator_name = name); \ |
47 SkPdfREPORTCODE((void)__operator_name); \ | 44 SkPdfREPORTCODE((void)__operator_name); \ |
(...skipping 2858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2906 | 2903 |
2907 rect = SkRect::MakeWH(width, height); | 2904 rect = SkRect::MakeWH(width, height); |
2908 | 2905 |
2909 setup_bitmap(output, SkScalarCeilToInt(width), SkScalarCeilToInt(height)); | 2906 setup_bitmap(output, SkScalarCeilToInt(width), SkScalarCeilToInt(height)); |
2910 | 2907 |
2911 SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (*output))); | 2908 SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (*output))); |
2912 SkCanvas canvas(device); | 2909 SkCanvas canvas(device); |
2913 | 2910 |
2914 return renderer->renderPage(page, &canvas, rect); | 2911 return renderer->renderPage(page, &canvas, rect); |
2915 } | 2912 } |
OLD | NEW |