From c0bbcd2c71f5055637f3bcb6a545f073e97eb429 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Sun, 30 Nov 2025 17:09:13 +0100 Subject: [PATCH] Allow images in higher resolution to be stored in own folder - The is an alternative used in other toolkits --- interface/wx/bmpbndl.h | 3 ++- src/common/bmpbndl.cpp | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/interface/wx/bmpbndl.h b/interface/wx/bmpbndl.h index eecb99ff8f..f8dd13660c 100644 --- a/interface/wx/bmpbndl.h +++ b/interface/wx/bmpbndl.h @@ -232,7 +232,8 @@ public: Create a bundle from bitmaps stored as files. Looking in @a path for files using @a filename as prefix and potentionally a - suffix with scale, e.g. "_2x" or "@2x" + suffix with scale, e.g. "_2x" or "@2x". Alternatively, it will look for + files with the same filename in a directory "2.0x/" (@since 3.3.2). @param path Path of the directory containing the files @param filename Bitmap's filename without any scale suffix diff --git a/src/common/bmpbndl.cpp b/src/common/bmpbndl.cpp index a9ecf66e2a..f97ab40a40 100644 --- a/src/common/bmpbndl.cpp +++ b/src/common/bmpbndl.cpp @@ -529,6 +529,12 @@ wxBitmapBundle wxBitmapBundle::FromFiles(const wxString& path, const wxString& f fn.SetName(wxString::Format("%s_%dx", filename, dpiFactor)); } + if ( !fn.FileExists() && dpiFactor != 1 ) + { + // try /2.0x/image.png naming scheme + fn.AppendDir( wxString::Format("%d.0x", dpiFactor)); + } + if ( fn.FileExists() ) { wxBitmap bmp(fn.GetFullPath(), wxBITMAP_TYPE_ANY);