mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
canvas: Use Cow<[u8]>
for bytes() getter (#37249)
I fell into trap of over-generalization in https://github.com/servo/servo/pull/36793, but https://github.com/servo/servo/pull/36821 showed `Cow<[u8]>` is all we need (to reuse existing vec alloc or pass on a slice). Testing: There are WPT tests, but it's just refactor so rust keeps us safe. Split of https://github.com/servo/servo/pull/36821 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
9083d58061
commit
c01f65affb
3 changed files with 9 additions and 6 deletions
|
@ -1327,7 +1327,7 @@ impl<'a, B: Backend> CanvasData<'a, B> {
|
|||
.to_vec()
|
||||
}
|
||||
} else {
|
||||
self.drawtarget.bytes().as_ref().to_vec()
|
||||
self.drawtarget.bytes().into_owned()
|
||||
};
|
||||
|
||||
Snapshot::from_vec(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue