- int lheight = dl->ascent + dl->descent - dl->clip;
- int pheight = ((int) IMAGE_INSTANCE_PIXMAP_HEIGHT (p) > lheight ? lheight :
- IMAGE_INSTANCE_PIXMAP_HEIGHT (p));
- int pwidth = min (width + xoffset, (int) IMAGE_INSTANCE_PIXMAP_WIDTH (p));
- int clip_x, clip_y, clip_width, clip_height;
-
- /* The pixmap_offset is used to center the pixmap on lines which are
- shorter than it is. This results in odd effects when scrolling
- pixmaps off of the bottom. Let's try not using it. */
-#if 0
- int pixmap_offset = (int) (IMAGE_INSTANCE_PIXMAP_HEIGHT (p) - lheight) / 2;
-#else
- int pixmap_offset = 0;
-#endif
-
- XSETWINDOW (window, w);
-
- if ((start_pixpos >= 0 && start_pixpos > xpos) || xoffset)
- {
- if (start_pixpos > xpos && start_pixpos > xpos + width)
- return;
-
- clip_x = xoffset;
- clip_width = width;
- if (start_pixpos > xpos)
- {
- clip_x += (start_pixpos - xpos);
- clip_width -= (start_pixpos - xpos);
- }
- }
- else
- {
- clip_x = 0;
- clip_width = 0;
- }
-
- /* Place markers for possible future functionality (clipping the top
- half instead of the bottom half; think pixel scrolling). */
- clip_y = 0;
- clip_height = pheight;
-
- /* Clear the area the pixmap is going into. The pixmap itself will
- always take care of the full width. We don't want to clear where
- it is going to go in order to avoid flicker. So, all we have to
- take care of is any area above or below the pixmap. */
- /* #### We take a shortcut for now. We know that since we have
- pixmap_offset hardwired to 0 that the pixmap is against the top
- edge so all we have to worry about is below it. */
- /* #### Unless the pixmap has a mask in which case we have to clear
- the whole damn thing since we can't yet clear just the area not
- included in the mask. */
- if (((int) (dl->ypos - dl->ascent + pheight) <
- (int) (dl->ypos + dl->descent - dl->clip))
- || IMAGE_INSTANCE_X_MASK (p))
- {
- int clear_x, clear_y, clear_width, clear_height;
-
- if (IMAGE_INSTANCE_X_MASK (p))
- {
- clear_y = dl->ypos - dl->ascent;
- clear_height = lheight;
- }
- else
- {
- clear_y = dl->ypos - dl->ascent + pheight;
- clear_height = lheight - pheight;
- }
-
- if (start_pixpos >= 0 && start_pixpos > xpos)
- {
- clear_x = start_pixpos;
- clear_width = xpos + width - start_pixpos;
- }
- else
- {
- clear_x = xpos;
- clear_width = width;
- }
-
- redisplay_clear_region (window, findex, clear_x, clear_y,
- clear_width, clear_height);
- }