Reduce repeated Screens::scale(int)

This commit is contained in:
Aleix Pol 2020-09-09 03:48:01 +02:00 committed by Aleix Pol Gonzalez
parent 75321a2166
commit 76fbb43798

View file

@ -627,14 +627,15 @@ qint64 SceneOpenGL::paint(const QRegion &damage, const QList<Toplevel *> &toplev
m_backend->prepareRenderingFrame();
for (int i = 0; i < screens()->count(); ++i) {
const QRect &geo = screens()->geometry(i);
const qreal scaling = screens()->scale(i);
QRegion update;
QRegion valid;
// prepare rendering makes context current on the output
QRegion repaint = m_backend->prepareRenderingForScreen(i);
GLVertexBuffer::setVirtualScreenGeometry(geo);
GLRenderTarget::setVirtualScreenGeometry(geo);
GLVertexBuffer::setVirtualScreenScale(screens()->scale(i));
GLRenderTarget::setVirtualScreenScale(screens()->scale(i));
GLVertexBuffer::setVirtualScreenScale(scaling);
GLRenderTarget::setVirtualScreenScale(scaling);
const GLenum status = glGetGraphicsResetStatus();
if (status != GL_NO_ERROR) {
@ -644,7 +645,8 @@ qint64 SceneOpenGL::paint(const QRegion &damage, const QList<Toplevel *> &toplev
int mask = 0;
updateProjectionMatrix();
paintScreen(&mask, damage.intersected(geo), repaint, &update, &valid, projectionMatrix(), geo, screens()->scale(i)); // call generic implementation
paintScreen(&mask, damage.intersected(geo), repaint, &update, &valid, projectionMatrix(), geo, scaling); // call generic implementation
paintCursor();
GLVertexBuffer::streamingBuffer()->endOfFrame();