summaryrefslogtreecommitdiff
path: root/FL
diff options
context:
space:
mode:
Diffstat (limited to 'FL')
-rw-r--r--FL/Fl_Device.H3
-rw-r--r--FL/Fl_Graphics_Driver.H9
-rw-r--r--FL/Fl_Image_Surface.H3
-rw-r--r--FL/Fl_PostScript.H23
-rw-r--r--FL/Fl_Printer.H3
-rw-r--r--FL/mac.H2
-rw-r--r--FL/win32.H14
7 files changed, 22 insertions, 35 deletions
diff --git a/FL/Fl_Device.H b/FL/Fl_Device.H
index cff6e228e..69b7f5d03 100644
--- a/FL/Fl_Device.H
+++ b/FL/Fl_Device.H
@@ -45,7 +45,8 @@ public:
static const char *class_id;
/**
Returns the name of the class of this object.
- Use of the class_name() function is discouraged because it will be removed from future FLTK versions.
+ The class_name() function is deprecated.
+ The preferred procedure is to use the Fl_Graphics_Driver::has_feature() member function.
The class of an instance of an Fl_Device subclass can be checked with code such as:
\code
diff --git a/FL/Fl_Graphics_Driver.H b/FL/Fl_Graphics_Driver.H
index cdf2f6611..3dedcf5d9 100644
--- a/FL/Fl_Graphics_Driver.H
+++ b/FL/Fl_Graphics_Driver.H
@@ -4,7 +4,7 @@
// Definition of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device
// for the Fast Light Tool Kit (FLTK).
//
-// Copyright 2010-2014 by Bill Spitzak and others.
+// Copyright 2010-2016 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -84,9 +84,12 @@ typedef short COORD_T;
to support all FLTK drawing functions.
*/
class FL_EXPORT Fl_Graphics_Driver : public Fl_Device {
+ friend class Fl_Surface_Device;
friend class Fl_Pixmap;
friend class Fl_Bitmap;
friend class Fl_RGB_Image;
+private:
+ void global_gc(void);
public:
// The following functions create the various graphics drivers that are required
// for core operations. They must be implemented as members of Fl_Graphics_Driver,
@@ -251,6 +254,10 @@ public:
virtual int draw_scaled(Fl_Image *img, int X, int Y, int W, int H);
virtual void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
+ /** Sets the value of the driver-specific graphics context. */
+ virtual void set_gc(void*) {}
+ /** Returns the driver-specific graphics context, of NULL if there's none. */
+ virtual void *get_gc(void) {return NULL;}
protected:
// --- implementation is in src/fl_vertex.cxx which includes src/cfg_gfx/xxx_rect.cxx
virtual void transformed_vertex0(COORD_T x, COORD_T y);
diff --git a/FL/Fl_Image_Surface.H b/FL/Fl_Image_Surface.H
index bcd868d59..4b05db72e 100644
--- a/FL/Fl_Image_Surface.H
+++ b/FL/Fl_Image_Surface.H
@@ -3,7 +3,7 @@
//
// Draw-to-image code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2014 by Bill Spitzak and others.
+// Copyright 1998-2016 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -61,7 +61,6 @@ private:
#else
Fl_Surface_Device *previous;
Window pre_window;
- GC gc;
#endif
public:
static const char *class_id;
diff --git a/FL/Fl_PostScript.H b/FL/Fl_PostScript.H
index 64e49f45d..69114ce2c 100644
--- a/FL/Fl_PostScript.H
+++ b/FL/Fl_PostScript.H
@@ -3,7 +3,7 @@
//
// Support for graphics output to PostScript file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 2010-2011 by Bill Spitzak and others.
+// Copyright 2010-2016 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -233,15 +233,6 @@ class Clip {
two variants of which are usable and allow to specify what page format and layout are desired.
*/
class FL_EXPORT Fl_PostScript_File_Device : public Fl_Paged_Device {
-#ifdef __APPLE__ // PORTME: Fl_Surface_Driver ? - platform specifics for PostScript
- CGContextRef gc;
-#elif defined(WIN32)
- // not needed
-#elif defined(FL_PORTING)
-# pragma message "FL_PORTING: define storage for your graphics context in Fl_PostScript_File_Device if needed"
-#else // X11
- // not needed
-#endif
protected:
Fl_PostScript_Graphics_Driver *driver();
public:
@@ -264,17 +255,7 @@ public:
void translate(int x, int y);
void untranslate(void);
int end_page (void);
- void end_job(void);
-#ifdef __APPLE__ // PORTME: Fl_Surface_Driver ? - platform specifics for PostScript
- void set_current() { fl_gc = gc; Fl_Paged_Device::set_current(); }
-#elif defined(WIN32)
- // not needed
-#elif defined(FL_PORTING)
-# pragma message "FL_PORTING: set access to your graphics context in Fl_PostScript_File_Device if needed"
-#else // X11
- // not needed
-#endif
-
+ void end_job(void);
static const char *file_chooser_title;
};
diff --git a/FL/Fl_Printer.H b/FL/Fl_Printer.H
index c65dba83a..a1f99bc48 100644
--- a/FL/Fl_Printer.H
+++ b/FL/Fl_Printer.H
@@ -51,9 +51,6 @@
class Fl_System_Printer : public Fl_Paged_Device {
friend class Fl_Printer;
private:
- /** \brief the printer's graphics context, if there's one, NULL otherwise */
- void *gc;
- void set_current(void);
#ifdef __APPLE__ // PORTME: Fl_Surface_Driver ? - platform printer driver
float scale_x;
float scale_y;
diff --git a/FL/mac.H b/FL/mac.H
index a2559882f..5f2a5f5b6 100644
--- a/FL/mac.H
+++ b/FL/mac.H
@@ -162,7 +162,7 @@ public:
void in_windowDidResize(bool); // sets whether window is performing windowDidResize
// Quartz additions:
CGContextRef gc; // graphics context (NULL when using QD)
- static void q_release_context(Fl_X *x=0); // free all resources associated with fl_gc
+ static void q_release_context(Fl_X *x=0); // free all resources associated with gc
// Cocoa additions
static NSOpenGLPixelFormat *mode_to_NSOpenGLPixelFormat(int mode, const int*); // computes NSOpenGLPixelFormat from Gl window's mode
static NSOpenGLContext* create_GLcontext_for_window(NSOpenGLPixelFormat *pixelformat, NSOpenGLContext *shared_ctx, Fl_Window *window);
diff --git a/FL/win32.H b/FL/win32.H
index 657a66d9f..3707f81f7 100644
--- a/FL/win32.H
+++ b/FL/win32.H
@@ -3,7 +3,7 @@
//
// WIN32 header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2012 by Bill Spitzak and others.
+// Copyright 1998-2016 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -132,15 +132,17 @@ extern FL_EXPORT HDC fl_makeDC(HBITMAP);
// off-screen pixmaps: create, destroy, draw into, copy to window
typedef HBITMAP Fl_Offscreen;
#define fl_create_offscreen(w, h) \
- CreateCompatibleBitmap( (fl_gc ? fl_gc : fl_GetDC(0) ) , w, h)
+ CreateCompatibleBitmap( (fl_graphics_driver->get_gc() ? (HDC)fl_graphics_driver->get_gc() : fl_GetDC(0) ) , w, h)
# define fl_begin_offscreen(b) \
- HDC _sgc=fl_gc; Window _sw=fl_window; \
- Fl_Surface_Device *_ss = Fl_Surface_Device::surface(); Fl_Display_Device::display_device()->set_current(); \
- fl_gc=fl_makeDC(b); int _savedc = SaveDC(fl_gc); fl_window=(HWND)b; fl_push_no_clip()
+ void* _sgc=fl_graphics_driver->get_gc(); Window _sw=fl_window; \
+ Fl_Surface_Device *_ss = Fl_Surface_Device::surface(); \
+HDC _tmp_gc = fl_makeDC(b); int _savedc = SaveDC(_tmp_gc); \
+Fl_Display_Device::display_device()->set_current(); \
+ fl_graphics_driver->set_gc(_tmp_gc); fl_window=(HWND)b; fl_push_no_clip()
# define fl_end_offscreen() \
- fl_pop_clip(); RestoreDC(fl_gc, _savedc); DeleteDC(fl_gc); _ss->set_current(); fl_window=_sw; fl_gc = _sgc
+ fl_pop_clip(); RestoreDC((HDC)fl_graphics_driver->get_gc(), _savedc); DeleteDC((HDC)fl_graphics_driver->get_gc()); _ss->set_current(); fl_window=_sw; fl_graphics_driver->set_gc(_sgc);
FL_EXPORT void fl_copy_offscreen(int x,int y,int w,int h,HBITMAP pixmap,int srcx,int srcy);