rhi: metal: Use scale from the layer we already have
...so that we do not need to call devicePixelRatio() again, which means one less UI Thread Checker warning in Xcode. Task-number: QTBUG-97518 Change-Id: I01d54ea113788cd0b141e124a47940f5cd3efabb Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 8e5806b6807df0d39f3bbd2a1c0ed590426e1aa0)
This commit is contained in:
parent
755d7af3eb
commit
9579e7581b
@ -5596,8 +5596,9 @@ bool QMetalSwapChain::createOrResize()
|
||||
int width = (int)d->layer.bounds.size.width;
|
||||
int height = (int)d->layer.bounds.size.height;
|
||||
CGSize layerSize = CGSizeMake(width, height);
|
||||
layerSize.width *= d->layer.contentsScale;
|
||||
layerSize.height *= d->layer.contentsScale;
|
||||
const float scaleFactor = d->layer.contentsScale;
|
||||
layerSize.width *= scaleFactor;
|
||||
layerSize.height *= scaleFactor;
|
||||
d->layer.drawableSize = layerSize;
|
||||
|
||||
m_currentPixelSize = QSizeF::fromCGSize(layerSize).toSize();
|
||||
@ -5636,12 +5637,13 @@ bool QMetalSwapChain::createOrResize()
|
||||
|
||||
rtWrapper.setRenderPassDescriptor(m_renderPassDesc); // for the public getter in QRhiRenderTarget
|
||||
rtWrapper.d->pixelSize = pixelSize;
|
||||
rtWrapper.d->dpr = float(window->devicePixelRatio());
|
||||
rtWrapper.d->dpr = scaleFactor;
|
||||
rtWrapper.d->sampleCount = samples;
|
||||
rtWrapper.d->colorAttCount = 1;
|
||||
rtWrapper.d->dsAttCount = ds ? 1 : 0;
|
||||
|
||||
qCDebug(QRHI_LOG_INFO, "got CAMetalLayer, size %dx%d", pixelSize.width(), pixelSize.height());
|
||||
qCDebug(QRHI_LOG_INFO, "got CAMetalLayer, pixel size %dx%d (scale %.2f)",
|
||||
pixelSize.width(), pixelSize.height(), scaleFactor);
|
||||
|
||||
if (samples > 1) {
|
||||
MTLTextureDescriptor *desc = [[MTLTextureDescriptor alloc] init];
|
||||
|
Loading…
x
Reference in New Issue
Block a user