mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
iOS: Enable support for layered/async drawing
This commit is contained in:
parent
bc796b1636
commit
bad031aa03
4 changed files with 47 additions and 16 deletions
|
|
@ -4,6 +4,27 @@ JUCE breaking changes
|
|||
Develop
|
||||
=======
|
||||
|
||||
Change
|
||||
------
|
||||
The functions `getComponentAsyncLayerBackedViewDisabled`
|
||||
and `setComponentAsyncLayerBackedViewDisabled` were moved into the juce
|
||||
namespace.
|
||||
|
||||
Possible Issues
|
||||
---------------
|
||||
Code that declares these functions may fail to link.
|
||||
|
||||
Workaround
|
||||
----------
|
||||
Move declarations of these functions into the juce namespace.
|
||||
|
||||
Rationale
|
||||
---------
|
||||
Although the names of these functions are unlikely to collide with functions
|
||||
from other libraries, we can make such collisions much more unlikely by keeping
|
||||
JUCE code in the juce namespace.
|
||||
|
||||
|
||||
Change
|
||||
------
|
||||
The `juce_blocks_basics` module was removed.
|
||||
|
|
|
|||
|
|
@ -236,6 +236,25 @@ namespace juce
|
|||
#include "native/juce_MultiTouchMapper.h"
|
||||
#endif
|
||||
|
||||
namespace juce
|
||||
{
|
||||
|
||||
static const juce::Identifier disableAsyncLayerBackedViewIdentifier { "disableAsyncLayerBackedView" };
|
||||
|
||||
/** 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];
|
||||
}
|
||||
|
||||
} // namespace juce
|
||||
|
||||
#if JUCE_MAC || JUCE_IOS
|
||||
#if JUCE_IOS
|
||||
#include "native/juce_ios_UIViewComponentPeer.mm"
|
||||
|
|
|
|||
|
|
@ -583,6 +583,13 @@ UIViewComponentPeer::UIViewComponentPeer (Component& comp, int windowStyleFlags,
|
|||
view.opaque = component.isOpaque();
|
||||
view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent: 0];
|
||||
|
||||
#if JUCE_COREGRAPHICS_DRAW_ASYNC
|
||||
if (! getComponentAsyncLayerBackedViewDisabled (component))
|
||||
{
|
||||
[[view layer] setDrawsAsynchronously: YES];
|
||||
}
|
||||
#endif
|
||||
|
||||
if (isSharedWindow)
|
||||
{
|
||||
window = [viewToAttachTo window];
|
||||
|
|
|
|||
|
|
@ -28,22 +28,6 @@
|
|||
- (float)deviceDeltaY;
|
||||
@end
|
||||
|
||||
//==============================================================================
|
||||
#if defined (MAC_OS_X_VERSION_10_8) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8) \
|
||||
&& USE_COREGRAPHICS_RENDERING && JUCE_COREGRAPHICS_DRAW_ASYNC
|
||||
static const juce::Identifier disableAsyncLayerBackedViewIdentifier { "disableAsyncLayerBackedView" };
|
||||
|
||||
void setComponentAsyncLayerBackedViewDisabled (juce::Component& comp, bool shouldDisableAsyncLayerBackedView)
|
||||
{
|
||||
comp.getProperties().set (disableAsyncLayerBackedViewIdentifier, shouldDisableAsyncLayerBackedView);
|
||||
}
|
||||
|
||||
bool getComponentAsyncLayerBackedViewDisabled (juce::Component& comp)
|
||||
{
|
||||
return comp.getProperties()[disableAsyncLayerBackedViewIdentifier];
|
||||
}
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
namespace juce
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue