diff options
author | 2011-01-13 12:13:20 -0800 | |
---|---|---|
committer | 2011-01-13 12:13:20 -0800 | |
commit | ada830f639591b99c3e40de22b07296c7932a33f (patch) | |
tree | 308f469469e96ce7f99d2ec5135e7d44eb858a35 /libs/hwui/OpenGLRenderer.cpp | |
parent | 4f6aff386045000c2c03b903c7109cb42092b7ea (diff) |
Cleanup implementation of hardware layers.
The new implementation relies on OpenGLRenderer's existing layer
code instead of duplicating it. The new code is much cleaner, with
simpler and better APIs and allows tracking of drawn regions inside
layers. Region tracking is not yet enabled but this will be done
in a future CL.
Change-Id: Ie826121a2227de8252c77b992a61218defea5143
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 9beb227c9b0c..7f7deec90a1b 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -622,10 +622,12 @@ void OpenGLRenderer::composeLayerRegion(Layer* layer, const Rect& rect) { setupDraw(); setupDrawWithTexture(); setupDrawColor(alpha, alpha, alpha, alpha); + setupDrawColorFilter(); setupDrawBlending(layer->blend || layer->alpha < 255, layer->mode, false); setupDrawProgram(); setupDrawDirtyRegionsDisabled(); setupDrawPureColorUniforms(); + setupDrawColorFilterUniforms(); setupDrawTexture(layer->texture); setupDrawModelViewTranslate(rect.left, rect.top, rect.right, rect.bottom); setupDrawMesh(&mesh[0].position[0], &mesh[0].texture[0]); @@ -1485,28 +1487,22 @@ void OpenGLRenderer::drawPath(SkPath* path, SkPaint* paint) { finishDrawTexture(); } -void OpenGLRenderer::drawLayer(int texture, float left, float top, float right, float bottom, - float u, float v, SkPaint* paint) { - if (quickReject(left, top, right, bottom)) { +void OpenGLRenderer::drawLayer(Layer* layer, float x, float y, SkPaint* paint) { + if (!layer || quickReject(x, y, x + layer->layer.getWidth(), y + layer->layer.getHeight())) { return; } glActiveTexture(gTextureUnits[0]); - if (!texture) return; - - mCaches.unbindMeshBuffer(); - resetDrawTextureTexCoords(0.0f, v, u, 0.0f); int alpha; SkXfermode::Mode mode; getAlphaAndMode(paint, &alpha, &mode); - // TODO: Should get the blend info from the caller - drawTextureMesh(left, top, right, bottom, texture, alpha / 255.0f, mode, true, - &mMeshVertices[0].position[0], &mMeshVertices[0].texture[0], - GL_TRIANGLE_STRIP, gMeshCount); + layer->alpha = alpha; + layer->mode = mode; - resetDrawTextureTexCoords(0.0f, 0.0f, 1.0f, 1.0f); + const Rect r(x, y, x + layer->layer.getWidth(), y + layer->layer.getHeight()); + composeLayerRect(layer, r); } /////////////////////////////////////////////////////////////////////////////// |