aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrCoordTransform.h
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-06-01 12:55:44 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-02 11:46:40 +0000
commit18166eeaf2d088d494c4273b88107544166046fd (patch)
treea5653250b48b2c3c432127ac2e40d57008a5f117 /src/gpu/GrCoordTransform.h
parentdec4c0b29843d5de7d06c3998d919b3e3abecdf2 (diff)
Omnibus: Push instantiation of GrTextures later (post TextureSampler)
Split into: https://skia-review.googlesource.com/c/10485/ (More GrSurfaceProxy-clean up) https://skia-review.googlesource.com/c/15819/ (Expand GrTextureProxy to handle highestFilterMode) https://skia-review.googlesource.com/c/16714/ (Switch ImageStorageAccess over to GrTextureProxies) https://skia-review.googlesource.com/c/16908/ (Convert DstTexture to DstProxy) Change-Id: I6cf3ba0f3bf0e1908d36749bc83571c066ddd568 Reviewed-on: https://skia-review.googlesource.com/10484 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrCoordTransform.h')
-rw-r--r--src/gpu/GrCoordTransform.h32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/gpu/GrCoordTransform.h b/src/gpu/GrCoordTransform.h
index 54c21b7472..325dbbd94b 100644
--- a/src/gpu/GrCoordTransform.h
+++ b/src/gpu/GrCoordTransform.h
@@ -9,10 +9,11 @@
#define GrCoordTransform_DEFINED
#include "SkMatrix.h"
+#include "GrSurfaceProxyPriv.h"
#include "GrTexture.h"
+#include "GrTextureProxy.h"
class GrResourceProvider;
-class GrTextureProxy;
/**
* A class representing a linear transformation of local coordinates. GrFragnentProcessors
@@ -21,7 +22,7 @@ class GrTextureProxy;
class GrCoordTransform : SkNoncopyable {
public:
GrCoordTransform()
- : fTexture(nullptr)
+ : fProxy(nullptr)
, fNormalize(false)
, fReverseY(false) {
SkDEBUGCODE(fInProcessor = false);
@@ -34,7 +35,7 @@ public:
GrCoordTransform(GrResourceProvider* resourceProvider, GrTextureProxy* proxy) {
SkASSERT(proxy);
SkDEBUGCODE(fInProcessor = false);
- this->reset(resourceProvider, SkMatrix::I(), proxy);
+ this->reset(resourceProvider, SkMatrix::I(), proxy, true);
}
/**
@@ -45,7 +46,7 @@ public:
GrTextureProxy* proxy) {
SkASSERT(proxy);
SkDEBUGCODE(fInProcessor = false);
- this->reset(resourceProvider, m, proxy);
+ this->reset(resourceProvider, m, proxy, true);
}
/**
@@ -56,12 +57,12 @@ public:
this->reset(m);
}
- void reset(GrResourceProvider*, const SkMatrix&, GrTextureProxy*, bool normalize = true);
+ void reset(GrResourceProvider*, const SkMatrix&, GrTextureProxy*, bool normalize);
void reset(const SkMatrix& m) {
SkASSERT(!fInProcessor);
fMatrix = m;
- fTexture = nullptr;
+ fProxy = nullptr;
fNormalize = false;
fReverseY = false;
}
@@ -69,7 +70,7 @@ public:
GrCoordTransform& operator= (const GrCoordTransform& that) {
SkASSERT(!fInProcessor);
fMatrix = that.fMatrix;
- fTexture = that.fTexture;
+ fProxy = that.fProxy;
fNormalize = that.fNormalize;
fReverseY = that.fReverseY;
return *this;
@@ -92,19 +93,26 @@ public:
}
if (fNormalize) {
- SkASSERT(fTexture && that.fTexture);
- return fTexture->width() == that.fTexture->width() &&
- fTexture->height() == that.fTexture->height();
+ if (fProxy != that.fProxy) {
+ return false;
+ }
}
return true;
}
const SkMatrix& getMatrix() const { return fMatrix; }
- const GrTexture* texture() const { return fTexture; }
+ const GrTextureProxy* proxy() const { return fProxy; }
bool normalize() const { return fNormalize; }
bool reverseY() const { return fReverseY; }
+ // This should only ever be called at flush time after the backing texture has been
+ // successfully instantiated
+ GrTexture* peekTexture() const {
+ SkASSERT(fProxy->priv().peekTexture());
+ return fProxy->priv().peekTexture();
+ }
+
private:
// The textures' effect is to optionally normalize the final matrix, so a blind
// equality check could be misleading
@@ -112,7 +120,7 @@ private:
bool operator!=(const GrCoordTransform& that) const;
SkMatrix fMatrix;
- const GrTexture* fTexture;
+ const GrTextureProxy* fProxy;
bool fNormalize;
bool fReverseY;
typedef SkNoncopyable INHERITED;