Commit Graph

623 Commits

Author SHA1 Message Date
Jeff Young f6aa25df52 Make bitmap text measuring cognizant of overbars.
Also adds fallback for when text contains super- or subscript.

Fixes https://gitlab.com/kicad/code/kicad/issues/6846
2021-02-07 13:59:53 +00:00
Marek Roszko 9770ba9739 Fix odd/even check in cairo. Modulo 1 is always 0 on ints. 2021-01-31 11:59:49 -05:00
Seth Hillbrand 945faba586 Wrap CTOR in try/catch for context errors 2021-01-28 10:55:27 -08:00
Seth Hillbrand ffb3748cfc Don't crash when getting multiple wx calls
Multiple size calls will assert trying to re-lock the GAL context.  Just
skip the second one.
2021-01-09 13:05:58 -08:00
Jeff Young 5888d376a7 Handle special cases for ending overbar text.
Fixes https://gitlab.com/kicad/code/kicad/issues/6695
2020-12-10 18:38:31 +00:00
Jeff Young 0a7ef25453 Replace STROKE_FONT performance fix, this time with correct type.
Also this time with a fixed Cairo implementation and an implemented
BASIC_GAL implementation.

Fixes https://gitlab.com/kicad/code/kicad/issues/6447
2020-11-20 11:24:52 +00:00
Marek Roszko 1db882ed1b Partially revert 876b87b64e
This broke all text objects (for me on Windows at least)
2020-11-19 19:34:54 -05:00
Jeff Young 876b87b64e Minor performance fixes for PCBNew selections. 2020-11-19 17:23:02 +00:00
Ian McInerney 11e6cac42b Introduce EGL backend support for the OpenGL canvas
wxWidgets 3.1.5+ on Linux will compile with the Wayland EGL
canvas as the backend instead of the X11 backend. This requires a
version of GLEW compiled with the proper EGL defines and a different
header/code for certain parts that are X11 GLEW specific.

This introduces an in-tree version of GLEW that will be built with the
GLEW_EGL flag then statically linked into the KiCad executables when
EGL support is needed.
2020-11-11 00:41:02 +00:00
Marek Roszko 2d33b23530 Fix formatting 2020-11-07 09:51:09 -05:00
Marek Roszko df49e0bb0d Don't leave dangling pointers 2020-11-07 09:48:59 -05:00
Roberto Fernandez Bautista fe415c4134 Check GLEW functions exist before calling them
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6235
2020-10-30 20:17:27 +00:00
Roberto Fernandez Bautista 33385d0bb0 Combine return statements in OPENGL_GAL::CheckFeatures 2020-10-30 20:17:27 +00:00
jean-pierre charras 73c7154891 Fix another Coverity warning. 2020-10-27 14:16:38 +01:00
Jeff Young 66e3e12a9d Allow screen rendering to be maxError out from WYSIWYG.
Correcting the error is more trouble than it is worth, and anyway
might not be corrected exactly the same way plotting/filling/DRC
is corrected anyway.
2020-10-24 19:39:19 +01:00
jean-pierre charras cc81d97f78 Opengl DrawArcSegment(): refinements for a better look of control points.
Use a segment count multiple of 2, because we have a control point on the
middle of the arc, and the look is better if it is on a segment junction
because there is no arc to segment approx error
2020-10-24 17:26:44 +02:00
jean-pierre charras 6d12a0c95b OPENGL_GAL, DrawArcSegment(): do not modify the radius of arc.
The radius correction does not fix correctly approximation errors,
and creates serious issues for thin arcs:
- control point outside the arc
- HitTest active area outside the arc shown on screen
- Cairo and opengl gives different arc positions.
- the formula used in radius correction is probably incorrect.
2020-10-24 16:29:26 +02:00
Jeff Young 58c006bc45 Register properties for ARC elements so we can get their netclass.
Also improves GAL arc drawing and polygonization.

Fixes https://gitlab.com/kicad/code/kicad/issues/6039
2020-10-23 14:27:36 +01:00
Seth Hillbrand ae1004776f Correct Cairo GAL dot rendering
This matches the OpenGL dot rendering.  Patch from dsa-t with minor
changes

Fixes https://gitlab.com/kicad/code/kicad/issues/5832
2020-10-21 12:31:21 -07:00
Jon Evans c388bf0f92 Update default color theme
Blue is the new green :)

ADDED: built-in read-only color themes support
Classic theme is still available for those who love it

