Commit Graph

95 Commits

Author SHA1 Message Date
jean-pierre charras 388397f97d Protect TesselatePolygon() against degenerated polygons (less than 3 corners) to avoid crashes.
Use TesselatePolygon() to draw polygons in Gerbview instead of GLU tesselation, much slower.
Add helper methods in GAL to know if the current GAL engine is Cairo, OpenGL or something else,
useful to optimize drawing code.
2018-12-18 12:49:14 +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 1bce69b9f0 Fix a minor compil warning. 2018-10-13 08:24:31 +02:00
Jeff Young 6c34fdefd7 Better exception handling and context locking for GAL.
This prevents deadlocks when exceptions are thrown and the context
ends up not getting unlocked.

It also removes an earlier hack to try and minimize this which
didn't work anyway.
2018-10-12 23:44:49 +01:00
Tomasz Włostowski 711b278248 gal/opengl: handle single-pixel line width clamping in hardware (new shader). Correct grid rendering in GAL for pixel-sized lines 2018-10-12 19:13:54 +02:00
Tomasz Wlostowski f82f310dd5 eeschema-gal: added EnableDepthTest() feature in GAL 2018-10-09 11:08:52 +01:00
Jeff Young 0309228276 Don't allow drawing to a zero-height or zero-width GAL canvas.
Fixes: lp:1793913
* https://bugs.launchpad.net/kicad/+bug/1793913
2018-09-22 22:06:40 +01:00
Tomasz Wlostowski 516cf47946 OPENGL_GAL: optimized JP's bitmap drawing function to use textures 2018-07-30 00:13:37 +02: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
Camille 9ff66a5274 Fix unnecessary value parameter detected by clang-tidy. - Replace value parameter by const reference parameter or move-assignement in some cases 2018-01-09 18:55:51 -05:00
Bernhard Stegmaier 19d7112fa2 Merge HIDPI_GL_CANVAS wrapper with OPENGL_GAL implementation. 2017-12-18 16:26:01 +01:00
Maciej Suminski 602ecf7502 Fix overbar display in OpenGL canvas
Moved the code handling text overbars to a single function
(ProcessOverbars()) to replace similar pieces of code trying to do the
same thing.

Fixes: lp:1735906
* https://bugs.launchpad.net/kicad/+bug/1735906
2017-12-07 17:58:54 +01:00
Tomasz Włostowski 316ddadec1 pcbnew: Optimized zone filling algorithm. 2017-12-05 14:54:57 +01:00
Jon Evans 1994cc3ae2 Use unordered_map instead of map for GROUPS_MAP 2017-09-25 13:39:37 +02:00
Jon Evans 0b9b8d3e93 Add support for reversed draw order and Cairo negative draw mode 2017-09-25 13:35:01 +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 22a8df69c4 Fix a few doxygen warnings 2017-06-30 16:03:17 +02:00
Maciej Suminski 11f8e53e27 Smoother arc rendering in OpenGL GAL
Fixes: lp:1496114
* https://bugs.launchpad.net/kicad/+bug/1496114
2017-03-10 14:08:59 +01:00
Jon Evans 3208d24ad4 Add DrawArcSegment() GAL method, to support drawing outlined arcs 2017-03-10 14:08:59 +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 88eb648cbb Alternative way of handling OpenGL initialization & errors
Some faults could result in a crash, as they were not properly
handled. Now the rendering loop is wrapped with try..catch block
which will revert to Cairo in case of an error and display an
error message.

Fixes: lp:1655766
* https://bugs.launchpad.net/kicad/+bug/1655766
2017-01-13 16:50:36 +01:00
Maciej Suminski 5a7604cbb4 More code formatting 2017-01-13 10:36:59 +01:00
decimad 77138e3702 Add UI control to set up gal opengl antialiasing and load/store the settings 2017-01-11 16:20:37 +01:00
decimad 047f52e7cb Move builtin font resources out of opengl_gal translation unit 2017-01-11 16:20:33 +01:00
jean-pierre charras 30df041de6 fix shadowed local variables 2016-11-25 18:17:34 +01:00
decimad 402f53a302 update font code along with the changes done in the msdf atlas tool (use codepoint spans and refined char placement)
add font coordinate system clarification drawing (svg)
2016-10-20 14:31:09 +02:00
Simon Richter 59c81976dc Explicitly mark overriding functions. 2016-09-24 14:53:15 -04:00
Simon Richter da5699de0a Replace boost::shared_ptr with std::shared_ptr. 2016-06-29 11:09:55 -04:00
Maciej Suminski b7ec4ea160 Corrected the last instance check in OPENGL_GAL. 2016-06-10 17:07:12 +02:00
Maciej Suminski 3fcae6b120 Fixes for OpenGL resources handling. 2016-06-07 14:42:42 +02:00
Maciej Suminski b4ad18a3ea Do not rebuild shaders on each OPENGL_GAL construction. 2016-06-03 15:46:13 +02:00
Maciej Suminski 68b6da57c0 Removed OPENGL_GAL::instanceCounter. 2016-06-03 15:46:12 +02:00
Maciej Suminski 01f32dd52c GL_CONTEXT_MANAGER class to avoid unexpected GL context switches. 2016-06-03 15:46:12 +02:00
jean-pierre charras 3e2cae946c Corrected wxDC objects used by EDA_DRAW_PANEL_GAL & OPENGL_GAL. 2016-06-03 15:46:11 +02:00
Maciej Suminski 3ca7026aa0 More robust checks for OpenGL canvas visibility. 2016-05-20 12:06:08 +02:00
Maciej Suminski 8d952f35c6 Fixed text vertical alignment for bitmap font (OpenGL). 2016-05-03 11:58:48 +02:00
Maciej Suminski 58ed0c8cce Improved grid drawing routine (OpenGL). 2016-05-02 16:15:24 +02:00
Maciej Suminski fff3abc9a0 Support for overbars in bitmap fonts (OpenGL GAL). 2016-05-02 16:12:18 +02:00
Maciej Suminski 59fe8df269 Split bitmap text drawing routine into smaller functions (GAL). 2016-05-02 16:12:18 +02:00
Maciej Suminski 702be4903f Vertices are stored in GPU memory (OpenGL GAL). 2016-05-02 16:12:16 +02:00
Maciej Suminski bda3011519 Initial support for bitmap fonts (OpenGL GAL). 2016-05-02 16:04:45 +02:00
Maciej Suminski c0465e5519 Instance counter for OPENGL_GAL to avoid double freeing. 2016-05-02 15:56:16 +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 0386a4df94 Bulletproof canvas switching. 2015-08-21 10:33:36 +02:00
Maciej Suminski 709697ea40 Better way to determine supported OpenGL version and extensions. 2015-04-20 14:16:41 +02:00
Maciej Suminski b1ace1607b Reworked GAL switching.
Now OpenGL can report its problems instead of shutting down the application.
2015-02-15 02:18:35 +01:00
Maciej Suminski a57f7ae8cd Fix OpenGL canvas freeze under Windows. 2014-07-20 21:14:42 +02:00
Maciej Suminski 0fc93666c6 Rework to support multiple views with OpenGL GAL canvas. 2014-07-09 11:22:42 +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