mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-24 07:24:31 +08:00
Simplify wxSplashScreen drawing code
Unix builds / Ubuntu 18.04 wxGTK 3 compatible 3.0 (push) Has been cancelled
Unix builds / Ubuntu 24.04 wxGTK ASAN not compatible (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK UTF-8 (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxQt (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxX11 (push) Has been cancelled
Unix builds / Ubuntu 20.04 wxGTK 3 with clang (push) Has been cancelled
Unix builds / Ubuntu 22.04 wxGTK with wx containers (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxDFB (push) Has been cancelled
Unix builds / Ubuntu 24.04 wxGTK UBSAN (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK 3 static with gcc 4.8 (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK 2 (push) Has been cancelled
CMake builds / Ubuntu 22.04 wxGTK 3 (push) Has been cancelled
CMake builds / macOS latest wxGTK 3 Unix Makefiles (push) Has been cancelled
CMake builds / MSW/MSVC wxMSW (push) Has been cancelled
CMake builds / MSW/Clang wxMSW (push) Has been cancelled
CMake builds / macOS latest wxOSX Ninja (push) Has been cancelled
CMake builds / macOS 14 wxOSX Xcode (push) Has been cancelled
CMake builds / macOS 14 wxIOS (push) Has been cancelled
CMake builds / MSW/MSVC wxQt 5.15 (push) Has been cancelled
CMake builds / MSW/MSVC wxQt 6.10 (push) Has been cancelled
Mac builds / wxMac ARM ASAN not compatible (push) Has been cancelled
Mac builds / wxMac Universal C++14 (push) Has been cancelled
Mac builds / wxiOS Simulator on Silicon Mac (push) Has been cancelled
Mac builds / wxiOS (push) Has been cancelled
Mac builds / wxMac Intel C++17 (push) Has been cancelled
Mac Xcode builds / iOS Simulator static (push) Has been cancelled
Mac Xcode builds / macOS dynamic Release (push) Has been cancelled
Mac Xcode builds / iOS static Debug (push) Has been cancelled
MSW builds / wxMSW vs2022 DLL Debug x64 (push) Has been cancelled
MSW builds / wxMSW vs2022 DLL Release x64 (push) Has been cancelled
MSW builds / wxMSW vs2022 Debug Win32 (push) Has been cancelled
MSW builds / wxMSW vs2022 Release arm64 (push) Has been cancelled
MSW builds / wxMSW vs2026 DLL Release x64 (push) Has been cancelled
MSW cross-builds / wxMSW 64 bits not compatible (push) Has been cancelled
MSW cross-builds / wxMSW/Univ (push) Has been cancelled
MSW cross-builds / wxMSW 32 bits (push) Has been cancelled
Code Checks / Check Spelling (push) Has been cancelled
Code Checks / Check Whitespace (push) Has been cancelled
Code Checks / Check Mixed EOL (push) Has been cancelled
Code Checks / Check C++ Style (push) Has been cancelled
Code Checks / Check All Headers In allheaders.h (push) Has been cancelled
Update Documentation / Update Online Documentation (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK 3 compatible 3.0 (push) Has been cancelled
Unix builds / Ubuntu 24.04 wxGTK ASAN not compatible (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK UTF-8 (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxQt (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxX11 (push) Has been cancelled
Unix builds / Ubuntu 20.04 wxGTK 3 with clang (push) Has been cancelled
Unix builds / Ubuntu 22.04 wxGTK with wx containers (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxDFB (push) Has been cancelled
Unix builds / Ubuntu 24.04 wxGTK UBSAN (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK 3 static with gcc 4.8 (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK 2 (push) Has been cancelled
CMake builds / Ubuntu 22.04 wxGTK 3 (push) Has been cancelled
CMake builds / macOS latest wxGTK 3 Unix Makefiles (push) Has been cancelled
CMake builds / MSW/MSVC wxMSW (push) Has been cancelled
CMake builds / MSW/Clang wxMSW (push) Has been cancelled
CMake builds / macOS latest wxOSX Ninja (push) Has been cancelled
CMake builds / macOS 14 wxOSX Xcode (push) Has been cancelled
CMake builds / macOS 14 wxIOS (push) Has been cancelled
CMake builds / MSW/MSVC wxQt 5.15 (push) Has been cancelled
CMake builds / MSW/MSVC wxQt 6.10 (push) Has been cancelled
Mac builds / wxMac ARM ASAN not compatible (push) Has been cancelled
Mac builds / wxMac Universal C++14 (push) Has been cancelled
Mac builds / wxiOS Simulator on Silicon Mac (push) Has been cancelled
Mac builds / wxiOS (push) Has been cancelled
Mac builds / wxMac Intel C++17 (push) Has been cancelled
Mac Xcode builds / iOS Simulator static (push) Has been cancelled
Mac Xcode builds / macOS dynamic Release (push) Has been cancelled
Mac Xcode builds / iOS static Debug (push) Has been cancelled
MSW builds / wxMSW vs2022 DLL Debug x64 (push) Has been cancelled
MSW builds / wxMSW vs2022 DLL Release x64 (push) Has been cancelled
MSW builds / wxMSW vs2022 Debug Win32 (push) Has been cancelled
MSW builds / wxMSW vs2022 Release arm64 (push) Has been cancelled
MSW builds / wxMSW vs2026 DLL Release x64 (push) Has been cancelled
MSW cross-builds / wxMSW 64 bits not compatible (push) Has been cancelled
MSW cross-builds / wxMSW/Univ (push) Has been cancelled
MSW cross-builds / wxMSW 32 bits (push) Has been cancelled
Code Checks / Check Spelling (push) Has been cancelled
Code Checks / Check Whitespace (push) Has been cancelled
Code Checks / Check Mixed EOL (push) Has been cancelled
Code Checks / Check C++ Style (push) Has been cancelled
Code Checks / Check All Headers In allheaders.h (push) Has been cancelled
Update Documentation / Update Online Documentation (push) Has been cancelled
Use wxBG_STYLE_PAINT, remove all the EVT_ERASE_BACKGROUND stuff, and just draw the bitmap in the paint handler.
This commit is contained in:
+2
-50
@@ -20,7 +20,6 @@
|
||||
#include "wx/splash.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/dcmemory.h"
|
||||
#include "wx/dcclient.h"
|
||||
#endif
|
||||
|
||||
@@ -130,10 +129,7 @@ void wxSplashScreen::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxBEGIN_EVENT_TABLE(wxSplashScreenWindow, wxWindow)
|
||||
#ifdef __WXGTK__
|
||||
EVT_PAINT(wxSplashScreenWindow::OnPaint)
|
||||
#endif
|
||||
EVT_ERASE_BACKGROUND(wxSplashScreenWindow::OnEraseBackground)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
wxSplashScreenWindow::wxSplashScreenWindow(const wxBitmap& bitmap, wxWindow* parent,
|
||||
@@ -142,6 +138,7 @@ wxSplashScreenWindow::wxSplashScreenWindow(const wxBitmap& bitmap, wxWindow* par
|
||||
: wxWindow(parent, id, pos, size, style)
|
||||
, m_bitmap(bitmap)
|
||||
{
|
||||
SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
|
||||
#if !defined(__WXGTK__) && wxUSE_PALETTE
|
||||
bool hiColour = (wxDisplayDepth() >= 16) ;
|
||||
@@ -153,56 +150,11 @@ wxSplashScreenWindow::wxSplashScreenWindow(const wxBitmap& bitmap, wxWindow* par
|
||||
#endif
|
||||
}
|
||||
|
||||
// VZ: why don't we do it under wxGTK?
|
||||
#if !defined(__WXGTK__) && wxUSE_PALETTE
|
||||
#define USE_PALETTE_IN_SPLASH
|
||||
#endif
|
||||
|
||||
static void wxDrawSplashBitmap(wxDC& dc, const wxBitmap& bitmap, int WXUNUSED(x), int WXUNUSED(y))
|
||||
{
|
||||
wxMemoryDC dcMem;
|
||||
|
||||
#ifdef USE_PALETTE_IN_SPLASH
|
||||
bool hiColour = (wxDisplayDepth() >= 16) ;
|
||||
|
||||
if (bitmap.GetPalette() && !hiColour)
|
||||
{
|
||||
dcMem.SetPalette(* bitmap.GetPalette());
|
||||
}
|
||||
#endif // USE_PALETTE_IN_SPLASH
|
||||
|
||||
dcMem.SelectObjectAsSource(bitmap);
|
||||
dc.Blit(0, 0, bitmap.GetLogicalWidth(), bitmap.GetLogicalHeight(), &dcMem, 0, 0, wxCOPY,
|
||||
true /* use mask */);
|
||||
dcMem.SelectObject(wxNullBitmap);
|
||||
|
||||
#ifdef USE_PALETTE_IN_SPLASH
|
||||
if (bitmap.GetPalette() && !hiColour)
|
||||
{
|
||||
dcMem.SetPalette(wxNullPalette);
|
||||
}
|
||||
#endif // USE_PALETTE_IN_SPLASH
|
||||
}
|
||||
|
||||
void wxSplashScreenWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
if (m_bitmap.IsOk())
|
||||
wxDrawSplashBitmap(dc, m_bitmap, 0, 0);
|
||||
}
|
||||
|
||||
void wxSplashScreenWindow::OnEraseBackground(wxEraseEvent& event)
|
||||
{
|
||||
if (event.GetDC() && m_bitmap.IsOk())
|
||||
{
|
||||
wxDrawSplashBitmap(* event.GetDC(), m_bitmap, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxClientDC dc(this);
|
||||
if (m_bitmap.IsOk())
|
||||
wxDrawSplashBitmap(dc, m_bitmap, 0, 0);
|
||||
}
|
||||
dc.DrawBitmap(m_bitmap, 0, 0, true);
|
||||
}
|
||||
|
||||
#endif // wxUSE_SPLASH
|
||||
|
||||
Reference in New Issue
Block a user