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 #ifndef SkPdfTokenLooper_DEFINED | 8 #ifndef SkPdfTokenLooper_DEFINED |
9 #define SkPdfTokenLooper_DEFINED | 9 #define SkPdfTokenLooper_DEFINED |
10 | 10 |
| 11 #include "SkPdfNativeTokenizer.h" |
| 12 // For SkPdfResult |
| 13 #include "SkPdfUtils.h" |
| 14 |
11 class SkCanvas; | 15 class SkCanvas; |
12 class SkPdfNativeTokenizer; | |
13 class SkPdfContext; | 16 class SkPdfContext; |
14 | 17 |
15 class PdfTokenLooper { | 18 class SkPdfTokenLooper { |
16 protected: | 19 protected: |
17 PdfTokenLooper* fParent; | 20 SkPdfTokenLooper* fParent; |
18 SkPdfNativeTokenizer* fTokenizer; | 21 SkPdfNativeTokenizer* fTokenizer; |
19 SkPdfContext* fPdfContext; | 22 SkPdfContext* fPdfContext; |
20 SkCanvas* fCanvas; | 23 SkCanvas* fCanvas; |
21 | 24 |
22 public: | 25 public: |
23 PdfTokenLooper(PdfTokenLooper* parent, | 26 SkPdfTokenLooper(SkPdfTokenLooper* parent, |
24 SkPdfNativeTokenizer* tokenizer, | 27 SkPdfNativeTokenizer* tokenizer, |
25 SkPdfContext* pdfContext, | 28 SkPdfContext* pdfContext, |
26 SkCanvas* canvas) | 29 SkCanvas* canvas) |
27 : fParent(parent), fTokenizer(tokenizer), fPdfContext(pdfContext), fCanv
as(canvas) {} | 30 : fParent(parent), fTokenizer(tokenizer), fPdfContext(pdfContext), fCanv
as(canvas) {} |
28 | 31 |
29 virtual ~PdfTokenLooper() {} | 32 virtual ~SkPdfTokenLooper() {} |
30 | 33 |
31 virtual SkPdfResult consumeToken(PdfToken& token) = 0; | 34 virtual SkPdfResult consumeToken(PdfToken& token) = 0; |
32 virtual void loop() = 0; | 35 virtual void loop() = 0; |
33 | 36 |
34 void setUp(PdfTokenLooper* parent) { | 37 void setUp(SkPdfTokenLooper* parent) { |
35 fParent = parent; | 38 fParent = parent; |
36 fTokenizer = parent->fTokenizer; | 39 fTokenizer = parent->fTokenizer; |
37 fPdfContext = parent->fPdfContext; | 40 fPdfContext = parent->fPdfContext; |
38 fCanvas = parent->fCanvas; | 41 fCanvas = parent->fCanvas; |
39 } | 42 } |
| 43 }; |
40 | 44 |
41 SkPdfNativeTokenizer* tokenizer() { return fTokenizer; } | 45 // Calls SkPdfNativeTokenizer::readToken, and also does debugging help. |
42 }; | 46 // TODO(edisonn): Pass SkPdfContext and SkCanvas only with the define for instru
mentation. |
| 47 // FIXME (scroggo): This calls tokenizer->readToken(). The rest of its functiona
lity should |
| 48 // be moved to a debugging file. |
| 49 bool readToken(SkPdfNativeTokenizer*, PdfToken*); |
| 50 |
43 #endif // SkPdfTokenLooper_DEFINED | 51 #endif // SkPdfTokenLooper_DEFINED |
OLD | NEW |