Forcing outlines to be whole pixels

This commit is contained in:
Jonathan Johnson 2023-11-19 14:39:48 -08:00
parent 9403e85901
commit 9be92c181c
No known key found for this signature in database
GPG key ID: A66D6A34D6620579

View file

@ -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<Px = Px, Lp = Lp, UPx = UPx> + 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),