summaryrefslogtreecommitdiff
path: root/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_line_style.cxx
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2021-03-11 16:05:20 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2021-03-11 16:05:32 +0100
commit569fec25e0454c4e4b98dcc383143a357ca50b55 (patch)
treec38048366a56a901a66465fdaca6628d0e03405a /src/drivers/Xlib/Fl_Xlib_Graphics_Driver_line_style.cxx
parentbd6c9854342094e2de8183aaab740804c1a6fc1f (diff)
Unification of scaled coordinate calculations in class Fl_Scalable_Graphics_Driver
Most coordinate calculations are done with the new inline function int Fl_Scalable_Graphics_Driver::floor(int coord) that is used by both the Windows and X11 platforms.
Diffstat (limited to 'src/drivers/Xlib/Fl_Xlib_Graphics_Driver_line_style.cxx')
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver_line_style.cxx18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_line_style.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_line_style.cxx
index 606b82920..1aaeceea1 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_line_style.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_line_style.cxx
@@ -26,7 +26,7 @@
#include "Fl_Xlib_Graphics_Driver.H"
-void Fl_Xlib_Graphics_Driver::line_style_unscaled(int style, float width, char* dashes) {
+void Fl_Xlib_Graphics_Driver::line_style_unscaled(int style, int width, char* dashes) {
int ndashes = dashes ? strlen(dashes) : 0;
// emulate the Windows dash patterns on X
@@ -61,3 +61,19 @@ if (*dashes == 0) ndashes = 0;//against error with very small scaling
Cap[(style>>8)&3], Join[(style>>12)&3]);
if (ndashes) XSetDashes(fl_display, gc_, 0, dashes, ndashes);
}
+
+void *Fl_Xlib_Graphics_Driver::change_pen_width(int lwidth) {
+ XGCValues *gc_values = (XGCValues*)malloc(sizeof(XGCValues));
+ gc_values->line_width = lwidth;
+ XChangeGC(fl_display, gc_, GCLineWidth, gc_values);
+ gc_values->line_width = line_width_;
+ line_width_ = lwidth;
+ return gc_values;
+}
+
+void Fl_Xlib_Graphics_Driver::reset_pen_width(void *data) {
+ XGCValues *gc_values = (XGCValues*)data;
+ line_width_ = gc_values->line_width;
+ XChangeGC(fl_display, gc_, GCLineWidth, gc_values);
+ delete gc_values;
+}