Commit Graph

339 Commits

Author SHA1 Message Date
Jeff Young e62969d007 Move zone fracture display mode to AdvancedCfg, and add triangulation.
Fixes https://gitlab.com/kicad/code/kicad/issues/8762
2021-07-26 18:57:35 +01:00
Wayne Stambaugh bcd6bddfd4 Start expunging NULL.
Given that KiCad is a C++ project, we should really be using nullptr
instead of NULL.
2021-07-15 15:44:45 -04:00
Mikolaj Wielgus 2af06a9d60 Fix stroke text size calculation and bitmap text overbar
Fixes bug 1 from https://gitlab.com/kicad/code/kicad/-/issues/8591.

Fixes a bug where no overbar would appear in bitmap text.
2021-06-14 09:09:30 +00:00
Jeff Young 9328c78b08 Fix issue with overbars in bitmap text. 2021-06-12 11:49:12 +01:00
Mikolaj Wielgus 3d520ebe1e Replace `~...~` overbar syntax with `~{...}`
Fixes https://gitlab.com/kicad/code/kicad/issues/8134

Fixes https://gitlab.com/kicad/code/kicad/issues/4227
2021-06-11 18:40:57 +00:00
luz paz f968fc8719 Fix source comment / documentation typos 2021-06-09 19:32:58 +00:00
Hajo Nils Krabbenhöft 937f502158 Improve accelerated supersampling 2x antialiasing
Avoid fractional pixel offsets by forcing integer division of m_screenSize.
Shift rounded lookAtPoint onto OpenGL pixel center to ensure consistent rounding to int.
The pixel 0..1 @ 1x needs to fill the area 0..2 @ 2x so its center moves by 0.5 * (pixel size @ 1x).
2021-06-03 17:53:51 +00:00
Marek Roszko cbad18ad98 Hide gal profiling behind KICAD_GAL_PROFILE cmake option
__WXDEBUG__ is too easy to get set
2021-04-30 19:24:36 -04:00
Jeff Young b83380b2ba Performance: don't look up map entry twice.
Fixes https://gitlab.com/kicad/code/kicad/issues/8157
2021-04-08 23:10:30 +01:00
Jonathan Haas 55679be2e3 Fix some typos across the codebase 2021-04-05 16:15:25 +02:00
Ian McInerney e08387ce3d Make the GAL responsible for the native cursor management
The native cursor must be set on the GAL canvas wx object,
not its frame (otherwise on GTK the cursor is only set
when we get a request for it from the WM and not immediately).

Fixes https://gitlab.com/kicad/code/kicad/issues/6421
2021-04-05 02:36:12 +01:00
Wayne Stambaugh d96cccbf20 OpenGL GAL tracing improvements. 2021-03-22 17:45:49 -04:00
Jeff Young 812d38736e Naming conventions. 2021-03-19 23:06:19 +00:00
Dominik Wernberger e2aa7be4b3 Added a lot of consts and refactored a few lines 2021-03-08 12:49:48 -08:00
Marek Roszko 907e282347 Silence some msvc warnings
- exception variables that were unused
- RAYSEG2D improperly foward declared with class instead of struct
- unused vars
2021-02-20 11:58:55 -05:00
Wayne Stambaugh e7227a4f21 GAL code cleaning. 2021-02-16 17:25:27 -05:00
Jeff Young 60d4d5b846 Scale down netnames on tracks so overbars fit.
Also fixes a bug where the overbar ignored the color opacity.

Fixes https://gitlab.com/kicad/code/kicad/issues/7524
2021-02-14 12:15:26 +00:00
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
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
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
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
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 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
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
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
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
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
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
Jeff Young 1fb51d29ab Reverse interpretation of triple-tilde.
Fixes https://gitlab.com/kicad/code/kicad/issues/4396
2020-05-11 22:56:09 +01:00
jean-pierre charras 79e7a27492 Fix a few Coverity warnings. 2020-02-02 08:55:24 +01:00
jean-pierre charras ad3c4b37ab Fix a few coverity warnings 2020-02-01 15:15:51 +01:00
Ian McInerney 13b6028e1b Refactor all math into a new kimath library
* Split up the thirdparty code into the thirdparty folder (#3637)
* Create a new kimath static library containing all the math functions

This is part of cleaning the build system for #1906.
2020-01-07 17:12:59 +00:00
Ian McInerney 6faa2188ed Silence warnings on MacOS about OpenGL deprecation
Apple has apparently deprecated OpenGL and replaced it with
their Metal API. It still works for now though.
2019-12-28 16:05:03 +00:00
Seth Hillbrand b5f021ff9f Cleanup: Replace push_back with emplace_back
In cases where we create a new item and immediately push into a
container, the emplace idiom is faster and more efficient.
2019-12-05 13:41:21 -08:00
Seth Hillbrand a2edf9c442 Unified update to C++14 std::make_unique
This update replaces the existing uses of unique pointer creation with
the C++14 std::make_unique call that provides proper memory release in
event of an exception.
2019-12-05 10:43:55 -08:00
Jeff Young 89ace3b0d0 Apply the overbar fixes from the stroke font to bitmap text.
Fixes: lp:1852037
* https://bugs.launchpad.net/kicad/+bug/1852037
2019-11-18 11:36:30 +00:00