Commit b6e3efe0 authored by YAMAMOTO Mitsuharu's avatar YAMAMOTO Mitsuharu
Browse files

(GC_CLIP_REGION): Remove macro.

(mac_begin_clip, mac_end_clip): Take arg GC instead of REGION.
All uses changed.  Don't do clipping if n_clip_rects is zero.
(mac_set_clip_rectangles): Use xassert instead of abort.  Set
n_clip_rects.  Don't make clip_region empty when number of
clipping rectangles is zero.
(mac_reset_clip_rectangles): Set n_clip_rects directly instead of
calling mac_set_clip_rectangles.
(x_set_toolkit_scroll_bar_thumb): Temporarily hide scroll bar to
avoid multiple redraws.
parent e188aa29
2006-02-22 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
* macgui.h (struct _XGC) [!MAC_OSX || !USE_ATSUI]: New member
n_clip_rects.
* macmenu.c (digest_single_submenu): Apply 2006-02-19 change for
xmenu.c.
* macterm.c (GC_CLIP_REGION): Remove macro.
(mac_begin_clip, mac_end_clip): Take arg GC instead of REGION.
All uses changed. Don't do clipping if n_clip_rects is zero.
(mac_set_clip_rectangles): Use xassert instead of abort. Set
n_clip_rects. Don't make clip_region empty when number of
clipping rectangles is zero.
(mac_reset_clip_rectangles): Set n_clip_rects directly instead of
calling mac_set_clip_rectangles.
(x_set_toolkit_scroll_bar_thumb): Temporarily hide scroll bar to
avoid multiple redraws.
2006-02-22 Kim F. Storm <storm@cua.dk> 2006-02-22 Kim F. Storm <storm@cua.dk>
   
