edisonn@google.com | 222382b | 2013-07-10 22:33:10 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2013 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | |
edisonn@google.com | 15b1118 | 2013-07-11 14:43:15 +0000 | [diff] [blame] | 9 | #ifndef SkPdfRenderer_DEFINED |
| 10 | #define SkPdfRenderer_DEFINED |
edisonn@google.com | 222382b | 2013-07-10 22:33:10 +0000 | [diff] [blame] | 11 | |
| 12 | class SkCanvas; |
| 13 | class SkNativeParsedPDF; |
edisonn@google.com | 444e25a | 2013-07-11 15:20:50 +0000 | [diff] [blame] | 14 | class SkRect; |
edisonn@google.com | 222382b | 2013-07-10 22:33:10 +0000 | [diff] [blame] | 15 | |
| 16 | // TODO(edisonn): move in another file |
| 17 | class SkPdfRenderer : public SkRefCnt { |
| 18 | SkNativeParsedPDF* fPdfDoc; |
| 19 | public: |
| 20 | SkPdfRenderer() : fPdfDoc(NULL) {} |
| 21 | virtual ~SkPdfRenderer() {unload();} |
| 22 | |
| 23 | // TODO(edisonn): add options to render forms, or not |
edisonn@google.com | 444e25a | 2013-07-11 15:20:50 +0000 | [diff] [blame] | 24 | bool renderPage(int page, SkCanvas* canvas, const SkRect& dst) const; |
edisonn@google.com | 222382b | 2013-07-10 22:33:10 +0000 | [diff] [blame] | 25 | |
| 26 | bool load(const SkString inputFileName); |
| 27 | bool loaded() const {return fPdfDoc != NULL;} |
| 28 | int pages() const; |
| 29 | void unload(); |
| 30 | SkRect MediaBox(int page) const; |
edisonn@google.com | 7b328fd | 2013-07-11 12:53:06 +0000 | [diff] [blame] | 31 | size_t bytesUsed() const; |
edisonn@google.com | 222382b | 2013-07-10 22:33:10 +0000 | [diff] [blame] | 32 | }; |
| 33 | |
| 34 | void reportPdfRenderStats(); |
| 35 | |
edisonn@google.com | 15b1118 | 2013-07-11 14:43:15 +0000 | [diff] [blame] | 36 | #endif // SkPdfRenderer_DEFINED |