diff options
Diffstat (limited to 'source/base')
-rw-r--r-- | source/base/StarAssets.cpp | 14 | ||||
-rw-r--r-- | source/base/StarAssets.hpp | 4 |
2 files changed, 8 insertions, 10 deletions
diff --git a/source/base/StarAssets.cpp b/source/base/StarAssets.cpp index 6bd9c09..e5313ea 100644 --- a/source/base/StarAssets.cpp +++ b/source/base/StarAssets.cpp @@ -234,11 +234,10 @@ void Assets::queueJsons(StringList const& paths) const { })); } -ImageConstPtr Assets::image(String const& path) const { - auto components = AssetPath::split(path); - validatePath(components, true, true); +ImageConstPtr Assets::image(AssetPath const& path) const { + validatePath(path, true, true); - return as<ImageData>(getAsset(AssetId{AssetType::Image, move(components)}))->image; + return as<ImageData>(getAsset(AssetId{AssetType::Image, path}))->image; } void Assets::queueImages(StringList const& paths) const { @@ -250,11 +249,10 @@ void Assets::queueImages(StringList const& paths) const { })); } -ImageConstPtr Assets::tryImage(String const& path) const { - auto components = AssetPath::split(path); - validatePath(components, true, true); +ImageConstPtr Assets::tryImage(AssetPath const& path) const { + validatePath(path, true, true); - if (auto imageData = as<ImageData>(tryAsset(AssetId{AssetType::Image, move(components)}))) + if (auto imageData = as<ImageData>(tryAsset(AssetId{AssetType::Image, path}))) return imageData->image; else return {}; diff --git a/source/base/StarAssets.hpp b/source/base/StarAssets.hpp index f6dc70a..15b3b50 100644 --- a/source/base/StarAssets.hpp +++ b/source/base/StarAssets.hpp @@ -119,12 +119,12 @@ public: // <full-path-minus-extension>.frames or default.frames, going up to assets // root. May return the same ImageConstPtr for different paths if the paths // are equivalent or they are aliases of other image paths. - ImageConstPtr image(String const& path) const; + ImageConstPtr image(AssetPath const& path) const; // Load images using background processing void queueImages(StringList const& paths) const; // Return the given image *if* it is already loaded, otherwise queue it for // loading. - ImageConstPtr tryImage(String const& path) const; + ImageConstPtr tryImage(AssetPath const& path) const; // Returns the best associated FramesSpecification for a given image path, if // it exists. The given path must not contain sub-paths or directives, and |