aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2014-12-29 07:05:27 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-29 07:05:27 -0800
commitb0ae649b7ebda86ef53bf913798b809d500973ed (patch)
tree86d7c1a8365f0815f1ffe7b096e96ee92a0f5553 /include
parent001db8599e1f2e2749a5ee65ee83821b0bde569b (diff)
Add device space skshader GM to test kDevice_GrCoordSet
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrColor.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/include/gpu/GrColor.h b/include/gpu/GrColor.h
index 860d18da2f..43bfd8dc11 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)