+2004-05-07 Steven Tamm <steventamm@mac.com>
+
+ * macterm.c (mac_check_for_quit_char): Adding BLOCK_INPUT
+ around call to ReceiveEvent to avoid certain crashes.
+
+2004-05-07 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
+ * macterm.c (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.
+
2004-05-07 Juanma Barranquero <lektu@terra.es>
* window.c (Fset_window_buffer): Fix docstring.
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
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);
}
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;
#else
EraseRect (&(ximg->portRect));
#endif
+ SetGWorld (old_port, old_gdh);
}
GraphicsImportSetGWorld (gi, ximg, NULL);
GraphicsImportDraw (gi);
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);
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);
GC gc;
int x1, y1, x2, y2;
{
+ CGrafPtr old_port;
+ GDHandle old_gdh;
+
+ GetGWorld (&old_port, &old_gdh);
SetGWorld (p, NULL);
mac_set_colors (gc);
MoveTo (x1, y1);
LineTo (x2, y2);
UnlockPixels (GetGWorldPixMap (p));
+
+ SetGWorld (old_port, old_gdh);
}
/* Mac version of XClearArea. */
{
Pixmap pixmap;
BitMap bitmap;
+ CGrafPtr old_port;
+ GDHandle old_gdh;
pixmap = XCreatePixmap (display, w, width, height, depth);
if (pixmap == NULL)
return NULL;
+ GetGWorld (&old_port, &old_gdh);
SetGWorld (pixmap, NULL);
mac_create_bitmap_from_bitmap_data (&bitmap, data, width, height);
mac_set_forecolor (fg);
&bitmap.bounds, &bitmap.bounds, srcCopy, 0);
#endif /* not TARGET_API_MAC_CARBON */
UnlockPixels (GetGWorldPixMap (pixmap));
+ SetGWorld (old_port, old_gdh);
mac_free_bitmap (&bitmap);
return pixmap;
int x, y;
unsigned int width, height;
{
+ CGrafPtr old_port;
+ GDHandle old_gdh;
Rect r;
+ GetGWorld (&old_port, &old_gdh);
SetGWorld (p, NULL);
mac_set_colors (gc);
SetRect (&r, x, y, x + width, y + height);
LockPixels (GetGWorldPixMap (p));
PaintRect (&r); /* using foreground color of gc */
UnlockPixels (GetGWorldPixMap (p));
+
+ SetGWorld (old_port, old_gdh);
}
int x, y;
unsigned int width, height;
{
+ CGrafPtr old_port;
+ GDHandle old_gdh;
Rect r;
+ GetGWorld (&old_port, &old_gdh);
SetGWorld (p, NULL);
mac_set_colors (gc);
SetRect (&r, x, y, x + width + 1, y + height + 1);
LockPixels (GetGWorldPixMap (p));
FrameRect (&r); /* using foreground color of gc */
UnlockPixels (GetGWorldPixMap (p));
+
+ SetGWorld (old_port, old_gdh);
}
unsigned int width, height;
int dest_x, dest_y;
{
+ CGrafPtr old_port;
+ GDHandle old_gdh;
Rect src_r, dest_r;
+ GetGWorld (&old_port, &old_gdh);
SetGWorld (dest, NULL);
ForeColor (blackColor);
BackColor (whiteColor);
#endif /* not TARGET_API_MAC_CARBON */
UnlockPixels (GetGWorldPixMap (dest));
UnlockPixels (GetGWorldPixMap (src));
+
+ SetGWorld (old_port, old_gdh);
}
unsigned int width, height;
int dest_x, dest_y;
{
+ CGrafPtr old_port;
+ GDHandle old_gdh;
Rect src_r, dest_r;
+ GetGWorld (&old_port, &old_gdh);
SetGWorld (dest, NULL);
ForeColor (blackColor);
BackColor (whiteColor);
UnlockPixels (GetGWorldPixMap (dest));
UnlockPixels (GetGWorldPixMap (mask));
UnlockPixels (GetGWorldPixMap (src));
+
+ SetGWorld (old_port, old_gdh);
}
mac_determine_quit_char_modifiers ();
/* Fill the queue with events */
+ BLOCK_INPUT;
ReceiveNextEvent (0, NULL, kEventDurationNoWait, false, &event);
event = FindSpecificEventInQueue (GetMainEventQueue (), quit_char_comp,
NULL);
+ UNBLOCK_INPUT;
if (event)
{
struct input_event e;