Do color space conversion in XfermodeImageFilter

BUG=skia:

Change-Id: I69c92506fca62e8711cece005f169ac05d26c872
Reviewed-on: https://skia-review.googlesource.com/6324
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2016-12-20 10:36:35 -05:00 committed by Skia Commit-Bot
parent 07b6ad0fe6
commit 7dc5452c90

View File

@ -253,8 +253,10 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilter_Base::filterImageGPU(
backgroundMatrix.setIDiv(backgroundTex->width(), backgroundTex->height());
backgroundMatrix.preTranslate(-SkIntToScalar(backgroundOffset.fX),
-SkIntToScalar(backgroundOffset.fY));
sk_sp<GrColorSpaceXform> bgXform = GrColorSpaceXform::Make(background->getColorSpace(),
outputProperties.colorSpace());
bgFP = GrTextureDomainEffect::Make(
backgroundTex.get(), nullptr, backgroundMatrix,
backgroundTex.get(), std::move(bgXform), backgroundMatrix,
GrTextureDomain::MakeTexelDomain(backgroundTex.get(),
background->subset()),
GrTextureDomain::kDecal_Mode,
@ -269,12 +271,13 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilter_Base::filterImageGPU(
foregroundMatrix.setIDiv(foregroundTex->width(), foregroundTex->height());
foregroundMatrix.preTranslate(-SkIntToScalar(foregroundOffset.fX),
-SkIntToScalar(foregroundOffset.fY));
sk_sp<GrColorSpaceXform> fgXform = GrColorSpaceXform::Make(foreground->getColorSpace(),
outputProperties.colorSpace());
sk_sp<GrFragmentProcessor> foregroundFP;
foregroundFP = GrTextureDomainEffect::Make(
foregroundTex.get(), nullptr, foregroundMatrix,
GrTextureDomain::MakeTexelDomain(foregroundTex.get(),
foregroundTex.get(), std::move(fgXform), foregroundMatrix,
GrTextureDomain::MakeTexelDomain(foregroundTex.get(),
foreground->subset()),
GrTextureDomain::kDecal_Mode,
GrSamplerParams::kNone_FilterMode);