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

Side by Side Diff: src/gpu/gl/GrGLTexture.h

Issue 19580003: Fix leak of GrGLTexID when its owning GrGLTexture has been abandoned. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 // creates a texture that is also an RT 64 // creates a texture that is also an RT
65 GrGLTexture(GrGpuGL* gpu, 65 GrGLTexture(GrGpuGL* gpu,
66 const Desc& textureDesc, 66 const Desc& textureDesc,
67 const GrGLRenderTarget::Desc& rtDesc); 67 const GrGLRenderTarget::Desc& rtDesc);
68 68
69 // creates a non-RT texture 69 // creates a non-RT texture
70 GrGLTexture(GrGpuGL* gpu, 70 GrGLTexture(GrGpuGL* gpu,
71 const Desc& textureDesc); 71 const Desc& textureDesc);
72 72
73
74 virtual ~GrGLTexture() { this->release(); } 73 virtual ~GrGLTexture() { this->release(); }
75 74
76 virtual GrBackendObject getTextureHandle() const SK_OVERRIDE; 75 virtual GrBackendObject getTextureHandle() const SK_OVERRIDE;
77 76
78 virtual void invalidateCachedState() SK_OVERRIDE { fTexParams.invalidate(); } 77 virtual void invalidateCachedState() SK_OVERRIDE { fTexParams.invalidate(); }
79 78
80 // these functions 79 // These functions are used to track the texture parameters associated with the texture.
81 const TexParams& getCachedTexParams(GrGpu::ResetTimestamp* timestamp) const { 80 const TexParams& getCachedTexParams(GrGpu::ResetTimestamp* timestamp) const {
82 *timestamp = fTexParamsTimestamp; 81 *timestamp = fTexParamsTimestamp;
83 return fTexParams; 82 return fTexParams;
84 } 83 }
84
85 void setCachedTexParams(const TexParams& texParams, 85 void setCachedTexParams(const TexParams& texParams,
86 GrGpu::ResetTimestamp timestamp) { 86 GrGpu::ResetTimestamp timestamp) {
87 fTexParams = texParams; 87 fTexParams = texParams;
88 fTexParamsTimestamp = timestamp; 88 fTexParamsTimestamp = timestamp;
89 } 89 }
90 GrGLuint textureID() const { return fTexIDObj->id(); } 90
91 GrGLuint textureID() const { return (NULL != fTexIDObj.get()) ? fTexIDObj->i d() : 0; }
91 92
92 protected: 93 protected:
93
94 // overrides of GrTexture 94 // overrides of GrTexture
95 virtual void onAbandon() SK_OVERRIDE; 95 virtual void onAbandon() SK_OVERRIDE;
96 virtual void onRelease() SK_OVERRIDE; 96 virtual void onRelease() SK_OVERRIDE;
97 97
98 private: 98 private:
99 TexParams fTexParams; 99 TexParams fTexParams;
100 GrGpu::ResetTimestamp fTexParamsTimestamp; 100 GrGpu::ResetTimestamp fTexParamsTimestamp;
101 GrGLTexID* fTexIDObj; 101 SkAutoTUnref<GrGLTexID> fTexIDObj;
102 102
103 void init(GrGpuGL* gpu, 103 void init(GrGpuGL* gpu,
104 const Desc& textureDesc, 104 const Desc& textureDesc,
105 const GrGLRenderTarget::Desc* rtDesc); 105 const GrGLRenderTarget::Desc* rtDesc);
106 106
107 typedef GrTexture INHERITED; 107 typedef GrTexture INHERITED;
108 }; 108 };
109 109
110 #endif 110 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698