diff options
author | brianosman <brianosman@google.com> | 2016-07-18 10:53:52 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-07-18 10:53:52 -0700 |
commit | 54f30c13fc0a5d89797fc9be5f0fb1050d96b6f4 (patch) | |
tree | 484d25c1b668126bd51203cd1875d7c47f34a1bf /src/effects | |
parent | baaea531c249d3a13b0d04eca59b8bd0ee58d76b (diff) |
Introduce GrColorSpaceXform, for gamut conversion on textures
GrTextureAccess optionally includes an instance, computed from the src
and dst color spaces. In all common cases (no color space for either src
or dst, or same color space for both), no object is allocated.
This change is orthogonal to my attempts to get color space attached to
render targets - regardless of how we choose to do that, this will give
us the source color space at all points where we are connecting src to
dst.
There are many dangling injection points where I've been inserting
nullptr, but I have a record of all of them. Additionally, there are now
three places (the most common simple paths for bitmap/image rendering)
where things are plumbed enough that I expect to have access to the dst
color space (all marked with XFORMTODO).
In addition to getting the dst color space, I need to inject shader code
and uniform uploading for appendTextureLookup and friends.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2154753003
Review-Url: https://codereview.chromium.org/2154753003
Diffstat (limited to 'src/effects')
-rw-r--r-- | src/effects/SkBlurMaskFilter.cpp | 2 | ||||
-rw-r--r-- | src/effects/SkGpuBlurUtils.cpp | 5 | ||||
-rw-r--r-- | src/effects/SkLightingImageFilter.cpp | 2 | ||||
-rw-r--r-- | src/effects/SkMagnifierImageFilter.cpp | 2 | ||||
-rw-r--r-- | src/effects/SkXfermodeImageFilter.cpp | 4 |
5 files changed, 8 insertions, 7 deletions
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp index 6a20d48c75..b7893c50b4 100644 --- a/src/effects/SkBlurMaskFilter.cpp +++ b/src/effects/SkBlurMaskFilter.cpp @@ -1260,7 +1260,7 @@ bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src, SkMatrix matrix; matrix.setIDiv(src->width(), src->height()); // Blend pathTexture over blurTexture. - paint.addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(src, matrix)); + paint.addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(src, nullptr, matrix)); if (kInner_SkBlurStyle == fBlurStyle) { // inner: dst = dst * src paint.setCoverageSetOpXPFactory(SkRegion::kIntersect_Op); diff --git a/src/effects/SkGpuBlurUtils.cpp b/src/effects/SkGpuBlurUtils.cpp index 9bc1265276..f0f684dc2d 100644 --- a/src/effects/SkGpuBlurUtils.cpp +++ b/src/effects/SkGpuBlurUtils.cpp @@ -275,6 +275,7 @@ sk_sp<GrDrawContext> GaussianBlur(GrContext* context, (i < scaleFactorY) ? SK_ScalarHalf / srcTexture->height() : 0.0f); sk_sp<GrFragmentProcessor> fp(GrTextureDomainEffect::Make( srcTexture.get(), + nullptr, matrix, domain, GrTextureDomain::kDecal_Mode, @@ -284,7 +285,7 @@ sk_sp<GrDrawContext> GaussianBlur(GrContext* context, srcOffset.set(0, 0); } else { GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_FilterMode); - paint.addColorTextureProcessor(srcTexture.get(), matrix, params); + paint.addColorTextureProcessor(srcTexture.get(), nullptr, matrix, params); } paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); shrink_irect_by_2(&dstRect, i < scaleFactorX, i < scaleFactorY); @@ -361,7 +362,7 @@ sk_sp<GrDrawContext> GaussianBlur(GrContext* context, // FIXME: this should be mitchell, not bilinear. GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_FilterMode); sk_sp<GrTexture> tex(srcDrawContext->asTexture()); - paint.addColorTextureProcessor(tex.get(), matrix, params); + paint.addColorTextureProcessor(tex.get(), nullptr, matrix, params); paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); SkIRect dstRect(srcRect); diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp index 8bf4077602..71503b5a2e 100644 --- a/src/effects/SkLightingImageFilter.cpp +++ b/src/effects/SkLightingImageFilter.cpp @@ -1699,7 +1699,7 @@ GrLightingEffect::GrLightingEffect(GrTexture* texture, const SkMatrix& matrix, BoundaryMode boundaryMode, const SkIRect* srcBounds) - : INHERITED(texture, GrCoordTransform::MakeDivByTextureWHMatrix(texture)) + : INHERITED(texture, nullptr, GrCoordTransform::MakeDivByTextureWHMatrix(texture)) , fLight(light) , fSurfaceScale(surfaceScale) , fFilterMatrix(matrix) diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp index cc2d243f1e..aebbad8328 100644 --- a/src/effects/SkMagnifierImageFilter.cpp +++ b/src/effects/SkMagnifierImageFilter.cpp @@ -68,7 +68,7 @@ private: float yInvZoom, float xInvInset, float yInvInset) - : INHERITED(texture, GrCoordTransform::MakeDivByTextureWHMatrix(texture)) + : INHERITED(texture, nullptr, GrCoordTransform::MakeDivByTextureWHMatrix(texture)) , fBounds(bounds) , fXOffset(xOffset) , fYOffset(yOffset) diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp index 785b46fcc7..345e6e504a 100644 --- a/src/effects/SkXfermodeImageFilter.cpp +++ b/src/effects/SkXfermodeImageFilter.cpp @@ -188,7 +188,7 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilter::filterImageGPU(SkSpecialImage* sour backgroundMatrix.preTranslate(SkIntToScalar(-backgroundOffset.fX), SkIntToScalar(-backgroundOffset.fY)); bgFP = GrTextureDomainEffect::Make( - backgroundTex.get(), backgroundMatrix, + backgroundTex.get(), nullptr, backgroundMatrix, GrTextureDomain::MakeTexelDomain(backgroundTex.get(), background->subset()), GrTextureDomain::kDecal_Mode, @@ -207,7 +207,7 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilter::filterImageGPU(SkSpecialImage* sour sk_sp<GrFragmentProcessor> foregroundFP; foregroundFP = GrTextureDomainEffect::Make( - foregroundTex.get(), foregroundMatrix, + foregroundTex.get(), nullptr, foregroundMatrix, GrTextureDomain::MakeTexelDomain(foregroundTex.get(), foreground->subset()), GrTextureDomain::kDecal_Mode, |