diff options
Diffstat (limited to 'libs/hwui')
-rw-r--r-- | libs/hwui/LayerRenderer.cpp | 4 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 26 | ||||
-rw-r--r-- | libs/hwui/Properties.h | 2 |
3 files changed, 27 insertions, 5 deletions
diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp index b1eb164..f92e20b 100644 --- a/libs/hwui/LayerRenderer.cpp +++ b/libs/hwui/LayerRenderer.cpp @@ -92,7 +92,11 @@ Region* LayerRenderer::getRegion() { void LayerRenderer::generateMesh() { #if RENDER_LAYERS_AS_REGIONS +#if RENDER_LAYERS_RECT_AS_RECT if (mLayer->region.isRect() || mLayer->region.isEmpty()) { +#else + if (mLayer->region.isEmpty()) { +#endif if (mLayer->mesh) { delete mLayer->mesh; delete mLayer->meshIndices; diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index b8bd7d6..d9d7d23 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -26,6 +26,8 @@ #include <utils/Log.h> #include <utils/StopWatch.h> +#include <private/hwui/DrawGlInfo.h> + #include <ui/Rect.h> #include "OpenGLRenderer.h" @@ -216,21 +218,29 @@ bool OpenGLRenderer::callDrawGLFunction(Functor *functor, Rect& dirty) { setScissorFromClip(); } + Rect clip(*mSnapshot->clipRect); + clip.snapToPixelBoundaries(); + #if RENDER_LAYERS_AS_REGIONS // Since we don't know what the functor will draw, let's dirty // tne entire clip region if (hasLayer()) { - Rect clip(*mSnapshot->clipRect); - clip.snapToPixelBoundaries(); dirtyLayerUnchecked(clip, getRegion()); } #endif - float bounds[4]; - status_t result = (*functor)(&bounds[0], 4); + DrawGlInfo info; + info.clipLeft = clip.left; + info.clipTop = clip.top; + info.clipRight = clip.right; + info.clipBottom = clip.bottom; + info.isLayer = hasLayer(); + getSnapshot()->transform->copyTo(&info.transform[0]); + + status_t result = (*functor)(0, &info); if (result != 0) { - Rect localDirty(bounds[0], bounds[1], bounds[2], bounds[3]); + Rect localDirty(info.dirtyLeft, info.dirtyTop, info.dirtyRight, info.dirtyBottom); dirty.unionWith(localDirty); } @@ -636,11 +646,13 @@ void OpenGLRenderer::composeLayerRect(Layer* layer, const Rect& rect, bool swap) void OpenGLRenderer::composeLayerRegion(Layer* layer, const Rect& rect) { #if RENDER_LAYERS_AS_REGIONS +#if RENDER_LAYERS_RECT_AS_RECT if (layer->region.isRect()) { composeLayerRect(layer, rect); layer->region.clear(); return; } +#endif if (!layer->region.isEmpty()) { size_t count; @@ -1646,10 +1658,14 @@ void OpenGLRenderer::drawLayer(Layer* layer, float x, float y, SkPaint* paint) { #if RENDER_LAYERS_AS_REGIONS if (!layer->region.isEmpty()) { +#if RENDER_LAYERS_RECT_AS_RECT if (layer->region.isRect()) { const Rect r(x, y, x + layer->layer.getWidth(), y + layer->layer.getHeight()); composeLayerRect(layer, r); } else if (layer->mesh) { +#else + if (layer->mesh) { +#endif const float a = alpha / 255.0f; const Rect& rect = layer->layer; diff --git a/libs/hwui/Properties.h b/libs/hwui/Properties.h index 2d8b6f3..1aef99b 100644 --- a/libs/hwui/Properties.h +++ b/libs/hwui/Properties.h @@ -27,6 +27,8 @@ // If turned on, layers drawn inside FBOs are optimized with regions #define RENDER_LAYERS_AS_REGIONS 1 +// If turned on, layers that map to a single rect are drawn as a rect +#define RENDER_LAYERS_RECT_AS_RECT 0 /** * Debug level for app developers. |