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

Side by Side Diff: include/gpu/GrCoordTransform.h

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « include/gpu/GrContextFactory.h ('k') | include/gpu/GrDrawEffect.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 * framework should internally do a y reversal to account for it being upsid e down by Skia's 56 * framework should internally do a y reversal to account for it being upsid e down by Skia's
57 * coord convention. 57 * coord convention.
58 */ 58 */
59 GrCoordTransform(GrCoordSet sourceCoords, const SkMatrix& m, const GrTexture * texture = NULL) { 59 GrCoordTransform(GrCoordSet sourceCoords, const SkMatrix& m, const GrTexture * texture = NULL) {
60 SkDEBUGCODE(fInEffect = false); 60 SkDEBUGCODE(fInEffect = false);
61 this->reset(sourceCoords, m, texture); 61 this->reset(sourceCoords, m, texture);
62 } 62 }
63 63
64 void reset(GrCoordSet sourceCoords, const GrTexture* texture) { 64 void reset(GrCoordSet sourceCoords, const GrTexture* texture) {
65 SkASSERT(!fInEffect); 65 SkASSERT(!fInEffect);
66 SkASSERT(NULL != texture); 66 SkASSERT(texture);
67 this->reset(sourceCoords, MakeDivByTextureWHMatrix(texture), texture); 67 this->reset(sourceCoords, MakeDivByTextureWHMatrix(texture), texture);
68 } 68 }
69 69
70 void reset(GrCoordSet sourceCoords, const SkMatrix& m, const GrTexture* text ure = NULL) { 70 void reset(GrCoordSet sourceCoords, const SkMatrix& m, const GrTexture* text ure = NULL) {
71 SkASSERT(!fInEffect); 71 SkASSERT(!fInEffect);
72 fSourceCoords = sourceCoords; 72 fSourceCoords = sourceCoords;
73 fMatrix = m; 73 fMatrix = m;
74 fReverseY = NULL != texture && kBottomLeft_GrSurfaceOrigin == texture->o rigin(); 74 fReverseY = texture && kBottomLeft_GrSurfaceOrigin == texture->origin();
75 } 75 }
76 76
77 GrCoordTransform& operator= (const GrCoordTransform& other) { 77 GrCoordTransform& operator= (const GrCoordTransform& other) {
78 SkASSERT(!fInEffect); 78 SkASSERT(!fInEffect);
79 fSourceCoords = other.fSourceCoords; 79 fSourceCoords = other.fSourceCoords;
80 fMatrix = other.fMatrix; 80 fMatrix = other.fMatrix;
81 fReverseY = other.fReverseY; 81 fReverseY = other.fReverseY;
82 return *this; 82 return *this;
83 } 83 }
84 84
(...skipping 12 matching lines...) Expand all
97 fReverseY == other.fReverseY; 97 fReverseY == other.fReverseY;
98 } 98 }
99 99
100 GrCoordSet sourceCoords() const { return fSourceCoords; } 100 GrCoordSet sourceCoords() const { return fSourceCoords; }
101 const SkMatrix& getMatrix() const { return fMatrix; } 101 const SkMatrix& getMatrix() const { return fMatrix; }
102 bool reverseY() const { return fReverseY; } 102 bool reverseY() const { return fReverseY; }
103 103
104 /** Useful for effects that want to insert a texture matrix that is implied by the texture 104 /** Useful for effects that want to insert a texture matrix that is implied by the texture
105 dimensions */ 105 dimensions */
106 static inline SkMatrix MakeDivByTextureWHMatrix(const GrTexture* texture) { 106 static inline SkMatrix MakeDivByTextureWHMatrix(const GrTexture* texture) {
107 SkASSERT(NULL != texture); 107 SkASSERT(texture);
108 SkMatrix mat; 108 SkMatrix mat;
109 mat.setIDiv(texture->width(), texture->height()); 109 mat.setIDiv(texture->width(), texture->height());
110 return mat; 110 return mat;
111 } 111 }
112 112
113 private: 113 private:
114 GrCoordSet fSourceCoords; 114 GrCoordSet fSourceCoords;
115 SkMatrix fMatrix; 115 SkMatrix fMatrix;
116 bool fReverseY; 116 bool fReverseY;
117 117
118 typedef SkNoncopyable INHERITED; 118 typedef SkNoncopyable INHERITED;
119 119
120 #ifdef SK_DEBUG 120 #ifdef SK_DEBUG
121 public: 121 public:
122 void setInEffect() const { fInEffect = true; } 122 void setInEffect() const { fInEffect = true; }
123 private: 123 private:
124 mutable bool fInEffect; 124 mutable bool fInEffect;
125 #endif 125 #endif
126 }; 126 };
127 127
128 #endif 128 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrContextFactory.h ('k') | include/gpu/GrDrawEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698