| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrCoordTransform_DEFINED | 8 #ifndef GrCoordTransform_DEFINED |
| 9 #define GrCoordTransform_DEFINED | 9 #define GrCoordTransform_DEFINED |
| 10 | 10 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 /** | 85 /** |
| 86 * Access the matrix for editing. Note, this must be done before adding the
transform to an | 86 * Access the matrix for editing. Note, this must be done before adding the
transform to an |
| 87 * effect, since effects are immutable. | 87 * effect, since effects are immutable. |
| 88 */ | 88 */ |
| 89 SkMatrix* accessMatrix() { | 89 SkMatrix* accessMatrix() { |
| 90 SkASSERT(!fInProcessor); | 90 SkASSERT(!fInProcessor); |
| 91 return &fMatrix; | 91 return &fMatrix; |
| 92 } | 92 } |
| 93 | 93 |
| 94 bool operator== (const GrCoordTransform& other) const { | 94 bool operator== (const GrCoordTransform& that) const { |
| 95 return fSourceCoords == other.fSourceCoords && | 95 return fSourceCoords == that.fSourceCoords && |
| 96 fMatrix.cheapEqualTo(other.fMatrix) && | 96 fMatrix.cheapEqualTo(that.fMatrix) && |
| 97 fReverseY == other.fReverseY; | 97 fReverseY == that.fReverseY; |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool operator!= (const GrCoordTransform& that) const { return !(*this == tha
t); } |
| 101 |
| 100 GrCoordSet sourceCoords() const { return fSourceCoords; } | 102 GrCoordSet sourceCoords() const { return fSourceCoords; } |
| 101 const SkMatrix& getMatrix() const { return fMatrix; } | 103 const SkMatrix& getMatrix() const { return fMatrix; } |
| 102 bool reverseY() const { return fReverseY; } | 104 bool reverseY() const { return fReverseY; } |
| 103 | 105 |
| 104 /** Useful for effects that want to insert a texture matrix that is implied
by the texture | 106 /** Useful for effects that want to insert a texture matrix that is implied
by the texture |
| 105 dimensions */ | 107 dimensions */ |
| 106 static inline SkMatrix MakeDivByTextureWHMatrix(const GrTexture* texture) { | 108 static inline SkMatrix MakeDivByTextureWHMatrix(const GrTexture* texture) { |
| 107 SkASSERT(texture); | 109 SkASSERT(texture); |
| 108 SkMatrix mat; | 110 SkMatrix mat; |
| 109 mat.setIDiv(texture->width(), texture->height()); | 111 mat.setIDiv(texture->width(), texture->height()); |
| 110 return mat; | 112 return mat; |
| 111 } | 113 } |
| 112 | 114 |
| 113 private: | 115 private: |
| 114 GrCoordSet fSourceCoords; | 116 GrCoordSet fSourceCoords; |
| 115 SkMatrix fMatrix; | 117 SkMatrix fMatrix; |
| 116 bool fReverseY; | 118 bool fReverseY; |
| 117 | 119 |
| 118 typedef SkNoncopyable INHERITED; | 120 typedef SkNoncopyable INHERITED; |
| 119 | 121 |
| 120 #ifdef SK_DEBUG | 122 #ifdef SK_DEBUG |
| 121 public: | 123 public: |
| 122 void setInProcessor() const { fInProcessor = true; } | 124 void setInProcessor() const { fInProcessor = true; } |
| 123 private: | 125 private: |
| 124 mutable bool fInProcessor; | 126 mutable bool fInProcessor; |
| 125 #endif | 127 #endif |
| 126 }; | 128 }; |
| 127 | 129 |
| 128 #endif | 130 #endif |
| OLD | NEW |