summaryrefslogtreecommitdiff
path: root/src/drivers/Quartz
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2021-03-01 15:10:52 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2021-03-01 15:11:00 +0100
commit0623a8d4b9e8a56cc435dc550c6b56fa1a9607e9 (patch)
tree48e6487325011a59b6016d0c43d2c1f78a6f1612 /src/drivers/Quartz
parent37175d17571e075324fb5cb3c651e45b236cd6e5 (diff)
Remove duplicated code between derived classes of Fl_Graphics_Driver.
Diffstat (limited to 'src/drivers/Quartz')
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H14
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx2
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver_vertex.cxx20
3 files changed, 1 insertions, 35 deletions
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H
index d9051ecbd..388fefd0f 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H
@@ -50,9 +50,6 @@ class Fl_Quartz_Graphics_Driver : public Fl_Graphics_Driver {
friend class Fl_Quartz_Font_Descriptor;
protected:
CGContextRef gc_;
- int p_size;
- typedef struct { float x; float y; } XPOINT;
- XPOINT *p;
bool high_resolution_;
float quartz_line_width_;
CGLineCap quartz_line_cap_;
@@ -90,9 +87,7 @@ public:
void XDestroyRegion(Fl_Region r);
void high_resolution(bool b) { high_resolution_ = b; }
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);
void focus_rect(int x, int y, int w, int h);
@@ -114,10 +109,7 @@ protected:
int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H);
int not_clipped(int x, int y, int w, int h);
void restore_clip();
- // --- implementation is in src/fl_vertex.cxx which includes src/cfg_gfx/xxx_rect.cxx
void begin_complex_polygon();
- void transformed_vertex(double xf, double yf);
- void vertex(double x, double y);
void end_points();
void end_line();
void end_loop();
@@ -125,19 +117,13 @@ protected:
void end_complex_polygon();
void gap();
void circle(double x, double y, double r);
- // --- implementation is in src/fl_arc.cxx which includes src/cfg_gfx/xxx_arc.cxx if needed
- // using void Fl_Graphics_Driver::arc(double x, double y, double r, double start, double end);
- // --- implementation is in src/fl_arci.cxx which includes src/cfg_gfx/xxx_arci.cxx
void arc(int x, int y, int w, int h, double a1, double a2);
void pie(int x, int y, int w, int h, double a1, double a2);
- // --- implementation is in src/fl_line_style.cxx which includes src/cfg_gfx/xxx_line_style.cxx
void line_style(int style, int width=0, char* dashes=0);
- // --- implementation is in src/fl_color.cxx which includes src/cfg_gfx/xxx_color.cxx
void color(Fl_Color c);
void set_color(Fl_Color i, unsigned int c);
Fl_Color color() { return color_; }
void color(uchar r, uchar g, uchar b);
- // --- implementation is in src/fl_font.cxx which includes src/cfg_gfx/xxx_font.cxx
void draw(const char *str, int n, int x, int y);
void draw(const char *str, int n, float x, float y);
void draw(int angle, const char *str, int n, int x, int y);
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx
index ab95ce510..6dbad2684 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx
@@ -52,7 +52,7 @@ Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver()
return new Fl_Quartz_Graphics_Driver();
}
-Fl_Quartz_Graphics_Driver::Fl_Quartz_Graphics_Driver() : Fl_Graphics_Driver(), gc_(NULL), p_size(0), p(NULL) {
+Fl_Quartz_Graphics_Driver::Fl_Quartz_Graphics_Driver() : Fl_Graphics_Driver(), gc_(NULL) {
quartz_line_width_ = 1.f;
quartz_line_cap_ = kCGLineCapButt;
quartz_line_join_ = kCGLineJoinMiter;
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_vertex.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_vertex.cxx
index 3b0b3f058..952c65b3d 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_vertex.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_vertex.cxx
@@ -27,14 +27,6 @@
#include <FL/math.h>
-void Fl_Quartz_Graphics_Driver::transformed_vertex(double xf, double yf) {
- transformed_vertex0(float(xf), float(yf));
-}
-
-void Fl_Quartz_Graphics_Driver::vertex(double x,double 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() {
if (quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(gc_, true);
for (int i=0; i<n; i++) {
@@ -130,18 +122,6 @@ 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--;
}