Mercurial > emacs
changeset 69099:9547db029a2a
(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.
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
---|---|
date | Wed, 22 Feb 2006 07:59:45 +0000 |
parents | 53d05914b117 |
children | 7885f9153d10 |
files | src/macterm.c |
diffstat | 1 files changed, 40 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- a/src/macterm.c Wed Feb 22 07:59:34 2006 +0000 +++ b/src/macterm.c Wed Feb 22 07:59:45 2006 +0000 @@ -267,14 +267,13 @@ #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; @@ -283,19 +282,19 @@ 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; -{ - if (region && !EmptyRgn (region)) +mac_end_clip (gc) + GC gc; +{ + if (gc->n_clip_rects) SetClip (saved_port_clip_region); } @@ -323,10 +322,10 @@ 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 @@ -367,9 +366,9 @@ 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))); } @@ -432,7 +431,7 @@ 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; @@ -447,7 +446,7 @@ 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))); } @@ -579,9 +578,9 @@ 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); } @@ -601,9 +600,9 @@ 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); } @@ -718,7 +717,7 @@ 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) { @@ -734,7 +733,7 @@ ATSUDrawText (text_layout, kATSUFromTextBeginning, kATSUToTextEnd, kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc); - mac_end_clip (GC_CLIP_REGION (gc)); + mac_end_clip (gc); #ifdef MAC_OSX } else @@ -807,7 +806,7 @@ 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) @@ -843,7 +842,7 @@ 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) @@ -1185,7 +1184,7 @@ ForeColor (blackColor); BackColor (whiteColor); - mac_begin_clip (GC_CLIP_REGION (gc)); + mac_begin_clip (gc); LockPixels (GetGWorldPixMap (src)); #if TARGET_API_MAC_CARBON { @@ -1203,7 +1202,7 @@ &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))); } @@ -1229,7 +1228,7 @@ 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 @@ -1249,7 +1248,7 @@ #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))); } @@ -1287,9 +1286,9 @@ 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 */ @@ -1425,14 +1424,10 @@ { 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 (); @@ -1450,8 +1445,6 @@ } } #if defined (MAC_OSX) && USE_ATSUI - gc->n_clip_rects = n; - for (i = 0; i < n; i++) { Rect *rect = rectangles + i; @@ -1471,7 +1464,7 @@ Display *display; GC gc; { - mac_set_clip_rectangles (display, gc, NULL, 0); + gc->n_clip_rects = 0; } @@ -4536,8 +4529,7 @@ 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; @@ -4550,11 +4542,17 @@ 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; }