macOS: report the drawable size to the renderer (#4479)

This commit is contained in:
Bouke van der Bijl
2026-08-14 15:31:09 +02:00
committed by GitHub
parent d508e65692
commit 6485d28b3e
2 changed files with 8 additions and 0 deletions

View File

@@ -39,6 +39,8 @@ public:
MLNBackendResource* getObject() override;
void display() override;
void drawableSizeChanged(CGSize size);
private:
bool presentsWithTransaction = true;
};

View File

@@ -25,6 +25,7 @@
}
- (void)mtkView:(MTKView*)view drawableSizeWillChange:(CGSize)size {
_impl->drawableSizeChanged(size);
}
- (void)drawInMTKView:(MTKView*)view {
@@ -134,6 +135,11 @@ MLNMapViewMetalImpl::MLNMapViewMetalImpl(MLNMapView* nativeView_)
resource.presentsWithTransaction = presentsWithTransaction;
[mapView addSubview:resource.mtlView positioned:NSWindowBelow relativeTo:nil];
drawableSizeChanged(resource.mtlView.drawableSize);
}
void MLNMapViewMetalImpl::drawableSizeChanged(CGSize drawableSize) {
size = {static_cast<uint32_t>(drawableSize.width), static_cast<uint32_t>(drawableSize.height)};
}
MLNMapViewMetalImpl::~MLNMapViewMetalImpl() = default;