Add FromSVG() overload taking const data

Passing non-const data is inconvenient and error-prone, as data can't be
used again after it was modified by Nano SVG, which resulted in the
button using SVG bitmap not working any longer in the toolbar sample
after recreating the toolbar.

So make it easier to do the right thing, while still keeping the
overload taking non-const data for the situations when avoiding an extra
copy is worth it.
This commit is contained in:
Vadim Zeitlin 2021-10-02 14:38:08 +01:00
parent 6783df71a7
commit ab619010bd
5 changed files with 23 additions and 9 deletions

View file

@ -67,6 +67,9 @@ public:
// Notice that the data here is non-const because it can be temporarily
// modified while parsing it.
static wxBitmapBundle FromSVG(char* data, const wxSize sizeDef);
// This overload currently makes a copy of the data.
static wxBitmapBundle FromSVG(const char* data, const wxSize sizeDef);
#endif // wxHAS_RAW_BITMAP
// Create from the resources: all existing versions of the bitmap of the