mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-17 14:26:17 +02:00
Lock the QML Surface resizing better
This commit is contained in:
parent
b41c106f3c
commit
fe1d8b24b4
1 changed files with 23 additions and 23 deletions
|
@ -241,32 +241,32 @@ void OffscreenQmlRenderThread::cleanup() {
|
||||||
|
|
||||||
void OffscreenQmlRenderThread::resize() {
|
void OffscreenQmlRenderThread::resize() {
|
||||||
// Lock _newSize changes
|
// Lock _newSize changes
|
||||||
QMutexLocker locker(&_mutex);
|
{
|
||||||
|
QMutexLocker locker(&_mutex);
|
||||||
|
|
||||||
// Update our members
|
// Update our members
|
||||||
if (_quickWindow) {
|
if (_quickWindow) {
|
||||||
_quickWindow->setGeometry(QRect(QPoint(), _newSize));
|
_quickWindow->setGeometry(QRect(QPoint(), _newSize));
|
||||||
_quickWindow->contentItem()->setSize(_newSize);
|
_quickWindow->contentItem()->setSize(_newSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Qt bug in 5.4 forces this check of pixel ratio,
|
||||||
|
// even though we're rendering offscreen.
|
||||||
|
qreal pixelRatio = 1.0;
|
||||||
|
if (_renderControl && _renderControl->_renderWindow) {
|
||||||
|
pixelRatio = _renderControl->_renderWindow->devicePixelRatio();
|
||||||
|
}
|
||||||
|
|
||||||
|
uvec2 newOffscreenSize = toGlm(_newSize * pixelRatio);
|
||||||
|
if (newOffscreenSize == _size) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << "Offscreen UI resizing to " << _newSize.width() << "x" << _newSize.height() << " with pixel ratio " << pixelRatio;
|
||||||
|
_size = newOffscreenSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Qt bug in 5.4 forces this check of pixel ratio,
|
_textures.setSize(_size);
|
||||||
// even though we're rendering offscreen.
|
|
||||||
qreal pixelRatio = 1.0;
|
|
||||||
if (_renderControl && _renderControl->_renderWindow) {
|
|
||||||
pixelRatio = _renderControl->_renderWindow->devicePixelRatio();
|
|
||||||
}
|
|
||||||
|
|
||||||
uvec2 newOffscreenSize = toGlm(_newSize * pixelRatio);
|
|
||||||
_textures.setSize(newOffscreenSize);
|
|
||||||
if (newOffscreenSize == _size) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_size = newOffscreenSize;
|
|
||||||
|
|
||||||
qDebug() << "Offscreen UI resizing to " << _newSize.width() << "x" << _newSize.height() << " with pixel ratio " << pixelRatio;
|
|
||||||
|
|
||||||
locker.unlock();
|
|
||||||
|
|
||||||
setupFbo();
|
setupFbo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue