mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
canvas: Use create_similar_draw_target
for recreate (#38336)
`create_similar_draw_target` is more performant then creating completely new target (this creates new wgpu device in vello backend). Testing: This change does not modify test results, but should increase performance. Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
f16e7d6daa
commit
82f5524901
1 changed files with 3 additions and 1 deletions
|
@ -632,7 +632,9 @@ impl<DrawTarget: GenericDrawTarget> CanvasData<DrawTarget> {
|
|||
.max(MIN_WR_IMAGE_SIZE);
|
||||
|
||||
// Step 1. Clear canvas's bitmap to transparent black.
|
||||
self.drawtarget = DrawTarget::new(Size2D::new(size.width, size.height).cast());
|
||||
self.drawtarget = self
|
||||
.drawtarget
|
||||
.create_similar_draw_target(&Size2D::new(size.width, size.height).cast());
|
||||
|
||||
self.update_image_rendering();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue