changeset 55022:dda0bae93c73

(image_ascent): Add slice arg; calculate ascent for image slice (or full image).
author Kim F. Storm <storm@cua.dk>
date Tue, 20 Apr 2004 22:16:33 +0000
parents 78fbab658433
children 47f04c0afbde
files src/image.c
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/image.c	Tue Apr 20 22:16:19 2004 +0000
+++ b/src/image.c	Tue Apr 20 22:16:33 2004 +0000
@@ -1076,13 +1076,21 @@
    drawn in face FACE.  */
 
 int
-image_ascent (img, face)
+image_ascent (img, face, slice)
      struct image *img;
      struct face *face;
-{
-  int height = img->height + img->vmargin;
+     struct glyph_slice *slice;
+{
+  int height;
   int ascent;
 
+  if (slice->height == img->height)
+    height = img->height + img->vmargin;
+  else if (slice->y == 0)
+    height = slice->height + img->vmargin;
+  else
+    height = slice->height;
+
   if (img->ascent == CENTERED_IMAGE_ASCENT)
     {
       if (face->font)