1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00
Commit graph

602 commits

Author SHA1 Message Date
reuk
eecf40ba95 Direct2D: Avoid creating multiple MemoryFontFileLoaders all referencing the same data 2025-11-27 13:25:55 +00:00
Anthony Nicholls
fc29df83b5 Direct2D: Fix an issue with excludeClipRectangle
Without this fix many of the component tests that appear in the
following commit will fail for the Direct2D renderer only.
2025-11-20 17:47:47 +00:00
Anthony Nicholls
c37c18c5b4 macOS: Prevent visual glitches in images
CGImages created from a juce Image may be drawn after or during
changes to the underlying data. This change copies the required
data into a new buffer to ensure the CGImage data is always
independent from the juce image data.
2025-11-20 15:04:46 +00:00
reuk
83e5264c86
Formatting: Remove double-dots from comments and other strings 2025-11-18 15:47:42 +00:00
attila
b72343cf8c Fix font sizing with the software and OpenGL renderers when ascent override is used 2025-10-24 11:22:15 +02:00
reuk
2f1c74981f
FreeType: Make font fallback slightly more robust
On Ubuntu 25.10, which includes Noto Color Emoji, I was seeing that the
FontsDemo would assert when attempting to render non-emoji text using
this font. It appears that FontConfig will tend to return Noto Color
Emoji when this family name is passed, even though the font may not
cover the required character set.

The new strategy is to use FontConfig as before, but then to check the
resolved font for coverage of the string. If the resolved font still
can't render the string, we relax the font matching constraints by
removing the family name from the pattern, then try matching again.
2025-10-20 17:34:48 +01:00
reuk
37cc73ad9f
FreeType: Avoid scanning pfb/pcf fonts
Harfbuzz doesn't support these font formats, so attempting to shape text
using these kinds of fonts will fail.

I noticed this on Ubuntu 25.10 for Arm, which seems to include pfb and
otf versions of some fonts. The FontsDemo would assert in cases where
the pfb font was selected instead of the otf font.
2025-10-20 17:34:48 +01:00
Anthony Nicholls
a5dedd36d5 Android: Address some clang-tidy warnings in Android Studio 2025-09-25 14:56:34 +01:00
Anthony Nicholls
5b0a2b9b80 Font: Cache HarfBuzz fonts and font details 2025-09-25 14:56:34 +01:00
Anthony Nicholls
667b3fae86 LruCache: Make the LRU cache implementation thread safe 2025-09-25 14:56:34 +01:00
Anthony Nicholls
e68627c9ed Smart Pointers: Add a new enum for indicating if a smart point should increment a reference count or not 2025-09-25 14:56:34 +01:00
reuk
1c9947b80e
Android: Use AFontMatcher to locate generic system fonts on supported platforms 2025-09-17 12:50:06 +01:00
reuk
81e4d59da2
Direct2D: Avoid unnecessarily transforming solid colour brush
The changes were not cleared between frames, so they could end up
accumulating and causing floating-point exceptions.
2025-09-11 14:28:23 +01:00
reuk
641497918c
Direct2D: Always call SetTransform for gradient/image brushes
This partly reverts commit ad28684b10.
Prior to that change, getBrush() would always end up calling
SetTransform on gradient/image brushes. This is important because, when
drawing text, we combine the current brush transform with the text
transform. If we don't reset the brush transform each time, these
transforms end up accumulating across frames.
2025-09-09 11:32:00 +01:00
attila
ad28684b10 Tidying: Remove unused code 2025-08-19 16:51:15 +01:00
attila
35fe3ac714 Direct2D: Fix gradient fill when the brush is transformed with not just translation
The code contains a performance optimisation for cases where the world
transform is translation only. In this case instead of applying the
brush transformation first and then the world translation, the order is
reversed. The translation is applied first and then the brush
transformation.

Flipping the transformations however is only correct in the special case
when both transformations are translation only.
2025-08-19 16:51:15 +01:00
attila
bb5a9cbac9 Direct2D: Fix wrong brush transform calculation
This change is practically a no-op, because if the affected branch is
taken, then the world transform was not applied, so transform is a
unity matrix. But if transform was non-unity, then the wrong ordering
would cause an observable error.

Logically the brush transformation is nested inside the world
transformation so the right order is applying the brush transform first
followed by the world transform.
2025-08-19 16:51:15 +01:00
reuk
2712f63628
Graphics: Use unique_ptr instead of raw pointers in RenderingHelpers 2025-08-14 14:13:09 +01:00
attila
fa0ed2801d Fix J8 vertical text placement regression in the software renderer 2025-08-13 17:28:30 +01:00
attila
f97355b9f6 Direct2D: Fix seams between tiles for large bitmaps 2025-07-25 20:45:17 +02:00
attila
19906c9d2f Direct2DGraphicsContextTests: Ignore the image edges to allow for differences in anti-aliasing 2025-07-25 20:45:17 +02:00
attila
3f898f6fee Direct2D: Fix jitter when drawing bitmaps with non-unity scaling
Reverts ca3abbb96d.

Prior to this fix gradually changing the Component scale would lead to
the jittery movement of drawn bitmaps, as their position would be
snapped to an arbitrary integral representation.
2025-07-25 20:45:17 +02:00
attila
5bc44c301f Make Direct2DGraphicsContextTests acceptance criteria stricter 2025-07-25 20:45:17 +02:00
reuk
5bb20e8e04
Direct2DImage: Flush CPU-only changes if necessary when copying images 2025-06-30 20:04:56 +01:00
reuk
a3d64c7784
Typeface: Enable advanced colour glyph rendering on Android
Android 15+ removed the 'legacy' png-based emoji font. Modern Android
versions may include only a COLR-v1-based font, which JUCE cannot
render itself.

