| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 | 8 |
| 9 #ifndef GrGLTexture_DEFINED | 9 #ifndef GrGLTexture_DEFINED |
| 10 #define GrGLTexture_DEFINED | 10 #define GrGLTexture_DEFINED |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 void invalidate() { memset(this, 0xff, sizeof(TexParams)); } | 26 void invalidate() { memset(this, 0xff, sizeof(TexParams)); } |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 struct IDDesc { | 29 struct IDDesc { |
| 30 GrGLuint fTextureID; | 30 GrGLuint fTextureID; |
| 31 bool fIsWrapped; | 31 bool fIsWrapped; |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 GrGLTexture(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&); | 34 GrGLTexture(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&); |
| 35 | 35 |
| 36 virtual GrBackendObject getTextureHandle() const SK_OVERRIDE; | 36 GrBackendObject getTextureHandle() const SK_OVERRIDE; |
| 37 | 37 |
| 38 virtual void textureParamsModified() SK_OVERRIDE { fTexParams.invalidate();
} | 38 void textureParamsModified() SK_OVERRIDE { fTexParams.invalidate(); } |
| 39 | 39 |
| 40 // These functions are used to track the texture parameters associated with
the texture. | 40 // These functions are used to track the texture parameters associated with
the texture. |
| 41 const TexParams& getCachedTexParams(GrGpu::ResetTimestamp* timestamp) const
{ | 41 const TexParams& getCachedTexParams(GrGpu::ResetTimestamp* timestamp) const
{ |
| 42 *timestamp = fTexParamsTimestamp; | 42 *timestamp = fTexParamsTimestamp; |
| 43 return fTexParams; | 43 return fTexParams; |
| 44 } | 44 } |
| 45 | 45 |
| 46 void setCachedTexParams(const TexParams& texParams, | 46 void setCachedTexParams(const TexParams& texParams, |
| 47 GrGpu::ResetTimestamp timestamp) { | 47 GrGpu::ResetTimestamp timestamp) { |
| 48 fTexParams = texParams; | 48 fTexParams = texParams; |
| 49 fTexParamsTimestamp = timestamp; | 49 fTexParamsTimestamp = timestamp; |
| 50 } | 50 } |
| 51 | 51 |
| 52 GrGLuint textureID() const { return fTextureID; } | 52 GrGLuint textureID() const { return fTextureID; } |
| 53 | 53 |
| 54 protected: | 54 protected: |
| 55 // The public constructor registers this object with the cache. However, onl
y the most derived | 55 // The public constructor registers this object with the cache. However, onl
y the most derived |
| 56 // class should register with the cache. This constructor does not do the re
gistration and | 56 // class should register with the cache. This constructor does not do the re
gistration and |
| 57 // rather moves that burden onto the derived class. | 57 // rather moves that burden onto the derived class. |
| 58 enum Derived { kDerived }; | 58 enum Derived { kDerived }; |
| 59 GrGLTexture(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&, Derived); | 59 GrGLTexture(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&, Derived); |
| 60 | 60 |
| 61 void init(const GrSurfaceDesc&, const IDDesc&); | 61 void init(const GrSurfaceDesc&, const IDDesc&); |
| 62 | 62 |
| 63 virtual void onAbandon() SK_OVERRIDE; | 63 void onAbandon() SK_OVERRIDE; |
| 64 virtual void onRelease() SK_OVERRIDE; | 64 void onRelease() SK_OVERRIDE; |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 TexParams fTexParams; | 67 TexParams fTexParams; |
| 68 GrGpu::ResetTimestamp fTexParamsTimestamp; | 68 GrGpu::ResetTimestamp fTexParamsTimestamp; |
| 69 GrGLuint fTextureID; | 69 GrGLuint fTextureID; |
| 70 | 70 |
| 71 // We track this separately from GrGpuResource because this may be both a te
xture and a render | 71 // We track this separately from GrGpuResource because this may be both a te
xture and a render |
| 72 // target, and the texture may be wrapped while the render target is not. | 72 // target, and the texture may be wrapped while the render target is not. |
| 73 bool fIsWrapped; | 73 bool fIsWrapped; |
| 74 | 74 |
| 75 typedef GrTexture INHERITED; | 75 typedef GrTexture INHERITED; |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 #endif | 78 #endif |
| OLD | NEW |