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 12 matching lines...) Expand all Loading... |
23 : GrSurface(gpu, idDesc.fIsWrapped, desc) | 23 : GrSurface(gpu, idDesc.fIsWrapped, desc) |
24 , INHERITED(gpu, idDesc.fIsWrapped, desc) { | 24 , INHERITED(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 fTextureID = idDesc.fTextureID; | 32 fTextureID = idDesc.fTextureID; |
| 33 fIsWrapped = idDesc.fIsWrapped; |
33 } | 34 } |
34 | 35 |
35 void GrGLTexture::onRelease() { | 36 void GrGLTexture::onRelease() { |
36 if (fTextureID) { | 37 if (fTextureID) { |
37 if (!this->isWrapped()) { | 38 if (!fIsWrapped) { |
38 GL_CALL(DeleteTextures(1, &fTextureID)); | 39 GL_CALL(DeleteTextures(1, &fTextureID)); |
39 } | 40 } |
40 fTextureID = 0; | 41 fTextureID = 0; |
| 42 fIsWrapped = false; |
41 } | 43 } |
42 INHERITED::onRelease(); | 44 INHERITED::onRelease(); |
43 } | 45 } |
44 | 46 |
45 void GrGLTexture::onAbandon() { | 47 void GrGLTexture::onAbandon() { |
46 fTextureID = 0; | 48 fTextureID = 0; |
| 49 fIsWrapped = false; |
47 INHERITED::onAbandon(); | 50 INHERITED::onAbandon(); |
48 } | 51 } |
49 | 52 |
50 GrBackendObject GrGLTexture::getTextureHandle() const { | 53 GrBackendObject GrGLTexture::getTextureHandle() const { |
51 return static_cast<GrBackendObject>(this->textureID()); | 54 return static_cast<GrBackendObject>(this->textureID()); |
52 } | 55 } |
OLD | NEW |