|
commit 1df79078b7992010f8cde6b8915408ac9f6305a2
Author: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Mon Oct 10 16:58:48 2022 +0200
Commit: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Mon Oct 10 16:58:48 2022 +0200
Remove duplications between Fl_Graphics_Driver and derived classes.
FL/Fl_Graphics_Driver.H | 3 +--
src/Fl_Graphics_Driver.cxx | 1 +
src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H | 2 --
src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx | 28 +++++++++++-----------
src/drivers/PostScript/Fl_PostScript.cxx | 26 ++++++++++----------
.../PostScript/Fl_PostScript_Graphics_Driver.H | 2 --
src/fl_vertex.cxx | 2 +-
7 files changed, 30 insertions(+), 34 deletions(-)
diff --git FL/Fl_Graphics_Driver.H FL/Fl_Graphics_Driver.H
index eacb03a..5de9835 100644
--- FL/Fl_Graphics_Driver.H
+++ FL/Fl_Graphics_Driver.H
@@ -166,7 +166,7 @@ protected:
matrix m; ///< current transformation matrix
int n; ///< For internal use by FLTK
int gap_; ///< For internal use by FLTK
- int what; ///< For internal use by FLTK
+ enum SHAPE {NONE=0, LINE, LOOP, POLYGON, POINTS} what;
int rstackptr; ///< For internal use by FLTK
static const int region_stack_max = FL_REGION_STACK_SIZE - 1; ///< For internal use by FLTK
Fl_Region rstack[FL_REGION_STACK_SIZE]; ///< For internal use by FLTK
@@ -175,7 +175,6 @@ protected:
typedef struct { float x; float y; } XPOINT;
XPOINT *xpoint;
#ifndef FL_DOXYGEN
- enum {LINE, LOOP, POLYGON, POINT_};
inline int vertex_no() { return n; }
inline int vertex_kind() {return what;}
#endif
diff --git src/Fl_Graphics_Driver.cxx src/Fl_Graphics_Driver.cxx
index 3bec7c2..95f79ee 100644
--- src/Fl_Graphics_Driver.cxx
+++ src/Fl_Graphics_Driver.cxx
@@ -55,6 +55,7 @@ Fl_Graphics_Driver::Fl_Graphics_Driver()
scale_ = 1;
p_size = 0;
xpoint = NULL;
+ what = NONE;
};
/** Destructor */
diff --git src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H
index 1a9d22e..3343345 100644
--- src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H
+++ src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H
@@ -58,7 +58,6 @@ protected:
public:
Fl_Cairo_Graphics_Driver();
virtual ~Fl_Cairo_Graphics_Driver();
- enum SHAPE {NONE=0, LINE, LOOP, POLYGON, POINTS};
class Clip {
public:
@@ -74,7 +73,6 @@ public:
void check_status(void);
- enum SHAPE shape_;
unsigned char cr_,cg_,cb_;
char linedash_[256];//should be enough
void concat(); // transform ror scalable dradings...
diff --git src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx
index 7ac9cee..f2f43d7 100644
--- src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx
+++ src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx
@@ -79,7 +79,7 @@ Fl_Cairo_Graphics_Driver::Fl_Cairo_Graphics_Driver() : Fl_Graphics_Driver() {
angle = 0;
left_margin = top_margin = 0;
needs_commit_tag_ = NULL;
- shape_ = NONE;
+ what = NONE;
}
Fl_Cairo_Graphics_Driver::~Fl_Cairo_Graphics_Driver() {
@@ -393,7 +393,7 @@ void Fl_Cairo_Graphics_Driver::begin_points() {
concat();
cairo_new_path(cairo_);
gap_=1;
- shape_=POINTS;
+ what=POINTS;
}
void Fl_Cairo_Graphics_Driver::begin_line() {
@@ -401,7 +401,7 @@ void Fl_Cairo_Graphics_Driver::begin_line() {
concat();
cairo_new_path(cairo_);
gap_=1;
- shape_=LINE;
+ what=LINE;
}
void Fl_Cairo_Graphics_Driver::begin_loop() {
@@ -409,7 +409,7 @@ void Fl_Cairo_Graphics_Driver::begin_loop() {
concat();
cairo_new_path(cairo_);
gap_=1;
- shape_=LOOP;
+ what=LOOP;
}
void Fl_Cairo_Graphics_Driver::begin_polygon() {
@@ -417,11 +417,11 @@ void Fl_Cairo_Graphics_Driver::begin_polygon() {
concat();
cairo_new_path(cairo_);
gap_=1;
- shape_=POLYGON;
+ what=POLYGON;
}
void Fl_Cairo_Graphics_Driver::vertex(double x, double y) {
- if (shape_==POINTS){
+ if (what==POINTS){
cairo_move_to(cairo_, x, y);
gap_=1;
return;
@@ -437,8 +437,8 @@ void Fl_Cairo_Graphics_Driver::vertex(double x, double y) {
void Fl_Cairo_Graphics_Driver::curve(double x, double y, double x1, double y1, double x2, double y2, double x3, double y3)
{
- if(shape_==NONE) return;
- if (shape_ == POINTS) Fl_Graphics_Driver::curve(x, y, x1, y1, x2, y2, x3, y3);
+ if(what==NONE) return;
+ if (what == POINTS) Fl_Graphics_Driver::curve(x, y, x1, y1, x2, y2, x3, y3);
else {
if(gap_)
cairo_move_to(cairo_, x, y);
@@ -451,7 +451,7 @@ void Fl_Cairo_Graphics_Driver::curve(double x, double y, double x1, double y1, d
}
void Fl_Cairo_Graphics_Driver::circle(double x, double y, double r){
- if (shape_ == NONE) {
+ if (what == NONE) {
cairo_save(cairo_);
concat();
cairo_arc(cairo_, x, y, r, 0, 2*M_PI);
@@ -465,7 +465,7 @@ void Fl_Cairo_Graphics_Driver::circle(double x, double y, double r){
}
void Fl_Cairo_Graphics_Driver::arc(double x, double y, double r, double start, double a){
- if (shape_ == NONE) return;
+ if (what == NONE) return;
gap_ = 0;
if (start > a)
cairo_arc(cairo_, x, y, r, -start*M_PI/180, -a*M_PI/180);
@@ -508,7 +508,7 @@ void Fl_Cairo_Graphics_Driver::end_line() {
reconcat();
cairo_stroke(cairo_);
cairo_restore(cairo_);
- shape_ = NONE;
+ what = NONE;
surface_needs_commit();
}
@@ -518,7 +518,7 @@ void Fl_Cairo_Graphics_Driver::end_loop(){
cairo_close_path(cairo_);
cairo_stroke(cairo_);
cairo_restore(cairo_);
- shape_ = NONE;
+ what = NONE;
surface_needs_commit();
}
@@ -528,12 +528,12 @@ void Fl_Cairo_Graphics_Driver::end_polygon() {
cairo_close_path(cairo_);
cairo_fill(cairo_);
cairo_restore(cairo_);
- shape_ = NONE;
+ what = NONE;
surface_needs_commit();
}
void Fl_Cairo_Graphics_Driver::transformed_vertex(double x, double y) {
- if (shape_ == POINTS) {
+ if (what == POINTS) {
cairo_move_to(cairo_, x, y);
point(x, y);
gap_ = 1;
diff --git src/drivers/PostScript/Fl_PostScript.cxx src/drivers/PostScript/Fl_PostScript.cxx
index 5e09e7f..bd8994c 100644
--- src/drivers/PostScript/Fl_PostScript.cxx
+++ src/drivers/PostScript/Fl_PostScript.cxx
@@ -149,7 +149,7 @@ Fl_PostScript_Graphics_Driver::Fl_PostScript_Graphics_Driver(void)
scale_x = scale_y = 1.;
bg_r = bg_g = bg_b = 255;
clip_ = NULL;
- shape_ = NONE;
+ what = NONE;
}
/** \brief The destructor. */
@@ -1257,7 +1257,7 @@ void Fl_PostScript_Graphics_Driver::begin_points(){
fprintf(output, "BP\n");
gap_=1;
- shape_=POINTS;
+ what=POINTS;
}
void Fl_PostScript_Graphics_Driver::begin_line(){
@@ -1265,7 +1265,7 @@ void Fl_PostScript_Graphics_Driver::begin_line(){
concat();
fprintf(output, "BP\n");
gap_=1;
- shape_=LINE;
+ what=LINE;
}
void Fl_PostScript_Graphics_Driver::begin_loop(){
@@ -1273,7 +1273,7 @@ void Fl_PostScript_Graphics_Driver::begin_loop(){
concat();
fprintf(output, "BP\n");
gap_=1;
- shape_=LOOP;
+ what=LOOP;
}
void Fl_PostScript_Graphics_Driver::begin_polygon(){
@@ -1281,11 +1281,11 @@ void Fl_PostScript_Graphics_Driver::begin_polygon(){
concat();
fprintf(output, "BP\n");
gap_=1;
- shape_=POLYGON;
+ what=POLYGON;
}
void Fl_PostScript_Graphics_Driver::vertex(double x, double y){
- if(shape_==POINTS){
+ if(what==POINTS){
clocale_printf("%g %g MT\n", x , y);
gap_=1;
return;
@@ -1298,7 +1298,7 @@ void Fl_PostScript_Graphics_Driver::vertex(double x, double y){
}
void Fl_PostScript_Graphics_Driver::curve(double x, double y, double x1, double y1, double x2, double y2, double x3, double y3){
- if(shape_==NONE) return;
+ if(what==NONE) return;
if(gap_)
clocale_printf("%g %g MT\n", x , y);
else
@@ -1310,7 +1310,7 @@ void Fl_PostScript_Graphics_Driver::curve(double x, double y, double x1, double
void Fl_PostScript_Graphics_Driver::circle(double x, double y, double r){
- if(shape_==NONE){
+ if(what==NONE){
fprintf(output, "GS\n");
concat();
// fprintf(output, "BP\n");
@@ -1325,7 +1325,7 @@ void Fl_PostScript_Graphics_Driver::circle(double x, double y, double r){
}
void Fl_PostScript_Graphics_Driver::arc(double x, double y, double r, double start, double a){
- if(shape_==NONE) return;
+ if(what==NONE) return;
gap_=0;
if(start>a)
clocale_printf("%g %g %g %g %g arc\n", x , y , r , -start, -a);
@@ -1370,7 +1370,7 @@ void Fl_PostScript_Graphics_Driver::end_points(){
reconcat();
fprintf(output, "ELP\n"); //??
fprintf(output, "GR\n");
- shape_=NONE;
+ what=NONE;
}
void Fl_PostScript_Graphics_Driver::end_line(){
@@ -1378,14 +1378,14 @@ void Fl_PostScript_Graphics_Driver::end_line(){
reconcat();
fprintf(output, "ELP\n");
fprintf(output, "GR\n");
- shape_=NONE;
+ what=NONE;
}
void Fl_PostScript_Graphics_Driver::end_loop(){
gap_=1;
reconcat();
fprintf(output, "ECP\n");
fprintf(output, "GR\n");
- shape_=NONE;
+ what=NONE;
}
void Fl_PostScript_Graphics_Driver::end_polygon(){
@@ -1394,7 +1394,7 @@ void Fl_PostScript_Graphics_Driver::end_polygon(){
reconcat();
fprintf(output, "EFP\n");
fprintf(output, "GR\n");
- shape_=NONE;
+ what=NONE;
}
void Fl_PostScript_Graphics_Driver::transformed_vertex(double x, double y){
diff --git src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H
index acba42d..52288cd 100644
--- src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H
+++ src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H
@@ -103,7 +103,6 @@ protected:
uchar **mask_bitmap() {return &mask;}
public:
Fl_PostScript_Graphics_Driver();
- enum SHAPE {NONE=0, LINE, LOOP, POLYGON, POINTS};
class Clip {
public:
@@ -131,7 +130,6 @@ public:
*/
int clocale_printf(const char *format, ...);
- enum SHAPE shape_;
int linewidth_;// need for clipping, lang level 1-2
int linestyle_;//
unsigned char cr_,cg_,cb_;
diff --git src/fl_vertex.cxx src/fl_vertex.cxx
index 5cddfce..c17a89e 100644
--- src/fl_vertex.cxx
+++ src/fl_vertex.cxx
@@ -90,7 +90,7 @@ void Fl_Graphics_Driver::translate(double x,double y) {
/** see fl_begin_points() */
void Fl_Graphics_Driver::begin_points() {
n = 0;
- what = POINT_;
+ what = POINTS;
}
/** see fl_begin_line() */
[ Direct Link to Message ] | |