aboutsummaryrefslogtreecommitdiffstats
path: root/src/macterm.c
diff options
context:
space:
mode:
authorKim F. Storm2004-02-13 23:28:32 +0000
committerKim F. Storm2004-02-13 23:28:32 +0000
commitdcd0c64591a4cd97cb5a23dea2bd1b12bacdbce7 (patch)
tree148a2440ba36c714d9e5502111175dd630d6c88c /src/macterm.c
parent03cce111cfce0b330c95a5216dd36fa21768b9bf (diff)
downloademacs-dcd0c64591a4cd97cb5a23dea2bd1b12bacdbce7.tar.gz
emacs-dcd0c64591a4cd97cb5a23dea2bd1b12bacdbce7.zip
(mac_draw_bitmap): Handle 16 bits wide bitmaps directly.
(x_draw_fringe_bitmap): Use enhanced mac_draw_bitmap, so we no longer need to call mac_create_bitmap_from_bitmap_data and mac_free_bitmap.
Diffstat (limited to 'src/macterm.c')
-rw-r--r--src/macterm.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/macterm.c b/src/macterm.c
index b4efe061d3d..3c1b33fa6dd 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -467,16 +467,21 @@ XClearWindow (display, w)
467/* Mac replacement for XCopyArea. */ 467/* Mac replacement for XCopyArea. */
468 468
469static void 469static void
470mac_draw_bitmap (display, w, gc, x, y, bitmap, overlay_p) 470mac_draw_bitmap (display, w, gc, x, y, width, height, bits, overlay_p)
471 Display *display; 471 Display *display;
472 WindowPtr w; 472 WindowPtr w;
473 GC gc; 473 GC gc;
474 int x, y; 474 int x, y, width, height;
475 BitMap *bitmap; 475 unsigned short *bits;
476 int overlay_p; 476 int overlay_p;
477{ 477{
478 BitMap bitmap;
478 Rect r; 479 Rect r;
479 480
481 bitmap.rowBytes = sizeof(unsigned short);
482 bitmap.baseAddr = bits;
483 SetRect (&(bitmap.bounds), 0, 0, width, height);
484
480#if TARGET_API_MAC_CARBON 485#if TARGET_API_MAC_CARBON
481 SetPort (GetWindowPort (w)); 486 SetPort (GetWindowPort (w));
482#else 487#else
@@ -484,7 +489,7 @@ mac_draw_bitmap (display, w, gc, x, y, bitmap, overlay_p)
484#endif 489#endif
485 490
486 mac_set_colors (gc); 491 mac_set_colors (gc);
487 SetRect (&r, x, y, x + bitmap->bounds.right, y + bitmap->bounds.bottom); 492 SetRect (&r, x, y, x + bitmap.bounds.right, y + bitmap.bounds.bottom);
488 493
489#if TARGET_API_MAC_CARBON 494#if TARGET_API_MAC_CARBON
490 { 495 {
@@ -492,12 +497,12 @@ mac_draw_bitmap (display, w, gc, x, y, bitmap, overlay_p)
492 497
493 LockPortBits (GetWindowPort (w)); 498 LockPortBits (GetWindowPort (w));
494 pmh = GetPortPixMap (GetWindowPort (w)); 499 pmh = GetPortPixMap (GetWindowPort (w));
495 CopyBits (bitmap, (BitMap *) *pmh, &(bitmap->bounds), &r, 500 CopyBits (&bitmap, (BitMap *) *pmh, &(bitmap.bounds), &r,
496 overlay_p ? srcOr : srcCopy, 0); 501 overlay_p ? srcOr : srcCopy, 0);
497 UnlockPortBits (GetWindowPort (w)); 502 UnlockPortBits (GetWindowPort (w));
498 } 503 }
499#else /* not TARGET_API_MAC_CARBON */ 504#else /* not TARGET_API_MAC_CARBON */
500 CopyBits (bitmap, &(w->portBits), &(bitmap->bounds), &r, 505 CopyBits (&bitmap, &(w->portBits), &(bitmap.bounds), &r,
501 overlay_p ? srcOr : srcCopy, 0); 506 overlay_p ? srcOr : srcCopy, 0);
502#endif /* not TARGET_API_MAC_CARBON */ 507#endif /* not TARGET_API_MAC_CARBON */
503} 508}
@@ -1344,10 +1349,7 @@ x_draw_fringe_bitmap (w, row, p)
1344 1349
1345 if (p->which) 1350 if (p->which)
1346 { 1351 {
1347 unsigned char *bits = p->bits + p->dh; 1352 unsigned short *bits = p->bits + p->dh;
1348 BitMap bitmap;
1349
1350 mac_create_bitmap_from_bitmap_data (&bitmap, bits, p->wd, p->h);
1351 1353
1352 gcv.foreground = (p->cursor_p 1354 gcv.foreground = (p->cursor_p
1353 ? (p->overlay_p ? face->background 1355 ? (p->overlay_p ? face->background
@@ -1355,9 +1357,8 @@ x_draw_fringe_bitmap (w, row, p)
1355 : face->foreground); 1357 : face->foreground);
1356 gcv.background = face->background; 1358 gcv.background = face->background;
1357 1359
1358 mac_draw_bitmap (display, window, &gcv, p->x, p->y, &bitmap, 1360 mac_draw_bitmap (display, window, &gcv, p->x, p->y,
1359 p->overlay_p); 1361 p->wd, p->h, bits, p->overlay_p);
1360 mac_free_bitmap (&bitmap);
1361 } 1362 }
1362 1363
1363 mac_reset_clipping (display, window); 1364 mac_reset_clipping (display, window);