Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emacs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
4
Issues
4
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
emacs
emacs
Commits
f67e15be
Commit
f67e15be
authored
May 04, 2008
by
Miles Bader
Browse files
Options
Browse Files
Download
Plain Diff
Merge from emacs--rel--22
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1142
parents
f8a29505
092a8af3
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
698 additions
and
43 deletions
+698
-43
ChangeLog
ChangeLog
+7
-0
configure
configure
+140
-0
configure.in
configure.in
+1
-0
src/ChangeLog
src/ChangeLog
+49
-0
src/config.in
src/config.in
+3
-0
src/image.c
src/image.c
+359
-40
src/macgui.h
src/macgui.h
+11
-0
src/macterm.c
src/macterm.c
+98
-1
src/macterm.h
src/macterm.h
+7
-1
src/s/darwin.h
src/s/darwin.h
+23
-1
No files found.
ChangeLog
View file @
f67e15be
2008-05-04 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
* configure.in: Check availability of AvailabilityMacros.h
if HAVE_CARBON.
* configure: Regenerate.
2008-05-03 Glenn Morris <rgm@gnu.org>
* configure.in (x_libraries): Remove standard 64-bit directories -
...
...
configure
View file @
f67e15be
...
...
@@ -15020,6 +15020,146 @@ cat >>confdefs.h <<\_ACEOF
#define HAVE_CARBON 1
_ACEOF
for ac_header in AvailabilityMacros.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
{ echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
ac_res=`eval echo '${'$as_ac_Header'}'`
{ echo "$as_me:$LINENO: result: $ac_res" >&5
echo "${ECHO_T}$ac_res" >&6; }
else
# Is the header compilable?
{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6; }
# Is the header present?
{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF
if { (ac_try="$ac_cpp conftest.$ac_ext"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null && {
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
test ! -s conftest.err
}; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6; }
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
;;
esac
{ echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=\$ac_header_preproc"
fi
ac_res=`eval echo '${'$as_ac_Header'}'`
{ echo "$as_me:$LINENO: result: $ac_res" >&5
echo "${ECHO_T}$ac_res" >&6; }
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
## Specify the install directory
carbon_appdir=
if test "${carbon_appdir_x}" != ""; then
...
...
configure.in
View file @
f67e15be
...
...
@@ -2230,6 +2230,7 @@ AC_CHECK_HEADER(malloc/malloc.h, [AC_DEFINE(HAVE_MALLOC_MALLOC_H, 1, [Define to
### Use Mac OS X Carbon API to implement GUI.
if test "${HAVE_CARBON}" = "yes"; then
AC_DEFINE(HAVE_CARBON, 1, [Define to 1 if you are using the Carbon API on Mac OS X.])
AC_CHECK_HEADERS(AvailabilityMacros.h)
## Specify the install directory
carbon_appdir=
if test "${carbon_appdir_x}" != ""; then
...
...
src/ChangeLog
View file @
f67e15be
2008-05-04 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
* image.c [USE_MAC_IMAGE_IO] (image_load_image_io):
Create bitmap context in native byte order.
* macterm.c (XDrawLine)
(XCreatePixmapFromBitmapData) [USE_MAC_IMAGE_IO]: Create bitmap
context in native byte order.
2008-05-04 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
* config.in: Regenerate.
* image.c (PIX_MASK_DRAW, PIX_MASK_RETAIN) [USE_MAC_IMAGE_IO]:
New definitions for Image I/O support.
(XGetImage, XPutPixel, XGetPixel, XDestroyImage)
(mac_create_cg_image_from_image, x_create_x_image_and_pixmap)
[USE_MAC_IMAGE_IO]: Add implementations for Image I/O support.
(mac_data_provider_release_data, image_load_image_io)
[USE_MAC_IMAGE_IO]: New functions.
(CGImageCreateWithPNGDataProviderProcType) [MAC_OSX]: Remove typedef.
(MyCGImageCreateWithPNGDataProvider) [MAC_OSX]: Remove variable.
(init_image_func_pointer) [MAC_OSX]: Remove function.
(image_load_quartz2d) [MAC_OSX]: Check availability of
CGImageCreateWithPNGDataProvider at compile time.
Use lowercase `false' for boolean constant.
(png_load, jpeg_load, tiff_load, gif_load) [USE_MAC_IMAGE_IO]:
Use image_load_image_io.
(png_load) [!USE_MAC_IMAGE_IO && MAC_OSX]:
Don't check MyCGImageCreateWithPNGDataProvider.
(init_image) [MAC_OSX && TARGET_API_MAC_CARBON]:
Don't call init_image_func_pointer.
* macgui.h (Pixmap) [USE_MAC_IMAGE_IO]: New definition for Image I/O.
* macterm.c (mac_cg_color_space_rgb) [USE_CG_DRAWING]:
Make variable non-static.
(XDrawLine, XCreatePixmap, XCreatePixmapFromBitmapData, XFreePixmap)
[USE_MAC_IMAGE_IO]: Add implementations for Image I/O support.
* macterm.h (ARGB_TO_ULONG, ALPHA_FROM_ULONG): New macros.
(RED_FROM_ULONG): Mask off higher bits.
(mac_cg_color_space_rgb) [USE_MAC_IMAGE_IO]: New extern.
* s/darwin.h [HAVE_CARBON && HAVE_AVAILABILITYMACROS_H]:
Include AvailabilityMacros.h.
(USE_MAC_IMAGE_IO, LIBS_IMAGE) [HAVE_CARBON]: New defines.
(LIBS_CARBON) [HAVE_CARBON]: Use LIBS_IMAGE.
2008-05-03 Stefan Monnier <monnier@iro.umontreal.ca>
* chartab.c (Fset_char_table_range): If range is t, really set all
...
...
src/config.in
View file @
f67e15be
...
...
@@ -90,6 +90,9 @@ Boston, MA 02110-1301, USA. */
/* Define to 1 if ALSA is available. */
#undef HAVE_ALSA
/* Define to 1 if you have the <AvailabilityMacros.h> header file. */
#undef HAVE_AVAILABILITYMACROS_H
/* Define to 1 if you have the `bcmp' function. */
#undef HAVE_BCMP
...
...
src/image.c
View file @
f67e15be
...
...
@@ -115,10 +115,15 @@ typedef struct mac_bitmap_record Bitmap_Record;
#define RGB_PIXEL_COLOR unsigned long
#if USE_MAC_IMAGE_IO
#define PIX_MASK_DRAW 255
#define PIX_MASK_RETAIN 0
#else
/* A black pixel in a mask bitmap/pixmap means ``draw a source
pixel''. A white pixel means ``retain the current pixel''. */
#define PIX_MASK_DRAW RGB_TO_ULONG(0,0,0)
#define PIX_MASK_RETAIN RGB_TO_ULONG(255,255,255)
#endif
#define FRAME_X_VISUAL(f) FRAME_X_DISPLAY_INFO (f)->visual
#define x_defined_color mac_defined_color
...
...
@@ -166,6 +171,7 @@ XGetImage (display, pixmap, x, y, width, height, plane_mask, format)
unsigned long plane_mask; /* not used */
int format; /* not used */
{
#if !USE_MAC_IMAGE_IO
#if GLYPH_DEBUG
xassert (x == 0 && y == 0);
{
...
...
@@ -177,6 +183,7 @@ XGetImage (display, pixmap, x, y, width, height, plane_mask, format)
#endif
LockPixels (GetGWorldPixMap (pixmap));
#endif
return pixmap;
}
...
...
@@ -187,6 +194,12 @@ XPutPixel (ximage, x, y, pixel)
int x, y;
unsigned long pixel;
{
#if USE_MAC_IMAGE_IO
if (ximage->bits_per_pixel == 32)
((unsigned int *)(ximage->data + y * ximage->bytes_per_line))[x] = pixel;
else
((unsigned char *)(ximage->data + y * ximage->bytes_per_line))[x] = pixel;
#else
PixMapHandle pixmap = GetGWorldPixMap (ximage);
short depth = GetPixDepth (pixmap);
...
...
@@ -227,6 +240,7 @@ XPutPixel (ximage, x, y, pixel)
SetGWorld (old_port, old_gdh);
}
#endif
}
static unsigned long
...
...
@@ -234,6 +248,12 @@ XGetPixel (ximage, x, y)
XImagePtr ximage;
int x, y;
{
#if USE_MAC_IMAGE_IO
if (ximage->bits_per_pixel == 32)
return ((unsigned int *)(ximage->data + y * ximage->bytes_per_line))[x];
else
return ((unsigned char *)(ximage->data + y * ximage->bytes_per_line))[x];
#else
PixMapHandle pixmap = GetGWorldPixMap (ximage);
short depth = GetPixDepth (pixmap);
...
...
@@ -271,21 +291,80 @@ XGetPixel (ximage, x, y)
SetGWorld (old_port, old_gdh);
return RGB_TO_ULONG (color.red >> 8, color.green >> 8, color.blue >> 8);
}
#endif
}
static void
XDestroyImage (ximg)
XImagePtr ximg;
{
#if !USE_MAC_IMAGE_IO
UnlockPixels (GetGWorldPixMap (ximg));
#endif
}
#if USE_CG_DRAWING
#if USE_MAC_IMAGE_IO
void
mac_data_provider_release_data (info, data, size)
void *info;
const void *data;
size_t size;
{
xfree ((void *)data);
}
#endif
static CGImageRef
mac_create_cg_image_from_image (f, img)
struct frame *f;
struct image *img;
{
#if USE_MAC_IMAGE_IO
XImagePtr ximg = img->pixmap;
CGDataProviderRef provider;
CGImageRef result;
if (img->mask)
{
int x, y;
unsigned long color, alpha;
for (y = 0; y < ximg->height; y++)
for (x = 0; x < ximg->width; x++)
{
color = XGetPixel (ximg, x, y);
alpha = XGetPixel (img->mask, x, y);
XPutPixel (ximg, x, y,
ARGB_TO_ULONG (alpha,
RED_FROM_ULONG (color)
* alpha / PIX_MASK_DRAW,
GREEN_FROM_ULONG (color)
* alpha / PIX_MASK_DRAW,
BLUE_FROM_ULONG (color)
* alpha / PIX_MASK_DRAW));
}
xfree (img->mask->data);
img->mask->data = NULL;
}
BLOCK_INPUT;
provider = CGDataProviderCreateWithData (NULL, ximg->data,
ximg->bytes_per_line * ximg->height,
mac_data_provider_release_data);
ximg->data = NULL;
result = CGImageCreate (ximg->width, ximg->height, 8, 32,
ximg->bytes_per_line, mac_cg_color_space_rgb,
(img->mask ? kCGImageAlphaPremultipliedFirst
: kCGImageAlphaNoneSkipFirst)
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
| kCGBitmapByteOrder32Host
#endif
, provider, NULL, 0, kCGRenderingIntentDefault);
CGDataProviderRelease (provider);
UNBLOCK_INPUT;
return result;
#else
Pixmap mask;
CGImageRef result = NULL;
...
...
@@ -320,6 +399,7 @@ mac_create_cg_image_from_image (f, img)
UNBLOCK_INPUT;
return result;
#endif
}
#endif /* USE_CG_DRAWING */
#endif /* MAC_OS */
...
...
@@ -2301,7 +2381,9 @@ x_create_x_image_and_pixmap (f, width, height, depth, ximg, pixmap)
return 0;
}
#if !USE_MAC_IMAGE_IO
LockPixels (GetGWorldPixMap (*pixmap));
#endif
*ximg = *pixmap;
return 1;
...
...
@@ -2454,6 +2536,256 @@ slurp_file (file, size)
MAC Image Load Functions
***********************************************************************/
#if USE_MAC_IMAGE_IO
static int
image_load_image_io (f, img, type)
struct frame *f;
struct image *img;
CFStringRef type;
{
CFDictionaryRef options, src_props = NULL, props = NULL;
CFStringRef keys[2];
CFTypeRef values[2];
Lisp_Object specified_file, specified_data;
CGImageSourceRef source = NULL;
size_t count;
CGImageRef image = NULL;
int loop_count = -1;
double delay_time = -1.0;
int width, height;
XImagePtr ximg = NULL;
CGContextRef context;
CGRect rectangle;
int has_alpha_p, gif_p;
gif_p = UTTypeEqual (type, kUTTypeGIF);
keys[0] = kCGImageSourceTypeIdentifierHint;
values[0] = (CFTypeRef) type;
keys[1] = kCGImageSourceShouldCache;
values[1] = (CFTypeRef) kCFBooleanFalse;
options = CFDictionaryCreate (NULL, (const void **) keys,
(const void **) values,
sizeof (keys) / sizeof (keys[0]),
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
if (options == NULL)
{
image_error ("Error creating options for image `%s'", img->spec, Qnil);
return 0;
}
/* Open the file. */
specified_file = image_spec_value (img->spec, QCfile, NULL);
specified_data = image_spec_value (img->spec, QCdata, NULL);
if (NILP (specified_data))
{
Lisp_Object file;
CFStringRef path;
CFURLRef url;
file = x_find_image_file (specified_file);
if (!STRINGP (file))
{
image_error ("Cannot find image file `%s'", specified_file, Qnil);
return 0;
}
path = cfstring_create_with_utf8_cstring (SDATA (file));
if (path)
{
url = CFURLCreateWithFileSystemPath (NULL, path,
kCFURLPOSIXPathStyle, 0);
CFRelease (path);
if (url)
{
source = CGImageSourceCreateWithURL (url, NULL);
CFRelease (url);
}
}
}
else
{
CFDataRef data = CFDataCreate (NULL, SDATA (specified_data),
SBYTES (specified_data));
if (data)
{
source = CGImageSourceCreateWithData (data, options);
CFRelease (data);
}
}
CFRelease (options);
if (source)
{
CFStringRef real_type = CGImageSourceGetType (source);
if (real_type && UTTypeEqual (type, real_type))
src_props = CGImageSourceCopyProperties (source, NULL);
if (src_props)
{
EMACS_INT ino = 0;
count = CGImageSourceGetCount (source);
if (gif_p)
{
Lisp_Object image = image_spec_value (img->spec, QCindex, NULL);
if (INTEGERP (image))
ino = XFASTINT (image);
}
if (ino >= 0 && ino < count)
{
props = CGImageSourceCopyPropertiesAtIndex (source, ino, NULL);
if (props)
image = CGImageSourceCreateImageAtIndex (source, ino, NULL);
}
}
CFRelease (source);
}
if (image == NULL)
{
if (src_props)
CFRelease (src_props);
if (props)
CFRelease (props);
image_error ("Error reading image `%s'", img->spec, Qnil);
return 0;
}
else
{
CFBooleanRef boolean;
if (CFDictionaryGetValueIfPresent (props, kCGImagePropertyHasAlpha,
(const void **) &boolean))
has_alpha_p = CFBooleanGetValue (boolean);
if (gif_p)
{
CFDictionaryRef dict;
CFNumberRef number;
dict = CFDictionaryGetValue (src_props,
kCGImagePropertyGIFDictionary);
if (dict
&& CFDictionaryGetValueIfPresent (dict,
kCGImagePropertyGIFLoopCount,
(const void **) &number))
CFNumberGetValue (number, kCFNumberIntType, &loop_count);
dict = CFDictionaryGetValue (props, kCGImagePropertyGIFDictionary);
if (dict
&& CFDictionaryGetValueIfPresent (dict,
kCGImagePropertyGIFDelayTime,
(const void **) &number))
CFNumberGetValue (number, kCFNumberDoubleType, &delay_time);
}
CFRelease (src_props);
CFRelease (props);
}
width = img->width = CGImageGetWidth (image);
height = img->height = CGImageGetHeight (image);
if (!check_image_size (f, width, height))
{
CGImageRelease (image);
image_error ("Invalid image size", Qnil, Qnil);
return 0;
}
if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
{
CGImageRelease (image);
image_error ("Out of memory (%s)", img->spec, Qnil);
return 0;
}
rectangle = CGRectMake (0, 0, width, height);
context = CGBitmapContextCreate (ximg->data, ximg->width, ximg->height, 8,
ximg->bytes_per_line,
mac_cg_color_space_rgb,
kCGImageAlphaNoneSkipFirst
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
| kCGBitmapByteOrder32Host
#endif
);
if (has_alpha_p)
{
Lisp_Object specified_bg;
XColor color;
specified_bg = image_spec_value (img->spec, QCbackground, NULL);
if (!STRINGP (specified_bg)
|| !mac_defined_color (f, SDATA (specified_bg), &color, 0))
{
color.pixel = FRAME_BACKGROUND_PIXEL (f);
color.red = RED16_FROM_ULONG (color.pixel);
color.green = GREEN16_FROM_ULONG (color.pixel);
color.blue = BLUE16_FROM_ULONG (color.pixel);
}
CGContextSetRGBFillColor (context, color.red / 65535.0,
color.green / 65535.0,
color.blue / 65535.0, 1.0);
CGContextFillRect (context, rectangle);
}
CGContextDrawImage (context, rectangle, image);
CGContextRelease (context);
CGImageRelease (image);
/* Save GIF image extension data for `image-extension-data'.
Format is (count IMAGES
0xff "NETSCAPE2.0" 0x00 DATA_SUB_BLOCK_FOR_LOOP_COUNT
0xf9 GRAPHIC_CONTROL_EXTENSION_BLOCK). */
if (gif_p)
{
img->data.lisp_val = Qnil;
if (delay_time >= 0)
{
Lisp_Object gce = make_uninit_string (4);
int centisec = delay_time * 100.0 + 0.5;
/* Fill the delay time field. */
SSET (gce, 1, centisec & 0xff);
SSET (gce, 2, (centisec >> 8) & 0xff);
/* We don't know about other fields. */
SSET (gce, 0, 0);
SSET (gce, 3, 0);
img->data.lisp_val = Fcons (make_number (0xf9),
Fcons (gce,
img->data.lisp_val));
}
if (loop_count >= 0)
{
Lisp_Object data_sub_block = make_uninit_string (3);
SSET (data_sub_block, 0, 0x01);
SSET (data_sub_block, 1, loop_count & 0xff);
SSET (data_sub_block, 2, (loop_count >> 8) & 0xff);
img->data.lisp_val = Fcons (make_number (0),
Fcons (data_sub_block,
img->data.lisp_val));
img->data.lisp_val = Fcons (make_number (0xff),
Fcons (build_string ("NETSCAPE2.0"),
img->data.lisp_val));
}
if (count > 1)
img->data.lisp_val = Fcons (Qcount,
Fcons (make_number (count),
img->data.lisp_val));
}
/* Maybe fill in the background field while we have ximg handy. */
if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
IMAGE_BACKGROUND (img, f, ximg);
/* Put the image into the pixmap. */
x_put_x_image (f, ximg, img->pixmap, width, height);
x_destroy_x_image (ximg);
return 1;
}
#else /* !USE_MAC_IMAGE_IO */
static int image_load_quicktime P_ ((struct frame *, struct image *img,
OSType));
#ifdef MAC_OSX
...
...
@@ -2666,30 +2998,6 @@ image_load_quicktime (f, img, type)
#ifdef MAC_OSX
/* Load a PNG/JPEG image using Quartz 2D decoding routines.
CGImageCreateWithPNGDataProvider is provided after Mac OS X 10.2.
So don't use this function directly but determine at runtime
whether it exists. */
typedef CGImageRef (*CGImageCreateWithPNGDataProviderProcType)
(CGDataProviderRef, const float [], bool, CGColorRenderingIntent);
static CGImageCreateWithPNGDataProviderProcType MyCGImageCreateWithPNGDataProvider;
static void
init_image_func_pointer ()
{
if (NSIsSymbolNameDefined ("_CGImageCreateWithPNGDataProvider"))
{
MyCGImageCreateWithPNGDataProvider
= (CGImageCreateWithPNGDataProviderProcType)
NSAddressOfSymbol (NSLookupAndBindSymbol
("_CGImageCreateWithPNGDataProvider"));
}
else
MyCGImageCreateWithPNGDataProvider = NULL;
}
static int
image_load_quartz2d (f, img, png_p)
struct frame *f;
...
...
@@ -2737,11 +3045,13 @@ image_load_quartz2d (f, img, png_p)
source = CGDataProviderCreateWithData (NULL, SDATA (specified_data),
SBYTES (specified_data), NULL);
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
if (png_p)
image =
(*MyCGImageCreateWithPNGDataProvider) (source, NULL, FALSE
,
kCGRenderingIntentDefault);
image =
CGImageCreateWithPNGDataProvider (source, NULL, false
,
kCGRenderingIntentDefault);
else
image = CGImageCreateWithJPEGDataProvider (source, NULL, FALSE,
#endif