Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 9bb07b5

Browse files
Revert "Use the new pushImageFilter offset parameter to fix the transform of the children (#113673)" (#115861)
This reverts commit 91aeda7.
1 parent 91aeda7 commit 9bb07b5

File tree

3 files changed

+3
-61
lines changed

3 files changed

+3
-61
lines changed

packages/flutter/lib/src/rendering/layer.dart

+1-3
Original file line numberDiff line numberDiff line change
@@ -1816,14 +1816,13 @@ class ColorFilterLayer extends ContainerLayer {
18161816
}
18171817

18181818
/// A composite layer that applies an [ImageFilter] to its children.
1819-
class ImageFilterLayer extends OffsetLayer {
1819+
class ImageFilterLayer extends ContainerLayer {
18201820
/// Creates a layer that applies an [ImageFilter] to its children.
18211821
///
18221822
/// The [imageFilter] property must be non-null before the compositing phase
18231823
/// of the pipeline.
18241824
ImageFilterLayer({
18251825
ui.ImageFilter? imageFilter,
1826-
super.offset,
18271826
}) : _imageFilter = imageFilter;
18281827

18291828
/// The image filter to apply to children.
@@ -1845,7 +1844,6 @@ class ImageFilterLayer extends OffsetLayer {
18451844
assert(imageFilter != null);
18461845
engineLayer = builder.pushImageFilter(
18471846
imageFilter!,
1848-
offset: offset,
18491847
oldLayer: _engineLayer as ui.ImageFilterEngineLayer?,
18501848
);
18511849
addChildrenToScene(builder);

packages/flutter/lib/src/widgets/image_filter.dart

+2-3
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,12 @@ class _ImageFilterRenderObject extends RenderProxyBox {
105105
}
106106

107107
if (layer == null) {
108-
layer = ImageFilterLayer(imageFilter: imageFilter, offset: offset);
108+
layer = ImageFilterLayer(imageFilter: imageFilter);
109109
} else {
110110
final ImageFilterLayer filterLayer = layer! as ImageFilterLayer;
111111
filterLayer.imageFilter = imageFilter;
112-
filterLayer.offset = offset;
113112
}
114-
context.pushLayer(layer!, super.paint, Offset.zero);
113+
context.pushLayer(layer!, super.paint, offset);
115114
assert(() {
116115
layer!.debugCreator = debugCreator;
117116
return true;

packages/flutter/test/widgets/image_filter_test.dart

-55
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// machines.
77
@Tags(<String>['reduced-test-set'])
88

9-
import 'dart:math';
109
import 'dart:ui';
1110

1211
import 'package:flutter/foundation.dart';
@@ -30,24 +29,6 @@ void main() {
3029
);
3130
});
3231

33-
testWidgets('Image filter - blur with offset', (WidgetTester tester) async {
34-
await tester.pumpWidget(
35-
RepaintBoundary(
36-
child: Transform.translate(
37-
offset: const Offset(50, 50),
38-
child: ImageFiltered(
39-
imageFilter: ImageFilter.blur(sigmaX: 3.0, sigmaY: 3.0),
40-
child: const Placeholder(),
41-
),
42-
),
43-
),
44-
);
45-
await expectLater(
46-
find.byType(ImageFiltered),
47-
matchesGoldenFile('image_filter_blur_offset.png'),
48-
);
49-
});
50-
5132
testWidgets('Image filter - dilate', (WidgetTester tester) async {
5233
await tester.pumpWidget(
5334
RepaintBoundary(
@@ -116,42 +97,6 @@ void main() {
11697
);
11798
});
11899

119-
testWidgets('Image filter - matrix with offset', (WidgetTester tester) async {
120-
final Matrix4 matrix = Matrix4.rotationZ(pi / 18);
121-
final ImageFilter matrixFilter = ImageFilter.matrix(matrix.storage);
122-
await tester.pumpWidget(
123-
RepaintBoundary(
124-
child: Transform.translate(
125-
offset: const Offset(50, 50),
126-
child: ImageFiltered(
127-
imageFilter: matrixFilter,
128-
child: MaterialApp(
129-
title: 'Flutter Demo',
130-
theme: ThemeData(primarySwatch: Colors.blue),
131-
home: Scaffold(
132-
appBar: AppBar(
133-
title: const Text('Matrix ImageFilter Test'),
134-
),
135-
body: const Center(
136-
child:Text('Hooray!'),
137-
),
138-
floatingActionButton: FloatingActionButton(
139-
onPressed: () { },
140-
tooltip: 'Increment',
141-
child: const Icon(Icons.add),
142-
),
143-
),
144-
),
145-
),
146-
),
147-
),
148-
);
149-
await expectLater(
150-
find.byType(ImageFiltered),
151-
matchesGoldenFile('image_filter_matrix_offset.png'),
152-
);
153-
});
154-
155100
testWidgets('Image filter - reuses its layer', (WidgetTester tester) async {
156101
Future<void> pumpWithSigma(double sigma) async {
157102
await tester.pumpWidget(

0 commit comments

Comments
 (0)