summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>1998-12-08 21:08:51 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>1998-12-08 21:08:51 +0000
commitf42673addcd73638632986058701b7705fa34c28 (patch)
tree354590a793aa70dddc7110aa8a6987d000c7277f
parent5e2f2d6c514d179ff1937d157cf8ba239dd07ae7 (diff)
Damage code consolidation from Gustavo...
git-svn-id: file:///fltk/svn/fltk/trunk@154 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--src/Fl.cxx78
-rw-r--r--src/Fl_win32.cxx57
-rw-r--r--src/Fl_x.cxx72
3 files changed, 80 insertions, 127 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx
index 1ed145b49..12f95dde6 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl.cxx,v 1.6 1998/10/21 14:19:54 mike Exp $"
+// "$Id: Fl.cxx,v 1.7 1998/12/08 21:08:50 mike Exp $"
//
// Main event handling code for the Fast Light Tool Kit (FLTK).
//
@@ -584,6 +584,80 @@ void fl_throw_focus(Fl_Widget *o) {
if (fix) fl_fix_focus();
}
+#include <FL/fl_draw.H>
+
+void Fl_Widget::damage(uchar flags) {
+ Fl_Widget* w = this;
+ while (w->type() < FL_WINDOW) {
+ w->damage_ |= flags;
+ w = w->parent();
+ if (!w) return;
+ flags = FL_DAMAGE_CHILD;
+ }
+ Fl_X* i = Fl_X::i((Fl_Window*)w);
+ if (i) {
+ if (i->region) {
+ // if there already is an update region then merge the area
+ // of the child with it:
+ if (w->damage() && w != this) {
+ w->damage(flags, x(), y(), this->w(), h());
+ return;
+ }
+ // otherwise it is faster to just damage the whole window and
+ // rely on Fl_Group only drawing the damaged children:
+ XDestroyRegion(i->region);
+ i->region = 0;
+ }
+ w->damage_ |= flags;
+ Fl::damage(FL_DAMAGE_CHILD);
+ }
+}
+
+void Fl_Widget::redraw() {damage(FL_DAMAGE_ALL);}
+
+void Fl_Widget::damage(uchar flags, int X, int Y, int W, int H) {
+ Fl_Widget* w = this;
+ while (w->type() < FL_WINDOW) {
+ w->damage_ |= flags;
+ w = w->parent();
+ if (!w) return;
+ flags = FL_DAMAGE_CHILD;
+ }
+ // see if damage covers entire window:
+ if (X<=0 && Y<=0 && W>=w->w() && H>=w->h()) {w->damage(flags); return;}
+ Fl_X* i = Fl_X::i((Fl_Window*)w);
+ if (i) {
+ if (w->damage()) {
+ // if we already have damage we must merge with existing region:
+ if (i->region) {
+#ifndef WIN32
+ XRectangle R;
+ R.x = X; R.y = Y; R.width = W; R.height = H;
+ XUnionRectWithRegion(&R, i->region, i->region);
+#else
+ Region r = XRectangleRegion(X,Y,W,H);
+ CombineRgn(i->region,i->region,r,RGN_OR);
+ XDestroyRegion(r);
+#endif
+ }
+ w->damage_ |= flags;
+ } else {
+ // create a new region:
+ if (i->region) XDestroyRegion(i->region);
+ i->region = XRectangleRegion(X,Y,W,H);
+ w->damage_ = flags;
+ }
+ Fl::damage(FL_DAMAGE_CHILD);
+ }
+}
+
+void Fl_Window::flush() {
+ make_current();
+//if (damage() == FL_DAMAGE_EXPOSE && can_boxcheat(box())) fl_boxcheat = this;
+ fl_clip_region(i->region); i->region = 0;
+ draw();
+}
+
//
-// End of "$Id: Fl.cxx,v 1.6 1998/10/21 14:19:54 mike Exp $".
+// End of "$Id: Fl.cxx,v 1.7 1998/12/08 21:08:50 mike Exp $".
//
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index 073aa5a73..31583d2c4 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_win32.cxx,v 1.18 1998/12/02 15:47:29 mike Exp $"
+// "$Id: Fl_win32.cxx,v 1.19 1998/12/08 21:08:50 mike Exp $"
//
// WIN32-specific code for the Fast Light Tool Kit (FLTK).
//
@@ -759,59 +759,6 @@ void Fl_Window::make_current() {
fl_clip_region(0);
}
-#include <FL/fl_draw.H>
-
-void Fl_Widget::damage(uchar flags) {
- if (type() < FL_WINDOW) {
- damage(flags, x(), y(), w(), h());
- } else {
- Fl_X* i = Fl_X::i((Fl_Window*)this);
- if (i) {
- if (i->region) {DeleteObject(i->region);}
- i->region = 0;
- damage_ |= flags;
- Fl::damage(FL_DAMAGE_CHILD);
- }
- }
-}
-
-void Fl_Widget::redraw() {damage(FL_DAMAGE_ALL);}
-
-Region XRectangleRegion(int x, int y, int w, int h); // in fl_rect.C
-
-void Fl_Widget::damage(uchar flags, int X, int Y, int W, int H) {
- if (type() < FL_WINDOW) {
- damage_ |= flags;
- if (parent()) parent()->damage(FL_DAMAGE_CHILD,X,Y,W,H);
- } else {
- // see if damage covers entire window:
- if (X<=0 && Y<=0 && W>=w() && H>=h()) {damage(flags); return;}
- Fl_X* i = Fl_X::i((Fl_Window*)this);
- if (i) {
- if (damage()) {
- // if we already have damage we must merge with existing region:
- if (i->region) {
- Region r = XRectangleRegion(X,Y,W,H);
- CombineRgn(i->region,i->region,r,RGN_OR);
- DeleteObject(r);
- }
- } else {
- // create a new region:
- if (i->region) DeleteObject(i->region);
- i->region = XRectangleRegion(X,Y,W,H);
- }
- damage_ |= flags;
- Fl::damage(FL_DAMAGE_CHILD);
- }
- }
-}
-
-void Fl_Window::flush() {
- make_current();
- fl_clip_region(i->region);i->region=0;
- draw();
-}
-
//
-// End of "$Id: Fl_win32.cxx,v 1.18 1998/12/02 15:47:29 mike Exp $".
+// End of "$Id: Fl_win32.cxx,v 1.19 1998/12/08 21:08:50 mike Exp $".
//
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index 3bf727c41..ac2c5d32a 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_x.cxx,v 1.12 1998/12/07 13:38:40 mike Exp $"
+// "$Id: Fl_x.cxx,v 1.13 1998/12/08 21:08:51 mike Exp $"
//
// X specific code for the Fast Light Tool Kit (FLTK).
//
@@ -801,76 +801,8 @@ void Fl_Window::make_current() {
fl_clip_region(0);
}
-#include <FL/fl_draw.H>
-
-void Fl_Widget::damage(uchar flags) {
- Fl_Widget* w = this;
- while (w->type() < FL_WINDOW) {
- w->damage_ |= flags;
- w = w->parent();
- if (!w) return;
- flags = FL_DAMAGE_CHILD;
- }
- Fl_X* i = Fl_X::i((Fl_Window*)w);
- if (i) {
- if (i->region) {
- // if there already is an update region then merge the area
- // of the child with it:
- if (w->damage() && w != this) {
- w->damage(flags, x(), y(), this->w(), h());
- return;
- }
- // otherwise it is faster to just damage the whole window and
- // rely on Fl_Group only drawing the damaged children:
- XDestroyRegion(i->region);
- i->region = 0;
- }
- w->damage_ |= flags;
- Fl::damage(FL_DAMAGE_CHILD);
- }
-}
-
-void Fl_Widget::redraw() {damage(FL_DAMAGE_ALL);}
-
-void Fl_Widget::damage(uchar flags, int X, int Y, int W, int H) {
- Fl_Widget* w = this;
- while (w->type() < FL_WINDOW) {
- w->damage_ |= flags;
- w = w->parent();
- if (!w) return;
- flags = FL_DAMAGE_CHILD;
- }
- // see if damage covers entire window:
- if (X<=0 && Y<=0 && W>=w->w() && H>=w->h()) {w->damage(flags); return;}
- Fl_X* i = Fl_X::i((Fl_Window*)w);
- if (i) {
- if (w->damage()) {
- // if we already have damage we must merge with existing region:
- if (i->region) {
- XRectangle R;
- R.x = X; R.y = Y; R.width = W; R.height = H;
- XUnionRectWithRegion(&R, i->region, i->region);
- }
- w->damage_ |= flags;
- } else {
- // create a new region:
- if (i->region) XDestroyRegion(i->region);
- i->region = XRectangleRegion(X,Y,W,H);
- w->damage_ = flags;
- }
- Fl::damage(FL_DAMAGE_CHILD);
- }
-}
-
-void Fl_Window::flush() {
- make_current();
-//if (damage() == FL_DAMAGE_EXPOSE && can_boxcheat(box())) fl_boxcheat = this;
- fl_clip_region(i->region); i->region = 0;
- draw();
-}
-
#endif
//
-// End of "$Id: Fl_x.cxx,v 1.12 1998/12/07 13:38:40 mike Exp $".
+// End of "$Id: Fl_x.cxx,v 1.13 1998/12/08 21:08:51 mike Exp $".
//