summaryrefslogtreecommitdiff
path: root/src/mbgl/layout
diff options
context:
space:
mode:
authorAlexander Shalamov <alexander.shalamov@mapbox.com>2019-11-14 15:23:15 +0200
committerAlexander Shalamov <alexander.shalamov@mapbox.com>2019-12-02 17:11:49 +0200
commit2c49c4374cb9e3654c1d347b1071542918ce5fd2 (patch)
tree9791f6f960939e92a5c891160d86065cc0cf0184 /src/mbgl/layout
parent2bb2a40b6d13d4fe44e8879003a3e53416033a34 (diff)
downloadqtlocation-mapboxgl-2c49c4374cb9e3654c1d347b1071542918ce5fd2.tar.gz
[core] Store 'sdf' flag in vertex attribute
Diffstat (limited to 'src/mbgl/layout')
-rw-r--r--src/mbgl/layout/symbol_instance.cpp6
-rw-r--r--src/mbgl/layout/symbol_instance.hpp10
-rw-r--r--src/mbgl/layout/symbol_layout.cpp13
3 files changed, 16 insertions, 13 deletions
diff --git a/src/mbgl/layout/symbol_instance.cpp b/src/mbgl/layout/symbol_instance.cpp
index d48a3af388..094f859830 100644
--- a/src/mbgl/layout/symbol_instance.cpp
+++ b/src/mbgl/layout/symbol_instance.cpp
@@ -26,13 +26,15 @@ SymbolInstanceSharedData::SymbolInstanceSharedData(GeometryCoordinates line_,
const style::SymbolPlacementType textPlacement,
const std::array<float, 2>& textOffset,
const ImageMap& imageMap,
+ SymbolContent iconType,
bool allowVerticalPlacement)
: line(std::move(line_)) {
// Create the quads used for rendering the icon and glyphs.
if (shapedIcon) {
- iconQuad = getIconQuad(*shapedIcon, getAnyShaping(shapedTextOrientations).writingMode);
+ iconQuad = getIconQuad(*shapedIcon, getAnyShaping(shapedTextOrientations).writingMode, iconType);
if (verticallyShapedIcon) {
- verticalIconQuad = getIconQuad(*verticallyShapedIcon, shapedTextOrientations.vertical.writingMode);
+ verticalIconQuad =
+ getIconQuad(*verticallyShapedIcon, shapedTextOrientations.vertical.writingMode, iconType);
}
}
diff --git a/src/mbgl/layout/symbol_instance.hpp b/src/mbgl/layout/symbol_instance.hpp
index bc2ff48d33..e20c05a0ab 100644
--- a/src/mbgl/layout/symbol_instance.hpp
+++ b/src/mbgl/layout/symbol_instance.hpp
@@ -21,6 +21,8 @@ struct ShapedTextOrientations {
bool singleLine = false;
};
+enum class SymbolContent : uint8_t { None = 0, Text = 1 << 0, IconRGBA = 1 << 1, IconSDF = 1 << 2 };
+
struct SymbolInstanceSharedData {
SymbolInstanceSharedData(GeometryCoordinates line,
const ShapedTextOrientations& shapedTextOrientations,
@@ -30,6 +32,7 @@ struct SymbolInstanceSharedData {
const style::SymbolPlacementType textPlacement,
const std::array<float, 2>& textOffset,
const ImageMap& imageMap,
+ SymbolContent iconType,
bool allowVerticalPlacement);
bool empty() const;
GeometryCoordinates line;
@@ -42,13 +45,6 @@ struct SymbolInstanceSharedData {
optional<SymbolQuad> verticalIconQuad;
};
-enum class SymbolContent : uint8_t {
- None = 0,
- Text = 1 << 0,
- IconRGBA = 1 << 1,
- IconSDF = 1 << 2
-};
-
class SymbolInstance {
public:
SymbolInstance(Anchor& anchor_,
diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp
index 1207c1c668..c03ad8835f 100644
--- a/src/mbgl/layout/symbol_layout.cpp
+++ b/src/mbgl/layout/symbol_layout.cpp
@@ -597,6 +597,7 @@ void SymbolLayout::addFeature(const std::size_t layoutFeatureIndex,
textPlacement,
textOffset,
imageMap,
+ iconType,
allowVerticalPlacement);
};
@@ -864,10 +865,14 @@ size_t SymbolLayout::addSymbol(SymbolBucket::Buffer& buffer,
uint16_t index = segment.vertexLength;
// coordinates (2 triangles)
- buffer.vertices.emplace_back(SymbolSDFIconProgram::layoutVertex(labelAnchor.point, tl, symbol.glyphOffset.y, tex.x, tex.y, sizeData));
- buffer.vertices.emplace_back(SymbolSDFIconProgram::layoutVertex(labelAnchor.point, tr, symbol.glyphOffset.y, tex.x + tex.w, tex.y, sizeData));
- buffer.vertices.emplace_back(SymbolSDFIconProgram::layoutVertex(labelAnchor.point, bl, symbol.glyphOffset.y, tex.x, tex.y + tex.h, sizeData));
- buffer.vertices.emplace_back(SymbolSDFIconProgram::layoutVertex(labelAnchor.point, br, symbol.glyphOffset.y, tex.x + tex.w, tex.y + tex.h, sizeData));
+ buffer.vertices.emplace_back(SymbolSDFIconProgram::layoutVertex(
+ labelAnchor.point, tl, symbol.glyphOffset.y, tex.x, tex.y, sizeData, symbol.isSDF));
+ buffer.vertices.emplace_back(SymbolSDFIconProgram::layoutVertex(
+ labelAnchor.point, tr, symbol.glyphOffset.y, tex.x + tex.w, tex.y, sizeData, symbol.isSDF));
+ buffer.vertices.emplace_back(SymbolSDFIconProgram::layoutVertex(
+ labelAnchor.point, bl, symbol.glyphOffset.y, tex.x, tex.y + tex.h, sizeData, symbol.isSDF));
+ buffer.vertices.emplace_back(SymbolSDFIconProgram::layoutVertex(
+ labelAnchor.point, br, symbol.glyphOffset.y, tex.x + tex.w, tex.y + tex.h, sizeData, symbol.isSDF));
// Dynamic/Opacity vertices are initialized so that the vertex count always agrees with
// the layout vertex buffer, but they will always be updated before rendering happens