Prevent going out of bounds with ContentFit::None
This commit is contained in:
parent
5aca246828
commit
13d8cbd0ab
1 changed files with 18 additions and 10 deletions
|
@ -192,6 +192,7 @@ where
|
|||
inner.set_av_offset(Instant::now() - last_frame_time);
|
||||
}
|
||||
|
||||
let render = |renderer: &mut Renderer| {
|
||||
renderer.draw_primitive(
|
||||
drawing_bounds,
|
||||
VideoPrimitive::new(
|
||||
|
@ -202,6 +203,13 @@ where
|
|||
upload_frame,
|
||||
),
|
||||
);
|
||||
};
|
||||
|
||||
if adjusted_fit.width > bounds.width || adjusted_fit.height > bounds.height {
|
||||
renderer.with_layer(bounds, render);
|
||||
} else {
|
||||
render(renderer);
|
||||
}
|
||||
}
|
||||
|
||||
fn on_event(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue