|
|
What do you think about a change like outlined here (implemented only for Xlib currently)?:
diff --git a/FL/Fl_Graphics_Driver.H b/FL/Fl_Graphics_Driver.H
index be5dbe433..1449c237d 100644
--- a/FL/Fl_Graphics_Driver.H
+++ b/FL/Fl_Graphics_Driver.H
@@ -413,6 +413,7 @@ public:
Fl_Scalable_Graphics_Driver();
protected:
int line_width_;
+ int style_;
virtual Fl_Region scale_clip(float f);
void unscale_clip(Fl_Region r);
virtual void point(int x, int y);
diff --git a/FL/fl_draw.H b/FL/fl_draw.H
index 4b9796acf..3547c80e2 100644
--- a/FL/fl_draw.H
+++ b/FL/fl_draw.H
@@ -235,7 +235,9 @@ enum {
FL_JOIN_MITER = 0x1000, ///< join style: line join extends to a point
FL_JOIN_ROUND = 0x2000, ///< join style: line join is rounded
- FL_JOIN_BEVEL = 0x3000 ///< join style: line join is tidied
+ FL_JOIN_BEVEL = 0x3000, ///< join style: line join is tidied
+
+ FL_FIXED_WIDTH= 0x4000 ///< no dynamic line width in scaled mode
};
// rectangles tweaked to exactly fill the pixel rectangle:
diff --git a/src/Fl_Graphics_Driver.cxx b/src/Fl_Graphics_Driver.cxx
index 5b33f7b2f..02e58e3e5 100644
--- a/src/Fl_Graphics_Driver.cxx
+++ b/src/Fl_Graphics_Driver.cxx
@@ -641,6 +641,7 @@ Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name, Fl_Fontsize Size) {
Fl_Scalable_Graphics_Driver::Fl_Scalable_Graphics_Driver() : Fl_Graphics_Driver() {
line_width_ = 0;
+ style_ = 0;
}
void Fl_Scalable_Graphics_Driver::rect(int x, int y, int w, int h)
@@ -810,6 +811,7 @@ void Fl_Scalable_Graphics_Driver::pie(int x,int y,int w,int h,double a1,double a
}
void Fl_Scalable_Graphics_Driver::line_style(int style, int width, char* dashes) {
+ style_ = style;
if (width == 0) line_width_ = scale() < 2 ? 0 : scale();
else line_width_ = width>0 ? width*scale() : -width*scale();
line_style_unscaled(style, line_width_, dashes);
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx
index ab591da09..618c8b48a 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx
@@ -266,9 +266,11 @@ void Fl_Xlib_Graphics_Driver::xyline_unscaled(float x, float y, float x1) {
int ix1 = int(x1/scale()+1.5)*scale()-1;
ix1 += line_delta_; if (scale() >= 4) ix1 -= 1;
draw_clipped_line(ix, iy, ix1, iy);
- // make sure no unfilled area lies between xyline(x,y,x1) and xyline(x,y+1,x1)
- if (y+line_delta_ + scale() >= iy + tw+1 - 0.001 )
- draw_clipped_line(ix, iy+1, ix1, iy+1);
+ if (!(style_ & FL_FIXED_WIDTH)) {
+ // make sure no unfilled area lies between xyline(x,y,x1) and xyline(x,y+1,x1)
+ if (y+line_delta_ + scale() >= iy + tw+1 - 0.001 )
+ draw_clipped_line(ix, iy+1, ix1, iy+1);
+ }
}
void Fl_Xlib_Graphics_Driver::yxline_unscaled(float x, float y, float y1) {
@@ -281,9 +283,11 @@ void Fl_Xlib_Graphics_Driver::yxline_unscaled(float x, float y, float y1) {
// make sure that line output by yxline(a,b,c) extends to pixel just above where yxline(a,c+1,d) begins
iy1 += line_delta_; if (scale() >= 4) iy1 -= 1;
draw_clipped_line(ix, iy, ix, iy1);
- // make sure no unfilled area lies between yxline(x,y,y1) and yxline(x+1,y,y1)
- if (x+line_delta_+scale() >= ix + tw+1 -0.001)
- draw_clipped_line(ix+1, iy, ix+1, iy1);
+ if (!(style_ & FL_FIXED_WIDTH)) {
+ // make sure no unfilled area lies between yxline(x,y,y1) and yxline(x+1,y,y1)
+ if (x+line_delta_+scale() >= ix + tw+1 -0.001)
+ draw_clipped_line(ix+1, iy, ix+1, iy1);
+ }
}
void Fl_Xlib_Graphics_Driver::loop_unscaled(float x, float y, float x1, float y1, float x2, float y2) {
It would allow to set e.g. fl_line_style(FL_SOLID|FL_FIXED_WIDTH) for non dynamic line widths.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
[ Direct Link to Message ] | |
|
| |