← Back to team overview

kicad-developers team mailing list archive

Re: [updated patch] GAL pixel alignment

 

Am 2019-02-15 13:48, schrieb Tomasz Wlostowski:
Hi all,

I made some fixes to the GAL pixel alignment code. Now it looks much
better on Retina displays (please set the DPI scaling to 100% in display
settings, otherwise the image will be blurry - OSX applies DPI scale to
GL canvases (!) and I don't know any workaround for this). It also fixes
some other issues:
- arc drawing (thanks Seth!)
- pixel alignment for circles
- missing last point of lines

Please test and report bugs here,

Bon Weekend,
Tom


Hi Tom-

This looks and works beautifully!  It even seems to run faster in Cairo.

The only bug I noticed was that supersampling isn't yet fully accounted for. I'm attaching an image of a diamond made with a filled polygon in pcbnew when running SuperSampling x2.

I attach a small patch to fix this issue.

Best-
Seth

diff --git a/common/gal/opengl/gl_builtin_shaders.cpp b/common/gal/opengl/gl_builtin_shaders.cpp
index 7911580255..d0a52b52a8 100644
--- a/common/gal/opengl/gl_builtin_shaders.cpp
+++ b/common/gal/opengl/gl_builtin_shaders.cpp
@@ -113,9 +113,9 @@ void computeLineCoords( bool posture, vec2 vs, vec2 vp, vec2 texcoord, vec2 dir, vec4 screenOffset = vec4( offsetNorm.x * screenPixelSize.x, -offsetNorm.y * screenPixelSize.y , 0, 0);
         vec4 adjust = vec4(-1, -1, 0, 0);

-        if( mod(pixelWidth, 2.0) > 0.9 )
+        if( mod( pixelWidth * pixelSizeMultiplier, 2.0 ) > 0.9 )
         {
- adjust += vec4( screenPixelSize.x, screenPixelSize.y, 0, 0) * 0.5; + adjust += vec4( screenPixelSize.x, screenPixelSize.y, 0, 0 ) * 0.5;
         }

gl_Position = roundv(screenPos, screenPixelSize) + adjust + screenOffset;

Attachment: Screenshot from 2019-02-15 12-10-31.png
Description: PNG image


References