From d15ebf25c595b855f6978d0600218e3ea5f31e92 Mon Sep 17 00:00:00 2001 From: Chet Haase Date: Wed, 5 Sep 2012 11:40:29 -0700 Subject: Enable changing properties of layer paint Previously, to draw a layered view with a changed Paint object for the drawLayer operation, you'd have to invalidate the parent view, to get the native DisplayList to pick up the new Paint properties. This change adds API and functionality so that the developer can call setLayerPaint(), which does the proper invalidation (lightweight, doesn't cause redrawing the view). Issue #6923810 Make it easy to efficiently animate a layer's Paint Change-Id: I7fea79788d50f6d9c86dd5e5b2a4490cb95142bb --- libs/hwui/OpenGLRenderer.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'libs/hwui/OpenGLRenderer.cpp') diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index b66c89854c08..05c7809e4647 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -2593,17 +2593,13 @@ status_t OpenGLRenderer::drawLayer(Layer* layer, float x, float y, SkPaint* pain mCaches.activeTexture(0); - int alpha; - SkXfermode::Mode mode; - getAlphaAndMode(paint, &alpha, &mode); - - layer->setAlpha(alpha, mode); - if (CC_LIKELY(!layer->region.isEmpty())) { if (layer->region.isRect()) { composeLayerRect(layer, layer->regionRect); } else if (layer->mesh) { - const float a = alpha / 255.0f; + const float a = layer->getAlpha() / 255.0f; + SkiaColorFilter *oldFilter = mColorFilter; + mColorFilter = layer->getColorFilter(); setupDraw(); setupDrawWithTexture(); @@ -2633,6 +2629,8 @@ status_t OpenGLRenderer::drawLayer(Layer* layer, float x, float y, SkPaint* pain finishDrawTexture(); + mColorFilter = oldFilter; + #if DEBUG_LAYERS_AS_REGIONS drawRegionRects(layer->region); #endif -- cgit v1.2.3-59-g8ed1b