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/drape_global.hpp13
-rw-r--r--drape/font_texture.cpp4
-rw-r--r--drape/symbols_texture.cpp4
-rw-r--r--drape/texture.cpp10
-rw-r--r--drape/texture.hpp10
5 files changed, 29 insertions, 12 deletions
diff --git a/drape/drape_global.hpp b/drape/drape_global.hpp
index e425afb8b2..493152dbb1 100644
--- a/drape/drape_global.hpp
+++ b/drape/drape_global.hpp
@@ -3,6 +3,19 @@
namespace dp
{
+enum TextureFormat
+{
+ RGBA8,
+ RGBA4,
+ ALPHA,
+ UNSPECIFIED
+};
+
+enum ResourceTag
+{
+ StipplePenTag
+};
+
enum Anchor
{
Center = 0,
diff --git a/drape/font_texture.cpp b/drape/font_texture.cpp
index d8709aa42c..1d9acdd9e5 100644
--- a/drape/font_texture.cpp
+++ b/drape/font_texture.cpp
@@ -150,7 +150,7 @@ namespace
void SingleTexture(vector<uint8_t> const & image, uint32_t width, uint32_t height)
{
FontTexture * texture = new FontTexture();
- texture->Create(width, height, Texture::ALPHA, MakeStackRefPointer((void *)&image[0]));
+ texture->Create(width, height, ALPHA, MakeStackRefPointer((void *)&image[0]));
m_regions.push_back(make_pair(m2::RectU(0, 0, width, height), texture));
}
@@ -180,7 +180,7 @@ namespace
copy_pixels(subView, dstView);
FontTexture * texture = new FontTexture();
- texture->Create(cutSize, cutSize, Texture::ALPHA,
+ texture->Create(cutSize, cutSize, ALPHA,
MakeStackRefPointer<void>(&regionImage[0]));
m_regions.push_back(make_pair(m2::RectU(pxDx, pxDy,
diff --git a/drape/symbols_texture.cpp b/drape/symbols_texture.cpp
index b1615f129b..e118efc77c 100644
--- a/drape/symbols_texture.cpp
+++ b/drape/symbols_texture.cpp
@@ -154,7 +154,7 @@ void SymbolsTexture::Load(string const & skinPathName)
unsigned char * data = stbi_png_load_from_memory(&rawData[0], rawData.size(), &w, &h, &bpp, 0);
if (width == w && height == h)
- Create(width, height, Texture::RGBA8, MakeStackRefPointer<void>(data));
+ Create(width, height, RGBA8, MakeStackRefPointer<void>(data));
else
Fail();
@@ -177,7 +177,7 @@ void SymbolsTexture::Fail()
{
m_definition.clear();
int32_t alfaTexture = 0;
- Create(1, 1, Texture::RGBA8, MakeStackRefPointer(&alfaTexture));
+ Create(1, 1, RGBA8, MakeStackRefPointer(&alfaTexture));
}
} // namespace dp
diff --git a/drape/texture.cpp b/drape/texture.cpp
index b20f4f4fb9..e0bbbbd841 100644
--- a/drape/texture.cpp
+++ b/drape/texture.cpp
@@ -24,6 +24,7 @@ Texture::Texture()
: m_textureID(-1)
, m_width(0)
, m_height(0)
+ , m_format(dp::UNSPECIFIED)
{
}
@@ -40,6 +41,7 @@ void Texture::Create(uint32_t width, uint32_t height, TextureFormat format)
void Texture::Create(uint32_t width, uint32_t height, TextureFormat format, RefPointer<void> data)
{
+ m_format = format;
m_width = width;
m_height = height;
if (!GLExtensionsList::Instance().IsSupported(GLExtensionsList::TextureNPOT))
@@ -78,6 +80,7 @@ void Texture::UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t height
TextureFormat format, RefPointer<void> data)
{
ASSERT_ID;
+ ASSERT(format == m_format, ());
glConst layout;
glConst pixelType;
@@ -86,6 +89,11 @@ void Texture::UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t height
GLFunctions::glTexSubImage2D(x, y, width, height, layout, pixelType, data.GetRaw());
}
+TextureFormat Texture::GetFormat() const
+{
+ return m_format;
+}
+
uint32_t Texture::GetWidth() const
{
ASSERT_ID;
@@ -121,7 +129,7 @@ uint32_t Texture::GetMaxTextureSize()
return GLFunctions::glGetInteger(gl_const::GLMaxTextureSize);
}
-void Texture::UnpackFormat(Texture::TextureFormat format, glConst & layout, glConst & pixelType)
+void Texture::UnpackFormat(TextureFormat format, glConst & layout, glConst & pixelType)
{
bool requiredFormat = GLExtensionsList::Instance().IsSupported(GLExtensionsList::RequiredInternalFormat);
switch (format) {
diff --git a/drape/texture.hpp b/drape/texture.hpp
index ed19b6f9b6..4fba17506b 100644
--- a/drape/texture.hpp
+++ b/drape/texture.hpp
@@ -2,6 +2,7 @@
#include "pointers.hpp"
#include "glconstants.hpp"
+#include "drape_global.hpp"
#include "../geometry/rect2d.hpp"
@@ -14,13 +15,6 @@ namespace dp
class Texture
{
public:
- enum TextureFormat
- {
- RGBA8,
- RGBA4,
- ALPHA
- };
-
enum ResourceType
{
Symbol,
@@ -61,6 +55,7 @@ public:
virtual ResourceInfo const * FindResource(Key const & key) const = 0;
+ TextureFormat GetFormat() const;
uint32_t GetWidth() const;
uint32_t GetHeight() const;
float GetS(uint32_t x) const;
@@ -78,6 +73,7 @@ private:
int32_t m_textureID;
uint32_t m_width;
uint32_t m_height;
+ TextureFormat m_format;
};
} // namespace dp