Skip to content

anyrender_skia: size render_to_vec buffers before wrapping pixels#49

Open
jrmoulton wants to merge 1 commit intoDioxusLabs:mainfrom
jrmoulton:push-ylqpwmlwkvpu
Open

anyrender_skia: size render_to_vec buffers before wrapping pixels#49
jrmoulton wants to merge 1 commit intoDioxusLabs:mainfrom
jrmoulton:push-ylqpwmlwkvpu

Conversation

@jrmoulton
Copy link
Contributor

SkiaImageRenderer::render_to_vec currently assumes the caller has already resized the Vec to the exact pixel buffer size. When callers pass an empty Vec with only capacity reserved, wrap_pixels receives an empty slice and the renderer panics.

Resize the Vec to image_info.compute_min_byte_size() before wrapping it so offscreen rendering works with a plain empty Vec. This keeps the unwrap that follows safe

SkiaImageRenderer::render_to_vec currently assumes the caller has already
resized the Vec to the exact pixel buffer size. When callers pass an empty
Vec with only capacity reserved, wrap_pixels receives an empty slice and the
renderer panics.

Resize the Vec to image_info.compute_min_byte_size() before wrapping it so
offscreen rendering works with a plain empty Vec.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant