зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1016086 - Part 3: Make sure ReadTexImageHelper doesn't change the attribute state during composition (r=Bas)
This commit is contained in:
Родитель
3f26ca158b
Коммит
2fa87a39ef
|
@ -637,21 +637,18 @@ GLReadTexImageHelper::ReadTexImage(GLuint aTextureId,
|
|||
|
||||
/* Setup quad geometry */
|
||||
mGL->fBindBuffer(LOCAL_GL_ARRAY_BUFFER, 0);
|
||||
mGL->fEnableVertexAttribArray(0);
|
||||
mGL->fEnableVertexAttribArray(1);
|
||||
|
||||
float w = (aTextureTarget == LOCAL_GL_TEXTURE_RECTANGLE) ? (float) aSize.width : 1.0f;
|
||||
float h = (aTextureTarget == LOCAL_GL_TEXTURE_RECTANGLE) ? (float) aSize.height : 1.0f;
|
||||
|
||||
|
||||
const float
|
||||
vertexArray[4*2] = {
|
||||
-1.0f, -1.0f,
|
||||
1.0f, -1.0f,
|
||||
-1.0f, 1.0f,
|
||||
1.0f, 1.0f
|
||||
};
|
||||
mGL->fVertexAttribPointer(0, 2, LOCAL_GL_FLOAT, LOCAL_GL_FALSE, 0, vertexArray);
|
||||
};
|
||||
ScopedVertexAttribPointer autoAttrib0(mGL, 0, 2, LOCAL_GL_FLOAT, LOCAL_GL_FALSE, 0, 0, vertexArray);
|
||||
|
||||
const float u0 = 0.0f;
|
||||
const float u1 = w;
|
||||
|
@ -661,7 +658,7 @@ GLReadTexImageHelper::ReadTexImage(GLuint aTextureId,
|
|||
u1, v0,
|
||||
u0, v1,
|
||||
u1, v1 };
|
||||
mGL->fVertexAttribPointer(1, 2, LOCAL_GL_FLOAT, LOCAL_GL_FALSE, 0, texCoordArray);
|
||||
ScopedVertexAttribPointer autoAttrib1(mGL, 1, 2, LOCAL_GL_FLOAT, LOCAL_GL_FALSE, 0, 0, texCoordArray);
|
||||
|
||||
/* Bind the texture */
|
||||
if (aTextureId) {
|
||||
|
@ -677,16 +674,12 @@ GLReadTexImageHelper::ReadTexImage(GLuint aTextureId,
|
|||
mGL->fDrawArrays(LOCAL_GL_TRIANGLE_STRIP, 0, 4);
|
||||
CLEANUP_IF_GLERROR_OCCURRED("when drawing texture");
|
||||
|
||||
mGL->fDisableVertexAttribArray(1);
|
||||
mGL->fDisableVertexAttribArray(0);
|
||||
|
||||
/* Read-back draw results */
|
||||
ReadPixelsIntoDataSurface(mGL, isurf);
|
||||
CLEANUP_IF_GLERROR_OCCURRED("when reading pixels into surface");
|
||||
} while (false);
|
||||
|
||||
/* Restore GL state */
|
||||
//cleanup:
|
||||
mGL->fBindRenderbuffer(LOCAL_GL_RENDERBUFFER, oldrb);
|
||||
mGL->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, oldfb);
|
||||
mGL->fUseProgram(oldprog);
|
||||
|
|
Загрузка…
Ссылка в новой задаче