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

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: add #if SK_SUPPORT_GPU, make FP a non-local class so it can be a template param in c++03. Created 5 years, 11 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 | « gyp/gmslides.gypi ('k') | src/core/SkBlitter.cpp » ('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 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 GR_STATIC_ASSERT(8 == kETC1_GrPixelConfig); 197 GR_STATIC_ASSERT(8 == kETC1_GrPixelConfig);
188 GR_STATIC_ASSERT(9 == kLATC_GrPixelConfig); 198 GR_STATIC_ASSERT(9 == kLATC_GrPixelConfig);
189 GR_STATIC_ASSERT(10 == kR11_EAC_GrPixelConfig); 199 GR_STATIC_ASSERT(10 == kR11_EAC_GrPixelConfig);
190 GR_STATIC_ASSERT(11 == kASTC_12x12_GrPixelConfig); 200 GR_STATIC_ASSERT(11 == kASTC_12x12_GrPixelConfig);
191 GR_STATIC_ASSERT(12 == kRGBA_float_GrPixelConfig); 201 GR_STATIC_ASSERT(12 == kRGBA_float_GrPixelConfig);
192 GR_STATIC_ASSERT(13 == kAlpha_half_GrPixelConfig); 202 GR_STATIC_ASSERT(13 == kAlpha_half_GrPixelConfig);
193 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFlags) == kGrPixelConfigCnt); 203 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFlags) == kGrPixelConfigCnt);
194 } 204 }
195 205
196 #endif 206 #endif
OLDNEW
« no previous file with comments | « gyp/gmslides.gypi ('k') | src/core/SkBlitter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698