comparison src/video/gem/SDL_gemvideo.c @ 737:7e4347dd2f9c

Small fix for iconification
author Patrice Mandin <patmandin@gmail.com>
date Fri, 14 Nov 2003 19:48:13 +0000
parents 028e03e273c8
children b8d311d90021
comparison
equal deleted inserted replaced
736:028e03e273c8 737:7e4347dd2f9c
64 /* Defines */ 64 /* Defines */
65 65
66 /*#define DEBUG_VIDEO_GEM 1*/ 66 /*#define DEBUG_VIDEO_GEM 1*/
67 67
68 #define GEM_VID_DRIVER_NAME "gem" 68 #define GEM_VID_DRIVER_NAME "gem"
69
70 #undef MIN
71 #define MIN(a,b) (((a)<(b)) ? (a) : (b))
72 #undef MAX
73 #define MAX(a,b) (((a)>(b)) ? (a) : (b))
69 74
70 /* Variables */ 75 /* Variables */
71 76
72 static unsigned char vdi_index[256] = { 77 static unsigned char vdi_index[256] = {
73 0, 2, 3, 6, 4, 7, 5, 8, 78 0, 2, 3, 6, 4, 7, 5, 8,
1103 return; 1108 return;
1104 } 1109 }
1105 1110
1106 if (iconified && GEM_icon) { 1111 if (iconified && GEM_icon) {
1107 short icon_rect[4], dst_rect[4]; 1112 short icon_rect[4], dst_rect[4];
1113 short iconx,icony;
1108 1114
1109 surface = GEM_icon; 1115 surface = GEM_icon;
1110 1116
1111 GEM_ClearRect(this, rect); 1117 GEM_ClearRect(this, rect);
1112 1118
1113 /* Calculate centered icon(x,y,w,h) relative to window */ 1119 /* Calculate centered icon(x,y,w,h) relative to window */
1114 icon_rect[0] = (wind_pxy[2]-surface->w)>>1; 1120 iconx = (wind_pxy[2]-surface->w)>>1;
1115 icon_rect[1] = (wind_pxy[3]-surface->h)>>1; 1121 icony = (wind_pxy[3]-surface->h)>>1;
1122
1123 icon_rect[0] = iconx;
1124 icon_rect[1] = icony;
1116 icon_rect[2] = surface->w; 1125 icon_rect[2] = surface->w;
1117 icon_rect[3] = surface->h; 1126 icon_rect[3] = surface->h;
1118 1127
1119 /* Calculate redraw rectangle(x,y,w,h) relative to window */ 1128 /* Calculate redraw rectangle(x,y,w,h) relative to window */
1120 dst_rect[0] = rect[0]-wind_pxy[0]; 1129 dst_rect[0] = rect[0]-wind_pxy[0];
1140 icon_rect[1] += wind_pxy[1]; 1149 icon_rect[1] += wind_pxy[1];
1141 icon_rect[2] += icon_rect[0]-1; 1150 icon_rect[2] += icon_rect[0]-1;
1142 icon_rect[3] += icon_rect[1]-1; 1151 icon_rect[3] += icon_rect[1]-1;
1143 1152
1144 /* Calculate intersection rectangle to redraw */ 1153 /* Calculate intersection rectangle to redraw */
1145 pxy[0]=0; 1154 pxy[4]=pxy[0]=MAX(icon_rect[0],rect[0]);
1146 pxy[1]=0; 1155 pxy[5]=pxy[1]=MAX(icon_rect[1],rect[1]);
1147 pxy[2]=surface->w - 1; 1156 pxy[6]=pxy[2]=MIN(icon_rect[2],rect[2]);
1148 pxy[3]=surface->h - 1; 1157 pxy[7]=pxy[3]=MIN(icon_rect[3],rect[3]);
1149 pxy[4]=rect[0]; 1158
1150 pxy[5]=rect[1]; 1159 /* Calculate icon source image pos relative to window */
1151 pxy[6]=rect[2]; 1160 pxy[0] -= wind_pxy[0]+iconx;
1152 pxy[7]=rect[3]; 1161 pxy[1] -= wind_pxy[1]+icony;
1153 1162 pxy[2] -= wind_pxy[0]+iconx;
1154 if (icon_rect[0]>rect[0]) { 1163 pxy[3] -= wind_pxy[1]+icony;
1155 pxy[4]=icon_rect[0];
1156 } else if (icon_rect[0]<rect[0]) {
1157 pxy[0]=rect[0]-icon_rect[0];
1158 }
1159
1160 if (icon_rect[1]>rect[1]) {
1161 pxy[5]=icon_rect[1];
1162 } else if (icon_rect[1]<rect[1]) {
1163 pxy[1]=rect[1]-icon_rect[1];
1164 }
1165
1166 if (icon_rect[2]>rect[2]) {
1167 pxy[2]=rect[2]-icon_rect[0];
1168 pxy[6]=rect[2];
1169 } else if (icon_rect[2]<rect[2]) {
1170 pxy[2]=icon_rect[2]-rect[0];
1171 pxy[6]=icon_rect[2];
1172 }
1173
1174 if (icon_rect[3]>rect[3]) {
1175 pxy[3]=rect[3]-icon_rect[1];
1176 pxy[7]=rect[3];
1177 } else if (icon_rect[3]<rect[3]) {
1178 pxy[3]=icon_rect[3]-rect[1];
1179 pxy[7]=icon_rect[3];
1180 }
1181 1164
1182 } else { 1165 } else {
1183 surface = this->screen; 1166 surface = this->screen;
1184 1167
1185 #ifdef DEBUG_VIDEO_GEM 1168 #ifdef DEBUG_VIDEO_GEM