summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-02-17 18:22:03 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-02-18 13:27:35 +0200
commitbfafc360a7257f57999edbcbd484a0e18b40798a (patch)
tree395a71d338a2c33ae11f2ebd421f4a2706698308 /src
parent1336e3e30f5bc9bdf4fc9fff516a36df9f0235d7 (diff)
downloadqtlocation-mapboxgl-bfafc360a7257f57999edbcbd484a0e18b40798a.tar.gz
[gl] Moved TexturePool to gl namespace
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/gl/texture_pool.cpp (renamed from src/mbgl/util/texture_pool.cpp)8
-rw-r--r--src/mbgl/gl/texture_pool.hpp (renamed from src/mbgl/util/texture_pool.hpp)3
-rw-r--r--src/mbgl/map/map_context.cpp5
-rw-r--r--src/mbgl/map/map_context.hpp5
-rw-r--r--src/mbgl/renderer/raster_bucket.cpp2
-rw-r--r--src/mbgl/renderer/raster_bucket.hpp2
-rw-r--r--src/mbgl/style/style.cpp2
-rw-r--r--src/mbgl/style/style.hpp6
-rw-r--r--src/mbgl/style/style_update_parameters.hpp6
-rw-r--r--src/mbgl/tile/raster_tile_data.cpp2
-rw-r--r--src/mbgl/tile/raster_tile_data.hpp6
-rw-r--r--src/mbgl/util/raster.cpp2
-rw-r--r--src/mbgl/util/raster.hpp6
13 files changed, 31 insertions, 24 deletions
diff --git a/src/mbgl/util/texture_pool.cpp b/src/mbgl/gl/texture_pool.cpp
index ec175c924a..9d0ff79b11 100644
--- a/src/mbgl/util/texture_pool.cpp
+++ b/src/mbgl/gl/texture_pool.cpp
@@ -1,4 +1,4 @@
-#include <mbgl/util/texture_pool.hpp>
+#include <mbgl/gl/texture_pool.hpp>
#include <mbgl/gl/gl_object_store.hpp>
#include <mbgl/util/thread_context.hpp>
@@ -7,7 +7,8 @@
const GLsizei TextureMax = 64;
-using namespace mbgl;
+namespace mbgl {
+namespace gl {
GLuint TexturePool::getTextureID() {
if (texture_ids.empty()) {
@@ -51,3 +52,6 @@ void TexturePool::clearTextureIDs() {
}
texture_ids.clear();
}
+
+} // namespace gl
+} // namespace mbgl
diff --git a/src/mbgl/util/texture_pool.hpp b/src/mbgl/gl/texture_pool.hpp
index db462ab3e3..3981d98f08 100644
--- a/src/mbgl/util/texture_pool.hpp
+++ b/src/mbgl/gl/texture_pool.hpp
@@ -5,9 +5,9 @@
#include <mbgl/gl/gl.hpp>
#include <set>
-#include <mutex>
namespace mbgl {
+namespace gl {
class TexturePool : private util::noncopyable {
@@ -20,6 +20,7 @@ private:
std::set<GLuint> texture_ids;
};
+} // namespace gl
} // namespace mbgl
#endif
diff --git a/src/mbgl/map/map_context.cpp b/src/mbgl/map/map_context.cpp
index 46d979a473..d9a7f47125 100644
--- a/src/mbgl/map/map_context.cpp
+++ b/src/mbgl/map/map_context.cpp
@@ -17,8 +17,9 @@
#include <mbgl/sprite/sprite_store.hpp>
#include <mbgl/gl/gl_object_store.hpp>
+#include <mbgl/gl/texture_pool.hpp>
+
#include <mbgl/util/worker.hpp>
-#include <mbgl/util/texture_pool.hpp>
#include <mbgl/util/exception.hpp>
#include <mbgl/util/string.hpp>
#include <mbgl/util/mapbox.hpp>
@@ -33,7 +34,7 @@ MapContext::MapContext(View& view_, FileSource& fileSource, MapMode mode_, GLCon
data(*dataPtr),
asyncUpdate([this] { update(); }),
asyncInvalidate([&view_] { view_.invalidate(); }),
- texturePool(std::make_unique<TexturePool>()) {
+ texturePool(std::make_unique<gl::TexturePool>()) {
assert(util::ThreadContext::currentlyOn(util::ThreadType::Map));
util::ThreadContext::setFileSource(&fileSource);
diff --git a/src/mbgl/map/map_context.hpp b/src/mbgl/map/map_context.hpp
index 617e178159..128d94dc3c 100644
--- a/src/mbgl/map/map_context.hpp
+++ b/src/mbgl/map/map_context.hpp
@@ -18,11 +18,12 @@ namespace mbgl {
class View;
class MapData;
-class TexturePool;
class Painter;
class SpriteImage;
class FileRequest;
+namespace gl { class TexturePool; }
+
struct FrameData {
std::array<uint16_t, 2> framebufferSize;
};
@@ -86,7 +87,7 @@ private:
util::AsyncTask asyncUpdate;
util::AsyncTask asyncInvalidate;
- std::unique_ptr<TexturePool> texturePool;
+ std::unique_ptr<gl::TexturePool> texturePool;
std::unique_ptr<Painter> painter;
std::unique_ptr<Style> style;
diff --git a/src/mbgl/renderer/raster_bucket.cpp b/src/mbgl/renderer/raster_bucket.cpp
index 4dbbf18697..0b19fa0c1e 100644
--- a/src/mbgl/renderer/raster_bucket.cpp
+++ b/src/mbgl/renderer/raster_bucket.cpp
@@ -5,7 +5,7 @@
using namespace mbgl;
-RasterBucket::RasterBucket(TexturePool& texturePool)
+RasterBucket::RasterBucket(gl::TexturePool& texturePool)
: raster(texturePool) {
}
diff --git a/src/mbgl/renderer/raster_bucket.hpp b/src/mbgl/renderer/raster_bucket.hpp
index 0f6237969a..92c6a8ea02 100644
--- a/src/mbgl/renderer/raster_bucket.hpp
+++ b/src/mbgl/renderer/raster_bucket.hpp
@@ -12,7 +12,7 @@ class VertexArrayObject;
class RasterBucket : public Bucket {
public:
- RasterBucket(TexturePool&);
+ RasterBucket(gl::TexturePool&);
void upload() override;
void render(Painter&, const StyleLayer&, const TileID&, const mat4&) override;
diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp
index b66575c36c..bf35d17c97 100644
--- a/src/mbgl/style/style.cpp
+++ b/src/mbgl/style/style.cpp
@@ -116,7 +116,7 @@ void Style::removeLayer(const std::string& id) {
}
void Style::update(const TransformState& transform,
- TexturePool& texturePool) {
+ gl::TexturePool& texturePool) {
bool allTilesUpdated = true;
StyleUpdateParameters parameters(data.pixelRatio,
data.getDebug(),
diff --git a/src/mbgl/style/style.hpp b/src/mbgl/style/style.hpp
index c74181ed00..f42578f923 100644
--- a/src/mbgl/style/style.hpp
+++ b/src/mbgl/style/style.hpp
@@ -26,11 +26,11 @@ class SpriteAtlas;
class LineAtlas;
class StyleLayer;
class TransformState;
-class TexturePool;
-
class Tile;
class Bucket;
+namespace gl { class TexturePool; }
+
struct RenderItem {
inline RenderItem(const StyleLayer& layer_,
const Tile* tile_ = nullptr,
@@ -79,7 +79,7 @@ public:
// Fetch the tiles needed by the current viewport and emit a signal when
// a tile is ready so observers can render the tile.
- void update(const TransformState&, TexturePool&);
+ void update(const TransformState&, gl::TexturePool&);
void cascade();
void recalculate(float z);
diff --git a/src/mbgl/style/style_update_parameters.hpp b/src/mbgl/style/style_update_parameters.hpp
index 0a646219f0..f9557fdf1b 100644
--- a/src/mbgl/style/style_update_parameters.hpp
+++ b/src/mbgl/style/style_update_parameters.hpp
@@ -7,9 +7,9 @@ namespace mbgl {
class TransformState;
class Worker;
-class TexturePool;
class MapData;
class Style;
+namespace gl { class TexturePool; }
class StyleUpdateParameters {
public:
@@ -18,7 +18,7 @@ public:
TimePoint animationTime_,
const TransformState& transformState_,
Worker& worker_,
- TexturePool& texturePool_,
+ gl::TexturePool& texturePool_,
bool shouldReparsePartialTiles_,
const MapMode mode_,
MapData& data_,
@@ -39,7 +39,7 @@ public:
TimePoint animationTime;
const TransformState& transformState;
Worker& worker;
- TexturePool& texturePool;
+ gl::TexturePool& texturePool;
bool shouldReparsePartialTiles;
const MapMode mode;
diff --git a/src/mbgl/tile/raster_tile_data.cpp b/src/mbgl/tile/raster_tile_data.cpp
index 797ee2a2b8..25b20e42c2 100644
--- a/src/mbgl/tile/raster_tile_data.cpp
+++ b/src/mbgl/tile/raster_tile_data.cpp
@@ -11,7 +11,7 @@ using namespace mbgl;
RasterTileData::RasterTileData(const TileID& id_,
float pixelRatio,
const std::string& urlTemplate,
- TexturePool &texturePool_,
+ gl::TexturePool &texturePool_,
Worker& worker_,
const std::function<void(std::exception_ptr)>& callback)
: TileData(id_),
diff --git a/src/mbgl/tile/raster_tile_data.hpp b/src/mbgl/tile/raster_tile_data.hpp
index 466d5fbf5e..8d5e901d99 100644
--- a/src/mbgl/tile/raster_tile_data.hpp
+++ b/src/mbgl/tile/raster_tile_data.hpp
@@ -8,15 +8,15 @@ namespace mbgl {
class FileRequest;
class StyleLayer;
-class TexturePool;
class WorkRequest;
+namespace gl { class TexturePool; }
class RasterTileData : public TileData {
public:
RasterTileData(const TileID&,
float pixelRatio,
const std::string& urlTemplate,
- TexturePool&,
+ gl::TexturePool&,
Worker&,
const std::function<void(std::exception_ptr)>& callback);
~RasterTileData();
@@ -25,7 +25,7 @@ public:
Bucket* getBucket(StyleLayer const &layer_desc) override;
private:
- TexturePool& texturePool;
+ gl::TexturePool& texturePool;
Worker& worker;
std::unique_ptr<FileRequest> req;
std::unique_ptr<Bucket> bucket;
diff --git a/src/mbgl/util/raster.cpp b/src/mbgl/util/raster.cpp
index fea48060a9..bf0de1330d 100644
--- a/src/mbgl/util/raster.cpp
+++ b/src/mbgl/util/raster.cpp
@@ -9,7 +9,7 @@
using namespace mbgl;
-Raster::Raster(TexturePool& texturePool_)
+Raster::Raster(gl::TexturePool& texturePool_)
: texturePool(texturePool_)
{}
diff --git a/src/mbgl/util/raster.hpp b/src/mbgl/util/raster.hpp
index 807ac11c03..f19f679bd5 100644
--- a/src/mbgl/util/raster.hpp
+++ b/src/mbgl/util/raster.hpp
@@ -2,7 +2,7 @@
#define MBGL_UTIL_RASTER
#include <mbgl/gl/gl.hpp>
-#include <mbgl/util/texture_pool.hpp>
+#include <mbgl/gl/texture_pool.hpp>
#include <mbgl/util/image.hpp>
#include <mbgl/util/ptr.hpp>
#include <mbgl/util/chrono.hpp>
@@ -14,7 +14,7 @@ namespace mbgl {
class Raster : public std::enable_shared_from_this<Raster> {
public:
- Raster(TexturePool&);
+ Raster(gl::TexturePool&);
~Raster();
// load image data
@@ -50,7 +50,7 @@ private:
bool loaded = false;
// shared texture pool
- TexturePool& texturePool;
+ gl::TexturePool& texturePool;
// min/mag filter
GLint filter = 0;