From ef5076f852cc6a5ec0968c9fc933d3b365a124f4 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sun, 21 Mar 2021 12:16:01 -0700 Subject: [PATCH] Fix build with wxUSE_PALETTE==0 --- src/msw/dib.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/msw/dib.cpp b/src/msw/dib.cpp index c52d733867..78656c8b33 100644 --- a/src/msw/dib.cpp +++ b/src/msw/dib.cpp @@ -638,6 +638,10 @@ wxPalette *wxDIB::CreatePalette() const bool wxDIB::Create(const wxImage& image, PixelFormat pf, int dstDepth) { wxCHECK_MSG( image.IsOk(), false, wxT("invalid wxImage in wxDIB ctor") ); +#if !wxUSE_PALETTE + wxCHECK_MSG(dstDepth != 1, false, + "wxImage conversion to monochrome bitmap requires wxUSE_PALETTE"); +#endif const int h = image.GetHeight(); const int w = image.GetWidth(); @@ -655,6 +659,7 @@ bool wxDIB::Create(const wxImage& image, PixelFormat pf, int dstDepth) // if requested, convert wxImage's content to monochrome wxScopedArray eightBitData; +#if wxUSE_PALETTE if ( dstDepth == 1 ) { wxImage quantized; @@ -695,6 +700,7 @@ bool wxDIB::Create(const wxImage& image, PixelFormat pf, int dstDepth) return false; } } +#endif // wxUSE_PALETTE // DIBs are stored in bottom to top order (see also the comment above in // Create()) so we need to copy bits line by line and starting from the end