aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKim F. Storm2004-04-20 22:16:19 +0000
committerKim F. Storm2004-04-20 22:16:19 +0000
commitcedd7cd9f175280c4da0a4d62d9e5fa484ce03e3 (patch)
treeed4916c411566cde1b7c28dce6f7663bf81272f3 /src
parent0633d52c3e2c278a293a30da354e43ed92e5816d (diff)
downloademacs-cedd7cd9f175280c4da0a4d62d9e5fa484ce03e3.tar.gz
emacs-cedd7cd9f175280c4da0a4d62d9e5fa484ce03e3.zip
(buffer_posn_from_coords): Return full image width
and height even for image slices (posn is relative to full image). (marginal_area_string): Adjust x0,y0 for image slice.
Diffstat (limited to 'src')
-rw-r--r--src/dispnew.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/dispnew.c b/src/dispnew.c
index 987562b0bef..5ceebdecf34 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -5730,6 +5730,9 @@ buffer_posn_from_coords (w, x, y, pos, object, dx, dy, width, height)
5730 struct text_pos startp; 5730 struct text_pos startp;
5731 Lisp_Object string; 5731 Lisp_Object string;
5732 struct glyph_row *row; 5732 struct glyph_row *row;
5733#ifdef HAVE_WINDOW_SYSTEM
5734 struct image *img = 0;
5735#endif
5733 int x0, x1; 5736 int x0, x1;
5734 5737
5735 current_buffer = XBUFFER (w->buffer); 5738 current_buffer = XBUFFER (w->buffer);
@@ -5755,7 +5758,6 @@ buffer_posn_from_coords (w, x, y, pos, object, dx, dy, width, height)
5755#ifdef HAVE_WINDOW_SYSTEM 5758#ifdef HAVE_WINDOW_SYSTEM
5756 if (it.what == IT_IMAGE) 5759 if (it.what == IT_IMAGE)
5757 { 5760 {
5758 struct image *img;
5759 if ((img = IMAGE_FROM_ID (it.f, it.image_id)) != NULL 5761 if ((img = IMAGE_FROM_ID (it.f, it.image_id)) != NULL
5760 && !NILP (img->spec)) 5762 && !NILP (img->spec))
5761 *object = img->spec; 5763 *object = img->spec;
@@ -5768,12 +5770,22 @@ buffer_posn_from_coords (w, x, y, pos, object, dx, dy, width, height)
5768 if (it.hpos < row->used[TEXT_AREA]) 5770 if (it.hpos < row->used[TEXT_AREA])
5769 { 5771 {
5770 struct glyph *glyph = row->glyphs[TEXT_AREA] + it.hpos; 5772 struct glyph *glyph = row->glyphs[TEXT_AREA] + it.hpos;
5771 *width = glyph->pixel_width;
5772 *height = glyph->ascent + glyph->descent;
5773#ifdef HAVE_WINDOW_SYSTEM 5773#ifdef HAVE_WINDOW_SYSTEM
5774 if (glyph->type == IMAGE_GLYPH) 5774 if (img)
5775 *dy -= row->ascent - glyph->ascent; 5775 {
5776 *dy -= row->ascent - glyph->ascent;
5777 *dx += glyph->slice.x;
5778 *dy += glyph->slice.y;
5779 /* Image slices positions are still relative to the entire image */
5780 *width = img->width;
5781 *height = img->height;
5782 }
5783 else
5776#endif 5784#endif
5785 {
5786 *width = glyph->pixel_width;
5787 *height = glyph->ascent + glyph->descent;
5788 }
5777 } 5789 }
5778 else 5790 else
5779 { 5791 {
@@ -5939,6 +5951,8 @@ marginal_area_string (w, part, x, y, charpos, object, dx, dy, width, height)
5939 if (img != NULL) 5951 if (img != NULL)
5940 *object = img->spec; 5952 *object = img->spec;
5941 y0 -= row->ascent - glyph->ascent; 5953 y0 -= row->ascent - glyph->ascent;
5954 x0 += glyph->slice.x;
5955 y0 += glyph->slice.y;
5942 } 5956 }
5943#endif 5957#endif
5944 } 5958 }