src/video/gem/SDL_gemvideo.c
branchSDL-1.2
changeset 11576 b3255371e439
parent 11571 49fa2a49574b
child 11580 b28174b10269
equal deleted inserted replaced
11571:49fa2a49574b 11576:b3255371e439
    96 static void GEM_ClearRect(_THIS, short *pxy);
    96 static void GEM_ClearRect(_THIS, short *pxy);
    97 static void GEM_ClearRectXYWH(_THIS, short *rect);
    97 static void GEM_ClearRectXYWH(_THIS, short *rect);
    98 static void GEM_SetNewPalette(_THIS, Uint16 newpal[256][3]);
    98 static void GEM_SetNewPalette(_THIS, Uint16 newpal[256][3]);
    99 static void GEM_LockScreen(_THIS);
    99 static void GEM_LockScreen(_THIS);
   100 static void GEM_UnlockScreen(_THIS);
   100 static void GEM_UnlockScreen(_THIS);
   101 static void refresh_window(_THIS, int winhandle, short *rect);
   101 static void refresh_window(_THIS, int winhandle, short *rect, SDL_bool pad_only);
   102 
   102 
   103 #if SDL_VIDEO_OPENGL
   103 #if SDL_VIDEO_OPENGL
   104 /* OpenGL functions */
   104 /* OpenGL functions */
   105 static void GEM_GL_SwapBuffers(_THIS);
   105 static void GEM_GL_SwapBuffers(_THIS);
   106 #endif
   106 #endif
   853 
   853 
   854 	/* We're done */
   854 	/* We're done */
   855 	return(current);
   855 	return(current);
   856 }
   856 }
   857 
   857 
   858 void GEM_align_work_area(_THIS, short windowid, int clear_pads)
   858 void GEM_align_work_area(_THIS, short windowid, SDL_bool clear_pads)
   859 {
   859 {
   860 	int new_x, new_w;
   860 	int new_x, new_w, old_x, old_w;
   861 
   861 
   862 	wind_get(windowid, WF_WORKXYWH, &GEM_work_x,&GEM_work_y,&GEM_work_w,&GEM_work_h);
   862 	wind_get(windowid, WF_WORKXYWH, &GEM_work_x,&GEM_work_y,&GEM_work_w,&GEM_work_h);
   863 	if (GEM_iconified) {
   863 	if (GEM_iconified) {
   864 		return;
   864 		return;
   865 	}
   865 	}
   866 
   866 
   867 	/* Align work area on 16 pixels boundary (faster for bitplanes modes) */
   867 	/* Align work area on 16 pixels boundary (faster for bitplanes modes) */
   868 	new_x = GEM_work_x;
   868 	new_x = old_x = GEM_work_x;
   869 	new_w = GEM_work_w;
   869 	new_w = old_w = GEM_work_w;
   870 	if (new_x & 15) {
   870 	if (new_x & 15) {
   871 		new_x = (new_x|15)+1;
   871 		new_x = (new_x|15)+1;
   872 	} else {
   872 	} else {
   873 		new_w -= 16;
   873 		new_w -= 16;
   874 	}
   874 	}
   875 	new_w -= (new_x - GEM_work_x);
   875 	new_w -= (new_x - GEM_work_x);
   876 	new_w &= ~15;
   876 	new_w &= ~15;
   877 
   877 
       
   878 	GEM_work_x = new_x;
       
   879 	GEM_work_w = new_w;
       
   880 
   878 	if (clear_pads) {
   881 	if (clear_pads) {
   879 		short rect[4];
   882 		short rect[4];
   880 
   883 
   881 		rect[1] = GEM_work_y;
   884 		rect[1] = GEM_work_y;
   882 		rect[3] = GEM_work_h;
   885 		rect[3] = GEM_work_h;
   883 
   886 
   884 		/* Left padding */
   887 		/* Left padding */
   885 		rect[0] = GEM_work_x;
   888 		rect[0] = old_x;
   886 		rect[2] = new_x-GEM_work_x+1;
   889 		rect[2] = new_x-old_x+1;
   887 		GEM_ClearRectXYWH(this, rect);
   890 		GEM_wind_redraw(this, GEM_handle, rect, SDL_TRUE);
   888 
   891 
   889 		/* Right padding */
   892 		/* Right padding */
   890 		rect[0] = new_x + new_w;
   893 		rect[0] = new_x + new_w;
   891 		rect[2] = (GEM_work_w-new_w)-(new_x-GEM_work_x)+1;
   894 		rect[2] = (old_w-new_w)-(new_x-old_x)+1;
   892 		GEM_ClearRectXYWH(this, rect);
   895 		GEM_wind_redraw(this, GEM_handle, rect, SDL_TRUE);
   893 	}
   896 	}
   894 
       
   895 	GEM_work_w = new_w;
       
   896 	GEM_work_x = new_x;
       
   897 }
   897 }
   898 
   898 
   899 static int GEM_AllocHWSurface(_THIS, SDL_Surface *surface)
   899 static int GEM_AllocHWSurface(_THIS, SDL_Surface *surface)
   900 {
   900 {
   901 	return -1;
   901 	return -1;
  1004 		rect[0] = GEM_work_x + rects[i].x;
  1004 		rect[0] = GEM_work_x + rects[i].x;
  1005 		rect[1] = GEM_work_y + rects[i].y;
  1005 		rect[1] = GEM_work_y + rects[i].y;
  1006 		rect[2] = rects[i].w;
  1006 		rect[2] = rects[i].w;
  1007 		rect[3] = rects[i].h;
  1007 		rect[3] = rects[i].h;
  1008 
  1008 
  1009 		GEM_wind_redraw(this, GEM_handle, rect);
  1009 		GEM_wind_redraw(this, GEM_handle, rect, SDL_FALSE);
  1010 	}
  1010 	}
  1011 }
  1011 }
  1012 
  1012 
  1013 static void GEM_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
  1013 static void GEM_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
  1014 {
  1014 {
  1094 	rect[0] = GEM_work_x;
  1094 	rect[0] = GEM_work_x;
  1095 	rect[1] = GEM_work_y;
  1095 	rect[1] = GEM_work_y;
  1096 	rect[2] = GEM_work_w;
  1096 	rect[2] = GEM_work_w;
  1097 	rect[3] = GEM_work_h;
  1097 	rect[3] = GEM_work_h;
  1098 
  1098 
  1099 	GEM_wind_redraw(this, GEM_handle, rect);
  1099 	GEM_wind_redraw(this, GEM_handle, rect, SDL_FALSE);
  1100 
  1100 
  1101 	return(0);
  1101 	return(0);
  1102 }
  1102 }
  1103 
  1103 
  1104 static int GEM_FlipHWSurface(_THIS, SDL_Surface *surface)
  1104 static int GEM_FlipHWSurface(_THIS, SDL_Surface *surface)
  1201 	}
  1201 	}
  1202 
  1202 
  1203 	this->screen->pixels = NULL;
  1203 	this->screen->pixels = NULL;
  1204 }
  1204 }
  1205 
  1205 
  1206 void GEM_wind_redraw(_THIS, int winhandle, short *inside)
  1206 void GEM_wind_redraw(_THIS, int winhandle, short *inside, SDL_bool pad_only)
  1207 {
  1207 {
  1208 	short todo[4];
  1208 	short todo[4];
  1209 
  1209 
  1210 	/* Tell AES we are going to update */
  1210 	/* Tell AES we are going to update */
  1211 	wind_update(BEG_UPDATE);
  1211 	wind_update(BEG_UPDATE);
  1216 	if (wind_get(winhandle, WF_FIRSTXYWH, &todo[0], &todo[1], &todo[2], &todo[3])!=0) {
  1216 	if (wind_get(winhandle, WF_FIRSTXYWH, &todo[0], &todo[1], &todo[2], &todo[3])!=0) {
  1217 
  1217 
  1218 		while (todo[2] && todo[3]) {
  1218 		while (todo[2] && todo[3]) {
  1219 
  1219 
  1220 			if (rc_intersect((GRECT *)inside,(GRECT *)todo)) {
  1220 			if (rc_intersect((GRECT *)inside,(GRECT *)todo)) {
  1221 				refresh_window(this, winhandle, todo);
  1221 				refresh_window(this, winhandle, todo, pad_only);
  1222 			}
  1222 			}
  1223 
  1223 
  1224 			if (wind_get(winhandle, WF_NEXTXYWH, &todo[0], &todo[1], &todo[2], &todo[3])==0) {
  1224 			if (wind_get(winhandle, WF_NEXTXYWH, &todo[0], &todo[1], &todo[2], &todo[3])==0) {
  1225 				break;
  1225 				break;
  1226 			}
  1226 			}
  1232 	wind_update(END_UPDATE);
  1232 	wind_update(END_UPDATE);
  1233 
  1233 
  1234 	v_show_c(VDI_handle,1);
  1234 	v_show_c(VDI_handle,1);
  1235 }
  1235 }
  1236 
  1236 
  1237 static void refresh_window(_THIS, int winhandle, short *rect)
  1237 static void refresh_window(_THIS, int winhandle, short *rect, SDL_bool pad_only)
  1238 {
  1238 {
  1239 	MFDB mfdb_src;
  1239 	MFDB mfdb_src;
  1240 	short pxy[8], work_rect[4];
  1240 	short pxy[8], work_rect[4];
  1241 	SDL_Surface *surface;
  1241 	SDL_Surface *surface;
  1242 	int max_width, max_height;
  1242 	int max_width, max_height;
  1284 			GEM_ClearRect(this, pxy);
  1284 			GEM_ClearRect(this, pxy);
  1285 		}
  1285 		}
  1286 	}
  1286 	}
  1287 
  1287 
  1288 	/* Do we intersect zone to redraw ? */
  1288 	/* Do we intersect zone to redraw ? */
  1289 	if (!rc_intersect((GRECT *)work_rect, (GRECT *)rect)) {
  1289 	if (pad_only || !rc_intersect((GRECT *)work_rect, (GRECT *)rect)) {
  1290 		return;
  1290 		return;
  1291 	}
  1291 	}
  1292 
  1292 
  1293 	/* Calculate intersection rectangle to redraw */
  1293 	/* Calculate intersection rectangle to redraw */
  1294 	max_width = MIN(work_rect[2], rect[2]);
  1294 	max_width = MIN(work_rect[2], rect[2]);