Skip to content

Commit

Permalink
atari:gem: Align window content on 16 pixels boundary (faster for bit…
Browse files Browse the repository at this point in the history
…planes modes). Make GEM_clear_rect public function to clear the visible extra space.
  • Loading branch information
pmandin committed Sep 30, 2017
1 parent 3f7719f commit 5420a70
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
32 changes: 26 additions & 6 deletions src/video/gem/SDL_gemevents.c
Expand Up @@ -187,9 +187,9 @@ void GEM_PumpEvents(_THIS)

static int do_messages(_THIS, short *message, short latest_msg_id)
{
int quit, update_work_area, sdl_resize;
int quit, update_work_area, align_work_area, sdl_resize;

quit = update_work_area = sdl_resize = 0;
quit = update_work_area = align_work_area = sdl_resize = 0;
switch (message[0]) {
case MSG_SDL_ID:
quit=(message[1] == latest_msg_id);
Expand All @@ -201,7 +201,7 @@ static int do_messages(_THIS, short *message, short latest_msg_id)
break;
case WM_MOVED:
wind_set(message[3],WF_CURRXYWH,message[4],message[5],message[6],message[7]);
update_work_area = 1;
update_work_area = align_work_area = 1;
break;
case WM_TOPPED:
wind_set(message[3],WF_TOP,message[4],0,0,0);
Expand Down Expand Up @@ -249,11 +249,11 @@ static int do_messages(_THIS, short *message, short latest_msg_id)
0,0);
GEM_refresh_name = SDL_FALSE;
}
update_work_area = 1;
update_work_area = align_work_area = 1;
break;
case WM_SIZED:
wind_set (message[3], WF_CURRXYWH, message[4], message[5], message[6], message[7]);
update_work_area = sdl_resize = 1;
update_work_area = align_work_area = sdl_resize = 1;
GEM_win_fulled = SDL_FALSE; /* Cancel maximized flag */
GEM_lock_redraw = SDL_TRUE; /* Prevent redraw till buffers resized */
break;
Expand All @@ -272,7 +272,7 @@ static int do_messages(_THIS, short *message, short latest_msg_id)
GEM_win_fulled = SDL_TRUE;
}
wind_set (message[3], WF_CURRXYWH, x, y, w, h);
update_work_area = sdl_resize = 1;
update_work_area = align_work_area = sdl_resize = 1;
GEM_lock_redraw = SDL_TRUE; /* Prevent redraw till buffers resized */
}
break;
Expand All @@ -289,6 +289,26 @@ static int do_messages(_THIS, short *message, short latest_msg_id)

if (update_work_area) {
wind_get (message[3], WF_WORKXYWH, &GEM_work_x, &GEM_work_y, &GEM_work_w, &GEM_work_h);

/* Align work area on 16 pixels boundary (faster for bitplanes modes) */
if (align_work_area) {
int aligned_x;
short pxy[4];

aligned_x = GEM_work_x;
if (aligned_x & 15) {
aligned_x = (aligned_x|15)+1;

pxy[0] = GEM_work_x;
pxy[1] = GEM_work_y;
pxy[2] = aligned_x - 1;
pxy[3] = pxy[1] + GEM_work_h - 1;
GEM_clear_rect(this, pxy);
}
GEM_work_w -= (aligned_x - GEM_work_x);
GEM_work_x = aligned_x;
}

if (sdl_resize) {
SDL_PrivateResize(GEM_work_w, GEM_work_h);
}
Expand Down
7 changes: 3 additions & 4 deletions src/video/gem/SDL_gemvideo.c
Expand Up @@ -93,7 +93,6 @@ static void GEM_UpdateRects(_THIS, int numrects, SDL_Rect *rects);
/* Internal functions */
static void GEM_FreeBuffers(_THIS);
static void GEM_ClearScreen(_THIS);
static void GEM_ClearRect(_THIS, short *rect);
static void GEM_SetNewPalette(_THIS, Uint16 newpal[256][3]);
static void GEM_LockScreen(_THIS);
static void GEM_UnlockScreen(_THIS);
Expand Down Expand Up @@ -500,7 +499,7 @@ static void GEM_FreeBuffers(_THIS)
}
}

static void GEM_ClearRect(_THIS, short *rect)
void GEM_clear_rect(_THIS, short *rect)
{
short oldrgb[3], rgb[3]={0,0,0};

Expand All @@ -524,7 +523,7 @@ static void GEM_ClearScreen(_THIS)
pxy[0] = pxy[1] = 0;
pxy[2] = VDI_w - 1;
pxy[3] = VDI_h - 1;
GEM_ClearRect(this, pxy);
GEM_clear_rect(this, pxy);

v_show_c(VDI_handle, 1);
}
Expand Down Expand Up @@ -1204,7 +1203,7 @@ static void refresh_window(_THIS, int winhandle, short *rect)

surface = GEM_icon;

GEM_ClearRect(this, rect);
GEM_clear_rect(this, rect);

/* Calculate centered icon(x,y,w,h) relative to window */
iconx = (wind_pxy[2]-surface->w)>>1;
Expand Down
1 change: 1 addition & 0 deletions src/video/gem/SDL_gemvideo.h
Expand Up @@ -37,6 +37,7 @@ struct WMcursor {

/* Functions prototypes */
void GEM_wind_redraw(_THIS, int winhandle, short *inside);
void GEM_clear_rect(_THIS, short *rect);

/* Private display data */

Expand Down

0 comments on commit 5420a70

Please sign in to comment.