summaryrefslogtreecommitdiff
path: root/src/drivers/Quartz
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2016-01-29 15:24:33 +0000
committerMatthias Melcher <fltk@matthiasm.com>2016-01-29 15:24:33 +0000
commit222243bc865df5f6531e6ec7d20c3b1b072d1ee6 (patch)
tree77d171db9767483f808c3c06aa75a1de3ae4d64e /src/drivers/Quartz
parent72dda7f35a11ca0fedac1ba5047db6988fb16299 (diff)
Made OpenGL driver compile by itself instead of including files from another .cxx file.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11083 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/Quartz')
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Display_Device.cxx129
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Display_Device.h69
2 files changed, 198 insertions, 0 deletions
diff --git a/src/drivers/Quartz/Fl_Quartz_Display_Device.cxx b/src/drivers/Quartz/Fl_Quartz_Display_Device.cxx
new file mode 100644
index 000000000..df0eaba5d
--- /dev/null
+++ b/src/drivers/Quartz/Fl_Quartz_Display_Device.cxx
@@ -0,0 +1,129 @@
+//
+// "$Id$"
+//
+// implementation of Fl_Device class for the Fast Light Tool Kit (FLTK).
+//
+// 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
+// file is missing or damaged, see the license at:
+//
+// http://www.fltk.org/COPYING.php
+//
+// Please report all bugs and problems to:
+//
+// http://www.fltk.org/str.php
+//
+
+// FIXME: implement this
+#if 0
+
+#include <FL/Fl.H>
+#include <FL/Fl_Device.H>
+#include <FL/Fl_Image.H>
+
+#include "config_lib.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
+
+
+/** \brief Make this surface the current drawing surface.
+ This surface will receive all future graphics requests. */
+void Fl_Surface_Device::set_current(void)
+{
+ fl_graphics_driver = _driver;
+ _surface = this;
+}
+
+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() {
+ font_ = 0;
+ size_ = 0;
+ sptr=0; rstackptr=0;
+ rstack[0] = NULL;
+ fl_clip_state_number=0;
+ m = m0;
+ fl_matrix = &m;
+ p = (XPOINT *)0;
+ font_descriptor_ = NULL;
+ p_size = 0;
+};
+
+void Fl_Graphics_Driver::text_extents(const char*t, int n, int& dx, int& dy, int& w, int& h)
+{
+ w = (int)width(t, n);
+ h = - height();
+ dx = 0;
+ dy = descent();
+}
+
+/** A constructor that sets the graphics driver used by the display */
+Fl_Display_Device::Fl_Display_Device(Fl_Graphics_Driver *graphics_driver) : Fl_Surface_Device(graphics_driver) {
+ this->set_current();
+};
+
+
+/** 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
+ );
+ return display;
+};
+
+
+Fl_Surface_Device *Fl_Surface_Device::default_surface()
+{
+ return Fl_Display_Device::display_device();
+}
+
+
+Fl_Display_Device *Fl_Display_Device::_display = Fl_Display_Device::display_device();
+
+#endif
+
+//
+// End of "$Id$".
+//
diff --git a/src/drivers/Quartz/Fl_Quartz_Display_Device.h b/src/drivers/Quartz/Fl_Quartz_Display_Device.h
new file mode 100644
index 000000000..221b80478
--- /dev/null
+++ b/src/drivers/Quartz/Fl_Quartz_Display_Device.h
@@ -0,0 +1,69 @@
+//
+// "$Id$"
+//
+// Definition of class Fl_Quartz_Display_Device
+// for the Fast Light Tool Kit (FLTK).
+//
+// 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
+// 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
+//
+
+/** \file Fl_Quartz_Disply_Device.h
+ \brief Implement a connection between the Cocoa window management and the
+ Quartz graphics driver on OS X.
+*/
+
+#ifndef FL_QUARTZ_DISPLAY_DEVICE_H
+#define FL_QUARTZ_DISPLAY_DEVICE_H
+
+// FIXME: implement this
+#if 0
+#include <FL/x.H>
+#include <FL/Fl_Plugin.H>
+#include <FL/Fl_Image.H>
+#include <FL/Fl_Bitmap.H>
+#include <FL/Fl_Pixmap.H>
+#include <FL/Fl_RGB_Image.H>
+#include <stdlib.h>
+
+/**
+ A display to which the computer can draw.
+ When the program begins running, an Fl_Display_Device instance has been created and made the current drawing surface.
+ 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 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();
+};
+
+#endif
+
+#endif // FL_QUARTZ_DISPLAY_DEVICE_H
+
+//
+// End of "$Id$".
+//