1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-30 02:50:05 +00:00

macOS/iOS: Add a Metal layer renderer

This restores the functionality of JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS.
Using this preprocessor flag may avoid Core Graphics rendering much larger regions than
necessary, but the small regions that are rendered will likely be rendered slower.
Whether using this flag improves or degrades the performance of your rendering overall
will be specific to each application.

Previously enabling JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS was ineffective
from versions of macOS around 10.13, but enabling it didn't have any negative impact on
performance. Now enabling JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS may result
in slower rendering.
This commit is contained in:
Tom Poole 2021-09-17 11:51:34 +01:00 committed by reuk
parent 570bcb666a
commit 833c1e590f
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11

View file

@ -1089,14 +1089,17 @@ public:
auto dispatchRectangles = [this] ()
{
if (metalRenderer != nullptr)
if (@available (macOS 10.14, *))
{
return metalRenderer->drawRectangleList ((CAMetalLayer*) view.layer,
(float) [[view window] backingScaleFactor],
view.frame,
getComponent(),
[this] (CGContextRef ctx, CGRect r) { drawRectWithContext (ctx, r); },
deferredRepaints);
if (metalRenderer != nullptr)
{
return metalRenderer->drawRectangleList ((CAMetalLayer*) view.layer,
(float) [[view window] backingScaleFactor],
view.frame,
getComponent(),
[this] (CGContextRef ctx, CGRect r) { drawRectWithContext (ctx, r); },
deferredRepaints);
}
}
for (auto& i : deferredRepaints)