diff --git a/ios/CanvasView.mm b/ios/CanvasView.mm index cbb2c3ee..48089baa 100644 --- a/ios/CanvasView.mm +++ b/ios/CanvasView.mm @@ -118,22 +118,11 @@ -(void)layoutSubviews { prev = self.frame; self.onReady(@{}); } else { - dispatch_async(dispatch_get_main_queue(), ^{ - self->renderer->resetBounds(SkRect::MakeWH(Helium::toPx(self.frame.size.width), Helium::toPx(self.frame.size.height))); + if(prev.size.width != self.frame.size.width || prev.size.height != self.frame.size.height) { + prev = self.frame; + renderer->resetBounds(SkRect::MakeWH(Helium::toPx(self.frame.size.width), Helium::toPx(self.frame.size.height))); self.onResized(@{}); - self->renderer->draw(); - }); - } -} - --(void)setFrame:(CGRect)frame { - [super setFrame:frame]; - if(ready) { - dispatch_async(dispatch_get_main_queue(), ^{ - self->renderer->resetBounds(SkRect::MakeWH(Helium::toPx(self.frame.size.width), Helium::toPx(self.frame.size.height))); - self.onResized(@{}); - self->renderer->draw(); - }); + } } } diff --git a/ios/MetalLayer.mm b/ios/MetalLayer.mm index d9dff729..66f39f57 100644 --- a/ios/MetalLayer.mm +++ b/ios/MetalLayer.mm @@ -38,14 +38,12 @@ } void MetalLayer::resetSize(int width, int height){ - dispatch_async(dispatch_get_main_queue(), ^{ - if(skContext) { - skContext->purgeUnlockedResources(false); - } + if(skContext) { + skContext->purgeUnlockedResources(false); + } layer.frame = CGRectMake(0, 0, Helium::toDB(width), Helium::toDB(height)); layer.drawableSize = CGSizeMake(width, height); - }); - + } void MetalLayer::draw(std::shared_ptr& renderView) {