Commit Graph

767 Commits

Author SHA1 Message Date
Alex Shvartzkop 59c06bcaf1 OpenGL GAL: fix reserved vertices calculation in drawSegmentChain.
(cherry picked from commit 6a123e2381)
2023-07-10 20:18:47 +05:00
Alex Shvartzkop 0ffef66cb6 Fix bitmap transparency in Cairo GAL.
Cairo ARGB32 format needs alpha pre-multiplied with color.

(cherry picked from commit f286015bc7)
2023-07-09 05:46:11 +05:00
Alex Shvartzkop 1a3dc72af8 Avoid deadlock when OpenGL context can't be created.
Previously, with aContext == nullptr, the mutex would lock, but not unlock.
Then it got deadlocked inside OPENGL_GAL dtor.

(cherry picked from commit eaf65f7d53)
2023-06-11 20:12:22 +03:00
Jeff Young 16f286735d Cache LIB_PIN text extents for performance.
Also fixes a bug where we didn't triangulate at all when the char
count didn't warrant the likely overhead of spinning up a
thread_pool.

And fix another bug where EDA_TEXT::GetRenderCache() wasn't using
the given font.

Also reverts using the cache for drawing-sheet text.  The text
items are created from scratch from the data items each time
they're drawn, so there's never an existing cache to make use of.
Instead, we now check that the item is in the view, using a very
approximate bounding box generator (because even generating a
real bounding box shows up large in profiles).

And, lastly, fixes a bug where EndPos was never considered in
DS_DATA_ITEM::IsInsidePage().

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14822

(cherry picked from commit f35a88ce0b)
2023-06-04 21:11:06 +01:00
Jeff Young 45c7490180 Outline font performance improvements.
1) Don't fracture font glyphs when generating them; we're going
   to fracture during triangulation anyway.
2) Don't check for self-intersection when deciding to fracture.
   It costs nearly as much as the fracture does.
3) Cache drawing sheet text.
4) Use the current font when checking for cache validity.
5) Parallelize glyph triangulation.
6) Don't invalidate bounding box caches when offset by {0,0}
7) Use the glyph cache when generating text effective shape.
8) Short-circuit NormalizeJustification() if its center/center.
9) Don't triangulate for GuessSelectionCandidates()
10) Avoid sqrt whenever possible.
11) Pre-allocate bezier and SHAPE_LINE_CHAIN buffers.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14303

(cherry picked from commit 4ed267394a)
2023-06-04 20:57:14 +01:00
Jeff Young c18600b67f Don't reset alpha when specified in hex value.
Also fixes a bug with colour picker cursor drawing on Mac.

Fixes https://gitlab.com/kicad/code/kicad/issues/14646

(cherry picked from commit a817b4c1ff)
2023-04-29 17:52:50 +01:00
jean-pierre charras c75672fd44 OPENGL_GAL: draw BITMAP_BASE: fix incorrect rendering of mirrored bitmaps
The vertical mirror was not working.
2023-04-23 16:12:14 +02:00
Alex d7b2247878 opengl_gal: Remove extra padding of bitmap textures.
Since the format has been changed to RGBA8, default (UN)PACK_ALIGNMENT = 4
works correctly, so the texture width padding to 4 is not needed anymore.

Fixes https://gitlab.com/kicad/code/kicad/issues/14432


(cherry picked from commit e91b53fc39)
2023-04-11 04:32:42 +00:00
Jon Evans ee0ba17c03 Improve HiDPI handling of appearance/layer controls
(cherry picked from commit 43d3a18b86)
2023-03-07 08:49:06 -05:00
Seth Hillbrand 823607796b Additional safety around wks bitmaps
Invalid files can create large problems for unloaded PNG data

Fixes https://gitlab.com/kicad/code/kicad/issues/13801
2023-02-07 12:08:39 +01:00
jean-pierre charras 23d0e6b4c0 Fix compil on msys2 (Structured Exception Handling not really supported) 2023-02-05 10:39:25 +01:00
Alex 525d0da126 Move __try into lambda. 2023-02-05 07:55:01 +03:00
Alex b913e9be1e Move more of defragment inside the __try block. 2023-02-05 07:45:03 +03:00
Alex 74a242c662 Catch access violation in defragment due to OpenGL drivers on Windows. 2023-02-05 07:03:04 +03:00
jean-pierre charras e900e472ce Fix compil and Coverity warnings 2023-01-22 09:40:09 +01:00
Marek Roszko ac94995f70 Some more wxS 2023-01-16 19:07:50 -05:00
Jon Evans 05b578a9bb Bitmaps: use original size for caching
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13486
2023-01-11 21:15:07 -05:00
Seth Hillbrand a206f6717d Desaturate the symbols in DNP for print/plot
The desaturation should match screen display

Fixes https://gitlab.com/kicad/code/kicad/issues/13481
2023-01-11 13:44:08 -08:00
Jon Evans 8894b8e669 Implement bitmap rotation and mirroring without texture modification in opengl_gal 2023-01-04 00:26:45 +00:00
Jon Evans ac3ed02283 Rework bitmap cache and enable it
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12405
2023-01-04 00:26:45 +00:00
Marek Roszko 8ab9934143 Use our own cmake module path variable to avoid conflicting with the main ones listy functional 2023-01-03 19:18:16 -05:00
Seth Hillbrand 1cc9792cdb Fix snapping dist when disabling grid
The disable grid hotkey should allow the snap scale to be completely
determined by the snapSize and world scale.  This prevents snapRange
from overriding in the case where grid is disabled.

