comparison src/redisplay-x.c @ 112:48d667d6f17f r20-1b8

Import from CVS: tag r20-1b8
author cvs
date Mon, 13 Aug 2007 09:20:48 +0200
parents 131b0175ea99
children 9f59509498e1
comparison
equal deleted inserted replaced
111:164ab62060bf 112:48d667d6f17f
1148 Window x_win = XtWindow (FRAME_X_TEXT_WIDGET (f)); 1148 Window x_win = XtWindow (FRAME_X_TEXT_WIDGET (f));
1149 1149
1150 GC gc; 1150 GC gc;
1151 XGCValues gcv; 1151 XGCValues gcv;
1152 unsigned long pixmap_mask; 1152 unsigned long pixmap_mask;
1153 int need_clipping = (clip_x || clip_y);
1153 1154
1154 if (!override_gc) 1155 if (!override_gc)
1155 { 1156 {
1156 memset (&gcv, ~0, sizeof (XGCValues)); 1157 memset (&gcv, ~0, sizeof (XGCValues));
1157 gcv.graphics_exposures = False; 1158 gcv.graphics_exposures = False;
1165 gcv.clip_mask = IMAGE_INSTANCE_X_MASK (p); 1166 gcv.clip_mask = IMAGE_INSTANCE_X_MASK (p);
1166 gcv.clip_x_origin = x; 1167 gcv.clip_x_origin = x;
1167 gcv.clip_y_origin = y - pixmap_offset; 1168 gcv.clip_y_origin = y - pixmap_offset;
1168 pixmap_mask |= (GCFunction | GCClipMask | GCClipXOrigin | 1169 pixmap_mask |= (GCFunction | GCClipMask | GCClipXOrigin |
1169 GCClipYOrigin); 1170 GCClipYOrigin);
1171 /* Can't set a clip rectangle below because we already have a mask.
1172 We could conceivably create a new clipmask by zeroing out
1173 everything outside the clip region. Is it worth it?
1174 Is it possible to get an equivalent effect by changing the
1175 args to XCopyArea below rather than messing with a clip box?
1176 - dkindred@cs.cmu.edu */
1177 need_clipping = 0;
1170 } 1178 }
1171 1179
1172 gc = gc_cache_lookup (DEVICE_X_GC_CACHE (d), &gcv, pixmap_mask); 1180 gc = gc_cache_lookup (DEVICE_X_GC_CACHE (d), &gcv, pixmap_mask);
1173 } 1181 }
1174 else 1182 else
1175 gc = override_gc; 1183 {
1176 1184 gc = override_gc;
1177 if (clip_x || clip_y) 1185 /* override_gc might have a mask already--we don't want to nuke it.
1186 Maybe we can insist that override_gc have no mask, or use
1187 one of the suggestions above. */
1188 need_clipping = 0;
1189 }
1190
1191 if (need_clipping)
1178 { 1192 {
1179 XRectangle clip_box[1]; 1193 XRectangle clip_box[1];
1180 1194
1181 clip_box[0].x = clip_x; 1195 clip_box[0].x = clip_x;
1182 clip_box[0].y = clip_y; 1196 clip_box[0].y = clip_y;
1207 ? y - pixmap_offset 1221 ? y - pixmap_offset
1208 : y), 1222 : y),
1209 1L); 1223 1L);
1210 } 1224 }
1211 1225
1212 if (clip_x || clip_y) 1226 if (need_clipping)
1213 { 1227 {
1214 XSetClipMask (dpy, gc, None); 1228 XSetClipMask (dpy, gc, None);
1215 XSetClipOrigin (dpy, gc, 0, 0); 1229 XSetClipOrigin (dpy, gc, 0, 0);
1216 } 1230 }
1217 } 1231 }