[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/image.c,v
From: |
YAMAMOTO Mitsuharu |
Subject: |
[Emacs-diffs] Changes to emacs/src/image.c,v |
Date: |
Thu, 23 Aug 2007 08:44:57 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: YAMAMOTO Mitsuharu <mituharu> 07/08/23 08:44:57
Index: image.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/image.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -b -r1.79 -r1.80
--- image.c 22 Aug 2007 07:51:39 -0000 1.79
+++ image.c 23 Aug 2007 08:44:57 -0000 1.80
@@ -8403,6 +8403,7 @@
const guint8 *pixels;
int rowstride;
XImagePtr ximg;
+ Lisp_Object specified_bg;
XColor background;
int x;
int y;
@@ -8441,30 +8442,45 @@
eassert (fn_gdk_pixbuf_get_bits_per_sample (pixbuf) == 8);
/* Try to create a x pixmap to hold the svg pixmap. */
- if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
{
+ if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
+ {
g_object_unref (pixbuf);
return 0;
}
init_color_table ();
- /* TODO: The code is somewhat prepared for other environments than
- X, but is far from done. */
+ /* Handle alpha channel by combining the image with a background
+ color. */
+ specified_bg = image_spec_value (img->spec, QCbackground, NULL);
+ if (STRINGP (specified_bg)
+ && x_defined_color (f, SDATA (specified_bg), &background, 0))
+ {
+ background.red >>= 8;
+ background.green >>= 8;
+ background.blue >>= 8;
+ }
+ else
+ {
#ifdef HAVE_X_WINDOWS
-
background.pixel = FRAME_BACKGROUND_PIXEL (f);
x_query_color (f, &background);
- /* SVG pixmaps specify transparency in the last byte, so right shift
- 8 bits to get rid of it, since emacs doesnt support
+ /* SVG pixmaps specify transparency in the last byte, so right
+ shift 8 bits to get rid of it, since emacs doesnt support
transparency. */
background.red >>= 8;
background.green >>= 8;
background.blue >>= 8;
-
-#else /* not HAVE_X_WINDOWS */
+#elif defined (MAC_OS)
+ background.pixel = FRAME_BACKGROUND_PIXEL (f);
+ background.red = RED_FROM_ULONG (background.pixel);
+ background.green = GREEN_FROM_ULONG (background.pixel);
+ background.blue = BLUE_FROM_ULONG (background.pixel);
+#else /* not HAVE_X_WINDOWS && not MAC_OS*/
#error FIXME
#endif
+ }
/* This loop handles opacity values, since Emacs assumes
non-transparent images. Each pixel must be "flattened" by
@@ -8505,14 +8521,18 @@
g_object_unref (pixbuf);
+ img->width = width;
+ img->height = height;
+
+ /* Maybe fill in the background field while we have ximg handy.
+ Casting avoids a GCC warning. */
+ IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
+
/* Put the image into the pixmap, then free the X image and its
buffer. */
x_put_x_image (f, ximg, img->pixmap, width, height);
x_destroy_x_image (ximg);
- img->width = width;
- img->height = height;
-
return 1;
rsvg_error:
@@ -9072,7 +9092,6 @@
ADD_IMAGE_TYPE(Qsvg);
#endif
-
defsubr (&Sinit_image_library);
defsubr (&Sclear_image_cache);
defsubr (&Simage_refresh);
- [Emacs-diffs] Changes to emacs/src/image.c,v, Chong Yidong, 2007/08/06
- [Emacs-diffs] Changes to emacs/src/image.c,v, Chong Yidong, 2007/08/07
- [Emacs-diffs] Changes to emacs/src/image.c,v, Glenn Morris, 2007/08/22
- [Emacs-diffs] Changes to emacs/src/image.c,v, Glenn Morris, 2007/08/22
- [Emacs-diffs] Changes to emacs/src/image.c,v,
YAMAMOTO Mitsuharu <=
- [Emacs-diffs] Changes to emacs/src/image.c,v, Jason Rumney, 2007/08/23
- [Emacs-diffs] Changes to emacs/src/image.c,v, Juanma Barranquero, 2007/08/24
- [Emacs-diffs] Changes to emacs/src/image.c,v, Miles Bader, 2007/08/29
- [Emacs-diffs] Changes to emacs/src/image.c,v, Stefan Monnier, 2007/08/29
- [Emacs-diffs] Changes to emacs/src/image.c,v, Glenn Morris, 2007/08/30