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

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

Issue 682223002: rename GrTextureDesc->GrSurfaceDesc, GrTextureFlags->GrSurfaceFlags (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: const 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/effects/GrTextureStripAtlas.cpp ('k') | src/gpu/gl/GrGLTexture.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 "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 this->registerWithCache();
25 } 25 }
26 26
27 namespace { 27 namespace {
28 GrTextureDesc MakeDesc(GrTextureFlags flags, 28 GrSurfaceDesc MakeDesc(GrSurfaceFlags flags,
29 int width, int height, 29 int width, int height,
30 GrPixelConfig config, int sampleCnt, 30 GrPixelConfig config, int sampleCnt,
31 GrSurfaceOrigin origin) { 31 GrSurfaceOrigin origin) {
32 GrTextureDesc temp; 32 GrSurfaceDesc temp;
33 temp.fFlags = flags; 33 temp.fFlags = flags;
34 temp.fWidth = width; 34 temp.fWidth = width;
35 temp.fHeight = height; 35 temp.fHeight = height;
36 temp.fConfig = config; 36 temp.fConfig = config;
37 temp.fSampleCnt = sampleCnt; 37 temp.fSampleCnt = sampleCnt;
38 temp.fOrigin = origin; 38 temp.fOrigin = origin;
39 return temp; 39 return temp;
40 } 40 }
41 41
42 }; 42 };
43 43
44 GrGLRenderTarget::GrGLRenderTarget(GrGpuGL* gpu, 44 GrGLRenderTarget::GrGLRenderTarget(GrGpuGL* gpu,
45 const Desc& desc, 45 const Desc& desc,
46 const GrGLIRect& viewport, 46 const GrGLIRect& viewport,
47 GrGLTexID* texID, 47 GrGLTexID* texID,
48 GrGLTexture* texture) 48 GrGLTexture* texture)
49 : INHERITED(gpu, 49 : INHERITED(gpu,
50 desc.fIsWrapped, 50 desc.fIsWrapped,
51 texture, 51 texture,
52 MakeDesc(kNone_GrTextureFlags, 52 MakeDesc(kNone_GrSurfaceFlags,
53 viewport.fWidth, viewport.fHeight, 53 viewport.fWidth, viewport.fHeight,
54 desc.fConfig, desc.fSampleCnt, 54 desc.fConfig, desc.fSampleCnt,
55 desc.fOrigin)) { 55 desc.fOrigin)) {
56 SkASSERT(texID); 56 SkASSERT(texID);
57 SkASSERT(texture); 57 SkASSERT(texture);
58 // FBO 0 can't also be a texture, right? 58 // FBO 0 can't also be a texture, right?
59 SkASSERT(0 != desc.fRTFBOID); 59 SkASSERT(0 != desc.fRTFBOID);
60 SkASSERT(0 != desc.fTexFBOID); 60 SkASSERT(0 != desc.fTexFBOID);
61 61
62 // we assume this is true, TODO: get rid of viewport as a param. 62 // we assume this is true, TODO: get rid of viewport as a param.
63 SkASSERT(viewport.fWidth == texture->width()); 63 SkASSERT(viewport.fWidth == texture->width());
64 SkASSERT(viewport.fHeight == texture->height()); 64 SkASSERT(viewport.fHeight == texture->height());
65 65
66 this->init(desc, viewport, texID); 66 this->init(desc, viewport, texID);
67 } 67 }
68 68
69 GrGLRenderTarget::GrGLRenderTarget(GrGpuGL* gpu, 69 GrGLRenderTarget::GrGLRenderTarget(GrGpuGL* gpu,
70 const Desc& desc, 70 const Desc& desc,
71 const GrGLIRect& viewport) 71 const GrGLIRect& viewport)
72 : INHERITED(gpu, 72 : INHERITED(gpu,
73 desc.fIsWrapped, 73 desc.fIsWrapped,
74 NULL, 74 NULL,
75 MakeDesc(kNone_GrTextureFlags, 75 MakeDesc(kNone_GrSurfaceFlags,
76 viewport.fWidth, viewport.fHeight, 76 viewport.fWidth, viewport.fHeight,
77 desc.fConfig, desc.fSampleCnt, 77 desc.fConfig, desc.fSampleCnt,
78 desc.fOrigin)) { 78 desc.fOrigin)) {
79 this->init(desc, viewport, NULL); 79 this->init(desc, viewport, NULL);
80 } 80 }
81 81
82 void GrGLRenderTarget::onRelease() { 82 void GrGLRenderTarget::onRelease() {
83 if (!this->isWrapped()) { 83 if (!this->isWrapped()) {
84 if (fTexFBOID) { 84 if (fTexFBOID) {
85 GL_CALL(DeleteFramebuffers(1, &fTexFBOID)); 85 GL_CALL(DeleteFramebuffers(1, &fTexFBOID));
(...skipping 15 matching lines...) Expand all
101 void GrGLRenderTarget::onAbandon() { 101 void GrGLRenderTarget::onAbandon() {
102 fRTFBOID = 0; 102 fRTFBOID = 0;
103 fTexFBOID = 0; 103 fTexFBOID = 0;
104 fMSColorRenderbufferID = 0; 104 fMSColorRenderbufferID = 0;
105 if (fTexIDObj.get()) { 105 if (fTexIDObj.get()) {
106 fTexIDObj->abandon(); 106 fTexIDObj->abandon();
107 fTexIDObj.reset(NULL); 107 fTexIDObj.reset(NULL);
108 } 108 }
109 INHERITED::onAbandon(); 109 INHERITED::onAbandon();
110 } 110 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrTextureStripAtlas.cpp ('k') | src/gpu/gl/GrGLTexture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698