summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2014-09-17 17:27:02 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-09-17 17:27:02 +0000
commitcd4f28e999b4aceadb32ec1b46f5538561fde1dd (patch)
tree11cd9ece237f7cb419ce42b9c0e9f4a785dbd131 /libs
parente529ea426ecd2b5da3064d8ef3bdbac53520a5c1 (diff)
parent4e458aca821ff8863ffbf1475af15b621deef964 (diff)
downloadframeworks_base-cd4f28e999b4aceadb32ec1b46f5538561fde1dd.zip
frameworks_base-cd4f28e999b4aceadb32ec1b46f5538561fde1dd.tar.gz
frameworks_base-cd4f28e999b4aceadb32ec1b46f5538561fde1dd.tar.bz2
am befbdaba: am b5a27aee: Merge "Handle premultiplication correctly for ColorMatrixColorFilters" into lmp-dev
* commit 'befbdaba72a2c1502ff6135a8214f7434a6b2ea7': Handle premultiplication correctly for ColorMatrixColorFilters
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/ProgramCache.cpp4
-rw-r--r--libs/hwui/Renderer.h2
2 files changed, 5 insertions, 1 deletions
diff --git a/libs/hwui/ProgramCache.cpp b/libs/hwui/ProgramCache.cpp
index a8b8b16..06353c0 100644
--- a/libs/hwui/ProgramCache.cpp
+++ b/libs/hwui/ProgramCache.cpp
@@ -327,8 +327,10 @@ const char* gFS_Main_ApplyColorOp[3] = {
// None
"",
// Matrix
+ " fragColor.rgb /= (fragColor.a + 0.0019);\n" // un-premultiply
" fragColor *= colorMatrix;\n"
- " fragColor += colorMatrixVector;\n",
+ " fragColor += colorMatrixVector;\n"
+ " fragColor.rgb *= (fragColor.a + 0.0019);\n", // re-premultiply
// PorterDuff
" fragColor = blendColors(colorBlend, fragColor);\n"
};
diff --git a/libs/hwui/Renderer.h b/libs/hwui/Renderer.h
index 6d4bb4a..3681637 100644
--- a/libs/hwui/Renderer.h
+++ b/libs/hwui/Renderer.h
@@ -70,6 +70,7 @@ public:
// TODO: move to a method on android:Paint
static inline bool paintWillNotDraw(const SkPaint& paint) {
return paint.getAlpha() == 0
+ && !paint.getColorFilter()
&& getXfermode(paint.getXfermode()) != SkXfermode::kClear_Mode;
}
@@ -77,6 +78,7 @@ public:
static inline bool paintWillNotDrawText(const SkPaint& paint) {
return paint.getAlpha() == 0
&& paint.getLooper() == NULL
+ && !paint.getColorFilter()
&& getXfermode(paint.getXfermode()) == SkXfermode::kSrcOver_Mode;
}
// ----------------------------------------------------------------------------