* fringe.c (draw_fringe_bitmap): Fix overlay-arrow display. * fringe.c (draw_fringe_bitmap): Fix overlay-arrow display.
......
...@@ -267,14 +267,13 @@ extern void menubar_selection_callback (FRAME_PTR, int); ...@@ -267,14 +267,13 @@ extern void menubar_selection_callback (FRAME_PTR, int);
#define GC_FORE_COLOR(gc) (&(gc)->fore_color) #define GC_FORE_COLOR(gc) (&(gc)->fore_color)
#define GC_BACK_COLOR(gc) (&(gc)->back_color) #define GC_BACK_COLOR(gc) (&(gc)->back_color)
#define GC_FONT(gc) ((gc)->xgcv.font) #define GC_FONT(gc) ((gc)->xgcv.font)
#define GC_CLIP_REGION(gc) ((gc)->clip_region)
#define FRAME_NORMAL_GC(f) ((f)->output_data.mac->normal_gc) #define FRAME_NORMAL_GC(f) ((f)->output_data.mac->normal_gc)
static RgnHandle saved_port_clip_region = NULL; static RgnHandle saved_port_clip_region = NULL;
static void static void
mac_begin_clip (region) mac_begin_clip (gc)
RgnHandle region; GC gc;
{ {
static RgnHandle new_region = NULL; static RgnHandle new_region = NULL;
...@@ -283,19 +282,19 @@ mac_begin_clip (region) ...@@ -283,19 +282,19 @@ mac_begin_clip (region)
if (new_region == NULL) if (new_region == NULL)
new_region = NewRgn (); new_region = NewRgn ();
if (region && !EmptyRgn (region)) if (gc->n_clip_rects)
{ {
GetClip (saved_port_clip_region); GetClip (saved_port_clip_region);
SectRgn (saved_port_clip_region, region, new_region); SectRgn (saved_port_clip_region, gc->clip_region, new_region);
SetClip (new_region); SetClip (new_region);
} }
} }
static void static void
mac_end_clip (region) mac_end_clip (gc)
RgnHandle region; GC gc;
{ {
if (region && !EmptyRgn (region)) if (gc->n_clip_rects)
SetClip (saved_port_clip_region); SetClip (saved_port_clip_region);
} }
...@@ -323,10 +322,10 @@ mac_draw_line (f, gc, x1, y1, x2, y2) ...@@ -323,10 +322,10 @@ mac_draw_line (f, gc, x1, y1, x2, y2)
RGBForeColor (GC_FORE_COLOR (gc)); RGBForeColor (GC_FORE_COLOR (gc));
mac_begin_clip (GC_CLIP_REGION (gc)); mac_begin_clip (gc);
MoveTo (x1, y1); MoveTo (x1, y1);
LineTo (x2, y2); LineTo (x2, y2);
mac_end_clip (GC_CLIP_REGION (gc)); mac_end_clip (gc);
} }
void void
...@@ -367,9 +366,9 @@ mac_erase_rectangle (f, gc, x, y, width, height) ...@@ -367,9 +366,9 @@ mac_erase_rectangle (f, gc, x, y, width, height)
RGBBackColor (GC_BACK_COLOR (gc)); RGBBackColor (GC_BACK_COLOR (gc));
SetRect (&r, x, y, x + width, y + height); SetRect (&r, x, y, x + width, y + height);
mac_begin_clip (GC_CLIP_REGION (gc)); mac_begin_clip (gc);
EraseRect (&r); EraseRect (&r);
mac_end_clip (GC_CLIP_REGION (gc)); mac_end_clip (gc);
RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
} }
...@@ -432,7 +431,7 @@ mac_draw_bitmap (f, gc, x, y, width, height, bits, overlay_p) ...@@ -432,7 +431,7 @@ mac_draw_bitmap (f, gc, x, y, width, height, bits, overlay_p)
RGBBackColor (GC_BACK_COLOR (gc)); RGBBackColor (GC_BACK_COLOR (gc));
SetRect (&r, x, y, x + width, y + height); SetRect (&r, x, y, x + width, y + height);
mac_begin_clip (GC_CLIP_REGION (gc)); mac_begin_clip (gc);
#if TARGET_API_MAC_CARBON #if TARGET_API_MAC_CARBON
{ {
CGrafPtr port; CGrafPtr port;
...@@ -447,7 +446,7 @@ mac_draw_bitmap (f, gc, x, y, width, height, bits, overlay_p) ...@@ -447,7 +446,7 @@ mac_draw_bitmap (f, gc, x, y, width, height, bits, overlay_p)
CopyBits (&bitmap, &(FRAME_MAC_WINDOW (f)->portBits), &(bitmap.bounds), &r, CopyBits (&bitmap, &(FRAME_MAC_WINDOW (f)->portBits), &(bitmap.bounds), &r,
overlay_p ? srcOr : srcCopy, 0); overlay_p ? srcOr : srcCopy, 0);
#endif /* not TARGET_API_MAC_CARBON */ #endif /* not TARGET_API_MAC_CARBON */
mac_end_clip (GC_CLIP_REGION (gc)); mac_end_clip (gc);
RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
} }
...@@ -579,9 +578,9 @@ mac_fill_rectangle (f, gc, x, y, width, height) ...@@ -579,9 +578,9 @@ mac_fill_rectangle (f, gc, x, y, width, height)
RGBForeColor (GC_FORE_COLOR (gc)); RGBForeColor (GC_FORE_COLOR (gc));
SetRect (&r, x, y, x + width, y + height); SetRect (&r, x, y, x + width, y + height);
mac_begin_clip (GC_CLIP_REGION (gc)); mac_begin_clip (gc);
PaintRect (&r); /* using foreground color of gc */ PaintRect (&r); /* using foreground color of gc */
mac_end_clip (GC_CLIP_REGION (gc)); mac_end_clip (gc);
} }
...@@ -601,9 +600,9 @@ mac_draw_rectangle (f, gc, x, y, width, height) ...@@ -601,9 +600,9 @@ mac_draw_rectangle (f, gc, x, y, width, height)
RGBForeColor (GC_FORE_COLOR (gc)); RGBForeColor (GC_FORE_COLOR (gc));
SetRect (&r, x, y, x + width + 1, y + height + 1); SetRect (&r, x, y, x + width + 1, y + height + 1);
mac_begin_clip (GC_CLIP_REGION (gc)); mac_begin_clip (gc);
FrameRect (&r); /* using foreground color of gc */ FrameRect (&r); /* using foreground color of gc */
mac_end_clip (GC_CLIP_REGION (gc)); mac_end_clip (gc);
} }
...@@ -718,7 +717,7 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char) ...@@ -718,7 +717,7 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char)
if (!mac_use_core_graphics) if (!mac_use_core_graphics)
{ {
#endif #endif
mac_begin_clip (GC_CLIP_REGION (gc)); mac_begin_clip (gc);
RGBForeColor (GC_FORE_COLOR (gc)); RGBForeColor (GC_FORE_COLOR (gc));
if (bg_width) if (bg_width)
{ {
...@@ -734,7 +733,7 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char) ...@@ -734,7 +733,7 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char)
ATSUDrawText (text_layout, ATSUDrawText (text_layout,
kATSUFromTextBeginning, kATSUToTextEnd, kATSUFromTextBeginning, kATSUToTextEnd,
kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc); kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc);
mac_end_clip (GC_CLIP_REGION (gc)); mac_end_clip (gc);
#ifdef MAC_OSX #ifdef MAC_OSX
} }
else else
...@@ -807,7 +806,7 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char) ...@@ -807,7 +806,7 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char)
if (mac_use_core_graphics) if (mac_use_core_graphics)
savedFlags = SwapQDTextFlags (kQDUseCGTextRendering); savedFlags = SwapQDTextFlags (kQDUseCGTextRendering);
#endif #endif
mac_begin_clip (GC_CLIP_REGION (gc)); mac_begin_clip (gc);
RGBForeColor (GC_FORE_COLOR (gc)); RGBForeColor (GC_FORE_COLOR (gc));
#ifdef MAC_OS8 #ifdef MAC_OS8
if (bg_width) if (bg_width)
...@@ -843,7 +842,7 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char) ...@@ -843,7 +842,7 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char)
DrawText (buf, 0, nchars * bytes_per_char); DrawText (buf, 0, nchars * bytes_per_char);
if (bg_width) if (bg_width)
RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
mac_end_clip (GC_CLIP_REGION (gc)); mac_end_clip (gc);
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
if (mac_use_core_graphics) if (mac_use_core_graphics)
...@@ -1185,7 +1184,7 @@ mac_copy_area (src, f, gc, src_x, src_y, width, height, dest_x, dest_y) ...@@ -1185,7 +1184,7 @@ mac_copy_area (src, f, gc, src_x, src_y, width, height, dest_x, dest_y)
ForeColor (blackColor); ForeColor (blackColor);
BackColor (whiteColor); BackColor (whiteColor);
mac_begin_clip (GC_CLIP_REGION (gc)); mac_begin_clip (gc);
LockPixels (GetGWorldPixMap (src)); LockPixels (GetGWorldPixMap (src));
#if TARGET_API_MAC_CARBON #if TARGET_API_MAC_CARBON
{ {
...@@ -1203,7 +1202,7 @@ mac_copy_area (src, f, gc, src_x, src_y, width, height, dest_x, dest_y) ...@@ -1203,7 +1202,7 @@ mac_copy_area (src, f, gc, src_x, src_y, width, height, dest_x, dest_y)
&src_r, &dest_r, srcCopy, 0); &src_r, &dest_r, srcCopy, 0);
#endif /* not TARGET_API_MAC_CARBON */ #endif /* not TARGET_API_MAC_CARBON */
UnlockPixels (GetGWorldPixMap (src)); UnlockPixels (GetGWorldPixMap (src));
mac_end_clip (GC_CLIP_REGION (gc)); mac_end_clip (gc);
RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
} }
...@@ -1229,7 +1228,7 @@ mac_copy_area_with_mask (src, mask, f, gc, src_x, src_y, ...@@ -1229,7 +1228,7 @@ mac_copy_area_with_mask (src, mask, f, gc, src_x, src_y,
ForeColor (blackColor); ForeColor (blackColor);
BackColor (whiteColor); BackColor (whiteColor);
mac_begin_clip (GC_CLIP_REGION (gc)); mac_begin_clip (gc);
LockPixels (GetGWorldPixMap (src)); LockPixels (GetGWorldPixMap (src));
LockPixels (GetGWorldPixMap (mask)); LockPixels (GetGWorldPixMap (mask));
#if TARGET_API_MAC_CARBON #if TARGET_API_MAC_CARBON
...@@ -1249,7 +1248,7 @@ mac_copy_area_with_mask (src, mask, f, gc, src_x, src_y, ...@@ -1249,7 +1248,7 @@ mac_copy_area_with_mask (src, mask, f, gc, src_x, src_y,
#endif /* not TARGET_API_MAC_CARBON */ #endif /* not TARGET_API_MAC_CARBON */
UnlockPixels (GetGWorldPixMap (mask)); UnlockPixels (GetGWorldPixMap (mask));
UnlockPixels (GetGWorldPixMap (src)); UnlockPixels (GetGWorldPixMap (src));
mac_end_clip (GC_CLIP_REGION (gc)); mac_end_clip (gc);
RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
} }
...@@ -1287,9 +1286,9 @@ mac_scroll_area (f, gc, src_x, src_y, width, height, dest_x, dest_y) ...@@ -1287,9 +1286,9 @@ mac_scroll_area (f, gc, src_x, src_y, width, height, dest_x, dest_y)
color mapping in CopyBits. Otherwise, it will be slow. */ color mapping in CopyBits. Otherwise, it will be slow. */
ForeColor (blackColor); ForeColor (blackColor);
BackColor (whiteColor); BackColor (whiteColor);
mac_begin_clip (GC_CLIP_REGION (gc)); mac_begin_clip (gc);
CopyBits (&(w->portBits), &(w->portBits), &src_r, &dest_r, srcCopy, 0); CopyBits (&(w->portBits), &(w->portBits), &src_r, &dest_r, srcCopy, 0);
mac_end_clip (GC_CLIP_REGION (gc)); mac_end_clip (gc);
RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
#endif /* not TARGET_API_MAC_CARBON */ #endif /* not TARGET_API_MAC_CARBON */
...@@ -1425,14 +1424,10 @@ mac_set_clip_rectangles (display, gc, rectangles, n) ...@@ -1425,14 +1424,10 @@ mac_set_clip_rectangles (display, gc, rectangles, n)
{ {
int i; int i;
if (n < 0 || n > MAX_CLIP_RECTS) xassert (n >= 0 && n <= MAX_CLIP_RECTS);
abort ();
if (n == 0) gc->n_clip_rects = n;
{ if (n > 0)
if (gc->clip_region)
SetEmptyRgn (gc->clip_region);
}
else
{ {
if (gc->clip_region == NULL) if (gc->clip_region == NULL)
gc->clip_region = NewRgn (); gc->clip_region = NewRgn ();
...@@ -1450,8 +1445,6 @@ mac_set_clip_rectangles (display, gc, rectangles, n) ...@@ -1450,8 +1445,6 @@ mac_set_clip_rectangles (display, gc, rectangles, n)
} }
} }
#if defined (MAC_OSX) && USE_ATSUI #if defined (MAC_OSX) && USE_ATSUI
gc->n_clip_rects = n;
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
Rect *rect = rectangles + i; Rect *rect = rectangles + i;
...@@ -1471,7 +1464,7 @@ mac_reset_clip_rectangles (display, gc) ...@@ -1471,7 +1464,7 @@ mac_reset_clip_rectangles (display, gc)
Display *display; Display *display;
GC gc; GC gc;
{ {
mac_set_clip_rectangles (display, gc, NULL, 0); gc->n_clip_rects = 0;
} }
...@@ -4536,8 +4529,7 @@ x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole) ...@@ -4536,8 +4529,7 @@ x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole)
int portion, position, whole; int portion, position, whole;
{ {
ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar); ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar);
int value, viewsize, maximum, visible_p;
int value, viewsize, maximum;
if (whole == 0 || XINT (bar->track_height) == 0) if (whole == 0 || XINT (bar->track_height) == 0)
value = 0, viewsize = 1, maximum = 0; value = 0, viewsize = 1, maximum = 0;
...@@ -4550,11 +4542,17 @@ x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole) ...@@ -4550,11 +4542,17 @@ x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole)
BLOCK_INPUT; BLOCK_INPUT;
/* Temporarily hide the scroll bar to avoid multiple redraws. */
visible_p = IsControlVisible (ch);
SetControlVisibility (ch, false, false);
SetControl32BitMinimum (ch, 0); SetControl32BitMinimum (ch, 0);
SetControl32BitMaximum (ch, maximum); SetControl32BitMaximum (ch, maximum);
SetControl32BitValue (ch, value); SetControl32BitValue (ch, value);
SetControlViewSize (ch, viewsize); SetControlViewSize (ch, viewsize);
SetControlVisibility (ch, visible_p, true);
UNBLOCK_INPUT; UNBLOCK_INPUT;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment