summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-02-21 13:08:13 +0100
committerKonstantin Käfer <mail@kkaefer.com>2014-02-21 13:08:13 +0100
commite382cab17dd399ef851a4a2800a11dd7b9a69c15 (patch)
treeff54618a2124267ea45ecf227e0f43058cb34168
parent4418f2d1c8f51ee268e2180c287abae0b8dbc574 (diff)
downloadqtlocation-mapboxgl-e382cab17dd399ef851a4a2800a11dd7b9a69c15.tar.gz
make implicit type conversions explicit
-rw-r--r--include/llmr/geometry/vertex_buffer.hpp2
-rw-r--r--include/llmr/renderer/fill_bucket.hpp6
-rw-r--r--include/llmr/renderer/line_bucket.hpp6
-rw-r--r--include/llmr/renderer/point_bucket.hpp4
-rw-r--r--include/llmr/style/style.hpp2
-rw-r--r--include/llmr/util/pbf.hpp4
-rw-r--r--src/geometry/debug_font_buffer.cpp4
-rw-r--r--src/geometry/vertex_buffer.cpp2
-rw-r--r--src/map/vector_tile.cpp4
-rw-r--r--src/renderer/fill_bucket.cpp2
-rw-r--r--src/renderer/line_bucket.cpp22
-rw-r--r--src/renderer/painter.cpp16
-rw-r--r--src/renderer/point_bucket.cpp2
-rw-r--r--src/style/sprite.cpp2
-rw-r--r--src/style/style.cpp2
15 files changed, 40 insertions, 40 deletions
diff --git a/include/llmr/geometry/vertex_buffer.hpp b/include/llmr/geometry/vertex_buffer.hpp
index 9d053693c9..a9236992c1 100644
--- a/include/llmr/geometry/vertex_buffer.hpp
+++ b/include/llmr/geometry/vertex_buffer.hpp
@@ -17,7 +17,7 @@ public:
* Returns the number of elements in this buffer. This is not the number of
* bytes, but rather the number of coordinates with associated information.
*/
- uint32_t index() const;
+ size_t index() const;
/*
* Transfers this buffer to the GPU and binds the buffer to the GL context.
diff --git a/include/llmr/renderer/fill_bucket.hpp b/include/llmr/renderer/fill_bucket.hpp
index 86188e4c7c..166eff3faf 100644
--- a/include/llmr/renderer/fill_bucket.hpp
+++ b/include/llmr/renderer/fill_bucket.hpp
@@ -52,9 +52,9 @@ private:
std::shared_ptr<LineElementsBuffer> lineElementsBuffer;
// hold information on where the vertices are located in the FillBuffer
- const uint32_t vertex_start;
- const uint32_t triangle_elements_start;
- const uint32_t line_elements_start;
+ const size_t vertex_start;
+ const size_t triangle_elements_start;
+ const size_t line_elements_start;
VertexArrayObject<OutlineShader> array;
std::vector<triangle_group_type> triangleGroups;
std::vector<line_group_type> lineGroups;
diff --git a/include/llmr/renderer/line_bucket.hpp b/include/llmr/renderer/line_bucket.hpp
index 6ec9d960d8..17ee226cfb 100644
--- a/include/llmr/renderer/line_bucket.hpp
+++ b/include/llmr/renderer/line_bucket.hpp
@@ -47,9 +47,9 @@ private:
std::shared_ptr<TriangleElementsBuffer> triangleElementsBuffer;
std::shared_ptr<PointElementsBuffer> pointElementsBuffer;
- const uint32_t vertex_start;
- const uint32_t triangle_elements_start;
- const uint32_t point_elements_start;
+ const size_t vertex_start;
+ const size_t triangle_elements_start;
+ const size_t point_elements_start;
std::vector<triangle_group_type> triangleGroups;
std::vector<point_group_type> pointGroups;
diff --git a/include/llmr/renderer/point_bucket.hpp b/include/llmr/renderer/point_bucket.hpp
index 9c8de8f88c..9da7edc30e 100644
--- a/include/llmr/renderer/point_bucket.hpp
+++ b/include/llmr/renderer/point_bucket.hpp
@@ -42,8 +42,8 @@ private:
std::shared_ptr<PointVertexBuffer> vertexBuffer;
VertexArrayObject<PointShader> array;
- const uint32_t vertex_start;
- uint32_t vertex_end = 0;
+ const size_t vertex_start;
+ size_t vertex_end = 0;
};
}
diff --git a/include/llmr/style/style.hpp b/include/llmr/style/style.hpp
index d1212f9fe3..7a491d810d 100644
--- a/include/llmr/style/style.hpp
+++ b/include/llmr/style/style.hpp
@@ -22,7 +22,7 @@ public:
Style();
void reset();
- void load(const uint8_t *const data, uint32_t bytes);
+ void load(const uint8_t *const data, size_t bytes);
// This is commented out because it is not fully implemented yet. For now,
// we keep using the protobuf stylesheet format
diff --git a/include/llmr/util/pbf.hpp b/include/llmr/util/pbf.hpp
index 132cc14354..2e99cd91cb 100644
--- a/include/llmr/util/pbf.hpp
+++ b/include/llmr/util/pbf.hpp
@@ -20,7 +20,7 @@ struct pbf {
struct unknown_field_type_exception : exception {};
struct end_of_buffer_exception : exception {};
- inline pbf(const unsigned char *data, uint32_t length);
+ inline pbf(const unsigned char *data, size_t length);
inline pbf();
inline operator bool() const;
@@ -49,7 +49,7 @@ struct pbf {
uint32_t tag = 0;
};
-pbf::pbf(const unsigned char *data, uint32_t length)
+pbf::pbf(const unsigned char *data, size_t length)
: data(data),
end(data + length),
value(0),
diff --git a/src/geometry/debug_font_buffer.cpp b/src/geometry/debug_font_buffer.cpp
index 4db1aa285a..a91865fb81 100644
--- a/src/geometry/debug_font_buffer.cpp
+++ b/src/geometry/debug_font_buffer.cpp
@@ -10,8 +10,8 @@ using namespace llmr;
void DebugFontBuffer::addText(const char *text, double left, double baseline, double scale) {
uint16_t *coords = nullptr;
- int32_t length = strlen(text);
- for (int32_t i = 0; i < length; ++i) {
+ size_t length = strlen(text);
+ for (size_t i = 0; i < length; ++i) {
if (text[i] < 32 || text[i] > 127) {
continue;
}
diff --git a/src/geometry/vertex_buffer.cpp b/src/geometry/vertex_buffer.cpp
index 47fe73a2aa..0ce21fd51c 100644
--- a/src/geometry/vertex_buffer.cpp
+++ b/src/geometry/vertex_buffer.cpp
@@ -12,7 +12,7 @@ VertexBuffer::~VertexBuffer() {
}
}
-uint32_t VertexBuffer::index() const {
+size_t VertexBuffer::index() const {
// We store 2 coordinates per vertex + 1 linesofar + 1 extrude coord pair == 4 (== 8 bytes)
return array.size() / 2;
}
diff --git a/src/map/vector_tile.cpp b/src/map/vector_tile.cpp
index e64d7114b1..129ddd997f 100644
--- a/src/map/vector_tile.cpp
+++ b/src/map/vector_tile.cpp
@@ -52,13 +52,13 @@ FilteredVectorTileLayer::FilteredVectorTileLayer(const VectorTileLayer& layer, c
// Find out what key/value IDs we need.
auto key_it = std::find(layer.keys.begin(), layer.keys.end(), bucket_desc.source_field);
if (key_it != layer.keys.end()) {
- key = key_it - layer.keys.begin();
+ key = (int32_t)(key_it - layer.keys.begin());
}
for (const Value& source_value : bucket_desc.source_value) {
auto value_it = std::find(layer.values.begin(), layer.values.end(), source_value);
if (value_it != layer.values.end()) {
- values.insert(value_it - layer.values.begin());
+ values.insert((uint32_t)(value_it - layer.values.begin()));
}
}
}
diff --git a/src/renderer/fill_bucket.cpp b/src/renderer/fill_bucket.cpp
index 6270ef0e5c..4420d3b970 100644
--- a/src/renderer/fill_bucket.cpp
+++ b/src/renderer/fill_bucket.cpp
@@ -50,7 +50,7 @@ void FillBucket::addGeometry(pbf& geom) {
}
void FillBucket::addGeometry(const std::vector<Coordinate>& line) {
- uint32_t vertex_start = vertexBuffer->index();
+ size_t vertex_start = vertexBuffer->index();
size_t length = line.size();
diff --git a/src/renderer/line_bucket.cpp b/src/renderer/line_bucket.cpp
index f24c42d5bf..1ceb2cb0a5 100644
--- a/src/renderer/line_bucket.cpp
+++ b/src/renderer/line_bucket.cpp
@@ -103,7 +103,7 @@ void LineBucket::addGeometry(const std::vector<Coordinate>& vertices) {
nextNormal = util::normal<double>(currentVertex, lastVertex);
}
- size_t start_vertex = vertexBuffer->index();
+ int32_t start_vertex = (int32_t)vertexBuffer->index();
std::vector<TriangleElement> triangle_store;
std::vector<PointElement> point_store;
@@ -174,7 +174,7 @@ void LineBucket::addGeometry(const std::vector<Coordinate>& vertices) {
// Add offset square begin cap.
if (!prevVertex && beginCap == CapType::Square) {
// Add first vertex
- e3 = vertexBuffer->add(currentVertex.x, currentVertex.y, // vertex pos
+ e3 = (int32_t)vertexBuffer->add(currentVertex.x, currentVertex.y, // vertex pos
flip * (prevNormal.x + prevNormal.y), flip * (-prevNormal.x + prevNormal.y), // extrude normal
0, 0, distance) - start_vertex; // texture normal
@@ -182,7 +182,7 @@ void LineBucket::addGeometry(const std::vector<Coordinate>& vertices) {
e1 = e2; e2 = e3;
// Add second vertex
- e3 = vertexBuffer->add(currentVertex.x, currentVertex.y, // vertex pos
+ e3 = (int32_t)vertexBuffer->add(currentVertex.x, currentVertex.y, // vertex pos
flip * (prevNormal.x - prevNormal.y), flip * (prevNormal.x + prevNormal.y), // extrude normal
0, 1, distance) - start_vertex; // texture normal
@@ -193,7 +193,7 @@ void LineBucket::addGeometry(const std::vector<Coordinate>& vertices) {
// Add offset square end cap.
else if (!nextVertex && endCap == CapType::Square) {
// Add first vertex
- e3 = vertexBuffer->add(currentVertex.x, currentVertex.y, // vertex pos
+ e3 = (int32_t)vertexBuffer->add(currentVertex.x, currentVertex.y, // vertex pos
nextNormal.x - flip * nextNormal.y, flip * nextNormal.x + nextNormal.y, // extrude normal
0, 0, distance) - start_vertex; // texture normal
@@ -201,7 +201,7 @@ void LineBucket::addGeometry(const std::vector<Coordinate>& vertices) {
e1 = e2; e2 = e3;
// Add second vertex
- e3 = vertexBuffer->add(currentVertex.x, currentVertex.y, // vertex pos
+ e3 = (int32_t)vertexBuffer->add(currentVertex.x, currentVertex.y, // vertex pos
nextNormal.x + flip * nextNormal.y, -flip * nextNormal.x + nextNormal.y, // extrude normal
0, 1, distance) - start_vertex; // texture normal
@@ -227,7 +227,7 @@ void LineBucket::addGeometry(const std::vector<Coordinate>& vertices) {
}
// Add first vertex
- e3 = vertexBuffer->add(currentVertex.x, currentVertex.y, // vertex pos
+ e3 = (int32_t)vertexBuffer->add(currentVertex.x, currentVertex.y, // vertex pos
flip * joinNormal.x, flip * joinNormal.y, // extrude normal
0, 0, distance) - start_vertex; // texture normal
@@ -235,7 +235,7 @@ void LineBucket::addGeometry(const std::vector<Coordinate>& vertices) {
e1 = e2; e2 = e3;
// Add second vertex
- e3 = vertexBuffer->add(currentVertex.x, currentVertex.y, // vertex pos
+ e3 = (int32_t)vertexBuffer->add(currentVertex.x, currentVertex.y, // vertex pos
-flip * joinNormal.x, -flip * joinNormal.y, // extrude normal
0, 1, distance) - start_vertex; // texture normal
@@ -251,7 +251,7 @@ void LineBucket::addGeometry(const std::vector<Coordinate>& vertices) {
else {
// Close up the previous line
// Add first vertex
- e3 = vertexBuffer->add(currentVertex.x, currentVertex.y, // vertex pos
+ e3 = (int32_t)vertexBuffer->add(currentVertex.x, currentVertex.y, // vertex pos
flip * prevNormal.y, -flip * prevNormal.x, // extrude normal
0, 0, distance) - start_vertex; // texture normal
@@ -259,7 +259,7 @@ void LineBucket::addGeometry(const std::vector<Coordinate>& vertices) {
e1 = e2; e2 = e3;
// Add second vertex.
- e3 = vertexBuffer->add(currentVertex.x, currentVertex.y, // vertex pos
+ e3 = (int32_t)vertexBuffer->add(currentVertex.x, currentVertex.y, // vertex pos
-flip * prevNormal.y, flip * prevNormal.x, // extrude normal
0, 1, distance) - start_vertex; // texture normal
@@ -289,7 +289,7 @@ void LineBucket::addGeometry(const std::vector<Coordinate>& vertices) {
// Start the new quad.
// Add first vertex
- e3 = vertexBuffer->add(currentVertex.x, currentVertex.y, // vertex pos
+ e3 = (int32_t)vertexBuffer->add(currentVertex.x, currentVertex.y, // vertex pos
-flip * nextNormal.y, flip * nextNormal.x, // extrude normal
0, 0, distance) - start_vertex; // texture normal
@@ -297,7 +297,7 @@ void LineBucket::addGeometry(const std::vector<Coordinate>& vertices) {
e1 = e2; e2 = e3;
// Add second vertex
- e3 = vertexBuffer->add(currentVertex.x, currentVertex.y, // vertex pos
+ e3 = (int32_t)vertexBuffer->add(currentVertex.x, currentVertex.y, // vertex pos
flip * nextNormal.y, -flip * nextNormal.x, // extrude normal
0, 1, distance) - start_vertex; // texture normal
diff --git a/src/renderer/painter.cpp b/src/renderer/painter.cpp
index 8d362ca29e..83bf8d4d94 100644
--- a/src/renderer/painter.cpp
+++ b/src/renderer/painter.cpp
@@ -117,7 +117,7 @@ void Painter::drawClippingMask() {
// Draw the clipping mask
plainShader->setColor(1.0f, 0.0f, 1.0f, 1.0f);
- glDrawArrays(GL_TRIANGLES, 0, tileStencilBuffer.index());
+ glDrawArrays(GL_TRIANGLES, 0, (GLsizei)tileStencilBuffer.index());
// glEnable(GL_STENCIL_TEST);
glStencilFunc(GL_EQUAL, 0x80, 0x80);
@@ -287,7 +287,7 @@ void Painter::renderFill(FillBucket& bucket, const std::string& layer_name, cons
// Draw a rectangle that covers the entire viewport.
coveringPatternArray.bind(*patternShader, tileStencilBuffer, BUFFER_OFFSET(0));
- glDrawArrays(GL_TRIANGLES, 0, tileStencilBuffer.index());
+ glDrawArrays(GL_TRIANGLES, 0, (GLsizei)tileStencilBuffer.index());
} else {
// Draw filling rectangle.
@@ -297,7 +297,7 @@ void Painter::renderFill(FillBucket& bucket, const std::string& layer_name, cons
// Draw a rectangle that covers the entire viewport.
coveringPlainArray.bind(*plainShader, tileStencilBuffer, BUFFER_OFFSET(0));
- glDrawArrays(GL_TRIANGLES, 0, tileStencilBuffer.index());
+ glDrawArrays(GL_TRIANGLES, 0, (GLsizei)tileStencilBuffer.index());
}
glStencilFunc(GL_EQUAL, 0x80, 0x80);
@@ -428,16 +428,16 @@ void Painter::renderDebug(const Tile::Ptr& tile) {
tileBorderArray.bind(*plainShader, tileBorderBuffer, BUFFER_OFFSET(0));
plainShader->setColor(1.0f, 0.0f, 0.0f, 1.0f);
lineWidth(4.0f * transform.pixelRatio);
- glDrawArrays(GL_LINE_STRIP, 0, tileBorderBuffer.index());
+ glDrawArrays(GL_LINE_STRIP, 0, (GLsizei)tileBorderBuffer.index());
// draw debug info
tile->debugFontArray.bind(*plainShader, tile->debugFontBuffer, BUFFER_OFFSET(0));
plainShader->setColor(1.0f, 1.0f, 1.0f, 1.0f);
lineWidth(4.0f * transform.pixelRatio);
- glDrawArrays(GL_LINES, 0, tile->debugFontBuffer.index());
+ glDrawArrays(GL_LINES, 0, (GLsizei)tile->debugFontBuffer.index());
plainShader->setColor(0.0f, 0.0f, 0.0f, 1.0f);
lineWidth(2.0f * transform.pixelRatio);
- glDrawArrays(GL_LINES, 0, tile->debugFontBuffer.index());
+ glDrawArrays(GL_LINES, 0, (GLsizei)tile->debugFontBuffer.index());
// Revert blending mode to blend to the back.
glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE);
@@ -454,7 +454,7 @@ void Painter::renderMatte() {
// Draw the clipping mask
matteArray.bind(*plainShader, matteBuffer, BUFFER_OFFSET(0));
plainShader->setColor(white);
- glDrawArrays(GL_TRIANGLES, 0, matteBuffer.index());
+ glDrawArrays(GL_TRIANGLES, 0, (GLsizei)matteBuffer.index());
glEnable(GL_STENCIL_TEST);
}
@@ -468,5 +468,5 @@ void Painter::renderBackground() {
// Draw the clipping mask
coveringPlainArray.bind(*plainShader, tileStencilBuffer, BUFFER_OFFSET(0));
plainShader->setColor(white);
- glDrawArrays(GL_TRIANGLES, 0, tileStencilBuffer.index());
+ glDrawArrays(GL_TRIANGLES, 0, (GLsizei)tileStencilBuffer.index());
}
diff --git a/src/renderer/point_bucket.cpp b/src/renderer/point_bucket.cpp
index 1f786a0cbd..04e9fbe9d8 100644
--- a/src/renderer/point_bucket.cpp
+++ b/src/renderer/point_bucket.cpp
@@ -48,5 +48,5 @@ bool PointBucket::hasPoints() const {
void PointBucket::drawPoints(PointShader& shader) {
char *vertex_index = BUFFER_OFFSET(vertex_start * vertexBuffer->itemSize);
array.bind(shader, *vertexBuffer, vertex_index);
- glDrawArrays(GL_POINTS, 0, vertex_end - vertex_start);
+ glDrawArrays(GL_POINTS, 0, (GLsizei)(vertex_end - vertex_start));
}
diff --git a/src/style/sprite.cpp b/src/style/sprite.cpp
index dcdfd0cb6f..70626ef396 100644
--- a/src/style/sprite.cpp
+++ b/src/style/sprite.cpp
@@ -180,7 +180,7 @@ void Sprite::loadImage(const std::string& data) {
png_read_update_info(png, info);
- unsigned int rowbytes = png_get_rowbytes(png, info);
+ png_size_t rowbytes = png_get_rowbytes(png, info);
assert(width * 4 == rowbytes);
img = (char *)malloc(width * height * 4);
diff --git a/src/style/style.cpp b/src/style/style.cpp
index 2aac0c3843..28e740e4cd 100644
--- a/src/style/style.cpp
+++ b/src/style/style.cpp
@@ -15,7 +15,7 @@ void Style::reset() {
computed.points.clear();
}
-void Style::load(const uint8_t *const data, uint32_t bytes) {
+void Style::load(const uint8_t *const data, size_t bytes) {
pbf style(data, bytes);
while (style.next()) {