unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#10500: 23.3.50; wrong relief display for sliced images
@ 2012-01-14  4:46 YAMAMOTO Mitsuharu
  2012-12-01  2:38 ` Chong Yidong
  2012-12-01 23:14 ` Paul Eggert
  0 siblings, 2 replies; 4+ messages in thread
From: YAMAMOTO Mitsuharu @ 2012-01-14  4:46 UTC (permalink / raw)
  To: 10500

You can observe that the image reliefs are displayed unclipped in the
following examples for sliced images:

(dolist
    (image
     (list (create-image "splash.png" nil nil :relief 10 :background "gray75")
	   (create-image "splash.png" nil nil :ascent 10 :relief 10 :background "gray75")
	   (create-image "splash.png" nil nil :ascent 100 :relief 10 :background "gray75")))
  (dotimes (i 3)
    (dotimes (j 3)
      (insert-image image nil nil (list (* j 100) (* i 80) 100 80))
      (insert "spacer"))
    (newline)))

I created a patch below for X11 and tried porting it for W32, but I
can't test it the latter.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp


If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/Users/mituharu/src/bzr/emacs/emacs-23/etc/DEBUG.


In GNU Emacs 23.3.50.1 (x86_64-apple-darwin11.2.0, X toolkit)
 of 2012-01-14 on yamamoto-no-iMac.local
Windowing system distributor `The X.Org Foundation', version 11.0.11003000
configured using `configure  '--with-jpeg=no' '--with-gif=no' '--with-tiff=no''

=== modified file 'src/w32term.c'
*** src/w32term.c	2012-01-11 07:52:35 +0000
--- src/w32term.c	2012-01-14 03:47:31 +0000
***************
*** 1657,1664 ****
    if (left_p)
      for (i = 0; i < width; ++i)
        w32_fill_area (f, hdc, gc.foreground,
! 		     left_x + i, top_y + i, 1,
! 		     bottom_y - top_y - 2 * i + 1);
  
    if (raised_p)
      gc.foreground = f->output_data.w32->black_relief.gc->foreground;
--- 1657,1664 ----
    if (left_p)
      for (i = 0; i < width; ++i)
        w32_fill_area (f, hdc, gc.foreground,
! 		     left_x + i, top_y + (i + 1) * top_p, 1,
! 		     bottom_y - top_y - (i + 1) * (bot_p + top_p) + 1);
  
    if (raised_p)
      gc.foreground = f->output_data.w32->black_relief.gc->foreground;
***************
*** 1676,1683 ****
    if (right_p)
      for (i = 0; i < width; ++i)
        w32_fill_area (f, hdc, gc.foreground,
! 		     right_x - i, top_y + i + 1, 1,
! 		     bottom_y - top_y - 2 * i - 1);
  
    w32_set_clip_rectangle (hdc, NULL);
  
--- 1676,1683 ----
    if (right_p)
      for (i = 0; i < width; ++i)
        w32_fill_area (f, hdc, gc.foreground,
! 		     right_x - i, top_y + (i + 1) * top_p, 1,
! 		     bottom_y - top_y - (i + 1) * (bot_p + top_p) + 1);
  
    w32_set_clip_rectangle (hdc, NULL);
  
***************
*** 1876,1882 ****
  x_draw_image_relief (s)
       struct glyph_string *s;
  {
!   int x0, y0, x1, y1, thick, raised_p;
    RECT r;
    int x = s->x;
    int y = s->ybase - image_ascent (s->img, s->face, &s->slice);
--- 1876,1882 ----
  x_draw_image_relief (s)
       struct glyph_string *s;
  {
!   int x1, y1, thick, raised_p, top_p, bot_p, left_p, right_p;
    RECT r;
    int x = s->x;
    int y = s->ybase - image_ascent (s->img, s->face, &s->slice);
***************
*** 1907,1925 ****
        raised_p = s->img->relief > 0;
      }
  
!   x0 = x - thick;
!   y0 = y - thick;
!   x1 = x + s->slice.width + thick - 1;
!   y1 = y + s->slice.height + thick - 1;
  
    x_setup_relief_colors (s);
    get_glyph_string_clip_rect (s, &r);
!   w32_draw_relief_rect (s->f, x0, y0, x1, y1, thick, raised_p,
! 			s->slice.y == 0,
! 			s->slice.y + s->slice.height == s->img->height,
! 			s->slice.x == 0,
! 			s->slice.x + s->slice.width == s->img->width,
! 			&r);
  }
  
  
