}
}
-/* Import BITS into BITMAP using the B_GRAY1 colorspace. */
+/* Import fringe bitmap (short array, low bit rightmost) BITS into
+ BITMAP using the B_GRAY1 colorspace. */
void
-BBitmap_import_mono_bits (void *bitmap, void *bits, int wd, int h)
+BBitmap_import_fringe_bitmap (void *bitmap, unsigned short *bits, int wd, int h)
{
BBitmap *bmp = (BBitmap *) bitmap;
unsigned char *data = (unsigned char *) bmp->Bits ();
- unsigned short *bts = (unsigned short *) bits;
+ int i;
- for (int i = 0; i < (h * (wd / 8)); i++)
+ for (i = 0; i < h; i++)
{
- *((unsigned short *) data) = bts[i];
+ if (wd <= 8)
+ data[0] = bits[i] & 0xff;
+ else
+ {
+ data[1] = bits[i] & 0xff;
+ data[0] = bits[i] >> 8;
+ }
+
data += bmp->BytesPerRow ();
}
}
+void
+BBitmap_import_mono_bits (void *bitmap, void *bits, int wd, int h)
+{
+ BBitmap *bmp = (BBitmap *) bitmap;
+
+ if (wd % 8)
+ wd += 8 - (wd % 8);
+
+ bmp->ImportBits (bits, wd / 8 * h, wd / 8, 0, B_GRAY1);
+}
+
/* Make a scrollbar at X, Y known to the view VIEW. */
void
BView_publish_scroll_bar (void *view, int x, int y, int width, int height)
extern void
BView_mouse_up (void *view, int x, int y);
+ extern void
+ BBitmap_import_fringe_bitmap (void *bitmap, unsigned short *bits,
+ int wd, int h);
+
extern void
BBitmap_import_mono_bits (void *bitmap, void *bits, int wd, int h);
}
fringe_bmps[which] = BBitmap_new (wd, h, 1);
- BBitmap_import_mono_bits (fringe_bmps[which], bits, wd, h);
+ BBitmap_import_fringe_bitmap (fringe_bmps[which], bits, wd, h);
}
static void