aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrTextureDomain.h
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-01-09 14:23:59 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-10 16:15:02 +0000
commite98234f231d66848e149db683c11b6388e10b233 (patch)
tree48bbfcde8b5519a3903a1be0e6b28b04dee6b819 /src/gpu/effects/GrTextureDomain.h
parent8e619a2b4eb31753e6fcb4a9ec494d31ace755da (diff)
Start making texture coordinates be absolute
The idea here is that we will pass GrTextureProxys in (where we're currently passing GrTextures) and defer the normalization until the texture is actually instantiated (and possibly move it to the GPU entirely) This CL does (intentionally) change the texturedomaineffect GM but I believe the new behavior is more correct. Change-Id: I4e0510b3dfb65ff0d0ee5921f9a6f94151e602d3 Reviewed-on: https://skia-review.googlesource.com/6807 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/effects/GrTextureDomain.h')
-rw-r--r--src/gpu/effects/GrTextureDomain.h33
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;
};
/**