Redraw speedup patch from Bill.
git-svn-id: file:///fltk/svn/fltk/trunk@141 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
eb9fdfb01f
commit
12e7a1cda4
5
FL/x.H
5
FL/x.H
@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: x.H,v 1.7 1998/12/02 15:51:34 mike Exp $"
|
// "$Id: x.H,v 1.8 1998/12/07 13:38:39 mike Exp $"
|
||||||
//
|
//
|
||||||
// X11 header file for the Fast Light Tool Kit (FLTK).
|
// X11 header file for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@ -60,6 +60,7 @@ extern XFontStruct* fl_xfont;
|
|||||||
ulong fl_xpixel(Fl_Color i);
|
ulong fl_xpixel(Fl_Color i);
|
||||||
ulong fl_xpixel(uchar r, uchar g, uchar b);
|
ulong fl_xpixel(uchar r, uchar g, uchar b);
|
||||||
void fl_clip_region(Region);
|
void fl_clip_region(Region);
|
||||||
|
Region XRectangleRegion(int x, int y, int w, int h); // in fl_rect.cxx
|
||||||
|
|
||||||
// feed events into fltk:
|
// feed events into fltk:
|
||||||
int fl_handle(const XEvent&);
|
int fl_handle(const XEvent&);
|
||||||
@ -117,5 +118,5 @@ extern int fl_background_pixel; // hack into Fl_X::make_xid()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: x.H,v 1.7 1998/12/02 15:51:34 mike Exp $".
|
// End of "$Id: x.H,v 1.8 1998/12/07 13:38:39 mike Exp $".
|
||||||
//
|
//
|
||||||
|
82
src/Fl_x.cxx
82
src/Fl_x.cxx
@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: Fl_x.cxx,v 1.11 1998/12/07 13:36:23 mike Exp $"
|
// "$Id: Fl_x.cxx,v 1.12 1998/12/07 13:38:40 mike Exp $"
|
||||||
//
|
//
|
||||||
// X specific code for the Fast Light Tool Kit (FLTK).
|
// X specific code for the Fast Light Tool Kit (FLTK).
|
||||||
//
|
//
|
||||||
@ -804,47 +804,61 @@ void Fl_Window::make_current() {
|
|||||||
#include <FL/fl_draw.H>
|
#include <FL/fl_draw.H>
|
||||||
|
|
||||||
void Fl_Widget::damage(uchar flags) {
|
void Fl_Widget::damage(uchar flags) {
|
||||||
if (type() < FL_WINDOW) {
|
Fl_Widget* w = this;
|
||||||
damage(flags, x(), y(), w(), h());
|
while (w->type() < FL_WINDOW) {
|
||||||
} else {
|
w->damage_ |= flags;
|
||||||
Fl_X* i = Fl_X::i((Fl_Window*)this);
|
w = w->parent();
|
||||||
if (i) {
|
if (!w) return;
|
||||||
if (i->region) {XDestroyRegion(i->region); i->region = 0;}
|
flags = FL_DAMAGE_CHILD;
|
||||||
damage_ |= flags;
|
}
|
||||||
Fl::damage(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::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) {
|
void Fl_Widget::damage(uchar flags, int X, int Y, int W, int H) {
|
||||||
if (type() < FL_WINDOW) {
|
Fl_Widget* w = this;
|
||||||
damage_ |= flags;
|
while (w->type() < FL_WINDOW) {
|
||||||
if (parent()) parent()->damage(FL_DAMAGE_CHILD,X,Y,W,H);
|
w->damage_ |= flags;
|
||||||
} else {
|
w = w->parent();
|
||||||
// see if damage covers entire window:
|
if (!w) return;
|
||||||
if (X<=0 && Y<=0 && W>=w() && H>=h()) {damage(flags); return;}
|
flags = FL_DAMAGE_CHILD;
|
||||||
Fl_X* i = Fl_X::i((Fl_Window*)this);
|
}
|
||||||
if (i) {
|
// see if damage covers entire window:
|
||||||
if (damage()) {
|
if (X<=0 && Y<=0 && W>=w->w() && H>=w->h()) {w->damage(flags); return;}
|
||||||
// if we already have damage we must merge with existing region:
|
Fl_X* i = Fl_X::i((Fl_Window*)w);
|
||||||
if (i->region) {
|
if (i) {
|
||||||
XRectangle R;
|
if (w->damage()) {
|
||||||
R.x = X; R.y = Y; R.width = W; R.height = H;
|
// if we already have damage we must merge with existing region:
|
||||||
XUnionRectWithRegion(&R, i->region, i->region);
|
if (i->region) {
|
||||||
}
|
XRectangle R;
|
||||||
damage_ |= flags;
|
R.x = X; R.y = Y; R.width = W; R.height = H;
|
||||||
} else {
|
XUnionRectWithRegion(&R, i->region, i->region);
|
||||||
// create a new region:
|
|
||||||
if (i->region) XDestroyRegion(i->region);
|
|
||||||
i->region = XRectangleRegion(X,Y,W,H);
|
|
||||||
damage_ = flags;
|
|
||||||
}
|
}
|
||||||
Fl::damage(FL_DAMAGE_CHILD);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -858,5 +872,5 @@ void Fl_Window::flush() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: Fl_x.cxx,v 1.11 1998/12/07 13:36:23 mike Exp $".
|
// End of "$Id: Fl_x.cxx,v 1.12 1998/12/07 13:38:40 mike Exp $".
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user