Fixed crash for very small Fl_Color_Chooser (STR #3490).

This commit is contained in:
Matthias Melcher 2019-02-04 00:58:51 +01:00
parent a7e91e0199
commit 67f0bf6fee
2 changed files with 17 additions and 8 deletions

View File

@ -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).

View File

@ -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);