Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: src/core/SkRasterClip.h

Issue 445233006: add isRect() check to AAClip, to detect if a soft-clip is really just an irect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add comment Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkAAClip.cpp ('k') | src/core/SkRasterClip.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/core/SkAAClip.cpp ('k') | src/core/SkRasterClip.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698