#define GC_FORE_COLOR(gc) (&(gc)->fore_color)
#define GC_BACK_COLOR(gc) (&(gc)->back_color)
#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)
static RgnHandle saved_port_clip_region = NULL;
static void
-mac_begin_clip (region)
- RgnHandle region;
+mac_begin_clip (gc)
+ GC gc;
{
static RgnHandle new_region = NULL;
if (new_region == NULL)
new_region = NewRgn ();
- if (region && !EmptyRgn (region))
+ if (gc->n_clip_rects)
{
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);
}
}
static void
-mac_end_clip (region)
- RgnHandle region;
+mac_end_clip (gc)
+ GC gc;
{
- if (region && !EmptyRgn (region))
+ if (gc->n_clip_rects)
SetClip (saved_port_clip_region);
}
RGBForeColor (GC_FORE_COLOR (gc));
- mac_begin_clip (GC_CLIP_REGION (gc));
+ mac_begin_clip (gc);
MoveTo (x1, y1);
LineTo (x2, y2);
- mac_end_clip (GC_CLIP_REGION (gc));
+ mac_end_clip (gc);
}
void
RGBBackColor (GC_BACK_COLOR (gc));
SetRect (&r, x, y, x + width, y + height);
- mac_begin_clip (GC_CLIP_REGION (gc));
+ mac_begin_clip (gc);
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 (gc));
SetRect (&r, x, y, x + width, y + height);
- mac_begin_clip (GC_CLIP_REGION (gc));
+ mac_begin_clip (gc);
#if TARGET_API_MAC_CARBON
{
CGrafPtr port;
CopyBits (&bitmap, &(FRAME_MAC_WINDOW (f)->portBits), &(bitmap.bounds), &r,
overlay_p ? srcOr : srcCopy, 0);
#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)));
}
RGBForeColor (GC_FORE_COLOR (gc));
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 */
- mac_end_clip (GC_CLIP_REGION (gc));
+ mac_end_clip (gc);
}
RGBForeColor (GC_FORE_COLOR (gc));
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 */
- mac_end_clip (GC_CLIP_REGION (gc));
+ mac_end_clip (gc);
}
if (!mac_use_core_graphics)
{
#endif
- mac_begin_clip (GC_CLIP_REGION (gc));
+ mac_begin_clip (gc);
RGBForeColor (GC_FORE_COLOR (gc));
if (bg_width)
{
ATSUDrawText (text_layout,
kATSUFromTextBeginning, kATSUToTextEnd,
kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc);
- mac_end_clip (GC_CLIP_REGION (gc));
+ mac_end_clip (gc);
#ifdef MAC_OSX
}
else
if (mac_use_core_graphics)
savedFlags = SwapQDTextFlags (kQDUseCGTextRendering);
#endif
- mac_begin_clip (GC_CLIP_REGION (gc));
+ mac_begin_clip (gc);
RGBForeColor (GC_FORE_COLOR (gc));
#ifdef MAC_OS8
if (bg_width)
DrawText (buf, 0, nchars * bytes_per_char);
if (bg_width)
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_use_core_graphics)
ForeColor (blackColor);
BackColor (whiteColor);
- mac_begin_clip (GC_CLIP_REGION (gc));
+ mac_begin_clip (gc);
LockPixels (GetGWorldPixMap (src));
#if TARGET_API_MAC_CARBON
{
&src_r, &dest_r, srcCopy, 0);
#endif /* not TARGET_API_MAC_CARBON */
UnlockPixels (GetGWorldPixMap (src));
- mac_end_clip (GC_CLIP_REGION (gc));
+ mac_end_clip (gc);
RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
}
ForeColor (blackColor);
BackColor (whiteColor);
- mac_begin_clip (GC_CLIP_REGION (gc));
+ mac_begin_clip (gc);
LockPixels (GetGWorldPixMap (src));
LockPixels (GetGWorldPixMap (mask));
#if TARGET_API_MAC_CARBON
#endif /* not TARGET_API_MAC_CARBON */
UnlockPixels (GetGWorldPixMap (mask));
UnlockPixels (GetGWorldPixMap (src));
- mac_end_clip (GC_CLIP_REGION (gc));
+ mac_end_clip (gc);
RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
}
color mapping in CopyBits. Otherwise, it will be slow. */
ForeColor (blackColor);
BackColor (whiteColor);
- mac_begin_clip (GC_CLIP_REGION (gc));
+ mac_begin_clip (gc);
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)));
#endif /* not TARGET_API_MAC_CARBON */
{
int i;
- if (n < 0 || n > MAX_CLIP_RECTS)
- abort ();
- if (n == 0)
- {
- if (gc->clip_region)
- SetEmptyRgn (gc->clip_region);
- }
- else
+ xassert (n >= 0 && n <= MAX_CLIP_RECTS);
+
+ gc->n_clip_rects = n;
+ if (n > 0)
{
if (gc->clip_region == NULL)
gc->clip_region = NewRgn ();
}
}
#if defined (MAC_OSX) && USE_ATSUI
- gc->n_clip_rects = n;
-
for (i = 0; i < n; i++)
{
Rect *rect = rectangles + i;
Display *display;
GC gc;
{
- mac_set_clip_rectangles (display, gc, NULL, 0);
+ gc->n_clip_rects = 0;
}
int portion, position, whole;
{
ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar);
-
- int value, viewsize, maximum;
+ int value, viewsize, maximum, visible_p;
if (whole == 0 || XINT (bar->track_height) == 0)
value = 0, viewsize = 1, maximum = 0;
BLOCK_INPUT;
+ /* Temporarily hide the scroll bar to avoid multiple redraws. */
+ visible_p = IsControlVisible (ch);
+ SetControlVisibility (ch, false, false);
+
SetControl32BitMinimum (ch, 0);
SetControl32BitMaximum (ch, maximum);
SetControl32BitValue (ch, value);
SetControlViewSize (ch, viewsize);
+ SetControlVisibility (ch, visible_p, true);
+
UNBLOCK_INPUT;
}