summaryrefslogtreecommitdiff
path: root/src/drivers/GDI
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/GDI')
-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
6 files changed, 32 insertions, 7 deletions
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 {