Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1759)

Unified Diff: experimental/PdfViewer/SkPdfRenderer.h

Issue 18435007: pdf viewer: refactor and fix a bug (SkPdfobject should not reset on destruct) (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « experimental/PdfViewer/SkPdfParser.cpp ('k') | experimental/PdfViewer/SkPdfRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « experimental/PdfViewer/SkPdfParser.cpp ('k') | experimental/PdfViewer/SkPdfRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698