GNU bug report logs - #17115
24.3.50; possible bug in drawing images with box on W32

Previous Next

Package: emacs;

Reported by: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>

Date: Thu, 27 Mar 2014 02:43:02 UTC

Severity: normal

Found in version 24.3.50

Fixed in version 24.4

Done: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17115 in the body.
You can then email your comments to 17115 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#17115; Package emacs. (Thu, 27 Mar 2014 02:43:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 27 Mar 2014 02:43:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; possible bug in drawing images with box on W32
Date: Thu, 27 Mar 2014 11:42:09 +0900
Recently I found a bug (which is different from Bug#17114) in drawing
images with box on the Mac port, and I suspect it also happens on W32
because their code are similar (though I can't test it).  Could
someone try if it is reproducible on W32 and if so, please try the
patch at the end?

Steps to reproduce:

  1. $ emacs -Q -D &
  2. (insert-image (create-image "splash.png")
	      (propertize " " 'face '(:box (:line-width 5)))) C-j
  3. C-p C-p

Result:

  The left half of the character `t' just after the image gets erased.

				     YAMAMOTO Mitsuharu
				mituharu <at> math.s.chiba-u.ac.jp

=== modified file 'src/w32term.c'
*** src/w32term.c	2014-03-26 15:57:13 +0000
--- src/w32term.c	2014-03-27 02:32:46 +0000
***************
*** 2082,2094 ****
  static void
  x_draw_image_glyph_string (struct glyph_string *s)
  {
-   int x, y;
    int box_line_hwidth = eabs (s->face->box_line_width);
    int box_line_vwidth = max (s->face->box_line_width, 0);
    int height;
    HBITMAP pixmap = 0;
  
!   height = s->height - 2 * box_line_vwidth;
  
    /* Fill background with face under the image.  Do it only if row is
       taller than image or if image has a clip mask to reduce
--- 2082,2097 ----
  static void
  x_draw_image_glyph_string (struct glyph_string *s)
  {
    int box_line_hwidth = eabs (s->face->box_line_width);
    int box_line_vwidth = max (s->face->box_line_width, 0);
    int height;
    HBITMAP pixmap = 0;
  
!   height = s->height;
!   if (s->slice.y == 0)
!     height -= box_line_vwidth;
!   if (s->slice.y + s->slice.height >= s->img->height)
!     height -= box_line_vwidth;
  
    /* Fill background with face under the image.  Do it only if row is
       taller than image or if image has a clip mask to reduce
***************
*** 2101,2112 ****
        || s->img->pixmap == 0
        || s->width != s->background_width)
      {
!       x = s->x;
        if (s->first_glyph->left_box_line_p
  	  && s->slice.x == 0)
! 	x += box_line_hwidth;
  
-       y = s->y;
        if (s->slice.y == 0)
  	y += box_line_vwidth;
  
--- 2104,2120 ----
        || s->img->pixmap == 0
        || s->width != s->background_width)
      {
!       int x = s->x;
!       int y = s->y;
!       int width = s->background_width;
! 
        if (s->first_glyph->left_box_line_p
  	  && s->slice.x == 0)
! 	{
! 	  x += box_line_hwidth;
! 	  width -= box_line_hwidth;
! 	}
  
        if (s->slice.y == 0)
  	y += box_line_vwidth;
  
***************
*** 2150,2156 ****
  	}
        else
  #endif
! 	x_draw_glyph_string_bg_rect (s, x, y, s->background_width, height);
  
        s->background_filled_p = 1;
      }
--- 2158,2164 ----
  	}
        else
  #endif
! 	x_draw_glyph_string_bg_rect (s, x, y, width, height);
  
        s->background_filled_p = 1;
      }





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17115; Package emacs. (Thu, 27 Mar 2014 04:49:02 GMT) Full text and rfc822 format available.

Message #8 received at 17115 <at> debbugs.gnu.org (full text, mbox):

From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
To: 17115 <at> debbugs.gnu.org
Subject: Re: bug#17115: 24.3.50; possible bug in drawing images with box on W32
Date: Thu, 27 Mar 2014 13:48:10 +0900
>>>>> On Thu, 27 Mar 2014 11:42:09 +0900, YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp> said:

> Recently I found a bug (which is different from Bug#17114) in drawing
> images with box on the Mac port, and I suspect it also happens on W32
> because their code are similar (though I can't test it).  Could
> someone try if it is reproducible on W32 and if so, please try the
> patch at the end?

> Steps to reproduce:

>   1. $ emacs -Q -D &
>   2. (insert-image (create-image "splash.png")
> 	      (propertize " " 'face '(:box (:line-width 5)))) C-j
>   3. C-p C-p

> Result:

>   The left half of the character `t' just after the image gets erased.

Probably "splash.png" in Step 2 should have been "splash.xpm" on W32
so that s->img->mask != NULL holds.

And I managed to reproduce the similar problem also on X11 by
replacing Step 2 with:

  2'. (insert-image (create-image "splash.png" nil nil :margin 10)
	      (propertize " " 'face '(:box (:line-width 5)))) C-j

Below is a patch for X11.

				     YAMAMOTO Mitsuharu
				mituharu <at> math.s.chiba-u.ac.jp

=== modified file 'src/xterm.c'
*** src/xterm.c	2014-03-21 19:04:57 +0000
--- src/xterm.c	2014-03-27 04:34:57 +0000
***************
*** 2402,2416 ****
  	{
  	  int x = s->x;
  	  int y = s->y;
  
  	  if (s->first_glyph->left_box_line_p
  	      && s->slice.x == 0)
! 	    x += box_line_hwidth;
  
  	  if (s->slice.y == 0)
  	    y += box_line_vwidth;
  
! 	  x_draw_glyph_string_bg_rect (s, x, y, s->background_width, height);
  	}
  
        s->background_filled_p = 1;
--- 2402,2420 ----
  	{
  	  int x = s->x;
  	  int y = s->y;
+ 	  int width = s->background_width;
  
  	  if (s->first_glyph->left_box_line_p
  	      && s->slice.x == 0)
! 	    {
! 	      x += box_line_hwidth;
! 	      width -= box_line_hwidth;
! 	    }
  
  	  if (s->slice.y == 0)
  	    y += box_line_vwidth;
  
! 	  x_draw_glyph_string_bg_rect (s, x, y, width, height);
  	}
  
        s->background_filled_p = 1;





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17115; Package emacs. (Thu, 27 Mar 2014 16:30:02 GMT) Full text and rfc822 format available.

Message #11 received at 17115 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
Cc: 17115 <at> debbugs.gnu.org
Subject: Re: bug#17115: 24.3.50; possible bug in drawing images with box on W32
Date: Thu, 27 Mar 2014 18:29:29 +0200
> Date: Thu, 27 Mar 2014 11:42:09 +0900
> From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
> 
> Recently I found a bug (which is different from Bug#17114) in drawing
> images with box on the Mac port, and I suspect it also happens on W32
> because their code are similar (though I can't test it).  Could
> someone try if it is reproducible on W32 and if so, please try the
> patch at the end?
> 
> Steps to reproduce:
> 
>   1. $ emacs -Q -D &
>   2. (insert-image (create-image "splash.png")
> 	      (propertize " " 'face '(:box (:line-width 5)))) C-j
>   3. C-p C-p
> 
> Result:
> 
>   The left half of the character `t' just after the image gets erased.

Confirmed.  (And yes, you need to use the XPM image to reproduce the
problem; PNG doesn't.)

> === modified file 'src/w32term.c'
> *** src/w32term.c	2014-03-26 15:57:13 +0000
> --- src/w32term.c	2014-03-27 02:32:46 +0000

Thanks, I installed this with minor changes (to keep the original
code style intact).




Reply sent to YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>:
You have taken responsibility. (Fri, 28 Mar 2014 00:56:02 GMT) Full text and rfc822 format available.

Notification sent to YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>:
bug acknowledged by developer. (Fri, 28 Mar 2014 00:56:03 GMT) Full text and rfc822 format available.

Message #16 received at 17115-done <at> debbugs.gnu.org (full text, mbox):

From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 17115-done <at> debbugs.gnu.org
Subject: Re: bug#17115: 24.3.50; possible bug in drawing images with box on W32
Date: Fri, 28 Mar 2014 09:54:53 +0900
Version: 24.4

>>>>> On Thu, 27 Mar 2014 18:29:29 +0200, Eli Zaretskii <eliz <at> gnu.org> said:

>> Steps to reproduce:
>> 
>> 1. $ emacs -Q -D &
>> 2. (insert-image (create-image "splash.png")
>> (propertize " " 'face '(:box (:line-width 5)))) C-j
>> 3. C-p C-p
>> 
>> Result:
>> 
>> The left half of the character `t' just after the image gets erased.

> Confirmed.  (And yes, you need to use the XPM image to reproduce the
> problem; PNG doesn't.)

Thanks for confirming this.

>> === modified file 'src/w32term.c'
>> *** src/w32term.c	2014-03-26 15:57:13 +0000
>> --- src/w32term.c	2014-03-27 02:32:46 +0000

> Thanks, I installed this with minor changes (to keep the original
> code style intact).

I moved the variables `x' and `y' to the inner block because that
makes the code look more like the corresponding one in xterm.c.

Anyway, I've just installed the patch for X11.  Closing.

				     YAMAMOTO Mitsuharu
				mituharu <at> math.s.chiba-u.ac.jp




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17115; Package emacs. (Fri, 28 Mar 2014 07:26:01 GMT) Full text and rfc822 format available.

Message #19 received at 17115-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
Cc: 17115-done <at> debbugs.gnu.org
Subject: Re: bug#17115: 24.3.50; possible bug in drawing images with box on W32
Date: Fri, 28 Mar 2014 10:25:03 +0300
> Date: Fri, 28 Mar 2014 09:54:53 +0900
> From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
> Cc: 17115-done <at> debbugs.gnu.org
> 
> > Thanks, I installed this with minor changes (to keep the original
> > code style intact).
> 
> I moved the variables `x' and `y' to the inner block because that
> makes the code look more like the corresponding one in xterm.c.

I don't object that in principle, I just think that style-related
changes like this should be separate from the other changes, because
otherwise they make it harder to understand what exactly was changed,
and why.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 25 Apr 2014 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 12 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.