Add additional wxBitmapBundle::FromSVG() overload
This overload can work on non 0 terminated unsigned char arrays. Especially useful for headers created by bin2c.py
This commit is contained in:
parent
ae7fa19ae3
commit
f256e5ae59
@ -76,6 +76,9 @@ public:
|
||||
// This overload currently makes a copy of the data.
|
||||
static wxBitmapBundle FromSVG(const char* data, const wxSize& sizeDef);
|
||||
|
||||
// This overload works for data not terminated with 0
|
||||
static wxBitmapBundle FromSVG(const wxByte* data, size_t len, const wxSize& sizeDef);
|
||||
|
||||
// Load SVG image from the given file (must be a local file, not an URL).
|
||||
static wxBitmapBundle FromSVGFile(const wxString& path, const wxSize& sizeDef);
|
||||
|
||||
|
@ -279,7 +279,7 @@ wxDefaultArtProvider::CreateBitmapBundle(const wxArtID& id,
|
||||
sizeDef = wxSize(16, 16);
|
||||
}
|
||||
|
||||
bb = wxBitmapBundle::FromSVG((const char*)wxlogo_svg_data, sizeDef);
|
||||
bb = wxBitmapBundle::FromSVG(wxlogo_svg_data, sizeof(wxlogo_svg_data), sizeDef);
|
||||
}
|
||||
#else // !wxHAS_SVG
|
||||
wxUnusedVar(id);
|
||||
|
@ -218,6 +218,15 @@ wxBitmapBundle wxBitmapBundle::FromSVG(const char* data, const wxSize& sizeDef)
|
||||
return FromSVG(copy.data(), sizeDef);
|
||||
}
|
||||
|
||||
/* static */
|
||||
wxBitmapBundle wxBitmapBundle::FromSVG(const wxByte* data, size_t len, const wxSize& sizeDef)
|
||||
{
|
||||
wxCharBuffer copy(len);
|
||||
memcpy(copy.data(), data, len);
|
||||
|
||||
return FromSVG(copy.data(), sizeDef);
|
||||
}
|
||||
|
||||
/* static */
|
||||
wxBitmapBundle wxBitmapBundle::FromSVGFile(const wxString& path, const wxSize& sizeDef)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user