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

Side by Side Diff: include/gpu/GrPaint.h

Issue 2236423002: Inline fast path for GrPaint::isConstantBlendedColor when no color FPs and src-over blend. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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 | « no previous file | src/gpu/GrPaint.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
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 GrPaint_DEFINED 10 #ifndef GrPaint_DEFINED
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 return *this; 160 return *this;
161 } 161 }
162 162
163 /** 163 /**
164 * Returns true if the paint's output color will be constant after blending. If the result is 164 * Returns true if the paint's output color will be constant after blending. If the result is
165 * true, constantColor will be updated to contain the constant color. Note t hat we can conflate 165 * true, constantColor will be updated to contain the constant color. Note t hat we can conflate
166 * coverage and color, so the actual values written to pixels with partial c overage may still 166 * coverage and color, so the actual values written to pixels with partial c overage may still
167 * not seem constant, even if this function returns true. 167 * not seem constant, even if this function returns true.
168 */ 168 */
169 bool isConstantBlendedColor(GrColor* constantColor) const; 169 bool isConstantBlendedColor(GrColor* constantColor) const {
170 GrColor paintColor = this->getColor();
171 if (!fXPFactory && fColorFragmentProcessors.empty()) {
172 if (!GrColorIsOpaque(paintColor)) {
173 return false;
174 }
175 *constantColor = paintColor;
176 return true;
177 }
178 return this->internalIsConstantBlendedColor(paintColor, constantColor);
179 }
170 180
171 private: 181 private:
182 bool internalIsConstantBlendedColor(GrColor paintColor, GrColor* constantCol or) const;
183
172 mutable sk_sp<GrXPFactory> fXPFactory; 184 mutable sk_sp<GrXPFactory> fXPFactory;
173 SkSTArray<4, sk_sp<GrFragmentProcessor>> fColorFragmentProcessors; 185 SkSTArray<4, sk_sp<GrFragmentProcessor>> fColorFragmentProcessors;
174 SkSTArray<2, sk_sp<GrFragmentProcessor>> fCoverageFragmentProcessors; 186 SkSTArray<2, sk_sp<GrFragmentProcessor>> fCoverageFragmentProcessors;
175 187
176 bool fAntiAlias; 188 bool fAntiAlias;
177 bool fDisableOutputConversionToSRGB; 189 bool fDisableOutputConversionToSRGB;
178 bool fAllowSRGBInputs; 190 bool fAllowSRGBInputs;
179 bool fUsesDistanceVectorField; 191 bool fUsesDistanceVectorField;
180 192
181 GrColor4f fColor; 193 GrColor4f fColor;
182 }; 194 };
183 195
184 #endif 196 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698