summaryrefslogtreecommitdiff
path: root/src/drivers/Quartz
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/Quartz')
-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
8 files changed, 37 insertions, 10 deletions
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
//