Fix infinite loop bug in Fl_File_Icon::draw() with 32-bit colors and

outline polygons...


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1665 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2001-10-29 15:40:49 +00:00
parent 46aa6619e1
commit 38fdf727f7

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_File_Icon.cxx,v 1.1.2.2 2001/10/29 03:44:32 easysw Exp $" // "$Id: Fl_File_Icon.cxx,v 1.1.2.3 2001/10/29 15:40:49 easysw Exp $"
// //
// Fl_File_Icon routines. // Fl_File_Icon routines.
// //
@ -256,7 +256,8 @@ Fl_File_Icon::draw(int x, // I - Upper-lefthand X
{ {
Fl_Color c, // Current color Fl_Color c, // Current color
oc; // Outline color oc; // Outline color
short *d; // Pointer to data short *d, // Pointer to data
*dend; // End of data...
short *prim; // Pointer to start of primitive... short *prim; // Pointer to start of primitive...
double scale; // Scale of icon double scale; // Scale of icon
@ -275,6 +276,7 @@ Fl_File_Icon::draw(int x, // I - Upper-lefthand X
// Loop through the array until we see an unmatched END... // Loop through the array until we see an unmatched END...
d = data_; d = data_;
dend = data_ + num_data_;
prim = NULL; prim = NULL;
c = ic; c = ic;
@ -283,10 +285,11 @@ Fl_File_Icon::draw(int x, // I - Upper-lefthand X
else else
fl_color(fl_inactive(c)); fl_color(fl_inactive(c));
while (*d != END || prim) while (d < dend)
switch (*d) switch (*d)
{ {
case END : case END :
if (prim)
switch (*prim) switch (*prim)
{ {
case LINE : case LINE :
@ -373,7 +376,7 @@ Fl_File_Icon::draw(int x, // I - Upper-lefthand X
case OUTLINEPOLYGON : case OUTLINEPOLYGON :
prim = d; prim = d;
d += 2; d += 3;
fl_begin_polygon(); fl_begin_polygon();
break; break;
@ -382,6 +385,9 @@ Fl_File_Icon::draw(int x, // I - Upper-lefthand X
fl_vertex(d[1] * 0.0001, d[2] * 0.0001); fl_vertex(d[1] * 0.0001, d[2] * 0.0001);
d += 3; d += 3;
break; break;
default : // Ignore invalid data...
d ++;
} }
// If we still have an open primitive, close it... // If we still have an open primitive, close it...
@ -1228,5 +1234,5 @@ get_kde_val(char *str,
// //
// End of "$Id: Fl_File_Icon.cxx,v 1.1.2.2 2001/10/29 03:44:32 easysw Exp $". // End of "$Id: Fl_File_Icon.cxx,v 1.1.2.3 2001/10/29 15:40:49 easysw Exp $".
// //