ui/gtk: Use consistent naming for variables in different coordinates

Now that we've documented definitions and presentation of various
coordinates, let's enforce the rules.

Signed-off-by: Weifeng Liu <weifeng.liu.z@gmail.com>
Message-ID: <20250511073337.876650-3-weifeng.liu.z@gmail.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Weifeng Liu 2025-05-11 15:33:12 +08:00 committed by Marc-André Lureau
parent 9498e2f7e1
commit 3a6b314409
3 changed files with 82 additions and 77 deletions

View file

@ -42,16 +42,16 @@ void gd_gl_area_draw(VirtualConsole *vc)
#ifdef CONFIG_GBM
QemuDmaBuf *dmabuf = vc->gfx.guest_fb.dmabuf;
#endif
int ww, wh, ws, y1, y2;
int pw, ph, gs, y1, y2;
if (!vc->gfx.gls) {
return;
}
gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area));
ws = gdk_window_get_scale_factor(gtk_widget_get_window(vc->gfx.drawing_area));
ww = gtk_widget_get_allocated_width(vc->gfx.drawing_area) * ws;
wh = gtk_widget_get_allocated_height(vc->gfx.drawing_area) * ws;
gs = gdk_window_get_scale_factor(gtk_widget_get_window(vc->gfx.drawing_area));
pw = gtk_widget_get_allocated_width(vc->gfx.drawing_area) * gs;
ph = gtk_widget_get_allocated_height(vc->gfx.drawing_area) * gs;
if (vc->gfx.scanout_mode) {
if (!vc->gfx.guest_fb.framebuffer) {
@ -71,11 +71,11 @@ void gd_gl_area_draw(VirtualConsole *vc)
glBindFramebuffer(GL_READ_FRAMEBUFFER, vc->gfx.guest_fb.framebuffer);
/* GtkGLArea sets GL_DRAW_FRAMEBUFFER for us */
glViewport(0, 0, ww, wh);
glViewport(0, 0, pw, ph);
y1 = vc->gfx.y0_top ? 0 : vc->gfx.h;
y2 = vc->gfx.y0_top ? vc->gfx.h : 0;
glBlitFramebuffer(0, y1, vc->gfx.w, y2,
0, 0, ww, wh,
0, 0, pw, ph,
GL_COLOR_BUFFER_BIT, GL_NEAREST);
#ifdef CONFIG_GBM
if (dmabuf) {
@ -101,7 +101,7 @@ void gd_gl_area_draw(VirtualConsole *vc)
}
gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area));
surface_gl_setup_viewport(vc->gfx.gls, vc->gfx.ds, ww, wh);
surface_gl_setup_viewport(vc->gfx.gls, vc->gfx.ds, pw, ph);
surface_gl_render_texture(vc->gfx.gls, vc->gfx.ds);
}
}