Make GrResource know whether 3D objects' lifetimes are managed by Skia or not.
Review URL: https://codereview.appspot.com/7201046
git-svn-id: http://skia.googlecode.com/svn/trunk@7348 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGLIndexBuffer.cpp b/src/gpu/gl/GrGLIndexBuffer.cpp
index 66ee095..561133a 100644
--- a/src/gpu/gl/GrGLIndexBuffer.cpp
+++ b/src/gpu/gl/GrGLIndexBuffer.cpp
@@ -15,10 +15,11 @@
#define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X)
GrGLIndexBuffer::GrGLIndexBuffer(GrGpuGL* gpu,
+ bool isWrapped,
GrGLuint id,
size_t sizeInBytes,
bool dynamic)
- : INHERITED(gpu, sizeInBytes, dynamic)
+ : INHERITED(gpu, isWrapped, sizeInBytes, dynamic)
, fBufferID(id)
, fLockPtr(NULL) {
@@ -26,7 +27,7 @@
void GrGLIndexBuffer::onRelease() {
// make sure we've not been abandoned
- if (fBufferID) {
+ if (fBufferID && !this->isWrapped()) {
GPUGL->notifyIndexBufferDelete(this);
GL_CALL(DeleteBuffers(1, &fBufferID));
fBufferID = 0;
@@ -134,4 +135,3 @@
#endif
return true;
}
-