diff options
author | 2011-07-29 20:29:05 +0000 | |
---|---|---|
committer | 2011-07-29 20:29:05 +0000 | |
commit | 5bfc21761e0ce41206acac4c5008fc0f24debd44 (patch) | |
tree | 48c5f9530880be39f5b26483c79e818143b900d4 /gpu/src/GrGLTexture.cpp | |
parent | aa5b6730f2658618015ed56ffb5882f15b6f053f (diff) |
cleanup GrGLTexture / GrGLRenderTarget cons. Make GrRenderTarget aware of its msaa sample count.
Review URL: http://codereview.appspot.com/4833045/
git-svn-id: http://skia.googlecode.com/svn/trunk@1996 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gpu/src/GrGLTexture.cpp')
-rw-r--r-- | gpu/src/GrGLTexture.cpp | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/gpu/src/GrGLTexture.cpp b/gpu/src/GrGLTexture.cpp index e7db2eeffd..caf001af40 100644 --- a/gpu/src/GrGLTexture.cpp +++ b/gpu/src/GrGLTexture.cpp @@ -33,14 +33,12 @@ const GrGLenum* GrGLTexture::WrapMode2GLWrap() { } }; -GrGLTexture::GrGLTexture(GrGpuGL* gpu, - const GLTextureDesc& textureDesc, - const GLRenderTargetIDs& rtIDs, - const TexParams& initialTexParams) - : INHERITED(gpu, - textureDesc.fContentWidth, - textureDesc.fContentHeight, - textureDesc.fFormat) { +void GrGLTexture::init(GrGpuGL* gpu, + const Desc& textureDesc, + const GrGLRenderTarget::Desc* rtDesc, + const TexParams& initialTexParams) { + + GrAssert(0 != textureDesc.fTextureID); fTexParams = initialTexParams; fTexIDObj = new GrGLTexID(textureDesc.fTextureID, @@ -56,9 +54,7 @@ GrGLTexture::GrGLTexture(GrGpuGL* gpu, fScaleY = GrIntToScalar(textureDesc.fContentHeight) / textureDesc.fAllocHeight; - GrAssert(0 != textureDesc.fTextureID); - - if (rtIDs.fTexFBOID) { + if (NULL != rtDesc) { // we render to the top left GrGLIRect vp; vp.fLeft = 0; @@ -66,14 +62,31 @@ GrGLTexture::GrGLTexture(GrGpuGL* gpu, vp.fHeight = textureDesc.fContentHeight; vp.fBottom = textureDesc.fAllocHeight - textureDesc.fContentHeight; - fRenderTarget = new GrGLRenderTarget(gpu, rtIDs, fTexIDObj, - textureDesc.fFormat, - textureDesc.fStencilBits, - rtIDs.fRTFBOID != rtIDs.fTexFBOID, - vp, this); + fRenderTarget = new GrGLRenderTarget(gpu, *rtDesc, vp, fTexIDObj, this); } } +GrGLTexture::GrGLTexture(GrGpuGL* gpu, + const Desc& textureDesc, + const TexParams& initialTexParams) + : INHERITED(gpu, + textureDesc.fContentWidth, + textureDesc.fContentHeight, + textureDesc.fFormat) { + this->init(gpu, textureDesc, NULL, initialTexParams); +} + +GrGLTexture::GrGLTexture(GrGpuGL* gpu, + const Desc& textureDesc, + const GrGLRenderTarget::Desc& rtDesc, + const TexParams& initialTexParams) + : INHERITED(gpu, + textureDesc.fContentWidth, + textureDesc.fContentHeight, + textureDesc.fFormat) { + this->init(gpu, textureDesc, &rtDesc, initialTexParams); +} + void GrGLTexture::onRelease() { INHERITED::onRelease(); GPUGL->notifyTextureDelete(this); |