← Back to team overview

kicad-developers team mailing list archive

Re: [patch] GAL pixel alignment

 

Am 2019-02-11 15:37, schrieb Jeff Young:
Will do.

BTW, I just finished building your previous patch.  Sadly it does not
solve the “holes in graphics” anomalies.

Cheers,
Jeff.

Hi Jeff-

I can't see the holes in graphics issue, but can you check the attached patch if you have time?

BTW, if it's just a easy for you, attaching PNGs for the example images will really help. The TIFF files are not handled by Chrome so I need to save them for Preview.

-Seth
From 5dfcde13128c55a05111442a4fcd5ce3b955f8ae Mon Sep 17 00:00:00 2001
From: Seth Hillbrand <hillbrand@xxxxxxxxxxx>
Date: Mon, 11 Feb 2019 12:55:12 -0800
Subject: [PATCH] GAL: expand half-pixels in super-sampling

---
 common/gal/opengl/gl_builtin_shaders.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/common/gal/opengl/gl_builtin_shaders.cpp b/common/gal/opengl/gl_builtin_shaders.cpp
index 39ae3b2941..9355936be1 100644
--- a/common/gal/opengl/gl_builtin_shaders.cpp
+++ b/common/gal/opengl/gl_builtin_shaders.cpp
@@ -109,14 +109,14 @@ void computeLineCoords( bool posture, vec2 vs, vec2 vp, vec2 texcoord, vec2 dir,
     {
         vec2 offsetNorm = (vs + vp) * pixelWidth / lineLength * 0.5;
         vec4 screenOffset = vec4( offsetNorm.x  * screenPixelSize.x, -offsetNorm.y  * screenPixelSize.y , 0, 0);
-        vec4 adjust = vec4(-1, -1, 0, 0);
+        vec4 adjust = vec4( -1, -1, 0, 0 );
 
-        if( mod(pixelWidth, 2.0) > 0.9 )
+        if( mod( pixelWidth, 2.0 ) >= 0.5 )
         {
-            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;
+        gl_Position = roundv( screenPos, screenPixelSize ) + adjust + screenOffset;
 
         shaderParams[0] = SHADER_LINE_A;
     }
-- 
2.20.1


Follow ups

References