diff options
author | Chris Craik <ccraik@google.com> | 2015-02-06 15:25:51 -0800 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2015-02-09 11:04:31 -0800 |
commit | 2ab95d780b023152556d9f8659de734ec7b55047 (patch) | |
tree | 9739704a8a0a8f16b59d1f04af4a3022b02a1998 /libs/hwui/OpenGLRenderer.cpp | |
parent | 92b2fe5d0d9781d57f3a2520eecc83682e9aa8ed (diff) | |
download | frameworks_base-2ab95d780b023152556d9f8659de734ec7b55047.zip frameworks_base-2ab95d780b023152556d9f8659de734ec7b55047.tar.gz frameworks_base-2ab95d780b023152556d9f8659de734ec7b55047.tar.bz2 |
Glop support for indexed quads
bug:19014311
Change-Id: If35a873421b41cc4508b0d8ac1b4d900c9bb3717
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 5a0cc1e..61cd16f 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -1581,7 +1581,12 @@ void OpenGLRenderer::renderGlop(const Glop& glop) { setStencilFromClip(); } mRenderState.render(glop); - dirtyLayer(glop.bounds.left, glop.bounds.top, glop.bounds.right, glop.bounds.bottom); + + if (!mRenderState.stencil().isWriteEnabled()) { + // TODO: specify more clearly when a draw should dirty the layer. + // is writing to the stencil the only time we should ignore this? + dirtyLayer(glop.bounds.left, glop.bounds.top, glop.bounds.right, glop.bounds.bottom); + } } /////////////////////////////////////////////////////////////////////////////// @@ -2353,13 +2358,12 @@ void OpenGLRenderer::drawVertexBuffer(float translateX, float translateY, aBuilder.setMeshVertexBuffer(vertexBuffer, shadowInterp) .setTransform(currentSnapshot()->getOrthoMatrix(), *currentTransform(), fudgeOffset) .setModelViewOffsetRect(translateX, translateY, vertexBuffer.getBounds()) - .setPaint(paint, currentSnapshot()->alpha) + .setPaint(*paint, currentSnapshot()->alpha) .build(); renderGlop(glop); return; } - const VertexBuffer::MeshFeatureFlags meshFeatureFlags = vertexBuffer.getMeshFeatureFlags(); Rect bounds(vertexBuffer.getBounds()); bounds.translate(translateX, translateY); @@ -3218,12 +3222,6 @@ void OpenGLRenderer::drawColorRects(const float* rects, int count, const SkPaint return; } - int color = paint->getColor(); - // If a shader is set, preserve only the alpha - if (getShader(paint)) { - color |= 0x00ffffff; - } - float left = FLT_MAX; float top = FLT_MAX; float right = FLT_MIN; @@ -3253,6 +3251,25 @@ void OpenGLRenderer::drawColorRects(const float* rects, int count, const SkPaint return; } + if (!paint->getShader() && !currentSnapshot()->roundRectClipState) { + const Matrix4& transform = ignoreTransform ? Matrix4::identity() : *currentTransform(); + Glop glop; + GlopBuilder aBuilder(mRenderState, mCaches, &glop); + aBuilder.setMeshIndexedQuads(&mesh[0], count / 4) + .setTransform(currentSnapshot()->getOrthoMatrix(), transform, false) + .setModelViewOffsetRect(0, 0, Rect(left, top, right, bottom)) + .setPaint(*paint, currentSnapshot()->alpha) + .build(); + renderGlop(glop); + return; + } + + int color = paint->getColor(); + // If a shader is set, preserve only the alpha + if (getShader(paint)) { + color |= 0x00ffffff; + } + setupDraw(); setupDrawNoTexture(); setupDrawColor(color, ((color >> 24) & 0xFF) * currentSnapshot()->alpha); @@ -3286,7 +3303,7 @@ void OpenGLRenderer::drawColorRect(float left, float top, float right, float bot aBuilder.setMeshUnitQuad() .setTransform(currentSnapshot()->getOrthoMatrix(), transform, false) .setModelViewMapUnitToRect(Rect(left, top, right, bottom)) - .setPaint(paint, currentSnapshot()->alpha) + .setPaint(*paint, currentSnapshot()->alpha) .build(); renderGlop(glop); return; |