emacs-devel
[Top][All Lists]
Advanced

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

Re: png images in tool-bar / alpha mask


From: David Reitter
Subject: Re: png images in tool-bar / alpha mask
Date: Thu, 3 Apr 2008 23:42:46 +0100

On 3 Apr 2008, at 22:55, YAMAMOTO Mitsuharu wrote:

prepare_image_for_display is never called before all the
postprocessing for the image is completed.

OK, so postprocessing seems to be the only processing that can be done to an image.


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     3 Apr 2008 22:38:10 -0000
***************
*** 1549,1555 ****
      }

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

  #if defined (MAC_OS) && USE_CG_DRAWING
!   if (img->data.ptr_val != NULL)
      {
        CGImageRelease (img->data.ptr_val);
        img->data.ptr_val = NULL;
***************
*** 1850,1861 ****

        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);
--- 1850,1877 ----

        mask = image_spec_value (spec, QCheuristic_mask, NULL);
        if (!NILP (mask))
!       {
! #if defined (MAC_OS) && USE_CG_DRAWING
!         if (img->data.ptr_val != NULL)
!           {
!             CGImageRelease (img->data.ptr_val);
!             img->data.ptr_val = NULL;
!           }
! #endif
!         x_build_heuristic_mask (f, img, mask);
!       }
        else
        {
          int found_p;

          mask = image_spec_value (spec, QCmask, &found_p);
+ #if defined (MAC_OS) && USE_CG_DRAWING
+         if (!NILP(mask) && img->data.ptr_val != NULL)
+           {
+             CGImageRelease (img->data.ptr_val);
+             img->data.ptr_val = NULL;
+           }
+ #endif

          if (EQ (mask, Qheuristic))
            x_build_heuristic_mask (f, img, Qt);
***************
*** 2756,2761 ****
--- 2772,2782 ----
        UNGCPRO;
        return 0;
      }
+
+ #ifdef USE_CG_DRAWING
+   img->data.ptr_val = image; /* retain original data */
+ #endif
+
    rectangle = CGRectMake (0, 0, width, height);
    QDBeginCGContext (ximg, &context);
    if (png_p)
***************
*** 2767,2773 ****
      }
    CGContextDrawImage (context, rectangle, image);
    QDEndCGContext (ximg, &context);
-   CGImageRelease (image);

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





reply via email to

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