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

Commit add0f51

Browse files
Correctly offset the cull rect of the opacity layer. (#50928)
This fixes flutter/flutter#140999. Previously, the cull rect would be misplaced causing many elements to not render at all.
1 parent 99dd2c8 commit add0f51

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/web_ui/lib/src/engine/layers.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ class OpacityOperation implements LayerOperation {
283283
if (offset != ui.Offset.zero) {
284284
canvas.save();
285285
canvas.translate(offset.dx, offset.dy);
286+
cullRect = cullRect.shift(-offset);
286287
}
287288
canvas.saveLayer(
288289
cullRect,

lib/web_ui/test/ui/scene_builder_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,16 @@ Future<void> testMain() async {
124124
);
125125
}));
126126

127-
sceneBuilder.pushOpacity(0x7F);
127+
sceneBuilder.pushOpacity(0x7F, offset: const ui.Offset(150, 150));
128128
sceneBuilder.addPicture(ui.Offset.zero, drawPicture((ui.Canvas canvas) {
129129
final ui.Paint paint = ui.Paint()..color = const ui.Color(0xFFFF0000);
130130
canvas.drawCircle(
131-
const ui.Offset(125, 150),
131+
const ui.Offset(-25, 0),
132132
50,
133133
paint
134134
);
135135
canvas.drawCircle(
136-
const ui.Offset(175, 150),
136+
const ui.Offset(25, 0),
137137
50,
138138
paint
139139
);

0 commit comments

Comments
 (0)