mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-18 08:58:36 +00:00
Fix clip rect clamping
This commit is contained in:
parent
21d85afee0
commit
6a4286de11
@ -218,8 +218,8 @@ impl<R: Resources> Renderer<R> {
|
||||
|
||||
self.bundle.slice.end = self.bundle.slice.start + cmd.elem_count;
|
||||
self.bundle.data.scissor = Rect {
|
||||
x: cmd.clip_rect.x.max(0.0).round() as u16,
|
||||
y: cmd.clip_rect.y.max(0.0).round() as u16,
|
||||
x: cmd.clip_rect.x.max(0.0).min(fb_width).round() as u16,
|
||||
y: cmd.clip_rect.y.max(0.0).min(fb_height).round() as u16,
|
||||
w: (cmd.clip_rect.z - cmd.clip_rect.x)
|
||||
.abs()
|
||||
.min(fb_width)
|
||||
|
||||
@ -152,15 +152,15 @@ impl Renderer {
|
||||
&DrawParameters {
|
||||
blend: Blend::alpha_blending(),
|
||||
scissor: Some(Rect {
|
||||
left: cmd.clip_rect.x.max(0.0).round() as u32,
|
||||
bottom: (fb_height - cmd.clip_rect.w).max(0.0).round() as u32,
|
||||
left: cmd.clip_rect.x.max(0.0).min(fb_width).round() as u32,
|
||||
bottom: (fb_height - cmd.clip_rect.w).max(0.0).min(fb_width).round() as u32,
|
||||
width: (cmd.clip_rect.z - cmd.clip_rect.x)
|
||||
.abs()
|
||||
.max(fb_width)
|
||||
.min(fb_width)
|
||||
.round() as u32,
|
||||
height: (cmd.clip_rect.w - cmd.clip_rect.y)
|
||||
.abs()
|
||||
.max(fb_height)
|
||||
.min(fb_height)
|
||||
.round() as u32,
|
||||
}),
|
||||
..DrawParameters::default()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user