Skip to content

Commit

Permalink
atari:gem: Align window work area on 16-pixels boundary (faster for b…
Browse files Browse the repository at this point in the history
…itplanes modes). Remove commented function GEM_ToggleFullscreen not used, and some extra whitespaces.
  • Loading branch information
pmandin committed Sep 30, 2017
1 parent 4c4e3fb commit e77831e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 40 deletions.
22 changes: 14 additions & 8 deletions src/video/gem/SDL_gemevents.c
Expand Up @@ -24,7 +24,7 @@
/*
* GEM SDL video driver implementation
* inspired from the Dummy SDL driver
*
*
* Patrice Mandin
* and work from
* Olivier Landemarre, Johan Klockars, Xavier Joubert, Claude Attard
Expand Down Expand Up @@ -161,7 +161,7 @@ void GEM_PumpEvents(_THIS)
if (gem_currentkeyboard[i] && !gem_previouskeyboard[i])
SDL_PrivateKeyboard(SDL_PRESSED,
SDL_Atari_TranslateKey(i, &keysym, SDL_TRUE));

/* Key unpressed ? */
if (gem_previouskeyboard[i] && !gem_currentkeyboard[i])
SDL_PrivateKeyboard(SDL_RELEASED,
Expand Down Expand Up @@ -196,7 +196,7 @@ static int do_messages(_THIS, short *message, short latest_msg_id)
quit=(message[1] == latest_msg_id);
break;
case WM_CLOSED:
case AP_TERM:
case AP_TERM:
SDL_PrivateQuit();
quit=1;
break;
Expand Down Expand Up @@ -227,7 +227,10 @@ static int do_messages(_THIS, short *message, short latest_msg_id)
}
/* Update window title */
if (GEM_refresh_name && GEM_icon_name) {
wind_set(GEM_handle,WF_NAME,(short)(((unsigned long)GEM_icon_name)>>16),(short)(((unsigned long)GEM_icon_name) & 0xffff),0,0);
wind_set(GEM_handle,WF_NAME,
(short)(((unsigned long)GEM_icon_name)>>16),
(short)(((unsigned long)GEM_icon_name) & 0xffff),
0,0);
GEM_refresh_name = SDL_FALSE;
}
break;
Expand All @@ -239,7 +242,10 @@ static int do_messages(_THIS, short *message, short latest_msg_id)
SDL_PrivateAppActive(1, SDL_APPACTIVE);
}
if (GEM_refresh_name && GEM_title_name) {
wind_set(GEM_handle,WF_NAME,(short)(((unsigned long)GEM_title_name)>>16),(short)(((unsigned long)GEM_title_name) & 0xffff),0,0);
wind_set(GEM_handle,WF_NAME,
(short)(((unsigned long)GEM_title_name)>>16),
(short)(((unsigned long)GEM_title_name) & 0xffff),
0,0);
GEM_refresh_name = SDL_FALSE;
}
break;
Expand Down Expand Up @@ -280,7 +286,7 @@ static int do_messages(_THIS, short *message, short latest_msg_id)
}
break;
}

return quit;
}

Expand Down Expand Up @@ -383,10 +389,10 @@ static void do_mouse_buttons(_THIS, short mb)

for (i=0;i<3;i++) {
int curbutton, prevbutton;

curbutton = mb & (1<<i);
prevbutton = prevmb & (1<<i);

if (curbutton && !prevbutton) {
SDL_PrivateMouseButton(SDL_PRESSED, i+1, 0, 0);
}
Expand Down
56 changes: 24 additions & 32 deletions src/video/gem/SDL_gemvideo.c
Expand Up @@ -89,9 +89,6 @@ static int GEM_FlipHWSurface(_THIS, SDL_Surface *surface);
static void GEM_UnlockHWSurface(_THIS, SDL_Surface *surface);
static void GEM_FreeHWSurface(_THIS, SDL_Surface *surface);
static void GEM_UpdateRects(_THIS, int numrects, SDL_Rect *rects);
#if 0
static int GEM_ToggleFullScreen(_THIS, int on);
#endif

/* Internal functions */
static void GEM_FreeBuffers(_THIS);
Expand Down Expand Up @@ -162,7 +159,7 @@ static SDL_VideoDevice *GEM_CreateDevice(int devindex)
device->UnlockHWSurface = GEM_UnlockHWSurface;
device->FlipHWSurface = GEM_FlipHWSurface;
device->FreeHWSurface = GEM_FreeHWSurface;
device->ToggleFullScreen = NULL /*GEM_ToggleFullScreen*/;
device->ToggleFullScreen = NULL;

/* Window manager */
device->SetCaption = GEM_SetCaption;
Expand Down Expand Up @@ -223,7 +220,7 @@ static void VDI_ReadExtInfo(_THIS, short *work_out)
if (Getcookie(C_EdDI, &cookie_EdDI) != C_FOUND) {
return;
}

EdDI_version = Atari_get_EdDI_version( (void *)cookie_EdDI);

vq_scrninfo(VDI_handle, work_out);
Expand Down Expand Up @@ -314,14 +311,14 @@ int GEM_VideoInit(_THIS, SDL_PixelFormat *vformat)
GEM_version = aes_global[0];
if (GEM_version >= 0x0410) {
short ap_gout[4], errorcode;

GEM_wfeatures=0;
errorcode=appl_getinfo(AES_WINDOW, &ap_gout[0], &ap_gout[1], &ap_gout[2], &ap_gout[3]);

if (errorcode==0) {
GEM_wfeatures=ap_gout[0];
GEM_wfeatures=ap_gout[0];
}
}
}

