Commit Graph

524 Commits

Author SHA1 Message Date
Maciej Suminski 5a64343fb4 CAIRO_PRINT_CTX class
CAIRO_PRINT_CTX provides a Cairo context created from wxPrintDC.
It allows one to prepare printouts using the Cairo library and
let wxWidgets handle the rest.
2018-10-31 19:17:29 +01:00
Maciej Suminski 1411e1f73a GAL: added methods to modify rotation in the transformation matrix 2018-10-31 19:17:29 +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 f183b4f526 GAL, Opengl: Draw Arc: fix draw layer depth (previously, set to 0.0, which is not always the case) 2018-10-21 19:53:36 +02:00
jean-pierre charras 7be215249d OPENGL_GAL: avoid crash when esotheric unicode chars are used in netnames/pad names in Debug mode.
It happens when the char is not found in the font used to display netnames/pad names.
When happens, a wxASSERT is raised.
Unfortunately it can crash the application if it is during a paint event or some critical time.
2018-10-20 18:08:36 +02:00
Tomasz Włostowski d66e0d4f7a eeschema-gal: implemented EnableDepthTest() in GAL, fixed drawing order in eeschema 2018-10-15 00:09:59 +02:00
Jeff Young 6a5744adb1 Show compile errors and go back to GLSL V120. 2018-10-13 12:39:53 +01: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 a676034e36 OPENGL_GAL::DrawGrid(): flush drawing buffer after drawing small crosses grid so that it's correctly composited
Fixes: lp:1797642
* https://bugs.launchpad.net/kicad/+bug/1797642
2018-10-12 23:52:35 +02: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
jean-pierre charras 0dfd0c5f52 Minot cosmetic enhancement 2018-10-11 11:26:59 +02:00
Ronnie Gaensli ab1f016132 Fix assert freeze of eeschema when ToHSV, h is Nan
Fixes: lp:1797006
* https://bugs.launchpad.net/kicad/+bug/1797006
2018-10-10 21:22:26 +02: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 88cdce8d62 Make SYMBOL_PREVIEW_WIDGET working, and using the canvas type of the caller. Fix an issue with F3 zoom key in libedit. 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
jean-pierre charras e55763947e Set the reight grid visibility at start. Display axis in libedit and viewlib. 2018-10-09 11:08:56 +01:00
Jeff Young 0063f2c12d Stroke rectangles after filling so fill doesn't cover 1/2 of stroke. 2018-10-09 11:08:55 +01:00
Jeff Young afeebc8944 Grid settings for Eeschema GAL.
Split antialiasing options out from display options.  Move
antialiasing to common.  Duplicate the rest of display options
for Eeschema.

Implement OnSelectGrid and hookup GAL canvas refresh to
SetPresetGrid.

Add Grid Settings... to View menu and move Show Grid from
preferences to View Menu to match Pcbnew.
2018-10-09 11:08:55 +01:00
Tomasz Wlostowski ccb594f599 eeschema-gal: support for global labels and bitmaps 2018-10-09 11:08:55 +01:00
Tomasz Wlostowski f82f310dd5 eeschema-gal: added EnableDepthTest() feature in GAL 2018-10-09 11:08:52 +01:00
jean-pierre charras 26838c6800 Pcbnew: Crash after running external plugin
Happens only in Opengl mode.
So enforce controls in 3 group function: DrawGroup, ChangeGroupColor, ChangeGroupDepth.

Fixes: lp:1795044
https://bugs.launchpad.net/kicad/+bug/1795044
2018-09-29 12:58:47 +02: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
Seth Hillbrand a6325aab29 Replacing Tesselation
Replaces Poly2Tri with updated code to process polygons faster and more
robustly.  Notably, we can now handle overlapping holes in the polygons,
allowing us to cache the triangulation of complex boards
2018-09-01 19:30:50 -07:00
Tomasz Wlostowski aab40ee9e8 OPENGL_GAL: don't use glCopyBuffer() on faulty Intel GL drivers
Fixes: lp:1787221
* https://bugs.launchpad.net/kicad/+bug/1787221
2018-08-16 14:34:36 +02:00
Jeff Young be1d6113d6 More performance enhancements.
Be more intelligent about sorting lib tree items.  (Footprint
entries, for instance, come out of an already-sorted list.)

