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

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

Issue 13895006: Expand modulate, add, subtract, extract component glsl helpers. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « gyp/gpu.gypi ('k') | include/gpu/GrTypesPriv.h » ('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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 kB_GrColorComponentFlag = 1 << (GrColor_SHIFT_B / 8), 77 kB_GrColorComponentFlag = 1 << (GrColor_SHIFT_B / 8),
78 kA_GrColorComponentFlag = 1 << (GrColor_SHIFT_A / 8), 78 kA_GrColorComponentFlag = 1 << (GrColor_SHIFT_A / 8),
79 79
80 kRGB_GrColorComponentFlags = (kR_GrColorComponentFlag | kG_GrColorComponentF lag | 80 kRGB_GrColorComponentFlags = (kR_GrColorComponentFlag | kG_GrColorComponentF lag |
81 kB_GrColorComponentFlag), 81 kB_GrColorComponentFlag),
82 82
83 kRGBA_GrColorComponentFlags = (kR_GrColorComponentFlag | kG_GrColorComponent Flag | 83 kRGBA_GrColorComponentFlags = (kR_GrColorComponentFlag | kG_GrColorComponent Flag |
84 kB_GrColorComponentFlag | kA_GrColorComponent Flag) 84 kB_GrColorComponentFlag | kA_GrColorComponent Flag)
85 }; 85 };
86 86
87 static inline char GrColorComponentFlagToChar(GrColorComponentFlags component) {
88 GrAssert(GrIsPow2(component));
89 switch (component) {
90 case kR_GrColorComponentFlag:
91 return 'r';
92 case kG_GrColorComponentFlag:
93 return 'g';
94 case kB_GrColorComponentFlag:
95 return 'b';
96 case kA_GrColorComponentFlag:
97 return 'a';
98 default:
99 GrCrash("Invalid color component flag.");
100 return '\0';
101 }
102 }
103
87 static inline uint32_t GrPixelConfigComponentMask(GrPixelConfig config) { 104 static inline uint32_t GrPixelConfigComponentMask(GrPixelConfig config) {
88 GrAssert(config >= 0 && config < kGrPixelConfigCnt); 105 GrAssert(config >= 0 && config < kGrPixelConfigCnt);
89 static const uint32_t kFlags[] = { 106 static const uint32_t kFlags[] = {
90 0, // kUnknown_GrPixelConfig 107 0, // kUnknown_GrPixelConfig
91 kA_GrColorComponentFlag, // kAlpha_8_GrPixelConfig 108 kA_GrColorComponentFlag, // kAlpha_8_GrPixelConfig
92 kRGBA_GrColorComponentFlags, // kIndex_8_GrPixelConfig 109 kRGBA_GrColorComponentFlags, // kIndex_8_GrPixelConfig
93 kRGB_GrColorComponentFlags, // kRGB_565_GrPixelConfig 110 kRGB_GrColorComponentFlags, // kRGB_565_GrPixelConfig
94 kRGBA_GrColorComponentFlags, // kRGBA_4444_GrPixelConfig 111 kRGBA_GrColorComponentFlags, // kRGBA_4444_GrPixelConfig
95 kRGBA_GrColorComponentFlags, // kRGBA_8888_GrPixelConfig 112 kRGBA_GrColorComponentFlags, // kRGBA_8888_GrPixelConfig
96 kRGBA_GrColorComponentFlags, // kBGRA_8888_GrPixelConfig 113 kRGBA_GrColorComponentFlags, // kBGRA_8888_GrPixelConfig
97 }; 114 };
98 return kFlags[config]; 115 return kFlags[config];
99 116
100 GR_STATIC_ASSERT(0 == kUnknown_GrPixelConfig); 117 GR_STATIC_ASSERT(0 == kUnknown_GrPixelConfig);
101 GR_STATIC_ASSERT(1 == kAlpha_8_GrPixelConfig); 118 GR_STATIC_ASSERT(1 == kAlpha_8_GrPixelConfig);
102 GR_STATIC_ASSERT(2 == kIndex_8_GrPixelConfig); 119 GR_STATIC_ASSERT(2 == kIndex_8_GrPixelConfig);
103 GR_STATIC_ASSERT(3 == kRGB_565_GrPixelConfig); 120 GR_STATIC_ASSERT(3 == kRGB_565_GrPixelConfig);
104 GR_STATIC_ASSERT(4 == kRGBA_4444_GrPixelConfig); 121 GR_STATIC_ASSERT(4 == kRGBA_4444_GrPixelConfig);
105 GR_STATIC_ASSERT(5 == kRGBA_8888_GrPixelConfig); 122 GR_STATIC_ASSERT(5 == kRGBA_8888_GrPixelConfig);
106 GR_STATIC_ASSERT(6 == kBGRA_8888_GrPixelConfig); 123 GR_STATIC_ASSERT(6 == kBGRA_8888_GrPixelConfig);
107 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFlags) == kGrPixelConfigCnt); 124 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFlags) == kGrPixelConfigCnt);
108 } 125 }
109 126
110 #endif 127 #endif
OLDNEW
« no previous file with comments | « gyp/gpu.gypi ('k') | include/gpu/GrTypesPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698