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 #ifndef GrRenderTarget_DEFINED | 8 #ifndef GrRenderTarget_DEFINED |
9 #define GrRenderTarget_DEFINED | 9 #define GrRenderTarget_DEFINED |
10 | 10 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 GrRenderTarget(GrGpu* gpu, | 141 GrRenderTarget(GrGpu* gpu, |
142 bool isWrapped, | 142 bool isWrapped, |
143 GrTexture* texture, | 143 GrTexture* texture, |
144 const GrTextureDesc& desc) | 144 const GrTextureDesc& desc) |
145 : INHERITED(gpu, isWrapped, desc) | 145 : INHERITED(gpu, isWrapped, desc) |
146 , fStencilBuffer(NULL) | 146 , fStencilBuffer(NULL) |
147 , fTexture(texture) { | 147 , fTexture(texture) { |
148 fResolveRect.setLargestInverted(); | 148 fResolveRect.setLargestInverted(); |
149 } | 149 } |
150 | 150 |
151 friend class GrTexture; | |
152 // When a texture unrefs an owned render target this func | |
153 // removes the back pointer. This could be called from | |
154 // texture's destructor but would have to be done in derived | |
155 // classes. By the time of texture base destructor it has already | |
bsalomon
2013/04/09 13:38:27
This comment no longer applies.
| |
156 // lost its pointer to the rt. | |
157 void onTextureReleaseRenderTarget() { | |
158 GrAssert(NULL != fTexture); | |
159 fTexture = NULL; | |
160 } | |
161 | |
162 // override of GrResource | 151 // override of GrResource |
163 virtual void onAbandon() SK_OVERRIDE; | 152 virtual void onAbandon() SK_OVERRIDE; |
164 virtual void onRelease() SK_OVERRIDE; | 153 virtual void onRelease() SK_OVERRIDE; |
165 | 154 |
166 private: | 155 private: |
156 friend class GrTexture; | |
bsalomon
2013/04/09 13:38:27
This block was added to the original change.
| |
157 // called by ~GrTexture to remove the non-ref'ed back ptr. | |
158 void owningTextureDestroyed() { | |
159 GrAssert(NULL != fTexture); | |
160 fTexture = NULL; | |
161 } | |
162 | |
167 GrStencilBuffer* fStencilBuffer; | 163 GrStencilBuffer* fStencilBuffer; |
168 GrTexture* fTexture; // not ref'ed | 164 GrTexture* fTexture; // not ref'ed |
169 | 165 |
170 GrIRect fResolveRect; | 166 GrIRect fResolveRect; |
171 | 167 |
172 typedef GrSurface INHERITED; | 168 typedef GrSurface INHERITED; |
173 }; | 169 }; |
174 | 170 |
175 #endif | 171 #endif |
OLD | NEW |