mirror of
https://github.com/fltk/fltk.git
synced 2026-06-05 16:12:13 +08:00
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:
+11
-5
@@ -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.
|
||||
//
|
||||
@@ -256,7 +256,8 @@ Fl_File_Icon::draw(int x, // I - Upper-lefthand X
|
||||
{
|
||||
Fl_Color c, // Current 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...
|
||||
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...
|
||||
d = data_;
|
||||
dend = data_ + num_data_;
|
||||
prim = NULL;
|
||||
c = ic;
|
||||
|
||||
@@ -283,10 +285,11 @@ Fl_File_Icon::draw(int x, // I - Upper-lefthand X
|
||||
else
|
||||
fl_color(fl_inactive(c));
|
||||
|
||||
while (*d != END || prim)
|
||||
while (d < dend)
|
||||
switch (*d)
|
||||
{
|
||||
case END :
|
||||
if (prim)
|
||||
switch (*prim)
|
||||
{
|
||||
case LINE :
|
||||
@@ -373,7 +376,7 @@ Fl_File_Icon::draw(int x, // I - Upper-lefthand X
|
||||
|
||||
case OUTLINEPOLYGON :
|
||||
prim = d;
|
||||
d += 2;
|
||||
d += 3;
|
||||
fl_begin_polygon();
|
||||
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);
|
||||
d += 3;
|
||||
break;
|
||||
|
||||
default : // Ignore invalid data...
|
||||
d ++;
|
||||
}
|
||||
|
||||
// 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 $".
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user