summaryrefslogtreecommitdiff
path: root/src/geometry
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-02-06 15:14:51 +0100
committerKonstantin Käfer <mail@kkaefer.com>2014-02-06 15:14:51 +0100
commit33beb081f5e72090abd5f4b70286971f7eccf347 (patch)
tree67794a93eb524facf42897586224a0eee2054faf /src/geometry
parented4072bdd13262ff54bab86e08192163dad41b6f (diff)
parent7d271cca02e2b5d73023c317d04f81c17139b6fe (diff)
downloadqtlocation-mapboxgl-33beb081f5e72090abd5f4b70286971f7eccf347.tar.gz
Merge branch 'master' of https://github.com/mapbox/llmr-native
Conflicts: src/geometry/debug_font.cpp
Diffstat (limited to 'src/geometry')
-rw-r--r--src/geometry/debug_font.cpp4
-rw-r--r--src/geometry/debug_font_buffer.cpp2
-rw-r--r--src/geometry/fill_buffer.cpp12
-rw-r--r--src/geometry/line_buffer.cpp4
-rw-r--r--src/geometry/vertex_buffer.cpp2
5 files changed, 13 insertions, 11 deletions
diff --git a/src/geometry/debug_font.cpp b/src/geometry/debug_font.cpp
index 8e79991895..2da0c67841 100644
--- a/src/geometry/debug_font.cpp
+++ b/src/geometry/debug_font.cpp
@@ -97,7 +97,7 @@ const int8_t simplex_93[] = { 5, 25, 7, 24, 8, 23, 9, 21, 9, 19, 8, 17, 7, 16, 6
const int8_t simplex_94[] = { 3, 6, 3, 8, 4, 11, 6, 12, 8, 12, 10, 11, 14, 8, 16, 7, 18, 7, 20, 8, 21, 10, -1, -1, 3, 8, 4, 10, 6, 11, 8, 11, 10, 10, 14, 7, 16, 6, 18, 6, 20, 7, 21, 10, 21, 12 };
struct glyph {
- glyph() : width(0), length(0), data(NULL) { }
+ glyph() : width(0), length(0), data(nullptr) { }
glyph(uint8_t width, uint8_t length, const int8_t *data)
: width(width),
length(length),
@@ -110,7 +110,7 @@ struct glyph {
// Font data From Hershey Simplex Font
// http://paulbourke.net/dataformats/hershey/
const std::map<char, glyph> simplex = {
- { ' ', { 16, 0, NULL } },
+ { ' ', { 16, 0, nullptr } },
{ '!', { 10, sizeof(simplex_1), simplex_1 } },
{ '"', { 16, sizeof(simplex_2), simplex_2 } },
{ '#', { 21, sizeof(simplex_3), simplex_3 } },
diff --git a/src/geometry/debug_font_buffer.cpp b/src/geometry/debug_font_buffer.cpp
index de0394c113..7316ca21cd 100644
--- a/src/geometry/debug_font_buffer.cpp
+++ b/src/geometry/debug_font_buffer.cpp
@@ -22,7 +22,7 @@ DebugFontBuffer::~DebugFontBuffer() {
void DebugFontBuffer::addText(const char *text, double left, double baseline, double scale) {
int32_t length = strlen(text);
- for (int32_t i = 0; i < length; i++) {
+ for (int32_t i = 0; i < length; ++i) {
if (text[i] < 32 || text[i] > 127) {
continue;
}
diff --git a/src/geometry/fill_buffer.cpp b/src/geometry/fill_buffer.cpp
index 36d2765382..ba6cfcb409 100644
--- a/src/geometry/fill_buffer.cpp
+++ b/src/geometry/fill_buffer.cpp
@@ -1,6 +1,8 @@
#include <llmr/geometry/fill_buffer.hpp>
#include <llmr/platform/gl.hpp>
+#include <climits>
+
using namespace llmr;
FillBuffer::FillBuffer()
@@ -32,16 +34,16 @@ uint32_t FillBuffer::elements_length() const {
}
void FillBuffer::addDegenerate() {
- vertices.push_back(32767);
+ vertices.push_back(std::numeric_limits<vertex_type>::max());
vertices.push_back(0);
}
-void FillBuffer::addCoordinate(int16_t x, int16_t y) {
+void FillBuffer::addCoordinate(vertex_type x, vertex_type y) {
vertices.push_back(x);
vertices.push_back(y);
}
-void FillBuffer::addElements(uint16_t a, uint16_t b, uint16_t c) {
+void FillBuffer::addElements(element_type a, element_type b, element_type c) {
elements.push_back(a);
elements.push_back(b);
elements.push_back(c);
@@ -60,8 +62,8 @@ void FillBuffer::bind() {
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, element_buffer);
if (dirty) {
- glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(uint16_t), vertices.data(), GL_STATIC_DRAW);
- glBufferData(GL_ELEMENT_ARRAY_BUFFER, elements.size() * sizeof(uint16_t), elements.data(), GL_STATIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(vertex_type), vertices.data(), GL_STATIC_DRAW);
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, elements.size() * sizeof(element_type), elements.data(), GL_STATIC_DRAW);
dirty = false;
}
}
diff --git a/src/geometry/line_buffer.cpp b/src/geometry/line_buffer.cpp
index ff95a50798..4e1200d2f6 100644
--- a/src/geometry/line_buffer.cpp
+++ b/src/geometry/line_buffer.cpp
@@ -15,7 +15,7 @@ uint32_t LineBuffer::length() const {
return array.size() / 4;
}
-void LineBuffer::add(int16_t x, int16_t y, float ex, float ey, int8_t tx, int8_t ty, int32_t linesofar) {
+void LineBuffer::add(vertex_type x, vertex_type y, float ex, float ey, int8_t tx, int8_t ty, int32_t linesofar) {
array.push_back((x * 2) | tx);
array.push_back((y * 2) | ty);
array.push_back(linesofar);
@@ -40,7 +40,7 @@ void LineBuffer::bind() {
glBindBuffer(GL_ARRAY_BUFFER, buffer);
if (dirty) {
- glBufferData(GL_ARRAY_BUFFER, array.size() * sizeof(int16_t), array.data(), GL_STATIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, array.size() * sizeof(vertex_type), array.data(), GL_STATIC_DRAW);
dirty = false;
}
}
diff --git a/src/geometry/vertex_buffer.cpp b/src/geometry/vertex_buffer.cpp
index 591b0c13d9..2d209f6be1 100644
--- a/src/geometry/vertex_buffer.cpp
+++ b/src/geometry/vertex_buffer.cpp
@@ -21,7 +21,7 @@ void VertexBuffer::bind() {
if (buffer == 0) {
glGenBuffers(1, &buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
- glBufferData(GL_ARRAY_BUFFER, array.size() * sizeof(int16_t), array.data(), GL_STATIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, array.size() * sizeof(vertex_type), array.data(), GL_STATIC_DRAW);
} else {
glBindBuffer(GL_ARRAY_BUFFER, buffer);
}