Chromium Code Reviews| 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 "GrGLGpu.h" | 9 #include "GrGLGpu.h" |
| 10 #include "SkTraceMemoryDump.h" | 10 #include "SkTraceMemoryDump.h" |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 SkASSERT(0 != idDesc.fInfo.fID); | 30 SkASSERT(0 != idDesc.fInfo.fID); |
| 31 fTexParams.invalidate(); | 31 fTexParams.invalidate(); |
| 32 fTexParamsTimestamp = GrGpu::kExpiredTimestamp; | 32 fTexParamsTimestamp = GrGpu::kExpiredTimestamp; |
| 33 fInfo = idDesc.fInfo; | 33 fInfo = idDesc.fInfo; |
| 34 fTextureIDLifecycle = idDesc.fLifeCycle; | 34 fTextureIDLifecycle = idDesc.fLifeCycle; |
| 35 } | 35 } |
| 36 | 36 |
| 37 void GrGLTexture::onRelease() { | 37 void GrGLTexture::onRelease() { |
| 38 if (fInfo.fID) { | 38 if (fInfo.fID) { |
| 39 if (GrGpuResource::kBorrowed_LifeCycle != fTextureIDLifecycle) { | 39 if (GrGpuResource::kBorrowed_LifeCycle != fTextureIDLifecycle) { |
| 40 if (desc().fTextureStorageAllocator.fDeallocateTextureStorage) { | |
| 41 desc().fTextureStorageAllocator.fDeallocateTextureStorage( | |
| 42 desc().fTextureStorageAllocator.fCtx, | |
| 43 reinterpret_cast<GrBackendObject>(&fInfo)); | |
| 44 } | |
| 40 GL_CALL(DeleteTextures(1, &fInfo.fID)); | 45 GL_CALL(DeleteTextures(1, &fInfo.fID)); |
|
bsalomon
2016/02/01 14:54:42
this->desc().
Shouldn't we be skipping DeleteText
erikchen
2016/02/01 22:58:32
Responded to both comments.
| |
| 41 } | 46 } |
| 42 fInfo.fID = 0; | 47 fInfo.fID = 0; |
| 43 } | 48 } |
| 44 INHERITED::onRelease(); | 49 INHERITED::onRelease(); |
| 45 } | 50 } |
| 46 | 51 |
| 47 void GrGLTexture::onAbandon() { | 52 void GrGLTexture::onAbandon() { |
| 48 fInfo.fTarget = 0; | 53 fInfo.fTarget = 0; |
| 49 fInfo.fID = 0; | 54 fInfo.fID = 0; |
| 50 INHERITED::onAbandon(); | 55 INHERITED::onAbandon(); |
| 51 } | 56 } |
| 52 | 57 |
| 53 GrBackendObject GrGLTexture::getTextureHandle() const { | 58 GrBackendObject GrGLTexture::getTextureHandle() const { |
| 54 #ifdef SK_IGNORE_GL_TEXTURE_TARGET | 59 #ifdef SK_IGNORE_GL_TEXTURE_TARGET |
| 55 return static_cast<GrBackendObject>(this->textureID()); | 60 return static_cast<GrBackendObject>(this->textureID()); |
| 56 #else | 61 #else |
| 57 return reinterpret_cast<GrBackendObject>(&fInfo); | 62 return reinterpret_cast<GrBackendObject>(&fInfo); |
| 58 #endif | 63 #endif |
| 59 } | 64 } |
| 60 | 65 |
| 61 void GrGLTexture::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump, | 66 void GrGLTexture::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump, |
| 62 const SkString& dumpName) const { | 67 const SkString& dumpName) const { |
| 63 SkString texture_id; | 68 SkString texture_id; |
| 64 texture_id.appendU32(this->textureID()); | 69 texture_id.appendU32(this->textureID()); |
| 65 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_texture", | 70 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_texture", |
| 66 texture_id.c_str()); | 71 texture_id.c_str()); |
| 67 } | 72 } |
| OLD | NEW |