| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 | 7 |
| 8 #ifndef SkRasterClip_DEFINED | 8 #ifndef SkRasterClip_DEFINED |
| 9 #define SkRasterClip_DEFINED | 9 #define SkRasterClip_DEFINED |
| 10 | 10 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 bool fIsBW; | 82 bool fIsBW; |
| 83 // these 2 are caches based on querying the right obj based on fIsBW | 83 // these 2 are caches based on querying the right obj based on fIsBW |
| 84 bool fIsEmpty; | 84 bool fIsEmpty; |
| 85 bool fIsRect; | 85 bool fIsRect; |
| 86 | 86 |
| 87 bool computeIsEmpty() const { | 87 bool computeIsEmpty() const { |
| 88 return fIsBW ? fBW.isEmpty() : fAA.isEmpty(); | 88 return fIsBW ? fBW.isEmpty() : fAA.isEmpty(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 bool computeIsRect() const { | 91 bool computeIsRect() const { |
| 92 return fIsBW ? fBW.isRect() : false; | 92 return fIsBW ? fBW.isRect() : fAA.isRect(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 bool updateCacheAndReturnNonEmpty() { | 95 bool updateCacheAndReturnNonEmpty(bool detectAARect = true) { |
| 96 fIsEmpty = this->computeIsEmpty(); | 96 fIsEmpty = this->computeIsEmpty(); |
| 97 |
| 98 // detect that our computed AA is really just a (hard-edged) rect |
| 99 if (detectAARect && !fIsEmpty && !fIsBW && fAA.isRect()) { |
| 100 fBW.setRect(fAA.getBounds()); |
| 101 fAA.setEmpty(); // don't need this guy anymore |
| 102 fIsBW = true; |
| 103 } |
| 104 |
| 97 fIsRect = this->computeIsRect(); | 105 fIsRect = this->computeIsRect(); |
| 98 return !fIsEmpty; | 106 return !fIsEmpty; |
| 99 } | 107 } |
| 100 | 108 |
| 101 void convertToAA(); | 109 void convertToAA(); |
| 102 }; | 110 }; |
| 103 | 111 |
| 104 class SkAutoRasterClipValidate : SkNoncopyable { | 112 class SkAutoRasterClipValidate : SkNoncopyable { |
| 105 public: | 113 public: |
| 106 SkAutoRasterClipValidate(const SkRasterClip& rc) : fRC(rc) { | 114 SkAutoRasterClipValidate(const SkRasterClip& rc) : fRC(rc) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 162 |
| 155 private: | 163 private: |
| 156 SkRegion fBWRgn; | 164 SkRegion fBWRgn; |
| 157 SkAAClipBlitter fAABlitter; | 165 SkAAClipBlitter fAABlitter; |
| 158 // what we return | 166 // what we return |
| 159 const SkRegion* fClipRgn; | 167 const SkRegion* fClipRgn; |
| 160 SkBlitter* fBlitter; | 168 SkBlitter* fBlitter; |
| 161 }; | 169 }; |
| 162 | 170 |
| 163 #endif | 171 #endif |
| OLD | NEW |