diff options
author | Chris Craik <ccraik@google.com> | 2014-09-17 17:01:34 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-09-17 17:01:35 +0000 |
commit | ba9d58516cbd544df67454922c23b0597fc01fcf (patch) | |
tree | e2842b9dcb8ce96d88e98183a29b7ad94ab5e6aa | |
parent | 63b328bdebf171a90dacaa10aad6377608c19fcf (diff) | |
parent | 73821c8d2bd453de6bf3f516e1f1cdb9a132f4a7 (diff) | |
download | frameworks_base-ba9d58516cbd544df67454922c23b0597fc01fcf.zip frameworks_base-ba9d58516cbd544df67454922c23b0597fc01fcf.tar.gz frameworks_base-ba9d58516cbd544df67454922c23b0597fc01fcf.tar.bz2 |
Merge "Handle premultiplication correctly for ColorMatrixColorFilters" into lmp-dev
-rw-r--r-- | libs/hwui/ProgramCache.cpp | 4 | ||||
-rw-r--r-- | libs/hwui/Renderer.h | 2 |
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; } // ---------------------------------------------------------------------------- |