wasm: use correct geometry when drawing window decorations

We were drawing window decorations at an incorrect location in
cases where the QScreen was not at (0,0) (i.e. at an offset on
the web page). Window content was placed correctly.

Correct canvas geometry can be fond by offsetting window geometry by the
negative screen position. Implement this for drawWindowDecorations(), and
also simplify the existing code in drawWindowContent().

Change-Id: I1347d325a58dae5e2bb950b93902123f64199ee8
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: David Skoland <david.skoland@qt.io>
This commit is contained in:
Morten Sørvig 2022-05-13 10:52:51 +02:00
parent af59c56dc1
commit 69ad72b05c

View File

@ -326,8 +326,7 @@ void QWasmCompositor::drawWindowContent(QOpenGLTextureBlitter *blitter, QWasmScr
return;
QOpenGLTexture const *texture = backingStore->getUpdatedTexture();
QPoint windowCanvasPosition = window->geometry().topLeft() - screen->geometry().topLeft();
QRect windowCanvasGeometry = QRect(windowCanvasPosition, window->geometry().size());
QRect windowCanvasGeometry = window->geometry().translated(-screen->geometry().topLeft());
blit(blitter, screen, texture, windowCanvasGeometry);
}
@ -585,7 +584,8 @@ void QWasmCompositor::drawWindowDecorations(QOpenGLTextureBlitter *blitter, QWas
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, image.width(), image.height(), GL_RGBA, GL_UNSIGNED_BYTE,
image.constScanLine(0));
blit(blitter, screen, &texture, QRect(window->windowFrameGeometry().topLeft(), QSize(width, height)));
QRect windowCanvasGeometry = window->windowFrameGeometry().translated(-screen->geometry().topLeft());
blit(blitter, screen, &texture, windowCanvasGeometry);
}
void QWasmCompositor::drawFrameWindow(QWasmFrameOptions options, QPainter *painter)