This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -400,13 +400,14 @@ class ImageFilterEngineLayer extends ContainerLayer
400
400
401
401
@override
402
402
void preroll (PrerollContext prerollContext, Matrix4 matrix) {
403
- final Matrix4 transform =
404
- (_filter as CkManagedSkImageFilterConvertible ).transform ;
405
- final Matrix4 childMatrix = matrix. multiplied (transform);
406
- prerollContext.mutatorsStack. pushTransform (transform );
403
+ final Matrix4 childMatrix = Matrix4 . copy (matrix);
404
+ childMatrix. translate (_offset.dx, _offset.dy) ;
405
+ prerollContext.mutatorsStack
406
+ . pushTransform (Matrix4 . translationValues (_offset.dx, _offset.dy, 0.0 ) );
407
407
final ui.Rect childPaintBounds =
408
408
prerollChildren (prerollContext, childMatrix);
409
- _filter.imageFilter ((SkImageFilter filter) {
409
+ (_filter as CkManagedSkImageFilterConvertible )
410
+ .imageFilter ((SkImageFilter filter) {
410
411
paintBounds =
411
412
rectFromSkIRect (filter.getOutputBounds (toSkRect (childPaintBounds)));
412
413
});
Original file line number Diff line number Diff line change @@ -78,6 +78,16 @@ Future<void> testMain() async {
78
78
await matchGoldenFile ('ui_filter_matrix_imagefilter.png' , region: region);
79
79
});
80
80
81
+ test ('resizing matrix filter' , () async {
82
+ await drawTestImageWithPaint (ui.Paint ()
83
+ ..imageFilter = ui.ImageFilter .matrix (
84
+ Matrix4 .diagonal3Values (0.5 , 0.5 , 1 ).toFloat64 (),
85
+ filterQuality: ui.FilterQuality .high,
86
+ ));
87
+ await matchGoldenFile ('ui_filter_matrix_imagefilter_scaled.png' ,
88
+ region: region);
89
+ });
90
+
81
91
test ('composed filters' , () async {
82
92
final ui.ImageFilter filter = ui.ImageFilter .compose (
83
93
outer: ui.ImageFilter .matrix (
You can’t perform that action at this time.
0 commit comments