@@ -415,32 +415,34 @@ class ImageFilterEngineLayer extends ContainerLayer
415
415
} else {
416
416
convertible = _filter as CkManagedSkImageFilterConvertible ;
417
417
}
418
- final ui.Rect childPaintBounds =
418
+ ui.Rect childPaintBounds =
419
419
prerollChildren (prerollContext, childMatrix);
420
- if (_filter is ui.ColorFilter ) {
421
- // If the filter is a ColorFilter, the extended paint bounds will be the
422
- // entire screen, which is not what we want.
423
- paintBounds = childPaintBounds;
424
- } else {
425
- convertible.withSkImageFilter ((skFilter) {
426
- paintBounds = rectFromSkIRect (
427
- skFilter.getOutputBounds (toSkRect (childPaintBounds)),
428
- );
429
- });
430
- }
420
+ childPaintBounds = childPaintBounds.translate (_offset.dx, _offset.dy);
421
+ if (_filter is ui.ColorFilter ) {
422
+ // If the filter is a ColorFilter, the extended paint bounds will be the
423
+ // entire screen, which is not what we want.
424
+ paintBounds = childPaintBounds;
425
+ } else {
426
+ convertible.withSkImageFilter ((skFilter) {
427
+ paintBounds = rectFromSkIRect (
428
+ skFilter.getOutputBounds (toSkRect (childPaintBounds)),
429
+ );
430
+ });
431
+ }
431
432
prerollContext.mutatorsStack.pop ();
432
433
}
433
434
434
435
@override
435
436
void paint (PaintContext paintContext) {
436
437
assert (needsPainting);
438
+ final ui.Rect offsetPaintBounds = paintBounds.shift (- _offset);
437
439
paintContext.internalNodesCanvas.save ();
438
440
paintContext.internalNodesCanvas.translate (_offset.dx, _offset.dy);
439
441
paintContext.internalNodesCanvas
440
- .clipRect (paintBounds , ui.ClipOp .intersect, false );
442
+ .clipRect (offsetPaintBounds , ui.ClipOp .intersect, false );
441
443
final CkPaint paint = CkPaint ();
442
444
paint.imageFilter = _filter;
443
- paintContext.internalNodesCanvas.saveLayer (paintBounds , paint);
445
+ paintContext.internalNodesCanvas.saveLayer (offsetPaintBounds , paint);
444
446
paintChildren (paintContext);
445
447
paintContext.internalNodesCanvas.restore ();
446
448
paintContext.internalNodesCanvas.restore ();
0 commit comments