| 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 "GrGLRenderTarget.h" | 8 #include "GrGLRenderTarget.h" |
| 9 | 9 |
| 10 #include "GrGpuGL.h" | 10 #include "GrGpuGL.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 desc.fIsWrapped, | 72 desc.fIsWrapped, |
| 73 NULL, | 73 NULL, |
| 74 MakeDesc(kNone_GrTextureFlags, | 74 MakeDesc(kNone_GrTextureFlags, |
| 75 viewport.fWidth, viewport.fHeight, | 75 viewport.fWidth, viewport.fHeight, |
| 76 desc.fConfig, desc.fSampleCnt, | 76 desc.fConfig, desc.fSampleCnt, |
| 77 desc.fOrigin)) { | 77 desc.fOrigin)) { |
| 78 this->init(desc, viewport, NULL); | 78 this->init(desc, viewport, NULL); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void GrGLRenderTarget::onRelease() { | 81 void GrGLRenderTarget::onRelease() { |
| 82 GPUGL->notifyRenderTargetDelete(this); |
| 82 if (!this->isWrapped()) { | 83 if (!this->isWrapped()) { |
| 83 if (fTexFBOID) { | 84 if (fTexFBOID) { |
| 84 GL_CALL(DeleteFramebuffers(1, &fTexFBOID)); | 85 GL_CALL(DeleteFramebuffers(1, &fTexFBOID)); |
| 85 } | 86 } |
| 86 if (fRTFBOID && fRTFBOID != fTexFBOID) { | 87 if (fRTFBOID && fRTFBOID != fTexFBOID) { |
| 87 GL_CALL(DeleteFramebuffers(1, &fRTFBOID)); | 88 GL_CALL(DeleteFramebuffers(1, &fRTFBOID)); |
| 88 } | 89 } |
| 89 if (fMSColorRenderbufferID) { | 90 if (fMSColorRenderbufferID) { |
| 90 GL_CALL(DeleteRenderbuffers(1, &fMSColorRenderbufferID)); | 91 GL_CALL(DeleteRenderbuffers(1, &fMSColorRenderbufferID)); |
| 91 } | 92 } |
| 92 } | 93 } |
| 93 fRTFBOID = 0; | 94 fRTFBOID = 0; |
| 94 fTexFBOID = 0; | 95 fTexFBOID = 0; |
| 95 fMSColorRenderbufferID = 0; | 96 fMSColorRenderbufferID = 0; |
| 96 fTexIDObj.reset(NULL); | 97 fTexIDObj.reset(NULL); |
| 97 INHERITED::onRelease(); | 98 INHERITED::onRelease(); |
| 98 } | 99 } |
| 99 | 100 |
| 100 void GrGLRenderTarget::onAbandon() { | 101 void GrGLRenderTarget::onAbandon() { |
| 101 fRTFBOID = 0; | 102 fRTFBOID = 0; |
| 102 fTexFBOID = 0; | 103 fTexFBOID = 0; |
| 103 fMSColorRenderbufferID = 0; | 104 fMSColorRenderbufferID = 0; |
| 104 if (NULL != fTexIDObj.get()) { | 105 if (NULL != fTexIDObj.get()) { |
| 105 fTexIDObj->abandon(); | 106 fTexIDObj->abandon(); |
| 106 fTexIDObj.reset(NULL); | 107 fTexIDObj.reset(NULL); |
| 107 } | 108 } |
| 108 INHERITED::onAbandon(); | 109 INHERITED::onAbandon(); |
| 109 } | 110 } |
| OLD | NEW |