Don't recreate menus twice when laoding Footprint Editor.

More pervasive use of WX_FILENAME to avoid expensive calls to
wxFileName::SplitPath() and string concatenation.

For POSIX kernels do all the work on the file-system side so we
don't have to keep converting back and forth between encodings.
2018-08-06 13:49:27 +01:00
Jeff Young 146ab1eb32 Small performance improvement loading stroke font. 2018-08-06 13:48:17 +01:00
jean-pierre charras 3a02e54411 Opengl fix: bitmaps having a width not multiple of 4 were incorrectly drawn.
This fix draws a "sub bitmap" having a width multiple of 4.
(The loss of 1 to 3 pixels in horizontal size should be not really noticeable)
2018-07-30 16:19:35 +02: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
jean-pierre charras 82d492a840 Better wxASSERT message in OPENGL_GAL::computeBitmapTextSize, if the char is not found in font. 2018-07-23 13:58:13 +02:00
Jeff Young 185b524a62 Support both add-empty and add-browse for 3D models.
Also fixes a bug where the selected row and the grid cursor get
separated after a delete.

Fixes: lp:1782747
* https://bugs.launchpad.net/kicad/+bug/1782747
2018-07-23 01:09:47 +01:00
Carsten Schoenert e81faa2d5f fix misspelled 'allow to' -> 'allow one to' 2018-07-11 10:35:14 -04:00
Carsten Schoenert 9f7109826d fix misspelled 'allows to' -> 'allows one to'
Fixup small grammar issues around used 'allows to ...' almost in
code comments.
2018-07-11 10:35:03 -04:00
Andrzej Wolski 1f6f76beb9 Fix overbar drawing for non-italic text
Overbar was always indented inward, regardless if text was italic or not.
2018-06-24 12:01:10 -04:00
Maciej Suminski 73a8d2a9d5 OPENGL GAL: Fixed the iteration condition when drawing triangulated polyset
The loop used an incorrect variable size as the loop limit,
occasionally causing out of bounds accesses.

Fixes: lp:1778288
* https://bugs.launchpad.net/kicad/+bug/1778288
2018-06-23 02:05:21 +02:00
Maciej Suminski 1751e4631c Code formatting 2018-06-23 01:59:49 +02:00
Maciej Suminski 813c1a2ba2 Dealing with inconsistent wxGLCanvas::IsDisplaySupported()
wxGLCanvas::IsDisplaySupported() handles wxGL_{MINOR,MAJOR}_VERSION
attributes only in 3.0.4. Since 3.1.0 the attributes are apparently not
supported, so instead wxGLContext::IsOK() is used (introduced in 3.1.0).

Fixes: lp:1775995
* https://bugs.launchpad.net/kicad/+bug/1775995
2018-06-11 12:26:59 +02:00
Maciej Suminski 6bd708621b Early check of supported OpenGL version 2018-06-04 12:17:58 +02:00
jean-pierre charras 8f984c2899 OpenGL, DrawGrid(): use grid and axis alpha color value setting, instead of the fixed 1.0
In Cairo mode, this function uses already the alpha color value setting.
Now for low alpha values (usually they are low, as said in many GAL comments),
Cairo mode and OpenGL mode should have a similar look.
2018-06-01 18:29:04 +02:00
Maciej Suminski 7d9dea7897 Remove an excessive assert for Cairo canvas size
It is a C-style assert causing application termination when triggered.
Certain systems display pcbnew window shrinked so much, that the canvas
size is 0x0 pixels. The only problem with that is the window needs to be
resized.

