Browse Source

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.
pull/22/head
Tom Poole reuk 4 years ago
parent
commit
833c1e590f
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
1 changed files with 10 additions and 7 deletions
  1. +10
    -7
      modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm

+ 10
- 7
modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm 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)


Loading…
Cancel
Save