| 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 12 matching lines...) Expand all Loading... |
| 23 GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc&
idDesc, Derived) | 23 GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc&
idDesc, Derived) |
| 24 : GrSurface(gpu, idDesc.fLifeCycle, desc) | 24 : GrSurface(gpu, idDesc.fLifeCycle, desc) |
| 25 , INHERITED(gpu, idDesc.fLifeCycle, desc) { | 25 , INHERITED(gpu, idDesc.fLifeCycle, desc) { |
| 26 this->init(desc, idDesc); | 26 this->init(desc, idDesc); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void GrGLTexture::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) { | 29 void GrGLTexture::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) { |
| 30 SkASSERT(0 != idDesc.fTextureID); | 30 SkASSERT(0 != idDesc.fTextureID); |
| 31 fTexParams.invalidate(); | 31 fTexParams.invalidate(); |
| 32 fTexParamsTimestamp = GrGpu::kExpiredTimestamp; | 32 fTexParamsTimestamp = GrGpu::kExpiredTimestamp; |
| 33 fTarget = idDesc.fTarget; |
| 33 fTextureID = idDesc.fTextureID; | 34 fTextureID = idDesc.fTextureID; |
| 34 fTextureIDLifecycle = idDesc.fLifeCycle; | 35 fTextureIDLifecycle = idDesc.fLifeCycle; |
| 35 } | 36 } |
| 36 | 37 |
| 37 void GrGLTexture::onRelease() { | 38 void GrGLTexture::onRelease() { |
| 38 if (fTextureID) { | 39 if (fTextureID) { |
| 39 if (GrGpuResource::kBorrowed_LifeCycle != fTextureIDLifecycle) { | 40 if (GrGpuResource::kBorrowed_LifeCycle != fTextureIDLifecycle) { |
| 40 GL_CALL(DeleteTextures(1, &fTextureID)); | 41 GL_CALL(DeleteTextures(1, &fTextureID)); |
| 41 } | 42 } |
| 42 fTextureID = 0; | 43 fTextureID = 0; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 53 return static_cast<GrBackendObject>(this->textureID()); | 54 return static_cast<GrBackendObject>(this->textureID()); |
| 54 } | 55 } |
| 55 | 56 |
| 56 void GrGLTexture::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump, | 57 void GrGLTexture::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump, |
| 57 const SkString& dumpName) const { | 58 const SkString& dumpName) const { |
| 58 SkString texture_id; | 59 SkString texture_id; |
| 59 texture_id.appendU32(this->textureID()); | 60 texture_id.appendU32(this->textureID()); |
| 60 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_texture", | 61 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_texture", |
| 61 texture_id.c_str()); | 62 texture_id.c_str()); |
| 62 } | 63 } |
| OLD | NEW |