[core] Introduce ImageManager::getSharedImage
This commit is contained in:
@@ -84,9 +84,16 @@ void ImageManager::removeImage(const std::string& id) {
|
||||
}
|
||||
|
||||
const style::Image::Impl* ImageManager::getImage(const std::string& id) const {
|
||||
if (auto* image = getSharedImage(id)) {
|
||||
return image->get();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const Immutable<style::Image::Impl>* ImageManager::getSharedImage(const std::string& id) const {
|
||||
const auto it = images.find(id);
|
||||
if (it != images.end()) {
|
||||
return it->second.get();
|
||||
return &(it->second);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ public:
|
||||
void dumpDebugLogs() const;
|
||||
|
||||
const style::Image::Impl* getImage(const std::string&) const;
|
||||
const Immutable<style::Image::Impl>* getSharedImage(const std::string&) const;
|
||||
|
||||
void addImage(Immutable<style::Image::Impl>);
|
||||
bool updateImage(Immutable<style::Image::Impl>);
|
||||
|
||||
Reference in New Issue
Block a user