DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2810
Version: 1.3.0


There was a comment in the development forum that uses of the
Fl_Device::class_name() functions express incomplete use of 
virtual functions. That's true. I would like to improve this and
remove all calls to function Fl_Device::class_name() in FLTK 1.3.
The attached svn diff file does that by using two new functions
static int Fl_Surface_Device::to_display()     and
static int Fl_Surface_Device::uses_display_driver().

This requires change to several files. I believe that ABI compatibity
is maintained. It seems this source 
http://techbase.kde.org/Policies/Binary_Compatibility_Issues_With_C++
provides a comprehensive description of how to ensure ABI 
compatibility of a C++ library. I would prefer to have the opinion
of other developpers before committing this large change.


Link: http://www.fltk.org/str.php?L2810
Version: 1.3.0
Index: src/Fl_Device.cxx
===================================================================
--- src/Fl_Device.cxx   (revision 9274)
+++ src/Fl_Device.cxx   (working copy)
@@ -40,8 +40,31 @@
 {
   fl_graphics_driver = _driver;
   _surface = this;
+  same_driver_as_display = 0;
 }
 
+/** returns whether the surface that currently receives graphics output is the 
platform display */
+int Fl_Surface_Device::to_display() {
+  return surface() == Fl_Display_Device::display_device();
+}
+
+/** returns whether the surface that currently receives graphics output uses 
+    the same graphics driver as the platform display */
+int Fl_Surface_Device::uses_display_driver() {
+  return same_driver_as_display;
+}
+
+int Fl_Surface_Device::same_driver_as_display = 0;
+
+void Fl_Display_Device::set_current()
+{
+  this->Fl_Surface_Device::set_current();
+  Fl_Surface_Device::same_driver_as_display = 1;
+}
+
+FL_EXPORT Fl_Graphics_Driver *fl_graphics_driver; // the current target device 
of graphics operations
+Fl_Surface_Device* Fl_Surface_Device::_surface; // the current target surface 
of graphics operations
+
 const Fl_Graphics_Driver::matrix Fl_Graphics_Driver::m0 = {1, 0, 0, 1, 0, 0};
 
 Fl_Graphics_Driver::Fl_Graphics_Driver() {
@@ -88,6 +111,7 @@
 #endif
   fl_mac_os_version = versionMajor * 10000 + versionMinor * 100 + 
versionBugFix;
 #endif
+this->set_current();
 };
 
 
Index: src/fl_draw_image_mac.cxx
===================================================================
--- src/fl_draw_image_mac.cxx   (revision 9132)
+++ src/fl_draw_image_mac.cxx   (working copy)
@@ -55,7 +55,7 @@
 
   const void *array = buf;
   uchar *tmpBuf = 0;
