| 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 "SkDocument.h" | 8 #include "SkDocument.h" |
| 9 #include "SkPDFCanon.h" | 9 #include "SkPDFCanon.h" |
| 10 #include "SkPDFDocument.h" | 10 #include "SkPDFDocument.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 return success; | 55 return success; |
| 56 } | 56 } |
| 57 | 57 |
| 58 void onAbort() SK_OVERRIDE { | 58 void onAbort() SK_OVERRIDE { |
| 59 fPageDevices.unrefAll(); | 59 fPageDevices.unrefAll(); |
| 60 fCanon.reset(); | 60 fCanon.reset(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 SkPDFCanon fCanon; | 64 SkPDFCanon fCanon; |
| 65 SkTDArray<SkPDFDevice*> fPageDevices; | 65 SkTDArray<const SkPDFDevice*> fPageDevices; |
| 66 SkAutoTUnref<SkCanvas> fCanvas; | 66 SkAutoTUnref<SkCanvas> fCanvas; |
| 67 SkScalar fRasterDpi; | 67 SkScalar fRasterDpi; |
| 68 }; | 68 }; |
| 69 } // namespace | 69 } // namespace |
| 70 /////////////////////////////////////////////////////////////////////////////// | 70 /////////////////////////////////////////////////////////////////////////////// |
| 71 | 71 |
| 72 SkDocument* SkDocument::CreatePDF(SkWStream* stream, SkScalar dpi) { | 72 SkDocument* SkDocument::CreatePDF(SkWStream* stream, SkScalar dpi) { |
| 73 return stream ? SkNEW_ARGS(SkDocument_PDF, (stream, NULL, dpi)) : NULL; | 73 return stream ? SkNEW_ARGS(SkDocument_PDF, (stream, NULL, dpi)) : NULL; |
| 74 } | 74 } |
| 75 | 75 |
| 76 static void delete_wstream(SkWStream* stream, bool aborted) { | 76 static void delete_wstream(SkWStream* stream, bool aborted) { |
| 77 SkDELETE(stream); | 77 SkDELETE(stream); |
| 78 } | 78 } |
| 79 | 79 |
| 80 SkDocument* SkDocument::CreatePDF(const char path[], SkScalar dpi) { | 80 SkDocument* SkDocument::CreatePDF(const char path[], SkScalar dpi) { |
| 81 SkFILEWStream* stream = SkNEW_ARGS(SkFILEWStream, (path)); | 81 SkFILEWStream* stream = SkNEW_ARGS(SkFILEWStream, (path)); |
| 82 if (!stream->isValid()) { | 82 if (!stream->isValid()) { |
| 83 SkDELETE(stream); | 83 SkDELETE(stream); |
| 84 return NULL; | 84 return NULL; |
| 85 } | 85 } |
| 86 return SkNEW_ARGS(SkDocument_PDF, (stream, delete_wstream, dpi)); | 86 return SkNEW_ARGS(SkDocument_PDF, (stream, delete_wstream, dpi)); |
| 87 } | 87 } |
| OLD | NEW |