summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2016-01-31 14:05:19 +0000
committerMatthias Melcher <fltk@matthiasm.com>2016-01-31 14:05:19 +0000
commitb9c8042a6ad579a35ff2459a14b79a6e34d0eecf (patch)
tree396cbf6e9613575f932b15d9e5b77a02d7f9e9d8
parent7440ea209ad349d92f27796f1c8d8090c4541ab8 (diff)
Fixed WIN32 setup. X11 setup verified.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11101 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--src/Fl_Bitmap.cxx31
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx28
2 files changed, 31 insertions, 28 deletions
diff --git a/src/Fl_Bitmap.cxx b/src/Fl_Bitmap.cxx
index 6915377e3..27526a04a 100644
--- a/src/Fl_Bitmap.cxx
+++ b/src/Fl_Bitmap.cxx
@@ -117,6 +117,37 @@ void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
fl_graphics_driver->draw(this, XP, YP, WP, HP, cx, cy);
}
+#if defined(WIN32)
+// TODO: move this code into the GDI driver in a sensible way
+// 'fl_create_bitmap()' - Create a 1-bit bitmap for drawing...
+static Fl_Bitmask fl_create_bitmap(int w, int h, const uchar *data) {
+ // we need to pad the lines out to words & swap the bits
+ // in each byte.
+ int w1 = (w + 7) / 8;
+ int w2 = ((w + 15) / 16) * 2;
+ uchar* newarray = new uchar[w2*h];
+ const uchar* src = data;
+ uchar* dest = newarray;
+ Fl_Bitmask bm;
+ static uchar reverse[16] = /* Bit reversal lookup table */
+ { 0x00, 0x88, 0x44, 0xcc, 0x22, 0xaa, 0x66, 0xee,
+ 0x11, 0x99, 0x55, 0xdd, 0x33, 0xbb, 0x77, 0xff };
+
+ for (int y = 0; y < h; y++) {
+ for (int n = 0; n < w1; n++, src++)
+ *dest++ = (uchar)((reverse[*src & 0x0f] & 0xf0) |
+ (reverse[(*src >> 4) & 0x0f] & 0x0f));
+ dest += w2 - w1;
+ }
+
+ bm = CreateBitmap(w, h, 1, 1, newarray);
+
+ delete[] newarray;
+
+ return bm;
+}
+#endif
+
int Fl_Bitmap::start(int XP, int YP, int WP, int HP, int &cx, int &cy,
int &X, int &Y, int &W, int &H)
{
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
index 30d8b6590..a6d32d6e4 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
@@ -332,34 +332,6 @@ void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) {
fl_rectf(x,y,w,h);
}
-// 'fl_create_bitmap()' - Create a 1-bit bitmap for drawing...
-static Fl_Bitmask fl_create_bitmap(int w, int h, const uchar *data) {
- // we need to pad the lines out to words & swap the bits
- // in each byte.
- int w1 = (w+7)/8;
- int w2 = ((w+15)/16)*2;
- uchar* newarray = new uchar[w2*h];
- const uchar* src = data;
- uchar* dest = newarray;
- Fl_Bitmask bm;
- static uchar reverse[16] = /* Bit reversal lookup table */
- { 0x00, 0x88, 0x44, 0xcc, 0x22, 0xaa, 0x66, 0xee,
- 0x11, 0x99, 0x55, 0xdd, 0x33, 0xbb, 0x77, 0xff };
-
- for (int y=0; y < h; y++) {
- for (int n = 0; n < w1; n++, src++)
- *dest++ = (uchar)((reverse[*src & 0x0f] & 0xf0) |
- (reverse[(*src >> 4) & 0x0f] & 0x0f));
- dest += w2-w1;
- }
-
- bm = CreateBitmap(w, h, 1, 1, newarray);
-
- delete[] newarray;
-
- return bm;
-}
-
// 'fl_create_bitmask()' - Create an N-bit bitmap for masking...
Fl_Bitmask Fl_GDI_Graphics_Driver::create_bitmask(int w, int h, const uchar *data) {
// this won't work when the user changes display mode during run or