-  if (cb || Fl_Surface_Device::surface()->class_name() == 
Fl_Printer::class_id) {
+  if (cb || !Fl_Surface_Device::to_display()) {
     tmpBuf = new uchar[ H*W*delta ];
     if (cb) {
       for (int i=0; i<H; i++) {
Index: src/fl_line_style.cxx
===================================================================
--- src/fl_line_style.cxx       (revision 9132)
+++ src/fl_line_style.cxx       (working copy)
@@ -118,7 +118,7 @@
   fl_quartz_line_width_ = (float)width; 
   fl_quartz_line_cap_ = Cap[(style>>8)&3];
   // when printing kCGLineCapSquare seems better for solid lines
-  if ( Fl_Surface_Device::surface()->class_name() == Fl_Printer::class_id && 
style == FL_SOLID && dashes == NULL ) {
+  if ( !Fl_Surface_Device::to_display() && style == FL_SOLID && dashes == NULL 
) {
     fl_quartz_line_cap_ = kCGLineCapSquare;
     }
   fl_quartz_line_join_ = Join[(style>>12)&3];
Index: src/Fl_Bitmap.cxx
===================================================================
--- src/Fl_Bitmap.cxx   (revision 9284)
+++ src/Fl_Bitmap.cxx   (working copy)
@@ -295,7 +295,7 @@
   HDC tempdc;
   int save;
   BOOL use_print_algo = false;
-  if (Fl_Surface_Device::surface()->class_name() == Fl_Printer::class_id) {
+  if (!Fl_Surface_Device::to_display()) {
     static HMODULE hMod = NULL;
     if (!hMod) {
       hMod = LoadLibrary("MSIMG32.DLL");
Index: src/Fl_Printer.cxx
===================================================================
--- src/Fl_Printer.cxx  (revision 9132)
+++ src/Fl_Printer.cxx  (working copy)
@@ -84,6 +84,7 @@
   fl_gc = (HDC)gc;
 #endif
   this->Fl_Surface_Device::set_current();
+  Fl_Surface_Device::same_driver_as_display = 1;
 }
 
 void Fl_System_Printer::origin(int *x, int *y)
Index: src/Fl_Text_Display.cxx
===================================================================
--- src/Fl_Text_Display.cxx     (revision 9140)
+++ src/Fl_Text_Display.cxx     (working copy)
@@ -3369,7 +3369,7 @@
   // draw the non-text, non-scrollbar areas.
   if (damage() & FL_DAMAGE_ALL) {
     //    printf("drawing all (box = %d)\n", box());
-    if (Fl_Surface_Device::surface()->class_name() == Fl_Printer::class_id) {
+    if (!Fl_Surface_Device::to_display()) {
       // if to printer, draw the background
       fl_rectf(text_area.x, text_area.y, text_area.w, text_area.h, color() );
     }
Index: src/Fl_Image.cxx
===================================================================
--- src/Fl_Image.cxx    (revision 9283)
+++ src/Fl_Image.cxx    (working copy)
@@ -532,7 +532,7 @@
   } else if (img->d()==2 || img->d()==4) {
     copy_offscreen_with_alpha(X, Y, W, H, (Fl_Offscreen)img->id_, cx, cy);
   } else {
-    fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)img->id_, cx, cy);
+    copy_offscreen(X, Y, W, H, (Fl_Offscreen)img->id_, cx, cy);
   }
 }
 
@@ -569,7 +569,7 @@
       XSetClipOrigin(fl_display, fl_gc, X-cx, Y-cy);
     }
     
-    fl_copy_offscreen(X, Y, W, H, img->id_, cx, cy);
+    copy_offscreen(X, Y, W, H, img->id_, cx, cy);
     
     if (img->mask_) {
       // put the old clip region back
Index: src/Fl_Pixmap.cxx
===================================================================
--- src/Fl_Pixmap.cxx   (revision 9278)
+++ src/Fl_Pixmap.cxx   (working copy)
@@ -107,7 +107,7 @@
     fl_draw_pixmap(pxm->data(), 0, 0, FL_GREEN);
     fl_end_offscreen();
     }
-  fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)pxm->id_, cx, cy);
+  copy_offscreen(X, Y, W, H, (Fl_Offscreen)pxm->id_, cx, cy);
 }
 
 #elif defined(WIN32)
@@ -132,7 +132,7 @@
     }
     fl_end_offscreen();
   }
-  if (Fl_Surface_Device::surface()->class_name() == Fl_Printer::class_id) {
+  if (!Fl_Surface_Device::to_display()) {
     typedef BOOL (WINAPI* fl_transp_func)  
(HDC,int,int,int,int,HDC,int,int,int,int,UINT);
     static HMODULE hMod = NULL;
     static fl_transp_func fl_TransparentBlt = NULL;
@@ -159,7 +159,7 @@
       fl_delete_offscreen(tmp_id);
     }
     else {
-      fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)pxm->id_, cx, cy);
+      copy_offscreen(X, Y, W, H, (Fl_Offscreen)pxm->id_, cx, cy);
     }
   }
   else if (pxm->mask_) {
@@ -172,7 +172,7 @@
     RestoreDC(new_gc,save);
     DeleteDC(new_gc);
   } else {
-    fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)pxm->id_, cx, cy);
+    copy_offscreen(X, Y, W, H, (Fl_Offscreen)pxm->id_, cx, cy);
   }
 }
 
