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

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

Issue 787713002: Fix GrUnPreMulColor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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 | no next file » | 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698