diff options
author | Robert Phillips <robertphillips@google.com> | 2017-07-21 14:12:29 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-21 19:05:25 +0000 |
commit | c686ce39f06d556d55befd290e0eb82851c7d33b (patch) | |
tree | d2d9cd464240a5a037ece559748ecedbb4293d0b /src/gpu/effects/GrTextureDomain.cpp | |
parent | 219f3622ba32a1cb6380212a2ec1947513fbfeb9 (diff) |
Smaller fragment from "Reduce dependence on GrSurface's origin field"
TBR=bsalomon@google.com
Change-Id: I996226ffaf84ca357740a6da9bb80a3b8febb379
Reviewed-on: https://skia-review.googlesource.com/25745
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/effects/GrTextureDomain.cpp')
-rw-r--r-- | src/gpu/effects/GrTextureDomain.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp index a8ce0ab6c5..f2b78586d7 100644 --- a/src/gpu/effects/GrTextureDomain.cpp +++ b/src/gpu/effects/GrTextureDomain.cpp @@ -161,7 +161,8 @@ void GrTextureDomain::GLDomain::sampleTexture(GrGLSLShaderBuilder* builder, void GrTextureDomain::GLDomain::setData(const GrGLSLProgramDataManager& pdman, const GrTextureDomain& textureDomain, - GrTexture* tex) { + GrSurfaceProxy* proxy) { + GrTexture* tex = proxy->priv().peekTexture(); SkASSERT(textureDomain.mode() == fMode); if (kIgnore_Mode != textureDomain.mode()) { SkScalar wInv = SK_Scalar1 / tex->width(); @@ -180,7 +181,7 @@ void GrTextureDomain::GLDomain::setData(const GrGLSLProgramDataManager& pdman, SkASSERT(values[3] >= 0.0f && values[3] <= 1.0f); // vertical flip if necessary - if (kBottomLeft_GrSurfaceOrigin == tex->origin()) { + if (kBottomLeft_GrSurfaceOrigin == proxy->origin()) { values[1] = 1.0f - values[1]; values[3] = 1.0f - values[3]; // The top and bottom were just flipped, so correct the ordering @@ -270,9 +271,9 @@ GrGLSLFragmentProcessor* GrTextureDomainEffect::onCreateGLSLInstance() const { const GrFragmentProcessor& fp) override { const GrTextureDomainEffect& tde = fp.cast<GrTextureDomainEffect>(); const GrTextureDomain& domain = tde.fTextureDomain; - GrTexture* texture = tde.textureSampler(0).peekTexture(); + GrSurfaceProxy* proxy = tde.textureSampler(0).proxy(); - fGLDomain.setData(pdman, domain, texture); + fGLDomain.setData(pdman, domain, proxy); if (SkToBool(tde.colorSpaceXform())) { fColorSpaceHelper.setData(pdman, tde.colorSpaceXform()); } @@ -372,16 +373,17 @@ GrGLSLFragmentProcessor* GrDeviceSpaceTextureDecalFragmentProcessor::onCreateGLS const GrFragmentProcessor& fp) override { const GrDeviceSpaceTextureDecalFragmentProcessor& dstdfp = fp.cast<GrDeviceSpaceTextureDecalFragmentProcessor>(); - GrTexture* texture = dstdfp.textureSampler(0).peekTexture(); + GrSurfaceProxy* proxy = dstdfp.textureSampler(0).proxy(); + GrTexture* texture = proxy->priv().peekTexture(); - fGLDomain.setData(pdman, dstdfp.fTextureDomain, texture); + fGLDomain.setData(pdman, dstdfp.fTextureDomain, proxy); float iw = 1.f / texture->width(); float ih = 1.f / texture->height(); float scaleAndTransData[4] = { iw, ih, -dstdfp.fDeviceSpaceOffset.fX * iw, -dstdfp.fDeviceSpaceOffset.fY * ih }; - if (texture->origin() == kBottomLeft_GrSurfaceOrigin) { + if (proxy->origin() == kBottomLeft_GrSurfaceOrigin) { scaleAndTransData[1] = -scaleAndTransData[1]; scaleAndTransData[3] = 1 - scaleAndTransData[3]; } |