diff options
author | Mathias Agopian <mathias@google.com> | 2013-08-28 18:13:56 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2013-08-28 18:13:56 -0700 |
commit | 19733a32799f792125913e746e8644d16f8dc223 (patch) | |
tree | 65a3de18d5eb2edf7c67454a8ecb7860e7111f14 /services/surfaceflinger/RenderEngine | |
parent | 931bda1c472ba8c8e965bdba6757ff94154df903 (diff) | |
download | frameworks_native-19733a32799f792125913e746e8644d16f8dc223.zip frameworks_native-19733a32799f792125913e746e8644d16f8dc223.tar.gz frameworks_native-19733a32799f792125913e746e8644d16f8dc223.tar.bz2 |
minor clean-up of the GLESRenderer
Change-Id: I978dea25b7687fbbbb283f09c24e115d9bad49a2
Diffstat (limited to 'services/surfaceflinger/RenderEngine')
6 files changed, 11 insertions, 24 deletions
diff --git a/services/surfaceflinger/RenderEngine/GLES11RenderEngine.cpp b/services/surfaceflinger/RenderEngine/GLES11RenderEngine.cpp index 06125b0..610061a 100644 --- a/services/surfaceflinger/RenderEngine/GLES11RenderEngine.cpp +++ b/services/surfaceflinger/RenderEngine/GLES11RenderEngine.cpp @@ -209,18 +209,11 @@ void GLES11RenderEngine::unbindFramebuffer(uint32_t texName, uint32_t fbName) { glDeleteTextures(1, &texName); } -void GLES11RenderEngine::fillWithColor(const Mesh& mesh, float r, float g, float b, float a) { +void GLES11RenderEngine::setupFillWithColor(float r, float g, float b, float a) { glColor4f(r, g, b, a); glDisable(GL_TEXTURE_EXTERNAL_OES); glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); - - glVertexPointer(mesh.getVertexSize(), - GL_FLOAT, - mesh.getByteStride(), - mesh.getPositions()); - - glDrawArrays(mesh.getPrimitive(), 0, mesh.getVertexCount()); } void GLES11RenderEngine::drawMesh(const Mesh& mesh) { diff --git a/services/surfaceflinger/RenderEngine/GLES11RenderEngine.h b/services/surfaceflinger/RenderEngine/GLES11RenderEngine.h index 90fc82f..1de0443 100644 --- a/services/surfaceflinger/RenderEngine/GLES11RenderEngine.h +++ b/services/surfaceflinger/RenderEngine/GLES11RenderEngine.h @@ -54,10 +54,10 @@ protected: virtual void setupDimLayerBlending(int alpha); virtual void setupLayerTexturing(const Texture& texture); virtual void setupLayerBlackedOut(); + virtual void setupFillWithColor(float r, float g, float b, float a) ; virtual void disableTexturing(); virtual void disableBlending(); - virtual void fillWithColor(const Mesh& mesh, float r, float g, float b, float a) ; virtual void drawMesh(const Mesh& mesh); virtual size_t getMaxTextureSize() const; diff --git a/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp b/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp index cde1e3a..56c6e56 100644 --- a/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp +++ b/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp @@ -186,20 +186,13 @@ void GLES20RenderEngine::unbindFramebuffer(uint32_t texName, uint32_t fbName) { glDeleteTextures(1, &texName); } -void GLES20RenderEngine::fillWithColor(const Mesh& mesh, float r, float g, float b, float a) { +void GLES20RenderEngine::setupFillWithColor(float r, float g, float b, float a) { + mState.setPlaneAlpha(1.0f); + mState.setPremultipliedAlpha(true); + mState.setOpaque(false); mState.setColor(r, g, b, a); - disableTexturing(); + mState.disableTexture(); glDisable(GL_BLEND); - - ProgramCache::getInstance().useProgram(mState); - - glVertexAttribPointer(Program::position, - mesh.getVertexSize(), - GL_FLOAT, GL_FALSE, - mesh.getByteStride(), - mesh.getPositions()); - - glDrawArrays(mesh.getPrimitive(), 0, mesh.getVertexCount()); } void GLES20RenderEngine::drawMesh(const Mesh& mesh) { diff --git a/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h b/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h index 3ff6d9f..eb8f31a 100644 --- a/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h +++ b/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h @@ -58,10 +58,10 @@ protected: virtual void setupDimLayerBlending(int alpha); virtual void setupLayerTexturing(const Texture& texture); virtual void setupLayerBlackedOut(); + virtual void setupFillWithColor(float r, float g, float b, float a); virtual void disableTexturing(); virtual void disableBlending(); - virtual void fillWithColor(const Mesh& mesh, float r, float g, float b, float a); virtual void drawMesh(const Mesh& mesh); virtual size_t getMaxTextureSize() const; diff --git a/services/surfaceflinger/RenderEngine/RenderEngine.cpp b/services/surfaceflinger/RenderEngine/RenderEngine.cpp index 063be2e..2abda82 100644 --- a/services/surfaceflinger/RenderEngine/RenderEngine.cpp +++ b/services/surfaceflinger/RenderEngine/RenderEngine.cpp @@ -164,7 +164,8 @@ void RenderEngine::fillRegionWithColor(const Region& region, uint32_t height, position[i*6 + 5].x = r->right; position[i*6 + 5].y = height - r->top; } - fillWithColor(mesh, red, green, blue, alpha); + setupFillWithColor(red, green, blue, alpha); + drawMesh(mesh); } void RenderEngine::clearWithColor(float red, float green, float blue, float alpha) { diff --git a/services/surfaceflinger/RenderEngine/RenderEngine.h b/services/surfaceflinger/RenderEngine/RenderEngine.h index 82765c7..bc88b69 100644 --- a/services/surfaceflinger/RenderEngine/RenderEngine.h +++ b/services/surfaceflinger/RenderEngine/RenderEngine.h @@ -87,12 +87,12 @@ public: virtual void setupDimLayerBlending(int alpha) = 0; virtual void setupLayerTexturing(const Texture& texture) = 0; virtual void setupLayerBlackedOut() = 0; + virtual void setupFillWithColor(float r, float g, float b, float a) = 0; virtual void disableTexturing() = 0; virtual void disableBlending() = 0; // drawing - virtual void fillWithColor(const Mesh& mesh, float r, float g, float b, float a) = 0; virtual void drawMesh(const Mesh& mesh) = 0; // queries |