Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: include/gpu/GrCoordTransform.h

Issue 25645006: Allow gradient optimization with perspective (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: updated skipped tests Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « expectations/gm/ignored-tests.txt ('k') | src/effects/gradients/SkGradientShaderPriv.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrCoordTransform.h
diff --git a/include/gpu/GrCoordTransform.h b/include/gpu/GrCoordTransform.h
index afe2e5ba2f05ac3c5cb72f2149b907e01bddec3e..14e2620e44b1eef6fe8743f6d4a74c8f90942e0f 100644
--- a/include/gpu/GrCoordTransform.h
+++ b/include/gpu/GrCoordTransform.h
@@ -41,12 +41,13 @@ enum GrCoordSet {
*/
class GrCoordTransform : public SkNoncopyable {
public:
- GrCoordTransform() {}
+ GrCoordTransform() { SkDEBUGCODE(fInEffect = false); }
/**
* Create a transformation that maps [0, 1] to a texture's boundaries.
*/
GrCoordTransform(GrCoordSet sourceCoords, const GrTexture* texture) {
+ SkDEBUGCODE(fInEffect = false);
this->reset(sourceCoords, texture);
}
@@ -56,20 +57,40 @@ public:
* coord convention.
*/
GrCoordTransform(GrCoordSet sourceCoords, const SkMatrix& m, const GrTexture* texture = NULL) {
+ SkDEBUGCODE(fInEffect = false);
this->reset(sourceCoords, m, texture);
}
void reset(GrCoordSet sourceCoords, const GrTexture* texture) {
+ SkASSERT(!fInEffect);
SkASSERT(NULL != texture);
this->reset(sourceCoords, GrEffect::MakeDivByTextureWHMatrix(texture), texture);
}
void reset(GrCoordSet sourceCoords, const SkMatrix& m, const GrTexture* texture = NULL) {
+ SkASSERT(!fInEffect);
fSourceCoords = sourceCoords;
fMatrix = m;
fReverseY = NULL != texture && kBottomLeft_GrSurfaceOrigin == texture->origin();
}
+ GrCoordTransform& operator= (const GrCoordTransform& other) {
+ SkASSERT(!fInEffect);
+ fSourceCoords = other.fSourceCoords;
+ fMatrix = other.fMatrix;
+ fReverseY = other.fReverseY;
+ return *this;
+ }
+
+ /**
+ * Access the matrix for editing. Note, this must be done before adding the transform to an
+ * effect, since effects are immutable.
+ */
+ SkMatrix* accessMatrix() {
+ SkASSERT(!fInEffect);
+ return &fMatrix;
+ }
+
bool operator== (const GrCoordTransform& other) const {
return fSourceCoords == other.fSourceCoords &&
fMatrix.cheapEqualTo(other.fMatrix) &&
@@ -86,6 +107,13 @@ private:
bool fReverseY;
typedef SkNoncopyable INHERITED;
+
+#ifdef SK_DEBUG
+public:
+ void setInEffect() const { fInEffect = true; }
+private:
+ mutable bool fInEffect;
+#endif
};
#endif
« no previous file with comments | « expectations/gm/ignored-tests.txt ('k') | src/effects/gradients/SkGradientShaderPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698