<!-- Please read the "Making a PR" section of [`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md) before opening a Pull Request! * Keep your PR:s small and focused. * If applicable, add a screenshot or gif. * If it is a non-trivial addition, consider adding a demo for it to `egui_demo_lib`, or a new example. * Do NOT open PR:s from your `master` branch, as that makes it hard for maintainers to add commits to your PR. * Remember to run `cargo fmt` and `cargo cranky`. * Open the PR as a draft until you have self-reviewed it and run `./scripts/check.sh`. * When you have addressed a PR comment, mark it as resolved. Please be patient! I will review your PR, but my time is limited! --> Closes #3759
This commit is contained in:
parent
0e7bf6dfcf
commit
b087f58c5d
|
|
@ -450,39 +450,35 @@ impl Renderer {
|
|||
continue;
|
||||
};
|
||||
|
||||
if callback.rect.is_positive() {
|
||||
let info = PaintCallbackInfo {
|
||||
viewport: callback.rect,
|
||||
clip_rect: *clip_rect,
|
||||
pixels_per_point,
|
||||
screen_size_px: size_in_pixels,
|
||||
};
|
||||
|
||||
let viewport_px = info.viewport_in_pixels();
|
||||
if viewport_px.width_px > 0 && viewport_px.height_px > 0 {
|
||||
crate::profile_scope!("callback");
|
||||
|
||||
needs_reset = true;
|
||||
|
||||
let info = PaintCallbackInfo {
|
||||
viewport: callback.rect,
|
||||
clip_rect: *clip_rect,
|
||||
pixels_per_point,
|
||||
screen_size_px: size_in_pixels,
|
||||
};
|
||||
|
||||
{
|
||||
// We're setting a default viewport for the render pass as a
|
||||
// courtesy for the user, so that they don't have to think about
|
||||
// it in the simple case where they just want to fill the whole
|
||||
// paint area.
|
||||
//
|
||||
// The user still has the possibility of setting their own custom
|
||||
// viewport during the paint callback, effectively overriding this
|
||||
// one.
|
||||
|
||||
let viewport_px = info.viewport_in_pixels();
|
||||
|
||||
render_pass.set_viewport(
|
||||
viewport_px.left_px as f32,
|
||||
viewport_px.top_px as f32,
|
||||
viewport_px.width_px as f32,
|
||||
viewport_px.height_px as f32,
|
||||
0.0,
|
||||
1.0,
|
||||
);
|
||||
}
|
||||
// We're setting a default viewport for the render pass as a
|
||||
// courtesy for the user, so that they don't have to think about
|
||||
// it in the simple case where they just want to fill the whole
|
||||
// paint area.
|
||||
//
|
||||
// The user still has the possibility of setting their own custom
|
||||
// viewport during the paint callback, effectively overriding this
|
||||
// one.
|
||||
render_pass.set_viewport(
|
||||
viewport_px.left_px as f32,
|
||||
viewport_px.top_px as f32,
|
||||
viewport_px.width_px as f32,
|
||||
viewport_px.height_px as f32,
|
||||
0.0,
|
||||
1.0,
|
||||
);
|
||||
|
||||
cbfn.0.paint(info, render_pass, &self.callback_resources);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue