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); | |
83 if (!this->isWrapped()) { | 82 if (!this->isWrapped()) { |
84 if (fTexFBOID) { | 83 if (fTexFBOID) { |
85 GL_CALL(DeleteFramebuffers(1, &fTexFBOID)); | 84 GL_CALL(DeleteFramebuffers(1, &fTexFBOID)); |
86 } | 85 } |
87 if (fRTFBOID && fRTFBOID != fTexFBOID) { | 86 if (fRTFBOID && fRTFBOID != fTexFBOID) { |
88 GL_CALL(DeleteFramebuffers(1, &fRTFBOID)); | 87 GL_CALL(DeleteFramebuffers(1, &fRTFBOID)); |
89 } | 88 } |
90 if (fMSColorRenderbufferID) { | 89 if (fMSColorRenderbufferID) { |
91 GL_CALL(DeleteRenderbuffers(1, &fMSColorRenderbufferID)); | 90 GL_CALL(DeleteRenderbuffers(1, &fMSColorRenderbufferID)); |
92 } | 91 } |
93 } | 92 } |
94 fRTFBOID = 0; | 93 fRTFBOID = 0; |
95 fTexFBOID = 0; | 94 fTexFBOID = 0; |
96 fMSColorRenderbufferID = 0; | 95 fMSColorRenderbufferID = 0; |
97 fTexIDObj.reset(NULL); | 96 fTexIDObj.reset(NULL); |
98 INHERITED::onRelease(); | 97 INHERITED::onRelease(); |
99 } | 98 } |
100 | 99 |
101 void GrGLRenderTarget::onAbandon() { | 100 void GrGLRenderTarget::onAbandon() { |
102 fRTFBOID = 0; | 101 fRTFBOID = 0; |
103 fTexFBOID = 0; | 102 fTexFBOID = 0; |
104 fMSColorRenderbufferID = 0; | 103 fMSColorRenderbufferID = 0; |
105 if (NULL != fTexIDObj.get()) { | 104 if (NULL != fTexIDObj.get()) { |
106 fTexIDObj->abandon(); | 105 fTexIDObj->abandon(); |
107 fTexIDObj.reset(NULL); | 106 fTexIDObj.reset(NULL); |
108 } | 107 } |
109 INHERITED::onAbandon(); | 108 INHERITED::onAbandon(); |
110 } | 109 } |
OLD | NEW |