diff --git a/gfx/layers/opengl/CompositorOGL.cpp b/gfx/layers/opengl/CompositorOGL.cpp index 0310797d6610..77ea7ecd08cd 100644 --- a/gfx/layers/opengl/CompositorOGL.cpp +++ b/gfx/layers/opengl/CompositorOGL.cpp @@ -911,11 +911,11 @@ static bool SetBlendMode(GLContext* aGL, gfx::CompositionOp aBlendMode, bool aIs } void -CompositorOGL::DrawQuadInternal(const Rect& aRect, - const Rect& aClipRect, - const EffectChain &aEffectChain, - Float aOpacity, - const gfx::Matrix4x4 &aTransform) +CompositorOGL::DrawQuad(const Rect& aRect, + const Rect& aClipRect, + const EffectChain &aEffectChain, + Float aOpacity, + const gfx::Matrix4x4 &aTransform) { PROFILER_LABEL("CompositorOGL", "DrawQuad"); MOZ_ASSERT(mFrameInProgress, "frame not started"); @@ -1461,28 +1461,24 @@ CompositorOGL::QuadVBOTexCoordsAttrib(GLuint aAttribIndex) { (GLvoid*) QuadVBOTexCoordOffset()); } -void -CompositorOGL::BindAndDrawQuad(GLuint aVertAttribIndex, - GLuint aTexCoordAttribIndex) -{ - BindQuadVBO(); - QuadVBOVerticesAttrib(aVertAttribIndex); - - if (aTexCoordAttribIndex != GLuint(-1)) { - QuadVBOTexCoordsAttrib(aTexCoordAttribIndex); - mGLContext->fEnableVertexAttribArray(aTexCoordAttribIndex); - } - - mGLContext->fEnableVertexAttribArray(aVertAttribIndex); - mGLContext->fDrawArrays(LOCAL_GL_TRIANGLE_STRIP, 0, 4); -} - void CompositorOGL::BindAndDrawQuad(ShaderProgramOGL *aProg) { NS_ASSERTION(aProg->HasInitialized(), "Shader program not correctly initialized"); - BindAndDrawQuad(aProg->AttribLocation(ShaderProgramOGL::VertexCoordAttrib), - aProg->AttribLocation(ShaderProgramOGL::TexCoordAttrib)); + + GLuint vertAttribIndex = aProg->AttribLocation(ShaderProgramOGL::VertexCoordAttrib); + GLuint texCoordAttribIndex = aProg->AttribLocation(ShaderProgramOGL::TexCoordAttrib); + + BindQuadVBO(); + QuadVBOVerticesAttrib(vertAttribIndex); + + if (texCoordAttribIndex != GLuint(-1)) { + QuadVBOTexCoordsAttrib(texCoordAttribIndex); + mGLContext->fEnableVertexAttribArray(texCoordAttribIndex); + } + + mGLContext->fEnableVertexAttribArray(vertAttribIndex); + mGLContext->fDrawArrays(LOCAL_GL_TRIANGLE_STRIP, 0, 4); } GLuint diff --git a/gfx/layers/opengl/CompositorOGL.h b/gfx/layers/opengl/CompositorOGL.h index 5ff67cf3c743..0c4c1da864a6 100644 --- a/gfx/layers/opengl/CompositorOGL.h +++ b/gfx/layers/opengl/CompositorOGL.h @@ -204,10 +204,7 @@ public: const gfx::Rect& aClipRect, const EffectChain &aEffectChain, gfx::Float aOpacity, - const gfx::Matrix4x4 &aTransform) MOZ_OVERRIDE - { - DrawQuadInternal(aRect, aClipRect, aEffectChain, aOpacity, aTransform); - } + const gfx::Matrix4x4 &aTransform) MOZ_OVERRIDE; virtual void EndFrame() MOZ_OVERRIDE; virtual void SetFBAcquireFence(Layer* aLayer) MOZ_OVERRIDE; @@ -277,12 +274,6 @@ public: return mProjMatrix; } private: - virtual void DrawQuadInternal(const gfx::Rect& aRect, - const gfx::Rect& aClipRect, - const EffectChain &aEffectChain, - gfx::Float aOpacity, - const gfx::Matrix4x4 &aTransform); - virtual gfx::IntSize GetWidgetSize() const MOZ_OVERRIDE { return gfx::ToIntSize(mWidgetSize); @@ -377,8 +368,6 @@ private: void BindQuadVBO(); void QuadVBOVerticesAttrib(GLuint aAttribIndex); void QuadVBOTexCoordsAttrib(GLuint aAttribIndex); - void BindAndDrawQuad(GLuint aVertAttribIndex, - GLuint aTexCoordAttribIndex); void BindAndDrawQuad(ShaderProgramOGL *aProg); void BindAndDrawQuadWithTextureRect(ShaderProgramOGL *aProg, const gfx3DMatrix& aTextureTransform,