aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects/gradients/SkLinearGradient.cpp
diff options
context:
space:
mode:
authorGravatar brianosman <brianosman@google.com>2016-09-28 11:27:28 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-09-28 11:27:28 -0700
commite25d71ccbcdb47c7ee7bdf13235066092ae11af3 (patch)
tree7e8af1153ca300660f2dc1b9ca7d43df62c008dc /src/effects/gradients/SkLinearGradient.cpp
parentca9654e4c6ff1a8a54d3ae1e277ba7e38a0fa00b (diff)
Gradients are serialized (and can be constructed) as SkColor4f + SkColorSpace
Added gradient shader factories that take SkColor4f + SkColorSpace. Modified Descriptor to only store SkColor4f + SkColorSpace. Existing factories make use of helper code to convert SkColor and forward to the new factories. Bumped SKP version to handle new gradient serialization format. I was toying with using half-float when serializing SkColor4f, despite my aggressive packing of flags, this format is significantly bigger. Also added GM to use 4f factories. This GM should (and does) look identical to the existing gradients GM. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2370063002 Review-Url: https://codereview.chromium.org/2370063002
Diffstat (limited to 'src/effects/gradients/SkLinearGradient.cpp')
-rw-r--r--src/effects/gradients/SkLinearGradient.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp
index 4bf5e3cc20..3372499a63 100644
--- a/src/effects/gradients/SkLinearGradient.cpp
+++ b/src/effects/gradients/SkLinearGradient.cpp
@@ -63,8 +63,9 @@ sk_sp<SkFlattenable> SkLinearGradient::CreateProc(SkReadBuffer& buffer) {
SkPoint pts[2];
pts[0] = buffer.readPoint();
pts[1] = buffer.readPoint();
- return SkGradientShader::MakeLinear(pts, desc.fColors, desc.fPos, desc.fCount, desc.fTileMode,
- desc.fGradFlags, desc.fLocalMatrix);
+ return SkGradientShader::MakeLinear(pts, desc.fColors, std::move(desc.fColorSpace), desc.fPos,
+ desc.fCount, desc.fTileMode, desc.fGradFlags,
+ desc.fLocalMatrix);
}
void SkLinearGradient::flatten(SkWriteBuffer& buffer) const {