| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 GrTextureAccess_DEFINED | 8 #ifndef GrTextureAccess_DEFINED |
| 9 #define GrTextureAccess_DEFINED | 9 #define GrTextureAccess_DEFINED |
| 10 | 10 |
| 11 #include "GrProgramResource.h" | 11 #include "GrGpuResourceRef.h" |
| 12 #include "GrTexture.h" | 12 #include "GrTexture.h" |
| 13 #include "SkRefCnt.h" | 13 #include "SkRefCnt.h" |
| 14 #include "SkShader.h" | 14 #include "SkShader.h" |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * Represents the filtering and tile modes used to access a texture. It is mostl
y used with | 17 * Represents the filtering and tile modes used to access a texture. It is mostl
y used with |
| 18 * GrTextureAccess (defined below). Also, some of the texture cache methods requ
ire knowledge about | 18 * GrTextureAccess (defined below). Also, some of the texture cache methods requ
ire knowledge about |
| 19 * filtering and tiling to perform a cache lookup. If it wasn't for this latter
usage this would | 19 * filtering and tiling to perform a cache lookup. If it wasn't for this latter
usage this would |
| 20 * be folded into GrTextureAccess. The default is clamp tile modes and no filter
ing. | 20 * be folded into GrTextureAccess. The default is clamp tile modes and no filter
ing. |
| 21 */ | 21 */ |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 (0 == memcmp(fSwizzle, other.fSwizzle, sizeof(fSwizzle)-1)); | 160 (0 == memcmp(fSwizzle, other.fSwizzle, sizeof(fSwizzle)-1)); |
| 161 } | 161 } |
| 162 | 162 |
| 163 bool operator!= (const GrTextureAccess& other) const { return !(*this == oth
er); } | 163 bool operator!= (const GrTextureAccess& other) const { return !(*this == oth
er); } |
| 164 | 164 |
| 165 GrTexture* getTexture() const { return fTexture.get(); } | 165 GrTexture* getTexture() const { return fTexture.get(); } |
| 166 | 166 |
| 167 /** | 167 /** |
| 168 * For internal use by GrEffect. | 168 * For internal use by GrEffect. |
| 169 */ | 169 */ |
| 170 const GrProgramResource* getProgramTexture() const { return &fTexture; } | 170 const GrGpuResourceRef* getProgramTexture() const { return &fTexture; } |
| 171 | 171 |
| 172 /** | 172 /** |
| 173 * Returns a string representing the swizzle. The string is is null-terminat
ed. | 173 * Returns a string representing the swizzle. The string is is null-terminat
ed. |
| 174 */ | 174 */ |
| 175 const char* getSwizzle() const { return fSwizzle; } | 175 const char* getSwizzle() const { return fSwizzle; } |
| 176 | 176 |
| 177 /** Returns a mask indicating which components are referenced in the swizzle
. The return | 177 /** Returns a mask indicating which components are referenced in the swizzle
. The return |
| 178 is a bitfield of GrColorComponentFlags. */ | 178 is a bitfield of GrColorComponentFlags. */ |
| 179 uint32_t swizzleMask() const { return fSwizzleMask; } | 179 uint32_t swizzleMask() const { return fSwizzleMask; } |
| 180 | 180 |
| 181 const GrTextureParams& getParams() const { return fParams; } | 181 const GrTextureParams& getParams() const { return fParams; } |
| 182 | 182 |
| 183 private: | 183 private: |
| 184 void setSwizzle(const char*); | 184 void setSwizzle(const char*); |
| 185 | 185 |
| 186 typedef GrProgramTResource<GrTexture> ProgramTexture; | 186 typedef GrTGpuResourceRef<GrTexture> ProgramTexture; |
| 187 | 187 |
| 188 ProgramTexture fTexture; | 188 ProgramTexture fTexture; |
| 189 GrTextureParams fParams; | 189 GrTextureParams fParams; |
| 190 uint32_t fSwizzleMask; | 190 uint32_t fSwizzleMask; |
| 191 char fSwizzle[5]; | 191 char fSwizzle[5]; |
| 192 | 192 |
| 193 typedef SkNoncopyable INHERITED; | 193 typedef SkNoncopyable INHERITED; |
| 194 }; | 194 }; |
| 195 | 195 |
| 196 #endif | 196 #endif |
| OLD | NEW |