aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/PdfViewer/inc/SkPdfContext.h
blob: cd6eba22097e0200d4758687e81ea6cae91f7dd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 * Copyright 2013 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkPdfContext_DEFINED
#define SkPdfContext_DEFINED

#include "SkMatrix.h"
#include "SkPdfGraphicsState.h"
#include "SkPdfNativeTokenizer.h"
#include "SkTDStackNester.h"
#include "SkTypes.h"

class SkCanvas;
class SkPdfNativeDoc;
class SkPdfNativeObject;

/**
 *   The context of the drawing. The document we draw from, the current stack of
 *   objects, ...
 */
class SkPdfContext : SkNoncopyable {
public:
    // FIXME (scroggo): Add functions for accessing these.
    SkTDStackNester<SkPdfNativeObject*>  fObjectStack;
    SkTDStackNester<SkPdfGraphicsState>  fStateStack;
    SkPdfGraphicsState              fGraphicsState;
    SkPdfNativeDoc*                 fPdfDoc;
    SkMatrix                        fOriginalMatrix;

    // Does not take ownership of the doc.
    explicit SkPdfContext(SkPdfNativeDoc* doc);

    /**
     *  Parse the stream and draw its commands to the canvas.
     *  FIXME (scroggo): May not be the best place for this, but leaving here
     *  for now, since it uses SkPdfContext's members.
     */
    void parseStream(SkPdfNativeObject* stream, SkCanvas* canvas);

private:
    // FIXME (scroggo): Is this the right place for the allocator?
    SkPdfAllocator fTmpPageAllocator;
};
#endif // SkPdfContext_DEFINED