Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: src/gpu/gl/GrGLTexture.cpp

Issue 691523002: Separate out GrSurfaceConfig's fields from other structs used to create GrGL* GrSurface subclasses (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix indent Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLTexture.h ('k') | src/gpu/gl/GrGpuGL.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrGLTexture.h" 8 #include "GrGLTexture.h"
9 #include "GrGpuGL.h" 9 #include "GrGpuGL.h"
10 10
11 #define GPUGL static_cast<GrGpuGL*>(getGpu()) 11 #define GPUGL static_cast<GrGpuGL*>(getGpu())
12 12
13 #define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X) 13 #define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X)
14 14
15 void GrGLTexture::init(GrGpuGL* gpu, 15 void GrGLTexture::init(GrGpuGL* gpu,
16 const Desc& textureDesc, 16 const GrSurfaceDesc& desc,
17 const GrGLRenderTarget::Desc* rtDesc) { 17 const IDDesc& idDesc,
18 const GrGLRenderTarget::IDDesc* rtIDDesc) {
18 19
19 SkASSERT(0 != textureDesc.fTextureID); 20 SkASSERT(0 != idDesc.fTextureID);
20 21
21 fTexParams.invalidate(); 22 fTexParams.invalidate();
22 fTexParamsTimestamp = GrGpu::kExpiredTimestamp; 23 fTexParamsTimestamp = GrGpu::kExpiredTimestamp;
23 fTexIDObj.reset(SkNEW_ARGS(GrGLTexID, (GPUGL->glInterface(), 24 fTexIDObj.reset(SkNEW_ARGS(GrGLTexID, (GPUGL->glInterface(),
24 textureDesc.fTextureID, 25 idDesc.fTextureID,
25 textureDesc.fIsWrapped))); 26 idDesc.fIsWrapped)));
26 27
27 if (rtDesc) { 28 if (rtIDDesc) {
28 GrGLIRect vp; 29 GrGLIRect vp;
29 vp.fLeft = 0; 30 vp.fLeft = 0;
30 vp.fWidth = textureDesc.fWidth; 31 vp.fWidth = desc.fWidth;
31 vp.fBottom = 0; 32 vp.fBottom = 0;
32 vp.fHeight = textureDesc.fHeight; 33 vp.fHeight = desc.fHeight;
33 34
34 fRenderTarget.reset(SkNEW_ARGS(GrGLRenderTarget, (gpu, *rtDesc, vp, fTex IDObj, this))); 35 fRenderTarget.reset(SkNEW_ARGS(GrGLRenderTarget, (gpu, *rtIDDesc, vp, fT exIDObj, this)));
35 } 36 }
36 this->registerWithCache(); 37 this->registerWithCache();
37 } 38 }
38 39
39 GrGLTexture::GrGLTexture(GrGpuGL* gpu, 40 GrGLTexture::GrGLTexture(GrGpuGL* gpu, const GrSurfaceDesc& desc, const IDDesc& idDesc)
40 const Desc& textureDesc) 41 : INHERITED(gpu, idDesc.fIsWrapped, desc) {
41 : INHERITED(gpu, textureDesc.fIsWrapped, textureDesc) { 42 this->init(gpu, desc, idDesc, NULL);
42 this->init(gpu, textureDesc, NULL);
43 } 43 }
44 44
45 GrGLTexture::GrGLTexture(GrGpuGL* gpu, 45 GrGLTexture::GrGLTexture(GrGpuGL* gpu,
46 const Desc& textureDesc, 46 const GrSurfaceDesc& desc,
47 const GrGLRenderTarget::Desc& rtDesc) 47 const IDDesc& idDesc,
48 : INHERITED(gpu, textureDesc.fIsWrapped, textureDesc) { 48 const GrGLRenderTarget::IDDesc& rtIDDesc)
49 this->init(gpu, textureDesc, &rtDesc); 49 : INHERITED(gpu, idDesc.fIsWrapped, desc) {
50 this->init(gpu, desc, idDesc, &rtIDDesc);
50 } 51 }
51 52
52 void GrGLTexture::onRelease() { 53 void GrGLTexture::onRelease() {
53 fTexIDObj.reset(NULL); 54 fTexIDObj.reset(NULL);
54 INHERITED::onRelease(); 55 INHERITED::onRelease();
55 } 56 }
56 57
57 void GrGLTexture::onAbandon() { 58 void GrGLTexture::onAbandon() {
58 if (fTexIDObj.get()) { 59 if (fTexIDObj.get()) {
59 fTexIDObj->abandon(); 60 fTexIDObj->abandon();
60 fTexIDObj.reset(NULL); 61 fTexIDObj.reset(NULL);
61 } 62 }
62 63
63 INHERITED::onAbandon(); 64 INHERITED::onAbandon();
64 } 65 }
65 66
66 GrBackendObject GrGLTexture::getTextureHandle() const { 67 GrBackendObject GrGLTexture::getTextureHandle() const {
67 return static_cast<GrBackendObject>(this->textureID()); 68 return static_cast<GrBackendObject>(this->textureID());
68 } 69 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLTexture.h ('k') | src/gpu/gl/GrGpuGL.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698