Index: experimental/PdfViewer/SkPdfRenderer.h |
=================================================================== |
--- experimental/PdfViewer/SkPdfRenderer.h (revision 9970) |
+++ experimental/PdfViewer/SkPdfRenderer.h (working copy) |
@@ -16,73 +16,26 @@ |
extern "C" SkBitmap* gDumpBitmap; |
extern "C" SkCanvas* gDumpCanvas; |
-// TODO(edisonn): Document PdfTokenLooper and subclasses. |
-class PdfTokenLooper { |
-protected: |
- PdfTokenLooper* fParent; |
- SkPdfNativeTokenizer* fTokenizer; |
- PdfContext* fPdfContext; |
- SkCanvas* fCanvas; |
+class SkCanvas; |
+class SkNativeParsedPDF; |
+// TODO(edisonn): move in another file |
+class SkPdfRenderer : public SkRefCnt { |
+ SkNativeParsedPDF* fPdfDoc; |
public: |
- PdfTokenLooper(PdfTokenLooper* parent, |
- SkPdfNativeTokenizer* tokenizer, |
- PdfContext* pdfContext, |
- SkCanvas* canvas) |
- : fParent(parent), fTokenizer(tokenizer), fPdfContext(pdfContext), fCanvas(canvas) {} |
+ SkPdfRenderer() : fPdfDoc(NULL) {} |
+ virtual ~SkPdfRenderer() {unload();} |
- virtual ~PdfTokenLooper() {} |
+ // TODO(edisonn): add options to render forms, or not |
+ bool renderPage(int page, SkCanvas* canvas) const; |
- virtual PdfResult consumeToken(PdfToken& token) = 0; |
- virtual void loop() = 0; |
- |
- void setUp(PdfTokenLooper* parent) { |
- fParent = parent; |
- fTokenizer = parent->fTokenizer; |
- fPdfContext = parent->fPdfContext; |
- fCanvas = parent->fCanvas; |
- } |
+ bool load(const SkString inputFileName); |
+ bool loaded() const {return fPdfDoc != NULL;} |
+ int pages() const; |
+ void unload(); |
+ SkRect MediaBox(int page) const; |
}; |
-class PdfMainLooper : public PdfTokenLooper { |
-public: |
- PdfMainLooper(PdfTokenLooper* parent, |
- SkPdfNativeTokenizer* tokenizer, |
- PdfContext* pdfContext, |
- SkCanvas* canvas) |
- : PdfTokenLooper(parent, tokenizer, pdfContext, canvas) {} |
- |
- virtual PdfResult consumeToken(PdfToken& token); |
- virtual void loop(); |
-}; |
- |
-class PdfInlineImageLooper : public PdfTokenLooper { |
-public: |
- PdfInlineImageLooper() |
- : PdfTokenLooper(NULL, NULL, NULL, NULL) {} |
- |
- virtual PdfResult consumeToken(PdfToken& token); |
- virtual void loop(); |
- PdfResult done(); |
-}; |
- |
-class PdfCompatibilitySectionLooper : public PdfTokenLooper { |
-public: |
- PdfCompatibilitySectionLooper() |
- : PdfTokenLooper(NULL, NULL, NULL, NULL) {} |
- |
- virtual PdfResult consumeToken(PdfToken& token); |
- virtual void loop(); |
-}; |
- |
-// TODO(edisonn): move in another file |
-class SkPdfViewer : public SkRefCnt { |
-public: |
- |
- bool load(const SkString inputFileName, SkPicture* out); |
- bool write(void*) const { return false; } |
-}; |
- |
void reportPdfRenderStats(); |
#endif // SkPdfParser_DEFINED |