Fixes: lp:1767031
* https://bugs.launchpad.net/kicad/+bug/1767031
2018-04-27 10:06:36 +02:00
Carsten Schoenert 77b3a662fc fix misspelled 'Allows to' -> 'Allows one to' 2018-04-08 13:24:30 -04:00
Carsten Schoenert 1f32f7c55b fix misspelled 'allows to' -> 'allows one to' 2018-04-08 13:24:18 -04:00
Jon Evans 081c77f6bd OPENGL_GAL::DrawSegment(): Enforce nonzero width to match Cairo
Fixes: lp:1759958
* https://bugs.launchpad.net/kicad/+bug/1759958
2018-03-29 22:13:46 -04:00
Maciej Suminski 6331f94544 OpenGL GAL: safer error handling
Replaced assert() with wxCHECK(), so in case of problems methods return
instead of continuing with invalid state/data, wherever possible.
2018-03-22 18:20:02 +01:00
Jeff Young 99e659ff54 Coverity fixes. 2018-03-21 23:11:55 +00:00
Jon Evans 921e68107b OpenGL: Make circle/arc drawing match Cairo for some edge cases 2018-03-08 22:04:33 -05:00
Maciej Suminski 9ce768c29a Modified STROKE_FONT::ComputeStringBoundaryLimits() to process multiline strings
Removed a declaration of a not existing method (STROKE_FONT::ComputeTextLineSize()).

Fixes: lp:1747967
* https://bugs.launchpad.net/kicad/+bug/1747967
2018-03-08 10:56:34 +01:00
Carsten Schoenert 9679bd55c1 fix misspelled 'streching' -> stretching 2018-02-25 17:10:10 -05:00
Carsten Schoenert cb14742442 fix misspelled 'accesing' -> 'accessing' 2018-02-25 17:10:10 -05:00
Maciej Suminski 5c8accef8e Enable GL debug output only if available 2018-02-14 08:52:08 +01:00
jean-pierre charras 5ecfd32654 OpenGl fix: call enableGlDebug( true ) only in Kicad debug build, and only on Linux
(Because we have crashes on OSX and some Window installs)
2018-02-10 11:57:22 +01:00
Maciej Suminski 8a68a21570 Enable OpenGL debug output in debug builds 2018-02-09 16:20:38 +01:00
Tomasz Włostowski 271363f822 router: support for board outline 2018-02-06 09:43:56 +01:00
Tomasz Włostowski 2faf1a1ed3 Initial support for keepout zones in the P&S router. 2018-02-06 09:43:56 +01:00
jean-pierre charras 2fd00b1d23 Revert "Ensure DrawRectangle() stroke outline will always be visible"
This reverts commit 74d47d8173 because
it breaks DrawRectangle in outline mode because it modify line width.
2018-01-21 10:14:02 +01:00
Jon Evans 74d47d8173 Ensure DrawRectangle() stroke outline will always be visible
Fixes: lp:1743242
* https://bugs.launchpad.net/kicad/+bug/1743242
2018-01-16 09:20:02 +01: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
Maciej Suminski 4ec24badb9 Enlarge OpenGL glyphs to match Cairo and legacy text size 2018-01-08 10:46:27 +01:00
Kristoffer Ödmark e7ddcca569 Fix some netname rendering issues
Fixes: lp:1739074
* https://bugs.launchpad.net/kicad/+bug/1739074
2018-01-08 10:29:50 +01:00
Jon Evans 9689200984 OpenGL: Fix background color being drawn twice in no-AA mode
Fixes: lp:1741363
* https://bugs.launchpad.net/kicad/+bug/1741363
2018-01-06 17:32:19 +01:00
Mark Roszko b98cc0b937 Some coverity fixes 2018-01-05 22:51:03 -07:00
Maciej Suminski 2fc07561f1 Fix crash when drawing a polygon with empty outline
In theory there should be no polygons with empty outline, but as you see
there was at least one leading to a crash.

