From 6485d28b3eb43ac6687cd7faeae9ad74c1a5b00b Mon Sep 17 00:00:00 2001 From: Bouke van der Bijl Date: Fri, 14 Aug 2026 15:31:09 +0200 Subject: [PATCH] macOS: report the drawable size to the renderer (#4479) --- platform/macos/src/MLNMapView+Metal.h | 2 ++ platform/macos/src/MLNMapView+Metal.mm | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/platform/macos/src/MLNMapView+Metal.h b/platform/macos/src/MLNMapView+Metal.h index d24778f98..b2ea4995b 100644 --- a/platform/macos/src/MLNMapView+Metal.h +++ b/platform/macos/src/MLNMapView+Metal.h @@ -39,6 +39,8 @@ public: MLNBackendResource* getObject() override; void display() override; + void drawableSizeChanged(CGSize size); + private: bool presentsWithTransaction = true; }; diff --git a/platform/macos/src/MLNMapView+Metal.mm b/platform/macos/src/MLNMapView+Metal.mm index bc4f9c42c..126cc1482 100644 --- a/platform/macos/src/MLNMapView+Metal.mm +++ b/platform/macos/src/MLNMapView+Metal.mm @@ -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(drawableSize.width), static_cast(drawableSize.height)}; } MLNMapViewMetalImpl::~MLNMapViewMetalImpl() = default;