Hi On Sun, Dec 19, 2021 at 6:32 AM Alexander Orzechowski < orzechowski.alexan...@gmail.com> wrote:
> These conditionals should never be false as scale_x and scale_y should > scale the fbw and fbh variables such that the ww and wh variables always > have a greater magnitude. > > Signed-off-by: Alexander Orzechowski <orzechowski.alexan...@gmail.com> > I don't understand how you reached that conclusion. scale_x/scale_y can have various values, from 0.25 manually, or pretty much anything in freescale. Just adding a breakpoint/debug there and you can see they can be false. --- > ui/gtk.c | 27 ++++++--------------------- > 1 file changed, 6 insertions(+), 21 deletions(-) > > diff --git a/ui/gtk.c b/ui/gtk.c > index 824334ff3d..f2d74b253d 100644 > --- a/ui/gtk.c > +++ b/ui/gtk.c > @@ -416,13 +416,8 @@ static void gd_update(DisplayChangeListener *dcl, > ww = gtk_widget_get_allocated_width(vc->gfx.drawing_area); > wh = gtk_widget_get_allocated_height(vc->gfx.drawing_area); > > - mx = my = 0; > - if (ww > fbw) { > - mx = (ww - fbw) / 2; > - } > - if (wh > fbh) { > - my = (wh - fbh) / 2; > - } > + mx = (ww - fbw) / 2; > + my = (wh - fbh) / 2; > > gtk_widget_queue_draw_area(vc->gfx.drawing_area, > mx + x1, my + y1, (x2 - x1), (y2 - y1)); > @@ -801,13 +796,8 @@ static gboolean gd_draw_event(GtkWidget *widget, > cairo_t *cr, void *opaque) > fbw *= vc->gfx.scale_x; > fbh *= vc->gfx.scale_y; > > - mx = my = 0; > - if (ww > fbw) { > - mx = (ww - fbw) / 2; > - } > - if (wh > fbh) { > - my = (wh - fbh) / 2; > - } > + mx = (ww - fbw) / 2; > + my = (wh - fbh) / 2; > > cairo_rectangle(cr, 0, 0, ww, wh); > > @@ -850,13 +840,8 @@ static gboolean gd_motion_event(GtkWidget *widget, > GdkEventMotion *motion, > ws = gdk_window_get_scale_factor( > gtk_widget_get_window(vc->gfx.drawing_area)); > > - mx = my = 0; > - if (ww > fbw) { > - mx = (ww - fbw) / 2; > - } > - if (wh > fbh) { > - my = (wh - fbh) / 2; > - } > + mx = (ww - fbw) / 2; > + my = (wh - fbh) / 2; > > x = (motion->x - mx) / vc->gfx.scale_x * ws; > y = (motion->y - my) / vc->gfx.scale_y * ws; > -- > 2.34.1 > > > -- Marc-André Lureau