OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 #ifndef SkMatrixClipStateMgr_DEFINED | 7 #ifndef SkMatrixClipStateMgr_DEFINED |
8 #define SkMatrixClipStateMgr_DEFINED | 8 #define SkMatrixClipStateMgr_DEFINED |
9 | 9 |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 // The SkMatrixClipStateMgr works by intercepting all the save*, restore, clip*, | 47 // The SkMatrixClipStateMgr works by intercepting all the save*, restore, clip*, |
48 // and matrix calls sent to SkCanvas in order to track the current matrix/clip | 48 // and matrix calls sent to SkCanvas in order to track the current matrix/clip |
49 // state. All the other canvas calls get funnelled into a generic "call" entry | 49 // state. All the other canvas calls get funnelled into a generic "call" entry |
50 // point that signals that a state block is required. | 50 // point that signals that a state block is required. |
51 class SkMatrixClipStateMgr { | 51 class SkMatrixClipStateMgr { |
52 public: | 52 public: |
53 static const int32_t kIdentityWideOpenStateID = 0; | 53 static const int32_t kIdentityWideOpenStateID = 0; |
54 static const int kIdentityMatID = 0; | 54 static const int kIdentityMatID = 0; |
55 | 55 |
56 class MatrixClipState : public SkNoncopyable { | 56 class MatrixClipState : SkNoncopyable { |
57 public: | 57 public: |
58 class MatrixInfo { | 58 class MatrixInfo { |
59 public: | 59 public: |
60 void reset() { | 60 void reset() { |
61 fMatrixID = kIdentityMatID; | 61 fMatrixID = kIdentityMatID; |
62 fMatrix.reset(); | 62 fMatrix.reset(); |
63 } | 63 } |
64 | 64 |
65 void preTranslate(SkScalar dx, SkScalar dy) { | 65 void preTranslate(SkScalar dx, SkScalar dy) { |
66 fMatrixID = -1; | 66 fMatrixID = -1; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 return fMatrixID; | 101 return fMatrixID; |
102 } | 102 } |
103 | 103 |
104 private: | 104 private: |
105 SkMatrix fMatrix; | 105 SkMatrix fMatrix; |
106 int fMatrixID; | 106 int fMatrixID; |
107 | 107 |
108 typedef SkNoncopyable INHERITED; | 108 typedef SkNoncopyable INHERITED; |
109 }; | 109 }; |
110 | 110 |
111 class ClipInfo : public SkNoncopyable { | 111 class ClipInfo : SkNoncopyable { |
112 public: | 112 public: |
113 ClipInfo() {} | 113 ClipInfo() {} |
114 | 114 |
115 bool clipRect(const SkRect& rect, | 115 bool clipRect(const SkRect& rect, |
116 SkRegion::Op op, | 116 SkRegion::Op op, |
117 bool doAA, | 117 bool doAA, |
118 int matrixID) { | 118 int matrixID) { |
119 ClipOp* newClip = fClips.append(); | 119 ClipOp* newClip = fClips.append(); |
120 newClip->fClipType = kRect_ClipType; | 120 newClip->fClipType = kRect_ClipType; |
121 newClip->fGeom.fRRect.setRect(rect); // storing the clipRect i
n the RRect | 121 newClip->fGeom.fRRect.setRect(rect); // storing the clipRect i
n the RRect |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 #ifdef SK_DEBUG | 405 #ifdef SK_DEBUG |
406 int fActualDepth; | 406 int fActualDepth; |
407 #endif | 407 #endif |
408 | 408 |
409 // save layers are nested within a specific MC state. This stack tracks | 409 // save layers are nested within a specific MC state. This stack tracks |
410 // the nesting MC state's ID as save layers are pushed and popped. | 410 // the nesting MC state's ID as save layers are pushed and popped. |
411 SkTDArray<int> fStateIDStack; | 411 SkTDArray<int> fStateIDStack; |
412 }; | 412 }; |
413 | 413 |
414 #endif | 414 #endif |
OLD | NEW |