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

Side by Side Diff: experimental/PdfViewer/inc/SkPdfTokenLooper.h

Issue 1266093003: Remove experimental/PdfViewer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-03 (Monday) 10:43:56 EDT Created 5 years, 4 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
« no previous file with comments | « experimental/PdfViewer/inc/SkPdfRenderer.h ('k') | experimental/PdfViewer/pdf_viewer_main.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 #ifndef SkPdfTokenLooper_DEFINED
9 #define SkPdfTokenLooper_DEFINED
10
11 #include "SkPdfNativeTokenizer.h"
12 // For SkPdfResult
13 #include "SkPdfUtils.h"
14
15 class SkCanvas;
16 class SkPdfContext;
17
18 /**
19 * An object which reads tokens from a tokenizer and draws it to an SkCanvas.
20 * FIXME (scroggo): Can this be an interface? See http://goo.gl/AXQtkH
21 */
22 class SkPdfTokenLooper {
23 public:
24 /**
25 * Create a looper with no parent.
26 * @param tokenizer SkPdfNativeTokenizer for reading tokens.
27 * @param pdfContext Context for drawing state.
28 * @param canvas Target SkCanvas for drawing.
29 */
30 SkPdfTokenLooper(SkPdfNativeTokenizer* tokenizer,
31 SkPdfContext* pdfContext,
32 SkCanvas* canvas)
33 : fParent(NULL)
34 , fTokenizer(tokenizer)
35 , fPdfContext(pdfContext)
36 , fCanvas(canvas) {}
37
38 /**
39 * Create a looper as a child of parent. It will share the
40 * SkPdfContext, SkPdfTokenizer, and SkCanvas with its parent.
41 */
42 explicit SkPdfTokenLooper(SkPdfTokenLooper* parent)
43 : fParent(parent)
44 , fTokenizer(parent->fTokenizer)
45 , fPdfContext(parent->fPdfContext)
46 , fCanvas(parent->fCanvas) {}
47
48 virtual ~SkPdfTokenLooper() {}
49
50 /**
51 * Consume a token, and draw to fCanvas as directed.
52 */
53 virtual SkPdfResult consumeToken(PdfToken& token) = 0;
54
55 /**
56 * Consume all the tokens this looper can handle.
57 */
58 virtual void loop() = 0;
59
60 protected:
61 // All are unowned pointers.
62 SkPdfTokenLooper* fParent;
63 SkPdfNativeTokenizer* fTokenizer;
64 SkPdfContext* fPdfContext;
65 SkCanvas* fCanvas;
66 };
67
68 #endif // SkPdfTokenLooper_DEFINED
OLDNEW
« no previous file with comments | « experimental/PdfViewer/inc/SkPdfRenderer.h ('k') | experimental/PdfViewer/pdf_viewer_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698