As a workaround, on Android, we use a Canvas object to render each emoji
glyph into a bitmap, and then render that bitmap in the same way as a
legacy png-based glyph. This won't look as crisp as rendering COLRv1
glyphs directly, especially at larger sizes, but this is a sufficient
stop-gap for the time being.
2025-06-16 16:59:55 +01:00
reuk
72e345cdd7
Direct2DImage: Add missing data change notification when creating writable BitmapData
The OpenGL renderer listens for imageDataChanged() to invalidated cached
textures.

Before this change, the SimpleFFTDemo would display a static (outdated)
image on Windows when using the OpenGLRenderer.
2025-05-27 18:01:53 +01:00
reuk
415aed4bea
Direct2DImage: Sync CPU storage when creating a BitmapData view over a subsection of the image
When syncing from CPU->GPU storage, we currently copy the entire image
contents. The contents of the CPU backup completely replace the old GPU
image. Therefore, if any pixels need to retain their existing values, we
need to read those pixels before overwriting them. This in turn implies
that, when a BitmapData refers to a subsection of the image, we should
always flush GPU->CPU storage first, so that the subsequent CPU->GPU
sync doesn't clobber pixels outside of the BitmapData region with
outdated values.

It's clear that copying the entire image back and forth could be
suboptimal when writing to image subsections, but to optimise this
process we'd have to keep track of dirty image regions or similar, which
may in turn pessimise more common cases.
2025-05-27 18:01:53 +01:00
reuk
4012677fdf
Direct2DImage: Mark CPU storage as outdated after modifying GPU storage by copying 2025-05-27 18:01:53 +01:00
attila
7fc75c35f9
Android: Suppress availability macro warning 2025-05-19 13:30:27 +01:00
Oli
6972c4f0e3 Direct2D: Fix ETW tracing build errors
This makes Direct2DMetrics and current frameId accessible to implementation subclasses.

It also replaces JUCE_WRITE_TRACE_LOG with JUCE_WRITE_TRACE_LOG_VA as intended in original implementation.

Co-authored-by: Matt Gonzalez <matt@echoaudio.com>
2025-04-30 10:50:52 +01:00
reuk
243d3756fc Direct2D: Hide implementation of RectangleListSpriteBatch::fillRectangles 2025-04-24 13:58:24 +01:00
reuk
49948d5dd4 Direct2D: Remove unused declarations 2025-04-24 13:58:24 +01:00
reuk
98d4ddef87 Direct2D: Move MemoryFontFileLoader to DirectX.cpp 2025-04-24 13:58:24 +01:00
reuk
234e75b2be Direct2D: Move MemoryFontFileFileStream to DirectX.cpp 2025-04-24 13:58:24 +01:00
reuk
96683e49a1 Direct2D: Move FontFileEnumerator to DirectX.cpp 2025-04-24 13:58:24 +01:00
reuk
8d29edec92 Direct2D: Move CompositionTree to Direct2DHwndContext.cpp 2025-04-24 13:58:24 +01:00
reuk
1f6c1737eb Direct2D: Remove declaration of makeGradientStopCollection() 2025-04-24 13:58:24 +01:00
reuk
8d33428dcf Direct2D: Move WindowsScopedEvent to Direct2DHwndContext.cpp 2025-04-24 13:58:24 +01:00
reuk
f56c7faf40 Direct2D: Move SwapChain into Direct2DHwndContext.cpp 2025-04-24 13:58:24 +01:00
reuk
43c9f28d59 Direct2D: Move ScopedGeometryWithSink to Direct2DGraphicsContextImpl.cpp 2025-04-24 13:58:24 +01:00
reuk
137d9820b1 Direct2D: Move D2DHelpers to Direct2DGraphicsContext.cpp 2025-04-24 13:58:24 +01:00
reuk
2aed72d0d7 Direct2D: Move paintPrimitive implementation into Direct2DGraphicsContext 2025-04-24 13:58:24 +01:00
reuk
b061d5f5a4 Direct2D: Hide D2D SavedState in .cpp file 2025-04-24 13:58:24 +01:00
reuk
0071f4741c Direct2D: Make protected members of Pimpl private/public as appropriate 2025-04-24 13:58:24 +01:00
reuk
170b463400 Direct2D: Remove unused hwnd data member from D2DGraphicsContext::Pimpl 2025-04-24 13:58:24 +01:00
reuk
93d227b6af Direct2D: Split declaration and definition of Direct2DGraphicsContext::Pimpl 2025-04-24 13:58:24 +01:00
reuk
352f77083d DirectX: Remove unused ScopedMultithread 2025-04-24 13:58:24 +01:00
reuk
87abc7919b DirectX: Split out function definitions into a separate cpp file 2025-04-24 13:58:24 +01:00
Oli
ca3abbb96d Direct2D: Round virtual texture tile position
This fixes the issue reported here: https://forum.juce.com/t/regression-in-drawimage/65084/5
2025-04-24 13:58:24 +01:00
Oli
5d6cd1f2d7 Direct2DGraphicsContext: Fix rendering for rectangles smaller than 1x1
This should also fix https://forum.juce.com/t/bug-d2d-renderer-does-not-draw-purely-horizontal-vertical-paths/65686/3

Co-authored-by: Matt Gonzalez <matt@echoaudio.com>
2025-04-24 13:58:24 +01:00