From 90d0c75e94a32fb7d993fae69762820aabc2fcbb Mon Sep 17 00:00:00 2001 From: Derek Sollenberger Date: Wed, 12 Feb 2014 18:59:05 +0000 Subject: Revert "Refactor setting an SkPaint onto a hwui Layer." This reverts commit e889298cd6ae1fc0d76bc00d7d12586db03eb261. Change-Id: I4b1d609b2d4280595d40cb10d6c18875c22999f8 --- libs/hwui/OpenGLRenderer.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'libs/hwui/OpenGLRenderer.cpp') diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 0a83332dad95..fee916b25369 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -868,11 +868,14 @@ bool OpenGLRenderer::createLayer(float left, float top, float right, float botto const bool fboLayer = flags & SkCanvas::kClipToLayer_SaveFlag; + SkXfermode::Mode mode = getXfermodeDirect(paint); + int alpha = getAlphaDirect(paint); + // Window coordinates of the layer Rect clip; Rect bounds(left, top, right, bottom); calculateLayerBoundsAndClip(bounds, clip, fboLayer); - updateSnapshotIgnoreForLayer(bounds, clip, fboLayer, getAlphaDirect(paint)); + updateSnapshotIgnoreForLayer(bounds, clip, fboLayer, alpha); // Bail out if we won't draw in this snapshot if (currentSnapshot()->isIgnored()) { @@ -885,11 +888,12 @@ bool OpenGLRenderer::createLayer(float left, float top, float right, float botto return false; } - layer->setPaint(paint); + layer->setAlpha(alpha, mode); layer->layer.set(bounds); layer->texCoords.set(0.0f, bounds.getHeight() / float(layer->getHeight()), bounds.getWidth() / float(layer->getWidth()), 0.0f); + layer->setColorFilter(getColorFilter(paint)); layer->setBlend(true); layer->setDirty(false); @@ -1007,6 +1011,7 @@ void OpenGLRenderer::composeLayer(const Snapshot& removed, const Snapshot& resto } if (!fboLayer && layer->getAlpha() < 255) { + // TODO: this seems to point to the fact that the layer should store the paint SkPaint layerPaint; layerPaint.setAlpha(layer->getAlpha()); layerPaint.setXfermodeMode(SkXfermode::kDstIn_Mode); -- cgit v1.2.3-59-g8ed1b