Re: [Kicad-developers] [updated patch] GAL pixel alignment

2019-02-20 Thread Vesa Solonen
Tomasz Wlostowski kirjoitti 19.2.2019 klo 2.23:

>> Version: 5.1.0-rc1-unknown-f1a6083~86~ubuntu18.04.1, release build
>>
> 
> Fixed.
> 
> Tom
> 

Thanks!

Version: 5.1.0-rc1-unknown-f40dfa2~86~ubuntu18.04.1, release build

The Cairo is perfect without anti-aliasing and just somewhat heavy on
arc strokes compared to grid fit ones. The OpenGL still has issues with
piecewise linear arc points and MSAA. Is this hw and driver specific?

-Vesa
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [updated patch] GAL pixel alignment

2019-02-18 Thread Tomasz Wlostowski
On 17/02/2019 22:24, Vesa Solonen wrote:
> Please find attached, both with max anti-alias settings. The one is from
> stock library and is a magic eye tube... The Philips pocketbook [1] for
> evening read ;^)
> 
> Version: 5.1.0-rc1-unknown-f1a6083~86~ubuntu18.04.1, release build
> 

Fixed.

Tom

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [updated patch] GAL pixel alignment

2019-02-17 Thread Vesa Solonen
Please find attached, both with max anti-alias settings. The one is from
stock library and is a magic eye tube... The Philips pocketbook [1] for
evening read ;^)

Version: 5.1.0-rc1-unknown-f1a6083~86~ubuntu18.04.1, release build

-Vesa


[1] https://frank.pocnet.net/other/Philips/Philips_Pocketbook_1969.pdf

Tomasz Wlostowski kirjoitti 17.2.2019 klo 23.10:
> Screenshot would be helpful. I don't have any low power pentodes in my 
> library :)
> 
> 17.02.2019 22:04 Vesa Solonen  napisał(a):
> Tomasz Wlostowski kirjoitti 15.2.2019 klo 20.48:
> 
>> Please test and report bugs here,
> 
> Polylines and arcs seem problematic. Testing with EM84 symbol is very
> revealing.
> 
> -Vesa
> 
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [updated patch] GAL pixel alignment

2019-02-17 Thread Tomasz Wlostowski
Screenshot would be helpful. I don't have any low power pentodes in my library 
:)

17.02.2019 22:04 Vesa Solonen  napisał(a):
Tomasz Wlostowski kirjoitti 15.2.2019 klo 20.48:

> Please test and report bugs here,

Polylines and arcs seem problematic. Testing with EM84 symbol is very
revealing.

-Vesa

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [updated patch] GAL pixel alignment

2019-02-17 Thread Vesa Solonen
Tomasz Wlostowski kirjoitti 15.2.2019 klo 20.48:

> Please test and report bugs here,

Polylines and arcs seem problematic. Testing with EM84 symbol is very
revealing.

-Vesa

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [updated patch] GAL pixel alignment

2019-02-16 Thread Wayne Stambaugh

On 2/16/19 2:27 PM, Tomasz Wlostowski wrote:

On 16/02/2019 14:21, Wayne Stambaugh wrote:

I tested this on windows and linux and it looks really good.  I think we
have tested it on all platforms.  What is left to get it ready to merge?



Hi Wayne,

I cleaned up & formatted the code, rebased on the last master and pushed
it. Hope people with enjoy the new sharper world of Kicad :-)

Tom



Great work Tom!

Thanks,

Wayne

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [updated patch] GAL pixel alignment

2019-02-16 Thread Tomasz Wlostowski
On 16/02/2019 14:21, Wayne Stambaugh wrote:
> I tested this on windows and linux and it looks really good.  I think we
> have tested it on all platforms.  What is left to get it ready to merge?


Hi Wayne,

I cleaned up & formatted the code, rebased on the last master and pushed
it. Hope people with enjoy the new sharper world of Kicad :-)

Tom

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [updated patch] GAL pixel alignment

