Use wxFileName in wxSVGBitmapFileHandler constructor

This commit is contained in:
Maarten Bent
2019-04-23 21:20:02 +02:00
parent 7e49a3e6c0
commit e32721247a
3 changed files with 8 additions and 8 deletions

View File

@@ -12,6 +12,7 @@
#define _WX_DCSVG_H_ #define _WX_DCSVG_H_
#include "wx/string.h" #include "wx/string.h"
#include "wx/filename.h"
#include "wx/dc.h" #include "wx/dc.h"
#if wxUSE_SVG #if wxUSE_SVG
@@ -49,7 +50,7 @@ public:
{ {
} }
explicit wxSVGBitmapFileHandler(const wxString& path) explicit wxSVGBitmapFileHandler(const wxFileName& path)
: m_path(path) : m_path(path)
{ {
} }
@@ -59,7 +60,7 @@ public:
wxOutputStream& stream) const wxOVERRIDE; wxOutputStream& stream) const wxOVERRIDE;
private: private:
wxString m_path; // When set, will be appended with _image#.png wxFileName m_path; // When set, name will be appended with _image#.png
}; };
// Predefined handler which embeds the bitmap (base64-encoding it) inside the // Predefined handler which embeds the bitmap (base64-encoding it) inside the

View File

@@ -180,7 +180,7 @@ public:
When using wxSVGFileDC::SetBitmapHandler() to set this handler with the When using wxSVGFileDC::SetBitmapHandler() to set this handler with the
default constructor, the PNG files are created in the runtime location of default constructor, the PNG files are created in the runtime location of
the application. The save location can be customized by using the the application. The save location can be customized by using the
wxSVGBitmapFileHandler(const wxString&) constructor. wxSVGBitmapFileHandler(const wxFileName&) constructor.
@see wxSVGFileDC::SetBitmapHandler(). @see wxSVGFileDC::SetBitmapHandler().
@@ -196,13 +196,12 @@ public:
Create a wxSVGBitmapFileHandler and specify the location where the file Create a wxSVGBitmapFileHandler and specify the location where the file
will be saved. will be saved.
@param path The path (with separator) of the save location. If @param path The path of the save location. If @a path contains a
@a path contains a filename, the autogenerated filename will be filename, the autogenerated filename will be appended to this name.
appended to this name.
@since 3.1.3 @since 3.1.3
*/ */
wxSVGBitmapFileHandler(const wxString& path); wxSVGBitmapFileHandler(const wxFileName& path);
virtual bool ProcessBitmap(const wxBitmap& bitmap, virtual bool ProcessBitmap(const wxBitmap& bitmap,
wxCoord x, wxCoord y, wxCoord x, wxCoord y,

View File

@@ -335,7 +335,7 @@ wxSVGBitmapFileHandler::ProcessBitmap(const wxBitmap& bmp,
wxImage::AddHandler(new wxPNGHandler); wxImage::AddHandler(new wxPNGHandler);
// find a suitable file name // find a suitable file name
wxFileName sPNG = wxFileName(m_path); wxFileName sPNG = m_path;
do do
{ {
sPNG.SetFullName(wxString::Format("%s%simage%d.png", sPNG.SetFullName(wxString::Format("%s%simage%d.png",