OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |