1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

CGMetalLayerRenderer: Avoid creating resources for zero-size layers

This commit is contained in:
reuk 2023-04-19 11:07:47 +01:00
parent c0af8de2f4
commit 1de392bbab
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C

View file

@ -82,6 +82,9 @@ public:
const auto drawableSizeTransform = CGAffineTransformMakeScale (layer.contentsScale, layer.contentsScale);
const auto transformedFrameSize = CGSizeApplyAffineTransform (layer.bounds.size, drawableSizeTransform);
if (CGSizeEqualToSize (transformedFrameSize, CGSizeZero))
return dirtyRegions;
if (resources == nullptr || ! CGSizeEqualToSize (layer.drawableSize, transformedFrameSize))
{
layer.drawableSize = transformedFrameSize;
@ -90,9 +93,6 @@ public:
dirtyRegions.add (convertToRectFloat (layer.bounds));
}
if (CGSizeEqualToSize (transformedFrameSize, CGSizeZero))
return dirtyRegions;
auto gpuTexture = resources->getGpuTexture();
if (gpuTexture == nullptr)