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 13121002: Make GrGLShaderBuilder::TextureSampler extract only required info from GrTextureAccess. (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 | « no previous file | include/gpu/GrEffect.h » ('j') | src/gpu/gl/GrGLShaderBuilder.h » ('J')
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 /** Converts a GrColor to an rgba array of GrGLfloat */ 61 /** Converts a GrColor to an rgba array of GrGLfloat */
62 static inline void GrColorToRGBAFloat(GrColor color, float rgba[4]) { 62 static inline void GrColorToRGBAFloat(GrColor color, float rgba[4]) {
63 static const float ONE_OVER_255 = 1.f / 255.f; 63 static const float ONE_OVER_255 = 1.f / 255.f;
64 rgba[0] = GrColorUnpackR(color) * ONE_OVER_255; 64 rgba[0] = GrColorUnpackR(color) * ONE_OVER_255;
65 rgba[1] = GrColorUnpackG(color) * ONE_OVER_255; 65 rgba[1] = GrColorUnpackG(color) * ONE_OVER_255;
66 rgba[2] = GrColorUnpackB(color) * ONE_OVER_255; 66 rgba[2] = GrColorUnpackB(color) * ONE_OVER_255;
67 rgba[3] = GrColorUnpackA(color) * ONE_OVER_255; 67 rgba[3] = GrColorUnpackA(color) * ONE_OVER_255;
68 } 68 }
69 69
70 /**
71 * Flags used for bitfields of color components. They are defined so that the bi t order reflects the
72 * GrColor shift order.
73 */
74 enum GrColorComponentFlags {
75 kR_GrColorComponentFlag = 1 << (GrColor_SHIFT_R / 8),
76 kG_GrColorComponentFlag = 1 << (GrColor_SHIFT_G / 8),
77 kB_GrColorComponentFlag = 1 << (GrColor_SHIFT_B / 8),
78 kA_GrColorComponentFlag = 1 << (GrColor_SHIFT_A / 8),
79
80 kRGB_GrColorComponentFlags = (kR_GrColorComponentFlag | kG_GrColorComponentF lag |
81 kB_GrColorComponentFlag),
82
83 kRGBA_GrColorComponentFlags = (kR_GrColorComponentFlag | kG_GrColorComponent Flag |
84 kB_GrColorComponentFlag | kA_GrColorComponent Flag)
85 };
86
87 static inline uint32_t GrPixelConfigComponentMask(GrPixelConfig config) {
88 GrAssert(config >= 0 && config < kGrPixelConfigCnt);
89 static const uint32_t kFlags[] = {
90 0, // kUnknown_GrPixelConfig
91 kA_GrColorComponentFlag, // kAlpha_8_GrPixelConfig
92 kRGBA_GrColorComponentFlags, // kIndex_8_GrPixelConfig
93 kRGB_GrColorComponentFlags, // kRGB_565_GrPixelConfig
94 kRGBA_GrColorComponentFlags, // kRGBA_4444_GrPixelConfig
95 kRGBA_GrColorComponentFlags, // kRGBA_8888_GrPixelConfig
96 kRGBA_GrColorComponentFlags, // kBGRA_8888_GrPixelConfig
97 };
98 return kFlags[config];
99
100 GR_STATIC_ASSERT(0 == kUnknown_GrPixelConfig);
101 GR_STATIC_ASSERT(1 == kAlpha_8_GrPixelConfig);
102 GR_STATIC_ASSERT(2 == kIndex_8_GrPixelConfig);
103 GR_STATIC_ASSERT(3 == kRGB_565_GrPixelConfig);
104 GR_STATIC_ASSERT(4 == kRGBA_4444_GrPixelConfig);
105 GR_STATIC_ASSERT(5 == kRGBA_8888_GrPixelConfig);
106 GR_STATIC_ASSERT(6 == kBGRA_8888_GrPixelConfig);
107 GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFlags) == kGrPixelConfigCnt);
108 }
109
70 #endif 110 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/GrEffect.h » ('j') | src/gpu/gl/GrGLShaderBuilder.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698