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

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

Issue 695813003: Add class GrGLTextureRenderTarget for GL texture/rendertarget objects (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleanup 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
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*>(this->getGpu())
12
13 #define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X) 12 #define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X)
14 13
15 void GrGLTexture::init(GrGpuGL* gpu, 14 GrGLTexture::GrGLTexture(GrGpuGL* gpu, const GrSurfaceDesc& desc, const IDDesc& idDesc)
16 const GrSurfaceDesc& desc, 15 : GrGLTexture(gpu, desc, idDesc, kDerived) {
17 const IDDesc& idDesc, 16 this->registerWithCache();
18 const GrGLRenderTarget::IDDesc* rtIDDesc) { 17 }
19 18
19 GrGLTexture::GrGLTexture(GrGpuGL* gpu, const GrSurfaceDesc& desc, const IDDesc& idDesc, Derived)
robertphillips 2014/11/03 13:58:54 move GrSurface ctor call to its own line ? // GrT
bsalomon 2014/11/03 15:20:14 Done.
20 : INHERITED(gpu, idDesc.fIsWrapped, desc), GrSurface(gpu, idDesc.fIsWrapped, desc) {
20 SkASSERT(0 != idDesc.fTextureID); 21 SkASSERT(0 != idDesc.fTextureID);
21
22 fTexParams.invalidate(); 22 fTexParams.invalidate();
23 fTexParamsTimestamp = GrGpu::kExpiredTimestamp; 23 fTexParamsTimestamp = GrGpu::kExpiredTimestamp;
24 fTexIDObj.reset(SkNEW_ARGS(GrGLTexID, (GPUGL->glInterface(), 24 fTexIDObj.reset(SkNEW_ARGS(GrGLTexID, (GPUGL->glInterface(),
25 idDesc.fTextureID, 25 idDesc.fTextureID,
26 idDesc.fIsWrapped))); 26 idDesc.fIsWrapped)));
27
28 if (rtIDDesc) {
29 GrGLIRect vp;
30 vp.fLeft = 0;
31 vp.fWidth = desc.fWidth;
32 vp.fBottom = 0;
33 vp.fHeight = desc.fHeight;
34
35 fRenderTarget.reset(SkNEW_ARGS(GrGLRenderTarget, (gpu, *rtIDDesc, vp, fT exIDObj, this)));
36 }
37 this->registerWithCache();
38 }
39
40 GrGLTexture::GrGLTexture(GrGpuGL* gpu, const GrSurfaceDesc& desc, const IDDesc& idDesc)
41 : INHERITED(gpu, idDesc.fIsWrapped, desc) {
42 this->init(gpu, desc, idDesc, NULL);
43 }
44
45 GrGLTexture::GrGLTexture(GrGpuGL* gpu,
46 const GrSurfaceDesc& desc,
47 const IDDesc& idDesc,
48 const GrGLRenderTarget::IDDesc& rtIDDesc)
49 : INHERITED(gpu, idDesc.fIsWrapped, desc) {
50 this->init(gpu, desc, idDesc, &rtIDDesc);
51 } 27 }
52 28
53 void GrGLTexture::onRelease() { 29 void GrGLTexture::onRelease() {
54 fTexIDObj.reset(NULL); 30 fTexIDObj.reset(NULL);
55 INHERITED::onRelease(); 31 INHERITED::onRelease();
56 } 32 }
57 33
58 void GrGLTexture::onAbandon() { 34 void GrGLTexture::onAbandon() {
59 if (fTexIDObj.get()) { 35 if (fTexIDObj.get()) {
60 fTexIDObj->abandon(); 36 fTexIDObj->abandon();
61 fTexIDObj.reset(NULL); 37 fTexIDObj.reset(NULL);
62 } 38 }
63 39
64 INHERITED::onAbandon(); 40 INHERITED::onAbandon();
65 } 41 }
66 42
67 GrBackendObject GrGLTexture::getTextureHandle() const { 43 GrBackendObject GrGLTexture::getTextureHandle() const {
68 return static_cast<GrBackendObject>(this->textureID()); 44 return static_cast<GrBackendObject>(this->textureID());
69 } 45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698