From 9be92c181c2023cdd566af231bef44fbb087e019 Mon Sep 17 00:00:00 2001 From: Jonathan Johnson Date: Sun, 19 Nov 2023 14:39:48 -0800 Subject: [PATCH] Forcing outlines to be whole pixels --- src/context.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/context.rs b/src/context.rs index 61b9623..140fb62 100644 --- a/src/context.rs +++ b/src/context.rs @@ -10,7 +10,7 @@ use kludgine::app::winit::event::{ DeviceId, Ime, KeyEvent, MouseButton, MouseScrollDelta, TouchPhase, }; use kludgine::figures::units::{Lp, Px, UPx}; -use kludgine::figures::{IntoSigned, Point, Px2D, Rect, ScreenScale, Size, Zero}; +use kludgine::figures::{IntoSigned, Point, Px2D, Rect, Round, ScreenScale, Size, Zero}; use kludgine::shapes::{Shape, StrokeOptions}; use kludgine::{Color, Kludgine}; @@ -545,7 +545,8 @@ impl<'context, 'window, 'clip, 'gfx, 'pass> GraphicsContext<'context, 'window, ' Unit: ScreenScale + Zero, { if color.alpha() > 0 { - let options = options.colored(color).into_px(self.gfx.scale()); + let mut options = options.colored(color).into_px(self.gfx.scale()); + options.line_width = options.line_width.round(); let inset = options.line_width / 2; let visible_rect = Rect::new( Point::squared(inset),