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

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

Issue 816003002: Add device space skshader GM to test kDevice_GrCoordSet (Closed) Base URL: https://skia.googlesource.com/skia.git@kpos
Patch Set: update 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
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 23 matching lines...) Expand all
34 #else 34 #else
35 #define GrColor_SHIFT_R 0 35 #define GrColor_SHIFT_R 0
36 #define GrColor_SHIFT_G 8 36 #define GrColor_SHIFT_G 8
37 #define GrColor_SHIFT_B 16 37 #define GrColor_SHIFT_B 16
38 #define GrColor_SHIFT_A 24 38 #define GrColor_SHIFT_A 24
39 #endif 39 #endif
40 40
41 /** 41 /**
42 * Pack 4 components (RGBA) into a GrColor int 42 * Pack 4 components (RGBA) into a GrColor int
43 */ 43 */
44 static inline GrColor GrColorPackRGBA(unsigned r, unsigned g, 44 static inline GrColor GrColorPackRGBA(unsigned r, unsigned g, unsigned b, unsign ed a) {
45 unsigned b, unsigned a) {
46 SkASSERT((uint8_t)r == r); 45 SkASSERT((uint8_t)r == r);
47 SkASSERT((uint8_t)g == g); 46 SkASSERT((uint8_t)g == g);
48 SkASSERT((uint8_t)b == b); 47 SkASSERT((uint8_t)b == b);
49 SkASSERT((uint8_t)a == a); 48 SkASSERT((uint8_t)a == a);
50 return (r << GrColor_SHIFT_R) | 49 return (r << GrColor_SHIFT_R) |
51 (g << GrColor_SHIFT_G) | 50 (g << GrColor_SHIFT_G) |
52 (b << GrColor_SHIFT_B) | 51 (b << GrColor_SHIFT_B) |
53 (a << GrColor_SHIFT_A); 52 (a << GrColor_SHIFT_A);
54 } 53 }
55 54
55 /**
56 * Packs a color with an alpha channel replicated across all four channels.
57 */
58 static inline GrColor GrColorPackA4(unsigned a) {
59 SkASSERT((uint8_t)a == a);
60 return (a << GrColor_SHIFT_R) |
61 (a << GrColor_SHIFT_G) |
62 (a << GrColor_SHIFT_B) |
63 (a << GrColor_SHIFT_A);
64 }
65
56 // extract a component (byte) from a GrColor int 66 // extract a component (byte) from a GrColor int
57 67
58 #define GrColorUnpackR(color) (((color) >> GrColor_SHIFT_R) & 0xFF) 68 #define GrColorUnpackR(color) (((color) >> GrColor_SHIFT_R) & 0xFF)
59 #define GrColorUnpackG(color) (((color) >> GrColor_SHIFT_G) & 0xFF) 69 #define GrColorUnpackG(color) (((color) >> GrColor_SHIFT_G) & 0xFF)
60 #define GrColorUnpackB(color) (((color) >> GrColor_SHIFT_B) & 0xFF) 70 #define GrColorUnpackB(color) (((color) >> GrColor_SHIFT_B) & 0xFF)
61 #define GrColorUnpackA(color) (((color) >> GrColor_SHIFT_A) & 0xFF) 71 #define GrColorUnpackA(color) (((color) >> GrColor_SHIFT_A) & 0xFF)
62 72
63 /** 73 /**
64 * Since premultiplied means that alpha >= color, we construct a color with 74 * Since premultiplied means that alpha >= color, we construct a color with
65 * each component==255 and alpha == 0 to be "illegal" 75 * each component==255 and alpha == 0 to be "illegal"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 GR_STATIC_ASSERT(7 == kETC1_GrPixelConfig); 195 GR_STATIC_ASSERT(7 == kETC1_GrPixelConfig);
186 GR_STATIC_ASSERT(8 == kLATC_GrPixelConfig); 196 GR_STATIC_ASSERT(8 == kLATC_GrPixelConfig);
187 GR_STATIC_ASSERT(9 == kR11_EAC_GrPixelConfig); 197 GR_STATIC_ASSERT(9 == kR11_EAC_GrPixelConfig);
188 GR_STATIC_ASSERT(10 == kASTC_12x12_GrPixelConfig); 198 GR_STATIC_ASSERT(10 == kASTC_12x12_GrPixelConfig);
189 GR_STATIC_ASSERT(11 == kRGBA_float_GrPixelConfig); 199 GR_STATIC_ASSERT(11 == kRGBA_float_GrPixelConfig);
190 GR_STATIC_ASSERT(12 == kAlpha_half_GrPixelConfig); 200 GR_STATIC_ASSERT(12 == kAlpha_half_GrPixelConfig);
191 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFlags) == kGrPixelConfigCnt); 201 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFlags) == kGrPixelConfigCnt);
192 } 202 }
193 203
194 #endif 204 #endif
OLDNEW
« gm/dcshader.cpp ('K') | « gyp/gmslides.gypi ('k') | src/core/SkBlitter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698