scroggo@google.com | d906702 | 2013-11-20 22:33:39 +0000 | [diff] [blame] | 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 | |
scroggo@google.com | d1cf769 | 2013-11-20 22:50:40 +0000 | [diff] [blame] | 8 | #ifndef SkPdfContext_DEFINED |
| 9 | #define SkPdfContext_DEFINED |
| 10 | |
scroggo@google.com | d906702 | 2013-11-20 22:33:39 +0000 | [diff] [blame] | 11 | #include "SkMatrix.h" |
scroggo@google.com | d906702 | 2013-11-20 22:33:39 +0000 | [diff] [blame] | 12 | #include "SkPdfGraphicsState.h" |
scroggo@google.com | 248647c | 2013-12-02 20:18:09 +0000 | [diff] [blame] | 13 | #include "SkPdfNativeTokenizer.h" |
| 14 | #include "SkTDStackNester.h" |
| 15 | #include "SkTypes.h" |
scroggo@google.com | d906702 | 2013-11-20 22:33:39 +0000 | [diff] [blame] | 16 | |
scroggo@google.com | 248647c | 2013-12-02 20:18:09 +0000 | [diff] [blame] | 17 | class SkCanvas; |
scroggo@google.com | d906702 | 2013-11-20 22:33:39 +0000 | [diff] [blame] | 18 | class SkPdfNativeDoc; |
| 19 | class SkPdfNativeObject; |
| 20 | |
scroggo@google.com | 248647c | 2013-12-02 20:18:09 +0000 | [diff] [blame] | 21 | /** |
| 22 | * The context of the drawing. The document we draw from, the current stack of |
| 23 | * objects, ... |
scroggo@google.com | d906702 | 2013-11-20 22:33:39 +0000 | [diff] [blame] | 24 | */ |
commit-bot@chromium.org | e3beb6b | 2014-04-07 19:34:38 +0000 | [diff] [blame^] | 25 | class SkPdfContext : SkNoncopyable { |
scroggo@google.com | d906702 | 2013-11-20 22:33:39 +0000 | [diff] [blame] | 26 | public: |
scroggo@google.com | 248647c | 2013-12-02 20:18:09 +0000 | [diff] [blame] | 27 | // FIXME (scroggo): Add functions for accessing these. |
scroggo@google.com | d906702 | 2013-11-20 22:33:39 +0000 | [diff] [blame] | 28 | SkTDStackNester<SkPdfNativeObject*> fObjectStack; |
| 29 | SkTDStackNester<SkPdfGraphicsState> fStateStack; |
| 30 | SkPdfGraphicsState fGraphicsState; |
| 31 | SkPdfNativeDoc* fPdfDoc; |
scroggo@google.com | d906702 | 2013-11-20 22:33:39 +0000 | [diff] [blame] | 32 | SkMatrix fOriginalMatrix; |
| 33 | |
scroggo@google.com | 248647c | 2013-12-02 20:18:09 +0000 | [diff] [blame] | 34 | // Does not take ownership of the doc. |
| 35 | explicit SkPdfContext(SkPdfNativeDoc* doc); |
| 36 | |
| 37 | /** |
| 38 | * Parse the stream and draw its commands to the canvas. |
| 39 | * FIXME (scroggo): May not be the best place for this, but leaving here |
| 40 | * for now, since it uses SkPdfContext's members. |
| 41 | */ |
| 42 | void parseStream(SkPdfNativeObject* stream, SkCanvas* canvas); |
| 43 | |
| 44 | private: |
| 45 | // FIXME (scroggo): Is this the right place for the allocator? |
| 46 | SkPdfAllocator fTmpPageAllocator; |
scroggo@google.com | d906702 | 2013-11-20 22:33:39 +0000 | [diff] [blame] | 47 | }; |
scroggo@google.com | d1cf769 | 2013-11-20 22:50:40 +0000 | [diff] [blame] | 48 | #endif // SkPdfContext_DEFINED |