@@ -210,7 +210,7 @@
     int oy = Y-cy; if (oy < 0) oy += pxm->h();
     XSetClipOrigin(fl_display, fl_gc, X-cx, Y-cy);
   }
-  fl_copy_offscreen(X, Y, W, H, pxm->id_, cx, cy);
+  copy_offscreen(X, Y, W, H, pxm->id_, cx, cy);
   if (pxm->mask_) {
     // put the old clip region back
     XSetClipOrigin(fl_display, fl_gc, 0, 0);
Index: src/Fl_Double_Window.cxx
===================================================================
--- src/Fl_Double_Window.cxx    (revision 9278)
+++ src/Fl_Double_Window.cxx    (working copy)
@@ -59,7 +59,6 @@
   Fl_Window::show();
 }
 
-static void fl_copy_offscreen_to_display(int x, int y, int w, int h, 
Fl_Offscreen pixmap, int srcx, int srcy);
 
 /** \addtogroup fl_drawings
  @{
@@ -70,23 +69,41 @@
  \param pixmap  offscreen buffer containing the rectangle to copy
  \param srcx,srcy origin in offscreen buffer of rectangle to copy
  */
+#if FLTK_ABI_VERSION >= 10302
+inline void fl_copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, 
int srcx, int srcy) {
+  fl_graphics_driver->copy_offscreen(x, y, w, h, pixmap, srcx, srcy);
+}
+#else
 void fl_copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int 
srcx, int srcy) {
-  if (fl_graphics_driver->class_name() == 
Fl_Display_Device::display_device()->driver()->class_name()) {
-    fl_copy_offscreen_to_display(x, y, w, h, pixmap, srcx, srcy);
+  if (Fl_Surface_Device::uses_display_driver()) {
+#ifdef USE_X11
+    ((Fl_Xlib_Graphics_Driver*)fl_graphics_driver)->copy_offscreen(x, y, w, h, 
pixmap, srcx, srcy);
+#elif defined(WIN32)
+    ((Fl_GDI_Graphics_Driver*)fl_graphics_driver)->copy_offscreen(x, y, w, h, 
pixmap, srcx, srcy);
+#elif defined(__APPLE__)
+    ((Fl_Quartz_Graphics_Driver*)fl_graphics_driver)->copy_offscreen(x, y, w, 
h, pixmap, srcx, srcy);
+#endif
   }
   else { // when copy is not to the display
-    fl_begin_offscreen(pixmap);
-    uchar *img = fl_read_image(NULL, srcx, srcy, w, h, 0);
-    fl_end_offscreen();
-    fl_draw_image(img, x, y, w, h, 3, 0);
-    delete[] img;
+    fl_graphics_driver->copy_offscreen(x, y, w, h, pixmap, srcx, srcy);
   }
 }
+#endif // FLTK_ABI_VERSION
 /** @} */
 
+/** see fl_copy_offscreen() */
+void Fl_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, 
Fl_Offscreen pixmap, int srcx, int srcy)
+{
+  fl_begin_offscreen(pixmap);
+  uchar *img = fl_read_image(NULL, srcx, srcy, w, h, 0);
+  fl_end_offscreen();
+  fl_draw_image(img, x, y, w, h, 3, 0);
+  delete[] img;
+}
+
 #if defined(USE_X11)
 
-static void fl_copy_offscreen_to_display(int x, int y, int w, int h, 
Fl_Offscreen pixmap, int srcx, int srcy) {
+void Fl_Xlib_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, 
Fl_Offscreen pixmap, int srcx, int srcy) {
   XCopyArea(fl_display, pixmap, fl_window, fl_gc, srcx, srcy, w, h, x, y);
 }
 
