diff --git a/imgui-gfx-renderer/src/lib.rs b/imgui-gfx-renderer/src/lib.rs index 70a2732..0d7e74e 100644 --- a/imgui-gfx-renderer/src/lib.rs +++ b/imgui-gfx-renderer/src/lib.rs @@ -218,8 +218,8 @@ impl Renderer { 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) diff --git a/imgui-glium-renderer/src/lib.rs b/imgui-glium-renderer/src/lib.rs index 7ef9a24..cd560c6 100644 --- a/imgui-glium-renderer/src/lib.rs +++ b/imgui-glium-renderer/src/lib.rs @@ -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()