diff options
Diffstat (limited to 'libs/hwui/CanvasTransform.cpp')
-rw-r--r-- | libs/hwui/CanvasTransform.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libs/hwui/CanvasTransform.cpp b/libs/hwui/CanvasTransform.cpp index adcdc18ab418..a03b31723808 100644 --- a/libs/hwui/CanvasTransform.cpp +++ b/libs/hwui/CanvasTransform.cpp @@ -28,6 +28,7 @@ #include <cmath> #include <log/log.h> +#include <SkHighContrastFilter.h> namespace android::uirenderer { @@ -113,4 +114,20 @@ bool transformPaint(ColorTransform transform, SkPaint* paint) { return true; } +bool transformPaint(ColorTransform transform, SkPaint* paint, BitmapPalette palette) { + bool shouldInvert = false; + if (palette == BitmapPalette::Light && transform == ColorTransform::Dark) { + shouldInvert = true; + } + if (palette == BitmapPalette::Dark && transform == ColorTransform::Light) { + shouldInvert = true; + } + if (shouldInvert) { + SkHighContrastConfig config; + config.fInvertStyle = SkHighContrastConfig::InvertStyle::kInvertLightness; + paint->setColorFilter(SkHighContrastFilter::Make(config)->makeComposed(paint->refColorFilter())); + } + return shouldInvert; +} + }; // namespace android::uirenderer
\ No newline at end of file |