@@ -158,7 +175,7 @@
   return new_gc;
 }
 
-static void fl_copy_offscreen_to_display(int x,int y,int w,int h,HBITMAP 
bitmap,int srcx,int srcy) {
+void Fl_GDI_Graphics_Driver::copy_offscreen(int x,int y,int w,int h,HBITMAP 
bitmap,int srcx,int srcy) {
   HDC new_gc = CreateCompatibleDC(fl_gc);
   int save = SaveDC(new_gc);
   SelectObject(new_gc, bitmap);
@@ -171,11 +188,11 @@
   HDC new_gc = CreateCompatibleDC(fl_gc);
   int save = SaveDC(new_gc);
   SelectObject(new_gc, bitmap);
+  fl_can_do_alpha_blending(); // make sure this is called
   BOOL alpha_ok = 0;
   // first try to alpha blend
   // if to printer, always try alpha_blend
-  int to_display = Fl_Surface_Device::surface()->class_name() == 
Fl_Display_Device::class_id; // true iff display output
-  if ( (to_display && fl_can_do_alpha_blending()) || 
Fl_Surface_Device::surface()->class_name() == Fl_Printer::class_id) {
+  if ( (!Fl_Surface_Device::to_display()) || fl_can_do_alpha_blending() ) {
     if (fl_alpha_blend) alpha_ok = fl_alpha_blend(fl_gc, x, y, w, h, new_gc, 
srcx, srcy, w, h, blendfunc);
   }
   // if that failed (it shouldn't), still copy the bitmap over, but now alpha 
is 1
@@ -194,6 +211,7 @@
   return 1;
 }
 
+#if ! defined(FL_DOXYGEN)
 Fl_Offscreen Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(int w, int 
h) {
   void *data = calloc(w*h,4);
   CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB();
@@ -202,6 +220,7 @@
   CGColorSpaceRelease(lut);
   return (Fl_Offscreen)ctx;
 }
+#endif
 
 /** \addtogroup fl_drawings
  @{
@@ -227,7 +246,7 @@
   if(count == 1) free((void*)data);
 }
 
-static void fl_copy_offscreen_to_display(int x,int y,int w,int h,Fl_Offscreen 
osrc,int srcx,int srcy) {
+void Fl_Quartz_Graphics_Driver::copy_offscreen(int x,int y,int w,int 
h,Fl_Offscreen osrc,int srcx,int srcy) {
   CGContextRef src = (CGContextRef)osrc;
   void *data = CGBitmapContextGetData(src);
   int sw = CGBitmapContextGetWidth(src);
Index: src/Fl_win32.cxx
===================================================================
--- src/Fl_win32.cxx    (revision 9132)
+++ src/Fl_win32.cxx    (working copy)
@@ -85,8 +85,6 @@
 
 static Fl_GDI_Graphics_Driver fl_gdi_driver;
 static Fl_Display_Device fl_gdi_display(&fl_gdi_driver);
-FL_EXPORT Fl_Graphics_Driver *fl_graphics_driver = 
(Fl_Graphics_Driver*)&fl_gdi_driver; // the current target driver of graphics 
operations
-Fl_Surface_Device* Fl_Surface_Device::_surface = 
(Fl_Surface_Device*)&fl_gdi_display; // the current target surface of graphics 
operations
 Fl_Display_Device *Fl_Display_Device::_display = &fl_gdi_display; // the 
platform display
 
 // dynamic wsock dll handling api:
@@ -1949,7 +1947,7 @@
 }
 
 Fl_Region XRectangleRegion(int x, int y, int w, int h) {
-  if (Fl_Surface_Device::surface()->class_name() == 
Fl_Display_Device::class_id) return CreateRectRgn(x,y,x+w,y+h);
+  if (Fl_Surface_Device::to_display()) return CreateRectRgn(x,y,x+w,y+h);
   // because rotation may apply, the rectangle becomes a polygon in device 
coords
   POINT pt[4] = { {x, y}, {x + w, y}, {x + w, y + h}, {x, y + h} };
   LPtoDP(fl_gc, pt, 4);
Index: src/Fl_x.cxx
===================================================================
--- src/Fl_x.cxx        (revision 9192)
+++ src/Fl_x.cxx        (working copy)
@@ -54,8 +54,6 @@
 
 static Fl_Xlib_Graphics_Driver fl_xlib_driver;
 static Fl_Display_Device fl_xlib_display(&fl_xlib_driver);
-FL_EXPORT Fl_Graphics_Driver *fl_graphics_driver = 
(Fl_Graphics_Driver*)&fl_xlib_driver; // the current target device of graphics 
operations
-Fl_Surface_Device* Fl_Surface_Device::_surface = 
(Fl_Surface_Device*)&fl_xlib_display; // the current target surface of graphics 
operations
 Fl_Display_Device *Fl_Display_Device::_display = &fl_xlib_display;// the 
platform display
 
 ////////////////////////////////////////////////////////////////
Index: src/fl_draw_pixmap.cxx
===================================================================
--- src/fl_draw_pixmap.cxx      (revision 9132)
+++ src/fl_draw_pixmap.cxx      (working copy)
@@ -332,9 +332,7 @@
 #endif
   
 #ifdef  __APPLE_QUARTZ__
-  if (fl_graphics_driver->class_name() == Fl_Quartz_Graphics_Driver::class_id 
) {
-    bool transparent = (transparent_index>=0);
-    transparent = true;
+  if (Fl_Surface_Device::uses_display_driver()) {
     U32 *array = new U32[d.w * d.h], *q = array;
     for (int Y = 0; Y < d.h; Y++) {
       const uchar* p = data[Y];
@@ -349,18 +347,9 @@
        }
       }
     }
-    CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB();
-    CGDataProviderRef src = CGDataProviderCreateWithData( 0L, array, d.w * d.h 
* 4, 0L);
-    CGImageRef img = CGImageCreate(d.w, d.h, 8, 4*8, 4*d.w,
-                                  lut, 
transparent?kCGImageAlphaLast:kCGImageAlphaNoneSkipLast,
-                                  src, 0L, false, kCGRenderingIntentDefault);
-    CGColorSpaceRelease(lut);
-    CGDataProviderRelease(src);
-    CGRect rect = { { x, y} , { d.w, d.h } };
-    Fl_X::q_begin_image(rect, 0, 0, d.w, d.h);
-    CGContextDrawImage(fl_gc, rect, img);
-    Fl_X::q_end_image();
-    CGImageRelease(img);
+    Fl_RGB_Image* rgb = new Fl_RGB_Image((uchar*)array, d.w, d.h, 4);
+    rgb->draw(x, y);
+    delete rgb;
     delete[] array;
     }
   else {
Index: src/fl_rect.cxx
===================================================================
--- src/fl_rect.cxx     (revision 9132)
+++ src/fl_rect.cxx     (working copy)
@@ -40,7 +40,7 @@
 
 #ifdef __APPLE_QUARTZ__
 extern float fl_quartz_line_width_;
-#define USINGQUARTZPRINTER  (Fl_Surface_Device::surface()->class_name() == 
Fl_Printer::class_id)
+#define USINGQUARTZPRINTER  (!Fl_Surface_Device::to_display())
 #endif
 
 #ifdef USE_X11
@@ -612,7 +612,7 @@
   return XRectInRegion(r, x, y, w, h);
 #elif defined(WIN32)
   RECT rect;
-  if (Fl_Surface_Device::surface()->class_name() == Fl_Printer::class_id) { // 
in case of print context, convert coords from logical to device
+  if (!Fl_Surface_Device::to_display()) { // in case of print context, convert 
coords from logical to device
     POINT pt[2] = { {x, y}, {x + w, y + h} };
     LPtoDP(fl_gc, pt, 2);
     rect.left = pt[0].x; rect.top = pt[0].y; rect.right = pt[1].x; rect.bottom 
= pt[1].y;
@@ -672,7 +672,7 @@
   } else {     // partial intersection
     RECT rect;
     GetRgnBox(temp, &rect);
-    if(Fl_Surface_Device::surface()->class_name() == Fl_Printer::class_id) { 
// if print context, convert coords from device to logical
+    if(!Fl_Surface_Device::to_display()) { // if print context, convert coords 
from device to logical
       POINT pt[2] = { {rect.left, rect.top}, {rect.right, rect.bottom} };
       DPtoLP(fl_gc, pt, 2);
       X = pt[0].x; Y = pt[0].y; W = pt[1].x - X; H = pt[1].y - Y;
Index: src/fl_font_win32.cxx
===================================================================
--- src/fl_font_win32.cxx       (revision 9132)
+++ src/fl_font_win32.cxx       (working copy)
@@ -263,7 +263,7 @@
 
 // if printer context, extents shd be converted to logical coords
 #define EXTENTS_UPDATE(x,y,w,h) \
-  if (Fl_Surface_Device::surface()->class_name() == Fl_Printer::class_id) { 
on_printer_extents_update(x,y,w,h); }
+  if (!Fl_Surface_Device::to_display()) { on_printer_extents_update(x,y,w,h); }
 
 // Function to determine the extent of the "inked" area of the glyphs in a 
string
 void Fl_GDI_Graphics_Driver::text_extents(const char *c, int n, int &dx, int 
&dy, int &w, int &h) {
Index: src/Fl_cocoa.mm
===================================================================
--- src/Fl_cocoa.mm     (revision 9282)
+++ src/Fl_cocoa.mm     (working copy)
@@ -89,8 +89,6 @@
 
 static Fl_Quartz_Graphics_Driver fl_quartz_driver;
 static Fl_Display_Device fl_quartz_display(&fl_quartz_driver);
-FL_EXPORT Fl_Graphics_Driver *fl_graphics_driver = 
(Fl_Graphics_Driver*)&fl_quartz_driver; // the current target device of 
graphics operations
-Fl_Surface_Device* Fl_Surface_Device::_surface = 
(Fl_Surface_Device*)&fl_quartz_display; // the current target surface of 
graphics operations
 Fl_Display_Device *Fl_Display_Device::_display = &fl_quartz_display; // the 
platform display
 
 // public variables
Index: src/fl_draw_image_win32.cxx
===================================================================
--- src/fl_draw_image_win32.cxx (revision 9132)
+++ src/fl_draw_image_win32.cxx (working copy)
@@ -169,7 +169,7 @@
   int blocking = h;
   {int size = linesize*h;
   // when printing, don't limit buffer size not to get a crash in StretchDIBits
-  if (size > MAXBUFFER && Fl_Surface_Device::surface()->class_name() != 
Fl_Printer::class_id) {
+  if (size > MAXBUFFER && Fl_Surface_Device::to_display()) {
     size = MAXBUFFER;
     blocking = MAXBUFFER/linesize;
   }
@@ -247,7 +247,7 @@
         }            
       }
     }
-    if(Fl_Surface_Device::surface()->class_name() == Fl_Printer::class_id) {
+    if(!Fl_Surface_Device::to_display()) {
       // if print context, device and logical units are not equal, so 
SetDIBitsToDevice
       // does not do the expected job, whereas StretchDIBits does it.
       StretchDIBits(fl_gc, x, y+j-k, w, k, 0, 0, w, k,
Index: FL/Fl_Device.H
===================================================================
--- FL/Fl_Device.H      (revision 9278)
+++ FL/Fl_Device.H      (working copy)
@@ -73,6 +73,10 @@
   static const char *class_id;
   /** 
    Returns the name of the class of this object. 
+   Use of the class_name() function is discouraged because
+   functions Fl_Surface_Device::to_display() or 
Fl_Surface_Device::uses_display_driver() 
+   should suffice in most if not all cases.
+   
    The class of an instance of an Fl_Device subclass can be checked with code 
such as:
    \code
    if ( instance->class_name() == Fl_Printer::class_id ) { ... }
@@ -206,7 +210,7 @@
   friend void fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int 
W,int H, int D);
   friend FL_EXPORT void fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data, 
int X,int Y,int W,int H, int D);
   friend FL_EXPORT void gl_start();
-
+  friend void fl_copy_offscreen(int x, int y, int w, int h, Fl_Offscreen 
pixmap, int srcx, int srcy);
   matrix *fl_matrix; /**< Points to the current coordinate transformation 
matrix */
 
   /** \brief The constructor. */
@@ -360,7 +364,11 @@
    the image offset by the cx and cy arguments.
    */
   virtual void draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int 
cy) {}
-    
+#if FLTK_ABI_VERSION >= 10302
+  virtual
+#endif
+  void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int 
srcx, int srcy);
+  
 public:
   static const char *class_id;
   virtual const char *class_name() {return class_id;};
