summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2005-07-14 13:16:17 +0000
committerMatthias Melcher <fltk@matthiasm.com>2005-07-14 13:16:17 +0000
commit7f526e136236802fccd9822ce87c509bf32e50d0 (patch)
tree62ef73549292dec25256a892c124153c2f5cc0b6
parent52960ea9038d1f5820453129db4652b012bda0fe (diff)
- Fixed Fl_Bitmap::copy code according to Stephans suggestions. Thanks! Good catch.
- Fixed some minor alignment in Fluid. - Live Mode window in Fluid is now double buffered to get rid of flicker. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4415 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--CHANGES1
-rw-r--r--fluid/Fl_Widget_Type.cxx2
-rw-r--r--fluid/widget_panel.cxx6
-rw-r--r--fluid/widget_panel.fl6
-rw-r--r--src/Fl_Bitmap.cxx10
5 files changed, 13 insertions, 12 deletions
diff --git a/CHANGES b/CHANGES
index 8a1b92948..c47fc8652 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,7 @@ CHANGES IN FLTK 1.1.7
- Documentation fixes (STR #648, STR #692, STR #730, STR
#744, STR #745)
+ - Fixed bitmap scaling code
- Fixed tiny memory leak (STR #878)
- Fixed hang on corrupt jpeg (STR #915)
- Fixed static allocation of font buffer in demo (STR #909)
diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx
index 639a9cc2e..9660eda79 100644
--- a/fluid/Fl_Widget_Type.cxx
+++ b/fluid/Fl_Widget_Type.cxx
@@ -1504,7 +1504,7 @@ void live_mode_cb(Fl_Button*o,void *v) {
Fl_Group::current(0);
int w = live_widget->w();
int h = live_widget->h();
- live_window = new Fl_Window(w+20, h+55, "Fluid Live Mode Widget");
+ live_window = new Fl_Double_Window(w+20, h+55, "Fluid Live Mode Widget");
live_window->box(FL_FLAT_BOX);
live_window->color(FL_GREEN);
Fl_Group *rsz = new Fl_Group(0, h+20, 130, 35);
diff --git a/fluid/widget_panel.cxx b/fluid/widget_panel.cxx
index 7c3efdb33..2b16e36fa 100644
--- a/fluid/widget_panel.cxx
+++ b/fluid/widget_panel.cxx
@@ -51,12 +51,12 @@ Fl_Double_Window* make_widget_panel() {
w = o;
o->labelsize(11);
w->hotspot(o);
- { Fl_Tabs* o = new Fl_Tabs(3, 5, 402, 310);
+ { Fl_Tabs* o = new Fl_Tabs(5, 5, 400, 310);
o->selection_color((Fl_Color)4);
o->labelsize(11);
o->callback((Fl_Callback*)cb_);
o->when(FL_WHEN_NEVER);
- { Fl_Group* o = new Fl_Group(3, 25, 402, 290, "GUI");
+ { Fl_Group* o = new Fl_Group(5, 25, 400, 290, "GUI");
o->labelsize(11);
o->callback((Fl_Callback*)propagate_load);
o->when(FL_WHEN_NEVER);
@@ -387,7 +387,7 @@ Fl_Double_Window* make_widget_panel() {
o->end();
Fl_Group::current()->resizable(o);
}
- { Fl_Group* o = new Fl_Group(3, 25, 402, 290, "Style");
+ { Fl_Group* o = new Fl_Group(5, 25, 400, 290, "Style");
o->labelsize(11);
o->callback((Fl_Callback*)propagate_load);
o->when(FL_WHEN_NEVER);
diff --git a/fluid/widget_panel.fl b/fluid/widget_panel.fl
index 0c70171b5..fc3ed02c1 100644
--- a/fluid/widget_panel.fl
+++ b/fluid/widget_panel.fl
@@ -39,12 +39,12 @@ Function {make_widget_panel()} {open
} {
Fl_Tabs {} {
callback {propagate_load((Fl_Group *)o,v);} open
- xywh {3 5 402 310} selection_color 4 labelsize 11 when 0 resizable
+ xywh {5 5 400 310} selection_color 4 labelsize 11 when 0 resizable
} {
Fl_Group {} {
label GUI
callback propagate_load
- xywh {3 25 402 290} labelsize 11 when 0 resizable
+ xywh {5 25 400 290} labelsize 11 when 0 resizable
} {
Fl_Group {} {
callback propagate_load
@@ -290,7 +290,7 @@ Function {make_widget_panel()} {open
Fl_Group {} {
label Style
callback propagate_load
- xywh {3 25 402 290} labelsize 11 when 0 hide
+ xywh {5 25 400 290} labelsize 11 when 0 hide
} {
Fl_Group {} {
callback propagate_load
diff --git a/src/Fl_Bitmap.cxx b/src/Fl_Bitmap.cxx
index f6e008368..372578633 100644
--- a/src/Fl_Bitmap.cxx
+++ b/src/Fl_Bitmap.cxx
@@ -476,15 +476,15 @@ Fl_Image *Fl_Bitmap::copy(int W, int H) {
// Scale the image using a nearest-neighbor algorithm...
for (dy = H, sy = 0, yerr = H, new_ptr = new_array; dy > 0; dy --) {
- for (dx = W, xerr = W, old_ptr = array + sy * (w() + 7) / 8, sx = 0, new_bit = 128;
+ for (dx = W, xerr = W, old_ptr = array + sy * ((w() + 7) / 8), sx = 0, new_bit = 1;
dx > 0;
dx --) {
- old_bit = (uchar)(128 >> (sx & 7));
+ old_bit = (uchar)(1 << (sx & 7));
if (old_ptr[sx / 8] & old_bit) *new_ptr |= new_bit;
- if (new_bit > 1) new_bit >>= 1;
+ if (new_bit < 128) new_bit <<= 1;
else {
- new_bit = 128;
+ new_bit = 1;
new_ptr ++;
}
@@ -497,7 +497,7 @@ Fl_Image *Fl_Bitmap::copy(int W, int H) {
}
}
- if (new_bit < 128) new_ptr ++;
+ if (new_bit > 1) new_ptr ++;
sy += ystep;
yerr -= ymod;