2019-02-16 Thread Steven A. Falco
Will the libraries, translations, and documentation be tagged for the rc1, rc2, 
etc?

I'd like to use tagged material for the package builds, rather than just 
picking a random SHA.  Currently, only the source is tagged with rc1.

Steve

On 2/16/19 8:21 AM, Wayne Stambaugh wrote:
> Tom,
> 
> I tested this on windows and linux and it looks really good.  I think we
> have tested it on all platforms.  What is left to get it ready to merge?
>  I would like to spin an rc2 to get some wider testing.  If no serious
> bug show up in the next week or so, I would like to release 5.1 by the
> end of February.
> 
> Cheers,
> 
> Wayne
> 
> On 2/15/19 1:48 PM, Tomasz Wlostowski wrote:
>> 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
>>
>>
>> ___
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to : kicad-developers@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
>>
> 
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 


___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [updated patch] GAL pixel alignment

2019-02-16 Thread Wayne Stambaugh
Tom,

I tested this on windows and linux and it looks really good.  I think we
have tested it on all platforms.  What is left to get it ready to merge?
 I would like to spin an rc2 to get some wider testing.  If no serious
bug show up in the next week or so, I would like to release 5.1 by the
end of February.

Cheers,

Wayne

On 2/15/19 1:48 PM, Tomasz Wlostowski wrote:
> 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
> 
> 
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [updated patch] GAL pixel alignment

2019-02-15 Thread Jeff Young
Whoo hooo!  Looks awesome.  Gets rid of the over-bolding at lower zooms too.

(OK, subpixel still looks weird, but that’s just the nature of the beast.  
Supersampling looks fantastic.)

Cheers,
Jeff.


> On 15 Feb 2019, at 18:48, Tomasz Wlostowski  wrote:
> 
> 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
> <0001-gal-pixel-alignment-hacks-works-for-Retina-display-t.patch>___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp


___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [updated patch] GAL pixel alignment

2019-02-15 Thread Seth Hillbrand

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;


___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [updated patch] GAL pixel alignment

2019-02-15 Thread 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
>From e0789912f9b3d41647eb0ce5fc01be9f2318459c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomasz=20W=C5=82ostowski?= 
Date: Mon, 21 Jan 2019 19:42:06 +0100
Subject: [PATCH] gal: pixel alignment hacks, works for Retina display too now.

gal: pixel alignment for Cairo.

gal: pixel alignment for OpenGL

Cleanup of pixel alignment patches

gal/opengl: more pixel alignment patches:
- works on Retina displays now
- pixel alignment for circles
- correct 1-pixel strokes
- fixed unfinished 1-pixel line ends

gal: minor cleanup

GAL: Restore antialiasing options in Cairo

GAL: Fix arc drawing

Removes DrawArcSegment, which drew arcs whose edge was optionally
stroked (a feature that we did not use).  Fixes Cairo arc drawing issue
where arcs were not visible in pcbnew.

gal: further cleanup

gal: removed unused shader parameter
---
 common/gal/cairo/cairo_compositor.cpp |   6 +-
 common/gal/cairo/cairo_gal.cpp| 524 ++
 common/gal/graphics_abstraction_layer.cpp | 185 ---
 common/gal/hidpi_gl_canvas.cpp|   2 +-
 common/gal/opengl/gl_builtin_shaders.cpp  | 156 --
 common/gal/opengl/opengl_compositor.cpp   |  13 +
 common/gal/opengl/opengl_gal.cpp  | 188 ++-
 common/gal/opengl/shader.cpp  |   6 +
 eeschema/sch_draw_panel.h |   2 +-
 gerbview/gerbview_painter.cpp |   2 +-
 include/gal/cairo/cairo_gal.h |  27 +-
 include/gal/graphics_abstraction_layer.h  |  20 +-
 include/gal/hidpi_gl_canvas.h |   5 +-
 include/gal/opengl/opengl_compositor.h|   2 +
 include/gal/opengl/opengl_gal.h   |  12 +-
 include/gal/opengl/shader.h   |   3 +
 pcbnew/pcb_painter.cpp|   9 +-
 qa/CMakeLists.txt |   1 +
 qa/gal/gal_pixel_alignment/CMakeLists.txt | 100 
 .../test_gal_pixel_alignment.cpp  | 231 
 qa/qa_utils/mocks.cpp |  23 +
 qa/qa_utils/pcb_test_frame.cpp|  10 +-
 qa/qa_utils/pcb_test_frame.h  |   7 +-
 23 files changed, 1003 insertions(+), 531 deletions(-)
 create mode 100644 qa/gal/gal_pixel_alignment/CMakeLists.txt
 create mode 100644 qa/gal/gal_pixel_alignment/test_gal_pixel_alignment.cpp

