aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2016-10-20 16:53:45 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-10-21 17:11:08 +0000
commit72ae431e4032985999dc0990bfbbf4acf127a74e (patch)
treed60da023e2421e839dc7c35db3175f50d4aa2604 /include
parent6a7287c14ba39784d66bb299a1340c0d7ca7b683 (diff)
New helpers for converting SkColor to GrColor4f
These versions will eliminate lots of copy-pasting in various fragment processor creation code. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3787 Change-Id: I3ada2d4866e92cfc0507beeea11e05790d73757d Reviewed-on: https://skia-review.googlesource.com/3787 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/gpu/SkGr.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/gpu/SkGr.h b/include/gpu/SkGr.h
index 43d61e250b..fc13c3864b 100644
--- a/include/gpu/SkGr.h
+++ b/include/gpu/SkGr.h
@@ -42,6 +42,14 @@ static inline GrColor SkColorToUnpremulGrColor(SkColor c) {
return GrColorPackRGBA(r, g, b, a);
}
+/** Transform an SkColor (sRGB bytes) to GrColor4f for the specified color space. */
+GrColor4f SkColorToPremulGrColor4f(SkColor c, SkColorSpace* dstColorSpace);
+GrColor4f SkColorToUnpremulGrColor4f(SkColor c, SkColorSpace* dstColorSpace);
+
+/**
+ * As above, but with explicit control over the linearization and gamut xform steps.
+ * Typically used when you have easy access to a pre-computed xform.
+ */
GrColor4f SkColorToPremulGrColor4f(SkColor c, bool gammaCorrect, GrColorSpaceXform* gamutXform);
GrColor4f SkColorToUnpremulGrColor4f(SkColor c, bool gammaCorrect, GrColorSpaceXform* gamutXform);