aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar brianosman <brianosman@google.com>2016-09-15 11:09:45 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-09-15 11:09:45 -0700
commitb9c5137a1cedbe8a3641db0b7c081881a2d5d58c (patch)
tree08a7c105b78177e0741cc954aece660285894c8c /src/gpu
parent1949386ae00485ae92dd5608a2614b9dee417542 (diff)
Add storage and computation of SkColor4f version of gradient stops.
For now, we still only have the SkColor factory, but the Descriptor can now carry either an SkColor or SkColor4f specified gradient. Base class constructor automatically populates both forms of color, so that legacy raster backend will continue to work, and new backend work can operate directly from the float4 version. On the GPU side, we have similar logic, but GrGradientEffect only keeps one version of colors around: SkColor if the destination is legacy, and SkColor4f (with an optional gamut xform) if the destination is gamma correct. The 4f colors are already linear, and we gamut xform them in setData, so gradients are now fully color-correct in sRGB and F16 modes... ... unless there are more than three stops. Then we use a texture, and that code path isn't handled yet. We have a few choices here (do we use an 8-bit sRGB atlas, or just always use F16 linear atlas so we can share it among both sRGB and wide-gamut rendering). In any case, I'd like to defer that to a second CL. This change does fix the non-texture gradients in the gamut GM. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2337313002 Review-Url: https://codereview.chromium.org/2337313002
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrColorSpaceXform.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gpu/GrColorSpaceXform.cpp b/src/gpu/GrColorSpaceXform.cpp
index 3380b0f390..d4faaaffd1 100644
--- a/src/gpu/GrColorSpaceXform.cpp
+++ b/src/gpu/GrColorSpaceXform.cpp
@@ -59,6 +59,18 @@ sk_sp<GrColorSpaceXform> GrColorSpaceXform::Make(SkColorSpace* src, SkColorSpace
return sk_make_sp<GrColorSpaceXform>(srcToDst);
}
+bool GrColorSpaceXform::Equals(const GrColorSpaceXform* a, const GrColorSpaceXform* b) {
+ if (a == b) {
+ return true;
+ }
+
+ if (!a || !b) {
+ return false;
+ }
+
+ return a->fSrcToDst == b->fSrcToDst;
+}
+
GrColor4f GrColorSpaceXform::apply(const GrColor4f& srcColor) {
GrColor4f result;
fSrcToDst.mapScalars(srcColor.fRGBA, result.fRGBA);