From cfd57361c4f5db2ad1ca7677591f81b4e88a436d Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Mon, 24 Aug 2020 16:09:43 +0200 Subject: [PATCH] Fix linewidth transformations The transformation determinant is signed, but we're only interested in the absolute scale for transforming linewidths. Signed-off-by: Elias Naur --- piet-gpu/shader/elements.comp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/piet-gpu/shader/elements.comp b/piet-gpu/shader/elements.comp index 1886907..3d21020 100644 --- a/piet-gpu/shader/elements.comp +++ b/piet-gpu/shader/elements.comp @@ -373,7 +373,7 @@ void main() { anno_stroke.rgba_color = stroke.rgba_color; vec2 lw = get_linewidth(st); anno_stroke.bbox = st.bbox + vec4(-lw, lw); - anno_stroke.linewidth = st.linewidth * sqrt(st.mat.x * st.mat.w - st.mat.y * st.mat.z); + anno_stroke.linewidth = st.linewidth * sqrt(abs(st.mat.x * st.mat.w - st.mat.y * st.mat.z)); AnnotatedRef out_ref = AnnotatedRef((st.path_count - 1) * Annotated_size); Annotated_Stroke_write(out_ref, anno_stroke); break;