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 "GrGLGpu.h" | 10 #include "GrGLGpu.h" |
11 | 11 |
12 void GrGLFBO::release(const GrGLInterface* gl) { | 12 void GrGLFBO::release(const GrGLInterface* gl) { |
13 SkASSERT(gl); | 13 SkASSERT(gl); |
14 if (this->isValid()) { | 14 if (this->isValid()) { |
15 GR_GL_CALL(gl, DeleteFramebuffers(1, &fID)); | 15 GR_GL_CALL(gl, DeleteFramebuffers(1, &fID)); |
16 fIsValid = false; | 16 fIsValid = false; |
17 } | 17 } |
18 } | 18 } |
19 | 19 |
20 void GrGLFBO::abandon() { fIsValid = false; } | 20 void GrGLFBO::abandon() { fIsValid = false; } |
21 | 21 |
22 ////////////////////////////////////////////////////////////////////////////// | 22 ////////////////////////////////////////////////////////////////////////////// |
23 | 23 |
24 #define GLGPU static_cast<GrGLGpu*>(this->getGpu()) | 24 #define GLGPU static_cast<GrGLGpu*>(this->getGpu()) |
25 #define GL_CALL(X) GR_GL_CALL(GLGPU->glInterface(), X) | 25 #define GL_CALL(X) GR_GL_CALL(GLGPU->glInterface(), X) |
26 | 26 |
27 // Because this class is virtually derived from GrSurface we must explicitly cal
l its constructor. | 27 // Because this class is virtually derived from GrSurface we must explicitly cal
l its constructor. |
28 GrGLRenderTarget::GrGLRenderTarget(GrGLGpu* gpu, const GrSurfaceDesc& desc, cons
t IDDesc& idDesc) | 28 GrGLRenderTarget::GrGLRenderTarget(GrGLGpu* gpu, const GrSurfaceDesc& desc, cons
t IDDesc& idDesc) |
29 : GrSurface(gpu, idDesc.fLifeCycle, desc) | 29 : GrSurface(gpu, idDesc.fLifeCycle, desc) |
30 , INHERITED(gpu, idDesc.fLifeCycle, desc) { | 30 , INHERITED(gpu, idDesc.fLifeCycle, desc, idDesc.fSampleConfig) { |
31 this->init(desc, idDesc); | 31 this->init(desc, idDesc); |
32 this->registerWithCache(); | 32 this->registerWithCache(); |
33 } | 33 } |
34 | 34 |
35 GrGLRenderTarget::GrGLRenderTarget(GrGLGpu* gpu, const GrSurfaceDesc& desc, cons
t IDDesc& idDesc, | 35 GrGLRenderTarget::GrGLRenderTarget(GrGLGpu* gpu, const GrSurfaceDesc& desc, cons
t IDDesc& idDesc, |
36 Derived) | 36 Derived) |
37 : GrSurface(gpu, idDesc.fLifeCycle, desc) | 37 : GrSurface(gpu, idDesc.fLifeCycle, desc) |
38 , INHERITED(gpu, idDesc.fLifeCycle, desc) { | 38 , INHERITED(gpu, idDesc.fLifeCycle, desc, idDesc.fSampleConfig) { |
39 this->init(desc, idDesc); | 39 this->init(desc, idDesc); |
40 } | 40 } |
41 | 41 |
42 void GrGLRenderTarget::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) { | 42 void GrGLRenderTarget::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) { |
43 fRenderFBO.reset(SkRef(idDesc.fRenderFBO.get())); | 43 fRenderFBO.reset(SkRef(idDesc.fRenderFBO.get())); |
44 fTextureFBO.reset(SkSafeRef(idDesc.fTextureFBO.get())); | 44 fTextureFBO.reset(SkSafeRef(idDesc.fTextureFBO.get())); |
45 SkASSERT(fRenderFBO->isValid()); | 45 SkASSERT(fRenderFBO->isValid()); |
46 SkASSERT(!fTextureFBO || fTextureFBO->isValid()); | 46 SkASSERT(!fTextureFBO || fTextureFBO->isValid()); |
47 fMSColorRenderbufferID = idDesc.fMSColorRenderbufferID; | 47 fMSColorRenderbufferID = idDesc.fMSColorRenderbufferID; |
48 fIsWrapped = kWrapped_LifeCycle == idDesc.fLifeCycle; | 48 fIsWrapped = kWrapped_LifeCycle == idDesc.fLifeCycle; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 fRenderFBO->abandon(); | 102 fRenderFBO->abandon(); |
103 fRenderFBO.reset(NULL); | 103 fRenderFBO.reset(NULL); |
104 } | 104 } |
105 if (fTextureFBO) { | 105 if (fTextureFBO) { |
106 fTextureFBO->abandon(); | 106 fTextureFBO->abandon(); |
107 fTextureFBO.reset(NULL); | 107 fTextureFBO.reset(NULL); |
108 } | 108 } |
109 fMSColorRenderbufferID = 0; | 109 fMSColorRenderbufferID = 0; |
110 INHERITED::onAbandon(); | 110 INHERITED::onAbandon(); |
111 } | 111 } |
OLD | NEW |