diff --git a/common/gal/cairo/cairo_compositor.cpp b/common/gal/cairo/cairo_compositor.cpp
index 21714214d..b48655397 100644
--- a/common/gal/cairo/cairo_compositor.cpp
+++ b/common/gal/cairo/cairo_compositor.cpp
@@ -35,7 +35,7 @@ using namespace KIGFX;
 
 CAIRO_COMPOSITOR::CAIRO_COMPOSITOR( cairo_t** aMainContext ) :
 m_current( 0 ), m_currentContext( aMainContext ), m_mainContext( *aMainContext ),
-m_currentAntialiasingMode( CAIRO_ANTIALIAS_NONE )
+m_currentAntialiasingMode( CAIRO_ANTIALIAS_DEFAULT )
 {
 // Do not have uninitialized members:
 cairo_matrix_init_identity( _matrix );
@@ -109,9 +109,7 @@ unsigned int CAIRO_COMPOSITOR::CreateBuffer()
 #endif /* __WXDEBUG__ */
 
 // Set default settings for the buffer
-cairo_set_antialias( context, m_currentAntialiasingMode );
-cairo_set_line_join( context, CAIRO_LINE_JOIN_ROUND );
-cairo_set_line_cap( context, CAIRO_LINE_CAP_ROUND );
+cairo_set_antialias( context,  m_currentAntialiasingMode );
 
 // Use the same transformation matrix as the main context
 cairo_get_matrix( m_mainContext, _matrix );
diff --git a/common/gal/cairo/cairo_gal.cpp b/common/gal/cairo/cairo_gal.cpp
index 1f5871c6e..0a29f9fd0 100644
--- a/common/gal/cairo/cairo_gal.cpp
+++ b/common/gal/cairo/cairo_gal.cpp
@@ -88,26 +88,95 @@ void CAIRO_GAL_BASE::endDrawing()
 Flush();
 }
 
+void CAIRO_GAL_BASE::updateWorldScreenMatrix()
+{
+cairo_matrix_multiply( , ,  );
+}
+
+const VECTOR2D CAIRO_GAL_BASE::xform( double x, double y )
+{
+VECTOR2D rv;
+
+rv.x = currentWorld2Screen.xx * x + currentWorld2Screen.xy * y + currentWorld2Screen.x0;
+rv.y = currentWorld2Screen.yx * x + currentWorld2Screen.yy * y + currentWorld2Screen.y0;
+return rv;
+}
+
+const VECTOR2D CAIRO_GAL_BASE::xform( const VECTOR2D& aP )
+{
+return xform(aP.x, aP.y);
+}
+
+const double CAIRO_GAL_BASE::xform( double x )
+{
+double dx = currentWorld2Screen.xx * x;
+double dy = currentWorld2Screen.yx * x;
+return sqrt( dx * dx + dy * dy );
+}
+
+static double roundp( double x )
+{
+return floor( x + 0.5 ) + 0.5;
+}
+
+const VECTOR2D CAIRO_GAL_BASE::roundp( const VECTOR2D& v )
+{
+if (