Skip to content

Commit

Permalink
Switch to FilterQuality.medium for images (#52984)
Browse files Browse the repository at this point in the history
  • Loading branch information
goderbauer authored May 29, 2024
1 parent fc3ae2d commit 557a4c6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/ui/painting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3740,7 +3740,7 @@ abstract class ImageFilter {
/// For example, applying a positive scale matrix (see [Matrix4.diagonal3])
/// when used with [BackdropFilter] would magnify the background image.
factory ImageFilter.matrix(Float64List matrix4,
{ FilterQuality filterQuality = FilterQuality.low }) {
{ FilterQuality filterQuality = FilterQuality.medium }) {
if (matrix4.length != 16) {
throw ArgumentError('"matrix4" must have 16 entries.');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/web_ui/lib/painting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ class ImageFilter {
factory ImageFilter.erode({ double radiusX = 0.0, double radiusY = 0.0 }) =>
engine.renderer.createErodeImageFilter(radiusX: radiusX, radiusY: radiusY);

factory ImageFilter.matrix(Float64List matrix4, {FilterQuality filterQuality = FilterQuality.low}) {
factory ImageFilter.matrix(Float64List matrix4, {FilterQuality filterQuality = FilterQuality.medium}) {
if (matrix4.length != 16) {
throw ArgumentError('"matrix4" must have 16 entries.');
}
Expand Down
9 changes: 9 additions & 0 deletions testing/dart/painting_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'dart:typed_data';
import 'dart:ui';

import 'package:litetest/litetest.dart';
import 'package:vector_math/vector_math_64.dart';

typedef CanvasCallback = void Function(Canvas canvas);

Expand Down Expand Up @@ -103,4 +104,12 @@ void main() {
whitePicture.dispose();
redClippedPicture.dispose();
});

test('ImageFilter.matrix defaults to FilterQuality.medium', () {
final Float64List data = Matrix4.identity().storage;
expect(
ImageFilter.matrix(data).toString(),
'ImageFilter.matrix($data, FilterQuality.medium)',
);
});
}

0 comments on commit 557a4c6

Please sign in to comment.