Index: src/gpu/gl/GrGLTexture.cpp |
diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp |
index ea02274ad72ad046295c78e70ba1effbcafcbdee..6c8f901e3f1ebccc71f10dc79845303f6037ab71 100644 |
--- a/src/gpu/gl/GrGLTexture.cpp |
+++ b/src/gpu/gl/GrGLTexture.cpp |
@@ -26,24 +26,33 @@ inline static GrSLType sampler_type(const GrGLTexture::IDDesc& idDesc, const GrG |
} |
// Because this class is virtually derived from GrSurface we must explicitly call its constructor. |
-GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc& idDesc) |
- : GrSurface(gpu, idDesc.fLifeCycle, desc) |
- , INHERITED(gpu, idDesc.fLifeCycle, desc, sampler_type(idDesc, gpu), false) { |
+GrGLTexture::GrGLTexture(GrGLGpu* gpu, SkBudgeted budgeted, const GrSurfaceDesc& desc, |
+ const IDDesc& idDesc) |
+ : GrSurface(gpu, desc) |
+ , INHERITED(gpu, desc, sampler_type(idDesc, gpu), false) { |
this->init(desc, idDesc); |
- this->registerWithCache(); |
+ this->registerWithCache(budgeted); |
} |
-GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc& idDesc, |
+GrGLTexture::GrGLTexture(GrGLGpu* gpu, SkBudgeted budgeted, const GrSurfaceDesc& desc, |
+ const IDDesc& idDesc, |
bool wasMipMapDataProvided) |
- : GrSurface(gpu, idDesc.fLifeCycle, desc) |
- , INHERITED(gpu, idDesc.fLifeCycle, desc, sampler_type(idDesc, gpu), wasMipMapDataProvided) { |
+ : GrSurface(gpu, desc) |
+ , INHERITED(gpu, desc, sampler_type(idDesc, gpu), wasMipMapDataProvided) { |
+ this->init(desc, idDesc); |
+ this->registerWithCache(budgeted); |
+} |
+ |
+GrGLTexture::GrGLTexture(GrGLGpu* gpu, Wrapped, const GrSurfaceDesc& desc, const IDDesc& idDesc) |
+ : GrSurface(gpu, desc) |
+ , INHERITED(gpu, desc, sampler_type(idDesc, gpu), false) { |
this->init(desc, idDesc); |
- this->registerWithCache(); |
+ this->registerWithCacheWrapped(); |
} |
-GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc& idDesc, Derived) |
- : GrSurface(gpu, idDesc.fLifeCycle, desc) |
- , INHERITED(gpu, idDesc.fLifeCycle, desc, sampler_type(idDesc, gpu), false) { |
+GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc& idDesc) |
+ : GrSurface(gpu, desc) |
+ , INHERITED(gpu, desc, sampler_type(idDesc, gpu), false) { |
this->init(desc, idDesc); |
} |
@@ -52,12 +61,12 @@ void GrGLTexture::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) { |
fTexParams.invalidate(); |
fTexParamsTimestamp = GrGpu::kExpiredTimestamp; |
fInfo = idDesc.fInfo; |
- fTextureIDLifecycle = idDesc.fLifeCycle; |
+ fTextureIDOwnership = idDesc.fOwnership; |
} |
void GrGLTexture::onRelease() { |
if (fInfo.fID) { |
- if (GrGpuResource::kBorrowed_LifeCycle != fTextureIDLifecycle) { |
+ if (GrBackendObjectOwnership::kBorrowed != fTextureIDOwnership) { |
GL_CALL(DeleteTextures(1, &fInfo.fID)); |
} |
fInfo.fID = 0; |
@@ -86,3 +95,9 @@ void GrGLTexture::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump, |
traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_texture", |
texture_id.c_str()); |
} |
+ |
+GrGLTexture* GrGLTexture::CreateWrapped(GrGLGpu* gpu, const GrSurfaceDesc& desc, |
+ const IDDesc& idDesc) { |
+ return new GrGLTexture(gpu, kWrapped, desc, idDesc); |
+} |
+ |