From a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3 Mon Sep 17 00:00:00 2001 From: Chet Haase Date: Tue, 21 Feb 2012 13:43:44 -0800 Subject: Handle view properties at the native level Basic functionality of handling View properties (transforms, left/right/top/bottom, and alpha) at the native DisplayList level. This logic is disabled for now (via compile-time flags in View.java and DisplayListRenderer.h) as we continue work on it (there is no advantage to the new approach until we optimize invalidation and rendering paths to use the new code path). Change-Id: I370c8d21fbd291be415f55515ab8dced6f6d51a3 --- libs/hwui/OpenGLRenderer.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'libs/hwui/OpenGLRenderer.cpp') diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index b4310ea..685fddc 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -1323,14 +1323,26 @@ void OpenGLRenderer::finishDrawTexture() { bool OpenGLRenderer::drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height, Rect& dirty, int32_t flags, uint32_t level) { - if (quickReject(0.0f, 0.0f, width, height)) { + float top = 0; + float left = 0; + float right = width; + float bottom = height; + if (USE_DISPLAY_LIST_PROPERTIES) { + Rect transformedRect; + displayList->transformRect(left, top, right, bottom, transformedRect); + left = transformedRect.left; + top = transformedRect.top; + right = transformedRect.right; + bottom = transformedRect.bottom; + } + if (quickReject(left, top, right, bottom)) { return false; } // All the usual checks and setup operations (quickReject, setupDraw, etc.) // will be performed by the display list itself if (displayList && displayList->isRenderable()) { - return displayList->replay(*this, dirty, flags, level); + return displayList->replay(*this, width, height, dirty, flags, level); } return false; @@ -2174,13 +2186,12 @@ void OpenGLRenderer::drawText(const char* text, int bytesCount, int count, return; } + if (length < 0.0f) length = paint->measureText(text, bytesCount); switch (paint->getTextAlign()) { case SkPaint::kCenter_Align: - if (length < 0.0f) length = paint->measureText(text, bytesCount); x -= length / 2.0f; break; case SkPaint::kRight_Align: - if (length < 0.0f) length = paint->measureText(text, bytesCount); x -= length; break; default: @@ -2189,7 +2200,6 @@ void OpenGLRenderer::drawText(const char* text, int bytesCount, int count, SkPaint::FontMetrics metrics; paint->getFontMetrics(&metrics, 0.0f); - // If no length was specified, just perform the hit test on the Y axis if (quickReject(x, y + metrics.fTop, x + length, y + metrics.fBottom)) { return; } -- cgit v1.1