• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2014 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 SkCanvasPriv_DEFINED
9 #define SkCanvasPriv_DEFINED
10 
11 #include "SkCanvas.h"
12 
13 class SkReadBuffer;
14 class SkWriteBuffer;
15 
16 class SkAutoCanvasMatrixPaint : SkNoncopyable {
17 public:
18     SkAutoCanvasMatrixPaint(SkCanvas*, const SkMatrix*, const SkPaint*, const SkRect& bounds);
19     ~SkAutoCanvasMatrixPaint();
20 
21 private:
22     SkCanvas*   fCanvas;
23     int         fSaveCount;
24 };
25 
26 class SkCanvasPriv {
27 public:
28     enum {
29         kDontClipToLayer_SaveLayerFlag = SkCanvas::kDontClipToLayer_PrivateSaveLayerFlag,
30     };
31 
32     // The lattice has pointers directly into the readbuffer
33     static bool ReadLattice(SkReadBuffer&, SkCanvas::Lattice*);
34 
35     static void WriteLattice(SkWriteBuffer&, const SkCanvas::Lattice&);
36 
37     // return the byte-size of the lattice, even if the buffer is null
38     // storage must be 4-byte aligned
39     static size_t WriteLattice(void* storage, const SkCanvas::Lattice&);
40 
41     static SkCanvas::SaveLayerFlags LegacySaveFlagsToSaveLayerFlags(uint32_t legacySaveFlags);
42 
SaveBehind(SkCanvas * canvas,const SkRect * subset)43     static int SaveBehind(SkCanvas* canvas, const SkRect* subset) {
44         return canvas->only_axis_aligned_saveBehind(subset);
45     }
46 };
47 
48 #endif
49