Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Unified Diff: src/gpu/gl/GrGLTexture.cpp

Issue 1429863009: Use a struct for client GL texture handles (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/gl/GrGLTexture.cpp
diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp
index 29f7423ba559156757c5a28db2bd4d816e0b0121..39a8d9279feef49637882b5e7a15a1c0e59305d5 100644
--- a/src/gpu/gl/GrGLTexture.cpp
+++ b/src/gpu/gl/GrGLTexture.cpp
@@ -27,31 +27,35 @@ GrGLTexture::GrGLTexture(GrGLGpu* gpu, const GrSurfaceDesc& desc, const IDDesc&
}
void GrGLTexture::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) {
- SkASSERT(0 != idDesc.fTextureID);
+ SkASSERT(0 != idDesc.fInfo.fID);
fTexParams.invalidate();
fTexParamsTimestamp = GrGpu::kExpiredTimestamp;
- fTarget = idDesc.fTarget;
- fTextureID = idDesc.fTextureID;
+ fInfo = idDesc.fInfo;
fTextureIDLifecycle = idDesc.fLifeCycle;
}
void GrGLTexture::onRelease() {
- if (fTextureID) {
+ if (fInfo.fID) {
if (GrGpuResource::kBorrowed_LifeCycle != fTextureIDLifecycle) {
- GL_CALL(DeleteTextures(1, &fTextureID));
+ GL_CALL(DeleteTextures(1, &fInfo.fID));
}
- fTextureID = 0;
+ fInfo.fID = 0;
}
INHERITED::onRelease();
}
void GrGLTexture::onAbandon() {
- fTextureID = 0;
+ fInfo.fTarget = 0;
+ fInfo.fID = 0;
INHERITED::onAbandon();
}
GrBackendObject GrGLTexture::getTextureHandle() const {
+#ifdef SK_IGNORE_GL_TEXTURE_TARGET
return static_cast<GrBackendObject>(this->textureID());
+#else
+ return reinterpret_cast<GrBackendObject>(&fInfo);
+#endif
}
void GrGLTexture::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump,

Powered by Google App Engine
This is Rietveld 408576698