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 #include "GrGLTexture.h" | 8 #include "GrGLTexture.h" |
9 #include "GrGpuGL.h" | 9 #include "GrGpuGL.h" |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... | |
22 GrGLTexture::GrGLTexture(GrGpuGL* gpu, const GrSurfaceDesc& desc, const IDDesc& idDesc, Derived) | 22 GrGLTexture::GrGLTexture(GrGpuGL* gpu, const GrSurfaceDesc& desc, const IDDesc& idDesc, Derived) |
23 : INHERITED(gpu, idDesc.fIsWrapped, desc) | 23 : INHERITED(gpu, idDesc.fIsWrapped, desc) |
24 , GrSurface(gpu, idDesc.fIsWrapped, desc) { | 24 , GrSurface(gpu, idDesc.fIsWrapped, desc) { |
25 this->init(desc, idDesc); | 25 this->init(desc, idDesc); |
26 } | 26 } |
27 | 27 |
28 void GrGLTexture::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) { | 28 void GrGLTexture::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) { |
29 SkASSERT(0 != idDesc.fTextureID); | 29 SkASSERT(0 != idDesc.fTextureID); |
30 fTexParams.invalidate(); | 30 fTexParams.invalidate(); |
31 fTexParamsTimestamp = GrGpu::kExpiredTimestamp; | 31 fTexParamsTimestamp = GrGpu::kExpiredTimestamp; |
32 fTexIDObj.reset(SkNEW_ARGS(GrGLTexID, (GPUGL->glInterface(), | 32 fTextureID = idDesc.fTextureID; |
33 idDesc.fTextureID, | |
34 idDesc.fIsWrapped))); | |
35 } | 33 } |
36 | 34 |
37 void GrGLTexture::onRelease() { | 35 void GrGLTexture::onRelease() { |
robertphillips
2014/11/03 15:56:01
Don't we still need to worry if it is wrapped ?
bsalomon
2014/11/03 15:58:15
Oh, of course. Fixed.
| |
38 fTexIDObj.reset(NULL); | 36 if (fTextureID) { |
37 GL_CALL(DeleteTextures(1, &fTextureID)); | |
38 fTextureID = 0; | |
39 } | |
39 INHERITED::onRelease(); | 40 INHERITED::onRelease(); |
40 } | 41 } |
41 | 42 |
42 void GrGLTexture::onAbandon() { | 43 void GrGLTexture::onAbandon() { |
43 if (fTexIDObj.get()) { | 44 fTextureID = 0; |
44 fTexIDObj->abandon(); | |
45 fTexIDObj.reset(NULL); | |
46 } | |
47 | |
48 INHERITED::onAbandon(); | 45 INHERITED::onAbandon(); |
49 } | 46 } |
50 | 47 |
51 GrBackendObject GrGLTexture::getTextureHandle() const { | 48 GrBackendObject GrGLTexture::getTextureHandle() const { |
52 return static_cast<GrBackendObject>(this->textureID()); | 49 return static_cast<GrBackendObject>(this->textureID()); |
53 } | 50 } |
OLD | NEW |