| 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(); |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace { | 27 namespace { |
| 27 GrTextureDesc MakeDesc(GrTextureFlags flags, | 28 GrTextureDesc MakeDesc(GrTextureFlags flags, |
| 28 int width, int height, | 29 int width, int height, |
| 29 GrPixelConfig config, int sampleCnt, | 30 GrPixelConfig config, int sampleCnt, |
| 30 GrSurfaceOrigin origin) { | 31 GrSurfaceOrigin origin) { |
| 31 GrTextureDesc temp; | 32 GrTextureDesc temp; |
| 32 temp.fFlags = flags; | 33 temp.fFlags = flags; |
| 33 temp.fWidth = width; | 34 temp.fWidth = width; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |