all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Reitter <david.reitter@gmail.com>
To: emacs- devel <emacs-devel@gnu.org>
Subject: Re: png images in tool-bar / alpha mask
Date: Sat, 5 Apr 2008 11:58:15 +0100	[thread overview]
Message-ID: <F01C724E-34E6-4F5A-BE40-24CCBB44E1AA@gmail.com> (raw)
In-Reply-To: <wllk3tg6au.wl%mituharu@math.s.chiba-u.ac.jp>

On 4 Apr 2008, at 13:20, YAMAMOTO Mitsuharu wrote:
>
> And the invalidation only takes care of the `mask' spec, but not for
> `conversion'.

Index: image.c
===================================================================
RCS file: /sources/emacs/emacs/src/image.c,v
retrieving revision 1.65.2.13
diff -c -r1.65.2.13 image.c
*** image.c	28 Mar 2008 14:57:32 -0000	1.65.2.13
--- image.c	4 Apr 2008 15:05:11 -0000
***************
*** 1135,1140 ****
--- 1135,1146 ----
        struct image *img = IMAGE_FROM_ID (f, id);
        if (img->mask)
  	mask = Qt;
+ #if USE_CG_DRAWING
+       /* Mask may be in an Alpha channel in the image data */
+       if (img->data.ptr_val != NULL &&
+ 	  CGImageGetAlphaInfo(img->data.ptr_val) != kCGImageAlphaNone)
+ 	mask = Qt;
+ #endif
      }
    else
      error ("Invalid image specification");
***************
*** 1549,1555 ****
      }

  #if defined (MAC_OS) && USE_CG_DRAWING
!   if (img->data.ptr_val)
      {
        CGImageRelease (img->data.ptr_val);
        img->data.ptr_val = NULL;
--- 1555,1561 ----
      }

  #if defined (MAC_OS) && USE_CG_DRAWING
!   if (img->data.ptr_val != NULL)
      {
        CGImageRelease (img->data.ptr_val);
        img->data.ptr_val = NULL;
***************
*** 1835,1840 ****
--- 1841,1848 ----
      {
        Lisp_Object conversion, spec;
        Lisp_Object mask;
+       int release = 0;
+       int found_p = 0;

        spec = img->spec;

***************
*** 1850,1862 ****

        mask = image_spec_value (spec, QCheuristic_mask, NULL);
        if (!NILP (mask))
! 	x_build_heuristic_mask (f, img, mask);
        else
  	{
- 	  int found_p;
-
  	  mask = image_spec_value (spec, QCmask, &found_p);
!
  	  if (EQ (mask, Qheuristic))
  	    x_build_heuristic_mask (f, img, Qt);
  	  else if (CONSP (mask)
--- 1858,1872 ----

        mask = image_spec_value (spec, QCheuristic_mask, NULL);
        if (!NILP (mask))
! 	{
! 	  release = 1;
! 	  x_build_heuristic_mask (f, img, mask);
! 	}
        else
  	{
  	  mask = image_spec_value (spec, QCmask, &found_p);
! 	  if (found_p)
! 	    release = 1;
  	  if (EQ (mask, Qheuristic))
  	    x_build_heuristic_mask (f, img, Qt);
  	  else if (CONSP (mask)
***************
*** 1876,1882 ****


        /* Should we apply an image transformation algorithm?  */
!       conversion = image_spec_value (spec, QCconversion, NULL);
        if (EQ (conversion, Qdisabled))
  	x_disable_image (f, img);
        else if (EQ (conversion, Qlaplace))
--- 1886,1895 ----


        /* Should we apply an image transformation algorithm?  */
!       found_p = 0;
!       conversion = image_spec_value (spec, QCconversion, &found_p);
!       if (found_p)
! 	release = 1;
        if (EQ (conversion, Qdisabled))
  	x_disable_image (f, img);
        else if (EQ (conversion, Qlaplace))
***************
*** 1893,1898 ****
--- 1906,1918 ----
  			      Fplist_get (tem, QCmatrix),
  			      Fplist_get (tem, QCcolor_adjustment));
  	}
+ #if defined (MAC_OS) && USE_CG_DRAWING
+       if (release && img->data.ptr_val != NULL)
+ 	{
+ 	  CGImageRelease (img->data.ptr_val);
+ 	  img->data.ptr_val = NULL;
+ 	}
+ #endif
      }
  }

***************
*** 2767,2773 ****
--- 2787,2798 ----
      }
    CGContextDrawImage (context, rectangle, image);
    QDEndCGContext (ximg, &context);
+
+ #if USE_CG_DRAWING
+   img->data.ptr_val = image; /* retain original data */
+ #else
    CGImageRelease (image);
+ #endif

    /* Maybe fill in the background field while we have ximg handy. */
    if (NILP (image_spec_value (img->spec, QCbackground, NULL)))





  reply	other threads:[~2008-04-05 10:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-01 17:14 png images in tool-bar / alpha mask David Reitter
2008-04-01 21:41 ` YAMAMOTO Mitsuharu
2008-04-01 23:10   ` David Reitter
2008-04-02 12:39     ` YAMAMOTO Mitsuharu
2008-04-03 15:09       ` David Reitter
2008-04-03 21:15         ` YAMAMOTO Mitsuharu
2008-04-03 21:42           ` David Reitter
2008-04-03 21:55             ` YAMAMOTO Mitsuharu
2008-04-03 22:42               ` David Reitter
2008-04-03 23:12                 ` YAMAMOTO Mitsuharu
2008-04-04 11:24                   ` David Reitter
2008-04-04 12:20                     ` YAMAMOTO Mitsuharu
2008-04-05 10:58                       ` David Reitter [this message]
2008-04-06  2:52                         ` YAMAMOTO Mitsuharu
2008-04-06 13:42                           ` David Reitter
2008-04-06 14:09                             ` YAMAMOTO Mitsuharu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F01C724E-34E6-4F5A-BE40-24CCBB44E1AA@gmail.com \
    --to=david.reitter@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.