am bf5e8b63: am 19733a32: minor clean-up of the GLESRenderer

* commit 'bf5e8b631db3dbd9cee5cf8805c5379f013b54db':
  minor clean-up of the GLESRenderer
This commit is contained in:
Mathias Agopian 2013-08-28 18:41:31 -07:00 committed by Android Git Automerger
commit aa62c663b7
7 changed files with 14 additions and 25 deletions

View File

@ -506,8 +506,10 @@ void Layer::onDraw(const sp<const DisplayDevice>& hw, const Region& clip) const
void Layer::clearWithOpenGL(const sp<const DisplayDevice>& hw, const Region& clip, void Layer::clearWithOpenGL(const sp<const DisplayDevice>& hw, const Region& clip,
float red, float green, float blue, float alpha) const float red, float green, float blue, float alpha) const
{ {
RenderEngine& engine(mFlinger->getRenderEngine());
computeGeometry(hw, mMesh); computeGeometry(hw, mMesh);
mFlinger->getRenderEngine().fillWithColor(mMesh, red, green, blue, alpha); engine.setupFillWithColor(red, green, blue, alpha);
engine.drawMesh(mMesh);
} }
void Layer::clearWithOpenGL( void Layer::clearWithOpenGL(

View File

@ -209,18 +209,11 @@ void GLES11RenderEngine::unbindFramebuffer(uint32_t texName, uint32_t fbName) {
glDeleteTextures(1, &texName); 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); glColor4f(r, g, b, a);
glDisable(GL_TEXTURE_EXTERNAL_OES); glDisable(GL_TEXTURE_EXTERNAL_OES);
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND); glDisable(GL_BLEND);
glVertexPointer(mesh.getVertexSize(),
GL_FLOAT,
mesh.getByteStride(),
mesh.getPositions());
glDrawArrays(mesh.getPrimitive(), 0, mesh.getVertexCount());
} }
void GLES11RenderEngine::drawMesh(const Mesh& mesh) { void GLES11RenderEngine::drawMesh(const Mesh& mesh) {

View File

@ -54,10 +54,10 @@ protected:
virtual void setupDimLayerBlending(int alpha); virtual void setupDimLayerBlending(int alpha);
virtual void setupLayerTexturing(const Texture& texture); virtual void setupLayerTexturing(const Texture& texture);
virtual void setupLayerBlackedOut(); virtual void setupLayerBlackedOut();
virtual void setupFillWithColor(float r, float g, float b, float a) ;
virtual void disableTexturing(); virtual void disableTexturing();
virtual void disableBlending(); virtual void disableBlending();
virtual void fillWithColor(const Mesh& mesh, float r, float g, float b, float a) ;
virtual void drawMesh(const Mesh& mesh); virtual void drawMesh(const Mesh& mesh);
virtual size_t getMaxTextureSize() const; virtual size_t getMaxTextureSize() const;

View File

@ -186,20 +186,13 @@ void GLES20RenderEngine::unbindFramebuffer(uint32_t texName, uint32_t fbName) {
glDeleteTextures(1, &texName); 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); mState.setColor(r, g, b, a);
disableTexturing(); mState.disableTexture();
glDisable(GL_BLEND); 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) { void GLES20RenderEngine::drawMesh(const Mesh& mesh) {

View File

@ -58,10 +58,10 @@ protected:
virtual void setupDimLayerBlending(int alpha); virtual void setupDimLayerBlending(int alpha);
virtual void setupLayerTexturing(const Texture& texture); virtual void setupLayerTexturing(const Texture& texture);
virtual void setupLayerBlackedOut(); virtual void setupLayerBlackedOut();
virtual void setupFillWithColor(float r, float g, float b, float a);
virtual void disableTexturing(); virtual void disableTexturing();
virtual void disableBlending(); virtual void disableBlending();
virtual void fillWithColor(const Mesh& mesh, float r, float g, float b, float a);
virtual void drawMesh(const Mesh& mesh); virtual void drawMesh(const Mesh& mesh);
virtual size_t getMaxTextureSize() const; virtual size_t getMaxTextureSize() const;

View File

@ -164,7 +164,8 @@ void RenderEngine::fillRegionWithColor(const Region& region, uint32_t height,
position[i*6 + 5].x = r->right; position[i*6 + 5].x = r->right;
position[i*6 + 5].y = height - r->top; 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) { void RenderEngine::clearWithColor(float red, float green, float blue, float alpha) {

View File

@ -87,12 +87,12 @@ public:
virtual void setupDimLayerBlending(int alpha) = 0; virtual void setupDimLayerBlending(int alpha) = 0;
virtual void setupLayerTexturing(const Texture& texture) = 0; virtual void setupLayerTexturing(const Texture& texture) = 0;
virtual void setupLayerBlackedOut() = 0; virtual void setupLayerBlackedOut() = 0;
virtual void setupFillWithColor(float r, float g, float b, float a) = 0;
virtual void disableTexturing() = 0; virtual void disableTexturing() = 0;
virtual void disableBlending() = 0; virtual void disableBlending() = 0;
// drawing // drawing
virtual void fillWithColor(const Mesh& mesh, float r, float g, float b, float a) = 0;
virtual void drawMesh(const Mesh& mesh) = 0; virtual void drawMesh(const Mesh& mesh) = 0;
// queries // queries