Commit Graph

93 Commits

Author SHA1 Message Date
Tomasz Włostowski f66baaed8c gal: cairo: pixel-align arc endpoints, not center to avoid misalignment with adjacent line segments 2019-02-19 01:21:20 +01:00
Seth Hillbrand 4597979d18 cairo: Draw ovals with filled half-arcs
The circle at the end only ever looked right with 100% opacity.

Also fixes double-drawn arc fills in Cairo
2019-02-18 16:09:44 -08:00
Seth Hillbrand 5af8d2d0a8 cairo: Fix rotated oval pads
Fixes: lp:1816428
* https://bugs.launchpad.net/kicad/+bug/1816428
2019-02-18 09:44:28 -08:00
Seth Hillbrand 9d4a19797c cairo: Don't round locations of outlines
Pixel alignment is not required for track outline mode.  It creates
differences between segment and radius calculations.

Also add specific width of the outlines
2019-02-16 17:45:05 -08:00
Tomasz Włostowski 85a7ab7795 gal: minor cleanup & formatting 2019-02-16 20:25:10 +01:00
Tomasz Włostowski bbee30671a 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: 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
2019-02-16 20:03:13 +01:00
Seth Hillbrand 5da4e18664 bitmaps: Handle mask colors
Some transparent bitmaps use masking colors to show the binary
opaque/transparent.

Fixes: lp:1814893
* https://bugs.launchpad.net/kicad/+bug/1814893
2019-02-07 21:27:43 -08:00
Seth Hillbrand b63cdcf225 Type cleanup 2019-01-25 13:03:36 -08:00
Seth Hillbrand 3a3bbbb545 GAL: Add transparency for bitmaps and Cairo draw
Bitmaps loaded via wx can contain alpha channels.  We utilize underlying
routines to correctly map the alpha.  This also standardizes the Cairo
alpha calls to ensure correct display in Fallback for partially
transparent highlights

    Fixes: lp:1809845
    * https://bugs.launchpad.net/kicad/+bug/1809845
2019-01-04 13:40:19 -08:00
Seth Hillbrand e8333633fe GAL: Add antialiasing options to Cairo
Cairo supports antialiasing when rendering but can be slow when set to
sub-pixel mode.  This bumps the minimum version of Cairo to 1.12
(available in 14.04 LTS as well as mingw) to support three antialias
settings (fast, good, best) that offer speed/appearance tradeoffs.

This can provide a higher-quality eeschema render as it works on a
per-element basis as opposed to the OpenGL per-screen antialias.
2019-01-04 13:39:56 -08:00
jean-pierre charras 83d851956c classes MARKER rework: remove duplicate code. Better HitTest code (HitTest takes in account the actual shape) 2018-12-19 19:53:27 +01:00
Maciej Suminski 64da77538f Fix bitmap scale in printouts
Display GALs had an incorrect world unit value set. Now the world unit
value says how many internal units are in an inch, in accord with the comments
in the GAL header. Bitmap drawing code relied on the information about DPI,
so scaling worked differently for display and print GALs.
2018-10-31 19:17:30 +01:00
Maciej Suminski 47d0eaa2c6 GAL: changed line width setting to float type 2018-10-31 19:17:30 +01:00
Maciej Suminski e36f6b476d Changed the CAIRO_GAL class hierarchy
There is a dedicated class for display (CAIRO_GAL) and another one
for printing. The common part has been moved to CAIRO_GAL_BASE.
2018-10-31 19:17:30 +01:00
Jeff Young 16925cc74e Implement RAII locking for GAL updating.
Fixes a crash when typing fast in the place footprint filter box.

Also adds a bunch more checking to GAL locking, including making
sure the same person unlocks as locked, and preventing piece-meal
calls (the RAII objects must be used).
2018-10-26 23:02:05 +01:00
jean-pierre charras a6d014d959 Fix some artifacts when drawing items, both on Cairo and Opengl.
Fix also incorrect selection of De Morgan style selection in SYMBOL_PREVIEW_WIDGET.
2018-10-09 11:08:56 +01:00
jean-pierre charras f283667fb0 add option to switch between opengl and cairo in eeschema (step 1) 2018-10-09 11:08:56 +01:00
Tomasz Wlostowski f82f310dd5 eeschema-gal: added EnableDepthTest() feature in GAL 2018-10-09 11:08:52 +01:00
jean-pierre charras fefc7b8172 GAL canvases: add DrawBitmap(), using a basic brute force algo for OpenGL, and a optimized code for Cairo. In this fix the brute force means draw each pixel as a rectangle. It works fine, but could be optimized. 2018-07-30 00:13:30 +02:00
Jon Evans 0b9b8d3e93 Add support for reversed draw order and Cairo negative draw mode 2017-09-25 13:35:01 +02:00
Jon Evans 93de82f0b2 Fix scrollbars in macOS GAL canvases 2017-09-15 11:29:49 +02:00
Tomasz Włostowski 32185ddcd3 Multiple improvements concerning colors, configuration handling and legacy features in pcbnew:
- support for background color setting
    - removed several global config settings (such as g_Drc_On)
    - wrapped most of global config settings in PCB_GENERAL_SETTINGS class
    - reorganized PCB general options dialog to clearly mark which options concern only the legacy canvas
    - new GAL feature for legacy users: double-click (or E) to change track width available as an option.

Fixes: lp:1530543
* https://bugs.launchpad.net/kicad/+bug/1530543