Fixes https://gitlab.com/kicad/code/kicad/-/issues/1991
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4259
2020-10-18 14:12:54 -04:00
Marek Roszko ae6900e7d7 Suppress the opengl test from generating "ghost frames" on Windows which appear and quickly disappear 2020-10-18 13:48:45 -04:00
jean-pierre charras f6b4b66a86 Avoid include wx/wx.h in many files that do not actually use this include.
Including wx.h includes the full set of wxWidgets include files, that is not good,
and can create some conflicts with some Windows headers on msys2.
2020-10-18 18:21:34 +02:00
Jeff Young 2574a8d71e Update GAL observers for all frames, not just calling frame.
Also don't rely on UpdateScaleFactor to do it as it only does it
if the scale factor changed.

Fixes https://gitlab.com/kicad/code/kicad/issues/5621
2020-10-09 21:30:09 +01:00
Jeff Young cc617b715f Implement hypertext links for intersheet references. 2020-10-02 21:18:34 +01:00
Mikolaj Wielgus 2d7a2a9658 Fix grid dots not appearing due to below-unity drawing width
Fixes https://gitlab.com/kicad/code/kicad/-/issues/5630
2020-09-29 01:23:39 +02:00
Seth Hillbrand 76e44c2f4b pcbnew: Really deal with missing segments this time
The OpenGL missing segments (when small) are due to rounding in larger
coordinates.  The GAL shader uses floats to represent int32 values for
position and distance.  Thus, at larger coordinates, the smaller integer
values cannot be represented accurately.  This tests for the rounding
error and, if it exists, draws a plain circle instead

Fixes https://gitlab.com/kicad/code/kicad/issues/5751
2020-09-21 16:59:31 -07:00
Seth Hillbrand f493e270ea ADDED: Menu option to enable/disable snap to grid
You can now enable and disable snap to grid when drawing/editing across
all apps.  You can also tie snap to grid to the visibility of the grid
to allow rapid enable/disable via grid display.
2020-09-10 20:09:30 -07:00
Jeff Young a0fbb79fd0 Tighten up the overbar spacing slightly.
Fixes https://gitlab.com/kicad/code/kicad/issues/5544
2020-09-08 11:02:09 +01:00
Seth Hillbrand c1a97fc0c3 GAL: Revision to 80af7b3158, allow LIB_POLYLINE
LIB_POLYLINE has a filled/not completely stroked draw mechanism that
allows stroking singular lines that will skip the fill
2020-08-21 16:02:13 -07:00
Seth Hillbrand 80af7b3158 Fix GAL check to account for shared function
Cairo Polyline and Polygon draw functions share a common routine.  While
Polygons must have 3 points to allow triangulation, a polyline (like our
text) need only have 2
2020-08-21 15:18:25 -07:00
Seth Hillbrand 7fc222db98 GAL: Check that polygons have at least 3 points
This resolves a crash when passing an empty polygon and alerts debug
users to possible generation cases when bad polygons are created.

