summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2014-10-02 19:28:07 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-10-02 19:28:09 +0000
commit59e129fbc8a70d58d124ccc309661719f562b486 (patch)
treee652f2698ee8d989be6b68111939fb6ab0347202
parent6062a09dbc1c26cacb6fa2dac7467ae826b70229 (diff)
parentc5b5f0556b542a22f01d254e6284f69e9eb23e74 (diff)
downloadframeworks_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
-rw-r--r--libs/hwui/DisplayListOp.h5
-rwxr-xr-xlibs/hwui/OpenGLRenderer.cpp7
-rw-r--r--libs/hwui/Renderer.h11
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
// ----------------------------------------------------------------------------