canvas: Make pixel obtaining methods take &mut GenericDrawTarget (#38264)

This will be needed for vello_cpu. While we could wrap it in RefCell for
inner mut, but that would be less ergonomic and performant.

Testing: Just refactoring, but the code is covered by WPT tests.

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
sagudev 2025-07-25 15:22:41 +02:00 committed by GitHub
parent 9d29017c0d
commit fc0038743d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 8 deletions

View file

@ -86,7 +86,9 @@ pub(crate) trait GenericDrawTarget {
composition_options: CompositionOptions,
transform: Transform2D<f32>,
);
fn surface(&self) -> Self::SourceSurface;
fn image_descriptor_and_serializable_data(&self) -> (ImageDescriptor, SerializableImageData);
fn snapshot(&self) -> Snapshot;
fn surface(&mut self) -> Self::SourceSurface;
fn image_descriptor_and_serializable_data(
&mut self,
) -> (ImageDescriptor, SerializableImageData);
fn snapshot(&mut self) -> Snapshot;
}