Don't allocate colour tables if palletes are not in use
This commit is contained in:
@@ -586,10 +586,12 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height,
|
|||||||
// Reading the palette, if it exists:
|
// Reading the palette, if it exists:
|
||||||
if ( bpp < 16 && ncolors != 0 )
|
if ( bpp < 16 && ncolors != 0 )
|
||||||
{
|
{
|
||||||
|
#if wxUSE_PALETTE
|
||||||
wxScopedArray<unsigned char>
|
wxScopedArray<unsigned char>
|
||||||
r(ncolors),
|
r(ncolors),
|
||||||
g(ncolors),
|
g(ncolors),
|
||||||
b(ncolors);
|
b(ncolors);
|
||||||
|
#endif // wxUSE_PALETTE
|
||||||
for (int j = 0; j < ncolors; j++)
|
for (int j = 0; j < ncolors; j++)
|
||||||
{
|
{
|
||||||
if (hasPalette)
|
if (hasPalette)
|
||||||
@@ -600,18 +602,19 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height,
|
|||||||
cmap[j].b = bbuf[0];
|
cmap[j].b = bbuf[0];
|
||||||
cmap[j].g = bbuf[1];
|
cmap[j].g = bbuf[1];
|
||||||
cmap[j].r = bbuf[2];
|
cmap[j].r = bbuf[2];
|
||||||
|
|
||||||
r[j] = cmap[j].r;
|
|
||||||
g[j] = cmap[j].g;
|
|
||||||
b[j] = cmap[j].b;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//used in reading .ico file mask
|
//used in reading .ico file mask
|
||||||
r[j] = cmap[j].r =
|
cmap[j].r =
|
||||||
g[j] = cmap[j].g =
|
cmap[j].g =
|
||||||
b[j] = cmap[j].b = ( j ? 255 : 0 );
|
cmap[j].b = ( j ? 255 : 0 );
|
||||||
}
|
}
|
||||||
|
#if wxUSE_PALETTE
|
||||||
|
r[j] = cmap[j].r;
|
||||||
|
g[j] = cmap[j].g;
|
||||||
|
b[j] = cmap[j].b;
|
||||||
|
#endif // wxUSE_PALETTE
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_PALETTE
|
#if wxUSE_PALETTE
|
||||||
|
Reference in New Issue
Block a user