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--geometry/packer.cpp3
-rw-r--r--graphics/geometry_batcher.cpp31
-rw-r--r--graphics/path_view.cpp6
-rw-r--r--graphics/path_view.hpp4
-rw-r--r--graphics/text_path.cpp4
-rw-r--r--graphics/text_path.hpp4
6 files changed, 39 insertions, 13 deletions
diff --git a/geometry/packer.cpp b/geometry/packer.cpp
index eddf799128..b11d27237f 100644
--- a/geometry/packer.cpp
+++ b/geometry/packer.cpp
@@ -84,8 +84,7 @@ namespace m2
m_currentHandle = 0;
}
- handle_t res = m_currentHandle++;
- return res;
+ return m_currentHandle++;
}
bool Packer::hasRoom(unsigned width, unsigned height) const
diff --git a/graphics/geometry_batcher.cpp b/graphics/geometry_batcher.cpp
index ea37101afa..9011dfb220 100644
--- a/graphics/geometry_batcher.cpp
+++ b/graphics/geometry_batcher.cpp
@@ -20,10 +20,22 @@
namespace graphics
{
+ template <typename T>
+ void CheckPointLayout()
+ {
+ STATIC_ASSERT(sizeof(m2::Point<T>) == 2 * sizeof(T));
+ m2::Point<T> p;
+ CHECK_EQUAL(reinterpret_cast<unsigned char*>(&p), reinterpret_cast<unsigned char*>(&p.x), ());
+ CHECK_EQUAL(reinterpret_cast<unsigned char*>(&p) + sizeof(T), reinterpret_cast<unsigned char*>(&p.y), ());
+ }
+
GeometryBatcher::Params::Params()
: m_storageType(ELargeStorage),
m_textureType(ELargeTexture)
- {}
+ {
+ CheckPointLayout<float>();
+ CheckPointLayout<double>();
+ }
GeometryBatcher::GeometryBatcher(Params const & p)
: base_t(p),
@@ -400,6 +412,8 @@ namespace graphics
double depth,
int pipelineID)
{
+ STATIC_ASSERT(sizeof(m2::PointF) == 2 * sizeof(float));
+
VertexStream vs;
vs.m_fPos.m_x = (float*)(coords);
@@ -430,6 +444,8 @@ namespace graphics
double depth,
int pipelineID)
{
+ STATIC_ASSERT(sizeof(m2::PointF) == 2 * sizeof(float));
+
VertexStream vs;
vs.m_fPos.m_x = (float*)(coords);
@@ -459,6 +475,8 @@ namespace graphics
int pipelineID
)
{
+ STATIC_ASSERT(sizeof(m2::PointF) == 2 * sizeof(float));
+
VertexStream vs;
vs.m_fPos.m_x = (float*)(coords);
@@ -490,6 +508,8 @@ namespace graphics
double depth,
int pipelineID)
{
+ STATIC_ASSERT(sizeof(m2::PointF) == 2 * sizeof(float));
+
VertexStream vs;
vs.m_fPos.m_x = (float*)(coords);
@@ -521,6 +541,9 @@ namespace graphics
double depth,
int pipelineID)
{
+ STATIC_ASSERT(sizeof(m2::PointD) == 2 * sizeof(double));
+ STATIC_ASSERT(sizeof(m2::PointF) == 2 * sizeof(float));
+
VertexStream vs;
vs.m_dPos.m_x = (double*)(coords);
@@ -552,6 +575,9 @@ namespace graphics
double depth,
int pipelineID)
{
+ STATIC_ASSERT(sizeof(m2::PointD) == 2 * sizeof(double));
+ STATIC_ASSERT(sizeof(m2::PointF) == 2 * sizeof(float));
+
VertexStream vs;
vs.m_dPos.m_x = (double*)(coords);
@@ -584,6 +610,8 @@ namespace graphics
double depth,
int pipelineID)
{
+ STATIC_ASSERT(sizeof(m2::PointF) == 2 * sizeof(float));
+
VertexStream vs;
vs.m_fPos.m_x = (float*)(coords);
@@ -809,7 +837,6 @@ namespace graphics
ResourceCache * staticCache = pipeline(m_startStaticPage).cache().get();
ResourceCache * dynamicCache = pipeline(m_dynamicPage).cache().get();
- uint32_t res;
ids[i] = staticCache->findInfo(*infos[i]);
if (ids[i] == invalidPageHandle())
diff --git a/graphics/path_view.cpp b/graphics/path_view.cpp
index b46a5d93ec..bf34197f2c 100644
--- a/graphics/path_view.cpp
+++ b/graphics/path_view.cpp
@@ -47,7 +47,7 @@ namespace graphics
return m_isReverse;
}
- PathPoint const PathView::offsetPoint(PathPoint const & pp, double offset)
+ PathPoint const PathView::offsetPoint(PathPoint const & pp, double offset) const
{
PathPoint res = pp;
@@ -86,7 +86,7 @@ namespace graphics
return res;
}
- PivotPoint PathView::findPivotPoint(PathPoint const & pp, double advance, double kern)
+ PivotPoint PathView::findPivotPoint(PathPoint const & pp, double advance, double kern) const
{
PathPoint startPt = offsetPoint(pp, kern);
@@ -103,7 +103,7 @@ namespace graphics
while (advance > 0)
{
if (j + 1 == size())
- return res;
+ return res;
double l = get(j + 1).Length(pt1);
diff --git a/graphics/path_view.hpp b/graphics/path_view.hpp
index 133517aa41..8c26d09e45 100644
--- a/graphics/path_view.hpp
+++ b/graphics/path_view.hpp
@@ -42,8 +42,8 @@ namespace graphics
void setIsReverse(bool flag);
bool isReverse() const;
- PathPoint const offsetPoint(PathPoint const & pp, double offset);
- PivotPoint findPivotPoint(PathPoint const & pp, double advance, double kern);
+ PathPoint const offsetPoint(PathPoint const & pp, double offset) const;
+ PivotPoint findPivotPoint(PathPoint const & pp, double advance, double kern) const;
PathPoint const front() const;
};
diff --git a/graphics/text_path.cpp b/graphics/text_path.cpp
index b727e21d9b..465aa8aabc 100644
--- a/graphics/text_path.cpp
+++ b/graphics/text_path.cpp
@@ -110,12 +110,12 @@ namespace graphics
return get(i);
}
- PathPoint const TextPath::offsetPoint(PathPoint const & pp, double offset)
+ PathPoint const TextPath::offsetPoint(PathPoint const & pp, double offset) const
{
return m_pv.offsetPoint(pp, offset);
}
- PivotPoint TextPath::findPivotPoint(PathPoint const & pp, GlyphMetrics const & sym, double kern)
+ PivotPoint TextPath::findPivotPoint(PathPoint const & pp, GlyphMetrics const & sym, double kern) const
{
return m_pv.findPivotPoint(pp, sym.m_xOffset + sym.m_width / 2.0, kern);
}
diff --git a/graphics/text_path.hpp b/graphics/text_path.hpp
index dd23d3c905..5d8449a2ca 100644
--- a/graphics/text_path.hpp
+++ b/graphics/text_path.hpp
@@ -37,8 +37,8 @@ namespace graphics
void setIsReverse(bool flag);
bool isReverse() const;
- PathPoint const offsetPoint(PathPoint const & pp, double offset);
- PivotPoint findPivotPoint(PathPoint const & pp, GlyphMetrics const & sym, double kern);
+ PathPoint const offsetPoint(PathPoint const & pp, double offset) const;
+ PivotPoint findPivotPoint(PathPoint const & pp, GlyphMetrics const & sym, double kern) const;
PathPoint const front() const;
};