diff options
author | 2011-02-18 16:09:55 +0000 | |
---|---|---|
committer | 2011-02-18 16:09:55 +0000 | |
commit | 8895a7a0e222de4530e506e43eaa5e6030e8c5ed (patch) | |
tree | 1493fb4cf14a7cfaccf86a16302495d7c27d61f5 /gpu/src/GrGLTexture.cpp | |
parent | ce2b1afb582f0a2274f476c949cff8b0e1c72b36 (diff) |
Reduce glGets for stencil bits.
Clean up GL vs Gr rect conventions for viewport and scissor.
Review URL: http://codereview.appspot.com/4185056/
git-svn-id: http://skia.googlecode.com/svn/trunk@813 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gpu/src/GrGLTexture.cpp')
-rw-r--r-- | gpu/src/GrGLTexture.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/gpu/src/GrGLTexture.cpp b/gpu/src/GrGLTexture.cpp index 110535f3ea..9fd1f57edf 100644 --- a/gpu/src/GrGLTexture.cpp +++ b/gpu/src/GrGLTexture.cpp @@ -18,20 +18,20 @@ #include "GrGLTexture.h" #include "GrGpuGL.h" -GrGLRenderTarget::GrGLRenderTarget(const GLRenderTargetIDs& ids, - const GrIRect& viewport, +GrGLRenderTarget::GrGLRenderTarget(const GLRenderTargetIDs& ids, + GLuint stencilBits, + const GrGLIRect& viewport, GrGLTexture* texture, GrGpuGL* gl) : INHERITED(texture) { fGL = gl; fRTFBOID = ids.fRTFBOID; fTexFBOID = ids.fTexFBOID; fStencilRenderbufferID = ids.fStencilRenderbufferID; + fStencilBits = stencilBits; fMSColorRenderbufferID = ids.fMSColorRenderbufferID; fNeedsResolve = false; fViewport = viewport; fOwnIDs = ids.fOwnIDs; - // viewport should be GL's viewport with top >= bottom - GrAssert(viewport.height() <= 0); } GrGLRenderTarget::~GrGLRenderTarget() { @@ -99,14 +99,15 @@ GrGLTexture::GrGLTexture(const GLTextureDesc& textureDesc, GrAssert(0 != textureDesc.fTextureID); if (rtIDs.fTexFBOID) { - GrIRect vp; + // we render to the top left + GrGLIRect vp; vp.fLeft = 0; - vp.fRight = (int32_t) textureDesc.fContentWidth; - // viewport for GL is top > bottom - vp.fTop = (int32_t) textureDesc.fAllocHeight; - vp.fBottom = (int32_t) textureDesc.fAllocHeight - - (int32_t)textureDesc.fContentHeight; - fRenderTarget = new GrGLRenderTarget(rtIDs, vp, this, gl); + vp.fWidth = textureDesc.fContentWidth; + vp.fHeight = textureDesc.fContentHeight; + vp.fBottom = textureDesc.fAllocHeight - textureDesc.fContentHeight; + + fRenderTarget = new GrGLRenderTarget(rtIDs, textureDesc.fStencilBits, + vp, this, gl); } } |