Author: manolo
Date: 2010-04-14 06:07:34 -0700 (Wed, 14 Apr 2010)
New Revision: 7501
Log:
More logical use of Fl_Device::draw(<image class> *,...) functions

Modified:
   branches/branch-1.3/FL/Fl_Bitmap.H
   branches/branch-1.3/FL/Fl_Image.H
   branches/branch-1.3/FL/Fl_Pixmap.H
   branches/branch-1.3/src/Fl_Bitmap.cxx
   branches/branch-1.3/src/Fl_Device.cxx
   branches/branch-1.3/src/Fl_Image.cxx
   branches/branch-1.3/src/Fl_Pixmap.cxx

Modified: branches/branch-1.3/FL/Fl_Bitmap.H
===================================================================
--- branches/branch-1.3/FL/Fl_Bitmap.H  2010-04-14 09:29:08 UTC (rev 7500)
+++ branches/branch-1.3/FL/Fl_Bitmap.H  2010-04-14 13:07:34 UTC (rev 7501)
@@ -40,6 +40,7 @@
   (bitmap) images. Images are drawn using the current color.
 */
 class FL_EXPORT Fl_Bitmap : public Fl_Image {
+  friend class Fl_Device;
   public:
 
   /** pointer to raw bitmap data */
@@ -57,6 +58,7 @@
   unsigned id_;
 #endif // __APPLE__ || WIN32
 
+  void generic_device_draw(int XP, int YP, int WP, int HP, int cx, int cy);
   public:
 
   /** The constructors create a new bitmap from the specified bitmap data */

Modified: branches/branch-1.3/FL/Fl_Image.H
===================================================================
--- branches/branch-1.3/FL/Fl_Image.H   2010-04-14 09:29:08 UTC (rev 7500)
+++ branches/branch-1.3/FL/Fl_Image.H   2010-04-14 13:07:34 UTC (rev 7501)
@@ -188,6 +188,8 @@
   &lt;FL/Fl_RGB_Image.H&gt; should be included.
 */
 class FL_EXPORT Fl_RGB_Image : public Fl_Image {
+  friend class Fl_Device;
+  void generic_device_draw(int X, int Y, int W, int H, int cx=0, int cy=0);
   public:
 
   const uchar *array;

Modified: branches/branch-1.3/FL/Fl_Pixmap.H
===================================================================
--- branches/branch-1.3/FL/Fl_Pixmap.H  2010-04-14 09:29:08 UTC (rev 7500)
+++ branches/branch-1.3/FL/Fl_Pixmap.H  2010-04-14 13:07:34 UTC (rev 7501)
@@ -45,6 +45,7 @@
   (pixmap) images, including transparency.
 */
 class FL_EXPORT Fl_Pixmap : public Fl_Image {
+  friend class Fl_Device;
   void copy_data();
   void delete_data();
   void set_data(const char * const *p);
@@ -66,6 +67,7 @@
   unsigned id_; // for internal use
   unsigned mask_; // for internal use (mask bitmap)
 #endif // __APPLE__ || WIN32
+  void generic_device_draw(int XP, int YP, int WP, int HP, int cx, int cy);
   
   public:
 

Modified: branches/branch-1.3/src/Fl_Bitmap.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Bitmap.cxx       2010-04-14 09:29:08 UTC (rev 
7500)
+++ branches/branch-1.3/src/Fl_Bitmap.cxx       2010-04-14 13:07:34 UTC (rev 
7501)
@@ -248,10 +248,10 @@
 }
 
 void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
-  if(fl_device->type() == Fl_Device::postscript_device) {
-    fl_device->draw(this, XP, YP, WP, HP, cx, cy);
-    return;
-  }
+  fl_device->draw(this, XP, YP, WP, HP, cx, cy);
+}
+
+void Fl_Bitmap::generic_device_draw(int XP, int YP, int WP, int HP, int cx, 
int cy) {
   if (!array) {
     draw_empty(XP, YP);
     return;

Modified: branches/branch-1.3/src/Fl_Device.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Device.cxx       2010-04-14 09:29:08 UTC (rev 
7500)
+++ branches/branch-1.3/src/Fl_Device.cxx       2010-04-14 13:07:34 UTC (rev 
7501)
@@ -27,7 +27,6 @@
 
 #include <FL/Fl.H>
 #include <FL/Fl_Device.H>
-//#include <FL/fl_draw.H>
 #include <FL/Fl_Image.H>
 
 /** \brief Draws an Fl_Pixmap object to the device. 
@@ -35,9 +34,8 @@
  Specifies a bounding box for the image, with the origin (upper left-hand 
corner) of 
  the image offset by the cx and cy arguments.
  */
-void Fl_Device::draw(Fl_Pixmap *pxm,int XP, int YP, int WP, int HP, int cx, 
int cy)
-{
-  pxm->draw(XP, YP, WP, HP, cx, cy);
+void Fl_Device::draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, 
int cy) {
+  pxm->generic_device_draw(XP, YP, WP, HP, cx, cy);
 }
 
 /** \brief Draws an Fl_Bitmap object to the device. 
@@ -45,9 +43,8 @@
  Specifies a bounding box for the image, with the origin (upper left-hand 
corner) of 
  the image offset by the cx and cy arguments.
  */
-void Fl_Device::draw(Fl_Bitmap *bm,int XP, int YP, int WP, int HP, int cx, int 
cy)
-{
-  bm->draw(XP, YP, WP, HP, cx, cy);
+void Fl_Device::draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, 
int cy) {
+  bm->generic_device_draw(XP, YP, WP, HP, cx, cy);
 }
 
 /** \brief Draws an Fl_RGB_Image object to the device. 
@@ -55,9 +52,8 @@
  Specifies a bounding box for the image, with the origin (upper left-hand 
corner) of 
  the image offset by the cx and cy arguments.
  */
-void Fl_Device::draw(Fl_RGB_Image *rgb,int XP, int YP, int WP, int HP, int cx, 
int cy)
-{
-  rgb->draw(XP, YP, WP, HP, cx, cy);
+void Fl_Device::draw(Fl_RGB_Image *rgb, int XP, int YP, int WP, int HP, int 
cx, int cy) {
+  rgb->generic_device_draw(XP, YP, WP, HP, cx, cy);
 }
 
 /**

Modified: branches/branch-1.3/src/Fl_Image.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Image.cxx        2010-04-14 09:29:08 UTC (rev 
7500)
+++ branches/branch-1.3/src/Fl_Image.cxx        2010-04-14 13:07:34 UTC (rev 
7501)
@@ -434,10 +434,10 @@
 #endif // !WIN32 && !__APPLE_QUARTZ__
 
 void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
-  if(fl_device->type() == Fl_Device::postscript_device) {
-    fl_device->draw(this, XP, YP, WP, HP, cx, cy);
-    return;
-  }
+  fl_device->draw(this, XP, YP, WP, HP, cx, cy);
+}
+
+void Fl_RGB_Image::generic_device_draw(int XP, int YP, int WP, int HP, int cx, 
int cy) {
   // Don't draw an empty image...
   if (!d() || !array) {
     draw_empty(XP, YP);

Modified: branches/branch-1.3/src/Fl_Pixmap.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Pixmap.cxx       2010-04-14 09:29:08 UTC (rev 
7500)
+++ branches/branch-1.3/src/Fl_Pixmap.cxx       2010-04-14 13:07:34 UTC (rev 
7501)
@@ -74,10 +74,10 @@
 }
 
 void Fl_Pixmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
-  if(fl_device->type() == Fl_Device::postscript_device) {
-    fl_device->draw(this, XP, YP, WP, HP, cx, cy);
-    return;
-    }
+  fl_device->draw(this, XP, YP, WP, HP, cx, cy);
+}
+
+void Fl_Pixmap::generic_device_draw(int XP, int YP, int WP, int HP, int cx, 
int cy) {
   // ignore empty or bad pixmap data:
   if (!data()) {
     draw_empty(XP, YP);

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

Reply via email to