Loading libs/hwui/OpenGLRenderer.cpp +30 −8 Original line number Diff line number Diff line Loading @@ -309,17 +309,12 @@ bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top, glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bounds.left, mHeight - bounds.bottom, bounds.getWidth(), bounds.getHeight(), 0); // Clear the framebuffer where the layer will draw glScissor(bounds.left, mHeight - bounds.bottom, bounds.getWidth(), bounds.getHeight()); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT); if (flags & SkCanvas::kClipToLayer_SaveFlag) { mSnapshot->clipTransformed(bounds); if (mSnapshot->clipTransformed(bounds)) setScissorFromClip(); } // Restore the initial clip setScissorFromClip(); // Enqueue the buffer coordinates to clear the corresponding region later mLayers.push(new Rect(bounds)); return true; } Loading Loading @@ -371,6 +366,26 @@ void OpenGLRenderer::composeLayer(sp<Snapshot> current, sp<Snapshot> previous) { } } void OpenGLRenderer::clearLayerRegions() { if (mLayers.size() == 0) return; for (uint32_t i = 0; i < mLayers.size(); i++) { Rect* bounds = mLayers.itemAt(i); // Clear the framebuffer where the layer will draw glScissor(bounds->left, mHeight - bounds->bottom, bounds->getWidth(), bounds->getHeight()); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT); delete bounds; } mLayers.clear(); // Restore the clip setScissorFromClip(); } /////////////////////////////////////////////////////////////////////////////// // Transforms /////////////////////////////////////////////////////////////////////////////// Loading Loading @@ -612,6 +627,7 @@ void OpenGLRenderer::drawText(const char* text, int bytesCount, int count, mode, false, true); const Rect& clip = mSnapshot->getLocalClip(); clearLayerRegions(); fontRenderer.renderText(paint, &clip, text, 0, bytesCount, count, x, y); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); Loading Loading @@ -651,6 +667,8 @@ void OpenGLRenderer::drawPath(SkPath* path, SkPaint* paint) { setupTextureAlpha8(texture, textureUnit, x, y, r, g, b, a, mode, true, true); clearLayerRegions(); // Draw the mesh glDrawArrays(GL_TRIANGLE_STRIP, 0, gMeshCount); glDisableVertexAttribArray(mCaches.currentProgram->getAttrib("texCoords")); Loading Loading @@ -836,6 +854,8 @@ void OpenGLRenderer::drawTextDecorations(const char* text, int bytesCount, float void OpenGLRenderer::drawColorRect(float left, float top, float right, float bottom, int color, SkXfermode::Mode mode, bool ignoreTransform, bool ignoreBlending) { clearLayerRegions(); // If a shader is set, preserve only the alpha if (mShader) { color |= 0x00ffffff; Loading Loading @@ -914,6 +934,8 @@ void OpenGLRenderer::drawTextureMesh(float left, float top, float right, float b GLuint texture, float alpha, SkXfermode::Mode mode, bool blend, GLvoid* vertices, GLvoid* texCoords, GLvoid* indices, GLsizei elementsCount, bool swapSrcDst, bool ignoreTransform) { clearLayerRegions(); ProgramDescription description; description.hasTexture = true; if (mColorFilter) { Loading libs/hwui/OpenGLRenderer.h +11 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include <utils/RefBase.h> #include <utils/ResourceTypes.h> #include <utils/Vector.h> #include "Extensions.h" #include "Matrix.h" Loading Loading @@ -155,6 +156,12 @@ private: bool createLayer(sp<Snapshot> snapshot, float left, float top, float right, float bottom, int alpha, SkXfermode::Mode mode, int flags); /** * Clears all the regions corresponding to the current list of layers. * This method MUST be invoked before any drawing operation. */ void clearLayerRegions(); /** * Draws a colored rectangle with the specified color. The specified coordinates * are transformed by the current snapshot's transform matrix. Loading Loading @@ -385,6 +392,10 @@ private: // Various caches Caches& mCaches; // List of rectangles to clear due to calls to saveLayer() Vector<Rect*> mLayers; }; // class OpenGLRenderer }; // namespace uirenderer Loading tests/HwAccelerationTest/src/com/android/test/hwui/TransparentListActivity.java +1 −1 File changed.Contains only whitespace changes. Show changes Loading
libs/hwui/OpenGLRenderer.cpp +30 −8 Original line number Diff line number Diff line Loading @@ -309,17 +309,12 @@ bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top, glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bounds.left, mHeight - bounds.bottom, bounds.getWidth(), bounds.getHeight(), 0); // Clear the framebuffer where the layer will draw glScissor(bounds.left, mHeight - bounds.bottom, bounds.getWidth(), bounds.getHeight()); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT); if (flags & SkCanvas::kClipToLayer_SaveFlag) { mSnapshot->clipTransformed(bounds); if (mSnapshot->clipTransformed(bounds)) setScissorFromClip(); } // Restore the initial clip setScissorFromClip(); // Enqueue the buffer coordinates to clear the corresponding region later mLayers.push(new Rect(bounds)); return true; } Loading Loading @@ -371,6 +366,26 @@ void OpenGLRenderer::composeLayer(sp<Snapshot> current, sp<Snapshot> previous) { } } void OpenGLRenderer::clearLayerRegions() { if (mLayers.size() == 0) return; for (uint32_t i = 0; i < mLayers.size(); i++) { Rect* bounds = mLayers.itemAt(i); // Clear the framebuffer where the layer will draw glScissor(bounds->left, mHeight - bounds->bottom, bounds->getWidth(), bounds->getHeight()); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT); delete bounds; } mLayers.clear(); // Restore the clip setScissorFromClip(); } /////////////////////////////////////////////////////////////////////////////// // Transforms /////////////////////////////////////////////////////////////////////////////// Loading Loading @@ -612,6 +627,7 @@ void OpenGLRenderer::drawText(const char* text, int bytesCount, int count, mode, false, true); const Rect& clip = mSnapshot->getLocalClip(); clearLayerRegions(); fontRenderer.renderText(paint, &clip, text, 0, bytesCount, count, x, y); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); Loading Loading @@ -651,6 +667,8 @@ void OpenGLRenderer::drawPath(SkPath* path, SkPaint* paint) { setupTextureAlpha8(texture, textureUnit, x, y, r, g, b, a, mode, true, true); clearLayerRegions(); // Draw the mesh glDrawArrays(GL_TRIANGLE_STRIP, 0, gMeshCount); glDisableVertexAttribArray(mCaches.currentProgram->getAttrib("texCoords")); Loading Loading @@ -836,6 +854,8 @@ void OpenGLRenderer::drawTextDecorations(const char* text, int bytesCount, float void OpenGLRenderer::drawColorRect(float left, float top, float right, float bottom, int color, SkXfermode::Mode mode, bool ignoreTransform, bool ignoreBlending) { clearLayerRegions(); // If a shader is set, preserve only the alpha if (mShader) { color |= 0x00ffffff; Loading Loading @@ -914,6 +934,8 @@ void OpenGLRenderer::drawTextureMesh(float left, float top, float right, float b GLuint texture, float alpha, SkXfermode::Mode mode, bool blend, GLvoid* vertices, GLvoid* texCoords, GLvoid* indices, GLsizei elementsCount, bool swapSrcDst, bool ignoreTransform) { clearLayerRegions(); ProgramDescription description; description.hasTexture = true; if (mColorFilter) { Loading
libs/hwui/OpenGLRenderer.h +11 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include <utils/RefBase.h> #include <utils/ResourceTypes.h> #include <utils/Vector.h> #include "Extensions.h" #include "Matrix.h" Loading Loading @@ -155,6 +156,12 @@ private: bool createLayer(sp<Snapshot> snapshot, float left, float top, float right, float bottom, int alpha, SkXfermode::Mode mode, int flags); /** * Clears all the regions corresponding to the current list of layers. * This method MUST be invoked before any drawing operation. */ void clearLayerRegions(); /** * Draws a colored rectangle with the specified color. The specified coordinates * are transformed by the current snapshot's transform matrix. Loading Loading @@ -385,6 +392,10 @@ private: // Various caches Caches& mCaches; // List of rectangles to clear due to calls to saveLayer() Vector<Rect*> mLayers; }; // class OpenGLRenderer }; // namespace uirenderer Loading
tests/HwAccelerationTest/src/com/android/test/hwui/TransparentListActivity.java +1 −1 File changed.Contains only whitespace changes. Show changes