From 876bf0687a6e2b6b5dd491b65dad587c688aa56d Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Tue, 24 May 2016 17:30:54 +0300 Subject: [PATCH] [core] Added PixelZoom, RasterPos to GL config --- include/mbgl/gl/gl_values.hpp | 4 ++++ src/mbgl/gl/gl_config.cpp | 5 +++++ src/mbgl/gl/gl_config.hpp | 12 ++++++++++++ 3 files changed, 21 insertions(+) diff --git a/include/mbgl/gl/gl_values.hpp b/include/mbgl/gl/gl_values.hpp index 2ebfe2e68..b96cfe310 100644 --- a/include/mbgl/gl/gl_values.hpp +++ b/include/mbgl/gl/gl_values.hpp @@ -269,6 +269,10 @@ struct PixelZoom { } }; +inline bool operator!=(const PixelZoom::Type& a, const PixelZoom::Type& b) { + return a.xfactor != b.xfactor || a.yfactor != b.yfactor; +} + struct RasterPos { using Type = std::array; static const Type Default; diff --git a/src/mbgl/gl/gl_config.cpp b/src/mbgl/gl/gl_config.cpp index ecf987876..c3c6601e4 100644 --- a/src/mbgl/gl/gl_config.cpp +++ b/src/mbgl/gl/gl_config.cpp @@ -21,5 +21,10 @@ const Program::Type Program::Default = 0; const LineWidth::Type LineWidth::Default = 1; const ActiveTexture::Type ActiveTexture::Default = GL_TEXTURE0; +#ifndef GL_ES_VERSION_2_0 +const PixelZoom::Type PixelZoom::Default = { 1, 1 }; +const RasterPos::Type RasterPos::Default = {{ 0, 0, 0, 0 }}; +#endif // GL_ES_VERSION_2_0 + } // namespace gl } // namespace mbgl diff --git a/src/mbgl/gl/gl_config.hpp b/src/mbgl/gl/gl_config.hpp index 8ec191daf..62dfbcadc 100644 --- a/src/mbgl/gl/gl_config.hpp +++ b/src/mbgl/gl/gl_config.hpp @@ -56,6 +56,10 @@ public: program.reset(); lineWidth.reset(); activeTexture.reset(); +#ifndef GL_ES_VERSION_2_0 + pixelZoom.reset(); + rasterPos.reset(); +#endif // GL_ES_VERSION_2_0 } void setDirty() { @@ -76,6 +80,10 @@ public: program.setDirty(); lineWidth.setDirty(); activeTexture.setDirty(); +#ifndef GL_ES_VERSION_2_0 + pixelZoom.setDirty(); + rasterPos.setDirty(); +#endif // GL_ES_VERSION_2_0 } Value stencilFunc; @@ -95,6 +103,10 @@ public: Value program; Value lineWidth; Value activeTexture; +#ifndef GL_ES_VERSION_2_0 + Value pixelZoom; + Value rasterPos; +#endif // GL_ES_VERSION_2_0 }; } // namespace gl