OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 #include "SkCanvas.h" | 7 #include "SkCanvas.h" |
8 #include "SkDocument.h" | 8 #include "SkDocument.h" |
9 #include "SkForceLinking.h" | 9 #include "SkForceLinking.h" |
10 #include "SkGraphics.h" | 10 #include "SkGraphics.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 DEFINE_bool(cachePages, false, "Use a PageCachingDocument."); | 24 DEFINE_bool(cachePages, false, "Use a PageCachingDocument."); |
25 DEFINE_bool(nullCanvas, true, "Render to a SkNullCanvas as a control."); | 25 DEFINE_bool(nullCanvas, true, "Render to a SkNullCanvas as a control."); |
26 | 26 |
27 __SK_FORCE_IMAGE_DECODER_LINKING; | 27 __SK_FORCE_IMAGE_DECODER_LINKING; |
28 | 28 |
29 namespace { | 29 namespace { |
30 class NullWStream : public SkWStream { | 30 class NullWStream : public SkWStream { |
31 public: | 31 public: |
32 NullWStream() : fBytesWritten(0) { | 32 NullWStream() : fBytesWritten(0) { |
33 } | 33 } |
34 bool write(const void*, size_t size) SK_OVERRIDE { | 34 bool write(const void*, size_t size) override { |
35 fBytesWritten += size; | 35 fBytesWritten += size; |
36 return true; | 36 return true; |
37 } | 37 } |
38 size_t bytesWritten() const SK_OVERRIDE { | 38 size_t bytesWritten() const override { |
39 return fBytesWritten; | 39 return fBytesWritten; |
40 } | 40 } |
41 size_t fBytesWritten; | 41 size_t fBytesWritten; |
42 }; | 42 }; |
43 | 43 |
44 SkDocument* CreatePDFDocument(SkWStream* out) { | 44 SkDocument* CreatePDFDocument(SkWStream* out) { |
45 if (FLAGS_cachePages) { | 45 if (FLAGS_cachePages) { |
46 return CreatePageCachingDocument(out); | 46 return CreatePageCachingDocument(out); |
47 } else { | 47 } else { |
48 return SkDocument::CreatePDF(out); | 48 return SkDocument::CreatePDF(out); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 } | 126 } |
127 if (!FLAGS_nullCanvas) { | 127 if (!FLAGS_nullCanvas) { |
128 pdfDocument->close(); | 128 pdfDocument->close(); |
129 pdfDocument.reset(NULL); | 129 pdfDocument.reset(NULL); |
130 } | 130 } |
131 printf(SK_SIZE_T_SPECIFIER "\t%4d\n", | 131 printf(SK_SIZE_T_SPECIFIER "\t%4d\n", |
132 inputStream.getLength(), | 132 inputStream.getLength(), |
133 sk_tools::getMaxResidentSetSizeMB()); | 133 sk_tools::getMaxResidentSetSizeMB()); |
134 return 0; | 134 return 0; |
135 } | 135 } |
OLD | NEW |