1
0
mirror of git://projects.qi-hardware.com/antorcha.git synced 2024-11-01 05:43:09 +02:00

tools/ant-gui/ant-gui.c (gui): fix scrolling

This commit is contained in:
Werner Almesberger 2012-11-01 20:18:57 -03:00
parent 2eaa1224cf
commit be1515daac

View File

@ -131,12 +131,12 @@ static void gui(uint8_t *const *imgs, int n)
SDL_FillRect(surf, NULL, SDL_MapRGB(surf->format, 0, 0, 0)); SDL_FillRect(surf, NULL, SDL_MapRGB(surf->format, 0, 0, 0));
for (iy = 0; iy != NY; iy++) for (iy = 0; iy != NY; iy++)
for (ix = 0; ix != NX; ix++) { for (ix = 0; ix != NX; ix++) {
i = iy*NX+ix; i = (y_top+iy)*NX+ix;
if (i >= n) if (i >= n)
break; break;
render(surf, imgs[i], render(surf, imgs[i],
ix*(W+GAP), (iy-y_top)*(H+GAP), ix*(W+GAP), iy*(H+GAP),
ix == x && iy == y, i == active); ix == x && y_top+iy == y, i == active);
} }
SDL_UnlockSurface(surf); SDL_UnlockSurface(surf);
SDL_UpdateRect(surf, 0, 0, 0, 0); SDL_UpdateRect(surf, 0, 0, 0, 0);