Only use clipping box if it is valid.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1862 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2001-12-17 15:01:38 +00:00
parent 5dd7625092
commit b5a99aa156
2 changed files with 16 additions and 8 deletions

View File

@ -1,5 +1,9 @@
CHANGES IN FLTK 1.1.0b8
- Fl_Text_Display could get in an infinite loop when
redrawing a portion of the screen. Added a check for
the return value from fl_clip_box() so that the
correct bounding box is used.
- Removed the Fl_Mutex and Fl_Signal_Mutex classes from
the threads example, since they weren't being used
and apparently are not very portable.

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Text_Display.cxx,v 1.12.2.7 2001/12/08 20:46:33 easysw Exp $"
// "$Id: Fl_Text_Display.cxx,v 1.12.2.8 2001/12/17 15:01:38 easysw Exp $"
//
// Copyright Mark Edel. Permission to distribute under the LGPL for
// the FLTK library granted by Mark Edel.
@ -1804,14 +1804,18 @@ void Fl_Text_Display::draw(void) {
if (damage() & (FL_DAMAGE_ALL | FL_DAMAGE_EXPOSE)) {
//printf("drawing all text\n");
int X, Y, W, H;
fl_clip_box(text_area.x, text_area.y,
text_area.w, text_area.h,
X, Y, W, H);
draw_text(X, Y, W, H); // this sets the clipping internally
// draw some lines of text
if (fl_clip_box(text_area.x, text_area.y, text_area.w, text_area.h,
X, Y, W, H)) {
// Draw text using the intersected clipping box...
// (this sets the clipping internally)
draw_text(X, Y, W, H);
} else {
// Draw the whole area...
draw_text(text_area.x, text_area.y, text_area.w, text_area.h);
}
}
else if (damage() & FL_DAMAGE_SCROLL) {
// draw some lines of text
fl_push_clip(text_area.x, text_area.y,
text_area.w, text_area.h);
//printf("drawing text from %d to %d\n", damage_range1_start, damage_range1_end);
@ -1956,5 +1960,5 @@ int Fl_Text_Display::handle(int event) {
//
// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.7 2001/12/08 20:46:33 easysw Exp $".
// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.8 2001/12/17 15:01:38 easysw Exp $".
//