summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-09-19 18:15:18 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-09-23 13:59:00 +0200
commit0642ca3528b1020acf1deadf8bf6d374c0db05f7 (patch)
tree1ede19f3ba7b09fab82b900b7ef4316d1b4cfaf5 /src/plugins/platforms/cocoa
parent04dcc902eb64d94653a12005f3aedf32be1011c3 (diff)
macOS: Don't update Metal layer's drawableSize automatically
Like our other rendering code paths, the Metal path should allow the user to resize their surface when they see fit. This is the case today with e.g QBackingStore::resize() and QOpenGLPaintDevice::setSize(). [ChangeLog][macOS] The drawableSize of Metal layers is no longer updated automatically on window resize or screen change. Update the size manually in response to resizeEvent(), or at the start of each frame, as needed. Change-Id: I9ed6d4326d0e0a3f4e3c63984d3b193e8bb77cae Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r--src/plugins/platforms/cocoa/qnsview_drawing.mm23
1 files changed, 2 insertions, 21 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview_drawing.mm b/src/plugins/platforms/cocoa/qnsview_drawing.mm
index de93e03685..e72142466b 100644
--- a/src/plugins/platforms/cocoa/qnsview_drawing.mm
+++ b/src/plugins/platforms/cocoa/qnsview_drawing.mm
@@ -173,20 +173,6 @@
}
#endif
-- (void)updateMetalLayerDrawableSize:(CAMetalLayer *)layer
-{
- CGSize drawableSize = layer.bounds.size;
- drawableSize.width *= layer.contentsScale;
- drawableSize.height *= layer.contentsScale;
- layer.drawableSize = drawableSize;
-}
-
-- (void)layoutSublayersOfLayer:(CALayer *)layer
-{
- if ([layer isKindOfClass:CAMetalLayer.class])
- [self updateMetalLayerDrawableSize:static_cast<CAMetalLayer* >(layer)];
-}
-
- (void)displayLayer:(CALayer *)layer
{
if (!NSThread.isMainThread) {
@@ -213,13 +199,8 @@
{
qCDebug(lcQpaDrawing) << "Backing properties changed for" << self;
- if (CALayer *layer = self.layer) {
- layer.contentsScale = self.window.backingScaleFactor;
-
- // Metal layers must be manually updated on e.g. screen change
- if ([layer isKindOfClass:CAMetalLayer.class])
- [self updateMetalLayerDrawableSize:static_cast<CAMetalLayer* >(layer)];
- }
+ if (self.layer)
+ self.layer.contentsScale = self.window.backingScaleFactor;
// Ideally we would plumb this situation through QPA in a way that lets
// clients invalidate their own caches, recreate QBackingStore, etc.