summaryrefslogtreecommitdiff
path: root/src/image.c
diff options
context:
space:
mode:
authorSteven Tamm <steventamm@mac.com>2004-05-07 17:46:50 +0000
committerSteven Tamm <steventamm@mac.com>2004-05-07 17:46:50 +0000
commit2a316a84d5fdae6c12766c32144c15f45542360b (patch)
tree898a5676d68b678c361065c86c76c92c93574e19 /src/image.c
parent7daa20fca46a6dbce0cbca0a935a2798e210237e (diff)
downloademacs-2a316a84d5fdae6c12766c32144c15f45542360b.tar.gz
macterm.c (mac_check_for_quit_char): Adding BLOCK_INPUT
around call to ReceiveEvent to avoid certain crashes. (mac_draw_line_to_pixmap, XCreatePixmapFromBitmapData) (mac_fill_rectangle_to_pixmap, mac_draw_rectangle_to_pixmap) (mac_copy_area_to_pixmap, mac_copy_area_with_mask_to_pixmap): Save/restore the current graphics port and device handle when drawing into an offscreen graphics world. image.c [MAC_OS] (XPutPixel, XGetPixel, image_load_qt_1) (gif_load): Likewise.
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/image.c b/src/image.c
index 09e497576a4..c7bedb5de32 100644
--- a/src/image.c
+++ b/src/image.c
@@ -174,14 +174,19 @@ XPutPixel (ximage, x, y, pixel)
int x, y;
unsigned long pixel;
{
+ CGrafPtr old_port;
+ GDHandle old_gdh;
RGBColor color;
+ GetGWorld (&old_port, &old_gdh);
SetGWorld (ximage, NULL);
color.red = RED16_FROM_ULONG (pixel);
color.green = GREEN16_FROM_ULONG (pixel);
color.blue = BLUE16_FROM_ULONG (pixel);
SetCPixel (x, y, &color);
+
+ SetGWorld (old_port, old_gdh);
}
static unsigned long
@@ -189,11 +194,16 @@ XGetPixel (ximage, x, y)
XImagePtr ximage;
int x, y;
{
+ CGrafPtr old_port;
+ GDHandle old_gdh;
RGBColor color;
+ GetGWorld (&old_port, &old_gdh);
SetGWorld (ximage, NULL);
GetCPixel (x, y, &color);
+
+ SetGWorld (old_port, old_gdh);
return RGB_TO_ULONG (color.red >> 8, color.green >> 8, color.blue >> 8);
}
@@ -2196,6 +2206,10 @@ image_load_qt_1 (f, img, type, fss, dh)
goto error;
if (draw_all_pixels != graphicsImporterDrawsAllPixels)
{
+ CGrafPtr old_port;
+ GDHandle old_gdh;
+
+ GetGWorld (&old_port, &old_gdh);
SetGWorld (ximg, NULL);
bg_color.red = color.red;
bg_color.green = color.green;
@@ -2207,6 +2221,7 @@ image_load_qt_1 (f, img, type, fss, dh)
#else
EraseRect (&(ximg->portRect));
#endif
+ SetGWorld (old_port, old_gdh);
}
GraphicsImportSetGWorld (gi, ximg, NULL);
GraphicsImportDraw (gi);
@@ -6883,6 +6898,8 @@ gif_load (f, img)
TimeValue time;
struct gcpro gcpro1;
int ino;
+ CGrafPtr old_port;
+ GDHandle old_gdh;
specified_file = image_spec_value (img->spec, QCfile, NULL);
specified_data = image_spec_value (img->spec, QCdata, NULL);
@@ -7000,11 +7017,13 @@ gif_load (f, img)
if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
goto error;
+ GetGWorld (&old_port, &old_gdh);
SetGWorld (ximg, NULL);
bg_color.red = color.red;
bg_color.green = color.green;
bg_color.blue = color.blue;
RGBBackColor (&bg_color);
+ SetGWorld (old_port, old_gdh);
SetMovieActive (movie, TRUE);
SetMovieGWorld (movie, ximg, NULL);
SampleNumToMediaTime (media, ino + 1, &time, NULL);