Calculate correct surface-to-buffer matrix with only upscaled viewport
Currently, if a wp_viewport upscales the surface but doesn't set the source rectangle, the surface-to-buffer matrix will be calculated incorrectly. If the source rect is not set, we need to calculate the source size based on the buffer size and compare it with the destination size. If the two are not the same, add a scale transform. BUG: 445346
This commit is contained in:
parent
357b5c1923
commit
f72c2196c7
1 changed files with 11 additions and 2 deletions
|
@ -434,8 +434,17 @@ QMatrix4x4 SurfaceInterfacePrivate::buildSurfaceToBufferMatrix()
|
||||||
|
|
||||||
if (current.viewport.sourceGeometry.isValid()) {
|
if (current.viewport.sourceGeometry.isValid()) {
|
||||||
surfaceToBufferMatrix.translate(current.viewport.sourceGeometry.x(), current.viewport.sourceGeometry.y());
|
surfaceToBufferMatrix.translate(current.viewport.sourceGeometry.x(), current.viewport.sourceGeometry.y());
|
||||||
surfaceToBufferMatrix.scale(current.viewport.sourceGeometry.width() / surfaceSize.width(),
|
}
|
||||||
current.viewport.sourceGeometry.height() / surfaceSize.height());
|
|
||||||
|
QSizeF sourceSize;
|
||||||
|
if (current.viewport.sourceGeometry.isValid()) {
|
||||||
|
sourceSize = current.viewport.sourceGeometry.size();
|
||||||
|
} else {
|
||||||
|
sourceSize = bufferSize / current.bufferScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sourceSize != surfaceSize) {
|
||||||
|
surfaceToBufferMatrix.scale(sourceSize.width() / surfaceSize.width(), sourceSize.height() / surfaceSize.height());
|
||||||
}
|
}
|
||||||
|
|
||||||
return surfaceToBufferMatrix;
|
return surfaceToBufferMatrix;
|
||||||
|
|
Loading…
Reference in a new issue