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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 class MatrixClipState : public SkNoncopyable { | 56 class MatrixClipState : public 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 bool preTranslate(SkScalar dx, SkScalar dy) { | 65 void preTranslate(SkScalar dx, SkScalar dy) { |
66 fMatrixID = -1; | 66 fMatrixID = -1; |
67 return fMatrix.preTranslate(dx, dy); | 67 fMatrix.preTranslate(dx, dy); |
68 } | 68 } |
69 | 69 |
70 bool preScale(SkScalar sx, SkScalar sy) { | 70 void preScale(SkScalar sx, SkScalar sy) { |
71 fMatrixID = -1; | 71 fMatrixID = -1; |
72 return fMatrix.preScale(sx, sy); | 72 fMatrix.preScale(sx, sy); |
73 } | 73 } |
74 | 74 |
75 bool preRotate(SkScalar degrees) { | 75 void preRotate(SkScalar degrees) { |
76 fMatrixID = -1; | 76 fMatrixID = -1; |
77 return fMatrix.preRotate(degrees); | 77 fMatrix.preRotate(degrees); |
78 } | 78 } |
79 | 79 |
80 bool preSkew(SkScalar sx, SkScalar sy) { | 80 void preSkew(SkScalar sx, SkScalar sy) { |
81 fMatrixID = -1; | 81 fMatrixID = -1; |
82 return fMatrix.preSkew(sx, sy); | 82 fMatrix.preSkew(sx, sy); |
83 } | 83 } |
84 | 84 |
85 bool preConcat(const SkMatrix& matrix) { | 85 void preConcat(const SkMatrix& matrix) { |
86 fMatrixID = -1; | 86 fMatrixID = -1; |
87 return fMatrix.preConcat(matrix); | 87 fMatrix.preConcat(matrix); |
88 } | 88 } |
89 | 89 |
90 void setMatrix(const SkMatrix& matrix) { | 90 void setMatrix(const SkMatrix& matrix) { |
91 fMatrixID = -1; | 91 fMatrixID = -1; |
92 fMatrix = matrix; | 92 fMatrix = matrix; |
93 } | 93 } |
94 | 94 |
95 int getID(SkMatrixClipStateMgr* mgr) { | 95 int getID(SkMatrixClipStateMgr* mgr) { |
96 if (fMatrixID >= 0) { | 96 if (fMatrixID >= 0) { |
97 return fMatrixID; | 97 return fMatrixID; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 int save(SkCanvas::SaveFlags flags); | 278 int save(SkCanvas::SaveFlags flags); |
279 | 279 |
280 int saveLayer(const SkRect* bounds, const SkPaint* paint, SkCanvas::SaveFlag
s flags); | 280 int saveLayer(const SkRect* bounds, const SkPaint* paint, SkCanvas::SaveFlag
s flags); |
281 | 281 |
282 bool isDrawingToLayer() const { | 282 bool isDrawingToLayer() const { |
283 return fCurMCState->fLayerID > 0; | 283 return fCurMCState->fLayerID > 0; |
284 } | 284 } |
285 | 285 |
286 void restore(); | 286 void restore(); |
287 | 287 |
288 bool translate(SkScalar dx, SkScalar dy) { | 288 void translate(SkScalar dx, SkScalar dy) { |
289 this->call(kMatrix_CallType); | 289 this->call(kMatrix_CallType); |
290 return fCurMCState->fMatrixInfo->preTranslate(dx, dy); | 290 fCurMCState->fMatrixInfo->preTranslate(dx, dy); |
291 } | 291 } |
292 | 292 |
293 bool scale(SkScalar sx, SkScalar sy) { | 293 void scale(SkScalar sx, SkScalar sy) { |
294 this->call(kMatrix_CallType); | 294 this->call(kMatrix_CallType); |
295 return fCurMCState->fMatrixInfo->preScale(sx, sy); | 295 fCurMCState->fMatrixInfo->preScale(sx, sy); |
296 } | 296 } |
297 | 297 |
298 bool rotate(SkScalar degrees) { | 298 void rotate(SkScalar degrees) { |
299 this->call(kMatrix_CallType); | 299 this->call(kMatrix_CallType); |
300 return fCurMCState->fMatrixInfo->preRotate(degrees); | 300 fCurMCState->fMatrixInfo->preRotate(degrees); |
301 } | 301 } |
302 | 302 |
303 bool skew(SkScalar sx, SkScalar sy) { | 303 void skew(SkScalar sx, SkScalar sy) { |
304 this->call(kMatrix_CallType); | 304 this->call(kMatrix_CallType); |
305 return fCurMCState->fMatrixInfo->preSkew(sx, sy); | 305 fCurMCState->fMatrixInfo->preSkew(sx, sy); |
306 } | 306 } |
307 | 307 |
308 bool concat(const SkMatrix& matrix) { | 308 void concat(const SkMatrix& matrix) { |
309 this->call(kMatrix_CallType); | 309 this->call(kMatrix_CallType); |
310 return fCurMCState->fMatrixInfo->preConcat(matrix); | 310 fCurMCState->fMatrixInfo->preConcat(matrix); |
311 } | 311 } |
312 | 312 |
313 void setMatrix(const SkMatrix& matrix) { | 313 void setMatrix(const SkMatrix& matrix) { |
314 this->call(kMatrix_CallType); | 314 this->call(kMatrix_CallType); |
315 fCurMCState->fMatrixInfo->setMatrix(matrix); | 315 fCurMCState->fMatrixInfo->setMatrix(matrix); |
316 } | 316 } |
317 | 317 |
318 bool clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) { | 318 bool clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) { |
319 this->call(SkMatrixClipStateMgr::kClip_CallType); | 319 this->call(SkMatrixClipStateMgr::kClip_CallType); |
320 return fCurMCState->fClipInfo->clipRect(rect, op, doAA, | 320 return fCurMCState->fClipInfo->clipRect(rect, op, doAA, |
(...skipping 84 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 |