Author: manolo
Date: 2012-03-28 09:19:01 -0700 (Wed, 28 Mar 2012)
New Revision: 9310
Log:
Fixes the compatibility with FLTK1 Fl_Bitmap class.

Modified:
   branches/branch-3.0/include/FL/Fl_Bitmap.H
   branches/branch-3.0/include/fltk3/Wrapper.h

Modified: branches/branch-3.0/include/FL/Fl_Bitmap.H
===================================================================
--- branches/branch-3.0/include/FL/Fl_Bitmap.H  2012-03-28 13:38:18 UTC (rev 
9309)
+++ branches/branch-3.0/include/FL/Fl_Bitmap.H  2012-03-28 16:19:01 UTC (rev 
9310)
@@ -38,7 +38,7 @@
 struct Fl_Menu_Item;
 
 FLTK3_WRAPPER_INTERFACE_BEGIN(Fl_Bitmap, Bitmap)
-FLTK3_WRAPPER_INTERFACE_IMAGE(Fl_Bitmap, Bitmap)
+FLTK3_WRAPPER_INTERFACE_BITMAP(Fl_Bitmap, Bitmap)
 FLTK3_WRAPPER_INTERFACE_END()
 
 
@@ -64,7 +64,7 @@
   }
 
   Fl_Bitmap(const char *bits, int W, int H) {
-    _p = new fltk3::Bitmap_I(bits, W, H);
+    _p = new fltk3::Bitmap_I((const uchar *)bits, W, H);
     _p->wrapper(this);
   }
 

Modified: branches/branch-3.0/include/fltk3/Wrapper.h
===================================================================
--- branches/branch-3.0/include/fltk3/Wrapper.h 2012-03-28 13:38:18 UTC (rev 
9309)
+++ branches/branch-3.0/include/fltk3/Wrapper.h 2012-03-28 16:19:01 UTC (rev 
9310)
@@ -253,38 +253,50 @@
       type3##_I(int w, int h, const char *l) \
       : type3(w, h, l) { }
 
+#define FLTK3_WRAPPER_INTERFACE_IMAGE_CTOR_5ARGS(type3) \
+  type3##_I(const uchar *bits, int W, int H, int D=3, int LD=0) : type3(bits, 
W, H, D, LD) { } 
+
+#define FLTK3_WRAPPER_INTERFACE_IMAGE_CTOR_3ARGS(type3) \
+  type3##_I(const uchar *bits, int W, int H) : type3(bits, W, H) { } 
+
+#define FLTK3_WRAPPER_INTERFACE_IMAGE_BODY(type3) \
+  Image *copy(int W, int H) { \
+  FLTK3_IMAGE_VCALLS_WRAPPER_RET(Image *, copy(W, H), CopyWH) \
+  return type3::copy(W, H); \
+  } \
+  void color_average(Color c, float i) { \
+  FLTK3_IMAGE_VCALLS_WRAPPER(color_average(c, i), ColorAverage) \
+  type3::color_average(c, i); \
+  } \
+  void desaturate() { \
+  FLTK3_IMAGE_VCALLS_WRAPPER(desaturate(), Desaturate) \
+  type3::desaturate(); \
+  } \
+  void label(Widget *w) { \
+  FLTK3_IMAGE_VCALLS_WRAPPER(label(w), LabelW) \
+  type3::label(w); \
+  } \
+  void label(MenuItem *w) { \
+  FLTK3_IMAGE_VCALLS_WRAPPER(label(w), LabelM) \
+  type3::label(w); \
+  } \
+  void draw(int X, int Y, int W, int H, int cx=0, int cy=0) { \
+  FLTK3_IMAGE_VCALLS_WRAPPER(draw(X, Y, W, H, cx, cy), Draw) \
+  type3::draw(X, Y, W, H, cx, cy); \
+  } \
+  void uncache() { \
+  FLTK3_IMAGE_VCALLS_WRAPPER(uncache(), Uncache) \
+  type3::uncache(); \
+  }
+
 #define FLTK3_WRAPPER_INTERFACE_IMAGE(type1, type3) \
-      type3##_I(const uchar *bits, int W, int H, int D=3, int LD=0) \
-      : type3(bits, W, H, D, LD) { } \
-      Image *copy(int W, int H) { \
-        FLTK3_IMAGE_VCALLS_WRAPPER_RET(Image *, copy(W, H), CopyWH) \
-        return type3::copy(W, H); \
-      } \
-      void color_average(Color c, float i) { \
-        FLTK3_IMAGE_VCALLS_WRAPPER(color_average(c, i), ColorAverage) \
-        type3::color_average(c, i); \
-      } \
-      void desaturate() { \
-        FLTK3_IMAGE_VCALLS_WRAPPER(desaturate(), Desaturate) \
-        type3::desaturate(); \
-      } \
-      void label(Widget *w) { \
-        FLTK3_IMAGE_VCALLS_WRAPPER(label(w), LabelW) \
-        type3::label(w); \
-      } \
-      void label(MenuItem *w) { \
-        FLTK3_IMAGE_VCALLS_WRAPPER(label(w), LabelM) \
-        type3::label(w); \
-      } \
-      void draw(int X, int Y, int W, int H, int cx=0, int cy=0) { \
-        FLTK3_IMAGE_VCALLS_WRAPPER(draw(X, Y, W, H, cx, cy), Draw) \
-        type3::draw(X, Y, W, H, cx, cy); \
-      } \
-      void uncache() { \
-        FLTK3_IMAGE_VCALLS_WRAPPER(uncache(), Uncache) \
-        type3::uncache(); \
-      }
+  FLTK3_WRAPPER_INTERFACE_IMAGE_CTOR_5ARGS(type3) \
+  FLTK3_WRAPPER_INTERFACE_IMAGE_BODY(type3)
 
+#define FLTK3_WRAPPER_INTERFACE_BITMAP(type1, type3) \
+  FLTK3_WRAPPER_INTERFACE_IMAGE_CTOR_3ARGS(type3) \
+  FLTK3_WRAPPER_INTERFACE_IMAGE_BODY(type3)
+
 #define FLTK3_WRAPPER_INTERFACE_END() \
     }; \
   }

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to