summaryrefslogtreecommitdiff
path: root/src/mbgl/text/shaping.cpp
diff options
context:
space:
mode:
authorAnsis Brammanis <brammanis@gmail.com>2015-03-31 15:33:57 -0700
committerAnsis Brammanis <brammanis@gmail.com>2015-03-31 15:33:57 -0700
commit9309f59de3e156432087b55f0f7e3ebc026b78e8 (patch)
treedf786aef3dd6a787d572b04b2f30ba607f364526 /src/mbgl/text/shaping.cpp
parent7b29c5b2576d687fb8491291f1f28b09020100de (diff)
downloadqtlocation-mapboxgl-9309f59de3e156432087b55f0f7e3ebc026b78e8.tar.gz
split generating symbol quads from collision code
Collision prevention is temporarily disabled.
Diffstat (limited to 'src/mbgl/text/shaping.cpp')
-rw-r--r--src/mbgl/text/shaping.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mbgl/text/shaping.cpp b/src/mbgl/text/shaping.cpp
new file mode 100644
index 0000000000..971b695e49
--- /dev/null
+++ b/src/mbgl/text/shaping.cpp
@@ -0,0 +1,18 @@
+#include <mbgl/text/shaping.hpp>
+#include <mbgl/style/style_layout.hpp>
+
+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 y1 = dy - image.originalH / 2.0f;
+ float y2 = y1 + image.h;
+
+ return PositionedIcon(image, y1, y2, x1, x2);
+}
+
+}