Fixes: lp:1739455
* https://bugs.launchpad.net/kicad/+bug/1739455
2017-12-21 09:51:26 +01:00
Maciej Suminski 7741b90c78 gal: Draw grid from edge to edge
Fixes: lp:1677211
* https://bugs.launchpad.net/kicad/+bug/1677211
2017-12-20 09:28:39 +01:00
Bernhard Stegmaier 02d1b2611e Remove wx-3.1 only constructor from HIDPI_GL_CANVAS wrapper. 2017-12-18 16:26:01 +01:00
Bernhard Stegmaier 19d7112fa2 Merge HIDPI_GL_CANVAS wrapper with OPENGL_GAL implementation. 2017-12-18 16:26:01 +01:00
Bernhard Stegmaier 909d95b5be Create HIDPI_GL_CANVAS wrapper for transparent wxGLCanvas HiDPI/Retina support. Enable HiDPI/Retina for 3d-viewer. 2017-12-18 16:26:01 +01:00
Tomasz Włostowski eed924fe45 Fixed zone filling crash & thermal stubs inconsistency
Fixes: lp:1737557
* https://bugs.launchpad.net/kicad/+bug/1737557
Fixes: lp:1737542
* https://bugs.launchpad.net/kicad/+bug/1737542
Fixes: lp:1737541
* https://bugs.launchpad.net/kicad/+bug/1737541
2017-12-14 01:29:08 +01:00
Andreas Buhr 6205363b50 bugfix: OPENGL_GAL::DrawPolygon did not close closed polygons
The polygon drawing routing in the OpenGL-GAL did
not plot polygons which are "closed", i.e. have a segment
from their last point to their first point, correctly.
That segment was omitted.
This commit fixes this bug.
2017-12-13 17:01:32 +01:00
Andreas Buhr 5572183c22 bugfix: OPENGL_GAL::drawPolygon did not respect fill settings
The OPENGL_GAL::drawPolygon function and all functions using it
did not respect the isFillEnabled member set by
GAL::SetIsFill. This is fixed by this patch.
2017-12-11 10:21:37 +01:00
Maciej Suminski ef8f5db024 Handle space character in OPENGL_GAL::BitmapText()
Fixes: lp:1668455
* https://bugs.launchpad.net/kicad/+bug/1668455
2017-12-07 17:58:54 +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 8df299a6bc pcbnew: Optimized zone filling algorithm: code cleanup 2017-12-05 14:54:57 +01:00
Tomasz Włostowski 316ddadec1 pcbnew: Optimized zone filling algorithm. 2017-12-05 14:54:57 +01:00
Jon Evans 0564d3456b Preserve color scheme when switching to legacy (Fixes lp:1670669)
Instead of modifying the colors when switching to legacy canvas,
they will now be preserved and only returned as the "legacy" colors.
2017-11-28 10:47:04 +01:00
jean-pierre charras 81ad3366f5 Avoid division by 0 in GAL::GetGridPoint( const VECTOR2D& aPoint ) 2017-11-07 09:45:03 +01:00
Maciej Suminski 5eb56dd8b0 Coverity fixes
CIDs:
102571
168696
168701
168704
168706
168708
168710
168713
168716
168717
2017-11-01 10:24:26 +01:00
jean-pierre charras 3407c6cf27 Gerbview: add icons in a context menu.
gal: remove a forgotten debug line.
2017-10-23 16:53:42 +02:00
jean-pierre charras 7418deb454 Pcbnew: fix issues with 360 deg angle arcs.
Fixes: lp:1725943
https://bugs.launchpad.net/kicad/+bug/1725943
2017-10-23 15:35:03 +02:00
Jon Evans 0b9b8d3e93 Add support for reversed draw order and Cairo negative draw mode 2017-09-25 13:35:01 +02:00
jean-pierre charras d8ade988ce workaround for a minor and strange issue: size of chars '-' and '_' are incorrect in msdf_atlasgen fonte. the size of 'x' char is used instead. 2017-09-19 18:56:33 +02:00
Jon Evans 93de82f0b2 Fix scrollbars in macOS GAL canvases 2017-09-15 11:29:49 +02:00
Maciej Suminski 8c7175b00d Upload correct amount of vertex data in CACHED_CONTAINER_RAM
Previous implementation uploaded only vertices with indices less
or equal to the number of stored vertices, which is invalid when
the container become fragmented.

