changeset 53935:60bbfcb6328e

(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.
author Kim F. Storm <storm@cua.dk>
date Fri, 13 Feb 2004 23:28:32 +0000
parents de8ab2bcee32
children 4dd0e0a7fd9e
files src/macterm.c
diffstat 1 files changed, 14 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/macterm.c	Fri Feb 13 23:28:00 2004 +0000
+++ b/src/macterm.c	Fri Feb 13 23:28:32 2004 +0000
@@ -467,16 +467,21 @@
 /* Mac replacement for XCopyArea.  */
 
 static void
-mac_draw_bitmap (display, w, gc, x, y, bitmap, overlay_p)
+mac_draw_bitmap (display, w, gc, x, y, width, height, bits, overlay_p)
      Display *display;
      WindowPtr w;
      GC gc;
-     int x, y;
-     BitMap *bitmap;
+     int x, y, width, height;
+     unsigned short *bits;
      int overlay_p;
 {
+  BitMap bitmap;
   Rect r;
 
+  bitmap.rowBytes = sizeof(unsigned short);
+  bitmap.baseAddr = bits;
+  SetRect (&(bitmap.bounds), 0, 0, width, height);
+
 #if TARGET_API_MAC_CARBON
   SetPort (GetWindowPort (w));
 #else
@@ -484,7 +489,7 @@
 #endif
 
   mac_set_colors (gc);
-  SetRect (&r, x, y, x + bitmap->bounds.right, y + bitmap->bounds.bottom);
+  SetRect (&r, x, y, x + bitmap.bounds.right, y + bitmap.bounds.bottom);
 
 #if TARGET_API_MAC_CARBON
   {
@@ -492,12 +497,12 @@
 
     LockPortBits (GetWindowPort (w));
     pmh = GetPortPixMap (GetWindowPort (w));
-    CopyBits (bitmap, (BitMap *) *pmh, &(bitmap->bounds), &r,
+    CopyBits (&bitmap, (BitMap *) *pmh, &(bitmap.bounds), &r,
 	      overlay_p ? srcOr : srcCopy, 0);
     UnlockPortBits (GetWindowPort (w));
   }
 #else /* not TARGET_API_MAC_CARBON */
-  CopyBits (bitmap, &(w->portBits), &(bitmap->bounds), &r,
+  CopyBits (&bitmap, &(w->portBits), &(bitmap.bounds), &r,
 	    overlay_p ? srcOr : srcCopy, 0);
 #endif /* not TARGET_API_MAC_CARBON */
 }
@@ -1344,10 +1349,7 @@
 
   if (p->which)
     {
-      unsigned char *bits = p->bits + p->dh;
-      BitMap bitmap;
-
-      mac_create_bitmap_from_bitmap_data (&bitmap, bits, p->wd, p->h);
+      unsigned short *bits = p->bits + p->dh;
 
       gcv.foreground = (p->cursor_p
 			? (p->overlay_p ? face->background
@@ -1355,9 +1357,8 @@
 			: face->foreground);
       gcv.background = face->background;
 
-      mac_draw_bitmap (display, window, &gcv, p->x, p->y, &bitmap,
-		       p->overlay_p);
-      mac_free_bitmap (&bitmap);
+      mac_draw_bitmap (display, window, &gcv, p->x, p->y, 
+		       p->wd, p->h, bits, p->overlay_p);
     }
 
   mac_reset_clipping (display, window);