summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <git@matthiasm.com>2019-02-04 00:58:51 +0100
committerMatthias Melcher <git@matthiasm.com>2019-02-04 00:58:51 +0100
commit67f0bf6feeaeaa58f205a3a3065136df68163420 (patch)
tree6480a6371f125ef03e49dea9e9db0f90f364ab76
parenta7e91e0199a11401c356115ea651daf13c436f29 (diff)
Fixed crash for very small Fl_Color_Chooser (STR #3490).
-rw-r--r--CHANGES.txt3
-rw-r--r--src/Fl_Color_Chooser.cxx22
2 files changed, 17 insertions, 8 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index f6cc68a23..c282898b4 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -18,7 +18,6 @@ Changes in FLTK 1.4.0 Released: ??? ?? 2019
New Features and Extensions
- (add new items here)
- - Tooltips hide by themselves after 12 seconds (STR #2584).
- New member functions Fl_Paged_Device::begin_job() and begin_page()
replace start_job() and start_page(). The start_... names are maintained
for API compatibility.
@@ -103,6 +102,7 @@ Changes in FLTK 1.4.0 Released: ??? ?? 2019
Other Improvements
- (add new items here)
+ - Tooltips hide by themselves after 12 seconds (STR #2584).
- Added widget visibility indicator to Fluid (STR #2669).
- Added Fl_Input_::append() method (STR #2953).
- Fix for STR#3473 (and its duplicate STR#3507) to restore configure-based
@@ -148,6 +148,7 @@ Changes in FLTK 1.4.0 Released: ??? ?? 2019
Bug Fixes
- (add new items here)
+ - Fixed crash for very small Fl_Color_Chooser (STR #3490).
- Removed all shadow lint in header files (STR #2714).
- Fixed pulldown menu position when at the bottom of the screen (STR #2880).
- Fixed missing item handling in Fl_Chekc_Browser (STR #3480).
diff --git a/src/Fl_Color_Chooser.cxx b/src/Fl_Color_Chooser.cxx
index 8d5a63724..bf0003ff8 100644
--- a/src/Fl_Color_Chooser.cxx
+++ b/src/Fl_Color_Chooser.cxx
@@ -307,9 +307,11 @@ void Flcc_HueBox::draw() {
int yy1 = y()+Fl::box_dy(box());
int w1 = w()-Fl::box_dw(box());
int h1 = h()-Fl::box_dh(box());
- if (damage() == FL_DAMAGE_EXPOSE) fl_push_clip(x1+px,yy1+py,6,6);
- fl_draw_image(generate_image, this, x1, yy1, w1, h1);
- if (damage() == FL_DAMAGE_EXPOSE) fl_pop_clip();
+ if (w1>0 && h1>0) {
+ if (damage() == FL_DAMAGE_EXPOSE) fl_push_clip(x1+px,yy1+py,6,6);
+ fl_draw_image(generate_image, this, x1, yy1, w1, h1);
+ if (damage() == FL_DAMAGE_EXPOSE) fl_pop_clip();
+ }
Fl_Color_Chooser* c = (Fl_Color_Chooser*)parent();
#ifdef CIRCLE
int X = int(.5*(cos(c->hue()*(M_PI/3.0))*c->saturation()+1) * (w1-6));
@@ -321,7 +323,11 @@ void Flcc_HueBox::draw() {
if (X < 0) X = 0; else if (X > w1-6) X = w1-6;
if (Y < 0) Y = 0; else if (Y > h1-6) Y = h1-6;
// fl_color(c->value()>.75 ? FL_BLACK : FL_WHITE);
- draw_box(FL_UP_BOX,x1+X,yy1+Y,6,6,Fl::focus() == this ? FL_FOREGROUND_COLOR : FL_GRAY);
+ if (w1>0 && h1>0) {
+ fl_push_clip(x1,yy1,w1,h1);
+ draw_box(FL_UP_BOX,x1+X,yy1+Y,6,6,Fl::focus() == this ? FL_FOREGROUND_COLOR : FL_GRAY);
+ fl_pop_clip();
+ }
px = X; py = Y;
}
#endif // !FL_DOXYGEN
@@ -381,9 +387,11 @@ void Flcc_ValueBox::draw() {
int yy1 = y()+Fl::box_dy(box());
int w1 = w()-Fl::box_dw(box());
int h1 = h()-Fl::box_dh(box());
- if (damage() == FL_DAMAGE_EXPOSE) fl_push_clip(x1,yy1+py,w1,6);
- fl_draw_image(generate_vimage, this, x1, yy1, w1, h1);
- if (damage() == FL_DAMAGE_EXPOSE) fl_pop_clip();
+ if (w1>0 && h1>0) {
+ if (damage() == FL_DAMAGE_EXPOSE) fl_push_clip(x1,yy1+py,w1,6);
+ fl_draw_image(generate_vimage, this, x1, yy1, w1, h1);
+ if (damage() == FL_DAMAGE_EXPOSE) fl_pop_clip();
+ }
int Y = int((1-c->value()) * (h1-6));
if (Y < 0) Y = 0; else if (Y > h1-6) Y = h1-6;
draw_box(FL_UP_BOX,x1,yy1+Y,w1,6,Fl::focus() == this ? FL_FOREGROUND_COLOR : FL_GRAY);