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

Unified 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, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/gpu/GrEffect.h » ('j') | src/gpu/gl/GrGLShaderBuilder.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrColor.h
===================================================================
--- include/gpu/GrColor.h (revision 8417)
+++ include/gpu/GrColor.h (working copy)
@@ -67,4 +67,44 @@
rgba[3] = GrColorUnpackA(color) * ONE_OVER_255;
}
+/**
+ * Flags used for bitfields of color components. They are defined so that the bit order reflects the
+ * GrColor shift order.
+ */
+enum GrColorComponentFlags {
+ kR_GrColorComponentFlag = 1 << (GrColor_SHIFT_R / 8),
+ kG_GrColorComponentFlag = 1 << (GrColor_SHIFT_G / 8),
+ kB_GrColorComponentFlag = 1 << (GrColor_SHIFT_B / 8),
+ kA_GrColorComponentFlag = 1 << (GrColor_SHIFT_A / 8),
+
+ kRGB_GrColorComponentFlags = (kR_GrColorComponentFlag | kG_GrColorComponentFlag |
+ kB_GrColorComponentFlag),
+
+ kRGBA_GrColorComponentFlags = (kR_GrColorComponentFlag | kG_GrColorComponentFlag |
+ kB_GrColorComponentFlag | kA_GrColorComponentFlag)
+};
+
+static inline uint32_t GrPixelConfigComponentMask(GrPixelConfig config) {
+ GrAssert(config >= 0 && config < kGrPixelConfigCnt);
+ static const uint32_t kFlags[] = {
+ 0, // kUnknown_GrPixelConfig
+ kA_GrColorComponentFlag, // kAlpha_8_GrPixelConfig
+ kRGBA_GrColorComponentFlags, // kIndex_8_GrPixelConfig
+ kRGB_GrColorComponentFlags, // kRGB_565_GrPixelConfig
+ kRGBA_GrColorComponentFlags, // kRGBA_4444_GrPixelConfig
+ kRGBA_GrColorComponentFlags, // kRGBA_8888_GrPixelConfig
+ kRGBA_GrColorComponentFlags, // kBGRA_8888_GrPixelConfig
+ };
+ return kFlags[config];
+
+ GR_STATIC_ASSERT(0 == kUnknown_GrPixelConfig);
+ GR_STATIC_ASSERT(1 == kAlpha_8_GrPixelConfig);
+ GR_STATIC_ASSERT(2 == kIndex_8_GrPixelConfig);
+ GR_STATIC_ASSERT(3 == kRGB_565_GrPixelConfig);
+ GR_STATIC_ASSERT(4 == kRGBA_4444_GrPixelConfig);
+ GR_STATIC_ASSERT(5 == kRGBA_8888_GrPixelConfig);
+ GR_STATIC_ASSERT(6 == kBGRA_8888_GrPixelConfig);
+ GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFlags) == kGrPixelConfigCnt);
+}
+
#endif
« 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