diff --git a/BREAKING-CHANGES.txt b/BREAKING-CHANGES.txt index 396e056563..c1902281f0 100644 --- a/BREAKING-CHANGES.txt +++ b/BREAKING-CHANGES.txt @@ -4,6 +4,32 @@ JUCE breaking changes develop ======= +Change +------ +The optional JUCE_COREGRAPHICS_DRAW_ASYNC preprocessor flag has been removed +and asynchronous Core Graphics rendering is now the default. The helper +function setComponentAsyncLayerBackedViewDisabled has also been removed. + +Possible Issues +--------------- +Components that were previously using setComponentAsyncLayerBackedViewDisabled +to conditionally opt out of asynchronous Core Graphics rendering will no longer +be able to do so. + +Workaround +---------- +To opt out of asynchronous Core Graphics rendering the +windowRequiresSynchronousCoreGraphicsRendering ComponentPeer style flag can be +used when adding a component to the desktop. + +Rationale +--------- +Asynchronous Core Graphics rendering provides a substantial performance +benefit. Asynchronous rendering is a property of a Peer, rather than a +Component, so a Peer style flag to conditionally opt out of asynchronous +rendering is more appropriate. + + Change ------ Constructors of AudioParameterBool, AudioParameterChoice, AudioParameterFloat, diff --git a/modules/juce_gui_basics/juce_gui_basics.cpp b/modules/juce_gui_basics/juce_gui_basics.cpp index 427cf957d5..217402c4ef 100644 --- a/modules/juce_gui_basics/juce_gui_basics.cpp +++ b/modules/juce_gui_basics/juce_gui_basics.cpp @@ -254,29 +254,6 @@ namespace juce #include "native/accessibility/juce_AccessibilityTextHelpers.h" #endif -namespace juce -{ - -static const juce::Identifier disableAsyncLayerBackedViewIdentifier { "disableAsyncLayerBackedView" }; - -JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wmissing-prototypes") - -/** Used by the macOS and iOS peers. */ -void setComponentAsyncLayerBackedViewDisabled (juce::Component& comp, bool shouldDisableAsyncLayerBackedView) -{ - comp.getProperties().set (disableAsyncLayerBackedViewIdentifier, shouldDisableAsyncLayerBackedView); -} - -/** Used by the macOS and iOS peers. */ -bool getComponentAsyncLayerBackedViewDisabled (juce::Component& comp) -{ - return comp.getProperties()[disableAsyncLayerBackedViewIdentifier]; -} - -JUCE_END_IGNORE_WARNINGS_GCC_LIKE - -} // namespace juce - #if JUCE_MAC || JUCE_IOS #include "native/accessibility/juce_mac_AccessibilitySharedCode.mm" diff --git a/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm index 8ab9a97514..b0e37c2b18 100644 --- a/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm @@ -659,10 +659,8 @@ UIViewComponentPeer::UIViewComponentPeer (Component& comp, int windowStyleFlags, view.opaque = component.isOpaque(); view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent: 0]; - #if JUCE_COREGRAPHICS_DRAW_ASYNC - if (! getComponentAsyncLayerBackedViewDisabled (component)) + if ((windowStyleFlags & ComponentPeer::windowRequiresSynchronousCoreGraphicsRendering) == 0) [[view layer] setDrawsAsynchronously: YES]; - #endif if (isSharedWindow) { diff --git a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm index c120c94f75..84aa3f9cef 100644 --- a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm @@ -134,8 +134,8 @@ public: [view setPostsFrameChangedNotifications: YES]; - #if USE_COREGRAPHICS_RENDERING && JUCE_COREGRAPHICS_DRAW_ASYNC - if (! getComponentAsyncLayerBackedViewDisabled (component)) + #if USE_COREGRAPHICS_RENDERING + if ((windowStyleFlags & ComponentPeer::windowRequiresSynchronousCoreGraphicsRendering) == 0) { if (@available (macOS 10.8, *)) { @@ -776,11 +776,9 @@ public: name: NSWindowWillMiniaturizeNotification object: currentWindow]; - #if JUCE_COREGRAPHICS_DRAW_ASYNC [notificationCenter removeObserver: view name: NSWindowDidBecomeKeyNotification object: currentWindow]; - #endif } if (isSharedWindow && [view window] == window && newWindow == nullptr) diff --git a/modules/juce_gui_basics/windows/juce_ComponentPeer.h b/modules/juce_gui_basics/windows/juce_ComponentPeer.h index e88e12f876..7733756c7c 100644 --- a/modules/juce_gui_basics/windows/juce_ComponentPeer.h +++ b/modules/juce_gui_basics/windows/juce_ComponentPeer.h @@ -40,31 +40,35 @@ public: /** A combination of these flags is passed to the ComponentPeer constructor. */ enum StyleFlags { - windowAppearsOnTaskbar = (1 << 0), /**< Indicates that the window should have a corresponding - entry on the taskbar (ignored on MacOSX) */ - windowIsTemporary = (1 << 1), /**< Indicates that the window is a temporary popup, like a menu, - tooltip, etc. */ - windowIgnoresMouseClicks = (1 << 2), /**< Indicates that the window should let mouse clicks pass - through it (may not be possible on some platforms). */ - windowHasTitleBar = (1 << 3), /**< Indicates that the window should have a normal OS-specific - title bar and frame. if not specified, the window will be - borderless. */ - windowIsResizable = (1 << 4), /**< Indicates that the window should have a resizable border. */ - windowHasMinimiseButton = (1 << 5), /**< Indicates that if the window has a title bar, it should have a - minimise button on it. */ - windowHasMaximiseButton = (1 << 6), /**< Indicates that if the window has a title bar, it should have a - maximise button on it. */ - windowHasCloseButton = (1 << 7), /**< Indicates that if the window has a title bar, it should have a - close button on it. */ - windowHasDropShadow = (1 << 8), /**< Indicates that the window should have a drop-shadow (this may - not be possible on all platforms). */ - windowRepaintedExplictly = (1 << 9), /**< Not intended for public use - this tells a window not to - do its own repainting, but only to repaint when the - performAnyPendingRepaintsNow() method is called. */ - windowIgnoresKeyPresses = (1 << 10), /**< Tells the window not to catch any keypresses. This can - be used for things like plugin windows, to stop them interfering - with the host's shortcut keys. */ - windowIsSemiTransparent = (1 << 30) /**< Not intended for public use - makes a window transparent. */ + windowAppearsOnTaskbar = (1 << 0), /**< Indicates that the window should have a corresponding + entry on the taskbar (ignored on MacOSX) */ + windowIsTemporary = (1 << 1), /**< Indicates that the window is a temporary popup, like a menu, + tooltip, etc. */ + windowIgnoresMouseClicks = (1 << 2), /**< Indicates that the window should let mouse clicks pass + through it (may not be possible on some platforms). */ + windowHasTitleBar = (1 << 3), /**< Indicates that the window should have a normal OS-specific + title bar and frame. if not specified, the window will be + borderless. */ + windowIsResizable = (1 << 4), /**< Indicates that the window should have a resizable border. */ + windowHasMinimiseButton = (1 << 5), /**< Indicates that if the window has a title bar, it should have a + minimise button on it. */ + windowHasMaximiseButton = (1 << 6), /**< Indicates that if the window has a title bar, it should have a + maximise button on it. */ + windowHasCloseButton = (1 << 7), /**< Indicates that if the window has a title bar, it should have a + close button on it. */ + windowHasDropShadow = (1 << 8), /**< Indicates that the window should have a drop-shadow (this may + not be possible on all platforms). */ + windowRepaintedExplictly = (1 << 9), /**< Not intended for public use - this tells a window not to + do its own repainting, but only to repaint when the + performAnyPendingRepaintsNow() method is called. */ + windowIgnoresKeyPresses = (1 << 10), /**< Tells the window not to catch any keypresses. This can + be used for things like plugin windows, to stop them interfering + with the host's shortcut keys. */ + windowRequiresSynchronousCoreGraphicsRendering = (1 << 11), /**< Indicates that the window should not be rendered with + asynchronous Core Graphics drawing operations. Use this if there + are issues with regions not being redrawn at the expected time + (macOS and iOS only). */ + windowIsSemiTransparent = (1 << 30) /**< Not intended for public use - makes a window transparent. */ };