Strip Graphics Driver related ifdefs.

- removed more ifdef's from the graphics drivers
- moved functionality into the driver files themselves
- updated CMakeList.txt



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11137 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2016-02-09 12:33:49 +00:00
parent 99a6faa513
commit dee0f5a824
7 changed files with 107 additions and 56 deletions

View File

@ -116,6 +116,14 @@ class FL_EXPORT Fl_Graphics_Driver : public Fl_Device {
friend class Fl_Pixmap;
friend class Fl_Bitmap;
friend class Fl_RGB_Image;
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,
// but located in the device driver module that is linked to the core library
static Fl_Graphics_Driver *newMainGraphicsDriver();
//static Fl_Graphics_Driver *newOpenGLGraphicsDriver();
//static Fl_Graphics_Driver *newPrinterGraphicsDriver();
//static Fl_Graphics_Driver *new...;
public:
/** A 2D coordinate transformation matrix */
struct matrix {double a, b, c, d, x, y;};
@ -354,23 +362,16 @@ public:
There is no need to create any other object of this class.
*/
class FL_EXPORT Fl_Display_Device : public Fl_Surface_Device {
friend class Fl_Quartz_Graphics_Driver;
static Fl_Display_Device *_display; // the platform display device
#ifdef __APPLE__
friend class Fl_X;
friend class Fl_Graphics_Driver;
static Fl_Display_Device *_display; // the platform display device
static bool high_res_window_; //< true when drawing to a window of a retina display (Mac OS X only)
static bool high_resolution() {return high_res_window_;}
#elif defined(WIN32)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement functions for extra high res drawing if your platform supports it"
#else
#endif
public:
static const char *class_id;
const char *class_name() {return class_id;};
Fl_Display_Device(Fl_Graphics_Driver *graphics_driver);
static Fl_Display_Device *display_device();
static bool high_resolution() {return high_res_window_;}
};
/**

View File

@ -159,6 +159,7 @@ if (USE_X11)
# X11 (including APPLE with X11)
set(DRIVER_FILES
drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx
drivers/Xlib/Fl_Xlib_Graphics_Driver_arci.cxx
drivers/Xlib/Fl_Xlib_Graphics_Driver_color.cxx
drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx
@ -198,6 +199,7 @@ else ()
# Windows (GDI)
set(DRIVER_FILES
drivers/GDI/Fl_GDI_Graphics_Driver.cxx
drivers/GDI/Fl_GDI_Graphics_Driver_arci.cxx
drivers/GDI/Fl_GDI_Graphics_Driver_color.cxx
drivers/GDI/Fl_GDI_Graphics_Driver_font.cxx

View File

@ -22,36 +22,12 @@
#include <FL/Fl_Image.H>
#include <FL/fl_draw.H>
#ifdef FL_CFG_GFX_QUARTZ
#include "drivers/Quartz/Fl_Quartz_Graphics_Driver.h"
#endif
#if defined(WIN32) || defined(__APPLE__)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: instantiate and implement various device drivers here"
#else
#endif
const char *Fl_Device::class_id = "Fl_Device";
const char *Fl_Surface_Device::class_id = "Fl_Surface_Device";
const char *Fl_Display_Device::class_id = "Fl_Display_Device";
const char *Fl_Graphics_Driver::class_id = "Fl_Graphics_Driver";
#if defined(__APPLE__) || defined(FL_DOXYGEN)
# ifndef FL_DOXYGEN
bool Fl_Display_Device::high_res_window_ = false;
# endif
#endif
#if defined(WIN32) || defined(FL_DOXYGEN)
const char *Fl_GDI_Graphics_Driver::class_id = "Fl_GDI_Graphics_Driver";
const char *Fl_GDI_Printer_Graphics_Driver::class_id = "Fl_GDI_Printer_Graphics_Driver";
#endif
#if !(defined(__APPLE__) || defined(WIN32))
#if defined(FL_PORTING)
# pragma message "FL_PORTING: instantiate the main graphics driver here"
#else
const char *Fl_Xlib_Graphics_Driver::class_id = "Fl_Xlib_Graphics_Driver";
#endif
#endif
bool Fl_Display_Device::high_res_window_ = false;
/** \brief Make this surface the current drawing surface.
@ -103,18 +79,7 @@ Fl_Display_Device::Fl_Display_Device(Fl_Graphics_Driver *graphics_driver) : Fl_S
/** Returns the platform display device. */
Fl_Display_Device *Fl_Display_Device::display_device() {
static Fl_Display_Device *display = new Fl_Display_Device(new
#if defined(__APPLE__)
Fl_Quartz_Graphics_Driver
#elif defined(WIN32)
Fl_GDI_Graphics_Driver
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: instantiate your display driver here"
Fl_XXX_Graphics_Driver
#else
Fl_Xlib_Graphics_Driver
#endif
);
static Fl_Display_Device *display = new Fl_Display_Device(Fl_Graphics_Driver::newMainGraphicsDriver());
return display;
};

View File

@ -0,0 +1,42 @@
//
// "$Id$"
//
// Rectangle drawing routines for the Fast Light Tool Kit (FLTK).
//
// 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
// file is missing or damaged, see the license at:
//
// http://www.fltk.org/COPYING.php
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
//
#include <config.h>
#include "../../config_lib.h"
#include "Fl_GDI_Graphics_Driver.h"
const char *Fl_GDI_Graphics_Driver::class_id = "Fl_GDI_Graphics_Driver";
// FIXME: move to printer graphics driver
const char *Fl_GDI_Printer_Graphics_Driver::class_id = "Fl_GDI_Printer_Graphics_Driver";
/*
* By linking this module, the following static method will instatiate the
* MSWindows GDI Graphics driver as the main display driver.
*/
Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver()
{
return new Fl_GDI_Graphics_Driver();
}
//
// End of "$Id$".
//

View File

@ -38,11 +38,6 @@ const char *Fl_Device::class_id = "Fl_Device";
const char *Fl_Surface_Device::class_id = "Fl_Surface_Device";
const char *Fl_Display_Device::class_id = "Fl_Display_Device";
const char *Fl_Graphics_Driver::class_id = "Fl_Graphics_Driver";
#if defined(__APPLE__) || defined(FL_DOXYGEN)
# ifndef FL_DOXYGEN
bool Fl_Display_Device::high_res_window_ = false;
# endif
#endif
#if defined(WIN32) || defined(FL_DOXYGEN)
const char *Fl_GDI_Graphics_Driver::class_id = "Fl_GDI_Graphics_Driver";
const char *Fl_GDI_Printer_Graphics_Driver::class_id = "Fl_GDI_Printer_Graphics_Driver";

View File

@ -18,13 +18,22 @@
#include "../../config_lib.h"
#ifdef FL_CFG_GFX_QUARTZ
#include "Fl_Quartz_Graphics_Driver.h"
const char *Fl_Quartz_Graphics_Driver::class_id = "Fl_Quartz_Graphics_Driver";
/*
* By linking this module, the following static method will instatiate the
* OS X Quartz Graphics driver as the main display driver.
*/
Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver()
{
return new Fl_Quartz_Graphics_Driver();
}
Fl_Offscreen Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(int w, int h) {
void *data = calloc(w*h,4);
CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB();
@ -34,8 +43,6 @@ Fl_Offscreen Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(int w, int h
}
#endif // FL_CFG_GFX_QUARTZ
//
// End of "$Id$".
//

View File

@ -0,0 +1,39 @@
//
// "$Id$"
//
// Rectangle drawing routines for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2012 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
// file is missing or damaged, see the license at:
//
// http://www.fltk.org/COPYING.php
//
// Please report all bugs and problems on the following page:
//
// http://www.fltk.org/str.php
//
#include <config.h>
#include "../../config_lib.h"
#include "Fl_Xlib_Graphics_Driver.h"
const char *Fl_Xlib_Graphics_Driver::class_id = "Fl_Xlib_Graphics_Driver";
/*
* By linking this module, the following static method will instatiate the
* X11 Xlib Graphics driver as the main display driver.
*/
Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver()
{
return new Fl_Xlib_Graphics_Driver();
}
//
// End of "$Id$".
//