Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4eb21445 authored by Derek Sollenberger's avatar Derek Sollenberger
Browse files

Fix bug in View system recording where Skia dropped the colorFilter.

Test: CtsUiRenderingTestCases added ColorFilterTests::testColorMatrix
Bug: 69071705
Change-Id: I45268c9a40e47d44045d795ccb772ea93c3e699d
parent 17da6d2a
Loading
Loading
Loading
Loading
+12 −9
Original line number Diff line number Diff line
@@ -144,22 +144,25 @@ void SkiaRecordingCanvas::drawVectorDrawable(VectorDrawableRoot* tree) {
// ----------------------------------------------------------------------------

inline static const SkPaint* bitmapPaint(const SkPaint* origPaint, SkPaint* tmpPaint,
                                         sk_sp<SkColorFilter> colorFilter) {
    if ((origPaint && origPaint->isAntiAlias()) || colorFilter) {
                                         sk_sp<SkColorFilter> colorSpaceFilter) {
    if ((origPaint && origPaint->isAntiAlias()) || colorSpaceFilter) {
        if (origPaint) {
            *tmpPaint = *origPaint;
        }

        sk_sp<SkColorFilter> filter;
        if (colorFilter && tmpPaint->getColorFilter()) {
            filter = SkColorFilter::MakeComposeFilter(tmpPaint->refColorFilter(), colorFilter);
            LOG_ALWAYS_FATAL_IF(!filter);
        if (colorSpaceFilter) {
            if (tmpPaint->getColorFilter()) {
                tmpPaint->setColorFilter(
                        SkColorFilter::MakeComposeFilter(tmpPaint->refColorFilter(), colorSpaceFilter));
            } else {
            filter = colorFilter;
                tmpPaint->setColorFilter(colorSpaceFilter);
            }
            LOG_ALWAYS_FATAL_IF(!tmpPaint->getColorFilter());
        }


        // disabling AA on bitmap draws matches legacy HWUI behavior
        tmpPaint->setAntiAlias(false);
        tmpPaint->setColorFilter(filter);
        return tmpPaint;
    } else {
        return origPaint;