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

Side by Side Diff: experimental/PdfViewer/SkPdfParser.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « experimental/PdfViewer/SkPdfFont.cpp ('k') | experimental/PdfViewer/SkPdfParser.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
9 #ifndef SkPdfParser_DEFINED
10 #define SkPdfParser_DEFINED
11
12 #include "SkPdfBasics.h"
13 #include "SkPdfNativeTokenizer.h"
14
15 extern "C" PdfContext* gPdfContext;
16 extern "C" SkBitmap* gDumpBitmap;
17 extern "C" SkCanvas* gDumpCanvas;
18
19 // TODO(edisonn): Document PdfTokenLooper and subclasses.
20 class PdfTokenLooper {
21 protected:
22 PdfTokenLooper* fParent;
23 SkPdfNativeTokenizer* fTokenizer;
24 PdfContext* fPdfContext;
25 SkCanvas* fCanvas;
26
27 public:
28 PdfTokenLooper(PdfTokenLooper* parent,
29 SkPdfNativeTokenizer* tokenizer,
30 PdfContext* pdfContext,
31 SkCanvas* canvas)
32 : fParent(parent), fTokenizer(tokenizer), fPdfContext(pdfContext), fCanv as(canvas) {}
33
34 virtual ~PdfTokenLooper() {}
35
36 virtual PdfResult consumeToken(PdfToken& token) = 0;
37 virtual void loop() = 0;
38
39 void setUp(PdfTokenLooper* parent) {
40 fParent = parent;
41 fTokenizer = parent->fTokenizer;
42 fPdfContext = parent->fPdfContext;
43 fCanvas = parent->fCanvas;
44 }
45 };
46
47 class PdfMainLooper : public PdfTokenLooper {
48 public:
49 PdfMainLooper(PdfTokenLooper* parent,
50 SkPdfNativeTokenizer* tokenizer,
51 PdfContext* pdfContext,
52 SkCanvas* canvas)
53 : PdfTokenLooper(parent, tokenizer, pdfContext, canvas) {}
54
55 virtual PdfResult consumeToken(PdfToken& token);
56 virtual void loop();
57 };
58
59 class PdfInlineImageLooper : public PdfTokenLooper {
60 public:
61 PdfInlineImageLooper()
62 : PdfTokenLooper(NULL, NULL, NULL, NULL) {}
63
64 virtual PdfResult consumeToken(PdfToken& token);
65 virtual void loop();
66 PdfResult done();
67 };
68
69 class PdfCompatibilitySectionLooper : public PdfTokenLooper {
70 public:
71 PdfCompatibilitySectionLooper()
72 : PdfTokenLooper(NULL, NULL, NULL, NULL) {}
73
74 virtual PdfResult consumeToken(PdfToken& token);
75 virtual void loop();
76 };
77
78 // TODO(edisonn): move in another file
79 class SkPdfViewer : public SkRefCnt {
80 public:
81
82 bool load(const SkString inputFileName, SkPicture* out);
83 bool write(void*) const { return false; }
84 };
85
86 void reportPdfRenderStats();
87
88 #endif // SkPdfParser_DEFINED
OLDNEW
« no previous file with comments | « experimental/PdfViewer/SkPdfFont.cpp ('k') | experimental/PdfViewer/SkPdfParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698