OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #ifndef GrTexture_DEFINED | 9 #ifndef GrTexture_DEFINED |
10 #define GrTexture_DEFINED | 10 #define GrTexture_DEFINED |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // These two shift a fixed-point value into normalized coordinates | 63 // These two shift a fixed-point value into normalized coordinates |
64 // for this texture if the texture is power of two sized. | 64 // for this texture if the texture is power of two sized. |
65 int fShiftFixedX; | 65 int fShiftFixedX; |
66 int fShiftFixedY; | 66 int fShiftFixedY; |
67 | 67 |
68 friend class GrTexturePriv; | 68 friend class GrTexturePriv; |
69 | 69 |
70 typedef GrSurface INHERITED; | 70 typedef GrSurface INHERITED; |
71 }; | 71 }; |
72 | 72 |
73 /** | |
74 * Represents a texture that is intended to be accessed in device coords with an
offset. | |
75 */ | |
76 class GrDeviceCoordTexture { | |
77 public: | |
78 GrDeviceCoordTexture() { fOffset.set(0, 0); } | |
79 | |
80 GrDeviceCoordTexture(const GrDeviceCoordTexture& other) { | |
81 *this = other; | |
82 } | |
83 | |
84 GrDeviceCoordTexture(GrTexture* texture, const SkIPoint& offset) | |
85 : fTexture(SkSafeRef(texture)) | |
86 , fOffset(offset) { | |
87 } | |
88 | |
89 GrDeviceCoordTexture& operator=(const GrDeviceCoordTexture& other) { | |
90 fTexture.reset(SkSafeRef(other.fTexture.get())); | |
91 fOffset = other.fOffset; | |
92 return *this; | |
93 } | |
94 | |
95 const SkIPoint& offset() const { return fOffset; } | |
96 | |
97 void setOffset(const SkIPoint& offset) { fOffset = offset; } | |
98 void setOffset(int ox, int oy) { fOffset.set(ox, oy); } | |
99 | |
100 GrTexture* texture() const { return fTexture.get(); } | |
101 | |
102 GrTexture* setTexture(GrTexture* texture) { | |
103 fTexture.reset(SkSafeRef(texture)); | |
104 return texture; | |
105 } | |
106 | |
107 private: | |
108 SkAutoTUnref<GrTexture> fTexture; | |
109 SkIPoint fOffset; | |
110 }; | |
111 | |
112 #endif | 73 #endif |
OLD | NEW |