/* Ask VDI physical workstation handle opened by AES */
VDI_handle = graf_handle(&dummy, &dummy, &dummy, &dummy);
Expand Down Expand Up @@ -388,7 +385,7 @@ int GEM_VideoInit(_THIS, SDL_PixelFormat *vformat)
} else {
VDI_oldnumcolors=1<<VDI_bpp;
}

for(i = 0; i < VDI_oldnumcolors; i++) {
short rgb[3];

Expand Down Expand Up @@ -756,6 +753,11 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current,
x2 += GEM_desk_x;
y2 += GEM_desk_y;

/* Align work area on 16 pixels boundary (faster for bitplanes modes) */
wind_calc(WC_WORK, GEM_win_type, x2,y2,w2,h2, &x2,&y2,&w2,&h2);
x2 &= -16;
wind_calc(WC_BORDER, GEM_win_type, x2,y2,w2,h2, &x2,&y2,&w2,&h2);

/* Destroy existing window */
if (GEM_handle >= 0) {
wind_close(GEM_handle);
Expand All @@ -775,7 +777,10 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current,
#endif

/* Setup window name */
wind_set(GEM_handle,WF_NAME,(short)(((unsigned long)GEM_title_name)>>16),(short)(((unsigned long)GEM_title_name) & 0xffff),0,0);
wind_set(GEM_handle,WF_NAME,
(short)(((unsigned long)GEM_title_name)>>16),
(short)(((unsigned long)GEM_title_name) & 0xffff),
0,0);
GEM_refresh_name = SDL_FALSE;

/* Open the window */
Expand Down Expand Up @@ -1063,36 +1068,23 @@ static int GEM_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)

for(i = 0; i < ncolors; i++)
{
int r, g, b;
short rgb[3];
int r, g, b;
short rgb[3];

r = colors[i].r;
g = colors[i].g;
b = colors[i].b;

rgb[0] = VDI_curpalette[i][0] = (1000 * r) / 255;
rgb[1] = VDI_curpalette[i][1] =(1000 * g) / 255;
rgb[2] = VDI_curpalette[i][2] =(1000 * b) / 255;
rgb[1] = VDI_curpalette[i][1] = (1000 * g) / 255;
rgb[2] = VDI_curpalette[i][2] = (1000 * b) / 255;

vs_color(VDI_handle, vdi_index[firstcolor+i], rgb);
}

return(1);
}

#if 0
static int GEM_ToggleFullScreen(_THIS, int on)
{
if (on) {
GEM_LockScreen(this);
} else {
GEM_UnlockScreen(this);
}

return(1);
}
#endif

/* Note: If we are terminated, this could be called in the middle of
another SDL video routine -- notably UpdateRects.
*/
Expand Down Expand Up @@ -1145,7 +1137,7 @@ void GEM_VideoQuit(_THIS)
SDL_modelist[0]=NULL;
}

this->screen->pixels = NULL;
this->screen->pixels = NULL;
}

void GEM_wind_redraw(_THIS, int winhandle, short *inside)
Expand Down Expand Up @@ -1203,7 +1195,7 @@ static void refresh_window(_THIS, int winhandle, short *rect)
if (iconified && GEM_icon) {
short icon_rect[4], dst_rect[4];
short iconx,icony;

surface = GEM_icon;

GEM_ClearRect(this, rect);
Expand Down Expand Up @@ -1264,12 +1256,12 @@ static void refresh_window(_THIS, int winhandle, short *rect)
/* Redraw all window content */
pxy[0] = rect[0]-wind_pxy[0];
pxy[1] = rect[1]-wind_pxy[1];
pxy[2] = rect[2]-wind_pxy[0];
pxy[3] = rect[3]-wind_pxy[1];
pxy[2] = rect[2]-wind_pxy[0];
pxy[3] = rect[3]-wind_pxy[1];

pxy[4] = rect[0];
pxy[5] = rect[1];
pxy[6] = rect[2];
pxy[6] = rect[2];
pxy[7] = rect[3];
}

Expand Down

0 comments on commit e77831e

Please sign in to comment.