blob: cd6eba22097e0200d4758687e81ea6cae91f7dd0 [file] [log] [blame]
scroggo@google.comd9067022013-11-20 22:33:39 +00001/*
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.comd1cf7692013-11-20 22:50:40 +00008#ifndef SkPdfContext_DEFINED
9#define SkPdfContext_DEFINED
10
scroggo@google.comd9067022013-11-20 22:33:39 +000011#include "SkMatrix.h"
scroggo@google.comd9067022013-11-20 22:33:39 +000012#include "SkPdfGraphicsState.h"
scroggo@google.com248647c2013-12-02 20:18:09 +000013#include "SkPdfNativeTokenizer.h"
14#include "SkTDStackNester.h"
15#include "SkTypes.h"
scroggo@google.comd9067022013-11-20 22:33:39 +000016
scroggo@google.com248647c2013-12-02 20:18:09 +000017class SkCanvas;
scroggo@google.comd9067022013-11-20 22:33:39 +000018class SkPdfNativeDoc;
19class SkPdfNativeObject;
20
scroggo@google.com248647c2013-12-02 20:18:09 +000021/**
22 * The context of the drawing. The document we draw from, the current stack of
23 * objects, ...
scroggo@google.comd9067022013-11-20 22:33:39 +000024 */
commit-bot@chromium.orge3beb6b2014-04-07 19:34:38 +000025class SkPdfContext : SkNoncopyable {
scroggo@google.comd9067022013-11-20 22:33:39 +000026public:
scroggo@google.com248647c2013-12-02 20:18:09 +000027 // FIXME (scroggo): Add functions for accessing these.
scroggo@google.comd9067022013-11-20 22:33:39 +000028 SkTDStackNester<SkPdfNativeObject*> fObjectStack;
29 SkTDStackNester<SkPdfGraphicsState> fStateStack;
30 SkPdfGraphicsState fGraphicsState;
31 SkPdfNativeDoc* fPdfDoc;
scroggo@google.comd9067022013-11-20 22:33:39 +000032 SkMatrix fOriginalMatrix;
33
scroggo@google.com248647c2013-12-02 20:18:09 +000034 // 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
44private:
45 // FIXME (scroggo): Is this the right place for the allocator?
46 SkPdfAllocator fTmpPageAllocator;
scroggo@google.comd9067022013-11-20 22:33:39 +000047};
scroggo@google.comd1cf7692013-11-20 22:50:40 +000048#endif // SkPdfContext_DEFINED