mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-08-18 01:19:45 +08:00
Merge branch 'wxbitmapbundlesvgimpl-refactor' of github.com:MaartenBent/wxWidgets
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 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
No Response / no-response (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 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
No Response / no-response (push) Has been cancelled
Refactor wxBitmapBundleImplSVG: reduce code duplication by adding wxBitmapBundleLunaSVG and wxBitmapBundleNanoSVG that implement DoRasterize(). Allow to use SVG size in wxBitmapBundle::FromSVG() by default. See #26116.
This commit is contained in:
@@ -45,3 +45,4 @@
|
||||
[submodule "3rdparty/lunasvg"]
|
||||
path = 3rdparty/lunasvg
|
||||
url = https://github.com/wxWidgets/lunasvg.git
|
||||
branch = wx
|
||||
|
||||
@@ -16,6 +16,7 @@ set(TEST_SRC
|
||||
arrays/arrays.cpp
|
||||
base64/base64.cpp
|
||||
cmdline/cmdlinetest.cpp
|
||||
config/config.cpp
|
||||
config/fileconf.cpp
|
||||
config/regconf.cpp
|
||||
datetime/datetimetest.cpp
|
||||
@@ -92,6 +93,7 @@ set(TEST_SRC
|
||||
weakref/evtconnection.cpp
|
||||
weakref/weakref.cpp
|
||||
xlocale/xlocale.cpp
|
||||
xml/xmltest.cpp
|
||||
|
||||
testprec.h
|
||||
testableframe.h
|
||||
|
||||
@@ -16,6 +16,7 @@ set(TEST_GUI_SRC
|
||||
geometry/point.cpp
|
||||
geometry/region.cpp
|
||||
graphics/bitmap.cpp
|
||||
graphics/bmpbundle.cpp
|
||||
graphics/colour.cpp
|
||||
graphics/ellipsization.cpp
|
||||
graphics/measuring.cpp
|
||||
@@ -84,6 +85,7 @@ set(TEST_GUI_SRC
|
||||
controls/windowtest.cpp
|
||||
controls/dialogtest.cpp
|
||||
events/clone.cpp
|
||||
events/enterleave.cpp
|
||||
# Duplicate this file here to test GUI event loops too.
|
||||
events/evtlooptest.cpp
|
||||
events/propagation.cpp
|
||||
@@ -105,6 +107,7 @@ set(TEST_GUI_SRC
|
||||
misc/garbage.cpp
|
||||
misc/safearrayconverttest.cpp
|
||||
misc/settings.cpp
|
||||
misc/textwrap.cpp
|
||||
# This one is intentionally duplicated here (it is also part of
|
||||
# non-GUI test) as sockets behave differently in console and GUI
|
||||
# applications.
|
||||
|
||||
@@ -285,8 +285,8 @@ public:
|
||||
extra parameter explicitly specifying the length of the input data,
|
||||
@e must be used.
|
||||
@param sizeDef The default size to return from GetDefaultSize() for
|
||||
this bundle. As SVG images usually don't have any natural
|
||||
default size, it should be provided when creating the bundle.
|
||||
this bundle. If an empty wxSize or wxDefaultSize is provided,
|
||||
the size of the SVG will be the default size.
|
||||
|
||||
@note Converting text objects to path objects will allow them to be
|
||||
rasterized as expected. This can be done in an SVG editor such as
|
||||
@@ -322,7 +322,8 @@ public:
|
||||
@param path Path to the SVG file. Notice that it should a local file,
|
||||
not an URL.
|
||||
@param sizeDef The default size to return from GetDefaultSize() for
|
||||
this bundle.
|
||||
this bundle. If an empty wxSize or wxDefaultSize is provided,
|
||||
the size of the SVG will be the default size.
|
||||
*/
|
||||
static wxBitmapBundle FromSVGFile(const wxString& path, const wxSize& sizeDef);
|
||||
|
||||
@@ -335,7 +336,8 @@ public:
|
||||
On MacOS, it must be a file with an extension "svg" placed in
|
||||
the "Resources" subdirectory of the application bundle.
|
||||
@param sizeDef The default size to return from GetDefaultSize() for
|
||||
this bundle.
|
||||
this bundle. If an empty wxSize or wxDefaultSize is provided,
|
||||
the size of the SVG will be the default size.
|
||||
|
||||
@see FromResources(), FromSVGFile()
|
||||
*/
|
||||
|
||||
@@ -1359,9 +1359,7 @@ void MyFrame::OnNewSVGFrame(wxCommandEvent&)
|
||||
if ( filename.empty() )
|
||||
return;
|
||||
|
||||
// The default size here is completely arbitrary, as we don't know anything
|
||||
// about the SVG being loaded.
|
||||
wxBitmapBundle bb = wxBitmapBundle::FromSVGFile(filename, wxSize(200, 200));
|
||||
wxBitmapBundle bb = wxBitmapBundle::FromSVGFile(filename, wxDefaultSize);
|
||||
if ( !bb.IsOk() )
|
||||
return;
|
||||
|
||||
|
||||
+197
-295
File diff suppressed because it is too large
Load Diff
@@ -18,9 +18,9 @@
|
||||
|
||||
#include "wx/dcmemory.h"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef __WXMSW__
|
||||
#include "wx/msw/private/resource_usage.h"
|
||||
#endif // __WINDOWS__
|
||||
#endif // __WXMSW__
|
||||
|
||||
static void TestStaticBitmap(wxWindow* window, double scale)
|
||||
{
|
||||
@@ -60,7 +60,7 @@ TEST_CASE("wxStaticBitmap::Set", "[wxStaticBitmap][bitmap]")
|
||||
TestStaticBitmap(window, window->GetDPIScaleFactor());
|
||||
}
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef __WXMSW__
|
||||
|
||||
TEST_CASE("wxStaticBitmap::ResourceLeak", "[wxStaticBitmap]")
|
||||
{
|
||||
@@ -84,6 +84,6 @@ TEST_CASE("wxStaticBitmap::ResourceLeak", "[wxStaticBitmap]")
|
||||
CHECK( usageAfter.numGDI == usageBefore.numGDI );
|
||||
}
|
||||
|
||||
#endif // __WINDOWS__
|
||||
#endif // __WXMSW__
|
||||
|
||||
#endif // wxUSE_STATBMP
|
||||
|
||||
+11
-11
@@ -60,7 +60,7 @@ TEST_CASE("EnterLeaveEvents", "[wxEvent][enter-leave]")
|
||||
SECTION("Without mouse capture")
|
||||
{
|
||||
sim.MouseMove(panel->GetScreenPosition() + wxPoint(5, 5));
|
||||
wxYield();
|
||||
YieldForAWhile();
|
||||
|
||||
CHECK( enter.GetCount() == 1 );
|
||||
CHECK( leave.GetCount() == 0 );
|
||||
@@ -68,7 +68,7 @@ TEST_CASE("EnterLeaveEvents", "[wxEvent][enter-leave]")
|
||||
enter.Clear();
|
||||
|
||||
sim.MouseMove(button->GetScreenPosition() + wxPoint(5, 5));
|
||||
wxYield();
|
||||
YieldForAWhile();
|
||||
|
||||
// The parent window (panel) should receive wxEVT_LEAVE_WINDOW event
|
||||
// when mouse enters the child window (button)
|
||||
@@ -78,7 +78,7 @@ TEST_CASE("EnterLeaveEvents", "[wxEvent][enter-leave]")
|
||||
leave.Clear();
|
||||
|
||||
sim.MouseMove(panel->GetScreenPosition() + wxPoint(5, 5));
|
||||
wxYield();
|
||||
YieldForAWhile();
|
||||
|
||||
// Now it (panel) should receive wxEVT_ENTER_WINDOW event when
|
||||
// the mouse leaves the button and enters the panel again.
|
||||
@@ -92,10 +92,10 @@ TEST_CASE("EnterLeaveEvents", "[wxEvent][enter-leave]")
|
||||
EventCounter clicked(button, wxEVT_BUTTON);
|
||||
|
||||
sim.MouseMove(button->GetScreenPosition() + wxPoint(5, 5));
|
||||
wxYield();
|
||||
YieldForAWhile();
|
||||
|
||||
sim.MouseClick();
|
||||
wxYield();
|
||||
YieldForAWhile();
|
||||
|
||||
CHECK( clicked.GetCount() == 1 );
|
||||
|
||||
@@ -103,7 +103,7 @@ TEST_CASE("EnterLeaveEvents", "[wxEvent][enter-leave]")
|
||||
leave.Clear();
|
||||
|
||||
sim.MouseDown();
|
||||
wxYield();
|
||||
YieldForAWhile();
|
||||
|
||||
#if defined(__WXGTK__) && !defined(__WXGTK3__)
|
||||
if ( IsAutomaticTest() )
|
||||
@@ -113,7 +113,7 @@ TEST_CASE("EnterLeaveEvents", "[wxEvent][enter-leave]")
|
||||
}
|
||||
#endif
|
||||
sim.MouseMove(button->GetScreenPosition() + wxPoint(10, 5));
|
||||
wxYield();
|
||||
YieldForAWhile();
|
||||
|
||||
// Holding the mouse button down (initiated on the button) and then
|
||||
// hovering over the panel should not generate any events (enter/leave)
|
||||
@@ -121,25 +121,25 @@ TEST_CASE("EnterLeaveEvents", "[wxEvent][enter-leave]")
|
||||
// mouse is still held down should also not generate any events.
|
||||
|
||||
sim.MouseMove(panel->GetScreenPosition() + wxPoint(5, 5));
|
||||
wxYield();
|
||||
YieldForAWhile();
|
||||
|
||||
CHECK( enter.GetCount() == 0 );
|
||||
CHECK( leave.GetCount() == 0 );
|
||||
|
||||
sim.MouseMove(textctrl->GetScreenPosition() + wxPoint(5, 5));
|
||||
wxYield();
|
||||
YieldForAWhile();
|
||||
|
||||
CHECK( enter.GetCount() == 0 );
|
||||
CHECK( leave.GetCount() == 0 );
|
||||
|
||||
sim.MouseMove(panel->GetScreenPosition() + wxPoint(5, 5));
|
||||
wxYield();
|
||||
YieldForAWhile();
|
||||
|
||||
CHECK( enter.GetCount() == 0 );
|
||||
CHECK( leave.GetCount() == 0 );
|
||||
|
||||
sim.MouseUp();
|
||||
wxYield();
|
||||
YieldForAWhile();
|
||||
|
||||
// wxGTK behaves differently here, as it does not generate a
|
||||
// wxEVT_ENTER_WINDOW event when we release the mouse button.
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
#include "wx/dcmemory.h"
|
||||
#include "wx/imaglist.h"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef __WXMSW__
|
||||
#include "wx/msw/private/resource_usage.h"
|
||||
#endif // __WINDOWS__
|
||||
#endif // __WXMSW__
|
||||
|
||||
#include "asserthelper.h"
|
||||
|
||||
@@ -77,7 +77,7 @@ TEST_CASE("BitmapBundle::GetBitmap", "[bmpbundle]")
|
||||
CHECK( b.GetBitmap(wxSize(48, 48)).GetSize() == wxSize(48, 48) );
|
||||
}
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#ifdef __WXMSW__
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -134,7 +134,7 @@ TEST_CASE("BitmapBundle::ResourceLeak", "[bmpbundle]")
|
||||
CHECK( usageAfter.numGDI - usageBefore.numGDI < 10 );
|
||||
}
|
||||
|
||||
#endif // __WINDOWS__
|
||||
#endif // __WXMSW__
|
||||
|
||||
// Helper functions for the test below.
|
||||
namespace
|
||||
|
||||
Reference in New Issue
Block a user