--- 1907,1929 ----
        raised_p = s->img->relief > 0;
      }
  
!   x1 = x + s->slice.width - 1;
!   y1 = y + s->slice.height - 1;
!   top_p = bot_p = left_p = right_p = 0;
! 
!   if (s->slice.x == 0)
!     x -= thick, left_p = 1;
!   if (s->slice.y == 0)
!     y -= thick, top_p = 1;
!   if (s->slice.x + s->slice.width == s->img->width)
!     x1 += thick, right_p = 1;
!   if (s->slice.y + s->slice.height == s->img->height)
!     y1 += thick, bot_p = 1;
  
    x_setup_relief_colors (s);
    get_glyph_string_clip_rect (s, &r);
!   w32_draw_relief_rect (s->f, x, y, x1, y1, thick, raised_p,
! 			top_p, bot_p, left_p, right_p, &r);
  }
  
  

=== modified file 'src/xterm.c'
*** src/xterm.c	2012-01-11 07:52:35 +0000
--- src/xterm.c	2012-01-14 03:21:46 +0000
***************
*** 2060,2066 ****
    if (left_p)
      for (i = 0; i < width; ++i)
        XDrawLine (dpy, window, gc,
! 		 left_x + i, top_y + i, left_x + i, bottom_y - i + 1);
  
    XSetClipMask (dpy, gc, None);
    if (raised_p)
--- 2060,2067 ----
    if (left_p)
      for (i = 0; i < width; ++i)
        XDrawLine (dpy, window, gc,
! 		 left_x + i, top_y + (i + 1) * top_p,
! 		 left_x + i, bottom_y + 1 - (i + 1) * bot_p);
  
    XSetClipMask (dpy, gc, None);
    if (raised_p)
***************
*** 2080,2086 ****
    if (right_p)
      for (i = 0; i < width; ++i)
        XDrawLine (dpy, window, gc,
! 		 right_x - i, top_y + i + 1, right_x - i, bottom_y - i);
  
    XSetClipMask (dpy, gc, None);
  }
--- 2081,2088 ----
    if (right_p)
      for (i = 0; i < width; ++i)
        XDrawLine (dpy, window, gc,
! 		 right_x - i, top_y + (i + 1) * top_p,
! 		 right_x - i, bottom_y + 1 - (i + 1) * bot_p);
  
    XSetClipMask (dpy, gc, None);
  }
***************
*** 2278,2284 ****
  x_draw_image_relief (s)
       struct glyph_string *s;
  {
!   int x0, y0, x1, y1, thick, raised_p;
    XRectangle r;
    int x = s->x;
    int y = s->ybase - image_ascent (s->img, s->face, &s->slice);
--- 2280,2286 ----
  x_draw_image_relief (s)
       struct glyph_string *s;
  {
!   int x1, y1, thick, raised_p, top_p, bot_p, left_p, right_p;
    XRectangle r;
    int x = s->x;
    int y = s->ybase - image_ascent (s->img, s->face, &s->slice);
***************
*** 2309,2327 ****
        raised_p = s->img->relief > 0;
      }
  
!   x0 = x - thick;
!   y0 = y - thick;
!   x1 = x + s->slice.width + thick - 1;
!   y1 = y + s->slice.height + thick - 1;
  
    x_setup_relief_colors (s);
    get_glyph_string_clip_rect (s, &r);
!   x_draw_relief_rect (s->f, x0, y0, x1, y1, thick, raised_p,
! 		      s->slice.y == 0,
! 		      s->slice.y + s->slice.height == s->img->height,
! 		      s->slice.x == 0,
! 		      s->slice.x + s->slice.width == s->img->width,
! 		      &r);
  }
  
  
