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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 public: | 50 public: |
51 struct TexParams { | 51 struct TexParams { |
52 GrGLenum fMinFilter; | 52 GrGLenum fMinFilter; |
53 GrGLenum fMagFilter; | 53 GrGLenum fMagFilter; |
54 GrGLenum fWrapS; | 54 GrGLenum fWrapS; |
55 GrGLenum fWrapT; | 55 GrGLenum fWrapT; |
56 GrGLenum fSwizzleRGBA[4]; | 56 GrGLenum fSwizzleRGBA[4]; |
57 void invalidate() { memset(this, 0xff, sizeof(TexParams)); } | 57 void invalidate() { memset(this, 0xff, sizeof(TexParams)); } |
58 }; | 58 }; |
59 | 59 |
60 struct Desc : public GrSurfaceDesc { | 60 struct IDDesc { |
61 GrGLuint fTextureID; | 61 GrGLuint fTextureID; |
62 bool fIsWrapped; | 62 bool fIsWrapped; |
63 }; | 63 }; |
64 | 64 |
65 // creates a texture that is also an RT | 65 // creates a texture that is also an RT |
66 GrGLTexture(GrGpuGL* gpu, | 66 GrGLTexture(GrGpuGL* gpu, const GrSurfaceDesc&, const IDDesc&, const GrGLRen
derTarget::IDDesc&); |
67 const Desc& textureDesc, | |
68 const GrGLRenderTarget::Desc& rtDesc); | |
69 | 67 |
70 // creates a non-RT texture | 68 // creates a non-RT texture |
71 GrGLTexture(GrGpuGL* gpu, | 69 GrGLTexture(GrGpuGL* gpu, const GrSurfaceDesc&, const IDDesc&); |
72 const Desc& textureDesc); | |
73 | 70 |
74 virtual ~GrGLTexture() { this->release(); } | 71 virtual ~GrGLTexture() { this->release(); } |
75 | 72 |
76 virtual GrBackendObject getTextureHandle() const SK_OVERRIDE; | 73 virtual GrBackendObject getTextureHandle() const SK_OVERRIDE; |
77 | 74 |
78 virtual void textureParamsModified() SK_OVERRIDE { fTexParams.invalidate();
} | 75 virtual void textureParamsModified() SK_OVERRIDE { fTexParams.invalidate();
} |
79 | 76 |
80 // These functions are used to track the texture parameters associated with
the texture. | 77 // These functions are used to track the texture parameters associated with
the texture. |
81 const TexParams& getCachedTexParams(GrGpu::ResetTimestamp* timestamp) const
{ | 78 const TexParams& getCachedTexParams(GrGpu::ResetTimestamp* timestamp) const
{ |
82 *timestamp = fTexParamsTimestamp; | 79 *timestamp = fTexParamsTimestamp; |
(...skipping 11 matching lines...) Expand all Loading... |
94 protected: | 91 protected: |
95 // overrides of GrTexture | 92 // overrides of GrTexture |
96 virtual void onAbandon() SK_OVERRIDE; | 93 virtual void onAbandon() SK_OVERRIDE; |
97 virtual void onRelease() SK_OVERRIDE; | 94 virtual void onRelease() SK_OVERRIDE; |
98 | 95 |
99 private: | 96 private: |
100 TexParams fTexParams; | 97 TexParams fTexParams; |
101 GrGpu::ResetTimestamp fTexParamsTimestamp; | 98 GrGpu::ResetTimestamp fTexParamsTimestamp; |
102 SkAutoTUnref<GrGLTexID> fTexIDObj; | 99 SkAutoTUnref<GrGLTexID> fTexIDObj; |
103 | 100 |
104 void init(GrGpuGL* gpu, | 101 void init(GrGpuGL* gpu, const GrSurfaceDesc&, const IDDesc&, const GrGLRende
rTarget::IDDesc*); |
105 const Desc& textureDesc, | |
106 const GrGLRenderTarget::Desc* rtDesc); | |
107 | 102 |
108 typedef GrTexture INHERITED; | 103 typedef GrTexture INHERITED; |
109 }; | 104 }; |
110 | 105 |
111 #endif | 106 #endif |
OLD | NEW |