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) |