From c6e188610db6e1495f63ecbd3809e168c37f4a30 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sat, 28 Dec 2019 23:32:34 +0100 Subject: [PATCH] Don't allocate colour tables if palletes are not in use --- src/common/imagbmp.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/common/imagbmp.cpp b/src/common/imagbmp.cpp index 7bc9bee950..352279e355 100644 --- a/src/common/imagbmp.cpp +++ b/src/common/imagbmp.cpp @@ -586,10 +586,12 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height, // Reading the palette, if it exists: if ( bpp < 16 && ncolors != 0 ) { +#if wxUSE_PALETTE wxScopedArray r(ncolors), g(ncolors), b(ncolors); +#endif // wxUSE_PALETTE for (int j = 0; j < ncolors; j++) { if (hasPalette) @@ -600,18 +602,19 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height, cmap[j].b = bbuf[0]; cmap[j].g = bbuf[1]; cmap[j].r = bbuf[2]; - - r[j] = cmap[j].r; - g[j] = cmap[j].g; - b[j] = cmap[j].b; } else { //used in reading .ico file mask - r[j] = cmap[j].r = - g[j] = cmap[j].g = - b[j] = cmap[j].b = ( j ? 255 : 0 ); + cmap[j].r = + cmap[j].g = + 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