comparison src/video/gem/SDL_gemvideo.c @ 1074:936da0056ed3

Save/restore system palette when application topped/untopped
author Patrice Mandin <patmandin@gmail.com>
date Tue, 07 Jun 2005 11:52:46 +0000
parents 5dbcac12f22b
children 1f5ef94e8bef
comparison
equal deleted inserted replaced
1073:6d3c1134cd19 1074:936da0056ed3
104 104
105 /* Internal functions */ 105 /* Internal functions */
106 static void GEM_FreeBuffers(_THIS); 106 static void GEM_FreeBuffers(_THIS);
107 static void GEM_ClearScreen(_THIS); 107 static void GEM_ClearScreen(_THIS);
108 static void GEM_ClearRect(_THIS, short *rect); 108 static void GEM_ClearRect(_THIS, short *rect);
109 static void GEM_SetNewPalette(_THIS, Uint16 newpal[256][3]);
109 static void GEM_LockScreen(_THIS); 110 static void GEM_LockScreen(_THIS);
110 static void GEM_UnlockScreen(_THIS); 111 static void GEM_UnlockScreen(_THIS);
111 static void refresh_window(_THIS, int winhandle, short *rect); 112 static void refresh_window(_THIS, int winhandle, short *rect);
112 113
113 #ifdef HAVE_OPENGL 114 #ifdef HAVE_OPENGL
394 395
395 VDI_oldpalette[i][0] = rgb[0]; 396 VDI_oldpalette[i][0] = rgb[0];
396 VDI_oldpalette[i][1] = rgb[1]; 397 VDI_oldpalette[i][1] = rgb[1];
397 VDI_oldpalette[i][2] = rgb[2]; 398 VDI_oldpalette[i][2] = rgb[2];
398 } 399 }
400 VDI_setpalette = GEM_SetNewPalette;
401 memcpy(VDI_curpalette,VDI_oldpalette,sizeof(VDI_curpalette));
399 402
400 /* Setup screen info */ 403 /* Setup screen info */
401 GEM_title_name = empty_name; 404 GEM_title_name = empty_name;
402 GEM_icon_name = empty_name; 405 GEM_icon_name = empty_name;
403 406
516 pxy[2] = VDI_w - 1; 519 pxy[2] = VDI_w - 1;
517 pxy[3] = VDI_h - 1; 520 pxy[3] = VDI_h - 1;
518 GEM_ClearRect(this, pxy); 521 GEM_ClearRect(this, pxy);
519 522
520 v_show_c(VDI_handle, 1); 523 v_show_c(VDI_handle, 1);
524 }
525
526 static void GEM_SetNewPalette(_THIS, Uint16 newpal[256][3])
527 {
528 int i;
529 short rgb[3];
530
531 if (VDI_oldnumcolors==0)
532 return;
533
534 for(i = 0; i < VDI_oldnumcolors; i++) {
535 rgb[0] = newpal[i][0];
536 rgb[1] = newpal[i][1];
537 rgb[2] = newpal[i][2];
538
539 vs_color(VDI_handle, i, rgb);
540 }
521 } 541 }
522 542
523 static void GEM_LockScreen(_THIS) 543 static void GEM_LockScreen(_THIS)
524 { 544 {
525 if (!GEM_locked) { 545 if (!GEM_locked) {
1046 1066
1047 r = colors[i].r; 1067 r = colors[i].r;
1048 g = colors[i].g; 1068 g = colors[i].g;
1049 b = colors[i].b; 1069 b = colors[i].b;
1050 1070
1051 rgb[0] = (1000 * r) / 255; 1071 rgb[0] = VDI_curpalette[i][0] = (1000 * r) / 255;
1052 rgb[1] = (1000 * g) / 255; 1072 rgb[1] = VDI_curpalette[i][1] =(1000 * g) / 255;
1053 rgb[2] = (1000 * b) / 255; 1073 rgb[2] = VDI_curpalette[i][2] =(1000 * b) / 255;
1054 1074
1055 vs_color(VDI_handle, vdi_index[firstcolor+i], rgb); 1075 vs_color(VDI_handle, vdi_index[firstcolor+i], rgb);
1056 } 1076 }
1057 1077
1058 return(1); 1078 return(1);
1099 GEM_menubar=NULL; 1119 GEM_menubar=NULL;
1100 } 1120 }
1101 1121
1102 appl_exit(); 1122 appl_exit();
1103 1123
1104 /* Restore palette */ 1124 GEM_SetNewPalette(this, VDI_oldpalette);
1105 if (VDI_oldnumcolors) {
1106 int i;
1107
1108 for(i = 0; i < VDI_oldnumcolors; i++) {
1109 short rgb[3];
1110
1111 rgb[0] = VDI_oldpalette[i][0];
1112 rgb[1] = VDI_oldpalette[i][1];
1113 rgb[2] = VDI_oldpalette[i][2];
1114
1115 vs_color(VDI_handle, i, rgb);
1116 }
1117 }
1118 1125
1119 /* Close VDI workstation */ 1126 /* Close VDI workstation */
1120 if (VDI_handle) { 1127 if (VDI_handle) {
1121 v_clsvwk(VDI_handle); 1128 v_clsvwk(VDI_handle);
1122 } 1129 }