{
GLint dstComponents;
GLint rDst, gDst, bDst, aDst, lDst, iDst;
- GLfloat rgba[MAX_WIDTH][4];
+ GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * n * sizeof(GLfloat));
+
+ if (!rgba) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
+ return;
+ }
dstComponents = _mesa_components_in_format( dstFormat );
/* source & dest image formats should have been error checked by now */
for (i = 0; i < n; i++) {
dest[i] = (GLchan) (indexes[i] & 0xff);
}
+ free(rgba);
return;
}
else {
dst += dstComponents;
}
}
+
+ free(rgba);
}
}
{
GLint dstComponents;
GLint rDst, gDst, bDst, aDst, lDst, iDst;
- GLfloat rgba[MAX_WIDTH][4];
+ GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * n * sizeof(GLfloat));
+
+ if (!rgba) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
+ return;
+ }
dstComponents = _mesa_components_in_format( dstFormat );
/* source & dest image formats should have been error checked by now */
for (i = 0; i < n; i++) {
dest[i] = (GLchan) (indexes[i] & 0xff);
}
+ free(rgba);
return;
}
else {
* with color indexes.
*/
transferOps &= ~(IMAGE_SCALE_BIAS_BIT | IMAGE_MAP_COLOR_BIT);
+
+ free(rgba);
}
else {
/* non-color index data */
const GLvoid *source,
const struct gl_pixelstore_attrib *srcPacking)
{
- GLuint rgba[MAX_WIDTH][4];
+ GLuint (*rgba)[4] = (GLuint (*)[4]) malloc(n * 4 * sizeof(GLfloat));
+
+ if (!rgba) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
+ return;
+ }
ASSERT(n <= MAX_WIDTH);
}
}
}
+
+ free(rgba);
}
/* general solution */
{
GLint dstComponents;
- GLfloat rgba[MAX_WIDTH][4];
GLbyte *dst = dest;
GLuint i;
+ GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * n * sizeof(GLfloat));
+
+ if (!rgba) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
+ return;
+ }
dstComponents = _mesa_components_in_format( dstFormat );
/* source & dest image formats should have been error checked by now */
dst[1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
dst += dstComponents;
}
+
+ free(rgba);
}
}