Fixes: lp:1707145
* https://bugs.launchpad.net/kicad/+bug/1707145
2017-08-04 16:06:57 +02:00
jean-pierre charras e97c91b025 Fixes: lp:1683128 (pcbnew: the cairo canvas ignore arc width)
https://bugs.launchpad.net/kicad/+bug/1683128
2017-04-16 19:21:31 +02:00
John Beard ef9f8d40c6 Init GAL class members (Coverity fixes)
Fixes: CID 157139 (GAL)
       CID 157138 (CAIRO_GAL)
2017-03-30 16:05:56 +02:00
Maciej Suminski ddf4f3b2bc Remove not used cursor fields & methods in Cairo GAL 2017-03-22 10:37:43 +01:00
John Beard b8edecc10f Move cursor shape flag into GAL settings
The motivation here is to concentrate display options in the GAL display
settings, ready for removal of legacy canvases. Instead of having the
property as a member of the DRAW_FRAME, with the GAL canvas retreiving
it from there, it is now in the GAL_DISPLAY_OPTIONS struct, and both GAL
and legacy get it from there.

The options for setting cursor shape are then moved out of the general
options dialog, and into the GAL display options widget, where they can
be used in all GAL-aware programs.

GAL cursor shape works on GAL, but not legacy, so the option is now
available on OSX (but only affects GAL, and is labelled as such).
2017-03-22 10:24:48 +01:00
John Beard 01c733bdb5 Dim GAL cursor when forced but no interactive tool
This makes it clearer when a tool is active, otherwise interactive tool
effects like auto-pan can come as a surprise when the cursor is forced
to display all the time.
2017-03-22 10:24:48 +01:00
Jon Evans 3208d24ad4 Add DrawArcSegment() GAL method, to support drawing outlined arcs 2017-03-10 14:08:59 +01:00
Jon Evans 2513f0b002 Add setting to have GAL draw axes on the grid 2017-03-08 09:37:40 +01:00
John Beard c86773462f GAL: Respect SHAPE_LINE_CHAIN closed setting
When drawing polylines using SHAPE_LINE_CHAIN, the polyline is always
was drawn closed in GAL and open in Cairo, regardless of the state of
SHAPE_LINE_CHAIN.
2017-03-07 13:28:14 +01:00
John Beard ddded86a06 Give all GAL canvases access to a GAL_DISPLAY_OPTIONS structure instance
Also loads the gal options when loading a canvas, as the canvas
otherwise might not register the initial settings.
2017-02-20 10:52:34 +01:00
Maciej Suminski 80956ef1e6 Added GAL::DrawPolygon(SHAPE_POLY_SET) & GAL::DrawPolyLine(SHAPE_LINE_CHAIN) 2017-01-27 19:08:32 +01:00
Maciej Suminski a2a950fdae Reduced the Cairo command entry size 2016-12-12 16:45:52 +01:00
Maciej Suminski 660e4ca9d4 Cairo group arguments are stored in a union. 2016-12-12 16:45:52 +01:00
Maciej Suminski 89055c4425 Code formatting 2016-12-12 16:45:52 +01:00
Tomasz Włostowski da28e163d2 Optimizations/fixes to the VIEW/GAL classes:
- much faster Cairo rendering (outperforms legacy)
- improvements in VIEW update handling
- fixed issue with grid rendering in flip view mode
2016-12-12 16:45:52 +01:00
Maciej Suminski d9f4877c94 Fixed a crash when starting pcbnew with OpenGL GAL. 2016-05-09 17:23:01 +02:00
Maciej Suminski 4951285a67 GAL::DrawPolygon() and GAL::DrawPolyline() variants that work with VECTOR2D array. 2016-01-20 15:16:39 +01:00
Maciej Suminski 51c0ae3480 Fixed cursor offset in GAL. 2015-07-01 03:46:42 +02:00
Maciej Suminski 785638a396 more fix for Cairo setting screen size. 2015-06-30 15:06:30 +02:00
Maciej Suminski d3c7b45438 Corrected GAL canvases screen size, so they do not include scroll bars. 2015-06-30 14:08:35 +02:00
Mark Roszko 3918d3f0b2 Eeschema code cleanup and coverity fixes. 2015-02-21 09:11:58 +01:00
Maciej Suminski 490a73b62a Fixed filled arcs drawing (GAL). 2014-08-06 13:51:46 +02:00
Maciej Suminski 65c116621d Added support for changing the cursor size. 2014-07-09 15:10:32 +02:00
Bernhard Stegmaier 60a86853ec Removed a few warnings. 2014-06-05 12:40:26 +02:00
Maciej Suminski d27ea7895d Moved background color settings from GAL to RENDER_SETTINGS. Added RENDER_SETTINGS::TranslateColor() to convert between EDA_COLOR_T and COLOR4D. 2014-05-14 10:35:12 +02:00
Maciej Suminski dbc4a8f292 GAL zooms in and out using the default hot keys (F1/F2).
Screen size is saved in VECTOR2I instead of VECTOR2D.
2014-03-20 08:47:31 +01:00
Maciej Suminski e1ce30d89d Fixed mouse wheel handling for GAL canvases with wx3.0. 2014-03-19 11:57:59 +01:00
Maciej Suminski c5a3c1082a Removed a few RecacheAllItems() calls, some of them changed to specific type recaching (using TYPE_COLLECTOR & VIEW_ITEM::ViewUpdate() ).
Removed OPENGL_GAL::SetStrokeColor().
2014-02-25 14:28:09 +01:00
Maciej Suminski 597e98dbf4 Cursor is in world coordinates. 2014-02-13 20:23:28 +01:00