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" |
11 | 11 |
12 #define GPUGL static_cast<GrGLGpu*>(this->getGpu()) | 12 #define GPUGL static_cast<GrGLGpu*>(this->getGpu()) |
13 #define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X) | 13 #define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X) |
14 | 14 |
15 // 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. |
16 GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc&
idDesc) | 16 GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc&
idDesc) |
17 : GrSurface(gpu, idDesc.fLifeCycle, desc) | 17 : GrSurface(gpu, idDesc.fLifeCycle, desc) |
18 , INHERITED(gpu, idDesc.fLifeCycle, desc) { | 18 , INHERITED(gpu, idDesc.fLifeCycle, desc, false) { |
| 19 this->init(desc, idDesc); |
| 20 this->registerWithCache(); |
| 21 } |
| 22 |
| 23 GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc&
idDesc, |
| 24 bool wasMipMapDataProvided) |
| 25 : GrSurface(gpu, idDesc.fLifeCycle, desc) |
| 26 , INHERITED(gpu, idDesc.fLifeCycle, desc, wasMipMapDataProvided) { |
19 this->init(desc, idDesc); | 27 this->init(desc, idDesc); |
20 this->registerWithCache(); | 28 this->registerWithCache(); |
21 } | 29 } |
22 | 30 |
23 GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc&
idDesc, Derived) | 31 GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc&
idDesc, Derived) |
24 : GrSurface(gpu, idDesc.fLifeCycle, desc) | 32 : GrSurface(gpu, idDesc.fLifeCycle, desc) |
25 , INHERITED(gpu, idDesc.fLifeCycle, desc) { | 33 , INHERITED(gpu, idDesc.fLifeCycle, desc, false) { |
26 this->init(desc, idDesc); | 34 this->init(desc, idDesc); |
27 } | 35 } |
28 | 36 |
29 void GrGLTexture::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) { | 37 void GrGLTexture::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) { |
30 SkASSERT(0 != idDesc.fInfo.fID); | 38 SkASSERT(0 != idDesc.fInfo.fID); |
31 fTexParams.invalidate(); | 39 fTexParams.invalidate(); |
32 fTexParamsTimestamp = GrGpu::kExpiredTimestamp; | 40 fTexParamsTimestamp = GrGpu::kExpiredTimestamp; |
33 fInfo = idDesc.fInfo; | 41 fInfo = idDesc.fInfo; |
34 fTextureIDLifecycle = idDesc.fLifeCycle; | 42 fTextureIDLifecycle = idDesc.fLifeCycle; |
35 } | 43 } |
(...skipping 28 matching lines...) Expand all Loading... |
64 #endif | 72 #endif |
65 } | 73 } |
66 | 74 |
67 void GrGLTexture::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump, | 75 void GrGLTexture::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump, |
68 const SkString& dumpName) const { | 76 const SkString& dumpName) const { |
69 SkString texture_id; | 77 SkString texture_id; |
70 texture_id.appendU32(this->textureID()); | 78 texture_id.appendU32(this->textureID()); |
71 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_texture", | 79 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_texture", |
72 texture_id.c_str()); | 80 texture_id.c_str()); |
73 } | 81 } |
OLD | NEW |