diff options
Diffstat (limited to 'src/gpu/effects/GrTextureDomain.h')
-rw-r--r-- | src/gpu/effects/GrTextureDomain.h | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/src/gpu/effects/GrTextureDomain.h b/src/gpu/effects/GrTextureDomain.h index 72204b1f8e..66bd2201e3 100644 --- a/src/gpu/effects/GrTextureDomain.h +++ b/src/gpu/effects/GrTextureDomain.h @@ -44,8 +44,7 @@ public: static const int kModeCount = kLastMode + 1; static const GrTextureDomain& IgnoredDomain() { - static const SkRect gDummyRect = {0, 0, 0, 0}; - static const GrTextureDomain gDomain(gDummyRect, kIgnore_Mode); + static const GrTextureDomain gDomain(nullptr, SkRect::MakeEmpty(), kIgnore_Mode); return gDomain; } @@ -53,36 +52,22 @@ public: * @param index Pass a value >= 0 if using multiple texture domains in the same effect. * It is used to keep inserted variables from causing name collisions. */ - GrTextureDomain(const SkRect& domain, Mode, int index = -1); + GrTextureDomain(GrTexture*, const SkRect& domain, Mode, int index = -1); const SkRect& domain() const { return fDomain; } Mode mode() const { return fMode; } /* Computes a domain that bounds all the texels in texelRect. Note that with bilerp enabled texels neighboring the domain may be read. */ - static const SkRect MakeTexelDomain(const GrTexture* texture, const SkIRect& texelRect) { - SkScalar wInv = SK_Scalar1 / texture->width(); - SkScalar hInv = SK_Scalar1 / texture->height(); - SkRect result = { - texelRect.fLeft * wInv, - texelRect.fTop * hInv, - texelRect.fRight * wInv, - texelRect.fBottom * hInv - }; - return result; + static const SkRect MakeTexelDomain(const SkIRect& texelRect) { + return SkRect::Make(texelRect); } - static const SkRect MakeTexelDomainForMode(const GrTexture* texture, const SkIRect& texelRect, Mode mode) { + static const SkRect MakeTexelDomainForMode(const SkIRect& texelRect, Mode mode) { // For Clamp mode, inset by half a texel. - SkScalar wInv = SK_Scalar1 / texture->width(); - SkScalar hInv = SK_Scalar1 / texture->height(); SkScalar inset = (mode == kClamp_Mode && !texelRect.isEmpty()) ? SK_ScalarHalf : 0; - return SkRect::MakeLTRB( - (texelRect.fLeft + inset) * wInv, - (texelRect.fTop + inset) * hInv, - (texelRect.fRight - inset) * wInv, - (texelRect.fBottom - inset) * hInv - ); + return SkRect::MakeLTRB(texelRect.fLeft + inset, texelRect.fTop + inset, + texelRect.fRight - inset, texelRect.fBottom - inset); } bool operator==(const GrTextureDomain& that) const { @@ -130,7 +115,7 @@ public: * origin. */ void setData(const GrGLSLProgramDataManager& pdman, const GrTextureDomain& textureDomain, - GrSurfaceOrigin textureOrigin); + GrTexture* texure); enum { kDomainKeyBits = 2, // See DomainKey(). @@ -157,8 +142,6 @@ protected: Mode fMode; SkRect fDomain; int fIndex; - - typedef GrSingleTextureEffect INHERITED; }; /** |