diff options
author | Chris Craik <ccraik@google.com> | 2014-10-02 19:28:07 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-10-02 19:28:09 +0000 |
commit | 59e129fbc8a70d58d124ccc309661719f562b486 (patch) | |
tree | e652f2698ee8d989be6b68111939fb6ab0347202 /libs/hwui | |
parent | 6062a09dbc1c26cacb6fa2dac7467ae826b70229 (diff) | |
parent | c5b5f0556b542a22f01d254e6284f69e9eb23e74 (diff) | |
download | frameworks_base-59e129fbc8a70d58d124ccc309661719f562b486.zip frameworks_base-59e129fbc8a70d58d124ccc309661719f562b486.tar.gz frameworks_base-59e129fbc8a70d58d124ccc309661719f562b486.tar.bz2 |
Merge "Account for colorfilter transparency in determining paint opacity" into lmp-mr1-dev
Diffstat (limited to 'libs/hwui')
-rw-r--r-- | libs/hwui/DisplayListOp.h | 5 | ||||
-rwxr-xr-x | libs/hwui/OpenGLRenderer.cpp | 7 | ||||
-rw-r--r-- | libs/hwui/Renderer.h | 11 |
3 files changed, 14 insertions, 9 deletions
diff --git a/libs/hwui/DisplayListOp.h b/libs/hwui/DisplayListOp.h index cb3ef9b..d78c1cb 100644 --- a/libs/hwui/DisplayListOp.h +++ b/libs/hwui/DisplayListOp.h @@ -212,10 +212,13 @@ protected: // check state/paint for transparency if (mPaint) { + if (mPaint->getAlpha() != 0xFF) { + return false; + } if (mPaint->getShader() && !mPaint->getShader()->isOpaque()) { return false; } - if (mPaint->getAlpha() != 0xFF) { + if (Renderer::isBlendedColorFilter(mPaint->getColorFilter())) { return false; } } diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index eac06cb..7a094fd 100755 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -1734,13 +1734,6 @@ void OpenGLRenderer::accountForClear(SkXfermode::Mode mode) { } } -static bool isBlendedColorFilter(const SkColorFilter* filter) { - if (filter == NULL) { - return false; - } - return (filter->getFlags() & SkColorFilter::kAlphaUnchanged_Flag) == 0; -} - void OpenGLRenderer::setupDrawBlending(const Layer* layer, bool swapSrcDst) { SkXfermode::Mode mode = layer->getMode(); // When the blending mode is kClear_Mode, we need to use a modulate color diff --git a/libs/hwui/Renderer.h b/libs/hwui/Renderer.h index 9cedd5a..a2f8c05 100644 --- a/libs/hwui/Renderer.h +++ b/libs/hwui/Renderer.h @@ -17,12 +17,13 @@ #ifndef ANDROID_HWUI_RENDERER_H #define ANDROID_HWUI_RENDERER_H +#include <SkColorFilter.h> +#include <SkPaint.h> #include <SkRegion.h> #include <utils/String8.h> #include "AssetAtlas.h" -#include "SkPaint.h" namespace android { @@ -81,6 +82,14 @@ public: && !paint.getColorFilter() && getXfermode(paint.getXfermode()) == SkXfermode::kSrcOver_Mode; } + + static bool isBlendedColorFilter(const SkColorFilter* filter) { + if (filter == NULL) { + return false; + } + return (filter->getFlags() & SkColorFilter::kAlphaUnchanged_Flag) == 0; + } + // ---------------------------------------------------------------------------- // Frame state operations // ---------------------------------------------------------------------------- |