Additionally, we disallow grid snapping when the grid scale is not
visible.  This means that when zoomed out sufficiently to not show the
minor ticks, these minor ticks will not override a snap

Fixes https://gitlab.com/kicad/code/kicad/issues/12303
2022-12-21 17:47:45 -08:00
Alex dcb131c20d Improve canvas responsiveness by better swap interval management. 2022-11-18 00:32:25 +05:00
Seth Hillbrand de21eb5268 Remove errant debugging printf 2022-11-04 13:22:49 -07:00
Seth Hillbrand 685185bd68 Remove unneeded assert
Asserts should really only be used if the condition would trigger a
program error.  These just need a warning
2022-11-04 11:49:50 -07:00
dsa-t aeef215ffb gal: Pass aReserve to drawLineQuad in drawPolyline. 2022-11-01 05:02:17 +00:00
Seth Hillbrand 5be0ddca27 Draw degenerate lines as points
Rather than not drawing, which will miss some imported elements that
should be visible due to the line width, we draw a zero-length line that
appears as a point.
2022-10-31 16:18:38 -07:00
Seth Hillbrand 53fea46fed Re-order headers to avoid X11 None def
X.h helpfully defines the word "None" because surely no one would ever
use that as a token, right?  Right?
2022-10-19 20:04:00 -07:00
Jeff Young c0a666507c Work around more instances of the wxWidgets color string locale bug.
Fixes https://gitlab.com/kicad/code/kicad/issues/12552
2022-09-30 20:56:25 +01:00
Alex dc07ab9df1 Replace PROF_COUNTER with PROF_TIMER in some conditional places. 2022-09-27 14:07:47 +00:00
Alex d0b4fb7b32 Don't fail when reserving 0 vertices. 2022-09-26 12:18:45 +03:00
Jeff Young 76a7a2b4bc Fix asserting when drawing empty line of text. 2022-09-25 22:20:51 +01:00
Ian McInerney 1683e552f7 Add/fix some variable initializations 2022-09-25 00:48:38 +01:00
Alex bdf4cf51b8 Add a missing statement in segments reservation.
Also adds an assert in FinishItem.

Fixes https://gitlab.com/kicad/code/kicad/issues/12448
2022-09-19 02:36:21 +00:00
dsa-t bd8b737c44 GAL: Do better job at reserving vertices. 2022-09-14 16:07:47 +00:00
jean-pierre charras df35576cf9 fix my previous commit (c0661468) broken. 2022-09-09 19:00:47 +02:00
jean-pierre charras c06614689e OPENGL_GAL: disable bitmap image caching due to serious issues (memory leak)
It was re-enabled by commit cbc3bfbf.
The current code to handle cached bitmaps is no longer compatible with the
current code.
Many cached items are created because a lot of clones are used to manage bitmap images.
Cached items are never cleaned, so a lot of memory is never freed after
using these temporary clones
And caching items do not significantly speedup drawings.
2022-09-09 18:37:30 +02:00
jean-pierre charras c13b938a4b Free memory when unused, forgotten in my commit d4feb59e 2022-09-08 13:07:36 +02:00
jean-pierre charras d4feb59ed9 OPENGL_GAL, draw bitmap: Rebuild the bitmap cache if the bitmap itself was rotated.
Fixes #12378
https://gitlab.com/kicad/code/kicad/issues/12378
Fix also a Coverity warning.
2022-09-08 12:00:43 +02:00
Seth Hillbrand f1261e71d4 Replace boost::optional with std::optional 2022-08-25 15:50:47 -07:00
Marek Roszko fc99b3ba95 Don't link gdiplus everywhere anymore
Tested on msys2 which is the only place it would have been buggy
CMake seems to share the gdiplus linkage with the other dependencies automatically now
2022-08-23 23:51:35 -04:00
jean-pierre charras 4bfbf91369 3D viewer: Fix incorrect behavior when moving the scene
Fixes #12114
https://gitlab.com/kicad/code/kicad/issues/12114
2022-07-30 13:27:25 +02:00
Jeff Young 7386e64923 Attempt to work-around wxWidgets bug with Serbian & Russian locales.
Fixes https://gitlab.com/kicad/code/kicad/issues/12002

Fixes https://gitlab.com/kicad/code/kicad/issues/11963
2022-07-20 17:52:48 +01:00
Mike Williams 3669cb4673 PCB Editor: Add User Background Images 2022-07-14 11:23:23 +00:00
Mike Williams cbc3bfbf08 GAL: Re-enable OpenGL bitmap cache
Might still have issues, re-enabling for wider test.
2022-07-14 11:23:23 +00:00
Mike Williams 3e80963482 GAL: Delete no-effect target changes 2022-07-14 11:23:23 +00:00
Fabien Corona 976670e987 Move 3D controls to a new class 2022-06-21 23:38:22 +00:00
dsa-t 3a76435eda OpenGL: Use glGetProgramiv instead of the extension function. 2022-06-09 19:37:42 +00:00
Mike Williams 857990a883 Hierarchy: turn into a left side pane
Drop auto-closing option as well.
2022-06-02 21:56:17 +00:00
Marek Roszko 417f2f357c Cleanup naming of shader params/uniforms 2022-05-19 07:49:24 -04:00