From a4927c1d13a6969f0994b9961c5e4db5cd4dfa57 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Sun, 13 May 2018 07:42:44 +0000 Subject: [PATCH] Fl_Scalable_Graphics_Driver::rect(): don't draw a rectangle if w or h is negative git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12920 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Graphics_Driver.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Fl_Graphics_Driver.cxx b/src/Fl_Graphics_Driver.cxx index ad0fd07cf..96c072d15 100644 --- a/src/Fl_Graphics_Driver.cxx +++ b/src/Fl_Graphics_Driver.cxx @@ -346,10 +346,12 @@ void Fl_Scalable_Graphics_Driver::rect(int x, int y, int w, int h) if (int(scale()) == scale()) { rect_unscaled(x * scale(), y * scale(), w * scale(), h * scale()); } else { - xyline(x, y, x+w-1); - yxline(x, y, y+h-1); - yxline(x+w-1, y, y+h-1); - xyline(x, y+h-1, x+w-1); + if (w > 0 && h > 0) { + xyline(x, y, x+w-1); + yxline(x, y, y+h-1); + yxline(x+w-1, y, y+h-1); + xyline(x, y+h-1, x+w-1); + } } }