| 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() : fAA.isRect(); | 92 return fIsBW ? fBW.isRect() : false; |
| 93 } | 93 } |
| 94 | 94 |
| 95 bool updateCacheAndReturnNonEmpty(bool detectAARect = true) { | 95 bool updateCacheAndReturnNonEmpty() { |
| 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 | |
| 105 fIsRect = this->computeIsRect(); | 97 fIsRect = this->computeIsRect(); |
| 106 return !fIsEmpty; | 98 return !fIsEmpty; |
| 107 } | 99 } |
| 108 | 100 |
| 109 void convertToAA(); | 101 void convertToAA(); |
| 110 }; | 102 }; |
| 111 | 103 |
| 112 class SkAutoRasterClipValidate : SkNoncopyable { | 104 class SkAutoRasterClipValidate : SkNoncopyable { |
| 113 public: | 105 public: |
| 114 SkAutoRasterClipValidate(const SkRasterClip& rc) : fRC(rc) { | 106 SkAutoRasterClipValidate(const SkRasterClip& rc) : fRC(rc) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 154 |
| 163 private: | 155 private: |
| 164 SkRegion fBWRgn; | 156 SkRegion fBWRgn; |
| 165 SkAAClipBlitter fAABlitter; | 157 SkAAClipBlitter fAABlitter; |
| 166 // what we return | 158 // what we return |
| 167 const SkRegion* fClipRgn; | 159 const SkRegion* fClipRgn; |
| 168 SkBlitter* fBlitter; | 160 SkBlitter* fBlitter; |
| 169 }; | 161 }; |
| 170 | 162 |
| 171 #endif | 163 #endif |
| OLD | NEW |