diff --git a/crates/yakui-core/src/paint/paint_dom.rs b/crates/yakui-core/src/paint/paint_dom.rs index 1338657a..5a82b913 100644 --- a/crates/yakui-core/src/paint/paint_dom.rs +++ b/crates/yakui-core/src/paint/paint_dom.rs @@ -7,10 +7,11 @@ use crate::dom::Dom; use crate::geometry::Rect; use crate::id::{ManagedTextureId, WidgetId}; use crate::layout::LayoutDom; +use crate::paint::{PaintCall, Pipeline}; use crate::widget::PaintContext; use super::layers::PaintLayers; -use super::primitives::{PaintCall, PaintMesh, Vertex}; +use super::primitives::{PaintMesh, Vertex}; use super::texture::{Texture, TextureChange}; /// Contains all information about how to paint the current set of widgets. @@ -202,7 +203,18 @@ impl PaintDom { let vertices = mesh.vertices.into_iter().map(|mut vertex| { let mut pos = vertex.position * self.scale_factor; pos += self.unscaled_viewport.pos(); + + // Currently, we only round the vertices of geometry fed to the text + // pipeline because rounding all geometry causes hairline cracks in + // some geometry, like rounded rectangles. + // + // See: https://github.com/SecondHalfGames/yakui/issues/153 + if mesh.pipeline == Pipeline::Text { + pos = pos.round(); + } + pos /= self.surface_size; + vertex.position = pos; vertex });