🐛 Don't copy margins past tile in draw_current_tile_into_backbuffer (#13066)

When dragging a shape each tile that needs repainted is repainted via
draw_current_tile_into_backbuffer in fast mode. So if you drag over a tile it
ends up dropping drop shadows etc.

IIUC, each tile is 512x512px but drawn on a 1024px surface with 256px margins
so that the background blur has something to read. In a regular render we
render the 1024px surface but only copy the center 512px of the tile into the
backbuffer. But in draw_current_tile_into_backbuffer we were copying the whole
1024px surface. This draws over the other tiles with a fast mode render, even
though those other tiles don't need repainted.

This fixes it by reusing draw_surface_src_rect_to_dst which clips the canvas
properly so we only draw the 512x512px of the tile.

AI-assisted-by: claude-fable-5-2
This commit is contained in:
Luke Lau 2026-11-16 21:47:27 +08:00 committed by GitHub
parent a224608a0e
commit 5d88cb3bb7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1516,27 +1516,30 @@ impl Surfaces {
// paint.set_color(color);
// backbuffer_canvas.draw_rect(tile_rect, &paint);
let dst = skia::Rect::from_xywh(
tile_rect.left,
tile_rect.top,
src_rect_f.width(),
src_rect_f.height(),
);
// Draw current surface directly to target (no snapshot)
self.current.draw(
draw_surface_src_rect_to_dst(
&mut self.current,
backbuffer_canvas,
(
tile_rect.left - src_rect_f.left,
tile_rect.top - src_rect_f.top,
),
src_rect_f,
dst,
sampling_options,
None,
);
// Also draw to cache for render_from_cache
if draw_on_cache == DrawOnCache::Yes {
self.current.draw(
draw_surface_src_rect_to_dst(
&mut self.current,
self.cache.canvas(),
(
tile_rect.left - src_rect_f.left,
tile_rect.top - src_rect_f.top,
),
src_rect_f,
dst,
sampling_options,
None,
);
}
}