mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-24 01:54:22 +00:00
CGMetalLayerRenderer: Fix crash when attempting to render zero-sized components
This commit is contained in:
parent
dcef8b88b2
commit
208be3dd5e
1 changed files with 7 additions and 2 deletions
|
|
@ -86,9 +86,13 @@ public:
|
|||
{
|
||||
layer.drawableSize = transformedFrameSize;
|
||||
resources = std::make_unique<Resources> (device.get(), layer);
|
||||
dirtyRegions = convertToRectFloat (layer.bounds);
|
||||
dirtyRegions.clear();
|
||||
dirtyRegions.add (convertToRectFloat (layer.bounds));
|
||||
}
|
||||
|
||||
if (CGSizeEqualToSize (transformedFrameSize, CGSizeZero))
|
||||
return dirtyRegions;
|
||||
|
||||
auto gpuTexture = resources->getGpuTexture();
|
||||
|
||||
if (gpuTexture == nullptr)
|
||||
|
|
@ -209,7 +213,8 @@ private:
|
|||
GpuTexturePool (id<MTLDevice> metalDevice, MTLTextureDescriptor* descriptor)
|
||||
{
|
||||
for (auto& t : textureCache)
|
||||
t.reset ([metalDevice newTextureWithDescriptor: descriptor]);
|
||||
t.reset ((descriptor.width != 0 && descriptor.height != 0) ? [metalDevice newTextureWithDescriptor: descriptor]
|
||||
: nullptr);
|
||||
}
|
||||
|
||||
id<MTLTexture> take() const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue