Skip to content

[Impeller] setting paint.invertColors does not work if you also set a colorFilter on the paint. #135699

@dnfield

Description

@dnfield

E.g. the ColorFilter - matrix test in color_filter_test.dart is broken for Impeller.

This is a small app that should cycle between two colors every 250ms, but on Impeller it stays solid:

import 'dart:ui';

void main() {
  const List<double> greyscaleColorMatrix = <double>[
    0.2126, 0.7152, 0.0722, 0, 0, //
    0.2126, 0.7152, 0.0722, 0, 0, //
    0.2126, 0.7152, 0.0722, 0, 0, //
    0, 0, 0, 1, 0, //
  ];
  const Color green = Color(0xFF00AA00);

  final Paint paint = Paint()
    ..color = green
    ..colorFilter = const ColorFilter.matrix(greyscaleColorMatrix);

  window.onBeginFrame = (_) {
    final recorder = PictureRecorder();
    final canvas = Canvas(recorder);
    canvas.drawPaint(paint);
    final picture = recorder.endRecording();
    final builder = SceneBuilder();
    builder.addPicture(Offset.zero, picture);
    final scene = builder.build();
    window.render(scene);
    scene.dispose();
    picture.dispose();

    paint.invertColors = !paint.invertColors;
    Future.delayed(const Duration(milliseconds: 250)).then((_) {
      window.scheduleFrame();
    });
  };

  window.scheduleFrame();
}

Metadata

Metadata

Assignees

Labels

e: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.team-engineOwned by Engine team

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions