Home | History | Annotate | Download | only in inc
      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 SkPdfContext_DEFINED
      9 #define SkPdfContext_DEFINED
     10 
     11 #include "SkMatrix.h"
     12 #include "SkPdfGraphicsState.h"
     13 #include "SkPdfNativeTokenizer.h"
     14 #include "SkTDStackNester.h"
     15 #include "SkTypes.h"
     16 
     17 class SkCanvas;
     18 class SkPdfNativeDoc;
     19 class SkPdfNativeObject;
     20 
     21 /**
     22  *   The context of the drawing. The document we draw from, the current stack of
     23  *   objects, ...
     24  */
     25 class SkPdfContext : SkNoncopyable {
     26 public:
     27     // FIXME (scroggo): Add functions for accessing these.
     28     SkTDStackNester<SkPdfNativeObject*>  fObjectStack;
     29     SkTDStackNester<SkPdfGraphicsState>  fStateStack;
     30     SkPdfGraphicsState              fGraphicsState;
     31     SkPdfNativeDoc*                 fPdfDoc;
     32     SkMatrix                        fOriginalMatrix;
     33 
     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;
     47 };
     48 #endif // SkPdfContext_DEFINED
     49