diff options
author | zmiao <miao.zhao@mapbox.com> | 2019-08-26 21:54:59 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-26 21:54:59 +0300 |
commit | c770c2326261ee22b22216538a2eaaed3648bc0d (patch) | |
tree | 03725479de83005554f1d3df3d0c0df25c128a2f /src/mbgl/layout/symbol_instance.hpp | |
parent | dbda6cc9e889278f391e45d952f57c95234b3f55 (diff) | |
download | qtlocation-mapboxgl-c770c2326261ee22b22216538a2eaaed3648bc0d.tar.gz |
[core] fix mixed sdf + non-sdf icon rendering in one layer (#15456)
* [core] fix icon symbol rendring when sdf and non-sdf icon in the same symbol layer
* fix build error
* fix typo
* revert renderableSegment change
* simplify codes
* fix build error
* refine sdf icon flag
* [core] fix mixed sdf + non-sdf icon rendering in one layer
* remove iconstatus getter in stymbol bucket
* fix review findings
* provide bitwise operator for SymbolContent enum
* use MBGL_MBGL_CONSTEXPR
* add one missing update for sdfIcon
* make renderer symbol type as enum
Diffstat (limited to 'src/mbgl/layout/symbol_instance.hpp')
-rw-r--r-- | src/mbgl/layout/symbol_instance.hpp | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/src/mbgl/layout/symbol_instance.hpp b/src/mbgl/layout/symbol_instance.hpp index 60883c12db..7d002d2285 100644 --- a/src/mbgl/layout/symbol_instance.hpp +++ b/src/mbgl/layout/symbol_instance.hpp @@ -4,7 +4,8 @@ #include <mbgl/text/glyph_atlas.hpp> #include <mbgl/text/collision_feature.hpp> #include <mbgl/style/layers/symbol_layer_properties.hpp> - +#include <mbgl/util/traits.hpp> +#include <mbgl/util/util.hpp> namespace mbgl { @@ -42,6 +43,25 @@ struct SymbolInstanceSharedData { optional<SymbolQuad> verticalIconQuad; }; +enum class SymbolContent : uint8_t { + None = 0, + Text = 1 << 0, + IconRGBA = 1 << 1, + IconSDF = 1 << 2 +}; + +MBGL_CONSTEXPR SymbolContent operator|(SymbolContent a, SymbolContent b) { + return SymbolContent(mbgl::underlying_type(a) | mbgl::underlying_type(b)); +} + +MBGL_CONSTEXPR SymbolContent& operator|=(SymbolContent& a, SymbolContent b) { + return (a = a | b); +} + +MBGL_CONSTEXPR SymbolContent operator&(SymbolContent a, SymbolContent b) { + return SymbolContent(mbgl::underlying_type(a) & mbgl::underlying_type(b)); +} + class SymbolInstance { public: SymbolInstance(Anchor& anchor_, @@ -64,7 +84,8 @@ public: const float iconRotation, const float textRotation, float radialTextOffset, - bool allowVerticalPlacement); + bool allowVerticalPlacement, + const SymbolContent iconType = SymbolContent::None); optional<size_t> getDefaultHorizontalPlacedTextIndex() const; const GeometryCoordinates& line() const; @@ -72,6 +93,9 @@ public: const SymbolQuads& leftJustifiedGlyphQuads() const; const SymbolQuads& centerJustifiedGlyphQuads() const; const SymbolQuads& verticalGlyphQuads() const; + bool hasText() const; + bool hasIcon() const; + bool hasSdfIcon() const; const optional<SymbolQuad>& iconQuad() const; const optional<SymbolQuad>& verticalIconQuad() const; void releaseSharedData(); @@ -81,8 +105,7 @@ private: public: Anchor anchor; - bool hasText; - bool hasIcon; + SymbolContent symbolContent; std::size_t rightJustifiedGlyphQuadsSize; std::size_t centerJustifiedGlyphQuadsSize; |