OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkCanvas_DEFINED | 10 #ifndef SkCanvas_DEFINED |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 bool doAntiAlias = false); | 374 bool doAntiAlias = false); |
375 | 375 |
376 /** EXPERIMENTAL -- only used for testing | 376 /** EXPERIMENTAL -- only used for testing |
377 Set to false to force clips to be hard, even if doAntiAlias=true is | 377 Set to false to force clips to be hard, even if doAntiAlias=true is |
378 passed to clipRect or clipPath. | 378 passed to clipRect or clipPath. |
379 */ | 379 */ |
380 void setAllowSoftClip(bool allow) { | 380 void setAllowSoftClip(bool allow) { |
381 fAllowSoftClip = allow; | 381 fAllowSoftClip = allow; |
382 } | 382 } |
383 | 383 |
| 384 /** EXPERIMENTAL -- only used for testing |
| 385 Set to simplify clip stack using path ops. |
| 386 */ |
| 387 void setAllowSimplifyClip(bool allow) { |
| 388 fAllowSimplifyClip = allow; |
| 389 } |
| 390 |
384 /** Modify the current clip with the specified region. Note that unlike | 391 /** Modify the current clip with the specified region. Note that unlike |
385 clipRect() and clipPath() which transform their arguments by the current | 392 clipRect() and clipPath() which transform their arguments by the current |
386 matrix, clipRegion() assumes its argument is already in device | 393 matrix, clipRegion() assumes its argument is already in device |
387 coordinates, and so no transformation is performed. | 394 coordinates, and so no transformation is performed. |
388 @param deviceRgn The region to apply to the current clip | 395 @param deviceRgn The region to apply to the current clip |
389 @param op The region op to apply to the current clip | 396 @param op The region op to apply to the current clip |
390 @return true if the canvas' new clip is non-empty | 397 @return true if the canvas' new clip is non-empty |
391 */ | 398 */ |
392 virtual bool clipRegion(const SkRegion& deviceRgn, | 399 virtual bool clipRegion(const SkRegion& deviceRgn, |
393 SkRegion::Op op = SkRegion::kIntersect_Op); | 400 SkRegion::Op op = SkRegion::kIntersect_Op); |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 static void DrawTextDecorations(const SkDraw& draw, const SkPaint& paint, | 1064 static void DrawTextDecorations(const SkDraw& draw, const SkPaint& paint, |
1058 const char text[], size_t byteLength, | 1065 const char text[], size_t byteLength, |
1059 SkScalar x, SkScalar y); | 1066 SkScalar x, SkScalar y); |
1060 | 1067 |
1061 /* These maintain a cache of the clip bounds in local coordinates, | 1068 /* These maintain a cache of the clip bounds in local coordinates, |
1062 (converted to 2s-compliment if floats are slow). | 1069 (converted to 2s-compliment if floats are slow). |
1063 */ | 1070 */ |
1064 mutable SkRectCompareType fLocalBoundsCompareType; | 1071 mutable SkRectCompareType fLocalBoundsCompareType; |
1065 mutable bool fLocalBoundsCompareTypeDirty; | 1072 mutable bool fLocalBoundsCompareTypeDirty; |
1066 bool fAllowSoftClip; | 1073 bool fAllowSoftClip; |
| 1074 bool fAllowSimplifyClip; |
1067 | 1075 |
1068 const SkRectCompareType& getLocalClipBoundsCompareType() const { | 1076 const SkRectCompareType& getLocalClipBoundsCompareType() const { |
1069 if (fLocalBoundsCompareTypeDirty) { | 1077 if (fLocalBoundsCompareTypeDirty) { |
1070 this->computeLocalClipBoundsCompareType(); | 1078 this->computeLocalClipBoundsCompareType(); |
1071 fLocalBoundsCompareTypeDirty = false; | 1079 fLocalBoundsCompareTypeDirty = false; |
1072 } | 1080 } |
1073 return fLocalBoundsCompareType; | 1081 return fLocalBoundsCompareType; |
1074 } | 1082 } |
1075 void computeLocalClipBoundsCompareType() const; | 1083 void computeLocalClipBoundsCompareType() const; |
1076 | 1084 |
| 1085 |
1077 class AutoValidateClip : ::SkNoncopyable { | 1086 class AutoValidateClip : ::SkNoncopyable { |
1078 public: | 1087 public: |
1079 explicit AutoValidateClip(SkCanvas* canvas) : fCanvas(canvas) { | 1088 explicit AutoValidateClip(SkCanvas* canvas) : fCanvas(canvas) { |
1080 fCanvas->validateClip(); | 1089 fCanvas->validateClip(); |
1081 } | 1090 } |
1082 ~AutoValidateClip() { fCanvas->validateClip(); } | 1091 ~AutoValidateClip() { fCanvas->validateClip(); } |
1083 | 1092 |
1084 private: | 1093 private: |
1085 const SkCanvas* fCanvas; | 1094 const SkCanvas* fCanvas; |
1086 }; | 1095 }; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 fCanvas = NULL; | 1132 fCanvas = NULL; |
1124 } | 1133 } |
1125 } | 1134 } |
1126 | 1135 |
1127 private: | 1136 private: |
1128 SkCanvas* fCanvas; | 1137 SkCanvas* fCanvas; |
1129 int fSaveCount; | 1138 int fSaveCount; |
1130 }; | 1139 }; |
1131 | 1140 |
1132 #endif | 1141 #endif |
OLD | NEW |