Merge "Handle premultiplication correctly for ColorMatrixColorFilters" into lmp-dev
This commit is contained in:
@@ -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"
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user