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 <msarett@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
This commit is contained in:
Matt Sarett 2017-04-12 09:19:15 -04:00 committed by Skia Commit-Bot
parent ac796f880f
commit 5d884b5628

View File

@ -71,7 +71,8 @@ SkColor SkColorSpaceXformer::apply(SkColor srgb) {
sk_sp<SkShader> 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<SkShader> 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<SkShader> SkColorSpaceXformer::apply(const SkShader* shader) {
}
}
return nullptr;
return sk_ref_sp(const_cast<SkShader*>(shader));
}
const SkPaint& SkColorSpaceXformer::apply(const SkPaint& src) {