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

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

Issue 2324553002: Push usage of GrColor4f into OverrideInput (Closed)
Patch Set: Remove TODO comment Created 4 years, 3 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 | include/gpu/GrFragmentProcessor.h » ('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 2010 Google Inc. 3 * Copyright 2010 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 10
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 static GrColor4f FromGrColor(GrColor color) { 188 static GrColor4f FromGrColor(GrColor color) {
189 GrColor4f result; 189 GrColor4f result;
190 GrColorToRGBAFloat(color, result.fRGBA); 190 GrColorToRGBAFloat(color, result.fRGBA);
191 return result; 191 return result;
192 } 192 }
193 193
194 static GrColor4f FromSkColor4f(const SkColor4f& color) { 194 static GrColor4f FromSkColor4f(const SkColor4f& color) {
195 return GrColor4f(color.fR, color.fG, color.fB, color.fA); 195 return GrColor4f(color.fR, color.fG, color.fB, color.fA);
196 } 196 }
197 197
198 bool operator==(const GrColor4f& other) const {
199 return
200 fRGBA[0] == other.fRGBA[0] &&
201 fRGBA[1] == other.fRGBA[1] &&
202 fRGBA[2] == other.fRGBA[2] &&
203 fRGBA[3] == other.fRGBA[3];
204 }
205 bool operator!=(const GrColor4f& other) const {
206 return !(*this == other);
207 }
208
198 GrColor toGrColor() const { 209 GrColor toGrColor() const {
199 return GrColorPackRGBA( 210 return GrColorPackRGBA(
200 SkTPin<unsigned>(static_cast<unsigned>(fRGBA[0] * 255.0f + 0.5f), 0, 255), 211 SkTPin<unsigned>(static_cast<unsigned>(fRGBA[0] * 255.0f + 0.5f), 0, 255),
201 SkTPin<unsigned>(static_cast<unsigned>(fRGBA[1] * 255.0f + 0.5f), 0, 255), 212 SkTPin<unsigned>(static_cast<unsigned>(fRGBA[1] * 255.0f + 0.5f), 0, 255),
202 SkTPin<unsigned>(static_cast<unsigned>(fRGBA[2] * 255.0f + 0.5f), 0, 255), 213 SkTPin<unsigned>(static_cast<unsigned>(fRGBA[2] * 255.0f + 0.5f), 0, 255),
203 SkTPin<unsigned>(static_cast<unsigned>(fRGBA[3] * 255.0f + 0.5f), 0, 255)); 214 SkTPin<unsigned>(static_cast<unsigned>(fRGBA[3] * 255.0f + 0.5f), 0, 255));
204 } 215 }
205 216
206 SkColor4f toSkColor4f() const { 217 SkColor4f toSkColor4f() const {
207 return SkColor4f { fRGBA[0], fRGBA[1], fRGBA[2], fRGBA[3] }; 218 return SkColor4f { fRGBA[0], fRGBA[1], fRGBA[2], fRGBA[3] };
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 GR_STATIC_ASSERT(10 == kLATC_GrPixelConfig); 300 GR_STATIC_ASSERT(10 == kLATC_GrPixelConfig);
290 GR_STATIC_ASSERT(11 == kR11_EAC_GrPixelConfig); 301 GR_STATIC_ASSERT(11 == kR11_EAC_GrPixelConfig);
291 GR_STATIC_ASSERT(12 == kASTC_12x12_GrPixelConfig); 302 GR_STATIC_ASSERT(12 == kASTC_12x12_GrPixelConfig);
292 GR_STATIC_ASSERT(13 == kRGBA_float_GrPixelConfig); 303 GR_STATIC_ASSERT(13 == kRGBA_float_GrPixelConfig);
293 GR_STATIC_ASSERT(14 == kAlpha_half_GrPixelConfig); 304 GR_STATIC_ASSERT(14 == kAlpha_half_GrPixelConfig);
294 GR_STATIC_ASSERT(15 == kRGBA_half_GrPixelConfig); 305 GR_STATIC_ASSERT(15 == kRGBA_half_GrPixelConfig);
295 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFlags) == kGrPixelConfigCnt); 306 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFlags) == kGrPixelConfigCnt);
296 } 307 }
297 308
298 #endif 309 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/GrFragmentProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698