summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-03-26 14:36:11 +0000
committerManolo Gouy <Manolo>2016-03-26 14:36:11 +0000
commit915d6c643a8b4e31ea79fdad81761d26b42530f5 (patch)
tree8756c72f988596beb8e55382f40ff04142816057 /src
parente86e4a6ab0e3ad8ccbb694909383f5d72b9b4c92 (diff)
Isolate the definition of the 3 public, OS-dependent types (Fl_Offscreen, Fl_Region, Fl_Bitmask).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11432 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl.cxx1
-rw-r--r--src/Fl_Double_Window.cxx1
-rw-r--r--src/Fl_Graphics_Driver.cxx2
-rw-r--r--src/Fl_Input.cxx1
-rw-r--r--src/Fl_Menu_Window.cxx1
-rw-r--r--src/Fl_Overlay_Window.cxx1
-rw-r--r--src/Fl_Pixmap.cxx1
-rw-r--r--src/Fl_Text_Display.cxx1
-rw-r--r--src/Fl_Widget_Surface.cxx1
-rw-r--r--src/Fl_Window.cxx1
-rw-r--r--src/Fl_Window_Driver.cxx1
-rw-r--r--src/Fl_arg.cxx2
-rw-r--r--src/Fl_win32.cxx1
-rw-r--r--src/Fl_x.cxx1
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm1
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx1
-rw-r--r--src/drivers/Darwin/Fl_Darwin_System_Driver.H6
-rw-r--r--src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx1
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver.H7
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx18
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_arci.cxx1
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx4
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_vertex.cxx8
-rw-r--r--src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver.H2
-rw-r--r--src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_vertex.cxx6
-rw-r--r--src/drivers/Posix/Fl_Posix_System_Driver.H6
-rw-r--r--src/drivers/PostScript/Fl_PostScript.cxx1
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.cxx1
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H16
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx1
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver_arci.cxx1
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx1
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver_line_style.cxx1
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx1
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver_vertex.cxx25
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_System_Driver.H7
-rw-r--r--src/drivers/X11/Fl_X11_Window_Driver.cxx1
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx1
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H7
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx19
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver_arci.cxx1
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver_vertex.cxx16
-rw-r--r--src/fl_cursor.cxx1
-rw-r--r--src/fl_draw_pixmap.cxx1
-rw-r--r--src/fl_font.cxx1
-rw-r--r--src/fl_read_image.cxx1
-rw-r--r--src/fl_rect.cxx1
-rw-r--r--src/fl_scroll_area.cxx1
-rw-r--r--src/fl_set_font.cxx1
-rw-r--r--src/fl_shortcut.cxx1
-rw-r--r--src/fl_vertex.cxx16
51 files changed, 148 insertions, 53 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx
index b47a90bcd..a3f2d2be8 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -30,6 +30,7 @@
#endif
#include <FL/Fl.H>
+#include <FL/x.H>
#include <FL/Fl_Screen_Driver.H>
#include <FL/Fl_Window_Driver.H>
#include <FL/Fl_Window.H>
diff --git a/src/Fl_Double_Window.cxx b/src/Fl_Double_Window.cxx
index 736adba20..00aca01ee 100644
--- a/src/Fl_Double_Window.cxx
+++ b/src/Fl_Double_Window.cxx
@@ -20,6 +20,7 @@
*/
#include <FL/Fl.H>
+#include <FL/x.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Printer.H>
#include <FL/fl_draw.H>
diff --git a/src/Fl_Graphics_Driver.cxx b/src/Fl_Graphics_Driver.cxx
index 83c6eccf4..fbe0d7712 100644
--- a/src/Fl_Graphics_Driver.cxx
+++ b/src/Fl_Graphics_Driver.cxx
@@ -34,9 +34,7 @@ Fl_Graphics_Driver::Fl_Graphics_Driver() {
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)
diff --git a/src/Fl_Input.cxx b/src/Fl_Input.cxx
index e26c30dd2..cf9bcb4a7 100644
--- a/src/Fl_Input.cxx
+++ b/src/Fl_Input.cxx
@@ -32,6 +32,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <FL/Fl.H>
+#include <FL/x.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Input.H>
#include <FL/fl_draw.H>
diff --git a/src/Fl_Menu_Window.cxx b/src/Fl_Menu_Window.cxx
index 56afb1020..4a2bb1709 100644
--- a/src/Fl_Menu_Window.cxx
+++ b/src/Fl_Menu_Window.cxx
@@ -31,6 +31,7 @@
// WIN32 note: HAVE_OVERLAY is false
#if HAVE_OVERLAY
+#include <FL/x.H>
extern XVisualInfo *fl_find_overlay_visual();
extern XVisualInfo *fl_overlay_visual;
extern Colormap fl_overlay_colormap;
diff --git a/src/Fl_Overlay_Window.cxx b/src/Fl_Overlay_Window.cxx
index 4a7195889..464ed1fb3 100644
--- a/src/Fl_Overlay_Window.cxx
+++ b/src/Fl_Overlay_Window.cxx
@@ -87,6 +87,7 @@ void Fl_Overlay_Window::redraw_overlay() {
}
#else
+#include <FL/x.H>
extern XVisualInfo *fl_find_overlay_visual();
extern XVisualInfo *fl_overlay_visual;
diff --git a/src/Fl_Pixmap.cxx b/src/Fl_Pixmap.cxx
index 70222fae2..1b17aa9f4 100644
--- a/src/Fl_Pixmap.cxx
+++ b/src/Fl_Pixmap.cxx
@@ -24,6 +24,7 @@
// it interferes with the color cube used by fl_draw_image).
#include <FL/Fl.H>
+#include <FL/x.H>
#include <FL/fl_draw.H>
#include <FL/Fl_Widget.H>
#include <FL/Fl_Menu_Item.H>
diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx
index b696b0d3d..cae7aedfd 100644
--- a/src/Fl_Text_Display.cxx
+++ b/src/Fl_Text_Display.cxx
@@ -27,6 +27,7 @@
#include <ctype.h>
#include <string.h> // strdup()
#include <FL/Fl.H>
+#include <FL/x.H>
#include <FL/Fl_Text_Buffer.H>
#include <FL/Fl_Text_Display.H>
#include <FL/Fl_Window.H>
diff --git a/src/Fl_Widget_Surface.cxx b/src/Fl_Widget_Surface.cxx
index e7c783dc5..6b8fbffee 100644
--- a/src/Fl_Widget_Surface.cxx
+++ b/src/Fl_Widget_Surface.cxx
@@ -19,6 +19,7 @@
#include <FL/Fl_Widget_Surface.H>
#include <FL/fl_draw.H>
#include <FL/Fl.H>
+#include <FL/x.H>
#include <FL/Fl_Shared_Image.H>
#include <FL/Fl_Window_Driver.H>
diff --git a/src/Fl_Window.cxx b/src/Fl_Window.cxx
index ef9669973..ae7024533 100644
--- a/src/Fl_Window.cxx
+++ b/src/Fl_Window.cxx
@@ -21,6 +21,7 @@
// crap you need to do to communicate with X is in Fl_x.cxx, the
// equivalent (but totally different) crap for MSWindows is in Fl_win32.cxx
#include <FL/Fl.H>
+#include <FL/x.H>
#include <FL/Fl_Window_Driver.H>
#include <FL/Fl_RGB_Image.H>
#include <FL/Fl_Window.H>
diff --git a/src/Fl_Window_Driver.cxx b/src/Fl_Window_Driver.cxx
index 795031824..517178ff0 100644
--- a/src/Fl_Window_Driver.cxx
+++ b/src/Fl_Window_Driver.cxx
@@ -22,6 +22,7 @@
#include <FL/Fl_Window_Driver.H>
#include <FL/fl_draw.H>
#include <FL/Fl.H>
+#include <FL/x.H>
extern void fl_throw_focus(Fl_Widget *o);
diff --git a/src/Fl_arg.cxx b/src/Fl_arg.cxx
index 8f92e3fed..8d56ac22e 100644
--- a/src/Fl_arg.cxx
+++ b/src/Fl_arg.cxx
@@ -20,8 +20,10 @@
// You do not need to call this! Feel free to make up your own switches.
#include <FL/Fl.H>
+#include <FL/x.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Window_Driver.H>
+#include <FL/Fl_Graphics_Driver.H>
#include <FL/Fl_Tooltip.H>
#include <FL/filename.H>
#include <FL/fl_draw.H>
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index b896cda08..d9edce48f 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -49,6 +49,7 @@ void fl_release_dc(HWND,HDC);
void fl_cleanup_dc_list(void);
#include <FL/Fl.H>
+#include <FL/x.H>
#include <FL/Fl_Window_Driver.H>
#include <FL/Fl_Graphics_Driver.H> // for fl_graphics_driver
#include "drivers/WinAPI/Fl_WinAPI_Window_Driver.H"
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index aa8dc4b33..0822202bc 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -24,6 +24,7 @@
# include <config.h>
# include <FL/Fl.H>
+# include <FL/x.H>
# include <FL/Fl_Window_Driver.H>
# include <FL/Fl_Window.H>
# include <FL/fl_utf8.h>
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm b/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm
index 525e545c0..188828da4 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm
+++ b/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm
@@ -22,6 +22,7 @@
#include "../Quartz/Fl_Quartz_Printer_Graphics_Driver.H"
#include <FL/Fl.H>
+#include <FL/x.H>
#include <FL/fl_ask.H>
#include <FL/fl_draw.H>
#import <Cocoa/Cocoa.h>
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx
index f3fba0131..22a819dcb 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx
+++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx
@@ -23,6 +23,7 @@
#include <FL/Fl_Overlay_Window.H>
#include <FL/fl_draw.H>
#include <FL/Fl.H>
+#include <FL/x.H>
Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *w)
diff --git a/src/drivers/Darwin/Fl_Darwin_System_Driver.H b/src/drivers/Darwin/Fl_Darwin_System_Driver.H
index 370a06316..05bd41e9f 100644
--- a/src/drivers/Darwin/Fl_Darwin_System_Driver.H
+++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.H
@@ -27,10 +27,14 @@
#include <FL/Fl_System_Driver.H>
+typedef struct CGContext* Fl_Offscreen;
+typedef struct CGImage* Fl_Bitmask;
+typedef struct flCocoaRegion* Fl_Region;
+
/*
Move everything here that manages the system interface.
- There is excatly one system driver.
+ There is exactly one system driver.
- filename and pathname management
- directory and file access
diff --git a/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx b/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx
index 1f6149052..c7f3d401a 100644
--- a/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx
+++ b/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx
@@ -20,6 +20,7 @@
#ifdef FL_CFG_GFX_GDI
#include <FL/Fl_Copy_Surface.H>
+#include <FL/x.H>
#include "Fl_GDI_Graphics_Driver.H"
#include <windows.h>
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H
index a25274e08..4d4a50bd1 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H
@@ -42,8 +42,11 @@ protected:
uchar **mask_bitmap_;
uchar **mask_bitmap() {return mask_bitmap_;}
void mask_bitmap(uchar **value) { mask_bitmap_ = value; }
+ int p_size;
+ POINT *p;
public:
- Fl_GDI_Graphics_Driver() {mask_bitmap_ = NULL;}
+ Fl_GDI_Graphics_Driver() {mask_bitmap_ = NULL; gc_ = NULL; p_size = 0; p = NULL;}
+ virtual ~Fl_GDI_Graphics_Driver() { if (p) free(p); }
virtual int has_feature(driver_feature mask) { return mask & NATIVE; }
char can_do_alpha_blending();
virtual void gc(void *ctxt) {if (ctxt != gc_) global_gc(); gc_ = (HDC)ctxt;}
@@ -76,6 +79,8 @@ public:
#endif
void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
protected:
+ void transformed_vertex0(int x, int y);
+ void fixloop();
// --- implementation is in src/fl_rect.cxx which includes src/cfg_gfx/gdi_rect.cxx
void point(int x, int y);
void rect(int x, int y, int w, int h);
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
index 15defb9eb..4af0b129f 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
@@ -21,6 +21,7 @@
#include "../../config_lib.h"
#include "Fl_GDI_Graphics_Driver.H"
#include <FL/Fl.H>
+#include <FL/x.H>
/* Reference to the current device context
@@ -150,6 +151,23 @@ void Fl_Graphics_Driver::add_rectangle_to_region(Fl_Region r, int X, int Y, int
XDestroyRegion(R);
}
+void Fl_GDI_Graphics_Driver::transformed_vertex0(int x, int y) {
+ if (!n || x != p[n-1].x || y != p[n-1].y) {
+ if (n >= p_size) {
+ p_size = p ? 2*p_size : 16;
+ p = (POINT*)realloc((void*)p, p_size*sizeof(*p));
+ }
+ p[n].x = x;
+ p[n].y = y;
+ n++;
+ }
+}
+
+void Fl_GDI_Graphics_Driver::fixloop() { // remove equal points from closed path
+ while (n>2 && p[n-1].x == p[0].x && p[n-1].y == p[0].y) n--;
+}
+
+
//
// End of "$Id$".
//
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_arci.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_arci.cxx
index 23aa0c542..83f7fbeda 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_arci.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_arci.cxx
@@ -33,6 +33,7 @@
#include "Fl_GDI_Graphics_Driver.H"
#include <FL/math.h>
+#include <FL/x.h>
void Fl_GDI_Graphics_Driver::arc(int x,int y,int w,int h,double a1,double a2) {
if (w <= 0 || h <= 0) return;
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx
index fdff2fe1b..3ef206488 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx
@@ -140,7 +140,7 @@ void Fl_GDI_Graphics_Driver::loop(int x, int y, int x1, int y1, int x2, int y2,
}
void Fl_GDI_Graphics_Driver::polygon(int x, int y, int x1, int y1, int x2, int y2) {
- XPoint p[3];
+ POINT p[3];
p[0].x = x; p[0].y = y;
p[1].x = x1; p[1].y = y1;
p[2].x = x2; p[2].y = y2;
@@ -149,7 +149,7 @@ void Fl_GDI_Graphics_Driver::polygon(int x, int y, int x1, int y1, int x2, int y
}
void Fl_GDI_Graphics_Driver::polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
- XPoint p[4];
+ POINT p[4];
p[0].x = x; p[0].y = y;
p[1].x = x1; p[1].y = y1;
p[2].x = x2; p[2].y = y2;
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_vertex.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_vertex.cxx
index e5d857f7e..e4ce856b1 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_vertex.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_vertex.cxx
@@ -33,11 +33,11 @@
void Fl_GDI_Graphics_Driver::transformed_vertex(double xf, double yf) {
- transformed_vertex0(COORD_T(rint(xf)), COORD_T(rint(yf)));
+ transformed_vertex0(int(rint(xf)), int(rint(yf)));
}
void Fl_GDI_Graphics_Driver::vertex(double x,double y) {
- transformed_vertex0(COORD_T(x*m.a + y*m.c + m.x), COORD_T(x*m.b + y*m.d + m.y));
+ transformed_vertex0(int(x*m.a + y*m.c + m.x), int(x*m.b + y*m.d + m.y));
}
void Fl_GDI_Graphics_Driver::end_points() {
@@ -54,7 +54,7 @@ void Fl_GDI_Graphics_Driver::end_line() {
void Fl_GDI_Graphics_Driver::end_loop() {
fixloop();
- if (n>2) transformed_vertex((COORD_T)p[0].x, (COORD_T)p[0].y);
+ if (n>2) transformed_vertex((int)p[0].x, (int)p[0].y);
end_line();
}
@@ -79,7 +79,7 @@ void Fl_GDI_Graphics_Driver::begin_complex_polygon() {
void Fl_GDI_Graphics_Driver::gap() {
while (n>gap_+2 && p[n-1].x == p[gap_].x && p[n-1].y == p[gap_].y) n--;
if (n > gap_+2) {
- transformed_vertex((COORD_T)p[gap_].x, (COORD_T)p[gap_].y);
+ transformed_vertex((int)p[gap_].x, (int)p[gap_].y);
counts[numcount++] = n-gap_;
gap_ = n;
} else {
diff --git a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver.H b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver.H
index 23986e848..775253178 100644
--- a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver.H
+++ b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver.H
@@ -56,7 +56,7 @@ public:
void pop_clip();
void restore_clip();
// --- implementation is in src/fl_vertex.cxx which includes src/cfg_gfx/xxx_rect.cxx
- void transformed_vertex0(COORD_T x, COORD_T y);
+ //void transformed_vertex0(double x, double y);
void transformed_vertex(double xf, double yf);
void vertex(double x, double y);
void begin_points();
diff --git a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_vertex.cxx b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_vertex.cxx
index bb6b03dcf..cbbb68f14 100644
--- a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_vertex.cxx
+++ b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_vertex.cxx
@@ -99,12 +99,8 @@ void Fl_OpenGL_Graphics_Driver::transformed_vertex(double xf, double yf) {
glVertex2d(xf, yf);
}
-void Fl_OpenGL_Graphics_Driver::transformed_vertex0(COORD_T x, COORD_T y) {
- glVertex2d(x, y);
-}
-
void Fl_OpenGL_Graphics_Driver::vertex(double x,double y) {
- transformed_vertex0(x*m.a + y*m.c + m.x, x*m.b + y*m.d + m.y);
+ transformed_vertex(x*m.a + y*m.c + m.x, x*m.b + y*m.d + m.y);
}
void Fl_OpenGL_Graphics_Driver::circle(double cx, double cy, double r) {
diff --git a/src/drivers/Posix/Fl_Posix_System_Driver.H b/src/drivers/Posix/Fl_Posix_System_Driver.H
index bf4fb6c92..3df22092c 100644
--- a/src/drivers/Posix/Fl_Posix_System_Driver.H
+++ b/src/drivers/Posix/Fl_Posix_System_Driver.H
@@ -27,10 +27,14 @@
#include <FL/Fl_System_Driver.H>
+typedef unsigned long Fl_Offscreen;
+typedef unsigned long Fl_Bitmask;
+typedef struct _XRegion *Fl_Region;
+
/*
Move everything here that manages the system interface.
- There is excatly one system driver.
+ There is exactly one system driver.
- filename and pathname management
- directory and file access
diff --git a/src/drivers/PostScript/Fl_PostScript.cxx b/src/drivers/PostScript/Fl_PostScript.cxx
index 7de93e48c..35eb6f77a 100644
--- a/src/drivers/PostScript/Fl_PostScript.cxx
+++ b/src/drivers/PostScript/Fl_PostScript.cxx
@@ -18,6 +18,7 @@
#include <config.h>
#include <FL/Fl.H>
+#include <FL/x.H>
#include <FL/fl_ask.H>
#include <FL/fl_draw.H>
#include <stdio.h>
diff --git a/src/drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.cxx b/src/drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.cxx
index 8488d5b8e..da400e5d3 100644
--- a/src/drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.cxx
@@ -20,6 +20,7 @@
#ifdef FL_CFG_GFX_QUARTZ
#include <FL/Fl_Copy_Surface.H>
+#include <FL/x.H>
#include "Fl_Quartz_Graphics_Driver.H"
class Fl_Quartz_Copy_Surface_Driver : public Fl_Copy_Surface_Driver {
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H
index 94bbf000c..7530c331f 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H
@@ -26,12 +26,7 @@
#define FL_QUARTZ_GRAPHICS_DRIVER_H
#include <FL/Fl_Graphics_Driver.H>
-
-// typedef what the x,y fields in a point are:
-// FIXME: this is still defined in Fl_Device.H, but should be invisible to the user
-//typedef float COORD_T;
-//typedef struct { float x; float y; } QPoint;
-
+#include <ApplicationServices/ApplicationServices.h>
/**
\brief The Mac OS X-specific graphics class.
@@ -41,7 +36,12 @@
class Fl_Quartz_Graphics_Driver : public Fl_Graphics_Driver {
protected:
CGContextRef gc_;
+ int p_size;
+ typedef struct { float x; float y; } XPOINT;
+ XPOINT *p;
public:
+ Fl_Quartz_Graphics_Driver() : Fl_Graphics_Driver(), gc_(NULL), p_size(0), p(NULL) {}
+ virtual ~Fl_Quartz_Graphics_Driver() { if (p) free(p); }
virtual int has_feature(driver_feature mask) { return mask & NATIVE; }
virtual void gc(void *ctxt) {if (ctxt != gc_) global_gc(); gc_ = (CGContextRef)ctxt; }
virtual void *gc() {return gc_;}
@@ -64,6 +64,8 @@ public:
void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
void draw_CGImage(CGImageRef cgimg, int x, int y, int w, int h, int srcx, int srcy, int sw, int sh);
protected:
+ void transformed_vertex0(float x, float y);
+ void fixloop();
// --- implementation is in src/fl_rect.cxx which includes src/cfg_gfx/quartz_rect.cxx
void point(int x, int y);
void rect(int x, int y, int w, int h);
@@ -122,6 +124,8 @@ protected:
int descent();
};
+extern float fl_quartz_line_width_;
+
#endif // FL_QUARTZ_GRAPHICS_DRIVER_H
//
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx
index 6fdc3461e..a829534d3 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx
@@ -19,6 +19,7 @@
#include "../../config_lib.h"
#include "Fl_Quartz_Graphics_Driver.H"
+#include <FL/x.H>
/* Reference to the current CGContext
For back-compatibility only. The preferred procedure to get this reference is
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_arci.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_arci.cxx
index d0f63fcee..7dc6d7268 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_arci.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_arci.cxx
@@ -20,6 +20,7 @@
#ifdef FL_CFG_GFX_QUARTZ
#include "Fl_Quartz_Graphics_Driver.h"
+#include <FL/x.H>
/**
\file quartz_arci.cxx
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx
index 7e0b22dec..8840d4a4f 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx
@@ -22,6 +22,7 @@
#include "Fl_Quartz_Graphics_Driver.h"
#include <math.h>
#include <FL/Fl.H>
+#include <FL/x.H>
#include <FL/fl_utf8.h>
Fl_Fontdesc* fl_fonts = NULL;
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_line_style.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_line_style.cxx
index 134f6b2be..a9583474b 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_line_style.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_line_style.cxx
@@ -20,6 +20,7 @@
#ifdef FL_CFG_GFX_QUARTZ
#include <FL/fl_draw.H>
+#include <FL/x.H>
extern int fl_line_width_;
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx
index 277abfdfb..41c4c5cdd 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx
@@ -21,6 +21,7 @@
#ifdef FL_CFG_GFX_QUARTZ
#include <FL/Fl.H>
+#include <FL/x.H>
/**
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_vertex.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_vertex.cxx
index 1ff8755e8..0de553c87 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_vertex.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_vertex.cxx
@@ -33,11 +33,11 @@
void Fl_Quartz_Graphics_Driver::transformed_vertex(double xf, double yf) {
- transformed_vertex0(COORD_T(xf), COORD_T(yf));
+ transformed_vertex0(float(xf), float(yf));
}
void Fl_Quartz_Graphics_Driver::vertex(double x,double y) {
- transformed_vertex0(COORD_T(x*m.a + y*m.c + m.x), COORD_T(x*m.b + y*m.d + m.y));
+ transformed_vertex0(float(x*m.a + y*m.c + m.x), float(x*m.b + y*m.d + m.y));
}
void Fl_Quartz_Graphics_Driver::end_points() {
@@ -66,7 +66,7 @@ void Fl_Quartz_Graphics_Driver::end_line() {
void Fl_Quartz_Graphics_Driver::end_loop() {
fixloop();
- if (n>2) transformed_vertex((COORD_T)p[0].x, (COORD_T)p[0].y);
+ if (n>2) transformed_vertex((float)p[0].x, (float)p[0].y);
end_line();
}
@@ -94,7 +94,7 @@ void Fl_Quartz_Graphics_Driver::begin_complex_polygon() {
void Fl_Quartz_Graphics_Driver::gap() {
while (n>gap_+2 && p[n-1].x == p[gap_].x && p[n-1].y == p[gap_].y) n--;
if (n > gap_+2) {
- transformed_vertex((COORD_T)p[gap_].x, (COORD_T)p[gap_].y);
+ transformed_vertex((float)p[gap_].x, (float)p[gap_].y);
gap_ = n;
} else {
n = gap_;
@@ -135,6 +135,23 @@ void Fl_Quartz_Graphics_Driver::circle(double x, double y,double r) {
CGContextSetShouldAntialias(gc_, false);
}
+void Fl_Quartz_Graphics_Driver::transformed_vertex0(float x, float y) {
+ if (!n || x != p[n-1].x || y != p[n-1].y) {
+ if (n >= p_size) {
+ p_size = p ? 2*p_size : 16;
+ p = (XPOINT*)realloc((void*)p, p_size*sizeof(*p));
+ }
+ p[n].x = x;
+ p[n].y = y;
+ n++;
+ }
+}
+
+void Fl_Quartz_Graphics_Driver::fixloop() { // remove equal points from closed path
+ while (n>2 && p[n-1].x == p[0].x && p[n-1].y == p[0].y) n--;
+}
+
+
#endif // FL_CFG_GFX_QUARTZ
//
diff --git a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H
index accc6d29b..691f3c507 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H
+++ b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H
@@ -27,10 +27,15 @@
#include <FL/Fl_System_Driver.H>
+typedef struct HBITMAP__ *HBITMAP;
+typedef HBITMAP Fl_Offscreen;
+typedef HBITMAP Fl_Bitmask;
+typedef struct HRGN__ *Fl_Region;
+
/*
Move everything here that manages the system interface.
- There is excatly one system driver.
+ There is exactly one system driver.
- filename and pathname management
- directory and file access
diff --git a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx
index cad3f3c4b..79939410a 100644
--- a/src/drivers/X11/Fl_X11_Window_Driver.cxx
+++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx
@@ -28,6 +28,7 @@
#include <FL/fl_draw.H>
#include <FL/fl_ask.H>
#include <FL/Fl.H>
+#include <FL/x.H>
#include <string.h>
#if HAVE_DLFCN_H
#include <dlfcn.h>
diff --git a/src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx b/src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx
index 8615fbb8b..3cb07dbd5 100644
--- a/src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx
@@ -21,6 +21,7 @@
#ifdef FL_CFG_GFX_XLIB
#include <FL/Fl_Copy_Surface.H>
#include <FL/Fl.H>
+#include <FL/x.H>
#include <FL/fl_draw.H>
#include "Fl_Translated_Xlib_Graphics_Driver.H"
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H
index d9f0d7135..4d4a1ab30 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H
@@ -26,6 +26,7 @@
#define FL_CFG_GFX_XLIB_H
#include <FL/Fl_Graphics_Driver.H>
+#include <FL/x.H>
/**
\brief The Xlib-specific graphics class.
@@ -38,8 +39,12 @@ protected:
uchar **mask_bitmap_;
uchar **mask_bitmap() {return mask_bitmap_;}
void mask_bitmap(uchar **value) { mask_bitmap_ = value; }
+ int p_size;
+ typedef struct {short x, y;} XPOINT;
+ XPOINT *p;
public:
Fl_Xlib_Graphics_Driver(void);
+ virtual ~Fl_Xlib_Graphics_Driver() { if (p) free(p); }
virtual int has_feature(driver_feature mask) { return mask & NATIVE; }
virtual void *gc() { return gc_; }
virtual void gc(void *value);
@@ -75,6 +80,8 @@ public:
void copy_offscreen_with_alpha(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
#endif
protected:
+ void transformed_vertex0(short x, short y);
+ void fixloop();
// --- implementation is in src/fl_rect.cxx which includes src/cfg_gfx/xlib_rect.cxx
void point(int x, int y);
void rect(int x, int y, int w, int h);
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx
index 967712490..aa82393fe 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx
@@ -20,6 +20,7 @@
#include "../../config_lib.h"
#include "Fl_Xlib_Graphics_Driver.H"
#include <FL/fl_draw.H>
+#include <FL/x.H>
#include <string.h>
@@ -51,6 +52,8 @@ GC Fl_Xlib_Graphics_Driver::gc_ = NULL;
Fl_Xlib_Graphics_Driver::Fl_Xlib_Graphics_Driver(void) {
mask_bitmap_ = NULL;
+ p_size = 0;
+ p = NULL;
}
void Fl_Xlib_Graphics_Driver::gc(void *value) {
@@ -105,6 +108,22 @@ void Fl_Graphics_Driver::add_rectangle_to_region(Fl_Region r, int X, int Y, int
XUnionRectWithRegion(&R, r, r);
}
+void Fl_Xlib_Graphics_Driver::transformed_vertex0(short x, short y) {
+ if (!n || x != p[n-1].x || y != p[n-1].y) {
+ if (n >= p_size) {
+ p_size = p ? 2*p_size : 16;
+ p = (XPOINT*)realloc((void*)p, p_size*sizeof(*p));
+ }
+ p[n].x = x;
+ p[n].y = y;
+ n++;
+ }
+}
+
+void Fl_Xlib_Graphics_Driver::fixloop() { // remove equal points from closed path
+ while (n>2 && p[n-1].x == p[0].x && p[n-1].y == p[0].y) n--;
+}
+
//
// End of "$Id$".
//
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_arci.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_arci.cxx
index a47e605b6..fcad6fd5f 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_arci.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_arci.cxx
@@ -19,6 +19,7 @@
#include <config.h>
#include "Fl_Xlib_Graphics_Driver.H"
#include <FL/fl_draw.H>
+#include <FL/x.H>
/**
\file Fl_Xlib_Graphics_Driver_arci.cxx
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_vertex.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_vertex.cxx
index 99f1da627..05c58eb8d 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_vertex.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_vertex.cxx
@@ -31,15 +31,15 @@
void Fl_Xlib_Graphics_Driver::transformed_vertex(double xf, double yf) {
- transformed_vertex0(COORD_T(rint(xf)), COORD_T(rint(yf)));
+ transformed_vertex0(short(rint(xf)), short(rint(yf)));
}
void Fl_Xlib_Graphics_Driver::vertex(double x,double y) {
- transformed_vertex0(COORD_T(x*m.a + y*m.c + m.x), COORD_T(x*m.b + y*m.d + m.y));
+ transformed_vertex0(short(x*m.a + y*m.c + m.x), short(x*m.b + y*m.d + m.y));
}
void Fl_Xlib_Graphics_Driver::end_points() {
- if (n>1) XDrawPoints(fl_display, fl_window, gc_, p, n, 0);
+ if (n>1) XDrawPoints(fl_display, fl_window, gc_, (XPoint*)p, n, 0);
}
void Fl_Xlib_Graphics_Driver::end_line() {
@@ -47,12 +47,12 @@ void Fl_Xlib_Graphics_Driver::end_line() {
end_points();
return;
}
- if (n>1) XDrawLines(fl_display, fl_window, gc_, p, n, 0);
+ if (n>1) XDrawLines(fl_display, fl_window, gc_, (XPoint*)p, n, 0);
}
void Fl_Xlib_Graphics_Driver::end_loop() {
fixloop();
- if (n>2) transformed_vertex((COORD_T)p[0].x, (COORD_T)p[0].y);
+ if (n>2) transformed_vertex((short)p[0].x, (short)p[0].y);
end_line();
}
@@ -62,7 +62,7 @@ void Fl_Xlib_Graphics_Driver::end_polygon() {
end_line();
return;
}
- if (n>2) XFillPolygon(fl_display, fl_window, gc_, p, n, Convex, 0);
+ if (n>2) XFillPolygon(fl_display, fl_window, gc_, (XPoint*)p, n, Convex, 0);
}
void Fl_Xlib_Graphics_Driver::begin_complex_polygon() {
@@ -73,7 +73,7 @@ void Fl_Xlib_Graphics_Driver::begin_complex_polygon() {
void Fl_Xlib_Graphics_Driver::gap() {
while (n>gap_+2 && p[n-1].x == p[gap_].x && p[n-1].y == p[gap_].y) n--;
if (n > gap_+2) {
- transformed_vertex((COORD_T)p[gap_].x, (COORD_T)p[gap_].y);
+ transformed_vertex((short)p[gap_].x, (short)p[gap_].y);
gap_ = n;
} else {
n = gap_;
@@ -86,7 +86,7 @@ void Fl_Xlib_Graphics_Driver::end_complex_polygon() {
end_line();
return;
}
- if (n>2) XFillPolygon(fl_display, fl_window, gc_, p, n, 0, 0);
+ if (n>2) XFillPolygon(fl_display, fl_window, gc_, (XPoint*)p, n, 0, 0);
}
// shortcut the closed circles so they use XDrawArc:
diff --git a/src/fl_cursor.cxx b/src/fl_cursor.cxx
index 22e207a56..9b9c9b9e2 100644
--- a/src/fl_cursor.cxx
+++ b/src/fl_cursor.cxx
@@ -23,6 +23,7 @@
// portable to other systems.
#include <FL/Fl.H>
+#include <FL/x.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Pixmap.H>
#include <FL/Fl_RGB_Image.H>
diff --git a/src/fl_draw_pixmap.cxx b/src/fl_draw_pixmap.cxx
index e37e6cb14..c6083c2d7 100644
--- a/src/fl_draw_pixmap.cxx
+++ b/src/fl_draw_pixmap.cxx
@@ -33,6 +33,7 @@
// transparency added, color cube not required, etc. -erco Oct 20 2013
#include <FL/Fl.H>
+#include <FL/x.H>
#include <FL/fl_draw.H>
#include <stdio.h>
#include "flstring.h"
diff --git a/src/fl_font.cxx b/src/fl_font.cxx
index 6e9f0c4d2..c6ae5ec77 100644
--- a/src/fl_font.cxx
+++ b/src/fl_font.cxx
@@ -20,6 +20,7 @@
// Select fonts from the FLTK font table.
#include "flstring.h"
#include <FL/Fl.H>
+#include <FL/x.H>
#include <FL/fl_draw.H>
#include "Fl_Font.H"
diff --git a/src/fl_read_image.cxx b/src/fl_read_image.cxx
index 5f91d0e19..114704f85 100644
--- a/src/fl_read_image.cxx
+++ b/src/fl_read_image.cxx
@@ -17,6 +17,7 @@
//
#include <FL/Fl.H>
+#include <FL/x.H>
#include <FL/fl_draw.H>
#include "flstring.h"
diff --git a/src/fl_rect.cxx b/src/fl_rect.cxx
index ba5aedbea..d8709d8e0 100644
--- a/src/fl_rect.cxx
+++ b/src/fl_rect.cxx
@@ -29,6 +29,7 @@
#include <config.h>
#include "config_lib.h"
#include <FL/Fl.H>
+#include <FL/x.H>
#include <FL/Fl_Widget.H>
#include <FL/Fl_Printer.H>
#include <FL/fl_draw.H>
diff --git a/src/fl_scroll_area.cxx b/src/fl_scroll_area.cxx
index ef18685dd..aa63976f7 100644
--- a/src/fl_scroll_area.cxx
+++ b/src/fl_scroll_area.cxx
@@ -22,6 +22,7 @@
#include <config.h>
#include <FL/Fl.H>
+#include <FL/x.H>
#include <FL/fl_draw.H>
#ifdef __APPLE__
#include "drivers/Quartz/Fl_Quartz_Graphics_Driver.h"
diff --git a/src/fl_set_font.cxx b/src/fl_set_font.cxx
index fadc56c13..0c53e75af 100644
--- a/src/fl_set_font.cxx
+++ b/src/fl_set_font.cxx
@@ -20,6 +20,7 @@
// Also see fl_set_fonts.cxx which adds all possible fonts.
#include <FL/Fl.H>
+#include <FL/x.H>
#include <FL/fl_draw.H>
#include "flstring.h"
#include "Fl_Font.H"
diff --git a/src/fl_shortcut.cxx b/src/fl_shortcut.cxx
index 0371f7615..e9ccec528 100644
--- a/src/fl_shortcut.cxx
+++ b/src/fl_shortcut.cxx
@@ -36,7 +36,6 @@
#include <FL/Fl_Widget.H>
#include <FL/Fl_Button.H>
#include <FL/fl_draw.H>
-#include <FL/Fl_System_Driver.H>
#include <stdlib.h>
#include <ctype.h>
#include "flstring.h"
diff --git a/src/fl_vertex.cxx b/src/fl_vertex.cxx
index 2e4313e6a..1a425895c 100644
--- a/src/fl_vertex.cxx
+++ b/src/fl_vertex.cxx
@@ -125,22 +125,6 @@ double Fl_Graphics_Driver::transform_dy(double x, double y) {
return x*m.b + y*m.d;
}
-void Fl_Graphics_Driver::transformed_vertex0(COORD_T x, COORD_T y) {
- if (!n || x != p[n-1].x || y != p[n-1].y) {
- if (n >= p_size) {
- p_size = p ? 2*p_size : 16;
- p = (XPOINT*)realloc((void*)p, p_size*sizeof(*p));
- }
- p[n].x = x;
- p[n].y = y;
- n++;
- }
-}
-
-void Fl_Graphics_Driver::fixloop() { // remove equal points from closed path
- while (n>2 && p[n-1].x == p[0].x && p[n-1].y == p[0].y) n--;
-}
-
//
// End of "$Id$".
//