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

Unified 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 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gyp/gmslides.gypi ('k') | src/core/SkBlitter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrColor.h
diff --git a/include/gpu/GrColor.h b/include/gpu/GrColor.h
index 860d18da2ffa769b38385e64f011148ee39d1949..43bfd8dc11e0aa104d83c4c998efc4e50909f202 100644
--- a/include/gpu/GrColor.h
+++ b/include/gpu/GrColor.h
@@ -41,8 +41,7 @@ typedef uint32_t GrColor;
/**
* Pack 4 components (RGBA) into a GrColor int
*/
-static inline GrColor GrColorPackRGBA(unsigned r, unsigned g,
- unsigned b, unsigned a) {
+static inline GrColor GrColorPackRGBA(unsigned r, unsigned g, unsigned b, unsigned a) {
SkASSERT((uint8_t)r == r);
SkASSERT((uint8_t)g == g);
SkASSERT((uint8_t)b == b);
@@ -53,6 +52,17 @@ static inline GrColor GrColorPackRGBA(unsigned r, unsigned g,
(a << GrColor_SHIFT_A);
}
+/**
+ * Packs a color with an alpha channel replicated across all four channels.
+ */
+static inline GrColor GrColorPackA4(unsigned a) {
+ SkASSERT((uint8_t)a == a);
+ return (a << GrColor_SHIFT_R) |
+ (a << GrColor_SHIFT_G) |
+ (a << GrColor_SHIFT_B) |
+ (a << GrColor_SHIFT_A);
+}
+
// extract a component (byte) from a GrColor int
#define GrColorUnpackR(color) (((color) >> GrColor_SHIFT_R) & 0xFF)
« 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