Thanks for Frans Zellman
(https://gitlab.com/kicad/code/kicad/-/merge_requests/365) for
identifying the issue.
2020-08-21 09:36:41 -07:00
Wayne Stambaugh ede39780e2 Remove all debugging output that cannot be disabled.
The use of printf, wxLogDebug, and std::err/std::out causes excessive
debugging output which makes finding specific debugging messages more
difficult than it needs to be.

There is still some debugging output in test code that really needs to
be moved into a unit test.

Add debugging output section to the coding policy regarding debugging
output.
2020-08-18 10:17:36 -04:00
Seth Hillbrand ab58b67842 Adding triangulation viewing to AC
This adds a helper routine to visualize the quality of our
triangulation.  It also renames an excessively long variable name for
the arc editor
2020-08-12 06:22:45 -07:00
Ian McInerney 5684708b22 Remove shadowing linewidth member from the Cairo GAL
The base GAL has the linewidth property already, and its
accessor will only return the base version. This was causing
problems with the Cairo printing GAL, since that setter wasn't
using the base class version. Also, this removes the print-specific
setter, since the actual setting of line width shouldn't be done
there and is instead done where the drawing happens.

Fixes https://gitlab.com/kicad/code/kicad/issues/5089
2020-08-10 22:16:11 +00:00
mntmn bf60482b5c OpenGL GAL: support fallback without overlay buffer
On platforms with limited framebuffer attachments, like GC7000L
driven by the open source etnaviv driver, we can still use
GPU acceleration by drawing directly to the main buffer.

EDA_DRAW_PANEL_GAL::onPaint checks if an overlay target is
available in the GAL, and if not, redraws the whole view if the
overlay target should be dirty.

Clearing of the overlay target is a no-op if there is no overlay
buffer.

Signed-off-by: Lukas F. Hartmann <lukas@mntre.com>
2020-08-07 13:27:47 +00:00
jean-pierre charras 2d9b0b255b Better fix for OPENGL_GAL::DrawSegment() than initial commit 294dab.
segments having a length <= 1 internal unit are not drawn  in opengl gal.
So these segments are drawn as circle.
2020-07-31 15:41:21 +02:00
Seth Hillbrand 294dabf640 GAL: Fix issue with small tracks being hidden
When drawing segments that are smaller than the segment width, OpenGL
did not use realistic values, leading to hidden, small tracks.  Instead,
we set the track to only draw a segment when the length is at least 1
radius long (so that we can see the full semi-circle at the track end)

Fixes https://gitlab.com/kicad/code/kicad/issues/5009
2020-07-30 15:11:39 -07:00
Urja Rannikko aa7ab46a06 GAL: Round the incoming mode parameter in fragment shader
This fixes some letters being randomly boxes and some circles
being randomly triangles on the Mali T760.
2020-07-17 20:24:18 +00:00
Urja Rannikko 65ceeebc71 GAL: Remove dead code regarding SHADER_LINE_B in the fragment shader
The only test for it was only called from a function
that's called if the mode is SHADER_LINE_A, not B.
2020-07-17 20:24:18 +00:00
jean-pierre charras 9f20c61fa7 Remove creation on the fly of a wxPaintEvent instance (fix previous commit). 2020-07-15 14:56:35 +02:00
jean-pierre charras 6366aa3ede Remove creation on the fly of a wxPaintEvent instance (final step).
This is not allowed in 3.1.4 wxWidgets.
2020-07-15 12:58:43 +02:00
Jon Evans a94a81b9a8 GAL: Handle text opacity in OpenGL
Vertex alpha was being dropped in the font shader
2020-07-12 11:16:28 -04:00
Jon Evans 5d118b0700 More visibility settings infrastructure
ADDED: Three-state high contrast mode action
ADDED: Save contrast mode in local settings

Also some initial infrastructure for layer presets
2020-07-11 21:59:07 -04:00
Qbort f3f17401dc Fix OPENGL_GAL initialization sequence
- New public static function OPENGL_GAL::CheckFeatures() gets called in EDA_DRAW_PANEL_GAL::SwitchBackend() before switching to OPENGL_GAL
- Moved all OpenGL feature checks from OPENGL_GAL constructor to OPENGL_GAL::init()

Fixes https://gitlab.com/kicad/code/kicad/-/issues/4714
2020-07-04 10:54:30 +00:00
Seth Hillbrand a210fd570f Set VSYNC to adaptive (if available)
Swap syncs can limit the redraw rate as the screen waits for previously
issued syncs.  Setting this to -1 allows for adaptive swapping
(resorting to unsynced if it falls behind) if it is supported by the
card but will fall back to unsynced (0) if the adaptive is not
supported.

Fixes https://gitlab.com/kicad/code/kicad/issues/4226
2020-07-03 13:27:48 +00:00
Lukas F. Hartmann f5842156a5 GAL: disable glCopyBuffer for etnaviv vendor 2020-06-28 17:01:26 +00:00
Ian McInerney 5b3d947b7e Fix initialization order fiasco with colors
The legacy color refs are needed by the COLOR4D constructor
when constructing a static variable, so they can't be static
themselves.
2020-06-19 17:05:18 +01:00
Ian McInerney 5649558cff Move DPI_SCALING into the GAL from common
It should be owned by the GAL, since it is used
with the OpenGL canvas infrastructure.
2020-06-19 17:02:46 +01:00
Jon Evans e91b9f6dfb Rip out the unused leftovers of the old color system 2020-06-18 22:32:14 -04:00
Ian McInerney ab83c86210 Remove the platform-specific GetBackendScalingFactor from HIDPI_GL_CANVAS
The scaling factor stored inside the canvas is created by a DPI_SCALING
helper, which will call the platform-specific functions if no user scaling
is specified. This change only affects OSX and Retina displays, so this
now also allows custom scaling to be used on OSX if desired (although it
shouldn't be needed, since wx has detection for it in 3.0.4).
2020-06-05 00:15:54 +00:00