Index: gpu/src/GrGLRenderTarget.cpp |
=================================================================== |
--- gpu/src/GrGLRenderTarget.cpp (revision 0) |
+++ gpu/src/GrGLRenderTarget.cpp (revision 0) |
@@ -0,0 +1,71 @@ |
+ |
+/* |
+ * Copyright 2011 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+ |
+#include "GrGLRenderTarget.h" |
+ |
+#include "GrGpuGL.h" |
+ |
+#define GPUGL static_cast<GrGpuGL*>(getGpu()) |
+ |
+GrGLRenderTarget::GrGLRenderTarget(GrGpuGL* gpu, |
+ const GLRenderTargetIDs& ids, |
+ GrGLTexID* texID, |
+ GrPixelConfig config, |
+ GrGLuint stencilBits, |
+ bool isMultisampled, |
+ const GrGLIRect& viewport, |
+ GrGLTexture* texture) |
+ : INHERITED(gpu, texture, viewport.fWidth, |
+ viewport.fHeight, config, |
+ stencilBits, isMultisampled) { |
+ fRTFBOID = ids.fRTFBOID; |
+ fTexFBOID = ids.fTexFBOID; |
+ fStencilRenderbufferID = ids.fStencilRenderbufferID; |
+ fMSColorRenderbufferID = ids.fMSColorRenderbufferID; |
+ fViewport = viewport; |
+ fOwnIDs = ids.fOwnIDs; |
+ fTexIDObj = texID; |
+ GrSafeRef(fTexIDObj); |
+} |
+ |
+void GrGLRenderTarget::onRelease() { |
+ GPUGL->notifyRenderTargetDelete(this); |
+ if (fOwnIDs) { |
+ if (fTexFBOID) { |
+ GR_GL(DeleteFramebuffers(1, &fTexFBOID)); |
+ } |
+ if (fRTFBOID && fRTFBOID != fTexFBOID) { |
+ GR_GL(DeleteFramebuffers(1, &fRTFBOID)); |
+ } |
+ if (fStencilRenderbufferID) { |
+ GR_GL(DeleteRenderbuffers(1, &fStencilRenderbufferID)); |
+ } |
+ if (fMSColorRenderbufferID) { |
+ GR_GL(DeleteRenderbuffers(1, &fMSColorRenderbufferID)); |
+ } |
+ } |
+ fRTFBOID = 0; |
+ fTexFBOID = 0; |
+ fStencilRenderbufferID = 0; |
+ fMSColorRenderbufferID = 0; |
+ GrSafeUnref(fTexIDObj); |
+ fTexIDObj = NULL; |
+} |
+ |
+void GrGLRenderTarget::onAbandon() { |
+ fRTFBOID = 0; |
+ fTexFBOID = 0; |
+ fStencilRenderbufferID = 0; |
+ fMSColorRenderbufferID = 0; |
+ if (NULL != fTexIDObj) { |
+ fTexIDObj->abandon(); |
+ fTexIDObj = NULL; |
+ } |
+} |
+ |
Property changes on: gpu\src\GrGLRenderTarget.cpp |
___________________________________________________________________ |
Added: svn:eol-style |
+ LF |