--- 2311,2333 ----
        raised_p = s->img->relief > 0;
      }
  
!   x1 = x + s->slice.width - 1;
!   y1 = y + s->slice.height - 1;
!   top_p = bot_p = left_p = right_p = 0;
! 
!   if (s->slice.x == 0)
!     x -= thick, left_p = 1;
!   if (s->slice.y == 0)
!     y -= thick, top_p = 1;
!   if (s->slice.x + s->slice.width == s->img->width)
!     x1 += thick, right_p = 1;
!   if (s->slice.y + s->slice.height == s->img->height)
!     y1 += thick, bot_p = 1;
  
    x_setup_relief_colors (s);
    get_glyph_string_clip_rect (s, &r);
!   x_draw_relief_rect (s->f, x, y, x1, y1, thick, raised_p,
! 		      top_p, bot_p, left_p, right_p, &r);
  }
  
  






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#10500: 23.3.50; wrong relief display for sliced images
  2012-01-14  4:46 bug#10500: 23.3.50; wrong relief display for sliced images YAMAMOTO Mitsuharu
@ 2012-12-01  2:38 ` Chong Yidong
  2012-12-01  9:18   ` Eli Zaretskii
  2012-12-01 23:14 ` Paul Eggert
  1 sibling, 1 reply; 4+ messages in thread
From: Chong Yidong @ 2012-12-01  2:38 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: 10500-done

YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> writes:

> You can observe that the image reliefs are displayed unclipped in the
> following examples for sliced images:
>
> I created a patch below for X11 and tried porting it for W32, but I
> can't test it the latter.

Thanks, I went ahead and committed your patch to trunk.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#10500: 23.3.50; wrong relief display for sliced images
  2012-12-01  2:38 ` Chong Yidong
@ 2012-12-01  9:18   ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2012-12-01  9:18 UTC (permalink / raw)
  To: Chong Yidong; +Cc: cyd, 10500

> From: Chong Yidong <cyd@gnu.org>
> Date: Sat, 01 Dec 2012 10:38:10 +0800
> Cc: 10500-done@debbugs.gnu.org
> 
> YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> writes:
> 
> > You can observe that the image reliefs are displayed unclipped in the
> > following examples for sliced images:
> >
> > I created a patch below for X11 and tried porting it for W32, but I
> > can't test it the latter.
> 
> Thanks, I went ahead and committed your patch to trunk.

It's hard for me to say whether the changes work correctly on
MS-Windows, since there was no image attached to the bug report to
show the correct and the incorrect display.  But at least the changes
compile on Windows and I do see a difference in the way the test case
is displayed before and after the change.

Thanks.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#10500: 23.3.50; wrong relief display for sliced images
  2012-01-14  4:46 bug#10500: 23.3.50; wrong relief display for sliced images YAMAMOTO Mitsuharu
  2012-12-01  2:38 ` Chong Yidong
@ 2012-12-01 23:14 ` Paul Eggert
  1 sibling, 0 replies; 4+ messages in thread
From: Paul Eggert @ 2012-12-01 23:14 UTC (permalink / raw)
  To: 10500

As installed in trunk bzr 111050, that patch caused the
local variables extra_x and extra_y to be unused.
I assume these variables are no longer needed, so I
removed them in trunk bzr 111059.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-12-01 23:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-14  4:46 bug#10500: 23.3.50; wrong relief display for sliced images YAMAMOTO Mitsuharu
2012-12-01  2:38 ` Chong Yidong
2012-12-01  9:18   ` Eli Zaretskii
2012-12-01 23:14 ` Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).