Bug 958550 - Use ScopedGLState for scissor test + blend state in two more places. r=bjacob

This commit is contained in:
Markus Stange 2014-01-13 15:29:10 +01:00
parent fe42b2da6d
commit 3e80866f97
2 changed files with 4 additions and 19 deletions

View File

@ -44,8 +44,8 @@ GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const nsIntRect&
int savedFb = 0;
mGL->fGetIntegerv(LOCAL_GL_FRAMEBUFFER_BINDING, &savedFb);
mGL->fDisable(LOCAL_GL_SCISSOR_TEST);
mGL->fDisable(LOCAL_GL_BLEND);
ScopedGLState scopedScissorTestState(mGL, LOCAL_GL_SCISSOR_TEST, false);
ScopedGLState scopedBlendState(mGL, LOCAL_GL_BLEND, false);
// 2.0 means scale up by two
float blitScaleX = float(aDstRect.width) / float(aSrcRect.width);
@ -170,9 +170,6 @@ GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const nsIntRect&
SetBlitFramebufferForDestTexture(0);
mGL->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, savedFb);
mGL->fEnable(LOCAL_GL_SCISSOR_TEST);
mGL->fEnable(LOCAL_GL_BLEND);
}
void

View File

@ -508,15 +508,10 @@ GLReadTexImageHelper::ReadTexImage(GLuint aTextureId,
return nullptr;
}
realGLboolean oldBlend, oldScissor;
GLint oldrb, oldfb, oldprog, oldTexUnit, oldTex;
GLuint rb, fb;
do {
/* Save current GL state */
oldBlend = mGL->fIsEnabled(LOCAL_GL_BLEND);
oldScissor = mGL->fIsEnabled(LOCAL_GL_SCISSOR_TEST);
mGL->fGetIntegerv(LOCAL_GL_RENDERBUFFER_BINDING, &oldrb);
mGL->fGetIntegerv(LOCAL_GL_FRAMEBUFFER_BINDING, &oldfb);
mGL->fGetIntegerv(LOCAL_GL_CURRENT_PROGRAM, &oldprog);
@ -536,9 +531,8 @@ GLReadTexImageHelper::ReadTexImage(GLuint aTextureId,
break;
}
/* Set required GL state */
mGL->fDisable(LOCAL_GL_BLEND);
mGL->fDisable(LOCAL_GL_SCISSOR_TEST);
ScopedGLState scopedScissorTestState(mGL, LOCAL_GL_SCISSOR_TEST, false);
ScopedGLState scopedBlendState(mGL, LOCAL_GL_BLEND, false);
ScopedViewportRect(mGL, 0, 0, aSize.width, aSize.height);
@ -632,12 +626,6 @@ GLReadTexImageHelper::ReadTexImage(GLuint aTextureId,
mGL->fDeleteRenderbuffers(1, &rb);
mGL->fDeleteFramebuffers(1, &fb);
if (oldBlend)
mGL->fEnable(LOCAL_GL_BLEND);
if (oldScissor)
mGL->fEnable(LOCAL_GL_SCISSOR_TEST);
if (aTextureId)
mGL->fBindTexture(aTextureTarget, oldTex);