diff options
| author | YAMAMOTO Mitsuharu | 2005-10-08 02:28:09 +0000 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2005-10-08 02:28:09 +0000 |
| commit | 1c4ac540607ae99e769fa04064c0a179720afa40 (patch) | |
| tree | 53e22a51e5b6d015fb0c9982b2f1fd0f92caf3a4 /src/macterm.c | |
| parent | 2be96ef8f959ced275347ce76c34094451c65ced (diff) | |
| download | emacs-1c4ac540607ae99e769fa04064c0a179720afa40.tar.gz emacs-1c4ac540607ae99e769fa04064c0a179720afa40.zip | |
(GC_CLIP_REGION): New macro.
(saved_port_clip_region): New variable.
(mac_begin_clip, mac_end_clip): New functions.
(XDrawLine, mac_erase_rectangle, mac_draw_bitmap, XFillRectangle)
(mac_draw_rectangle, mac_draw_string_common, mac_copy_area)
(mac_copy_area_with_mask, mac_scroll_area): Use them.
(mac_set_clip_rectangle, mac_reset_clipping): Remove functions.
[USE_ATSUI] (atsu_get_text_layout_with_text_ptr)
[MAC_OS_X_VERSION_MAX_ALLOWED < 1020]: Specify kATSLineFractDisable.
(mac_draw_string_common) [MAC_OSX && USE_ATSUI]: Clip to clipping
rectangles stored in gc.
(XFreeGC): Dispose clipping region.
(mac_set_clip_rectangles, mac_reset_clip_rectangles): New functions.
(x_draw_fringe_bitmap, x_set_glyph_string_clipping)
(x_draw_relief_rect, x_draw_box_rect, x_draw_stretch_glyph_string)
(x_draw_glyph_string, x_clip_to_row, x_draw_hollow_cursor)
(x_draw_bar_cursor): Use them.
(x_set_glyph_string_clipping): Use get_glyph_string_clip_rects to
get multiple clipping rectangles.
Diffstat (limited to 'src/macterm.c')
| -rw-r--r-- | src/macterm.c | 208 |
1 files changed, 145 insertions, 63 deletions
diff --git a/src/macterm.c b/src/macterm.c index 94a2c4d5434..7d75e962e9c 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -270,8 +270,38 @@ extern void menubar_selection_callback (FRAME_PTR, int); | |||
| 270 | #define GC_FORE_COLOR(gc) (&(gc)->fore_color) | 270 | #define GC_FORE_COLOR(gc) (&(gc)->fore_color) |
| 271 | #define GC_BACK_COLOR(gc) (&(gc)->back_color) | 271 | #define GC_BACK_COLOR(gc) (&(gc)->back_color) |
| 272 | #define GC_FONT(gc) ((gc)->xgcv.font) | 272 | #define GC_FONT(gc) ((gc)->xgcv.font) |
| 273 | #define GC_CLIP_REGION(gc) ((gc)->clip_region) | ||
| 273 | #define MAC_WINDOW_NORMAL_GC(w) (((mac_output *) GetWRefCon (w))->normal_gc) | 274 | #define MAC_WINDOW_NORMAL_GC(w) (((mac_output *) GetWRefCon (w))->normal_gc) |
| 274 | 275 | ||
| 276 | static RgnHandle saved_port_clip_region = NULL; | ||
| 277 | |||
| 278 | static void | ||
| 279 | mac_begin_clip (region) | ||
| 280 | RgnHandle region; | ||
| 281 | { | ||
| 282 | static RgnHandle new_region = NULL; | ||
| 283 | |||
| 284 | if (saved_port_clip_region == NULL) | ||
| 285 | saved_port_clip_region = NewRgn (); | ||
| 286 | if (new_region == NULL) | ||
| 287 | new_region = NewRgn (); | ||
| 288 | |||
| 289 | if (region) | ||
| 290 | { | ||
| 291 | GetClip (saved_port_clip_region); | ||
| 292 | SectRgn (saved_port_clip_region, region, new_region); | ||
| 293 | SetClip (new_region); | ||
| 294 | } | ||
| 295 | } | ||
| 296 | |||
| 297 | static void | ||
| 298 | mac_end_clip (region) | ||
| 299 | RgnHandle region; | ||
| 300 | { | ||
| 301 | if (region) | ||
| 302 | SetClip (saved_port_clip_region); | ||
| 303 | } | ||
| 304 | |||
| 275 | 305 | ||
| 276 | /* X display function emulation */ | 306 | /* X display function emulation */ |
| 277 | 307 | ||
| @@ -297,8 +327,10 @@ XDrawLine (display, w, gc, x1, y1, x2, y2) | |||
| 297 | 327 | ||
| 298 | RGBForeColor (GC_FORE_COLOR (gc)); | 328 | RGBForeColor (GC_FORE_COLOR (gc)); |
| 299 | 329 | ||
| 330 | mac_begin_clip (GC_CLIP_REGION (gc)); | ||
| 300 | MoveTo (x1, y1); | 331 | MoveTo (x1, y1); |
| 301 | LineTo (x2, y2); | 332 | LineTo (x2, y2); |
| 333 | mac_end_clip (GC_CLIP_REGION (gc)); | ||
| 302 | } | 334 | } |
| 303 | 335 | ||
| 304 | void | 336 | void |
| @@ -339,7 +371,9 @@ mac_erase_rectangle (w, gc, x, y, width, height) | |||
| 339 | RGBBackColor (GC_BACK_COLOR (gc)); | 371 | RGBBackColor (GC_BACK_COLOR (gc)); |
| 340 | SetRect (&r, x, y, x + width, y + height); | 372 | SetRect (&r, x, y, x + width, y + height); |
| 341 | 373 | ||
| 374 | mac_begin_clip (GC_CLIP_REGION (gc)); | ||
| 342 | EraseRect (&r); | 375 | EraseRect (&r); |
| 376 | mac_end_clip (GC_CLIP_REGION (gc)); | ||
| 343 | 377 | ||
| 344 | RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (w))); | 378 | RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (w))); |
| 345 | } | 379 | } |
| @@ -406,6 +440,7 @@ mac_draw_bitmap (display, w, gc, x, y, width, height, bits, overlay_p) | |||
| 406 | RGBBackColor (GC_BACK_COLOR (gc)); | 440 | RGBBackColor (GC_BACK_COLOR (gc)); |
| 407 | SetRect (&r, x, y, x + width, y + height); | 441 | SetRect (&r, x, y, x + width, y + height); |
| 408 | 442 | ||
| 443 | mac_begin_clip (GC_CLIP_REGION (gc)); | ||
| 409 | #if TARGET_API_MAC_CARBON | 444 | #if TARGET_API_MAC_CARBON |
| 410 | LockPortBits (GetWindowPort (w)); | 445 | LockPortBits (GetWindowPort (w)); |
| 411 | CopyBits (&bitmap, GetPortBitMapForCopyBits (GetWindowPort (w)), | 446 | CopyBits (&bitmap, GetPortBitMapForCopyBits (GetWindowPort (w)), |
| @@ -415,41 +450,12 @@ mac_draw_bitmap (display, w, gc, x, y, width, height, bits, overlay_p) | |||
| 415 | CopyBits (&bitmap, &(w->portBits), &(bitmap.bounds), &r, | 450 | CopyBits (&bitmap, &(w->portBits), &(bitmap.bounds), &r, |
| 416 | overlay_p ? srcOr : srcCopy, 0); | 451 | overlay_p ? srcOr : srcCopy, 0); |
| 417 | #endif /* not TARGET_API_MAC_CARBON */ | 452 | #endif /* not TARGET_API_MAC_CARBON */ |
| 453 | mac_end_clip (GC_CLIP_REGION (gc)); | ||
| 418 | 454 | ||
| 419 | RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (w))); | 455 | RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (w))); |
| 420 | } | 456 | } |
| 421 | 457 | ||
| 422 | 458 | ||
| 423 | /* Mac replacement for XSetClipRectangles. */ | ||
| 424 | |||
| 425 | static void | ||
| 426 | mac_set_clip_rectangle (display, w, r) | ||
| 427 | Display *display; | ||
| 428 | WindowPtr w; | ||
| 429 | Rect *r; | ||
| 430 | { | ||
| 431 | SetPortWindowPort (w); | ||
| 432 | |||
| 433 | ClipRect (r); | ||
| 434 | } | ||
| 435 | |||
| 436 | |||
| 437 | /* Mac replacement for XSetClipMask. */ | ||
| 438 | |||
| 439 | static void | ||
| 440 | mac_reset_clipping (display, w) | ||
| 441 | Display *display; | ||
| 442 | WindowPtr w; | ||
| 443 | { | ||
| 444 | Rect r; | ||
| 445 | |||
| 446 | SetPortWindowPort (w); | ||
| 447 | |||
| 448 | SetRect (&r, -32767, -32767, 32767, 32767); | ||
| 449 | ClipRect (&r); | ||
| 450 | } | ||
| 451 | |||
| 452 | |||
| 453 | /* Mac replacement for XCreateBitmapFromBitmapData. */ | 459 | /* Mac replacement for XCreateBitmapFromBitmapData. */ |
| 454 | 460 | ||
| 455 | static void | 461 | static void |
| @@ -577,7 +583,9 @@ XFillRectangle (display, w, gc, x, y, width, height) | |||
| 577 | RGBForeColor (GC_FORE_COLOR (gc)); | 583 | RGBForeColor (GC_FORE_COLOR (gc)); |
| 578 | SetRect (&r, x, y, x + width, y + height); | 584 | SetRect (&r, x, y, x + width, y + height); |
| 579 | 585 | ||
| 586 | mac_begin_clip (GC_CLIP_REGION (gc)); | ||
| 580 | PaintRect (&r); /* using foreground color of gc */ | 587 | PaintRect (&r); /* using foreground color of gc */ |
| 588 | mac_end_clip (GC_CLIP_REGION (gc)); | ||
| 581 | } | 589 | } |
| 582 | 590 | ||
| 583 | 591 | ||
| @@ -625,7 +633,9 @@ mac_draw_rectangle (display, w, gc, x, y, width, height) | |||
| 625 | RGBForeColor (GC_FORE_COLOR (gc)); | 633 | RGBForeColor (GC_FORE_COLOR (gc)); |
| 626 | SetRect (&r, x, y, x + width + 1, y + height + 1); | 634 | SetRect (&r, x, y, x + width + 1, y + height + 1); |
| 627 | 635 | ||
| 636 | mac_begin_clip (GC_CLIP_REGION (gc)); | ||
| 628 | FrameRect (&r); /* using foreground color of gc */ | 637 | FrameRect (&r); /* using foreground color of gc */ |
| 638 | mac_end_clip (GC_CLIP_REGION (gc)); | ||
| 629 | } | 639 | } |
| 630 | 640 | ||
| 631 | 641 | ||
| @@ -678,7 +688,7 @@ atsu_get_text_layout_with_text_ptr (text, text_length, style, text_layout) | |||
| 678 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 | 688 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 |
| 679 | kATSLineDisableAllLayoutOperations | kATSLineUseDeviceMetrics | 689 | kATSLineDisableAllLayoutOperations | kATSLineUseDeviceMetrics |
| 680 | #else | 690 | #else |
| 681 | kATSLineIsDisplayOnly | 691 | kATSLineIsDisplayOnly | kATSLineFractDisable |
| 682 | #endif | 692 | #endif |
| 683 | ; | 693 | ; |
| 684 | ATSUAttributeValuePtr values[] = {&line_layout}; | 694 | ATSUAttributeValuePtr values[] = {&line_layout}; |
| @@ -782,10 +792,12 @@ mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode, | |||
| 782 | if (NILP (Vmac_use_core_graphics)) | 792 | if (NILP (Vmac_use_core_graphics)) |
| 783 | { | 793 | { |
| 784 | #endif | 794 | #endif |
| 795 | mac_begin_clip (GC_CLIP_REGION (gc)); | ||
| 785 | MoveTo (x, y); | 796 | MoveTo (x, y); |
| 786 | ATSUDrawText (text_layout, | 797 | ATSUDrawText (text_layout, |
| 787 | kATSUFromTextBeginning, kATSUToTextEnd, | 798 | kATSUFromTextBeginning, kATSUToTextEnd, |
| 788 | kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc); | 799 | kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc); |
| 800 | mac_end_clip (GC_CLIP_REGION (gc)); | ||
| 789 | #ifdef MAC_OSX | 801 | #ifdef MAC_OSX |
| 790 | } | 802 | } |
| 791 | else | 803 | else |
| @@ -793,7 +805,6 @@ mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode, | |||
| 793 | CGrafPtr port; | 805 | CGrafPtr port; |
| 794 | CGContextRef context; | 806 | CGContextRef context; |
| 795 | Rect rect; | 807 | Rect rect; |
| 796 | RgnHandle region = NewRgn (); | ||
| 797 | float port_height; | 808 | float port_height; |
| 798 | ATSUAttributeTag tags[] = {kATSUCGContextTag}; | 809 | ATSUAttributeTag tags[] = {kATSUCGContextTag}; |
| 799 | ByteCount sizes[] = {sizeof (CGContextRef)}; | 810 | ByteCount sizes[] = {sizeof (CGContextRef)}; |
| @@ -803,16 +814,15 @@ mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode, | |||
| 803 | QDBeginCGContext (port, &context); | 814 | QDBeginCGContext (port, &context); |
| 804 | GetPortBounds (port, &rect); | 815 | GetPortBounds (port, &rect); |
| 805 | port_height = rect.bottom - rect.top; | 816 | port_height = rect.bottom - rect.top; |
| 806 | GetClip (region); | 817 | if (gc->n_clip_rects) |
| 807 | GetRegionBounds (region, &rect); | 818 | { |
| 808 | /* XXX: This is not correct if the clip region is not a | 819 | CGContextTranslateCTM (context, 0, port_height); |
| 809 | simple rectangle. */ | 820 | CGContextScaleCTM (context, 1, -1); |
| 810 | CGContextClipToRect (context, | 821 | CGContextClipToRects (context, gc->clip_rects, |
| 811 | CGRectMake (rect.left, | 822 | gc->n_clip_rects); |
| 812 | port_height - rect.bottom, | 823 | CGContextScaleCTM (context, 1, -1); |
| 813 | rect.right - rect.left, | 824 | CGContextTranslateCTM (context, 0, -port_height); |
| 814 | rect.bottom - rect.top)); | 825 | } |
| 815 | DisposeRgn (region); | ||
| 816 | CGContextSetRGBFillColor | 826 | CGContextSetRGBFillColor |
| 817 | (context, | 827 | (context, |
| 818 | RED_FROM_ULONG (gc->xgcv.foreground) / 255.0, | 828 | RED_FROM_ULONG (gc->xgcv.foreground) / 255.0, |
| @@ -843,8 +853,10 @@ mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode, | |||
| 843 | TextFace (GC_FONT (gc)->mac_fontface); | 853 | TextFace (GC_FONT (gc)->mac_fontface); |
| 844 | TextMode (mode); | 854 | TextMode (mode); |
| 845 | 855 | ||
| 856 | mac_begin_clip (GC_CLIP_REGION (gc)); | ||
| 846 | MoveTo (x, y); | 857 | MoveTo (x, y); |
| 847 | DrawText (buf, 0, nchars * bytes_per_char); | 858 | DrawText (buf, 0, nchars * bytes_per_char); |
| 859 | mac_end_clip (GC_CLIP_REGION (gc)); | ||
| 848 | #if USE_ATSUI | 860 | #if USE_ATSUI |
| 849 | } | 861 | } |
| 850 | #endif | 862 | #endif |
| @@ -943,6 +955,7 @@ mac_copy_area (display, src, dest, gc, src_x, src_y, width, height, dest_x, | |||
| 943 | ForeColor (blackColor); | 955 | ForeColor (blackColor); |
| 944 | BackColor (whiteColor); | 956 | BackColor (whiteColor); |
| 945 | 957 | ||
| 958 | mac_begin_clip (GC_CLIP_REGION (gc)); | ||
| 946 | LockPixels (GetGWorldPixMap (src)); | 959 | LockPixels (GetGWorldPixMap (src)); |
| 947 | #if TARGET_API_MAC_CARBON | 960 | #if TARGET_API_MAC_CARBON |
| 948 | LockPortBits (GetWindowPort (dest)); | 961 | LockPortBits (GetWindowPort (dest)); |
| @@ -955,6 +968,7 @@ mac_copy_area (display, src, dest, gc, src_x, src_y, width, height, dest_x, | |||
| 955 | &src_r, &dest_r, srcCopy, 0); | 968 | &src_r, &dest_r, srcCopy, 0); |
| 956 | #endif /* not TARGET_API_MAC_CARBON */ | 969 | #endif /* not TARGET_API_MAC_CARBON */ |
| 957 | UnlockPixels (GetGWorldPixMap (src)); | 970 | UnlockPixels (GetGWorldPixMap (src)); |
| 971 | mac_end_clip (GC_CLIP_REGION (gc)); | ||
| 958 | 972 | ||
| 959 | RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (dest))); | 973 | RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (dest))); |
| 960 | } | 974 | } |
| @@ -981,6 +995,7 @@ mac_copy_area_with_mask (display, src, mask, dest, gc, src_x, src_y, | |||
| 981 | ForeColor (blackColor); | 995 | ForeColor (blackColor); |
| 982 | BackColor (whiteColor); | 996 | BackColor (whiteColor); |
| 983 | 997 | ||
| 998 | mac_begin_clip (GC_CLIP_REGION (gc)); | ||
| 984 | LockPixels (GetGWorldPixMap (src)); | 999 | LockPixels (GetGWorldPixMap (src)); |
| 985 | LockPixels (GetGWorldPixMap (mask)); | 1000 | LockPixels (GetGWorldPixMap (mask)); |
| 986 | #if TARGET_API_MAC_CARBON | 1001 | #if TARGET_API_MAC_CARBON |
| @@ -995,6 +1010,7 @@ mac_copy_area_with_mask (display, src, mask, dest, gc, src_x, src_y, | |||
| 995 | #endif /* not TARGET_API_MAC_CARBON */ | 1010 | #endif /* not TARGET_API_MAC_CARBON */ |
| 996 | UnlockPixels (GetGWorldPixMap (mask)); | 1011 | UnlockPixels (GetGWorldPixMap (mask)); |
| 997 | UnlockPixels (GetGWorldPixMap (src)); | 1012 | UnlockPixels (GetGWorldPixMap (src)); |
| 1013 | mac_end_clip (GC_CLIP_REGION (gc)); | ||
| 998 | 1014 | ||
| 999 | RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (dest))); | 1015 | RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (dest))); |
| 1000 | } | 1016 | } |
| @@ -1031,7 +1047,9 @@ mac_scroll_area (display, w, gc, src_x, src_y, width, height, dest_x, dest_y) | |||
| 1031 | color mapping in CopyBits. Otherwise, it will be slow. */ | 1047 | color mapping in CopyBits. Otherwise, it will be slow. */ |
| 1032 | ForeColor (blackColor); | 1048 | ForeColor (blackColor); |
| 1033 | BackColor (whiteColor); | 1049 | BackColor (whiteColor); |
| 1050 | mac_begin_clip (GC_CLIP_REGION (gc)); | ||
| 1034 | CopyBits (&(w->portBits), &(w->portBits), &src_r, &dest_r, srcCopy, 0); | 1051 | CopyBits (&(w->portBits), &(w->portBits), &src_r, &dest_r, srcCopy, 0); |
| 1052 | mac_end_clip (GC_CLIP_REGION (gc)); | ||
| 1035 | 1053 | ||
| 1036 | RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (w))); | 1054 | RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (w))); |
| 1037 | #endif /* not TARGET_API_MAC_CARBON */ | 1055 | #endif /* not TARGET_API_MAC_CARBON */ |
| @@ -1166,6 +1184,8 @@ XFreeGC (display, gc) | |||
| 1166 | Display *display; | 1184 | Display *display; |
| 1167 | GC gc; | 1185 | GC gc; |
| 1168 | { | 1186 | { |
| 1187 | if (gc->clip_region) | ||
| 1188 | DisposeRgn (gc->clip_region); | ||
| 1169 | xfree (gc); | 1189 | xfree (gc); |
| 1170 | } | 1190 | } |
| 1171 | 1191 | ||
| @@ -1236,6 +1256,70 @@ XSetFont (display, gc, font) | |||
| 1236 | } | 1256 | } |
| 1237 | 1257 | ||
| 1238 | 1258 | ||
| 1259 | /* Mac replacement for XSetClipRectangles. */ | ||
| 1260 | |||
| 1261 | static void | ||
| 1262 | mac_set_clip_rectangles (display, gc, rectangles, n) | ||
| 1263 | Display *display; | ||
| 1264 | GC gc; | ||
| 1265 | Rect *rectangles; | ||
| 1266 | int n; | ||
| 1267 | { | ||
| 1268 | int i; | ||
| 1269 | |||
| 1270 | if (n < 0 || n > MAX_CLIP_RECTS) | ||
| 1271 | abort (); | ||
| 1272 | if (n == 0) | ||
| 1273 | { | ||
| 1274 | if (gc->clip_region) | ||
| 1275 | { | ||
| 1276 | DisposeRgn (gc->clip_region); | ||
| 1277 | gc->clip_region = NULL; | ||
| 1278 | } | ||
| 1279 | } | ||
| 1280 | else | ||
| 1281 | { | ||
| 1282 | if (gc->clip_region == NULL) | ||
| 1283 | gc->clip_region = NewRgn (); | ||
| 1284 | RectRgn (gc->clip_region, rectangles); | ||
| 1285 | if (n > 1) | ||
| 1286 | { | ||
| 1287 | RgnHandle region = NewRgn (); | ||
| 1288 | |||
| 1289 | for (i = 1; i < n; i++) | ||
| 1290 | { | ||
| 1291 | RectRgn (region, rectangles + i); | ||
| 1292 | UnionRgn (gc->clip_region, region, gc->clip_region); | ||
| 1293 | } | ||
| 1294 | DisposeRgn (region); | ||
| 1295 | } | ||
| 1296 | } | ||
| 1297 | #if defined (MAC_OSX) && USE_ATSUI | ||
| 1298 | gc->n_clip_rects = n; | ||
| 1299 | |||
| 1300 | for (i = 0; i < n; i++) | ||
| 1301 | { | ||
| 1302 | Rect *rect = rectangles + i; | ||
| 1303 | |||
| 1304 | gc->clip_rects[i] = CGRectMake (rect->left, rect->top, | ||
| 1305 | rect->right - rect->left, | ||
| 1306 | rect->bottom - rect->top); | ||
| 1307 | } | ||
| 1308 | #endif | ||
| 1309 | } | ||
| 1310 | |||
| 1311 | |||
| 1312 | /* Mac replacement for XSetClipMask. */ | ||
| 1313 | |||
| 1314 | static INLINE void | ||
| 1315 | mac_reset_clip_rectangles (display, gc) | ||
| 1316 | Display *display; | ||
| 1317 | GC gc; | ||
| 1318 | { | ||
| 1319 | mac_set_clip_rectangles (display, gc, NULL, 0); | ||
| 1320 | } | ||
| 1321 | |||
| 1322 | |||
| 1239 | /* Mac replacement for XSetWindowBackground. */ | 1323 | /* Mac replacement for XSetWindowBackground. */ |
| 1240 | 1324 | ||
| 1241 | void | 1325 | void |
| @@ -1647,7 +1731,7 @@ x_draw_fringe_bitmap (w, row, p) | |||
| 1647 | XSetForeground (display, face->gc, gcv.foreground); | 1731 | XSetForeground (display, face->gc, gcv.foreground); |
| 1648 | } | 1732 | } |
| 1649 | 1733 | ||
| 1650 | mac_reset_clipping (display, window); | 1734 | mac_reset_clip_rectangles (display, gc); |
| 1651 | } | 1735 | } |
| 1652 | 1736 | ||
| 1653 | 1737 | ||
| @@ -2122,9 +2206,11 @@ static INLINE void | |||
| 2122 | x_set_glyph_string_clipping (s) | 2206 | x_set_glyph_string_clipping (s) |
| 2123 | struct glyph_string *s; | 2207 | struct glyph_string *s; |
| 2124 | { | 2208 | { |
| 2125 | Rect r; | 2209 | Rect rects[MAX_CLIP_RECTS]; |
| 2126 | get_glyph_string_clip_rect (s, &r); | 2210 | int n; |
| 2127 | mac_set_clip_rectangle (s->display, s->window, &r); | 2211 | |
| 2212 | n = get_glyph_string_clip_rects (s, rects, MAX_CLIP_RECTS); | ||
| 2213 | mac_set_clip_rectangles (s->display, s->gc, rects, n); | ||
| 2128 | } | 2214 | } |
| 2129 | 2215 | ||
| 2130 | 2216 | ||
| @@ -2341,7 +2427,7 @@ x_draw_glyph_string_foreground (s) | |||
| 2341 | { | 2427 | { |
| 2342 | if (s->two_byte_p) | 2428 | if (s->two_byte_p) |
| 2343 | XDrawImageString16 (s->display, s->window, s->gc, x, | 2429 | XDrawImageString16 (s->display, s->window, s->gc, x, |
| 2344 | s->ybase - boff, s->char2b, s->nchars); | 2430 | s->ybase - boff, s->char2b, s->nchars); |
| 2345 | else | 2431 | else |
| 2346 | XDrawImageString (s->display, s->window, s->gc, x, | 2432 | XDrawImageString (s->display, s->window, s->gc, x, |
| 2347 | s->ybase - boff, char1b, s->nchars); | 2433 | s->ybase - boff, char1b, s->nchars); |
| @@ -2749,7 +2835,7 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width, | |||
| 2749 | gc = f->output_data.mac->white_relief.gc; | 2835 | gc = f->output_data.mac->white_relief.gc; |
| 2750 | else | 2836 | else |
| 2751 | gc = f->output_data.mac->black_relief.gc; | 2837 | gc = f->output_data.mac->black_relief.gc; |
| 2752 | mac_set_clip_rectangle (dpy, window, clip_rect); | 2838 | mac_set_clip_rectangles (dpy, gc, clip_rect, 1); |
| 2753 | 2839 | ||
| 2754 | /* Top. */ | 2840 | /* Top. */ |
| 2755 | if (top_p) | 2841 | if (top_p) |
| @@ -2764,13 +2850,12 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width, | |||
| 2764 | XDrawLine (dpy, window, gc, | 2850 | XDrawLine (dpy, window, gc, |
| 2765 | left_x + i, top_y + i, left_x + i, bottom_y - i); | 2851 | left_x + i, top_y + i, left_x + i, bottom_y - i); |
| 2766 | 2852 | ||
| 2767 | mac_reset_clipping (dpy, window); | 2853 | mac_reset_clip_rectangles (dpy, gc); |
| 2768 | if (raised_p) | 2854 | if (raised_p) |
| 2769 | gc = f->output_data.mac->black_relief.gc; | 2855 | gc = f->output_data.mac->black_relief.gc; |
| 2770 | else | 2856 | else |
| 2771 | gc = f->output_data.mac->white_relief.gc; | 2857 | gc = f->output_data.mac->white_relief.gc; |
| 2772 | mac_set_clip_rectangle (dpy, window, | 2858 | mac_set_clip_rectangles (dpy, gc, clip_rect, 1); |
| 2773 | clip_rect); | ||
| 2774 | 2859 | ||
| 2775 | /* Bottom. */ | 2860 | /* Bottom. */ |
| 2776 | if (bot_p) | 2861 | if (bot_p) |
| @@ -2785,7 +2870,7 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width, | |||
| 2785 | XDrawLine (dpy, window, gc, | 2870 | XDrawLine (dpy, window, gc, |
| 2786 | right_x - i, top_y + i + 1, right_x - i, bottom_y - i - 1); | 2871 | right_x - i, top_y + i + 1, right_x - i, bottom_y - i - 1); |
| 2787 | 2872 | ||
| 2788 | mac_reset_clipping (dpy, window); | 2873 | mac_reset_clip_rectangles (dpy, gc); |
| 2789 | } | 2874 | } |
| 2790 | 2875 | ||
| 2791 | 2876 | ||
| @@ -2807,7 +2892,7 @@ x_draw_box_rect (s, left_x, top_y, right_x, bottom_y, width, | |||
| 2807 | 2892 | ||
| 2808 | XGetGCValues (s->display, s->gc, GCForeground, &xgcv); | 2893 | XGetGCValues (s->display, s->gc, GCForeground, &xgcv); |
| 2809 | XSetForeground (s->display, s->gc, s->face->box_color); | 2894 | XSetForeground (s->display, s->gc, s->face->box_color); |
| 2810 | mac_set_clip_rectangle (s->display, s->window, clip_rect); | 2895 | mac_set_clip_rectangles (s->display, s->gc, clip_rect, 1); |
| 2811 | 2896 | ||
| 2812 | /* Top. */ | 2897 | /* Top. */ |
| 2813 | XFillRectangle (s->display, s->window, s->gc, | 2898 | XFillRectangle (s->display, s->window, s->gc, |
| @@ -2828,7 +2913,7 @@ x_draw_box_rect (s, left_x, top_y, right_x, bottom_y, width, | |||
| 2828 | right_x - width + 1, top_y, width, bottom_y - top_y + 1); | 2913 | right_x - width + 1, top_y, width, bottom_y - top_y + 1); |
| 2829 | 2914 | ||
| 2830 | XSetForeground (s->display, s->gc, xgcv.foreground); | 2915 | XSetForeground (s->display, s->gc, xgcv.foreground); |
| 2831 | mac_reset_clipping (s->display, s->window); | 2916 | mac_reset_clip_rectangles (s->display, s->gc); |
| 2832 | } | 2917 | } |
| 2833 | 2918 | ||
| 2834 | 2919 | ||
| @@ -3182,7 +3267,6 @@ x_draw_image_glyph_string (s) | |||
| 3182 | x_set_glyph_string_clipping (s); | 3267 | x_set_glyph_string_clipping (s); |
| 3183 | mac_copy_area (s->display, pixmap, s->window, s->gc, | 3268 | mac_copy_area (s->display, pixmap, s->window, s->gc, |
| 3184 | 0, 0, s->background_width, s->height, s->x, s->y); | 3269 | 0, 0, s->background_width, s->height, s->x, s->y); |
| 3185 | mac_reset_clipping (s->display, s->window); | ||
| 3186 | XFreePixmap (s->display, pixmap); | 3270 | XFreePixmap (s->display, pixmap); |
| 3187 | } | 3271 | } |
| 3188 | else | 3272 | else |
| @@ -3234,7 +3318,7 @@ x_draw_stretch_glyph_string (s) | |||
| 3234 | gc = s->face->gc; | 3318 | gc = s->face->gc; |
| 3235 | 3319 | ||
| 3236 | get_glyph_string_clip_rect (s, &r); | 3320 | get_glyph_string_clip_rect (s, &r); |
| 3237 | mac_set_clip_rectangle (s->display, s->window, &r); | 3321 | mac_set_clip_rectangles (s->display, gc, &r, 1); |
| 3238 | 3322 | ||
| 3239 | #if 0 /* MAC_TODO: stipple */ | 3323 | #if 0 /* MAC_TODO: stipple */ |
| 3240 | if (s->face->stipple) | 3324 | if (s->face->stipple) |
| @@ -3247,8 +3331,6 @@ x_draw_stretch_glyph_string (s) | |||
| 3247 | else | 3331 | else |
| 3248 | #endif /* MAC_TODO */ | 3332 | #endif /* MAC_TODO */ |
| 3249 | mac_erase_rectangle (s->window, gc, x, y, w, h); | 3333 | mac_erase_rectangle (s->window, gc, x, y, w, h); |
| 3250 | |||
| 3251 | mac_reset_clipping (s->display, s->window); | ||
| 3252 | } | 3334 | } |
| 3253 | } | 3335 | } |
| 3254 | else if (!s->background_filled_p) | 3336 | else if (!s->background_filled_p) |
| @@ -3397,7 +3479,7 @@ x_draw_glyph_string (s) | |||
| 3397 | } | 3479 | } |
| 3398 | 3480 | ||
| 3399 | /* Reset clipping. */ | 3481 | /* Reset clipping. */ |
| 3400 | mac_reset_clipping (s->display, s->window); | 3482 | mac_reset_clip_rectangles (s->display, s->gc); |
| 3401 | } | 3483 | } |
| 3402 | 3484 | ||
| 3403 | /* Shift display to make room for inserted glyphs. */ | 3485 | /* Shift display to make room for inserted glyphs. */ |
| @@ -5270,7 +5352,7 @@ x_clip_to_row (w, row, area, gc) | |||
| 5270 | clip_rect.right = clip_rect.left + window_width; | 5352 | clip_rect.right = clip_rect.left + window_width; |
| 5271 | clip_rect.bottom = clip_rect.top + row->visible_height; | 5353 | clip_rect.bottom = clip_rect.top + row->visible_height; |
| 5272 | 5354 | ||
| 5273 | mac_set_clip_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), &clip_rect); | 5355 | mac_set_clip_rectangles (FRAME_MAC_DISPLAY (f), gc, &clip_rect, 1); |
| 5274 | } | 5356 | } |
| 5275 | 5357 | ||
| 5276 | 5358 | ||
| @@ -5313,7 +5395,7 @@ x_draw_hollow_cursor (w, row) | |||
| 5313 | /* Set clipping, draw the rectangle, and reset clipping again. */ | 5395 | /* Set clipping, draw the rectangle, and reset clipping again. */ |
| 5314 | x_clip_to_row (w, row, TEXT_AREA, gc); | 5396 | x_clip_to_row (w, row, TEXT_AREA, gc); |
| 5315 | mac_draw_rectangle (dpy, FRAME_MAC_WINDOW (f), gc, x, y, wd, h); | 5397 | mac_draw_rectangle (dpy, FRAME_MAC_WINDOW (f), gc, x, y, wd, h); |
| 5316 | mac_reset_clipping (dpy, FRAME_MAC_WINDOW (f)); | 5398 | mac_reset_clip_rectangles (dpy, gc); |
| 5317 | } | 5399 | } |
| 5318 | 5400 | ||
| 5319 | 5401 | ||
| @@ -5397,7 +5479,7 @@ x_draw_bar_cursor (w, row, width, kind) | |||
| 5397 | cursor_glyph->pixel_width, | 5479 | cursor_glyph->pixel_width, |
| 5398 | width); | 5480 | width); |
| 5399 | 5481 | ||
| 5400 | mac_reset_clipping (dpy, FRAME_MAC_WINDOW (f)); | 5482 | mac_reset_clip_rectangles (dpy, gc); |
| 5401 | } | 5483 | } |
| 5402 | } | 5484 | } |
| 5403 | 5485 | ||
| @@ -7610,7 +7692,7 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7610 | ATSUFontFeatureType types[] = {kAllTypographicFeaturesType}; | 7692 | ATSUFontFeatureType types[] = {kAllTypographicFeaturesType}; |
| 7611 | ATSUFontFeatureSelector selectors[] = {kAllTypeFeaturesOffSelector}; | 7693 | ATSUFontFeatureSelector selectors[] = {kAllTypeFeaturesOffSelector}; |
| 7612 | Lisp_Object font_id_cons; | 7694 | Lisp_Object font_id_cons; |
| 7613 | 7695 | ||
| 7614 | font_id_cons = Fgethash (Fdowncase | 7696 | font_id_cons = Fgethash (Fdowncase |
| 7615 | (make_unibyte_string (mfontname, | 7697 | (make_unibyte_string (mfontname, |
| 7616 | strlen (mfontname))), | 7698 | strlen (mfontname))), |