GUI: Load SVGs from theme
This commit is contained in:
parent
55ae2e4367
commit
4a58f08a37
2 changed files with 30 additions and 2 deletions
|
@ -33,6 +33,7 @@
|
|||
#include "graphics/cursorman.h"
|
||||
#include "graphics/fontman.h"
|
||||
#include "graphics/surface.h"
|
||||
#include "graphics/svg.h"
|
||||
#include "graphics/transparent_surface.h"
|
||||
#include "graphics/VectorRenderer.h"
|
||||
#include "graphics/fonts/bdf.h"
|
||||
|
@ -265,6 +266,14 @@ ThemeEngine::~ThemeEngine() {
|
|||
}
|
||||
_abitmaps.clear();
|
||||
|
||||
for (SVGMap::iterator i = _svgs.begin(); i != _svgs.end(); ++i) {
|
||||
Graphics::SVGBitmap *svg = i->_value;
|
||||
if (svg) {
|
||||
delete svg;
|
||||
}
|
||||
}
|
||||
_svgs.clear();
|
||||
|
||||
delete _parser;
|
||||
delete _themeEval;
|
||||
delete[] _cursor;
|
||||
|
@ -689,7 +698,7 @@ bool ThemeEngine::addTextColor(TextColor colorId, int r, int g, int b) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ThemeEngine::addBitmap(const Common::String &filename) {
|
||||
bool ThemeEngine::addBitmap(const Common::String &filename, const Common::String &scalablefile) {
|
||||
// Nothing has to be done if the bitmap already has been loaded.
|
||||
Graphics::Surface *surf = _bitmaps[filename];
|
||||
if (surf) {
|
||||
|
@ -745,6 +754,21 @@ bool ThemeEngine::addBitmap(const Common::String &filename) {
|
|||
surf = srcSurface->convertTo(_overlayFormat);
|
||||
}
|
||||
|
||||
if (!scalablefile.empty()) {
|
||||
Graphics::SVGBitmap *image = nullptr;
|
||||
Common::ArchiveMemberList members;
|
||||
_themeFiles.listMatchingMembers(members, filename);
|
||||
for (Common::ArchiveMemberList::const_iterator i = members.begin(), end = members.end(); i != end; ++i) {
|
||||
Common::SeekableReadStream *stream = (*i)->createReadStream();
|
||||
if (stream) {
|
||||
image = new Graphics::SVGBitmap(stream);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_svgs[filename] = image;
|
||||
}
|
||||
|
||||
if (_scaleFactor != 1.0) {
|
||||
Graphics::Surface *tmp2 = surf->scale(surf->w * _scaleFactor, surf->h * _scaleFactor, false);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue