From e77831e1c45419f6304d8e1f2aaccfef5a74f477 Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Sat, 30 Sep 2017 15:43:28 +0200 Subject: [PATCH] atari:gem: Align window work area on 16-pixels boundary (faster for bitplanes modes). Remove commented function GEM_ToggleFullscreen not used, and some extra whitespaces. --- src/video/gem/SDL_gemevents.c | 22 +++++++++----- src/video/gem/SDL_gemvideo.c | 56 +++++++++++++++-------------------- 2 files changed, 38 insertions(+), 40 deletions(-) diff --git a/src/video/gem/SDL_gemevents.c b/src/video/gem/SDL_gemevents.c index 920661723..e11ec65d1 100644 --- a/src/video/gem/SDL_gemevents.c +++ b/src/video/gem/SDL_gemevents.c @@ -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 @@ -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, @@ -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; @@ -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; @@ -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; @@ -280,7 +286,7 @@ static int do_messages(_THIS, short *message, short latest_msg_id) } break; } - + return quit; } @@ -383,10 +389,10 @@ static void do_mouse_buttons(_THIS, short mb) for (i=0;i<3;i++) { int curbutton, prevbutton; - + curbutton = mb & (1<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; @@ -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); @@ -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); @@ -388,7 +385,7 @@ int GEM_VideoInit(_THIS, SDL_PixelFormat *vformat) } else { VDI_oldnumcolors=1<= 0) { wind_close(GEM_handle); @@ -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 */ @@ -1063,16 +1068,16 @@ 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); } @@ -1080,19 +1085,6 @@ static int GEM_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) 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. */ @@ -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) @@ -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); @@ -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]; }