mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
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:
parent
9d29017c0d
commit
fc0038743d
3 changed files with 10 additions and 8 deletions
|
@ -401,7 +401,7 @@ impl GenericDrawTarget for raqote::DrawTarget {
|
|||
fn push_clip_rect(&mut self, rect: &Rect<i32>) {
|
||||
self.push_clip_rect(rect.to_box2d());
|
||||
}
|
||||
fn surface(&self) -> Self::SourceSurface {
|
||||
fn surface(&mut self) -> Self::SourceSurface {
|
||||
self.get_data_u8().to_vec()
|
||||
}
|
||||
fn stroke(
|
||||
|
@ -450,7 +450,7 @@ impl GenericDrawTarget for raqote::DrawTarget {
|
|||
}
|
||||
|
||||
fn image_descriptor_and_serializable_data(
|
||||
&self,
|
||||
&mut self,
|
||||
) -> (
|
||||
webrender_api::ImageDescriptor,
|
||||
compositing_traits::SerializableImageData,
|
||||
|
@ -466,7 +466,7 @@ impl GenericDrawTarget for raqote::DrawTarget {
|
|||
(descriptor, data)
|
||||
}
|
||||
|
||||
fn snapshot(&self) -> Snapshot {
|
||||
fn snapshot(&mut self) -> Snapshot {
|
||||
Snapshot::from_vec(
|
||||
self.get_size().cast(),
|
||||
SnapshotPixelFormat::BGRA,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue