comparison src/redisplay-output.c @ 404:2f8bb876ab1d r21-2-32

Import from CVS: tag r21-2-32
author cvs
date Mon, 13 Aug 2007 11:16:07 +0200
parents 74fd4e045ea6
children b8cc9ab3f761
comparison
equal deleted inserted replaced
403:9f011ab08d48 404:2f8bb876ab1d
99 sync_display_line_structs 99 sync_display_line_structs
100 100
101 For the given LINE in window W, make the current display line equal 101 For the given LINE in window W, make the current display line equal
102 the desired display line. 102 the desired display line.
103 ****************************************************************************/ 103 ****************************************************************************/
104 static void 104 void
105 sync_display_line_structs (struct window *w, int line, int do_blocks, 105 sync_display_line_structs (struct window *w, int line, int do_blocks,
106 display_line_dynarr *cdla, 106 display_line_dynarr *cdla,
107 display_line_dynarr *ddla) 107 display_line_dynarr *ddla)
108 { 108 {
109 int cdla_len = Dynarr_length (cdla); 109 int cdla_len = Dynarr_length (cdla);
209 So I (JV) conjecture 209 So I (JV) conjecture
210 210
211 #### It would really be worth it to arrange for this function to 211 #### It would really be worth it to arrange for this function to
212 be (almost) a single call to memcmp. */ 212 be (almost) a single call to memcmp. */
213 213
214 if ((crb->findex != drb->findex) || 214 if (crb->xpos != drb->xpos)
215 (WINDOW_FACE_CACHEL_DIRTY (w, drb->findex)))
216 return 0;
217 else if (crb->xpos != drb->xpos)
218 return 0; 215 return 0;
219 else if (crb->width != drb->width) 216 else if (crb->width != drb->width)
220 return 0; 217 return 0;
221 else if (crb->cursor_type != drb->cursor_type) 218 else if (crb->cursor_type != drb->cursor_type)
222 return 0; 219 return 0;
234 !EQ (crb->object.dglyph.extent, drb->object.dglyph.extent) || 231 !EQ (crb->object.dglyph.extent, drb->object.dglyph.extent) ||
235 crb->object.dglyph.xoffset != drb->object.dglyph.xoffset)) 232 crb->object.dglyph.xoffset != drb->object.dglyph.xoffset))
236 return 0; 233 return 0;
237 /* Only check dirtiness if we know something has changed. */ 234 /* Only check dirtiness if we know something has changed. */
238 else if (crb->type == RUNE_DGLYPH && 235 else if (crb->type == RUNE_DGLYPH &&
239 XFRAME (w->frame)->glyphs_changed) 236 ((XFRAME (w->frame)->glyphs_changed &&
240 { 237 XGLYPH_DIRTYP (crb->object.dglyph.glyph)) ||
241 glyph_index gindex = get_glyph_cachel_index (w, drb->object.dglyph.glyph); 238 crb->findex != drb->findex))
242 /* Although doing the cachel lookup for every comparison is 239 {
243 very expensive.we have to do it to make sure the cache is 240 /* We need some way of telling redisplay_output_layout () that the
244 up-to-date. */ 241 only reason we are outputting it is because something has
245 if (GLYPH_CACHEL_DIRTYP (w, gindex)) 242 changed internally. That way we can optimize whether we need
243 to clear the layout first and also only output the components
244 that have changed. The image_instance dirty flag and
245 display_hash are no good to us because these will invariably
246 have been set anyway if the layout has changed. So it looks
247 like we need yet another change flag that we can set here and
248 then clear in redisplay_output_layout (). */
249 Lisp_Object window, image;
250 Lisp_Image_Instance* ii;
251 XSETWINDOW (window, w);
252 image = glyph_image_instance (crb->object.dglyph.glyph,
253 window, ERROR_ME_NOT, 1);
254 ii = XIMAGE_INSTANCE (image);
255
256 if (TEXT_IMAGE_INSTANCEP (image) &&
257 (crb->findex != drb->findex ||
258 WINDOW_FACE_CACHEL_DIRTY (w, drb->findex)))
246 return 0; 259 return 0;
260
261 /* It is quite common of the two glyphs to be EQ since in many
262 cases they will actually be the same object. This does not
263 mean, however, that nothing has changed. We therefore need to
264 check the current hash of the glyph against the last recorded
265 display hash. See update_subwindow (). */
266 if (IMAGE_INSTANCE_DISPLAY_HASH (ii) == 0 ||
267 IMAGE_INSTANCE_DISPLAY_HASH (ii) !=
268 internal_hash (image, IMAGE_INSTANCE_HASH_DEPTH) ||
269 crb->findex != drb->findex ||
270 WINDOW_FACE_CACHEL_DIRTY (w, drb->findex))
271 {
272 /* We now now we are going to re-output the glyph, but since
273 this is for some internal reason not related to geometry
274 changes, send a hint to the output routines that they can
275 take some short cuts. This is most useful for
276 layouts. This flag should get reset by the output
277 routines.
278
279 #### It is possible for us to get here when the
280 face_cachel is dirty. I do not know what the implications
281 of this are.*/
282 IMAGE_INSTANCE_OPTIMIZE_OUTPUT (ii) = 1;
283 return 0;
284 }
247 else 285 else
248 return 1; 286 return 1;
249 } 287 }
288 /* We now do this last so that glyph checks can do their own thing
289 for face changes. Face changes quite often happen when we are
290 trying to output something in the gutter, this would normally
291 lead to a lot of flashing. The indices can quite often be
292 different and yet the faces are the same, we do not want to
293 re-output in this instance. */
294 else if (crb->findex != drb->findex ||
295 WINDOW_FACE_CACHEL_DIRTY (w, drb->findex))
296 return 0;
250 else 297 else
251 return 1; 298 return 1;
252 } 299 }
253 300
254 /***************************************************************************** 301 /*****************************************************************************
1065 int start, int end, int start_pixpos, int cursor_start, 1112 int start, int end, int start_pixpos, int cursor_start,
1066 int cursor_width, int cursor_height) 1113 int cursor_width, int cursor_height)
1067 { 1114 {
1068 struct frame *f = XFRAME (w->frame); 1115 struct frame *f = XFRAME (w->frame);
1069 struct device *d = XDEVICE (f->device); 1116 struct device *d = XDEVICE (f->device);
1117 /* Temporarily disabled until generalization is done. */
1118 #if 0
1070 struct display_block *db = Dynarr_atp (dl->display_blocks, block); 1119 struct display_block *db = Dynarr_atp (dl->display_blocks, block);
1071 rune_dynarr *rba = db->runes; 1120 rune_dynarr *rba = db->runes;
1072 struct rune *rb; 1121 struct rune *rb;
1073 int xpos, width; 1122 int xpos, width;
1074 rb = Dynarr_atp (rba, start); 1123 rb = Dynarr_atp (rba, start);
1082 if (end < 0) 1131 if (end < 0)
1083 end = Dynarr_length (rba); 1132 end = Dynarr_length (rba);
1084 1133
1085 rb = Dynarr_atp (rba, end - 1); 1134 rb = Dynarr_atp (rba, end - 1);
1086 width = rb->xpos + rb->width - xpos; 1135 width = rb->xpos + rb->width - xpos;
1136 #endif
1087 /* now actually output the block. */ 1137 /* now actually output the block. */
1088 DEVMETH (d, output_display_block, (w, dl, block, start, 1138 DEVMETH (d, output_display_block, (w, dl, block, start,
1089 end, start_pixpos, 1139 end, start_pixpos,
1090 cursor_start, cursor_width, 1140 cursor_start, cursor_width,
1091 cursor_height)); 1141 cursor_height));
1241 Lisp_Object window, rest; 1291 Lisp_Object window, rest;
1242 Emchar_dynarr *buf = Dynarr_new (Emchar); 1292 Emchar_dynarr *buf = Dynarr_new (Emchar);
1243 struct frame *f = XFRAME (w->frame); 1293 struct frame *f = XFRAME (w->frame);
1244 struct device *d = XDEVICE (f->device); 1294 struct device *d = XDEVICE (f->device);
1245 int layout_height, layout_width; 1295 int layout_height, layout_width;
1246 /* We bogusly don't take f->extents_changed and f->glyphs_changed
1247 into account. This is because if we do we always redisplay the
1248 entire layout. So far I have seen no ill effects so we'll see. */
1249 int frame_really_changed = (f->buffers_changed ||
1250 f->clip_changed ||
1251 f->faces_changed ||
1252 f->frame_changed ||
1253 f->modeline_changed ||
1254 f->subwindows_changed ||
1255 f->windows_changed ||
1256 f->windows_structure_changed);
1257 1296
1258 XSETWINDOW (window, w); 1297 XSETWINDOW (window, w);
1259 1298
1260 layout_height = glyph_height (image_instance, window); 1299 layout_height = glyph_height (image_instance, window);
1261 layout_width = glyph_width (image_instance, window); 1300 layout_width = glyph_width (image_instance, window);
1267 if (!redisplay_normalize_glyph_area (db, dga)) 1306 if (!redisplay_normalize_glyph_area (db, dga))
1268 return; 1307 return;
1269 1308
1270 /* Highly dodgy optimization. We want to only output the whole 1309 /* Highly dodgy optimization. We want to only output the whole
1271 layout if we really have to. */ 1310 layout if we really have to. */
1272 if (frame_really_changed 1311 if (!IMAGE_INSTANCE_OPTIMIZE_OUTPUT (p)
1273 || IMAGE_INSTANCE_LAYOUT_CHANGED (p) 1312 || IMAGE_INSTANCE_LAYOUT_CHANGED (p)
1274 || IMAGE_INSTANCE_WIDGET_FACE_CHANGED (p) 1313 || IMAGE_INSTANCE_WIDGET_FACE_CHANGED (p)
1275 || IMAGE_INSTANCE_SIZE_CHANGED (p) 1314 || IMAGE_INSTANCE_SIZE_CHANGED (p)
1276 || IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p)) 1315 || IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p))
1277 { 1316 {
1340 1379
1341 /* First determine if the image is visible at all */ 1380 /* First determine if the image is visible at all */
1342 if (IMAGE_INSTANCEP (child)) 1381 if (IMAGE_INSTANCEP (child))
1343 { 1382 {
1344 Lisp_Image_Instance* childii = XIMAGE_INSTANCE (child); 1383 Lisp_Image_Instance* childii = XIMAGE_INSTANCE (child);
1384
1345 /* The enclosing layout offsets are +ve at this point */ 1385 /* The enclosing layout offsets are +ve at this point */
1346 struct display_glyph_area cdga; 1386 struct display_glyph_area cdga;
1347 cdga.xoffset = IMAGE_INSTANCE_XOFFSET (childii) - dga->xoffset; 1387 cdga.xoffset = IMAGE_INSTANCE_XOFFSET (childii) - dga->xoffset;
1348 cdga.yoffset = IMAGE_INSTANCE_YOFFSET (childii) - dga->yoffset; 1388 cdga.yoffset = IMAGE_INSTANCE_YOFFSET (childii) - dga->yoffset;
1349 cdga.width = glyph_width (child, window); 1389 cdga.width = glyph_width (child, window);
1350 cdga.height = glyph_height (child, window); 1390 cdga.height = glyph_height (child, window);
1391
1392 IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii) =
1393 IMAGE_INSTANCE_OPTIMIZE_OUTPUT (p);
1351 1394
1352 /* Although normalization is done by the output routines 1395 /* Although normalization is done by the output routines
1353 we have to do it here so that they don't try and 1396 we have to do it here so that they don't try and
1354 clear all of db. This is true below also. */ 1397 clear all of db. This is true below also. */
1355 if (redisplay_normalize_glyph_area (&cdb, &cdga)) 1398 if (redisplay_normalize_glyph_area (&cdb, &cdga))
1373 { 1416 {
1374 /* #### This is well hacked and could use some 1417 /* #### This is well hacked and could use some
1375 generalisation.*/ 1418 generalisation.*/
1376 if (redisplay_normalize_glyph_area (&cdb, &cdga) 1419 if (redisplay_normalize_glyph_area (&cdb, &cdga)
1377 && 1420 &&
1378 (frame_really_changed || IMAGE_INSTANCE_DIRTYP (childii))) 1421 (!IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii) ||
1422 IMAGE_INSTANCE_DIRTYP (childii)))
1379 { 1423 {
1380 struct display_line dl; /* this is fake */ 1424 struct display_line dl; /* this is fake */
1381 Lisp_Object string = 1425 Lisp_Object string =
1382 IMAGE_INSTANCE_TEXT_STRING (childii); 1426 IMAGE_INSTANCE_TEXT_STRING (childii);
1383 convert_bufbyte_string_into_emchar_dynarr 1427 convert_bufbyte_string_into_emchar_dynarr
1407 } 1451 }
1408 break; 1452 break;
1409 1453
1410 case IMAGE_MONO_PIXMAP: 1454 case IMAGE_MONO_PIXMAP:
1411 case IMAGE_COLOR_PIXMAP: 1455 case IMAGE_COLOR_PIXMAP:
1412 if (frame_really_changed || IMAGE_INSTANCE_DIRTYP (childii)) 1456 if (!IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii)
1457 || IMAGE_INSTANCE_DIRTYP (childii))
1413 redisplay_output_pixmap (w, child, &cdb, &cdga, findex, 1458 redisplay_output_pixmap (w, child, &cdb, &cdga, findex,
1414 0, 0, 0, 0); 1459 0, 0, 0, 0);
1415 break; 1460 break;
1416 1461
1417 case IMAGE_WIDGET: 1462 case IMAGE_WIDGET:
1418 case IMAGE_SUBWINDOW: 1463 case IMAGE_SUBWINDOW:
1419 if (frame_really_changed || IMAGE_INSTANCE_DIRTYP (childii)) 1464 if (!IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii) ||
1465 IMAGE_INSTANCE_DIRTYP (childii))
1420 redisplay_output_subwindow (w, child, &cdb, &cdga, findex, 1466 redisplay_output_subwindow (w, child, &cdb, &cdga, findex,
1421 0, 0, 0); 1467 0, 0, 0);
1422 break; 1468 break;
1423 1469
1424 case IMAGE_LAYOUT: 1470 case IMAGE_LAYOUT:
1433 case IMAGE_POINTER: 1479 case IMAGE_POINTER:
1434 default: 1480 default:
1435 abort (); 1481 abort ();
1436 } 1482 }
1437 } 1483 }
1484 IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii) = 0;
1438 } 1485 }
1439 } 1486 }
1440 1487
1441 /* Update any display properties. I'm not sure whether this actually 1488 /* Update any display properties. I'm not sure whether this actually
1442 does anything for layouts except clear the changed flags. */ 1489 does anything for layouts except clear the changed flags. */