summaryrefslogtreecommitdiff
path: root/src/mbgl/text/tagged_string.cpp
diff options
context:
space:
mode:
authorAlexander Shalamov <alexander.shalamov@mapbox.com>2019-03-11 10:26:19 +0200
committerAlexander Shalamov <alexander.shalamov@mapbox.com>2019-03-13 17:14:53 +0200
commit8be135231d9efe41a3b12037518d02b36104e8cf (patch)
treeefecd5380232f899aed2cd5824dc16f057f0469a /src/mbgl/text/tagged_string.cpp
parent8a51362bccbd6487dd1ed8518443b16ba6114fd8 (diff)
downloadqtlocation-mapboxgl-8be135231d9efe41a3b12037518d02b36104e8cf.tar.gz
[core] Add possibility of overriding paint properties inside format expression #14062
* [core] Add format override expression and formatted section to evaluation context * [core] Add textColor to TaggedString's formatted section * [core] Add FormatSectionOverrides and introduce overridable properties * [core] Populate symbol layer paint properties for text sections * [core] Add benchmark for style that uses text-color override * [core] Add unit test for FormatOverrideExpression * [core] Add unit test for FormatSectionOverrides
Diffstat (limited to 'src/mbgl/text/tagged_string.cpp')
-rw-r--r--src/mbgl/text/tagged_string.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mbgl/text/tagged_string.cpp b/src/mbgl/text/tagged_string.cpp
index 851e011c4f..8c4e3b02e8 100644
--- a/src/mbgl/text/tagged_string.cpp
+++ b/src/mbgl/text/tagged_string.cpp
@@ -1,11 +1,12 @@
#include <mbgl/text/tagged_string.hpp>
+#include <mbgl/math/minmax.hpp>
#include <mbgl/util/i18n.hpp>
namespace mbgl {
-void TaggedString::addSection(const std::u16string& sectionText, double scale, FontStackHash fontStack) {
+void TaggedString::addSection(const std::u16string& sectionText, double scale, FontStack fontStack, optional<Color> textColor) {
styledText.first += sectionText;
- sections.emplace_back(scale, fontStack);
+ sections.emplace_back(scale, fontStack, std::move(textColor));
styledText.second.resize(styledText.first.size(), sections.size() - 1);
}
@@ -26,7 +27,7 @@ void TaggedString::trim() {
double TaggedString::getMaxScale() const {
double maxScale = 0.0;
for (std::size_t i = 0; i < styledText.first.length(); i++) {
- maxScale = std::max(maxScale, getSection(i).scale);
+ maxScale = util::max(maxScale, getSection(i).scale);
}
return maxScale;
}