summaryrefslogtreecommitdiff
path: root/src/mbgl/sprite
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2020-03-20 12:38:09 +0200
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2020-03-23 12:09:09 +0200
commitd15b9c1f9c1afa29175ba2e398adc680e66147e6 (patch)
tree6bf426ae77d7386a6bbdee30444974bbc5dd76d0 /src/mbgl/sprite
parent37802eec36aae3cb84c7f73a48652d9959489243 (diff)
downloadqtlocation-mapboxgl-d15b9c1f9c1afa29175ba2e398adc680e66147e6.tar.gz
[core] Fix performance-unnecessary-value-param errors
As reported by clang-tidy-8.
Diffstat (limited to 'src/mbgl/sprite')
-rw-r--r--src/mbgl/sprite/sprite_parser.cpp17
-rw-r--r--src/mbgl/sprite/sprite_parser.hpp2
2 files changed, 5 insertions, 14 deletions
diff --git a/src/mbgl/sprite/sprite_parser.cpp b/src/mbgl/sprite/sprite_parser.cpp
index 155269cdbc..ac0b7f91f1 100644
--- a/src/mbgl/sprite/sprite_parser.cpp
+++ b/src/mbgl/sprite/sprite_parser.cpp
@@ -25,7 +25,7 @@ std::unique_ptr<style::Image> createStyleImage(const std::string& id,
const bool sdf,
style::ImageStretches&& stretchX,
style::ImageStretches&& stretchY,
- optional<style::ImageContent> content) {
+ const optional<style::ImageContent>& content) {
// Disallow invalid parameter configurations.
if (width <= 0 || height <= 0 || width > 1024 || height > 1024 || ratio <= 0 || ratio > 10 ||
srcX >= image.size.width || srcY >= image.size.height || srcX + width > image.size.width ||
@@ -49,7 +49,7 @@ std::unique_ptr<style::Image> createStyleImage(const std::string& id,
try {
return std::make_unique<style::Image>(
- id, std::move(dstImage), ratio, sdf, std::move(stretchX), std::move(stretchY), std::move(content));
+ id, std::move(dstImage), ratio, sdf, std::move(stretchX), std::move(stretchY), content);
} catch (const util::StyleImageException& ex) {
Log::Error(Event::Sprite, "Can't create image with invalid metadata: %s", ex.what());
return nullptr;
@@ -181,17 +181,8 @@ std::vector<Immutable<style::Image::Impl>> parseSprite(const std::string& encode
style::ImageStretches stretchY = getStretches(value, "stretchY", name.c_str());
optional<style::ImageContent> content = getContent(value, "content", name.c_str());
- auto image = createStyleImage(name,
- raster,
- x,
- y,
- width,
- height,
- pixelRatio,
- sdf,
- std::move(stretchX),
- std::move(stretchY),
- std::move(content));
+ auto image = createStyleImage(
+ name, raster, x, y, width, height, pixelRatio, sdf, std::move(stretchX), std::move(stretchY), content);
if (image) {
images.push_back(std::move(image->baseImpl));
}
diff --git a/src/mbgl/sprite/sprite_parser.hpp b/src/mbgl/sprite/sprite_parser.hpp
index f2e7358ac2..7d545a6d98 100644
--- a/src/mbgl/sprite/sprite_parser.hpp
+++ b/src/mbgl/sprite/sprite_parser.hpp
@@ -17,7 +17,7 @@ std::unique_ptr<style::Image> createStyleImage(const std::string& id,
bool sdf,
style::ImageStretches&& stretchX = {},
style::ImageStretches&& stretchY = {},
- optional<style::ImageContent> content = nullopt);
+ const optional<style::ImageContent>& content = nullopt);
// Parses an image and an associated JSON file and returns the sprite objects.
std::vector<Immutable<style::Image::Impl>> parseSprite(const std::string& image, const std::string& json);