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 | 11 |
11 #define GPUGL static_cast<GrGLGpu*>(this->getGpu()) | 12 #define GPUGL static_cast<GrGLGpu*>(this->getGpu()) |
12 #define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X) | 13 #define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X) |
13 | 14 |
14 // Because this class is virtually derived from GrSurface we must explicitly cal
l its constructor. | 15 // Because this class is virtually derived from GrSurface we must explicitly cal
l its constructor. |
15 GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc&
idDesc) | 16 GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc&
idDesc) |
16 : GrSurface(gpu, idDesc.fLifeCycle, desc) | 17 : GrSurface(gpu, idDesc.fLifeCycle, desc) |
17 , INHERITED(gpu, idDesc.fLifeCycle, desc) { | 18 , INHERITED(gpu, idDesc.fLifeCycle, desc) { |
18 this->init(desc, idDesc); | 19 this->init(desc, idDesc); |
19 this->registerWithCache(); | 20 this->registerWithCache(); |
(...skipping 24 matching lines...) Expand all Loading... |
44 } | 45 } |
45 | 46 |
46 void GrGLTexture::onAbandon() { | 47 void GrGLTexture::onAbandon() { |
47 fTextureID = 0; | 48 fTextureID = 0; |
48 INHERITED::onAbandon(); | 49 INHERITED::onAbandon(); |
49 } | 50 } |
50 | 51 |
51 GrBackendObject GrGLTexture::getTextureHandle() const { | 52 GrBackendObject GrGLTexture::getTextureHandle() const { |
52 return static_cast<GrBackendObject>(this->textureID()); | 53 return static_cast<GrBackendObject>(this->textureID()); |
53 } | 54 } |
| 55 |
| 56 void GrGLTexture::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump, |
| 57 const SkString& dumpName) const { |
| 58 SkString texture_id; |
| 59 texture_id.appendU32(this->textureID()); |
| 60 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_texture", |
| 61 texture_id.c_str()); |
| 62 } |
OLD | NEW |