summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2024-07-24 17:08:52 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2024-07-24 17:09:30 +0200
commit3cc12d203f30f29a8920b85ee98c46f4c9bb0bcb (patch)
treee3545874eb334748bfa6e6c01314c73eca43d72c /src/drivers
parent467866b8299132138df10bbd91ec4f62639ca873 (diff)
Fix Fl_Scalable_Graphics_Driver::rect(x,y,w,h) (#1017)
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver.H1
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx8
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H1
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx4
4 files changed, 14 insertions, 0 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H
index 03371c8c4..38fce606d 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H
@@ -109,6 +109,7 @@ protected:
void fixloop() FL_OVERRIDE;
void point(int x, int y) FL_OVERRIDE;
void focus_rect(int x, int y, int w, int h) FL_OVERRIDE;
+ void rect_unscaled(int x, int y, int w, int h) FL_OVERRIDE;
void rectf_unscaled(int x, int y, int w, int h) FL_OVERRIDE;
#if USE_COLORMAP
void colored_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) FL_OVERRIDE;
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx
index 1b13ff0a9..4527ee920 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx
@@ -61,6 +61,14 @@ void Fl_GDI_Graphics_Driver::focus_rect(int x, int y, int w, int h) {
for (yy = h; yy > 0; yy--, i++) if (i & 1) SetPixel(gc_, x, y+yy, c);
}
+void Fl_GDI_Graphics_Driver::rect_unscaled(int x, int y, int w, int h) {
+ MoveToEx(fl_gc, x, y, 0L);
+ LineTo(fl_gc, x+w, y);
+ LineTo(fl_gc, x+w, y+h);
+ LineTo(fl_gc, x, y+h);
+ LineTo(fl_gc, x, y);
+}
+
void Fl_GDI_Graphics_Driver::rectf_unscaled(int x, int y, int w, int h) {
RECT rect;
rect.left = x; rect.top = y;
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H
index 4116b79b9..b3e9ad444 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H
@@ -141,6 +141,7 @@ protected:
void transformed_vertex0(float x, float y) FL_OVERRIDE;
void fixloop() FL_OVERRIDE;
void focus_rect(int x, int y, int w, int h) FL_OVERRIDE;
+ void rect_unscaled(int x, int y, int w, int h) FL_OVERRIDE;
void rectf_unscaled(int x, int y, int w, int h) FL_OVERRIDE;
void colored_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) FL_OVERRIDE;
void line_unscaled(int x, int y, int x1, int y1) FL_OVERRIDE;
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx
index 6693dc460..689f0eccf 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx
@@ -227,6 +227,10 @@ void Fl_Xlib_Graphics_Driver::focus_rect(int x, int y, int w, int h) {
}
}
+void Fl_Xlib_Graphics_Driver::rect_unscaled(int x, int y, int w, int h) {
+ XDrawRectangle(fl_display, fl_window, gc_, x, y, w, h);
+}
+
void Fl_Xlib_Graphics_Driver::rectf_unscaled(int x, int y, int w, int h) {
x += floor(offset_x_);
y += floor(offset_y_);