summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2015-09-11 15:08:54 +0300
committerKonstantin Käfer <mail@kkaefer.com>2015-09-15 13:22:07 +0200
commita3ea4acb7cb4d57ca2f5808b9b600d7c1b7b3cc7 (patch)
treed39c60300f32df4644a3cf3ad705fa9b1e0a1337 /src
parentc33a6bddc66efd18159b111796cce65ad78950f2 (diff)
downloadqtlocation-mapboxgl-a3ea4acb7cb4d57ca2f5808b9b600d7c1b7b3cc7.tar.gz
[core] convert remaining types to use OpenGL header defined variants
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/geometry/buffer.hpp4
-rw-r--r--src/mbgl/geometry/glyph_atlas.hpp4
-rw-r--r--src/mbgl/geometry/line_buffer.cpp4
-rw-r--r--src/mbgl/geometry/line_buffer.hpp2
-rw-r--r--src/mbgl/geometry/sprite_atlas.hpp2
-rw-r--r--src/mbgl/renderer/circle_bucket.hpp4
-rw-r--r--src/mbgl/renderer/fill_bucket.cpp12
-rw-r--r--src/mbgl/renderer/fill_bucket.hpp6
-rw-r--r--src/mbgl/renderer/line_bucket.cpp10
-rw-r--r--src/mbgl/renderer/line_bucket.hpp4
-rw-r--r--src/mbgl/renderer/painter.cpp4
-rw-r--r--src/mbgl/renderer/painter.hpp4
-rw-r--r--src/mbgl/renderer/symbol_bucket.cpp3
13 files changed, 32 insertions, 31 deletions
diff --git a/src/mbgl/geometry/buffer.hpp b/src/mbgl/geometry/buffer.hpp
index 620315d490..d54ee18c7e 100644
--- a/src/mbgl/geometry/buffer.hpp
+++ b/src/mbgl/geometry/buffer.hpp
@@ -110,10 +110,10 @@ public:
private:
// CPU buffer
- void *array = nullptr;
+ GLvoid *array = nullptr;
// Byte position where we are writing.
- size_t pos = 0;
+ GLsizeiptr pos = 0;
// Number of bytes that are valid in this buffer.
size_t length = 0;
diff --git a/src/mbgl/geometry/glyph_atlas.hpp b/src/mbgl/geometry/glyph_atlas.hpp
index f499859d7e..c5c785994d 100644
--- a/src/mbgl/geometry/glyph_atlas.hpp
+++ b/src/mbgl/geometry/glyph_atlas.hpp
@@ -32,8 +32,8 @@ public:
// the texture is only bound when the data is out of date (=dirty).
void upload();
- const uint16_t width = 0;
- const uint16_t height = 0;
+ const GLsizei width;
+ const GLsizei height;
private:
struct GlyphValue {
diff --git a/src/mbgl/geometry/line_buffer.cpp b/src/mbgl/geometry/line_buffer.cpp
index f475c63b24..77a134b468 100644
--- a/src/mbgl/geometry/line_buffer.cpp
+++ b/src/mbgl/geometry/line_buffer.cpp
@@ -5,8 +5,8 @@
using namespace mbgl;
-size_t LineVertexBuffer::add(vertex_type x, vertex_type y, float ex, float ey, int8_t tx, int8_t ty, int32_t linesofar) {
- size_t idx = index();
+GLsizei LineVertexBuffer::add(vertex_type x, vertex_type y, float ex, float ey, int8_t tx, int8_t ty, int32_t linesofar) {
+ GLsizei idx = index();
void *data = addElement();
int16_t *coords = static_cast<int16_t *>(data);
diff --git a/src/mbgl/geometry/line_buffer.hpp b/src/mbgl/geometry/line_buffer.hpp
index 1c217b59d2..7174fa2910 100644
--- a/src/mbgl/geometry/line_buffer.hpp
+++ b/src/mbgl/geometry/line_buffer.hpp
@@ -30,7 +30,7 @@ public:
* @param {number} tx texture normal
* @param {number} ty texture normal
*/
- size_t add(vertex_type x, vertex_type y, float ex, float ey, int8_t tx, int8_t ty, int32_t linesofar = 0);
+ GLsizei add(vertex_type x, vertex_type y, float ex, float ey, int8_t tx, int8_t ty, int32_t linesofar = 0);
};
diff --git a/src/mbgl/geometry/sprite_atlas.hpp b/src/mbgl/geometry/sprite_atlas.hpp
index 4a8c3fefaf..2e794f651b 100644
--- a/src/mbgl/geometry/sprite_atlas.hpp
+++ b/src/mbgl/geometry/sprite_atlas.hpp
@@ -69,7 +69,7 @@ public:
inline const uint32_t* getData() const { return data.get(); }
private:
- const dimension width, height;
+ const GLsizei width, height;
const dimension pixelWidth, pixelHeight;
const float pixelRatio;
diff --git a/src/mbgl/renderer/circle_bucket.hpp b/src/mbgl/renderer/circle_bucket.hpp
index 727b9fa376..d25cbdad3b 100644
--- a/src/mbgl/renderer/circle_bucket.hpp
+++ b/src/mbgl/renderer/circle_bucket.hpp
@@ -35,8 +35,8 @@ private:
CircleVertexBuffer& vertexBuffer_;
TriangleElementsBuffer& elementsBuffer_;
- const size_t vertexStart_;
- const size_t elementsStart_;
+ const GLsizei vertexStart_;
+ const GLsizei elementsStart_;
std::vector<std::unique_ptr<TriangleGroup>> triangleGroups_;
};
diff --git a/src/mbgl/renderer/fill_bucket.cpp b/src/mbgl/renderer/fill_bucket.cpp
index 7fb25d9a80..38263b3a47 100644
--- a/src/mbgl/renderer/fill_bucket.cpp
+++ b/src/mbgl/renderer/fill_bucket.cpp
@@ -91,7 +91,7 @@ void FillBucket::tessellate() {
return;
}
- size_t total_vertex_count = 0;
+ GLsizei total_vertex_count = 0;
for (const auto& polygon : polygons) {
total_vertex_count += polygon.size();
}
@@ -110,7 +110,7 @@ void FillBucket::tessellate() {
GLsizei lineIndex = lineGroup.vertex_length;
for (const auto& polygon : polygons) {
- const size_t group_count = polygon.size();
+ const GLsizei group_count = static_cast<GLsizei>(polygon.size());
assert(group_count >= 3);
std::vector<TESSreal> clipped_line;
@@ -120,8 +120,8 @@ void FillBucket::tessellate() {
vertexBuffer.add(pt.X, pt.Y);
}
- for (size_t i = 0; i < group_count; i++) {
- const size_t prev_i = (i == 0 ? group_count : i) - 1;
+ for (GLsizei i = 0; i < group_count; i++) {
+ const GLsizei prev_i = (i == 0 ? group_count : i) - 1;
lineElementsBuffer.add(lineIndex + prev_i, lineIndex + i);
}
@@ -134,12 +134,12 @@ void FillBucket::tessellate() {
if (tessTesselate(tesselator, TESS_WINDING_ODD, TESS_POLYGONS, vertices_per_group, vertexSize, 0)) {
const TESSreal *vertices = tessGetVertices(tesselator);
- const size_t vertex_count = tessGetVertexCount(tesselator);
+ const GLsizei vertex_count = tessGetVertexCount(tesselator);
TESSindex *vertex_indices = const_cast<TESSindex *>(tessGetVertexIndices(tesselator));
const TESSindex *elements = tessGetElements(tesselator);
const int triangle_count = tessGetElementCount(tesselator);
- for (size_t i = 0; i < vertex_count; ++i) {
+ for (GLsizei i = 0; i < vertex_count; ++i) {
if (vertex_indices[i] == TESS_UNDEF) {
vertexBuffer.add(::round(vertices[i * 2]), ::round(vertices[i * 2 + 1]));
vertex_indices[i] = (TESSindex)total_vertex_count;
diff --git a/src/mbgl/renderer/fill_bucket.hpp b/src/mbgl/renderer/fill_bucket.hpp
index 2ff86ba9af..1e02852544 100644
--- a/src/mbgl/renderer/fill_bucket.hpp
+++ b/src/mbgl/renderer/fill_bucket.hpp
@@ -54,9 +54,9 @@ private:
LineElementsBuffer& lineElementsBuffer;
// hold information on where the vertices are located in the FillBuffer
- const size_t vertex_start;
- const size_t triangle_elements_start;
- const size_t line_elements_start;
+ const GLsizei vertex_start;
+ const GLsizei triangle_elements_start;
+ const GLsizei line_elements_start;
std::vector<std::unique_ptr<TriangleGroup>> triangleGroups;
std::vector<std::unique_ptr<LineGroup>> lineGroups;
diff --git a/src/mbgl/renderer/line_bucket.cpp b/src/mbgl/renderer/line_bucket.cpp
index 9769cac332..9f4d060fce 100644
--- a/src/mbgl/renderer/line_bucket.cpp
+++ b/src/mbgl/renderer/line_bucket.cpp
@@ -32,8 +32,8 @@ void LineBucket::addGeometry(const GeometryCollection& geometryCollection) {
}
void LineBucket::addGeometry(const std::vector<Coordinate>& vertices) {
- const auto len = [&vertices] {
- auto l = vertices.size();
+ const GLsizei len = [&vertices] {
+ GLsizei l = static_cast<GLsizei>(vertices.size());
// If the line has duplicate vertices at the end, adjust length to remove them.
while (l > 2 && vertices[l - 1] == vertices[l - 2]) {
l--;
@@ -78,7 +78,7 @@ void LineBucket::addGeometry(const std::vector<Coordinate>& vertices) {
const GLint startVertex = vertexBuffer.index();
std::vector<TriangleElement> triangleStore;
- for (size_t i = 0; i < len; ++i) {
+ for (GLsizei i = 0; i < len; ++i) {
if (closed && i == len - 1) {
// if the line is closed, we treat the last vertex like the first
nextVertex = vertices[1];
@@ -303,8 +303,8 @@ void LineBucket::addGeometry(const std::vector<Coordinate>& vertices) {
startOfLine = false;
}
- const size_t endVertex = vertexBuffer.index();
- const size_t vertexCount = endVertex - startVertex;
+ const GLsizei endVertex = vertexBuffer.index();
+ const GLsizei vertexCount = endVertex - startVertex;
// Store the triangle/line groups.
{
diff --git a/src/mbgl/renderer/line_bucket.hpp b/src/mbgl/renderer/line_bucket.hpp
index ea12a1d844..2be0cf3924 100644
--- a/src/mbgl/renderer/line_bucket.hpp
+++ b/src/mbgl/renderer/line_bucket.hpp
@@ -58,8 +58,8 @@ private:
LineVertexBuffer& vertexBuffer;
TriangleElementsBuffer& triangleElementsBuffer;
- const size_t vertex_start;
- const size_t triangle_elements_start;
+ const GLsizei vertex_start;
+ const GLsizei triangle_elements_start;
GLint e1;
GLint e2;
diff --git a/src/mbgl/renderer/painter.cpp b/src/mbgl/renderer/painter.cpp
index a1b5566f2b..abb08f28b5 100644
--- a/src/mbgl/renderer/painter.cpp
+++ b/src/mbgl/renderer/painter.cpp
@@ -235,7 +235,7 @@ void Painter::render(const Style& style, TransformState state_, const FrameData&
// Make a second pass, rendering translucent objects. This time, we render bottom-to-top.
renderPass(RenderPass::Translucent,
order.begin(), order.end(),
- order.size() - 1, -1);
+ static_cast<GLsizei>(order.size()) - 1, -1);
if (debug::renderTree) { Log::Info(Event::Render, "}"); indent--; }
@@ -266,7 +266,7 @@ void Painter::render(const Style& style, TransformState state_, const FrameData&
template <class Iterator>
void Painter::renderPass(RenderPass pass_,
Iterator it, Iterator end,
- std::size_t i, int8_t increment) {
+ GLsizei i, int8_t increment) {
pass = pass_;
MBGL_DEBUG_GROUP(pass == RenderPass::Opaque ? "opaque" : "translucent");
diff --git a/src/mbgl/renderer/painter.hpp b/src/mbgl/renderer/painter.hpp
index ce42b59d1f..07bd4c4d3d 100644
--- a/src/mbgl/renderer/painter.hpp
+++ b/src/mbgl/renderer/painter.hpp
@@ -143,7 +143,7 @@ private:
template <class Iterator>
void renderPass(RenderPass,
Iterator it, Iterator end,
- std::size_t i, int8_t increment);
+ GLsizei i, int8_t increment);
void prepareTile(const Tile& tile);
@@ -201,7 +201,7 @@ private:
Color background = {{ 0, 0, 0, 0 }};
int numSublayers = 3;
- size_t currentLayer;
+ GLsizei currentLayer;
float depthRangeSize;
const float depthEpsilon = 1.0f / (1 << 16);
diff --git a/src/mbgl/renderer/symbol_bucket.cpp b/src/mbgl/renderer/symbol_bucket.cpp
index 9b1deef912..dabffa14ff 100644
--- a/src/mbgl/renderer/symbol_bucket.cpp
+++ b/src/mbgl/renderer/symbol_bucket.cpp
@@ -103,7 +103,8 @@ bool SymbolBucket::needsDependencies(const GeometryTileLayer& layer,
// Determine and load glyph ranges
std::set<GlyphRange> ranges;
- for (std::size_t i = 0; i < layer.featureCount(); i++) {
+ const GLsizei featureCount = static_cast<GLsizei>(layer.featureCount());
+ for (GLsizei i = 0; i < featureCount; i++) {
auto feature = layer.getFeature(i);
GeometryTileFeatureExtractor extractor(*feature);