From cc78b74098e02311cc646fe5b82c13641ff705fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Thu, 29 Sep 2016 15:32:48 +0200 Subject: [core] remove dependence on gl.h types --- src/mbgl/sprite/sprite_atlas.cpp | 12 ++++++------ src/mbgl/sprite/sprite_atlas.hpp | 7 +++---- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'src/mbgl/sprite') diff --git a/src/mbgl/sprite/sprite_atlas.cpp b/src/mbgl/sprite/sprite_atlas.cpp index b17bb7c2ec..198b0a6c57 100644 --- a/src/mbgl/sprite/sprite_atlas.cpp +++ b/src/mbgl/sprite/sprite_atlas.cpp @@ -282,7 +282,7 @@ void SpriteAtlas::copy(const Holder& holder, const SpritePatternMode mode) { dirtyFlag = true; } -void SpriteAtlas::upload(gl::Context& context, uint32_t unit) { +void SpriteAtlas::upload(gl::Context& context, gl::TextureUnit unit) { if (dirtyFlag) { bind(false, context, unit); } @@ -316,7 +316,7 @@ void SpriteAtlas::updateDirty() { dirtySprites.clear(); } -void SpriteAtlas::bind(bool linear, gl::Context& context, uint32_t unit) { +void SpriteAtlas::bind(bool linear, gl::Context& context, gl::TextureUnit unit) { if (!data) { return; // Empty atlas } @@ -325,9 +325,9 @@ void SpriteAtlas::bind(bool linear, gl::Context& context, uint32_t unit) { texture = context.createTexture(); context.activeTexture = unit; context.texture[unit] = *texture; -#ifndef GL_ES_VERSION_2_0 +#if not MBGL_USE_GLES2 MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0)); -#endif +#endif // MBGL_USE_GLES2 // We are using clamp to edge here since OpenGL ES doesn't allow GL_REPEAT on NPOT textures. // We use those when the pixelRatio isn't a power of two, e.g. on iPhone 6 Plus. MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)); @@ -379,10 +379,10 @@ void SpriteAtlas::bind(bool linear, gl::Context& context, uint32_t unit) { dirtyFlag = false; -#ifndef GL_ES_VERSION_2_0 +#if not MBGL_USE_GLES2 // platform::showColorDebugImage("Sprite Atlas", reinterpret_cast(data.get()), // pixelWidth, pixelHeight, pixelWidth, pixelHeight); -#endif +#endif // MBGL_USE_GLES2 } } diff --git a/src/mbgl/sprite/sprite_atlas.hpp b/src/mbgl/sprite/sprite_atlas.hpp index b4ee5ae48c..3a0aea2dad 100644 --- a/src/mbgl/sprite/sprite_atlas.hpp +++ b/src/mbgl/sprite/sprite_atlas.hpp @@ -1,7 +1,6 @@ #pragma once #include -#include #include #include #include @@ -83,14 +82,14 @@ public: SpritePatternMode mode = SpritePatternMode::Single); // Binds the atlas texture to the GPU, and uploads data if it is out of date. - void bind(bool linear, gl::Context&, uint32_t unit); + void bind(bool linear, gl::Context&, gl::TextureUnit unit); // Updates sprites in the atlas texture that may have changed. void updateDirty(); // Uploads the texture to the GPU to be available when we need it. This is a lazy operation; // the texture is only bound when the data is out of date (=dirty). - void upload(gl::Context&, uint32_t unit); + void upload(gl::Context&, gl::TextureUnit unit); dimension getWidth() const { return width; } dimension getHeight() const { return height; } @@ -105,7 +104,7 @@ private: void _setSprite(const std::string&, const std::shared_ptr& = nullptr); void emitSpriteLoadedIfComplete(); - const GLsizei width, height; + const uint16_t width, height; const dimension pixelWidth, pixelHeight; const float pixelRatio; -- cgit v1.2.1