2291 |
GraphicsImportComponent gi; |
GraphicsImportComponent gi; |
2292 |
Rect rect; |
Rect rect; |
2293 |
int width, height; |
int width, height; |
2294 |
|
ImageDescriptionHandle desc_handle; |
2295 |
short draw_all_pixels; |
short draw_all_pixels; |
2296 |
Lisp_Object specified_bg; |
Lisp_Object specified_bg; |
2297 |
XColor color; |
XColor color; |
2327 |
goto error; |
goto error; |
2328 |
} |
} |
2329 |
} |
} |
2330 |
err = GraphicsImportGetNaturalBounds (gi, &rect); |
err = GraphicsImportGetImageDescription (gi, &desc_handle); |
2331 |
if (err != noErr) |
if (err != noErr || desc_handle == NULL) |
2332 |
{ |
{ |
2333 |
image_error ("Error reading `%s'", img->spec, Qnil); |
image_error ("Error reading `%s'", img->spec, Qnil); |
2334 |
goto error; |
goto error; |
2335 |
} |
} |
2336 |
width = img->width = rect.right - rect.left; |
width = img->width = (*desc_handle)->width; |
2337 |
height = img->height = rect.bottom - rect.top; |
height = img->height = (*desc_handle)->height; |
2338 |
|
DisposeHandle ((Handle)desc_handle); |
2339 |
|
|
2340 |
|
if (!check_image_size (f, width, height)) |
2341 |
|
{ |
2342 |
|
image_error ("Invalid image size", Qnil, Qnil); |
2343 |
|
goto error; |
2344 |
|
} |
2345 |
|
|
2346 |
err = GraphicsImportDoesDrawAllPixels (gi, &draw_all_pixels); |
err = GraphicsImportDoesDrawAllPixels (gi, &draw_all_pixels); |
2347 |
#if 0 |
#if 0 |
2348 |
/* Don't check the error code here. It may have an undocumented |
/* Don't check the error code here. It may have an undocumented |
2544 |
image_error ("Error reading image `%s'", img->spec, Qnil); |
image_error ("Error reading image `%s'", img->spec, Qnil); |
2545 |
return 0; |
return 0; |
2546 |
} |
} |
2547 |
|
width = img->width = CGImageGetWidth (image); |
2548 |
|
height = img->height = CGImageGetHeight (image); |
2549 |
|
|
2550 |
|
if (!check_image_size (f, width, height)) |
2551 |
|
{ |
2552 |
|
UNGCPRO; |
2553 |
|
image_error ("Invalid image size", Qnil, Qnil); |
2554 |
|
return 0; |
2555 |
|
} |
2556 |
|
|
2557 |
if (png_p) |
if (png_p) |
2558 |
{ |
{ |
2566 |
color.blue = BLUE16_FROM_ULONG (color.pixel); |
color.blue = BLUE16_FROM_ULONG (color.pixel); |
2567 |
} |
} |
2568 |
} |
} |
2569 |
width = img->width = CGImageGetWidth (image); |
|
|
height = img->height = CGImageGetHeight (image); |
|
2570 |
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)) |
2571 |
{ |
{ |
2572 |
CGImageRelease (image); |
CGImageRelease (image); |
4207 |
|| width <= 0 || height <= 0 |
|| width <= 0 || height <= 0 |
4208 |
|| num_colors <= 0 || chars_per_pixel <= 0) |
|| num_colors <= 0 || chars_per_pixel <= 0) |
4209 |
goto failure; |
goto failure; |
4210 |
|
|
4211 |
|
if (!check_image_size (f, width, height)) |
4212 |
|
{ |
4213 |
|
image_error ("Invalid image size", Qnil, Qnil); |
4214 |
|
goto failure; |
4215 |
|
} |
4216 |
|
|
4217 |
expect (','); |
expect (','); |
4218 |
|
|
4219 |
XSETFRAME (frame, f); |
XSETFRAME (frame, f); |