summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mbgl/text/quads.cpp13
-rw-r--r--src/mbgl/text/shaping.cpp5
2 files changed, 11 insertions, 7 deletions
diff --git a/src/mbgl/text/quads.cpp b/src/mbgl/text/quads.cpp
index 6c517bab2e..9835a488a2 100644
--- a/src/mbgl/text/quads.cpp
+++ b/src/mbgl/text/quads.cpp
@@ -13,10 +13,15 @@ SymbolQuads getIconQuads(Anchor &anchor, const PositionedIcon &shapedIcon,
const std::vector<Coordinate> &line, const StyleLayoutSymbol &layout,
const bool alongLine) {
- vec2<float> tl{shapedIcon.left, shapedIcon.top};
- vec2<float> tr{shapedIcon.right, shapedIcon.top};
- vec2<float> br{shapedIcon.right, shapedIcon.bottom};
- vec2<float> bl{shapedIcon.left, shapedIcon.bottom};
+ const float border = 1.0;
+ auto left = shapedIcon.left - border;
+ auto right = left + shapedIcon.image.w;
+ auto top = shapedIcon.top - border;
+ auto bottom = top + shapedIcon.image.h;
+ vec2<float> tl{left, top};
+ vec2<float> tr{right, top};
+ vec2<float> br{right, bottom};
+ vec2<float> bl{left, bottom};
float angle = layout.icon.rotate * M_PI / 180.0f;
diff --git a/src/mbgl/text/shaping.cpp b/src/mbgl/text/shaping.cpp
index 971b695e49..35fe5dc24b 100644
--- a/src/mbgl/text/shaping.cpp
+++ b/src/mbgl/text/shaping.cpp
@@ -6,11 +6,10 @@ namespace mbgl {
PositionedIcon shapeIcon(const Rect<uint16_t> &image, const StyleLayoutSymbol &layout) {
float dx = layout.icon.offset[0];
float dy = layout.icon.offset[1];
- // TODO, this is image.image.width in -js
float x1 = dx - image.originalW / 2.0f;
- float x2 = x1 + image.w;
+ float x2 = x1 + image.originalW;
float y1 = dy - image.originalH / 2.0f;
- float y2 = y1 + image.h;
+ float y2 = y1 + image.originalH;
return PositionedIcon(image, y1, y2, x1, x2);
}