comparison src/macterm.c @ 80788:74541c8c7ba2

(mac_draw_rectangle) [USE_CG_DRAWING]: Fix rectangle calculation.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Tue, 02 Sep 2008 08:19:06 +0000
parents 5e49fbefd047
children
comparison
equal deleted inserted replaced
80787:3b1a088f523a 80788:74541c8c7ba2
474 GC gc; 474 GC gc;
475 int x, y; 475 int x, y;
476 unsigned int width, height; 476 unsigned int width, height;
477 { 477 {
478 #if USE_CG_DRAWING 478 #if USE_CG_DRAWING
479 { 479 CGContextRef context;
480 CGContextRef context; 480
481 481 context = mac_begin_cg_clip (f, gc);
482 context = mac_begin_cg_clip (f, gc); 482 CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc);
483 CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc); 483 CGContextFillRect (context, mac_rect_make (f, x, y, width, height));
484 CGContextFillRect (context, mac_rect_make (f, x, y, width, height)); 484 mac_end_cg_clip (f);
485 mac_end_cg_clip (f);
486 }
487 #else 485 #else
488 { 486 Rect r;
489 Rect r; 487
490 488 mac_begin_clip (f, gc);
491 mac_begin_clip (f, gc); 489 RGBBackColor (GC_BACK_COLOR (gc));
492 RGBBackColor (GC_BACK_COLOR (gc)); 490 SetRect (&r, x, y, x + width, y + height);
493 SetRect (&r, x, y, x + width, y + height); 491 EraseRect (&r);
494 EraseRect (&r); 492 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
495 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); 493 mac_end_clip (f, gc);
496 mac_end_clip (f, gc);
497 }
498 #endif 494 #endif
499 } 495 }
500 496
501 497
502 /* Mac version of XClearArea. */ 498 /* Mac version of XClearArea. */
515 static void 511 static void
516 mac_clear_window (f) 512 mac_clear_window (f)
517 struct frame *f; 513 struct frame *f;
518 { 514 {
519 #if USE_CG_DRAWING 515 #if USE_CG_DRAWING
520 { 516 CGContextRef context;
521 CGContextRef context; 517 GC gc = FRAME_NORMAL_GC (f);
522 GC gc = FRAME_NORMAL_GC (f); 518
523 519 context = mac_begin_cg_clip (f, NULL);
524 context = mac_begin_cg_clip (f, NULL); 520 CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc);
525 CG_SET_FILL_COLOR_WITH_GC_BACKGROUND (context, gc); 521 CGContextFillRect (context, CGRectMake (0, 0, FRAME_PIXEL_WIDTH (f),
526 CGContextFillRect (context, CGRectMake (0, 0, FRAME_PIXEL_WIDTH (f), 522 FRAME_PIXEL_HEIGHT (f)));
527 FRAME_PIXEL_HEIGHT (f))); 523 mac_end_cg_clip (f);
528 mac_end_cg_clip (f);
529 }
530 #else /* !USE_CG_DRAWING */ 524 #else /* !USE_CG_DRAWING */
531 mac_begin_clip (f, NULL); 525 mac_begin_clip (f, NULL);
532 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); 526 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
533 #if TARGET_API_MAC_CARBON 527 #if TARGET_API_MAC_CARBON
534 { 528 {
838 int x, y; 832 int x, y;
839 unsigned int width, height; 833 unsigned int width, height;
840 { 834 {
841 #if USE_CG_DRAWING 835 #if USE_CG_DRAWING
842 CGContextRef context; 836 CGContextRef context;
837 CGRect rect;
843 838
844 context = mac_begin_cg_clip (f, gc); 839 context = mac_begin_cg_clip (f, gc);
845 CG_SET_STROKE_COLOR_WITH_GC_FOREGROUND (context, gc); 840 CG_SET_STROKE_COLOR_WITH_GC_FOREGROUND (context, gc);
846 CGContextStrokeRect (context, 841 rect = mac_rect_make (f, x, y, width + 1, height + 1);
847 CGRectMake (x + 0.5f, y + 0.5f, width, height)); 842 CGContextStrokeRect (context, CGRectInset (rect, 0.5f, 0.5f));
848 mac_end_cg_clip (f); 843 mac_end_cg_clip (f);
849 #else 844 #else
850 Rect r; 845 Rect r;
851 846
852 mac_begin_clip (f, gc); 847 mac_begin_clip (f, gc);