Fixes: lp:1712887
* https://bugs.launchpad.net/kicad/+bug/1712887
2017-09-09 21:07:32 +02:00
Maciej Suminski 342bb2bf78 Code formatting
Renamed VERTEX related constants to follow UPPER_CASE naming.
2017-09-09 21:07:32 +02:00
Maciej Suminski b5db6a7d5d Map/unmap vertices once per layer order update
Multiple memory map/unmap operations cause a significant delay on
GPUs that fetch vertices from RAM.

Fixes: lp:1701936
* https://bugs.launchpad.net/kicad/+bug/1701936
2017-08-21 13:28:09 +02:00
Maciej Suminski 6ff065fa63 Fixed recognition of GPUs not handling glMapBuffer() efficiently
Fixes: lp:1685335
* https://bugs.launchpad.net/kicad/+bug/1685335

Fixes: lp:1683041
* https://bugs.launchpad.net/kicad/+bug/1683041
2017-08-18 15:02:46 +02:00
jean-pierre charras 8a1a3ed36c Better fix for compil problems in utils.cpp 2017-08-09 15:30:01 +02:00
jean-pierre charras 7ab6368869 Fix compil problems in utils.cpp, to be compatible with msys2/windows and linux. 2017-08-09 14:05:10 +02:00
Maciej Suminski c18d148589 Moved VERTEX_CONTAINERs intialization to the constructors 2017-08-08 15:33:57 +02:00
Maciej Suminski 4ae29aa693 Fixed a shadowing variable warning 2017-08-08 15:31:45 +02:00
Maciej Suminski 2697a21a7a Yet another try for correct function signature type cast 2017-08-08 15:26:50 +02:00
Maciej Suminski ef6910faa9 Take two for satisyfing picky compilers (casting nullptr to void*) 2017-08-08 14:53:34 +02:00
Maciej Suminski e91ce300fb Cast nullptr to const void* to satisfy picky compilers 2017-08-08 14:47:27 +02:00
Maciej Suminski 262fcc91af Fixes for video cards unable to use gl{Un,}MapBuffer correctly
Fixes: lp:1685335
* https://bugs.launchpad.net/kicad/+bug/1685335

Fixes: lp:1683041
* https://bugs.launchpad.net/kicad/+bug/1683041
2017-08-08 14:26:05 +02:00
Maciej Suminski 46b5575c51 OpenGL driver debug routines 2017-08-08 09:31:57 +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 1f6854f2b8 Make internal errors messages not translatable 2017-08-01 13:12:59 +02:00
Maciej Suminski 7399759b3b Fixed polygon DRAWSEGMENT rendering in OpenGL GAL
Fixes: lp:1704542
* https://bugs.launchpad.net/kicad/+bug/1704542
2017-07-28 10:34:47 +02:00
Oliver Walters c27f5b725d Improved various error messages
- Moved developer "jargon" to details pane
- Changed error messages to "WHAT" rather than "WHY" or "WHERE"
2017-07-25 07:37:14 -04:00
jean-pierre charras 5f4599fb56 Add a new color selector, to adjust color selection for GAL mode, with support of opacity (alpha channel)
Pcbnew: save opacity value in color config, and keep it when switching between legacy and gal mode.
2017-07-18 19:07:47 +02:00
jean-pierre charras ed66496242 Fix an issue (created by commit 16cb6a6ca0) when converting a color4D to a legacy color
Fixes: lp:1704724
https://bugs.launchpad.net/kicad/+bug/1704724
2017-07-17 09:59:34 +02:00