bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#10500: 23.3.50; wrong relief display for sliced images


From: YAMAMOTO Mitsuharu
Subject: bug#10500: 23.3.50; wrong relief display for sliced images
Date: Sat, 14 Jan 2012 13:46:07 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shij┼Ź) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

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
                                address@hidden


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);
  }
  
  






reply via email to

[Prev in Thread] Current Thread [Next in Thread]