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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 | 104 |
105 /** Returns an unpremuled version of the GrColor. */ | 105 /** Returns an unpremuled version of the GrColor. */ |
106 static inline GrColor GrUnPreMulColor(GrColor color) { | 106 static inline GrColor GrUnPreMulColor(GrColor color) { |
107 unsigned r = GrColorUnpackR(color); | 107 unsigned r = GrColorUnpackR(color); |
108 unsigned g = GrColorUnpackG(color); | 108 unsigned g = GrColorUnpackG(color); |
109 unsigned b = GrColorUnpackB(color); | 109 unsigned b = GrColorUnpackB(color); |
110 unsigned a = GrColorUnpackA(color); | 110 unsigned a = GrColorUnpackA(color); |
111 SkPMColor colorPM = SkPackARGB32(a, r, g, b); | 111 SkPMColor colorPM = SkPackARGB32(a, r, g, b); |
112 SkColor colorUPM = SkUnPreMultiply::PMColorToColor(colorPM); | 112 SkColor colorUPM = SkUnPreMultiply::PMColorToColor(colorPM); |
113 | 113 |
114 r = SkGetPackedR32(colorUPM); | 114 r = SkColorGetR(colorUPM); |
bsalomon
2014/12/08 20:19:32
GrColorUnpackR, etc?
bsalomon
2014/12/08 20:21:18
Oh i get it, lgtm
| |
115 g = SkGetPackedG32(colorUPM); | 115 g = SkColorGetG(colorUPM); |
116 b = SkGetPackedB32(colorUPM); | 116 b = SkColorGetB(colorUPM); |
117 a = SkGetPackedA32(colorUPM); | 117 a = SkColorGetA(colorUPM); |
118 | 118 |
119 return GrColorPackRGBA(r, g, b, a); | 119 return GrColorPackRGBA(r, g, b, a); |
120 } | 120 } |
121 | 121 |
122 /** | 122 /** |
123 * Flags used for bitfields of color components. They are defined so that the bi t order reflects the | 123 * Flags used for bitfields of color components. They are defined so that the bi t order reflects the |
124 * GrColor shift order. | 124 * GrColor shift order. |
125 */ | 125 */ |
126 enum GrColorComponentFlags { | 126 enum GrColorComponentFlags { |
127 kR_GrColorComponentFlag = 1 << (GrColor_SHIFT_R / 8), | 127 kR_GrColorComponentFlag = 1 << (GrColor_SHIFT_R / 8), |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 GR_STATIC_ASSERT(7 == kETC1_GrPixelConfig); | 182 GR_STATIC_ASSERT(7 == kETC1_GrPixelConfig); |
183 GR_STATIC_ASSERT(8 == kLATC_GrPixelConfig); | 183 GR_STATIC_ASSERT(8 == kLATC_GrPixelConfig); |
184 GR_STATIC_ASSERT(9 == kR11_EAC_GrPixelConfig); | 184 GR_STATIC_ASSERT(9 == kR11_EAC_GrPixelConfig); |
185 GR_STATIC_ASSERT(10 == kASTC_12x12_GrPixelConfig); | 185 GR_STATIC_ASSERT(10 == kASTC_12x12_GrPixelConfig); |
186 GR_STATIC_ASSERT(11 == kRGBA_float_GrPixelConfig); | 186 GR_STATIC_ASSERT(11 == kRGBA_float_GrPixelConfig); |
187 GR_STATIC_ASSERT(12 == kAlpha_half_GrPixelConfig); | 187 GR_STATIC_ASSERT(12 == kAlpha_half_GrPixelConfig); |
188 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFlags) == kGrPixelConfigCnt); | 188 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFlags) == kGrPixelConfigCnt); |
189 } | 189 } |
190 | 190 |
191 #endif | 191 #endif |
OLD | NEW |