@@ -424,6 +432,7 @@
 #if ! defined(FL_DOXYGEN)
   static Fl_Offscreen create_offscreen_with_alpha(int w, int h);
 #endif
+  void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int 
srcx, int srcy);
 };
 #endif
 #if defined(WIN32) || defined(FL_DOXYGEN)
@@ -457,6 +466,7 @@
 #if ! defined(FL_DOXYGEN)
   void copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP bitmap,int 
srcx,int srcy);
 #endif
+  void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int 
srcx, int srcy);
 };
 #endif
 #if !(defined(__APPLE__) || defined(WIN32))
@@ -487,6 +497,7 @@
   void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h);
   int height();
   int descent();
+  void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int 
srcx, int srcy);
 };
 #endif
 
@@ -500,6 +511,9 @@
 protected:
   /** \brief Constructor that sets the graphics driver to use for the created 
surface. */
   Fl_Surface_Device(Fl_Graphics_Driver *graphics_driver) {_driver = 
graphics_driver; };
+  /** true if the surface that currently receives graphics output uses 
+   the same graphics driver as the system's display */
+  static int same_driver_as_display;
 public:
   static const char *class_id;
   const char *class_name() {return class_id;};
@@ -510,6 +524,8 @@
   inline Fl_Graphics_Driver *driver() {return _driver; };
   /** \brief the surface that currently receives graphics output */
   static inline Fl_Surface_Device *surface() {return _surface; }; 
+  static int to_display();
+  static int uses_display_driver();
   /** \brief The destructor. */
   virtual ~Fl_Surface_Device() {}
 };
@@ -526,6 +542,7 @@
   Fl_Display_Device(Fl_Graphics_Driver *graphics_driver);
   /** Returns the platform display device. */
   static inline Fl_Display_Device *display_device() {return _display;};
+  void set_current(void);
 };
 
 /**
Index: FL/x.H
===================================================================
--- FL/x.H      (revision 9132)
+++ FL/x.H      (working copy)
@@ -86,7 +86,7 @@
 typedef ulong Fl_Offscreen;
 #   define fl_create_offscreen(w,h) \
   XCreatePixmap(fl_display, \
-             (Fl_Surface_Device::surface()->class_name() == 
Fl_Display_Device::class_id ? \
+             (Fl_Surface_Device::to_display() ? \
              fl_window : fl_xid(Fl::first_window()) ) , \
              w, h, fl_visual->depth)
 // begin/end are macros that save the old state in local variables:
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to