#88 Bugs found in Util/pixel.c

open
Packer (3)
5
2007-03-13
2007-03-13
Ray
No

In line 244:
Original code was:
--------
case GL_INT:
for (i = 0; i < width; i++)
tmpRow[i] = (GLfloat) INT_TO_FLOAT(bSrc[i]);
break;
--------
It should be:
--------
case GL_INT:
for (i = 0; i < width; i++)
tmpRow[i] = (GLfloat) INT_TO_FLOAT(iSrc[i]);
break;
----------
Since we are reading from an integer source
(difference in bSrc[i] --> iSrc[i])

Also, line 248:
----------
case GL_UNSIGNED_INT:
for (i = 0; i < width; i++)
tmpRow[i] = (GLfloat) UINT_TO_FLOAT(bSrc[i]);
break;
-----------
Corrected should be:
-----------
case GL_UNSIGNED_INT:
for (i = 0; i < width; i++)
tmpRow[i] = (GLfloat) UINT_TO_FLOAT(uiSrc[i]);
break;
------------
Since we are reading from an unsigned int
(difference in (bSrc[i] --> uiSrc[i])

In line 310, original was:
-------------
case GL_DOUBLE:
for (i = 0; i < width; i++, dst += 4)
tmpRow[dst] = (GLfloat) fSrc[i];
break;
--------------
Should be:
---------------
case GL_DOUBLE:
for (i = 0; i < width; i++, dst += 4)
tmpRow[dst] = (GLfloat) dSrc[i];
break;
-------------
Since we are reading from a double source
(fSrc[i]-->dSrc[i])

Discussion