X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e22c13fe7ed64b4a7cb68ef42b338b6805f9fc64..8b3fddc49326c0b6019cd7082218726aa17a5727:/src/generic/splash.cpp diff --git a/src/generic/splash.cpp b/src/generic/splash.cpp index 144bac6469..fa641bdf1e 100644 --- a/src/generic/splash.cpp +++ b/src/generic/splash.cpp @@ -98,7 +98,9 @@ void wxSplashScreen::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) */ BEGIN_EVENT_TABLE(wxSplashScreenWindow, wxWindow) - //EVT_PAINT(wxSplashScreenWindow::OnPaint) +#ifdef __WXGTK__ + EVT_PAINT(wxSplashScreenWindow::OnPaint) +#endif EVT_ERASE_BACKGROUND(wxSplashScreenWindow::OnEraseBackground) EVT_CHAR(wxSplashScreenWindow::OnChar) EVT_MOUSE_EVENTS(wxSplashScreenWindow::OnMouseEvent) @@ -108,13 +110,16 @@ wxSplashScreenWindow::wxSplashScreenWindow(const wxBitmap& bitmap, wxWindow* par wxWindow(parent, id, pos, size, style) { m_bitmap = bitmap; -} -void wxSplashScreenWindow::OnPaint(wxPaintEvent& WXUNUSED(event)) -{ - wxPaintDC dc(this); - if (m_bitmap.Ok()) - dc.DrawBitmap(m_bitmap, 0, 0); +#if !defined(__WXGTK__) && wxUSE_PALETTE + bool hiColour = (wxDisplayDepth() >= 16) ; + + if (bitmap.GetPalette() && !hiColour) + { + SetPalette(* bitmap.GetPalette()); + } +#endif + } // VZ: why don't we do it under wxGTK? @@ -131,7 +136,6 @@ static void wxDrawSplashBitmap(wxDC& dc, const wxBitmap& bitmap, int WXUNUSED(x) if (bitmap.GetPalette() && !hiColour) { - dc.SetPalette(* bitmap.GetPalette()); dcMem.SetPalette(* bitmap.GetPalette()); } #endif // USE_PALETTE_IN_SPLASH @@ -143,12 +147,18 @@ static void wxDrawSplashBitmap(wxDC& dc, const wxBitmap& bitmap, int WXUNUSED(x) #ifdef USE_PALETTE_IN_SPLASH if (bitmap.GetPalette() && !hiColour) { - dc.SetPalette(wxNullPalette); dcMem.SetPalette(wxNullPalette); } #endif // USE_PALETTE_IN_SPLASH } +void wxSplashScreenWindow::OnPaint(wxPaintEvent& WXUNUSED(event)) +{ + wxPaintDC dc(this); + if (m_bitmap.Ok()) + wxDrawSplashBitmap(dc, m_bitmap, 0, 0); +} + void wxSplashScreenWindow::OnEraseBackground(wxEraseEvent& event) { if (event.GetDC())