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" |
11 | 11 |
12 #define GPUGL static_cast<GrGpuGL*>(getGpu()) | 12 #define GPUGL static_cast<GrGpuGL*>(getGpu()) |
13 | 13 |
14 #define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X) | 14 #define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X) |
15 | 15 |
16 void GrGLRenderTarget::init(const Desc& desc, | 16 void GrGLRenderTarget::init(const Desc& desc, |
17 const GrGLIRect& viewport, | 17 const GrGLIRect& viewport, |
18 GrGLTexID* texID) { | 18 GrGLTexID* texID) { |
19 fRTFBOID = desc.fRTFBOID; | 19 fRTFBOID = desc.fRTFBOID; |
20 fTexFBOID = desc.fTexFBOID; | 20 fTexFBOID = desc.fTexFBOID; |
21 fMSColorRenderbufferID = desc.fMSColorRenderbufferID; | 21 fMSColorRenderbufferID = desc.fMSColorRenderbufferID; |
22 fViewport = viewport; | 22 fViewport = viewport; |
23 fTexIDObj.reset(SkSafeRef(texID)); | 23 fTexIDObj.reset(SkSafeRef(texID)); |
24 this->registerWithCache(); | |
25 } | 24 } |
26 | 25 |
27 namespace { | 26 namespace { |
28 GrTextureDesc MakeDesc(GrTextureFlags flags, | 27 GrTextureDesc MakeDesc(GrTextureFlags flags, |
29 int width, int height, | 28 int width, int height, |
30 GrPixelConfig config, int sampleCnt, | 29 GrPixelConfig config, int sampleCnt, |
31 GrSurfaceOrigin origin) { | 30 GrSurfaceOrigin origin) { |
32 GrTextureDesc temp; | 31 GrTextureDesc temp; |
33 temp.fFlags = flags; | 32 temp.fFlags = flags; |
34 temp.fWidth = width; | 33 temp.fWidth = width; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |