From 5d884b562828ceb13ccacb71bc4581d2020e62bb Mon Sep 17 00:00:00 2001 From: Matt Sarett Date: Wed, 12 Apr 2017 09:19:15 -0400 Subject: [PATCH] SkColorSpaceXformer: Preserve local matrix on shaders Also, do not drop unknown shaders. Fixes cts tests. b/37161109 b/37237678 Bug: skia: Change-Id: I0fd817a4d6461ede0ccdcb8f3cccb255b646b864 Reviewed-on: https://skia-review.googlesource.com/13246 Commit-Queue: Matt Sarett Commit-Queue: Mike Klein Reviewed-by: Mike Klein --- src/core/SkColorSpaceXformer.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/SkColorSpaceXformer.cpp b/src/core/SkColorSpaceXformer.cpp index 38e717de0d..fe66e74c79 100644 --- a/src/core/SkColorSpaceXformer.cpp +++ b/src/core/SkColorSpaceXformer.cpp @@ -71,7 +71,8 @@ SkColor SkColorSpaceXformer::apply(SkColor srgb) { sk_sp SkColorSpaceXformer::apply(const SkShader* shader) { SkColor color; if (shader->isConstant() && shader->asLuminanceColor(&color)) { - return SkShader::MakeColorShader(this->apply(color)); + return SkShader::MakeColorShader(this->apply(color)) + ->makeWithLocalMatrix(shader->getLocalMatrix()); } SkShader::TileMode xy[2]; @@ -85,7 +86,8 @@ sk_sp SkColorSpaceXformer::apply(const SkShader* shader) { auto A = this->apply(compose.fShaderA), B = this->apply(compose.fShaderB); if (A && B) { - return SkShader::MakeComposeShader(std::move(A), std::move(B), compose.fBlendMode); + return SkShader::MakeComposeShader(std::move(A), std::move(B), compose.fBlendMode) + ->makeWithLocalMatrix(shader->getLocalMatrix()); } } @@ -147,7 +149,7 @@ sk_sp SkColorSpaceXformer::apply(const SkShader* shader) { } } - return nullptr; + return sk_ref_sp(const_cast(shader)); } const SkPaint& SkColorSpaceXformer::apply(const SkPaint& src) {