Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drape/CMakeLists.txt1
-rw-r--r--drape/drape_global.hpp24
-rw-r--r--drape/drape_tests/font_texture_tests.cpp2
-rw-r--r--drape/drape_tests/static_texture_tests.cpp4
-rw-r--r--drape/drape_tests/stipple_pen_tests.cpp65
-rw-r--r--drape/drape_tests/texture_of_colors_tests.cpp62
-rw-r--r--drape/dynamic_texture.hpp5
-rw-r--r--drape/font_texture.hpp12
-rw-r--r--drape/glconstants.cpp12
-rw-r--r--drape/glconstants.hpp12
-rw-r--r--drape/hw_texture.cpp108
-rw-r--r--drape/hw_texture.hpp57
-rw-r--r--drape/hw_texture_ios.hpp14
-rw-r--r--drape/hw_texture_ios.mm30
-rw-r--r--drape/render_state.cpp42
-rw-r--r--drape/render_state.hpp35
-rw-r--r--drape/static_texture.cpp10
-rw-r--r--drape/stipple_pen_resource.cpp2
-rw-r--r--drape/stipple_pen_resource.hpp12
-rw-r--r--drape/symbols_texture.cpp31
-rw-r--r--drape/texture.cpp2
-rw-r--r--drape/texture.hpp15
-rw-r--r--drape/texture_manager.cpp20
-rw-r--r--drape/texture_of_colors.cpp2
-rw-r--r--drape/texture_of_colors.hpp16
-rw-r--r--drape/texture_types.hpp41
-rw-r--r--drape_frontend/area_shape.cpp2
-rw-r--r--drape_frontend/arrow3d.hpp1
-rw-r--r--drape_frontend/colored_symbol_shape.cpp2
-rwxr-xr-xdrape_frontend/frontend_renderer.cpp3
-rw-r--r--drape_frontend/line_shape.cpp2
-rw-r--r--drape_frontend/poi_symbol_shape.cpp4
-rw-r--r--drape_frontend/text_shape.cpp2
-rw-r--r--drape_frontend/user_mark_shapes.cpp2
-rw-r--r--xcode/drape/drape.xcodeproj/project.pbxproj4
35 files changed, 341 insertions, 317 deletions
diff --git a/drape/CMakeLists.txt b/drape/CMakeLists.txt
index 476bfd8ed3..d219584a39 100644
--- a/drape/CMakeLists.txt
+++ b/drape/CMakeLists.txt
@@ -101,6 +101,7 @@ set(
${DRAPE_ROOT}/texture_manager.hpp
${DRAPE_ROOT}/texture_of_colors.cpp
${DRAPE_ROOT}/texture_of_colors.hpp
+ ${DRAPE_ROOT}/texture_types.hpp
${DRAPE_ROOT}/uniform_value.cpp
${DRAPE_ROOT}/uniform_value.hpp
${DRAPE_ROOT}/utils/glyph_usage_tracker.cpp
diff --git a/drape/drape_global.hpp b/drape/drape_global.hpp
index 73376750bc..326f9c2fb2 100644
--- a/drape/drape_global.hpp
+++ b/drape/drape_global.hpp
@@ -16,27 +16,6 @@ enum ApiVersion
OpenGLES3
};
-enum TextureFormat
-{
- RGBA8,
- ALPHA,
- RED_GREEN,
- UNSPECIFIED
-};
-
-inline uint8_t GetBytesPerPixel(TextureFormat format)
-{
- uint8_t result = 0;
- switch (format)
- {
- case RGBA8: result = 4; break;
- case ALPHA: result = 1; break;
- case RED_GREEN: result = 2; break;
- default: ASSERT(false, ()); break;
- }
- return result;
-}
-
enum Anchor
{
Center = 0,
@@ -72,8 +51,7 @@ struct FontDecl
FontDecl(Color const & color, float size, bool isSdf = true,
Color const & outlineColor = Color::Transparent())
: m_color(color), m_outlineColor(outlineColor), m_size(size), m_isSdf(isSdf)
- {
- }
+ {}
Color m_color = Color::Transparent();
Color m_outlineColor = Color::Transparent();
diff --git a/drape/drape_tests/font_texture_tests.cpp b/drape/drape_tests/font_texture_tests.cpp
index 193628911b..9f18c2ca0f 100644
--- a/drape/drape_tests/font_texture_tests.cpp
+++ b/drape/drape_tests/font_texture_tests.cpp
@@ -103,7 +103,7 @@ UNIT_TEST(UploadingGlyphs)
Texture::Params p;
p.m_allocator = GetDefaultAllocator();
- p.m_format = dp::ALPHA;
+ p.m_format = dp::TextureFormat::Alpha;
p.m_width = p.m_height = 128;
DummyTexture tex;
diff --git a/drape/drape_tests/static_texture_tests.cpp b/drape/drape_tests/static_texture_tests.cpp
index 8cece22e10..9022c00ad3 100644
--- a/drape/drape_tests/static_texture_tests.cpp
+++ b/drape/drape_tests/static_texture_tests.cpp
@@ -20,10 +20,10 @@ UNIT_TEST(CheckTrafficArrowTextures)
GetStyleReader().SetCurrentStyle(style);
for (size_t i = 0; i < skinPaths.size(); ++i)
{
- dp::StaticTexture texture("traffic-arrow", skinPaths[i], dp::RGBA8, nullptr);
+ dp::StaticTexture texture("traffic-arrow", skinPaths[i], dp::TextureFormat::RGBA8, nullptr);
TEST(texture.IsLoadingCorrect(), ());
- dp::StaticTexture texture2("area-hatching", skinPaths[i], dp::RGBA8, nullptr);
+ dp::StaticTexture texture2("area-hatching", skinPaths[i], dp::TextureFormat::RGBA8, nullptr);
TEST(texture2.IsLoadingCorrect(), ());
}
}
diff --git a/drape/drape_tests/stipple_pen_tests.cpp b/drape/drape_tests/stipple_pen_tests.cpp
index 22c2c57f0a..360ad9dbea 100644
--- a/drape/drape_tests/stipple_pen_tests.cpp
+++ b/drape/drape_tests/stipple_pen_tests.cpp
@@ -3,55 +3,42 @@
#include "drape/drape_tests/memory_comparer.hpp"
#include "drape/drape_tests/dummy_texture.hpp"
-#include "drape/glconstants.hpp"
#include "drape/stipple_pen_resource.hpp"
#include "drape/texture.hpp"
-
-#include "drape/drape_tests/glmock_functions.hpp"
-
-#include <gmock/gmock.h>
-
-using testing::_;
-using testing::Return;
-using testing::InSequence;
-using testing::Invoke;
-using testing::IgnoreResult;
-using testing::AnyOf;
using namespace dp;
namespace
{
- void TestPacker(StipplePenPacker & packer, uint32_t width, m2::RectU const & expect)
- {
- m2::RectU rect = packer.PackResource(width);
- TEST_EQUAL(rect, expect, ());
- }
+void TestPacker(StipplePenPacker & packer, uint32_t width, m2::RectU const & expect)
+{
+ m2::RectU rect = packer.PackResource(width);
+ TEST_EQUAL(rect, expect, ());
+}
- bool IsRectsEqual(m2::RectF const & r1, m2::RectF const & r2)
- {
- return my::AlmostEqualULPs(r1.minX(), r2.minX()) &&
- my::AlmostEqualULPs(r1.minY(), r2.minY()) &&
- my::AlmostEqualULPs(r1.maxX(), r2.maxX()) &&
- my::AlmostEqualULPs(r1.maxY(), r2.maxY());
- }
+bool IsRectsEqual(m2::RectF const & r1, m2::RectF const & r2)
+{
+ return my::AlmostEqualULPs(r1.minX(), r2.minX()) &&
+ my::AlmostEqualULPs(r1.minY(), r2.minY()) &&
+ my::AlmostEqualULPs(r1.maxX(), r2.maxX()) &&
+ my::AlmostEqualULPs(r1.maxY(), r2.maxY());
+}
- class DummyStipplePenIndex : public StipplePenIndex
- {
- typedef StipplePenIndex TBase;
- public:
- DummyStipplePenIndex(m2::PointU const & size)
- : TBase(size)
- {
- }
+class DummyStipplePenIndex : public StipplePenIndex
+{
+ using Base = StipplePenIndex;
+public:
+ explicit DummyStipplePenIndex(m2::PointU const & size)
+ : Base(size)
+ {}
- ref_ptr<Texture::ResourceInfo> MapResource(StipplePenKey const & key)
- {
- bool dummy = false;
- return TBase::MapResource(key, dummy);
- }
- };
-}
+ ref_ptr<Texture::ResourceInfo> MapResource(StipplePenKey const & key)
+ {
+ bool dummy = false;
+ return Base::MapResource(key, dummy);
+ }
+};
+} // namespace
UNIT_TEST(SimpleStipplePackTest)
{
diff --git a/drape/drape_tests/texture_of_colors_tests.cpp b/drape/drape_tests/texture_of_colors_tests.cpp
index 0b5f1cb2bf..7d631771af 100644
--- a/drape/drape_tests/texture_of_colors_tests.cpp
+++ b/drape/drape_tests/texture_of_colors_tests.cpp
@@ -66,9 +66,9 @@ UNIT_TEST(ColorPalleteMappingTests)
{
DummyColorPallete cp(m2::PointU(32, 16));
- ref_ptr<Texture::ResourceInfo> info1 = cp.MapResource(dp::Color(0, 0, 0, 0));
- ref_ptr<Texture::ResourceInfo> info2 = cp.MapResource(dp::Color(1, 1, 1, 1));
- ref_ptr<Texture::ResourceInfo> info3 = cp.MapResource(dp::Color(0, 0, 0, 0));
+ ref_ptr<Texture::ResourceInfo> info1 = cp.MapResource(dp::ColorKey(dp::Color(0, 0, 0, 0)));
+ ref_ptr<Texture::ResourceInfo> info2 = cp.MapResource(dp::ColorKey(dp::Color(1, 1, 1, 1)));
+ ref_ptr<Texture::ResourceInfo> info3 = cp.MapResource(dp::ColorKey(dp::Color(0, 0, 0, 0)));
TEST_NOT_EQUAL(info1, info2, ());
TEST_EQUAL(info1, info3, ());
@@ -81,10 +81,10 @@ UNIT_TEST(ColorPalleteMappingTests)
1.0f / 32.0f, 1.0f / 16));
for (int i = 2; i < 100; ++i)
- cp.MapResource(dp::Color(i, i, i, i));
+ cp.MapResource(dp::ColorKey(dp::Color(i, i, i, i)));
- TestRects(cp.MapResource(dp::Color(54, 54, 54, 54))->GetTexRect(), m2::RectF(13.0f / 32.0f, 7.0f / 16.0f,
- 13.0f / 32.0f, 7.0f / 16.0f));
+ TestRects(cp.MapResource(dp::ColorKey(dp::Color(54, 54, 54, 54)))->GetTexRect(),
+ m2::RectF(13.0f / 32.0f, 7.0f / 16.0f, 13.0f / 32.0f, 7.0f / 16.0f));
}
UNIT_TEST(ColorPalleteUploadingSingleRow)
@@ -95,7 +95,7 @@ UNIT_TEST(ColorPalleteUploadingSingleRow)
Texture::Params p;
p.m_allocator = GetDefaultAllocator();
- p.m_format = dp::RGBA8;
+ p.m_format = dp::TextureFormat::RGBA8;
p.m_width = width;
p.m_height = height;
@@ -105,11 +105,11 @@ UNIT_TEST(ColorPalleteUploadingSingleRow)
cp.UploadResources(make_ref(&texture));
{
- cp.MapResource(dp::Color(0xFF, 0, 0, 0));
- cp.MapResource(dp::Color(0, 0xFF, 0, 0));
- cp.MapResource(dp::Color(0, 0, 0xFF, 0));
- cp.MapResource(dp::Color(0, 0, 0, 0xFF));
- cp.MapResource(dp::Color(0xAA, 0xBB, 0xCC, 0xDD));
+ cp.MapResource(dp::ColorKey(dp::Color(0xFF, 0, 0, 0)));
+ cp.MapResource(dp::ColorKey(dp::Color(0, 0xFF, 0, 0)));
+ cp.MapResource(dp::ColorKey(dp::Color(0, 0, 0xFF, 0)));
+ cp.MapResource(dp::ColorKey(dp::Color(0, 0, 0, 0xFF)));
+ cp.MapResource(dp::ColorKey(dp::Color(0xAA, 0xBB, 0xCC, 0xDD)));
uint8_t memoryEtalon[] =
{
@@ -144,11 +144,11 @@ UNIT_TEST(ColorPalleteUploadingSingleRow)
}
{
- cp.MapResource(dp::Color(0xFF, 0xAA, 0, 0));
- cp.MapResource(dp::Color(0xAA, 0xFF, 0, 0));
- cp.MapResource(dp::Color(0xAA, 0, 0xFF, 0));
- cp.MapResource(dp::Color(0xAA, 0, 0, 0xFF));
- cp.MapResource(dp::Color(0x00, 0xBB, 0xCC, 0xDD));
+ cp.MapResource(dp::ColorKey(dp::Color(0xFF, 0xAA, 0, 0)));
+ cp.MapResource(dp::ColorKey(dp::Color(0xAA, 0xFF, 0, 0)));
+ cp.MapResource(dp::ColorKey(dp::Color(0xAA, 0, 0xFF, 0)));
+ cp.MapResource(dp::ColorKey(dp::Color(0xAA, 0, 0, 0xFF)));
+ cp.MapResource(dp::ColorKey(dp::Color(0x00, 0xBB, 0xCC, 0xDD)));
uint8_t memoryEtalon[] =
{
@@ -193,7 +193,7 @@ UNIT_TEST(ColorPalleteUploadingPartialyRow)
Texture::Params p;
p.m_allocator = GetDefaultAllocator();
- p.m_format = dp::RGBA8;
+ p.m_format = dp::TextureFormat::RGBA8;
p.m_width = width;
p.m_height = height;
@@ -203,8 +203,8 @@ UNIT_TEST(ColorPalleteUploadingPartialyRow)
DummyColorPallete cp(m2::PointU(width, height));
{
- cp.MapResource(dp::Color(0xFF, 0, 0, 0));
- cp.MapResource(dp::Color(0xFF, 0xFF, 0, 0));
+ cp.MapResource(dp::ColorKey(dp::Color(0xFF, 0, 0, 0)));
+ cp.MapResource(dp::ColorKey(dp::Color(0xFF, 0xFF, 0, 0)));
uint8_t memoryEtalon[] =
{
@@ -227,10 +227,10 @@ UNIT_TEST(ColorPalleteUploadingPartialyRow)
}
{
- cp.MapResource(dp::Color(0xAA, 0, 0, 0));
- cp.MapResource(dp::Color(0xAA, 0xAA, 0, 0));
- cp.MapResource(dp::Color(0xAA, 0xAA, 0xAA, 0));
- cp.MapResource(dp::Color(0xAA, 0xAA, 0xAA, 0xAA));
+ cp.MapResource(dp::ColorKey(dp::Color(0xAA, 0, 0, 0)));
+ cp.MapResource(dp::ColorKey(dp::Color(0xAA, 0xAA, 0, 0)));
+ cp.MapResource(dp::ColorKey(dp::Color(0xAA, 0xAA, 0xAA, 0)));
+ cp.MapResource(dp::ColorKey(dp::Color(0xAA, 0xAA, 0xAA, 0xAA)));
uint8_t memoryEtalon1[] =
{
@@ -281,7 +281,7 @@ UNIT_TEST(ColorPalleteUploadingMultiplyRow)
Texture::Params p;
p.m_allocator = GetDefaultAllocator();
- p.m_format = dp::RGBA8;
+ p.m_format = dp::TextureFormat::RGBA8;
p.m_width = width;
p.m_height = height;
@@ -292,8 +292,8 @@ UNIT_TEST(ColorPalleteUploadingMultiplyRow)
cp.SetIsDebug(true);
{
- cp.MapResource(dp::Color(0xFF, 0, 0, 0));
- cp.MapResource(dp::Color(0xAA, 0, 0, 0));
+ cp.MapResource(dp::ColorKey(dp::Color(0xFF, 0, 0, 0)));
+ cp.MapResource(dp::ColorKey(dp::Color(0xAA, 0, 0, 0)));
uint8_t memoryEtalon[] =
{
@@ -316,10 +316,10 @@ UNIT_TEST(ColorPalleteUploadingMultiplyRow)
}
{
- cp.MapResource(dp::Color(0xCC, 0, 0, 0));
- cp.MapResource(dp::Color(0xFF, 0xFF, 0, 0));
- cp.MapResource(dp::Color(0xFF, 0xFF, 0xFF, 0));
- cp.MapResource(dp::Color(0xFF, 0xFF, 0xFF, 0xFF));
+ cp.MapResource(dp::ColorKey(dp::Color(0xCC, 0, 0, 0)));
+ cp.MapResource(dp::ColorKey(dp::Color(0xFF, 0xFF, 0, 0)));
+ cp.MapResource(dp::ColorKey(dp::Color(0xFF, 0xFF, 0xFF, 0)));
+ cp.MapResource(dp::ColorKey(dp::Color(0xFF, 0xFF, 0xFF, 0xFF)));
uint8_t memoryEtalon1[] =
{
diff --git a/drape/dynamic_texture.hpp b/drape/dynamic_texture.hpp
index da17f3cca2..a795c50d90 100644
--- a/drape/dynamic_texture.hpp
+++ b/drape/dynamic_texture.hpp
@@ -1,7 +1,6 @@
#pragma once
#include "drape/texture.hpp"
-#include "drape/glconstants.hpp"
#include <atomic>
#include <vector>
@@ -78,7 +77,7 @@ public:
Texture::Bind();
}
- void SetFilter(glConst filter) override
+ void SetFilter(TextureFilter filter) override
{
if (m_isInitialized)
Texture::SetFilter(filter);
@@ -93,7 +92,7 @@ protected:
{
m2::PointU m_size;
dp::TextureFormat m_format;
- glConst m_filter;
+ TextureFilter m_filter;
bool m_usePixelBuffer;
};
diff --git a/drape/font_texture.hpp b/drape/font_texture.hpp
index be664ae1f4..f3aea98e09 100644
--- a/drape/font_texture.hpp
+++ b/drape/font_texture.hpp
@@ -39,7 +39,7 @@ public:
, m_fixedSize(fixedSize)
{}
- Texture::ResourceType GetType() const { return Texture::Glyph; }
+ Texture::ResourceType GetType() const { return Texture::ResourceType::Glyph; }
strings::UniChar GetUnicodePoint() const { return m_unicodePoint; }
int GetFixedSize() const { return m_fixedSize; }
@@ -66,7 +66,7 @@ public:
{}
~GlyphInfo() override = default;
- Texture::ResourceType GetType() const override { return Texture::Glyph; }
+ Texture::ResourceType GetType() const override { return Texture::ResourceType::Glyph; }
GlyphManager::GlyphMetrics const & GetMetrics() const { return m_metrics; }
private:
@@ -111,16 +111,16 @@ private:
std::mutex m_mutex;
};
-class FontTexture : public DynamicTexture<GlyphIndex, GlyphKey, Texture::Glyph>
+class FontTexture : public DynamicTexture<GlyphIndex, GlyphKey, Texture::ResourceType::Glyph>
{
- using TBase = DynamicTexture<GlyphIndex, GlyphKey, Texture::Glyph>;
+ using TBase = DynamicTexture<GlyphIndex, GlyphKey, Texture::ResourceType::Glyph>;
public:
FontTexture(m2::PointU const & size, ref_ptr<GlyphManager> glyphMng,
ref_ptr<GlyphGenerator> glyphGenerator, ref_ptr<HWTextureAllocator> allocator)
: m_index(size, glyphMng, glyphGenerator)
{
- TBase::TextureParams params{size, TextureFormat::ALPHA,
- gl_const::GLLinear, true /* m_usePixelBuffer */};
+ TBase::TextureParams params{size, TextureFormat::Alpha,
+ TextureFilter::Linear, true /* m_usePixelBuffer */};
TBase::Init(allocator, make_ref(&m_index), params);
}
diff --git a/drape/glconstants.cpp b/drape/glconstants.cpp
index afa77d6907..6a06dab62b 100644
--- a/drape/glconstants.cpp
+++ b/drape/glconstants.cpp
@@ -166,8 +166,8 @@ const glConst GLMagFilter = GL_TEXTURE_MAG_FILTER;
const glConst GLWrapS = GL_TEXTURE_WRAP_S;
const glConst GLWrapT = GL_TEXTURE_WRAP_T;
-const glConst GLRepeate = GL_REPEAT;
-const glConst GLMirroredRepeate = GL_MIRRORED_REPEAT;
+const glConst GLRepeat = GL_REPEAT;
+const glConst GLMirroredRepeat = GL_MIRRORED_REPEAT;
const glConst GLClampToEdge = GL_CLAMP_TO_EDGE;
const glConst GLLinear = GL_LINEAR;
@@ -204,10 +204,10 @@ const glConst GLSrcColor = GL_SRC_COLOR;
const glConst GLOneMinusSrcColor = GL_ONE_MINUS_SRC_COLOR;
const glConst GLDstColor = GL_DST_COLOR;
const glConst GLOneMinusDstColor = GL_ONE_MINUS_DST_COLOR;
-const glConst GLSrcAlfa = GL_SRC_ALPHA;
-const glConst GLOneMinusSrcAlfa = GL_ONE_MINUS_SRC_ALPHA;
-const glConst GLDstAlfa = GL_DST_ALPHA;
-const glConst GLOneMinusDstAlfa = GL_ONE_MINUS_DST_ALPHA;
+const glConst GLSrcAlpha = GL_SRC_ALPHA;
+const glConst GLOneMinusSrcAlpha = GL_ONE_MINUS_SRC_ALPHA;
+const glConst GLDstAlpha = GL_DST_ALPHA;
+const glConst GLOneMinusDstAlpha = GL_ONE_MINUS_DST_ALPHA;
const glConst GLDepthTest = GL_DEPTH_TEST;
const glConst GLBlending = GL_BLEND;
diff --git a/drape/glconstants.hpp b/drape/glconstants.hpp
index 40e4d475e9..9517174334 100644
--- a/drape/glconstants.hpp
+++ b/drape/glconstants.hpp
@@ -89,8 +89,8 @@ extern const glConst GLWrapS;
extern const glConst GLWrapT;
/// Texture Wrap Modes
-extern const glConst GLRepeate;
-extern const glConst GLMirroredRepeate;
+extern const glConst GLRepeat;
+extern const glConst GLMirroredRepeat;
extern const glConst GLClampToEdge;
/// Texture Filter Modes
@@ -131,10 +131,10 @@ extern const glConst GLSrcColor;
extern const glConst GLOneMinusSrcColor;
extern const glConst GLDstColor;
extern const glConst GLOneMinusDstColor;
-extern const glConst GLSrcAlfa;
-extern const glConst GLOneMinusSrcAlfa;
-extern const glConst GLDstAlfa;
-extern const glConst GLOneMinusDstAlfa;
+extern const glConst GLSrcAlpha;
+extern const glConst GLOneMinusSrcAlpha;
+extern const glConst GLDstAlpha;
+extern const glConst GLOneMinusDstAlpha;
/// OpenGL states
extern const glConst GLDepthTest;
diff --git a/drape/hw_texture.cpp b/drape/hw_texture.cpp
index b6b13a0e02..b7218fb2c4 100644
--- a/drape/hw_texture.cpp
+++ b/drape/hw_texture.cpp
@@ -1,7 +1,7 @@
-#include "hw_texture.hpp"
+#include "drape/hw_texture.hpp"
-#include "glextensions_list.hpp"
-#include "glfunctions.hpp"
+#include "drape/glextensions_list.hpp"
+#include "drape/glfunctions.hpp"
#include "platform/platform.hpp"
@@ -13,23 +13,57 @@
#endif
#if defined(OMIM_OS_IPHONE)
-#include "hw_texture_ios.hpp"
+#include "drape/hw_texture_ios.hpp"
#endif
#define ASSERT_ID ASSERT(GetID() != 0, ())
namespace dp
{
-HWTexture::HWTexture()
- : m_width(0)
- , m_height(0)
- , m_format(UNSPECIFIED)
- , m_textureID(0)
- , m_filter(gl_const::GLLinear)
- , m_pixelBufferID(0)
- , m_pixelBufferSize(0)
- , m_pixelBufferElementSize(0)
-{}
+void UnpackFormat(TextureFormat format, glConst & layout, glConst & pixelType)
+{
+ // Now we support only 1-byte-per-channel textures.
+ pixelType = gl_const::GL8BitOnChannel;
+
+ switch (format)
+ {
+ case TextureFormat::RGBA8: layout = gl_const::GLRGBA; return;
+ case TextureFormat::Alpha:
+ // On OpenGL ES3 GLAlpha is not supported, we use GLRed instead.
+ layout = GLFunctions::CurrentApiVersion == dp::ApiVersion::OpenGLES2 ? gl_const::GLAlpha
+ : gl_const::GLRed;
+ return;
+ case TextureFormat::RedGreen:
+ // On OpenGL ES2 2-channel textures are not supported.
+ layout = GLFunctions::CurrentApiVersion == dp::ApiVersion::OpenGLES2 ? gl_const::GLRGBA
+ : gl_const::GLRedGreen;
+ return;
+ case TextureFormat::Unspecified:
+ CHECK(false, ());
+ return;
+ }
+ ASSERT(false, ());
+}
+
+glConst DecodeTextureFilter(TextureFilter filter)
+{
+ switch (filter)
+ {
+ case TextureFilter::Linear: return gl_const::GLLinear;
+ case TextureFilter::Nearest: return gl_const::GLNearest;
+ }
+ ASSERT(false, ());
+}
+
+glConst DecodeTextureWrapping(TextureWrapping wrapping)
+{
+ switch (wrapping)
+ {
+ case TextureWrapping::ClampToEdge: return gl_const::GLClampToEdge;
+ case TextureWrapping::Repeat: return gl_const::GLRepeat;
+ }
+ ASSERT(false, ());
+}
HWTexture::~HWTexture()
{
@@ -41,7 +75,7 @@ HWTexture::~HWTexture()
void HWTexture::Create(Params const & params) { Create(params, nullptr); }
-void HWTexture::Create(Params const & params, ref_ptr<void> /*data*/)
+void HWTexture::Create(Params const & params, ref_ptr<void> /* data */)
{
m_width = params.m_width;
m_height = params.m_height;
@@ -86,37 +120,13 @@ uint32_t HWTexture::GetHeight() const
float HWTexture::GetS(uint32_t x) const
{
ASSERT_ID;
- return x / (float)m_width;
+ return x / static_cast<float>(m_width);
}
float HWTexture::GetT(uint32_t y) const
{
ASSERT_ID;
- return y / (float)m_height;
-}
-
-void HWTexture::UnpackFormat(TextureFormat format, glConst & layout, glConst & pixelType)
-{
- // Now we support only 1-byte-per-channel textures.
- pixelType = gl_const::GL8BitOnChannel;
-
- switch (format)
- {
- case RGBA8:
- layout = gl_const::GLRGBA;
- break;
- case ALPHA:
- // On OpenGL ES3 GLAlpha is not supported, we use GLRed instead.
- layout = GLFunctions::CurrentApiVersion == dp::ApiVersion::OpenGLES2 ? gl_const::GLAlpha
- : gl_const::GLRed;
- break;
- case RED_GREEN:
- // On OpenGL ES2 2-channel textures are not supported.
- layout = GLFunctions::CurrentApiVersion == dp::ApiVersion::OpenGLES2 ? gl_const::GLRGBA
- : gl_const::GLRedGreen;
- break;
- default: ASSERT(false, ()); break;
- }
+ return y / static_cast<float>(m_height);
}
void HWTexture::Bind() const
@@ -126,13 +136,14 @@ void HWTexture::Bind() const
GLFunctions::glBindTexture(GetID());
}
-void HWTexture::SetFilter(glConst filter)
+void HWTexture::SetFilter(TextureFilter filter)
{
if (m_filter != filter)
{
m_filter = filter;
- GLFunctions::glTexParameter(gl_const::GLMinFilter, m_filter);
- GLFunctions::glTexParameter(gl_const::GLMagFilter, m_filter);
+ auto const f = DecodeTextureFilter(m_filter);
+ GLFunctions::glTexParameter(gl_const::GLMinFilter, f);
+ GLFunctions::glTexParameter(gl_const::GLMagFilter, f);
}
}
@@ -161,11 +172,12 @@ void OpenGLHWTexture::Create(Params const & params, ref_ptr<void> data)
glConst pixelType;
UnpackFormat(m_format, layout, pixelType);
+ auto const f = DecodeTextureFilter(m_filter);
GLFunctions::glTexImage2D(m_width, m_height, layout, pixelType, data.get());
- GLFunctions::glTexParameter(gl_const::GLMinFilter, params.m_filter);
- GLFunctions::glTexParameter(gl_const::GLMagFilter, params.m_filter);
- GLFunctions::glTexParameter(gl_const::GLWrapS, params.m_wrapSMode);
- GLFunctions::glTexParameter(gl_const::GLWrapT, params.m_wrapTMode);
+ GLFunctions::glTexParameter(gl_const::GLMinFilter, f);
+ GLFunctions::glTexParameter(gl_const::GLMagFilter, f);
+ GLFunctions::glTexParameter(gl_const::GLWrapS, DecodeTextureWrapping(params.m_wrapSMode));
+ GLFunctions::glTexParameter(gl_const::GLWrapT, DecodeTextureWrapping(params.m_wrapTMode));
if (m_pixelBufferSize > 0)
{
diff --git a/drape/hw_texture.hpp b/drape/hw_texture.hpp
index 6afdf17f67..7fb1ffa1d2 100644
--- a/drape/hw_texture.hpp
+++ b/drape/hw_texture.hpp
@@ -1,8 +1,8 @@
#pragma once
-#include "glconstants.hpp"
-#include "pointers.hpp"
-#include "drape_global.hpp"
+#include "drape/glconstants.hpp"
+#include "drape/pointers.hpp"
+#include "drape/texture_types.hpp"
#include <cstdint>
@@ -13,26 +13,17 @@ class HWTextureAllocator;
class HWTexture
{
public:
- HWTexture();
virtual ~HWTexture();
struct Params
{
- Params()
- : m_filter(gl_const::GLLinear)
- , m_wrapSMode(gl_const::GLClampToEdge)
- , m_wrapTMode(gl_const::GLClampToEdge)
- , m_format(UNSPECIFIED)
- , m_usePixelBuffer(false)
- {}
-
- uint32_t m_width;
- uint32_t m_height;
- glConst m_filter;
- glConst m_wrapSMode;
- glConst m_wrapTMode;
- TextureFormat m_format;
- bool m_usePixelBuffer;
+ uint32_t m_width = 0;
+ uint32_t m_height = 0;
+ TextureFilter m_filter = TextureFilter::Linear;
+ TextureWrapping m_wrapSMode = TextureWrapping::ClampToEdge;
+ TextureWrapping m_wrapTMode = TextureWrapping::ClampToEdge;
+ TextureFormat m_format = TextureFormat::Unspecified;
+ bool m_usePixelBuffer = false;
ref_ptr<HWTextureAllocator> m_allocator;
};
@@ -45,7 +36,7 @@ public:
void Bind() const;
// Texture must be bound before calling this method.
- void SetFilter(glConst filter);
+ void SetFilter(TextureFilter filter);
TextureFormat GetFormat() const;
uint32_t GetWidth() const;
@@ -56,22 +47,20 @@ public:
uint32_t GetID() const;
protected:
- void UnpackFormat(TextureFormat format, glConst & layout, glConst & pixelType);
-
- uint32_t m_width;
- uint32_t m_height;
- TextureFormat m_format;
- uint32_t m_textureID;
- glConst m_filter;
- uint32_t m_pixelBufferID;
- uint32_t m_pixelBufferSize;
- uint32_t m_pixelBufferElementSize;
+ uint32_t m_width = 0;
+ uint32_t m_height = 0;
+ TextureFormat m_format = TextureFormat::Unspecified;
+ uint32_t m_textureID = 0;
+ TextureFilter m_filter = TextureFilter::Linear;
+ uint32_t m_pixelBufferID = 0;
+ uint32_t m_pixelBufferSize = 0;
+ uint32_t m_pixelBufferElementSize = 0;
};
class HWTextureAllocator
{
public:
- virtual ~HWTextureAllocator() {}
+ virtual ~HWTextureAllocator() = default;
virtual drape_ptr<HWTexture> CreateTexture() = 0;
virtual void Flush() = 0;
@@ -82,7 +71,7 @@ class OpenGLHWTexture : public HWTexture
using TBase = HWTexture;
public:
- ~OpenGLHWTexture();
+ ~OpenGLHWTexture() override;
void Create(Params const & params, ref_ptr<void> data) override;
void UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t height,
ref_ptr<void> data) override;
@@ -97,4 +86,8 @@ public:
ref_ptr<HWTextureAllocator> GetDefaultAllocator();
drape_ptr<HWTextureAllocator> CreateAllocator();
+
+void UnpackFormat(TextureFormat format, glConst & layout, glConst & pixelType);
+glConst DecodeTextureFilter(TextureFilter filter);
+glConst DecodeTextureWrapping(TextureWrapping wrapping);
} // namespace dp
diff --git a/drape/hw_texture_ios.hpp b/drape/hw_texture_ios.hpp
index f93ca15f9f..fc714d3c67 100644
--- a/drape/hw_texture_ios.hpp
+++ b/drape/hw_texture_ios.hpp
@@ -1,9 +1,10 @@
#pragma once
-#import "hw_texture.hpp"
+#include "drape/glconstants.hpp"
+#include "drape/hw_texture.hpp"
#ifndef OMIM_OS_IPHONE
- #error Only for ios
+ #error Only for iOS
#endif
#import <CoreVideo/CVPixelBuffer.h>
@@ -12,18 +13,17 @@
namespace dp
{
-
class HWTextureAllocatorApple : public HWTextureAllocator
{
public:
HWTextureAllocatorApple();
~HWTextureAllocatorApple();
- CVPixelBufferRef CVCreatePixelBuffer(uint32_t width, uint32_t height, int format);
+ CVPixelBufferRef CVCreatePixelBuffer(uint32_t width, uint32_t height, dp::TextureFormat format);
void CVDestroyPixelBuffer(CVPixelBufferRef buffer);
CVOpenGLESTextureRef CVCreateTexture(CVPixelBufferRef buffer, uint32_t width, uint32_t height,
- glConst layout, glConst pixelType);
+ glConst layout, glConst pixelType);
void CVDestroyTexture(CVOpenGLESTextureRef texture);
void RiseFlushFlag();
@@ -51,12 +51,10 @@ private:
void Lock();
void Unlock();
-private:
CVPixelBufferRef m_directBuffer;
CVOpenGLESTextureRef m_texture;
ref_ptr<HWTextureAllocatorApple> m_allocator;
void * m_directPointer;
};
-
-}
+} // namespace dp
diff --git a/drape/hw_texture_ios.mm b/drape/hw_texture_ios.mm
index 68ac455b97..9f7a9f3cc1 100644
--- a/drape/hw_texture_ios.mm
+++ b/drape/hw_texture_ios.mm
@@ -1,10 +1,9 @@
-#include "hw_texture_ios.hpp"
-
-#include "base/logging.hpp"
-
+#include "drape/hw_texture_ios.hpp"
#include "drape/glfunctions.hpp"
#include "drape/glIncludes.hpp"
+#include "base/logging.hpp"
+
#import <QuartzCore/CAEAGLLayer.h>
#import <Foundation/NSDictionary.h>
@@ -37,7 +36,6 @@ using boost::gil::copy_pixels;
namespace dp
{
-
HWTextureAllocatorApple::HWTextureAllocatorApple()
{
CVReturn cvRetval = CVOpenGLESTextureCacheCreate(kCFAllocatorDefault, nullptr,
@@ -52,7 +50,8 @@ HWTextureAllocatorApple::~HWTextureAllocatorApple()
CFRelease(m_textureCache);
}
-CVPixelBufferRef HWTextureAllocatorApple::CVCreatePixelBuffer(uint32_t width, uint32_t height, int format)
+CVPixelBufferRef HWTextureAllocatorApple::CVCreatePixelBuffer(uint32_t width, uint32_t height,
+ dp::TextureFormat format)
{
NSDictionary * attrs = [NSDictionary dictionaryWithObjectsAndKeys:
[NSDictionary dictionary], kCVPixelBufferIOSurfacePropertiesKey,
@@ -66,10 +65,11 @@ CVPixelBufferRef HWTextureAllocatorApple::CVCreatePixelBuffer(uint32_t width, ui
CVReturn cvRetval = 0;
switch (format)
{
- case dp::RGBA8:
- cvRetval = CVPixelBufferCreate(kCFAllocatorDefault, width, height, kCVPixelFormatType_32BGRA, attrsRef, &result);
+ case dp::TextureFormat::RGBA8:
+ cvRetval = CVPixelBufferCreate(kCFAllocatorDefault, width, height, kCVPixelFormatType_32BGRA,
+ attrsRef, &result);
break;
- case dp::ALPHA:
+ case dp::TextureFormat::Alpha:
cvRetval = CVPixelBufferCreate(kCFAllocatorDefault, width, height, kCVPixelFormatType_OneComponent8,
attrsRef, &result);
break;
@@ -156,10 +156,11 @@ void HWTextureApple::Create(Params const & params, ref_ptr<void> data)
m_textureID = CVOpenGLESTextureGetName(m_texture);
GLFunctions::glBindTexture(m_textureID);
- GLFunctions::glTexParameter(gl_const::GLMinFilter, params.m_filter);
- GLFunctions::glTexParameter(gl_const::GLMagFilter, params.m_filter);
- GLFunctions::glTexParameter(gl_const::GLWrapS, params.m_wrapSMode);
- GLFunctions::glTexParameter(gl_const::GLWrapT, params.m_wrapTMode);
+ auto const f = DecodeTextureFilter(params.m_filter);
+ GLFunctions::glTexParameter(gl_const::GLMinFilter, f);
+ GLFunctions::glTexParameter(gl_const::GLMagFilter, f);
+ GLFunctions::glTexParameter(gl_const::GLWrapS, DecodeTextureWrapping(params.m_wrapSMode));
+ GLFunctions::glTexParameter(gl_const::GLWrapT, DecodeTextureWrapping(params.m_wrapTMode));
if (data == nullptr)
return;
@@ -211,5 +212,4 @@ void HWTextureApple::Unlock()
CHECK_EQUAL(CVPixelBufferUnlockBaseAddress(m_directBuffer, 0), kCVReturnSuccess, ());
m_allocator->RiseFlushFlag();
}
-
-}
+} // namespace dp
diff --git a/drape/render_state.cpp b/drape/render_state.cpp
index 90e4cd987b..2a1063e148 100644
--- a/drape/render_state.cpp
+++ b/drape/render_state.cpp
@@ -5,16 +5,30 @@
namespace dp
{
-BlendingParams::BlendingParams()
- : m_blendFunction(gl_const::GLAddBlend)
- , m_blendSrcFactor(gl_const::GLSrcAlfa)
- , m_blendDstFactor(gl_const::GLOneMinusSrcAlfa)
-{}
+namespace
+{
+glConst DecodeDepthFunction(DepthFunction depthFunction)
+{
+ switch (depthFunction)
+ {
+ case DepthFunction::Never: return gl_const::GLNever;
+ case DepthFunction::Less: return gl_const::GLLess;
+ case DepthFunction::Equal: return gl_const::GLEqual;
+ case DepthFunction::LessOrEqual: return gl_const::GLLessOrEqual;
+ case DepthFunction::Great: return gl_const::GLGreat;
+ case DepthFunction::NotEqual: return gl_const::GLNotEqual;
+ case DepthFunction::GreatOrEqual: return gl_const::GLGreatOrEqual;
+ case DepthFunction::Always: return gl_const::GLAlways;
+ }
+ ASSERT(false, ());
+}
+} // namespace
-void BlendingParams::Apply() const
+// static
+void AlphaBlendingState::Apply()
{
- GLFunctions::glBlendEquation(m_blendFunction);
- GLFunctions::glBlendFunc(m_blendSrcFactor, m_blendDstFactor);
+ GLFunctions::glBlendEquation(gl_const::GLAddBlend);
+ GLFunctions::glBlendFunc(gl_const::GLSrcAlpha, gl_const::GLOneMinusSrcAlpha);
}
Blending::Blending(bool isEnabled)
@@ -33,14 +47,14 @@ bool Blending::operator<(Blending const & other) const { return m_isEnabled < ot
bool Blending::operator==(Blending const & other) const { return m_isEnabled == other.m_isEnabled; }
-glConst RenderState::GetDepthFunction() const
+DepthFunction RenderState::GetDepthFunction() const
{
return m_depthFunction;
}
-void RenderState::SetDepthFunction(glConst functionName)
+void RenderState::SetDepthFunction(DepthFunction depthFunction)
{
- m_depthFunction = functionName;
+ m_depthFunction = depthFunction;
}
bool RenderState::GetDepthTestEnabled() const
@@ -53,12 +67,12 @@ void RenderState::SetDepthTestEnabled(bool enabled)
m_depthTestEnabled = enabled;
}
-glConst RenderState::GetTextureFilter() const
+TextureFilter RenderState::GetTextureFilter() const
{
return m_textureFilter;
}
-void RenderState::SetTextureFilter(glConst filter)
+void RenderState::SetTextureFilter(TextureFilter filter)
{
m_textureFilter = filter;
}
@@ -172,7 +186,7 @@ void ApplyState(RenderState const & state, ref_ptr<GpuProgram> program)
if (state.GetDepthTestEnabled())
{
GLFunctions::glEnable(gl_const::GLDepthTest);
- GLFunctions::glDepthFunc(state.GetDepthFunction());
+ GLFunctions::glDepthFunc(DecodeDepthFunction(state.GetDepthFunction()));
}
else
{
diff --git a/drape/render_state.hpp b/drape/render_state.hpp
index 333e4f696d..f8b41d84e1 100644
--- a/drape/render_state.hpp
+++ b/drape/render_state.hpp
@@ -1,6 +1,5 @@
#pragma once
-#include "drape/glconstants.hpp"
#include "drape/gpu_program.hpp"
#include "drape/pointers.hpp"
#include "drape/texture.hpp"
@@ -11,15 +10,9 @@
namespace dp
{
-struct BlendingParams
+struct AlphaBlendingState
{
- BlendingParams();
-
- void Apply() const;
-
- glConst m_blendFunction;
- glConst m_blendSrcFactor;
- glConst m_blendDstFactor;
+ static void Apply();
};
struct Blending
@@ -34,6 +27,18 @@ struct Blending
bool m_isEnabled;
};
+enum class DepthFunction : uint8_t
+{
+ Never,
+ Less,
+ Equal,
+ LessOrEqual,
+ Great,
+ NotEqual,
+ GreatOrEqual,
+ Always
+};
+
class BaseRenderStateExtension
{
public:
@@ -79,14 +84,14 @@ public:
template<typename ProgramType>
ProgramType GetProgram3d() const { return static_cast<ProgramType>(m_gpuProgram3d); }
- glConst GetDepthFunction() const;
- void SetDepthFunction(glConst functionName);
+ DepthFunction GetDepthFunction() const;
+ void SetDepthFunction(DepthFunction depthFunction);
bool GetDepthTestEnabled() const;
void SetDepthTestEnabled(bool enabled);
- glConst GetTextureFilter() const;
- void SetTextureFilter(glConst filter);
+ TextureFilter GetTextureFilter() const;
+ void SetTextureFilter(TextureFilter filter);
bool GetDrawAsLine() const;
void SetDrawAsLine(bool drawAsLine);
@@ -104,9 +109,9 @@ private:
Blending m_blending;
bool m_depthTestEnabled = true;
- glConst m_depthFunction = gl_const::GLLessOrEqual;
+ DepthFunction m_depthFunction = DepthFunction::LessOrEqual;
- glConst m_textureFilter = gl_const::GLLinear;
+ TextureFilter m_textureFilter = TextureFilter::Linear;
ref_ptr<Texture> m_colorTexture;
ref_ptr<Texture> m_maskTexture;
diff --git a/drape/static_texture.cpp b/drape/static_texture.cpp
index 699219d449..3121088433 100644
--- a/drape/static_texture.cpp
+++ b/drape/static_texture.cpp
@@ -86,7 +86,7 @@ class StaticResourceInfo : public Texture::ResourceInfo
public:
StaticResourceInfo() : Texture::ResourceInfo(m2::RectF(0.0f, 0.0f, 1.0f, 1.0f)) {}
virtual ~StaticResourceInfo() {}
- Texture::ResourceType GetType() const override { return Texture::Static; }
+ Texture::ResourceType GetType() const override { return Texture::ResourceType::Static; }
};
} // namespace
@@ -110,8 +110,8 @@ bool StaticTexture::Load(ref_ptr<HWTextureAllocator> allocator)
p.m_format = m_format;
p.m_width = width;
p.m_height = height;
- p.m_wrapSMode = gl_const::GLRepeate;
- p.m_wrapTMode = gl_const::GLRepeate;
+ p.m_wrapSMode = TextureWrapping::Repeat;
+ p.m_wrapTMode = TextureWrapping::Repeat;
Create(p, make_ref(data));
};
@@ -137,7 +137,7 @@ ref_ptr<Texture::ResourceInfo> StaticTexture::FindResource(Texture::Key const &
bool & newResource)
{
newResource = false;
- if (key.GetType() != Texture::Static)
+ if (key.GetType() != Texture::ResourceType::Static)
return nullptr;
return make_ref(m_info);
}
@@ -147,7 +147,7 @@ void StaticTexture::Fail()
int32_t alphaTexture = 0;
Texture::Params p;
p.m_allocator = GetDefaultAllocator();
- p.m_format = dp::RGBA8;
+ p.m_format = dp::TextureFormat::RGBA8;
p.m_width = 1;
p.m_height = 1;
Create(p, make_ref(&alphaTexture));
diff --git a/drape/stipple_pen_resource.cpp b/drape/stipple_pen_resource.cpp
index c8a8762dca..cb8f1d8e75 100644
--- a/drape/stipple_pen_resource.cpp
+++ b/drape/stipple_pen_resource.cpp
@@ -166,7 +166,7 @@ ref_ptr<Texture::ResourceInfo> StipplePenIndex::MapResource(StipplePenKey const
void StipplePenIndex::UploadResources(ref_ptr<Texture> texture)
{
- ASSERT(texture->GetFormat() == dp::ALPHA, ());
+ ASSERT(texture->GetFormat() == dp::TextureFormat::Alpha, ());
TPendingNodes pendingNodes;
{
std::lock_guard<std::mutex> g(m_lock);
diff --git a/drape/stipple_pen_resource.hpp b/drape/stipple_pen_resource.hpp
index 02e97abe94..57143e1ed4 100644
--- a/drape/stipple_pen_resource.hpp
+++ b/drape/stipple_pen_resource.hpp
@@ -22,7 +22,7 @@ class StipplePenKey : public Texture::Key
public:
StipplePenKey() = default;
StipplePenKey(buffer_vector<uint8_t, 8> const & pattern) : m_pattern(pattern) {}
- virtual Texture::ResourceType GetType() const { return Texture::StipplePen; }
+ virtual Texture::ResourceType GetType() const { return Texture::ResourceType::StipplePen; }
buffer_vector<uint8_t, 8> m_pattern;
};
@@ -72,7 +72,7 @@ public:
{
}
- virtual Texture::ResourceType GetType() const { return Texture::StipplePen; }
+ virtual Texture::ResourceType GetType() const { return Texture::ResourceType::StipplePen; }
uint32_t GetMaskPixelLength() const { return m_pixelLength; }
uint32_t GetPatternPixelLength() const { return m_patternLength; }
@@ -118,18 +118,18 @@ private:
std::string DebugPrint(StipplePenHandle const & key);
-class StipplePenTexture : public DynamicTexture<StipplePenIndex, StipplePenKey, Texture::StipplePen>
+class StipplePenTexture : public DynamicTexture<StipplePenIndex, StipplePenKey, Texture::ResourceType::StipplePen>
{
- typedef DynamicTexture<StipplePenIndex, StipplePenKey, Texture::StipplePen> TBase;
+ typedef DynamicTexture<StipplePenIndex, StipplePenKey, Texture::ResourceType::StipplePen> TBase;
public:
StipplePenTexture(m2::PointU const & size, ref_ptr<HWTextureAllocator> allocator)
: m_index(size)
{
- TBase::TextureParams params{size, TextureFormat::ALPHA, gl_const::GLNearest, false /* m_usePixelBuffer */};
+ TBase::TextureParams params{size, TextureFormat::Alpha, TextureFilter::Nearest, false /* m_usePixelBuffer */};
TBase::Init(allocator, make_ref(&m_index), params);
}
- ~StipplePenTexture() { TBase::Reset(); }
+ ~StipplePenTexture() override { TBase::Reset(); }
void ReservePattern(buffer_vector<uint8_t, 8> const & pattern);
diff --git a/drape/symbols_texture.cpp b/drape/symbols_texture.cpp
index d66b2fd1f3..439d51e32d 100644
--- a/drape/symbols_texture.cpp
+++ b/drape/symbols_texture.cpp
@@ -16,10 +16,8 @@
namespace dp
{
-
namespace
{
-
using TDefinitionInserter = function<void(string const &, m2::RectF const &)>;
using TSymbolsLoadingCompletion = function<void(unsigned char *, uint32_t, uint32_t)>;
using TSymbolsLoadingFailure = function<void(string const &)>;
@@ -32,10 +30,9 @@ public:
, m_convertToUV(convertToUV)
, m_width(0)
, m_height(0)
- {
- }
+ {}
- bool Push(string const & /*element*/) { return true;}
+ bool Push(string const & /*element*/) { return true; }
void Pop(string const & element)
{
@@ -171,17 +168,15 @@ void LoadSymbols(std::string const & skinPathName, std::string const & textureNa
stbi_image_free(data);
}
-
-}
+} // namespace
SymbolsTexture::SymbolKey::SymbolKey(string const & symbolName)
: m_symbolName(symbolName)
-{
-}
+{}
Texture::ResourceType SymbolsTexture::SymbolKey::GetType() const
{
- return Texture::Symbol;
+ return Texture::ResourceType::Symbol;
}
string const & SymbolsTexture::SymbolKey::GetSymbolName() const
@@ -191,12 +186,11 @@ string const & SymbolsTexture::SymbolKey::GetSymbolName() const
SymbolsTexture::SymbolInfo::SymbolInfo(const m2::RectF & texRect)
: ResourceInfo(texRect)
-{
-}
+{}
Texture::ResourceType SymbolsTexture::SymbolInfo::GetType() const
{
- return Symbol;
+ return Texture::ResourceType::Symbol;
}
SymbolsTexture::SymbolsTexture(std::string const & skinPathName, std::string const & textureName,
@@ -217,7 +211,7 @@ void SymbolsTexture::Load(std::string const & skinPathName, ref_ptr<HWTextureAll
{
Texture::Params p;
p.m_allocator = allocator;
- p.m_format = dp::RGBA8;
+ p.m_format = dp::TextureFormat::RGBA8;
p.m_width = width;
p.m_height = height;
@@ -245,12 +239,12 @@ void SymbolsTexture::Invalidate(string const & skinPathName, ref_ptr<HWTextureAl
ref_ptr<Texture::ResourceInfo> SymbolsTexture::FindResource(Texture::Key const & key, bool & newResource)
{
newResource = false;
- if (key.GetType() != Texture::Symbol)
+ if (key.GetType() != Texture::ResourceType::Symbol)
return nullptr;
string const & symbolName = static_cast<SymbolKey const &>(key).GetSymbolName();
- TSymDefinition::iterator it = m_definition.find(symbolName);
+ auto it = m_definition.find(symbolName);
ASSERT(it != m_definition.end(), (symbolName));
return make_ref(&it->second);
}
@@ -261,7 +255,7 @@ void SymbolsTexture::Fail()
int32_t alfaTexture = 0;
Texture::Params p;
p.m_allocator = GetDefaultAllocator();
- p.m_format = dp::RGBA8;
+ p.m_format = dp::TextureFormat::RGBA8;
p.m_width = 1;
p.m_height = 1;
@@ -305,5 +299,4 @@ bool SymbolsTexture::DecodeToMemory(std::string const & skinPathName, std::strin
definitionInserter, completionHandler, failureHandler);
return result;
}
-
-} // namespace dp
+} // namespace dp
diff --git a/drape/texture.cpp b/drape/texture.cpp
index 39bbd60c7d..b09e35b180 100644
--- a/drape/texture.cpp
+++ b/drape/texture.cpp
@@ -77,7 +77,7 @@ void Texture::Bind() const
m_hwTexture->Bind();
}
-void Texture::SetFilter(glConst filter)
+void Texture::SetFilter(TextureFilter filter)
{
ASSERT(m_hwTexture != nullptr, ());
m_hwTexture->SetFilter(filter);
diff --git a/drape/texture.hpp b/drape/texture.hpp
index 979a251082..679eb121c5 100644
--- a/drape/texture.hpp
+++ b/drape/texture.hpp
@@ -1,9 +1,8 @@
#pragma once
-#include "drape/drape_global.hpp"
-#include "drape/glconstants.hpp"
#include "drape/hw_texture.hpp"
#include "drape/pointers.hpp"
+#include "drape/texture_types.hpp"
#include "geometry/rect2d.hpp"
@@ -17,7 +16,7 @@ namespace dp
class Texture
{
public:
- enum ResourceType
+ enum class ResourceType : uint8_t
{
Symbol,
Glyph,
@@ -29,15 +28,15 @@ public:
class Key
{
public:
- virtual ~Key() {}
+ virtual ~Key() = default;
virtual ResourceType GetType() const = 0;
};
class ResourceInfo
{
public:
- ResourceInfo(m2::RectF const & texRect);
- virtual ~ResourceInfo() {}
+ explicit ResourceInfo(m2::RectF const & texRect);
+ virtual ~ResourceInfo() = default;
virtual ResourceType GetType() const = 0;
m2::RectF const & GetTexRect() const;
@@ -50,7 +49,7 @@ public:
virtual ref_ptr<ResourceInfo> FindResource(Key const & key, bool & newResource) = 0;
virtual void UpdateState() {}
- virtual bool HasEnoughSpace(uint32_t /*newKeysCount*/) const { return true; }
+ virtual bool HasEnoughSpace(uint32_t /* newKeysCount */) const { return true; }
using Params = HWTexture::Params;
virtual TextureFormat GetFormat() const;
@@ -63,7 +62,7 @@ public:
virtual void Bind() const;
// Texture must be bound before calling this method.
- virtual void SetFilter(glConst filter);
+ virtual void SetFilter(TextureFilter filter);
void Create(Params const & params);
void Create(Params const & params, ref_ptr<void> data);
diff --git a/drape/texture_manager.cpp b/drape/texture_manager.cpp
index ee280d80ab..d0c2bb2eed 100644
--- a/drape/texture_manager.cpp
+++ b/drape/texture_manager.cpp
@@ -199,37 +199,37 @@ TextureManager::GlyphRegion::GlyphRegion()
float TextureManager::GlyphRegion::GetOffsetX() const
{
- ASSERT(m_info->GetType() == Texture::Glyph, ());
+ ASSERT(m_info->GetType() == Texture::ResourceType::Glyph, ());
return ref_ptr<GlyphInfo>(m_info)->GetMetrics().m_xOffset;
}
float TextureManager::GlyphRegion::GetOffsetY() const
{
- ASSERT(m_info->GetType() == Texture::Glyph, ());
+ ASSERT(m_info->GetType() == Texture::ResourceType::Glyph, ());
return ref_ptr<GlyphInfo>(m_info)->GetMetrics().m_yOffset;
}
float TextureManager::GlyphRegion::GetAdvanceX() const
{
- ASSERT(m_info->GetType() == Texture::Glyph, ());
+ ASSERT(m_info->GetType() == Texture::ResourceType::Glyph, ());
return ref_ptr<GlyphInfo>(m_info)->GetMetrics().m_xAdvance;
}
float TextureManager::GlyphRegion::GetAdvanceY() const
{
- ASSERT(m_info->GetType() == Texture::Glyph, ());
+ ASSERT(m_info->GetType() == Texture::ResourceType::Glyph, ());
return ref_ptr<GlyphInfo>(m_info)->GetMetrics().m_yAdvance;
}
uint32_t TextureManager::StippleRegion::GetMaskPixelLength() const
{
- ASSERT(m_info->GetType() == Texture::StipplePen, ());
+ ASSERT(m_info->GetType() == Texture::ResourceType::StipplePen, ());
return ref_ptr<StipplePenResourceInfo>(m_info)->GetMaskPixelLength();
}
uint32_t TextureManager::StippleRegion::GetPatternPixelLength() const
{
- ASSERT(m_info->GetType() == Texture::StipplePen, ());
+ ASSERT(m_info->GetType() == Texture::ResourceType::StipplePen, ());
return ref_ptr<StipplePenResourceInfo>(m_info)->GetPatternPixelLength();
}
@@ -480,16 +480,16 @@ void TextureManager::Init(Params const & params)
// Initialize static textures.
m_trafficArrowTexture = make_unique_dp<StaticTexture>("traffic-arrow", m_resPostfix,
- dp::RGBA8, make_ref(m_textureAllocator));
+ dp::TextureFormat::RGBA8, make_ref(m_textureAllocator));
m_hatchingTexture = make_unique_dp<StaticTexture>("area-hatching", m_resPostfix,
- dp::RGBA8, make_ref(m_textureAllocator));
+ dp::TextureFormat::RGBA8, make_ref(m_textureAllocator));
if (GLFunctions::CurrentApiVersion == dp::ApiVersion::OpenGLES3)
{
m_smaaAreaTexture = make_unique_dp<StaticTexture>("smaa-area", StaticTexture::kDefaultResource,
- dp::RED_GREEN, make_ref(m_textureAllocator));
+ dp::TextureFormat::RedGreen, make_ref(m_textureAllocator));
m_smaaSearchTexture = make_unique_dp<StaticTexture>("smaa-search", StaticTexture::kDefaultResource,
- dp::ALPHA, make_ref(m_textureAllocator));
+ dp::TextureFormat::Alpha, make_ref(m_textureAllocator));
}
// Initialize patterns.
diff --git a/drape/texture_of_colors.cpp b/drape/texture_of_colors.cpp
index 4d1f37be4b..3194fbcf9d 100644
--- a/drape/texture_of_colors.cpp
+++ b/drape/texture_of_colors.cpp
@@ -72,7 +72,7 @@ ref_ptr<Texture::ResourceInfo> ColorPalette::MapResource(ColorKey const & key, b
void ColorPalette::UploadResources(ref_ptr<Texture> texture)
{
- ASSERT(texture->GetFormat() == dp::RGBA8, ());
+ ASSERT(texture->GetFormat() == dp::TextureFormat::RGBA8, ());
buffer_vector<PendingColor, 16> pendingNodes;
{
std::lock_guard<std::mutex> g(m_lock);
diff --git a/drape/texture_of_colors.hpp b/drape/texture_of_colors.hpp
index 619b73314b..c204882d89 100644
--- a/drape/texture_of_colors.hpp
+++ b/drape/texture_of_colors.hpp
@@ -14,8 +14,8 @@ namespace dp
class ColorKey : public Texture::Key
{
public:
- ColorKey(Color color) : Texture::Key(), m_color(color) {}
- virtual Texture::ResourceType GetType() const { return Texture::Color; }
+ explicit ColorKey(Color color) : Texture::Key(), m_color(color) {}
+ virtual Texture::ResourceType GetType() const { return Texture::ResourceType::Color; }
Color m_color;
};
@@ -23,14 +23,14 @@ public:
class ColorResourceInfo : public Texture::ResourceInfo
{
public:
- ColorResourceInfo(m2::RectF const & texRect) : Texture::ResourceInfo(texRect) { }
- virtual Texture::ResourceType GetType() const { return Texture::Color; }
+ explicit ColorResourceInfo(m2::RectF const & texRect) : Texture::ResourceInfo(texRect) { }
+ virtual Texture::ResourceType GetType() const { return Texture::ResourceType::Color; }
};
class ColorPalette
{
public:
- ColorPalette(m2::PointU const & canvasSize);
+ explicit ColorPalette(m2::PointU const & canvasSize);
ref_ptr<Texture::ResourceInfo> ReserveResource(bool predefined, ColorKey const & key, bool & newResource);
ref_ptr<Texture::ResourceInfo> MapResource(ColorKey const & key, bool & newResource);
@@ -57,14 +57,14 @@ private:
std::mutex m_mappingLock;
};
-class ColorTexture : public DynamicTexture<ColorPalette, ColorKey, Texture::Color>
+class ColorTexture : public DynamicTexture<ColorPalette, ColorKey, Texture::ResourceType::Color>
{
- typedef DynamicTexture<ColorPalette, ColorKey, Texture::Color> TBase;
+ typedef DynamicTexture<ColorPalette, ColorKey, Texture::ResourceType::Color> TBase;
public:
ColorTexture(m2::PointU const & size, ref_ptr<HWTextureAllocator> allocator)
: m_palette(size)
{
- TBase::TextureParams params{size, TextureFormat::RGBA8, gl_const::GLNearest, false /* m_usePixelBuffer */};
+ TBase::TextureParams params{size, TextureFormat::RGBA8, TextureFilter::Nearest, false /* m_usePixelBuffer */};
TBase::Init(allocator, make_ref(&m_palette), params);
}
diff --git a/drape/texture_types.hpp b/drape/texture_types.hpp
new file mode 100644
index 0000000000..20b1cc8ad6
--- /dev/null
+++ b/drape/texture_types.hpp
@@ -0,0 +1,41 @@
+#pragma once
+
+#include "base/assert.hpp"
+
+#include <cstdint>
+
+namespace dp
+{
+enum class TextureFormat : uint8_t
+{
+ RGBA8,
+ Alpha,
+ RedGreen,
+ Unspecified
+};
+
+enum class TextureFilter : uint8_t
+{
+ Nearest,
+ Linear
+};
+
+enum class TextureWrapping : uint8_t
+{
+ ClampToEdge,
+ Repeat
+};
+
+inline uint8_t GetBytesPerPixel(TextureFormat format)
+{
+ uint8_t result = 0;
+ switch (format)
+ {
+ case TextureFormat::RGBA8: result = 4; break;
+ case TextureFormat::Alpha: result = 1; break;
+ case TextureFormat::RedGreen: result = 2; break;
+ default: ASSERT(false, ()); break;
+ }
+ return result;
+}
+} // namespace dp
diff --git a/drape_frontend/area_shape.cpp b/drape_frontend/area_shape.cpp
index 7eb82cf708..21751f9c61 100644
--- a/drape_frontend/area_shape.cpp
+++ b/drape_frontend/area_shape.cpp
@@ -120,7 +120,7 @@ void AreaShape::DrawHatchingArea(ref_ptr<dp::Batcher> batcher, m2::PointD const
state.SetDepthTestEnabled(m_params.m_depthTestEnabled);
state.SetColorTexture(texture);
state.SetMaskTexture(hatchingTexture);
- state.SetTextureFilter(gl_const::GLLinear);
+ state.SetTextureFilter(dp::TextureFilter::Linear);
dp::AttributeProvider provider(1, static_cast<uint32_t>(vertexes.size()));
provider.InitStream(0, gpu::HatchingAreaVertex::GetBindingInfo(), make_ref(vertexes.data()));
diff --git a/drape_frontend/arrow3d.hpp b/drape_frontend/arrow3d.hpp
index 28946f2a47..fbad65540e 100644
--- a/drape_frontend/arrow3d.hpp
+++ b/drape_frontend/arrow3d.hpp
@@ -2,6 +2,7 @@
#include "drape_frontend/render_state_extension.hpp"
+#include "drape/color.hpp"
#include "drape/pointers.hpp"
#include "geometry/rect2d.hpp"
diff --git a/drape_frontend/colored_symbol_shape.cpp b/drape_frontend/colored_symbol_shape.cpp
index ae4f50ad8f..6cdd3ecb49 100644
--- a/drape_frontend/colored_symbol_shape.cpp
+++ b/drape_frontend/colored_symbol_shape.cpp
@@ -302,7 +302,7 @@ void ColoredSymbolShape::Draw(ref_ptr<dp::Batcher> batcher,
state.SetProgram3d(gpu::Program::ColoredSymbolBillboard);
state.SetDepthTestEnabled(m_params.m_depthTestEnabled);
state.SetColorTexture(colorRegion.GetTexture());
- state.SetDepthFunction(gl_const::GLLess);
+ state.SetDepthFunction(dp::DepthFunction::Less);
dp::AttributeProvider provider(1, static_cast<uint32_t>(buffer.size()));
provider.InitStream(0, gpu::ColoredSymbolVertex::GetBindingInfo(), make_ref(buffer.data()));
diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp
index c187a19272..45f180dae5 100755
--- a/drape_frontend/frontend_renderer.cpp
+++ b/drape_frontend/frontend_renderer.cpp
@@ -1886,8 +1886,7 @@ void FrontendRenderer::OnContextCreate()
m_gpuProgramManager = make_unique_dp<gpu::ProgramManager>();
m_gpuProgramManager->Init(m_apiVersion);
- dp::BlendingParams blendingParams;
- blendingParams.Apply();
+ dp::AlphaBlendingState::Apply();
// TODO: think on redesigning DebugRectRenderer to eliminate functor.
dp::DebugRectRenderer::Instance().Init(m_gpuProgramManager->GetProgram(gpu::Program::DebugRect),
diff --git a/drape_frontend/line_shape.cpp b/drape_frontend/line_shape.cpp
index 8681706dbc..903f53bd62 100644
--- a/drape_frontend/line_shape.cpp
+++ b/drape_frontend/line_shape.cpp
@@ -210,7 +210,7 @@ public:
auto state = CreateRenderState(gpu::Program::CapJoin, m_params.m_depthLayer);
state.SetDepthTestEnabled(m_params.m_depthTestEnabled);
state.SetColorTexture(m_params.m_color.GetTexture());
- state.SetDepthFunction(gl_const::GLLess);
+ state.SetDepthFunction(dp::DepthFunction::Less);
return state;
}
diff --git a/drape_frontend/poi_symbol_shape.cpp b/drape_frontend/poi_symbol_shape.cpp
index 33d1c8f681..d1d1a95e27 100644
--- a/drape_frontend/poi_symbol_shape.cpp
+++ b/drape_frontend/poi_symbol_shape.cpp
@@ -71,7 +71,7 @@ void Batch<SV>(ref_ptr<dp::Batcher> batcher, drape_ptr<dp::OverlayHandle> && han
state.SetProgram3d(gpu::Program::TexturingBillboard);
state.SetDepthTestEnabled(params.m_depthTestEnabled);
state.SetColorTexture(symbolRegion.GetTexture());
- state.SetTextureFilter(gl_const::GLNearest);
+ state.SetTextureFilter(dp::TextureFilter::Nearest);
dp::AttributeProvider provider(1 /* streamCount */, ARRAY_SIZE(vertexes));
provider.InitStream(0 /* streamIndex */, SV::GetBindingInfo(), make_ref(vertexes));
@@ -106,7 +106,7 @@ void Batch<MV>(ref_ptr<dp::Batcher> batcher, drape_ptr<dp::OverlayHandle> && han
state.SetDepthTestEnabled(params.m_depthTestEnabled);
state.SetColorTexture(symbolRegion.GetTexture());
state.SetMaskTexture(colorRegion.GetTexture()); // Here mask is a color.
- state.SetTextureFilter(gl_const::GLNearest);
+ state.SetTextureFilter(dp::TextureFilter::Nearest);
dp::AttributeProvider provider(1 /* streamCount */, ARRAY_SIZE(vertexes));
provider.InitStream(0 /* streamIndex */, MV::GetBindingInfo(), make_ref(vertexes));
diff --git a/drape_frontend/text_shape.cpp b/drape_frontend/text_shape.cpp
index c7d24eba04..59a246539e 100644
--- a/drape_frontend/text_shape.cpp
+++ b/drape_frontend/text_shape.cpp
@@ -324,7 +324,7 @@ void TextShape::DrawSubStringPlain(StraightTextLayout const & layout, dp::FontDe
state.SetMaskTexture(layout.GetMaskTexture());
if (isNonSdfText)
- state.SetTextureFilter(gl_const::GLNearest);
+ state.SetTextureFilter(dp::TextureFilter::Nearest);
gpu::TTextDynamicVertexBuffer initialDynBuffer(dynamicBuffer.size());
diff --git a/drape_frontend/user_mark_shapes.cpp b/drape_frontend/user_mark_shapes.cpp
index 91b04ed6bf..359be7c04f 100644
--- a/drape_frontend/user_mark_shapes.cpp
+++ b/drape_frontend/user_mark_shapes.cpp
@@ -414,7 +414,7 @@ void CacheUserMarks(TileKey const & tileKey, ref_ptr<dp::TextureManager> texture
state.SetProgram3d(isAnimated ? gpu::Program::BookmarkAnimBillboard
: gpu::Program::BookmarkBillboard);
state.SetColorTexture(region.GetTexture());
- state.SetTextureFilter(gl_const::GLNearest);
+ state.SetTextureFilter(dp::TextureFilter::Nearest);
state.SetDepthTestEnabled(depthTestEnabled);
dp::AttributeProvider attribProvider(1, static_cast<uint32_t>(buffer.size()));
diff --git a/xcode/drape/drape.xcodeproj/project.pbxproj b/xcode/drape/drape.xcodeproj/project.pbxproj
index 4b9ce35e0b..99a663746c 100644
--- a/xcode/drape/drape.xcodeproj/project.pbxproj
+++ b/xcode/drape/drape.xcodeproj/project.pbxproj
@@ -17,6 +17,7 @@
4513BF0D1EC2F0760066565C /* viewport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4513BF091EC2F0760066565C /* viewport.cpp */; };
4513BF0E1EC2F0760066565C /* viewport.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 4513BF0A1EC2F0760066565C /* viewport.hpp */; };
45201E951CE605B1008A4842 /* constants.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 45201E941CE605B1008A4842 /* constants.hpp */; };
+ 45447109211462A300D28C28 /* texture_types.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 45447108211462A300D28C28 /* texture_types.hpp */; };
457B536620358F7E00E4E752 /* drape_routine.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 457B536320358F7D00E4E752 /* drape_routine.hpp */; };
457B536720358F7E00E4E752 /* glyph_generator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 457B536420358F7D00E4E752 /* glyph_generator.cpp */; };
457B536820358F7E00E4E752 /* glyph_generator.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 457B536520358F7E00E4E752 /* glyph_generator.hpp */; };
@@ -124,6 +125,7 @@
4513BF091EC2F0760066565C /* viewport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = viewport.cpp; sourceTree = "<group>"; };
4513BF0A1EC2F0760066565C /* viewport.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = viewport.hpp; sourceTree = "<group>"; };
45201E941CE605B1008A4842 /* constants.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = constants.hpp; sourceTree = "<group>"; };
+ 45447108211462A300D28C28 /* texture_types.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = texture_types.hpp; sourceTree = "<group>"; };
457B536320358F7D00E4E752 /* drape_routine.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = drape_routine.hpp; sourceTree = "<group>"; };
457B536420358F7D00E4E752 /* glyph_generator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = glyph_generator.cpp; sourceTree = "<group>"; };
457B536520358F7E00E4E752 /* glyph_generator.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = glyph_generator.hpp; sourceTree = "<group>"; };
@@ -340,6 +342,7 @@
6729A5531A69213A007D5872 /* texture_manager.hpp */,
6729A5541A69213A007D5872 /* texture_of_colors.cpp */,
6729A5551A69213A007D5872 /* texture_of_colors.hpp */,
+ 45447108211462A300D28C28 /* texture_types.hpp */,
6729A5561A69213A007D5872 /* texture.cpp */,
6729A5571A69213A007D5872 /* texture.hpp */,
6729A5581A69213A007D5872 /* uniform_value.cpp */,
@@ -391,6 +394,7 @@
45D7ADE22113535600160DE3 /* render_state.hpp in Headers */,
6729A5681A69213A007D5872 /* batcher_helpers.hpp in Headers */,
6729A56A1A69213A007D5872 /* batcher.hpp in Headers */,
+ 45447109211462A300D28C28 /* texture_types.hpp in Headers */,
675D219A1BFB876E00717E4F /* projection.hpp in Headers */,
670947291BDF9A4F005014C0 /* hw_texture_ios.hpp in Headers */,
670947281BDF9A4F005014C0 /* glyph_manager.hpp in Headers */,