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:
authorr.kuznetsov <r.kuznetsov@corp.mail.ru>2015-07-30 11:32:59 +0300
committerr.kuznetsov <r.kuznetsov@corp.mail.ru>2015-11-30 16:09:33 +0300
commit61b04a64ba3811432e0fcb2f6f78177a7c852c59 (patch)
tree69e07a9ebe3f004e234eb037441d4376b7915f25
parentd6acc20e7e2e3c5dd32f83da6e301934626443a7 (diff)
Review fixes
-rw-r--r--android/assets/colors.txtbin0 -> 408035 bytes
-rw-r--r--data/colors.txt198
-rw-r--r--drape/dynamic_texture.hpp1
-rw-r--r--drape/texture_manager.cpp53
-rw-r--r--drape/texture_manager.hpp1
-rw-r--r--drape/texture_of_colors.cpp29
-rw-r--r--drape/texture_of_colors.hpp4
-rw-r--r--drape_frontend/apply_feature_functors.cpp6
-rw-r--r--drape_frontend/apply_feature_functors.hpp9
-rw-r--r--drape_frontend/backend_renderer.cpp1
-rw-r--r--drape_frontend/engine_context.cpp13
-rw-r--r--drape_frontend/engine_context.hpp12
-rw-r--r--drape_frontend/line_shape.cpp34
-rw-r--r--drape_frontend/line_shape.hpp11
-rw-r--r--drape_frontend/map_shape.hpp1
-rwxr-xr-xdrape_frontend/read_manager.cpp10
-rwxr-xr-xdrape_frontend/read_manager.hpp2
-rw-r--r--drape_frontend/read_mwm_task.cpp7
-rw-r--r--drape_frontend/read_mwm_task.hpp9
-rw-r--r--drape_frontend/rule_drawer.cpp12
-rw-r--r--drape_frontend/rule_drawer.hpp10
-rw-r--r--drape_frontend/tile_info.cpp10
-rw-r--r--drape_frontend/tile_info.hpp9
-rw-r--r--drape_frontend/user_mark_shapes.cpp2
-rw-r--r--drape_head/testing_engine.cpp10
-rw-r--r--iphone/Maps/Maps.xcodeproj/project.pbxproj6
-rwxr-xr-xtools/unix/generate_drules.sh2
27 files changed, 348 insertions, 114 deletions
diff --git a/android/assets/colors.txt b/android/assets/colors.txt
new file mode 100644
index 0000000000..774d4be416
--- /dev/null
+++ b/android/assets/colors.txt
Binary files differ
diff --git a/data/colors.txt b/data/colors.txt
new file mode 100644
index 0000000000..a96e595f81
--- /dev/null
+++ b/data/colors.txt
@@ -0,0 +1,198 @@
+0
+68
+255
+8840
+17408
+21760
+21998
+26112
+30464
+65535
+1118481
+1122833
+1131588
+2232610
+2236945
+2236962
+2236979
+2241348
+2241382
+2245734
+2263074
+3355426
+3355443
+3355460
+3364266
+3364317
+3368584
+4456448
+4456516
+4460817
+4469521
+4473907
+4473924
+4473941
+4487133
+4491332
+4504388
+4521796
+5570560
+5570645
+5579281
+5583650
+5587968
+5592405
+5592422
+5601245
+5601262
+5609813
+5614080
+6693393
+6693478
+6702097
+6702182
+6706466
+6710801
+6710886
+6710903
+7798784
+7807505
+7811959
+7816209
+7820561
+7829350
+7829367
+7829384
+8912998
+8921634
+8930440
+8934809
+8947831
+8947848
+8960836
+10048836
+10066176
+10066244
+10066312
+10066329
+10075033
+10075118
+10083737
+10088089
+11141120
+11167232
+11175970
+11184793
+11184810
+11193531
+11193565
+11197781
+11197934
+11206655
+12285696
+12290082
+12294468
+12303257
+12303274
+12303291
+12311978
+12312029
+12316398
+12320767
+13369344
+13412983
+13421670
+13421738
+13421755
+13421772
+13430459
+14483456
+14514005
+14518408
+14522675
+14527061
+14531481
+14535833
+14535850
+14535867
+14540117
+14540185
+14540219
+14540236
+14540253
+14544588
+14544605
+15632622
+15636770
+15645542
+15645627
+15645678
+15649877
+15654263
+15654314
+15658717
+15658734
+16711680
+16729156
+16733508
+16742144
+16742229
+16746496
+16746751
+16755353
+16763904
+16763972
+16768256
+16768409
+16772710
+16772829
+16772846
+16776960
+16777096
+16777113
+16777147
+16777164
+16777181
+16777198
+16777215
+1291845632
+1297438037
+1300793480
+1308622847
+2147483648
+2147514112
+2153076053
+2156431496
+2158668458
+2164230399
+2164260863
+2566914048
+2571387972
+2579217339
+2583691263
+3003121664
+3003121732
+3003130504
+3003147776
+3006477107
+3006485930
+3007595588
+3007612996
+3012043298
+3012052104
+3012056473
+3012069512
+3013187908
+3013209753
+3014262784
+3014288896
+3014319598
+3015407360
+3015424955
+3016543436
+3017605120
+3018754286
+3019863808
+3019885568
+3019898811
+3019898879
diff --git a/drape/dynamic_texture.hpp b/drape/dynamic_texture.hpp
index d5867146c2..aac1bac1b2 100644
--- a/drape/dynamic_texture.hpp
+++ b/drape/dynamic_texture.hpp
@@ -59,7 +59,6 @@ protected:
m_indexer = nullptr;
}
-private:
ref_ptr<TIndexer> m_indexer;
};
diff --git a/drape/texture_manager.cpp b/drape/texture_manager.cpp
index 7e481dcc64..26d930d34c 100644
--- a/drape/texture_manager.cpp
+++ b/drape/texture_manager.cpp
@@ -9,7 +9,9 @@
#include "platform/platform.hpp"
#include "coding/file_name_utils.hpp"
+#include "coding/reader.hpp"
+#include "base/logging.hpp"
#include "base/stl_add.hpp"
#include "std/vector.hpp"
@@ -27,19 +29,47 @@ size_t const DUPLICATED_GLYPHS_COUNT = 128;
namespace
{
- void MultilineTextToUniString(TextureManager::TMultilineText const & text, strings::UniString & outString)
+
+void MultilineTextToUniString(TextureManager::TMultilineText const & text, strings::UniString & outString)
+{
+ size_t cnt = 0;
+ for (strings::UniString const & str : text)
+ cnt += str.size();
+
+ outString.clear();
+ outString.reserve(cnt);
+ for (strings::UniString const & str : text)
+ outString.append(str.begin(), str.end());
+}
+
+template <typename ToDo>
+void ParseColorsList(string const & colorsFile, ToDo toDo)
+{
+ string colorsList;
+ try
+ {
+ ReaderPtr<Reader>(GetPlatform().GetReader(colorsFile)).ReadAsString(colorsList);
+ }
+ catch(RootException const & e)
+ {
+ LOG(LWARNING, ("Error reading colors list ", colorsFile, " : ", e.what()));
+ return;
+ }
+
+ istringstream fin(colorsList);
+ while (true)
{
- size_t cnt = 0;
- for (strings::UniString const & str : text)
- cnt += str.size();
-
- outString.clear();
- outString.reserve(cnt);
- for (strings::UniString const & str : text)
- outString.append(str.begin(), str.end());
+ uint32_t color;
+ fin >> color;
+ if (!fin)
+ break;
+
+ toDo(dp::Extract(color));
}
}
+} // namespace
+
TextureManager::TextureManager()
: m_maxTextureSize(0)
, m_maxGlypsCount(0)
@@ -291,6 +321,11 @@ void TextureManager::Init(Params const & params)
m_symbolTexture = make_unique_dp<SymbolsTexture>(params.m_resPostfix);
m_stipplePenTexture = make_unique_dp<StipplePenTexture>(m2::PointU(STIPPLE_TEXTURE_SIZE, STIPPLE_TEXTURE_SIZE));
m_colorTexture = make_unique_dp<ColorTexture>(m2::PointU(COLOR_TEXTURE_SIZE, COLOR_TEXTURE_SIZE));
+ ParseColorsList(params.m_colors, [this](dp::Color const & color)
+ {
+ ref_ptr<ColorTexture> colorTexture = make_ref(m_colorTexture);
+ colorTexture->ReserveColor(color);
+ });
m_glyphManager = make_unique_dp<GlyphManager>(params.m_glyphMngParams);
m_maxTextureSize = min(2048, GLFunctions::glGetInteger(gl_const::GLMaxTextureSize));
diff --git a/drape/texture_manager.hpp b/drape/texture_manager.hpp
index ca4a8afd34..9771f6b13a 100644
--- a/drape/texture_manager.hpp
+++ b/drape/texture_manager.hpp
@@ -66,6 +66,7 @@ public:
struct Params
{
string m_resPostfix;
+ string m_colors;
GlyphManager::Params m_glyphMngParams;
};
diff --git a/drape/texture_of_colors.cpp b/drape/texture_of_colors.cpp
index 09395b7340..41995bc6d0 100644
--- a/drape/texture_of_colors.cpp
+++ b/drape/texture_of_colors.cpp
@@ -20,12 +20,13 @@ ColorPalette::ColorPalette(m2::PointU const & canvasSize)
, m_cursor(m2::PointU::Zero())
{}
-ref_ptr<Texture::ResourceInfo> ColorPalette::MapResource(ColorKey const & key, bool & newResource)
+ref_ptr<Texture::ResourceInfo> ColorPalette::ReserveResource(bool predefined, ColorKey const & key, bool & newResource)
{
- lock_guard<mutex> g(m_mappingLock);
+ lock_guard<mutex> lock(m_mappingLock);
- TPalette::iterator itm = m_palette.find(key.m_color);
- newResource = itm == m_palette.end();
+ TPalette & palette = predefined ? m_predefinedPalette : m_palette;
+ TPalette::iterator itm = palette.find(key.m_color);
+ newResource = (itm == palette.end());
if (newResource)
{
PendingColor pendingColor;
@@ -51,13 +52,25 @@ ref_ptr<Texture::ResourceInfo> ColorPalette::MapResource(ColorKey const & key, b
m2::PointF const resCenter = m2::RectF(pendingColor.m_rect).Center();
float const x = resCenter.x / sizeX;
float const y = resCenter.y / sizeY;
- auto res = m_palette.emplace(key.m_color, ColorResourceInfo(m2::RectF(x, y, x, y)));
+ auto res = palette.emplace(key.m_color, ColorResourceInfo(m2::RectF(x, y, x, y)));
ASSERT(res.second, ());
itm = res.first;
}
+
return make_ref(&itm->second);
}
+ref_ptr<Texture::ResourceInfo> ColorPalette::MapResource(ColorKey const & key, bool & newResource)
+{
+ TPalette::iterator itm = m_predefinedPalette.find(key.m_color);
+ if (itm != m_predefinedPalette.end())
+ {
+ newResource = false;
+ return make_ref(&itm->second);
+ }
+ return ReserveResource(false /* predefined */, key, newResource);
+}
+
void ColorPalette::UploadResources(ref_ptr<Texture> texture)
{
ASSERT(texture->GetFormat() == dp::RGBA8, ());
@@ -172,4 +185,10 @@ void ColorPalette::MoveCursor()
ASSERT(m_cursor.y + RESOURCE_SIZE <= m_textureSize.y, ());
}
+void ColorTexture::ReserveColor(dp::Color const & color)
+{
+ bool newResource = false;
+ m_indexer->ReserveResource(true /* predefined */, ColorKey(color), newResource);
+}
+
}
diff --git a/drape/texture_of_colors.hpp b/drape/texture_of_colors.hpp
index 34400b718f..24d5974a60 100644
--- a/drape/texture_of_colors.hpp
+++ b/drape/texture_of_colors.hpp
@@ -32,6 +32,7 @@ class ColorPalette
public:
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);
void UploadResources(ref_ptr<Texture> texture);
glConst GetMinFilter() const;
@@ -52,6 +53,7 @@ private:
};
TPalette m_palette;
+ TPalette m_predefinedPalette;
buffer_vector<PendingColor, 16> m_pendingNodes;
m2::PointU m_textureSize;
m2::PointU m_cursor;
@@ -76,6 +78,8 @@ public:
TBase::Init(make_ref(&m_pallete), params);
}
+ void ReserveColor(dp::Color const & color);
+
~ColorTexture() { TBase::Reset(); }
private:
diff --git a/drape_frontend/apply_feature_functors.cpp b/drape_frontend/apply_feature_functors.cpp
index 20a798989c..48c5f6c405 100644
--- a/drape_frontend/apply_feature_functors.cpp
+++ b/drape_frontend/apply_feature_functors.cpp
@@ -15,7 +15,6 @@
#include "drape/color.hpp"
#include "drape/stipple_pen_resource.hpp"
-#include "drape/texture_manager.hpp"
#include "drape/utils/projection.hpp"
#include "base/logging.hpp"
@@ -340,13 +339,12 @@ void ApplyAreaFeature::ProcessRule(Stylist::TRuleWrapper const & rule)
ApplyLineFeature::ApplyLineFeature(TInsertShapeFn const & insertShape, FeatureID const & id,
CaptionDescription const & captions, double currentScaleGtoP,
- bool simplify, size_t pointsCount, ref_ptr<dp::TextureManager> texMng)
+ bool simplify, size_t pointsCount)
: TBase(insertShape, id, captions)
, m_currentScaleGtoP(currentScaleGtoP)
, m_sqrScale(math::sqr(m_currentScaleGtoP))
, m_simplify(simplify)
, m_initialPointsCount(pointsCount)
- , m_texMng(texMng)
#ifdef CALC_FILTERED_POINTS
, m_readedCount(0)
#endif
@@ -438,7 +436,7 @@ void ApplyLineFeature::ProcessRule(Stylist::TRuleWrapper const & rule)
Extract(pLineRule, params);
params.m_depth = depth;
params.m_baseGtoPScale = m_currentScaleGtoP;
- m_insertShape(make_unique_dp<LineShape>(m_spline, params, m_texMng));
+ m_insertShape(make_unique_dp<LineShape>(m_spline, params));
}
}
}
diff --git a/drape_frontend/apply_feature_functors.hpp b/drape_frontend/apply_feature_functors.hpp
index bb7a078f41..6c0562876f 100644
--- a/drape_frontend/apply_feature_functors.hpp
+++ b/drape_frontend/apply_feature_functors.hpp
@@ -16,11 +16,6 @@ class CaptionDefProto;
//#define CALC_FILTERED_POINTS
-namespace dp
-{
- class TextureManager;
-}
-
namespace df
{
@@ -90,7 +85,7 @@ class ApplyLineFeature : public BaseApplyFeature
public:
ApplyLineFeature(TInsertShapeFn const & insertShape, FeatureID const & id,
CaptionDescription const & captions, double currentScaleGtoP,
- bool simplify, size_t pointsCount, ref_ptr<dp::TextureManager> texMng);
+ bool simplify, size_t pointsCount);
void operator() (m2::PointD const & point);
bool HasGeometry() const;
@@ -105,8 +100,6 @@ private:
bool m_simplify;
size_t m_initialPointsCount;
- ref_ptr<dp::TextureManager> m_texMng;
-
#ifdef CALC_FILTERED_POINTS
int m_readedCount;
#endif
diff --git a/drape_frontend/backend_renderer.cpp b/drape_frontend/backend_renderer.cpp
index ca3d9afad0..6096b80b99 100644
--- a/drape_frontend/backend_renderer.cpp
+++ b/drape_frontend/backend_renderer.cpp
@@ -257,6 +257,7 @@ void BackendRenderer::InitGLDependentResource()
dp::TextureManager::Params params;
params.m_resPostfix = VisualParams::Instance().GetResourcePostfix();
+ params.m_colors = "colors.txt";
params.m_glyphMngParams.m_uniBlocks = "unicode_blocks.txt";
params.m_glyphMngParams.m_whitelist = "fonts_whitelist.txt";
params.m_glyphMngParams.m_blacklist = "fonts_blacklist.txt";
diff --git a/drape_frontend/engine_context.cpp b/drape_frontend/engine_context.cpp
index 0526b7b9bf..70896fb13b 100644
--- a/drape_frontend/engine_context.cpp
+++ b/drape_frontend/engine_context.cpp
@@ -15,12 +15,19 @@
namespace df
{
-EngineContext::EngineContext(TileKey tileKey, ref_ptr<ThreadsCommutator> commutator)
+EngineContext::EngineContext(TileKey tileKey, ref_ptr<ThreadsCommutator> commutator,
+ ref_ptr<dp::TextureManager> texMng)
: m_tileKey(tileKey)
, m_commutator(commutator)
+ , m_texMng(texMng)
{
}
+ref_ptr<dp::TextureManager> EngineContext::GetTextureManager() const
+{
+ return m_texMng;
+}
+
void EngineContext::BeginReadTile()
{
PostMessage(make_unique_dp<TileReadStartMessage>(m_tileKey));
@@ -31,7 +38,7 @@ void EngineContext::Flush(list<drape_ptr<MapShape>> && shapes)
PostMessage(make_unique_dp<MapShapeReadedMessage>(m_tileKey, move(shapes)));
}
-void EngineContext::EndReadTile(ref_ptr<dp::TextureManager> texMng)
+void EngineContext::EndReadTile()
{
#ifdef DRAW_TILE_NET
m2::RectD r = m_tileKey.GetGlobalRect();
@@ -51,7 +58,7 @@ void EngineContext::EndReadTile(ref_ptr<dp::TextureManager> texMng)
p.m_width = 5;
p.m_join = dp::RoundJoin;
- InsertShape(make_unique_dp<LineShape>(spline, p, texMng));
+ InsertShape(make_unique_dp<LineShape>(spline, p, m_texMng));
df::TextViewParams tp;
tp.m_anchor = dp::Center;
diff --git a/drape_frontend/engine_context.hpp b/drape_frontend/engine_context.hpp
index 5b1bb2bc21..3a32008d3e 100644
--- a/drape_frontend/engine_context.hpp
+++ b/drape_frontend/engine_context.hpp
@@ -8,8 +8,8 @@
namespace dp
{
- class TextureManager;
-}
+class TextureManager;
+} // namespace dp
namespace df
{
@@ -19,19 +19,23 @@ class Message;
class EngineContext
{
public:
- EngineContext(TileKey tileKey, ref_ptr<ThreadsCommutator> commutator);
+ EngineContext(TileKey tileKey, ref_ptr<ThreadsCommutator> commutator,
+ ref_ptr<dp::TextureManager> texMng);
TileKey const & GetTileKey() const { return m_tileKey; }
+ ref_ptr<dp::TextureManager> GetTextureManager() const;
+
void BeginReadTile();
void Flush(list<drape_ptr<MapShape>> && shapes);
- void EndReadTile(ref_ptr<dp::TextureManager> texMng);
+ void EndReadTile();
private:
void PostMessage(drape_ptr<Message> && message);
TileKey m_tileKey;
ref_ptr<ThreadsCommutator> m_commutator;
+ ref_ptr<dp::TextureManager> m_texMng;
};
} // namespace df
diff --git a/drape_frontend/line_shape.cpp b/drape_frontend/line_shape.cpp
index 834e186154..9320891bc9 100644
--- a/drape_frontend/line_shape.cpp
+++ b/drape_frontend/line_shape.cpp
@@ -59,7 +59,7 @@ private:
};
template <typename TVertex>
-class BaseLineBuilder : public LineBuilder
+class BaseLineBuilder : public ILineShapeInfo
{
public:
BaseLineBuilder(dp::TextureManager::ColorRegion const & color, float pxHalfWidth,
@@ -68,11 +68,8 @@ public:
, m_colorCoord(glsl::ToVec2(m_color.GetTexRect().Center()))
, m_pxHalfWidth(pxHalfWidth)
{
- if (geometrySize != 0)
- m_geometry.reserve(geometrySize);
-
- if (joinsSize != 0)
- m_joinGeom.reserve(joinsSize);
+ m_geometry.reserve(geometrySize);
+ m_joinGeom.reserve(joinsSize);
}
void GetTexturingInfo(float const globalLength, int & steps, float & maskSize)
@@ -231,14 +228,15 @@ private:
} // namespace
-LineShape::LineShape(m2::SharedSpline const & spline,
- LineViewParams const & params,
- ref_ptr<dp::TextureManager> textures)
+LineShape::LineShape(m2::SharedSpline const & spline, LineViewParams const & params)
: m_params(params)
, m_spline(spline)
{
ASSERT_GREATER(m_spline->GetPath().size(), 1, ());
+}
+void LineShape::Prepare(ref_ptr<dp::TextureManager> textures) const
+{
dp::TextureManager::ColorRegion colorRegion;
textures->GetColorRegion(m_params.m_color, colorRegion);
float const pxHalfWidth = m_params.m_width / 2.0f;
@@ -247,7 +245,7 @@ LineShape::LineShape(m2::SharedSpline const & spline,
{
auto builder = make_unique<SolidLineBuilder>(colorRegion, pxHalfWidth, m_spline->GetPath().size());
Construct<SolidLineBuilder>(*builder);
- m_lineBuilder = move(builder);
+ m_lineShapeInfo = move(builder);
}
else
{
@@ -260,7 +258,7 @@ LineShape::LineShape(m2::SharedSpline const & spline,
pxHalfWidth, m_params.m_baseGtoPScale,
m_spline->GetPath().size());
Construct<DashedLineBuilder>(*builder);
- m_lineBuilder = move(builder);
+ m_lineShapeInfo = move(builder);
}
}
@@ -368,19 +366,21 @@ void LineShape::Construct(TBuilder & builder) const
void LineShape::Draw(ref_ptr<dp::Batcher> batcher, ref_ptr<dp::TextureManager> textures) const
{
- ASSERT(m_lineBuilder != nullptr, ());
+ if (!m_lineShapeInfo)
+ Prepare(textures);
- dp::GLState state = m_lineBuilder->GetState();
+ ASSERT(m_lineShapeInfo != nullptr, ());
+ dp::GLState state = m_lineShapeInfo->GetState();
- dp::AttributeProvider provider(1, m_lineBuilder->GetLineSize());
- provider.InitStream(0, m_lineBuilder->GetBindingInfo(), m_lineBuilder->GetLineData());
+ dp::AttributeProvider provider(1, m_lineShapeInfo->GetLineSize());
+ provider.InitStream(0, m_lineShapeInfo->GetBindingInfo(), m_lineShapeInfo->GetLineData());
batcher->InsertListOfStrip(state, make_ref(&provider), dp::Batcher::VertexPerQuad);
- size_t joinSize = m_lineBuilder->GetJoinSize();
+ size_t joinSize = m_lineShapeInfo->GetJoinSize();
if (joinSize > 0)
{
dp::AttributeProvider joinsProvider(1, joinSize);
- joinsProvider.InitStream(0, m_lineBuilder->GetBindingInfo(), m_lineBuilder->GetJoinData());
+ joinsProvider.InitStream(0, m_lineShapeInfo->GetBindingInfo(), m_lineShapeInfo->GetJoinData());
batcher->InsertTriangleList(state, make_ref(&joinsProvider));
}
}
diff --git a/drape_frontend/line_shape.hpp b/drape_frontend/line_shape.hpp
index 102c7434bb..7abda3815f 100644
--- a/drape_frontend/line_shape.hpp
+++ b/drape_frontend/line_shape.hpp
@@ -13,10 +13,10 @@
namespace df
{
-class LineBuilder
+class ILineShapeInfo
{
public:
- virtual ~LineBuilder() {}
+ virtual ~ILineShapeInfo() {}
virtual dp::BindingInfo const & GetBindingInfo() = 0;
virtual dp::GLState GetState() = 0;
@@ -31,10 +31,9 @@ public:
class LineShape : public MapShape
{
public:
- LineShape(m2::SharedSpline const & spline,
- LineViewParams const & params,
- ref_ptr<dp::TextureManager> textures);
+ LineShape(m2::SharedSpline const & spline, LineViewParams const & params);
+ void Prepare(ref_ptr<dp::TextureManager> textures) const override;
void Draw(ref_ptr<dp::Batcher> batcher, ref_ptr<dp::TextureManager> textures) const override;
private:
@@ -43,7 +42,7 @@ private:
LineViewParams m_params;
m2::SharedSpline m_spline;
- unique_ptr<LineBuilder> m_lineBuilder;
+ mutable unique_ptr<ILineShapeInfo> m_lineShapeInfo;
};
} // namespace df
diff --git a/drape_frontend/map_shape.hpp b/drape_frontend/map_shape.hpp
index 310c2103f9..59463aec47 100644
--- a/drape_frontend/map_shape.hpp
+++ b/drape_frontend/map_shape.hpp
@@ -18,6 +18,7 @@ class MapShape
{
public:
virtual ~MapShape(){}
+ virtual void Prepare(ref_ptr<dp::TextureManager> textures) const {}
virtual void Draw(ref_ptr<dp::Batcher> batcher, ref_ptr<dp::TextureManager> textures) const = 0;
};
diff --git a/drape_frontend/read_manager.cpp b/drape_frontend/read_manager.cpp
index 0bc4125c95..d23152a562 100755
--- a/drape_frontend/read_manager.cpp
+++ b/drape_frontend/read_manager.cpp
@@ -106,7 +106,7 @@ void ReadManager::UpdateCoverage(ScreenBase const & screen, TTilesCollection con
IncreaseCounter(static_cast<int>(inputRects.size() + (m_tileInfos.size() - outdatedTiles.size())));
for_each(outdatedTiles.begin(), outdatedTiles.end(), bind(&ReadManager::ClearTileInfo, this, _1));
- for_each(m_tileInfos.begin(), m_tileInfos.end(), bind(&ReadManager::PushTaskFront, this, _1, texMng));
+ for_each(m_tileInfos.begin(), m_tileInfos.end(), bind(&ReadManager::PushTaskFront, this, _1));
for_each(inputRects.begin(), inputRects.end(), bind(&ReadManager::PushTaskBackForTileKey, this, _1, texMng));
}
m_currentViewport = screen;
@@ -153,17 +153,17 @@ bool ReadManager::MustDropAllTiles(ScreenBase const & screen) const
void ReadManager::PushTaskBackForTileKey(TileKey const & tileKey, ref_ptr<dp::TextureManager> texMng)
{
- shared_ptr<TileInfo> tileInfo(new TileInfo(make_unique_dp<EngineContext>(tileKey, m_commutator)));
+ shared_ptr<TileInfo> tileInfo(new TileInfo(make_unique_dp<EngineContext>(tileKey, m_commutator, texMng)));
m_tileInfos.insert(tileInfo);
ReadMWMTask * task = myPool.Get();
- task->Init(tileInfo, texMng);
+ task->Init(tileInfo);
m_pool->PushBack(task);
}
-void ReadManager::PushTaskFront(shared_ptr<TileInfo> const & tileToReread, ref_ptr<dp::TextureManager> texMng)
+void ReadManager::PushTaskFront(shared_ptr<TileInfo> const & tileToReread)
{
ReadMWMTask * task = myPool.Get();
- task->Init(tileToReread, texMng);
+ task->Init(tileToReread);
m_pool->PushFront(task);
}
diff --git a/drape_frontend/read_manager.hpp b/drape_frontend/read_manager.hpp
index 53b750fe0f..600986c4d3 100755
--- a/drape_frontend/read_manager.hpp
+++ b/drape_frontend/read_manager.hpp
@@ -41,7 +41,7 @@ private:
bool MustDropAllTiles(ScreenBase const & screen) const;
void PushTaskBackForTileKey(TileKey const & tileKey, ref_ptr<dp::TextureManager> texMng);
- void PushTaskFront(shared_ptr<TileInfo> const & tileToReread, ref_ptr<dp::TextureManager> texMng);
+ void PushTaskFront(shared_ptr<TileInfo> const & tileToReread);
private:
MemoryFeatureIndex m_memIndex;
diff --git a/drape_frontend/read_mwm_task.cpp b/drape_frontend/read_mwm_task.cpp
index e40abfb98d..d84accba03 100644
--- a/drape_frontend/read_mwm_task.cpp
+++ b/drape_frontend/read_mwm_task.cpp
@@ -1,7 +1,5 @@
#include "drape_frontend/read_mwm_task.hpp"
-#include "drape/texture_manager.hpp"
-
namespace df
{
ReadMWMTask::ReadMWMTask(MemoryFeatureIndex & memIndex, MapDataProvider & model)
@@ -13,10 +11,9 @@ ReadMWMTask::ReadMWMTask(MemoryFeatureIndex & memIndex, MapDataProvider & model)
#endif
}
-void ReadMWMTask::Init(shared_ptr<TileInfo> const & tileInfo, ref_ptr<dp::TextureManager> texMng)
+void ReadMWMTask::Init(shared_ptr<TileInfo> const & tileInfo)
{
m_tileInfo = tileInfo;
- m_texMng = texMng;
#ifdef DEBUG
m_checker = true;
#endif
@@ -39,7 +36,7 @@ void ReadMWMTask::Do()
ASSERT(m_tileInfo != nullptr, ());
try
{
- m_tileInfo->ReadFeatures(m_model, m_memIndex, m_texMng);
+ m_tileInfo->ReadFeatures(m_model, m_memIndex);
}
catch (TileInfo::ReadCanceledException &)
{
diff --git a/drape_frontend/read_mwm_task.hpp b/drape_frontend/read_mwm_task.hpp
index b1b0c89139..8659bee1fb 100644
--- a/drape_frontend/read_mwm_task.hpp
+++ b/drape_frontend/read_mwm_task.hpp
@@ -10,11 +10,6 @@
#include "std/shared_ptr.hpp"
-namespace dp
-{
- class TextureManager;
-}
-
namespace df
{
@@ -26,14 +21,12 @@ public:
virtual void Do();
- void Init(shared_ptr<TileInfo> const & tileInfo, ref_ptr<dp::TextureManager> texMng);
+ void Init(shared_ptr<TileInfo> const & tileInfo);
void Reset();
TileKey GetTileKey() const;
private:
shared_ptr<TileInfo> m_tileInfo;
- ref_ptr<dp::TextureManager> m_texMng;
-
MemoryFeatureIndex & m_memIndex;
MapDataProvider & m_model;
diff --git a/drape_frontend/rule_drawer.cpp b/drape_frontend/rule_drawer.cpp
index ba06408e05..a9b5475b00 100644
--- a/drape_frontend/rule_drawer.cpp
+++ b/drape_frontend/rule_drawer.cpp
@@ -4,8 +4,6 @@
#include "drape_frontend/apply_feature_functors.hpp"
#include "drape_frontend/visual_params.hpp"
-#include "drape/texture_manager.hpp"
-
#include "indexer/feature.hpp"
#include "indexer/feature_algo.hpp"
@@ -18,11 +16,9 @@ namespace df
int const SIMPLIFY_BOTTOM = 10;
int const SIMPLIFY_TOP = 12;
-RuleDrawer::RuleDrawer(TDrawerCallback const & fn, ref_ptr<EngineContext> context,
- ref_ptr<dp::TextureManager> texMng)
+RuleDrawer::RuleDrawer(TDrawerCallback const & fn, ref_ptr<EngineContext> context)
: m_callback(fn)
, m_context(context)
- , m_texMng(texMng)
{
m_globalRect = m_context->GetTileKey().GetGlobalRect();
@@ -74,8 +70,7 @@ void RuleDrawer::operator()(FeatureType const & f)
else if (s.LineStyleExists())
{
ApplyLineFeature apply(insertShape, f.GetID(), s.GetCaptionDescription(), m_currentScaleGtoP,
- zoomLevel >= SIMPLIFY_BOTTOM && zoomLevel <= SIMPLIFY_TOP, f.GetPointsCount(),
- m_texMng);
+ zoomLevel >= SIMPLIFY_BOTTOM && zoomLevel <= SIMPLIFY_TOP, f.GetPointsCount());
f.ForEachPointRef(apply, zoomLevel);
if (apply.HasGeometry())
@@ -92,6 +87,9 @@ void RuleDrawer::operator()(FeatureType const & f)
apply.Finish();
}
+ for (auto & shape : m_mapShapes)
+ shape->Prepare(m_context->GetTextureManager());
+
m_context->Flush(move(m_mapShapes));
}
diff --git a/drape_frontend/rule_drawer.hpp b/drape_frontend/rule_drawer.hpp
index 44181d541c..c963c329d6 100644
--- a/drape_frontend/rule_drawer.hpp
+++ b/drape_frontend/rule_drawer.hpp
@@ -13,11 +13,6 @@
class FeatureType;
-namespace dp
-{
- class TextureManager;
-}
-
namespace df
{
@@ -29,9 +24,7 @@ class RuleDrawer
{
public:
using TDrawerCallback = function<void (FeatureType const &, Stylist &)>;
- RuleDrawer(TDrawerCallback const & fn,
- ref_ptr<EngineContext> context,
- ref_ptr<dp::TextureManager> texMng);
+ RuleDrawer(TDrawerCallback const & fn, ref_ptr<EngineContext> context);
void operator() (FeatureType const & f);
@@ -44,7 +37,6 @@ private:
set<string> m_coastlines;
list<drape_ptr<MapShape>> m_mapShapes;
- ref_ptr<dp::TextureManager> m_texMng;
};
} // namespace dfo
diff --git a/drape_frontend/tile_info.cpp b/drape_frontend/tile_info.cpp
index f9e05e9be2..fb9bf034fb 100644
--- a/drape_frontend/tile_info.cpp
+++ b/drape_frontend/tile_info.cpp
@@ -4,8 +4,6 @@
#include "drape_frontend/stylist.hpp"
#include "drape_frontend/tile_info.hpp"
-#include "drape/texture_manager.hpp"
-
#include "indexer/scales.hpp"
#include "base/scope_guard.hpp"
@@ -39,14 +37,12 @@ void TileInfo::ReadFeatureIndex(MapDataProvider const & model)
}
}
-void TileInfo::ReadFeatures(MapDataProvider const & model,
- MemoryFeatureIndex & memIndex,
- ref_ptr<dp::TextureManager> texMng)
+void TileInfo::ReadFeatures(MapDataProvider const & model, MemoryFeatureIndex & memIndex)
{
m_context->BeginReadTile();
// Reading can be interrupted by exception throwing
- MY_SCOPE_GUARD(ReleaseReadTile, bind(&EngineContext::EndReadTile, m_context.get(), texMng));
+ MY_SCOPE_GUARD(ReleaseReadTile, bind(&EngineContext::EndReadTile, m_context.get()));
ReadFeatureIndex(model);
@@ -57,7 +53,7 @@ void TileInfo::ReadFeatures(MapDataProvider const & model,
if (!featuresToRead.empty())
{
- RuleDrawer drawer(bind(&TileInfo::InitStylist, this, _1 ,_2), make_ref(m_context), texMng);
+ RuleDrawer drawer(bind(&TileInfo::InitStylist, this, _1 ,_2), make_ref(m_context));
model.ReadFeatures(bind<void>(ref(drawer), _1), featuresToRead);
}
}
diff --git a/drape_frontend/tile_info.hpp b/drape_frontend/tile_info.hpp
index 9e865f35f6..cdb21fb24f 100644
--- a/drape_frontend/tile_info.hpp
+++ b/drape_frontend/tile_info.hpp
@@ -14,11 +14,6 @@
class FeatureType;
-namespace dp
-{
- class TextureManager;
-}
-
namespace df
{
@@ -32,9 +27,7 @@ public:
TileInfo(drape_ptr<EngineContext> && context);
- void ReadFeatures(MapDataProvider const & model,
- MemoryFeatureIndex & memIndex,
- ref_ptr<dp::TextureManager> texMng);
+ void ReadFeatures(MapDataProvider const & model, MemoryFeatureIndex & memIndex);
void Cancel(MemoryFeatureIndex & memIndex);
m2::RectD GetGlobalRect() const;
diff --git a/drape_frontend/user_mark_shapes.cpp b/drape_frontend/user_mark_shapes.cpp
index 4f1c37683f..91e5680152 100644
--- a/drape_frontend/user_mark_shapes.cpp
+++ b/drape_frontend/user_mark_shapes.cpp
@@ -183,7 +183,7 @@ void CacheUserLines(UserMarksProvider const * provider,
params.m_depth = line->GetLayerDepth(layerIndex);
params.m_width = line->GetWidth(layerIndex);
- LineShape(spline, params, textures).Draw(batcher, textures);
+ LineShape(spline, params).Draw(batcher, textures);
}
}
}
diff --git a/drape_head/testing_engine.cpp b/drape_head/testing_engine.cpp
index b4c2b22706..727f52f41f 100644
--- a/drape_head/testing_engine.cpp
+++ b/drape_head/testing_engine.cpp
@@ -463,7 +463,7 @@ void TestingEngine::DrawImpl()
lvp.m_color = dp::Color::Red();
lvp.m_width = 16.0f;
lvp.m_join = dp::BevelJoin;
- LineShape(spline, lvp, make_ref(m_textures)).Draw(make_ref(m_batcher), make_ref(m_textures));
+ LineShape(spline, lvp).Draw(make_ref(m_batcher), make_ref(m_textures));
{
PathSymbolViewParams p;
@@ -494,7 +494,7 @@ void TestingEngine::DrawImpl()
lvp.m_join = dp::RoundJoin;
lvp.m_cap = dp::RoundCap;
lvp.m_color = dp::Color::Black();
- LineShape(spl1, lvp, make_ref(m_textures)).Draw(make_ref(m_batcher), make_ref(m_textures));
+ LineShape(spl1, lvp).Draw(make_ref(m_batcher), make_ref(m_textures));
}
{
@@ -518,7 +518,7 @@ void TestingEngine::DrawImpl()
lvpl.m_pattern.clear();
lvpl.m_depth = -10.0f;
lvpl.m_width = 2.0f;
- LineShape(spl, lvpl, make_ref(m_textures)).Draw(make_ref(m_batcher), make_ref(m_textures));
+ LineShape(spl, lvpl).Draw(make_ref(m_batcher), make_ref(m_textures));
DummyMutableLabel tt(m2::PointF(120.0f, 30.0f), "200 km");
tt.Draw(make_ref(m_batcher), make_ref(m_textures));
@@ -537,7 +537,7 @@ void TestingEngine::DrawImpl()
lvpl.m_pattern.clear();
lvpl.m_depth = -10.0f;
lvpl.m_width = 2.0f;
- LineShape(spl, lvpl, make_ref(m_textures)).Draw(make_ref(m_batcher), make_ref(m_textures));
+ LineShape(spl, lvpl).Draw(make_ref(m_batcher), make_ref(m_textures));
}
dp::FontDecl font(dp::Color::Black(), 14);
@@ -577,7 +577,7 @@ void TestingEngine::DrawRects()
};
m2::SharedSpline spline(path);
- LineShape(spline, lvp, make_ref(m_textures)).Draw(make_ref(m_batcher), make_ref(m_textures));
+ LineShape(spline, lvp).Draw(make_ref(m_batcher), make_ref(m_textures));
};
for (m2::RectD const & r : m_boundRects)
diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj
index b50decf38c..a9adf32449 100644
--- a/iphone/Maps/Maps.xcodeproj/project.pbxproj
+++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj
@@ -124,6 +124,8 @@
34F45E901B96E8B100AC93F8 /* MWMSearchTabButtonsView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34F45E8F1B96E8B100AC93F8 /* MWMSearchTabButtonsView.xib */; };
34F8ADD91B97229A004184CC /* MWMSearchTableView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34F8ADD81B97229A004184CC /* MWMSearchTableView.mm */; };
45159BF91B0CA2D5009BFA85 /* resources-6plus in Resources */ = {isa = PBXBuildFile; fileRef = 45159BF81B0CA2D5009BFA85 /* resources-6plus */; };
+ 452FCA3B1B6A3DF7007019AB /* colors.txt in Resources */ = {isa = PBXBuildFile; fileRef = 452FCA3A1B6A3DF7007019AB /* colors.txt */; };
+ 452FCA3E1B6A3E83007019AB /* colors.txt in Resources */ = {isa = PBXBuildFile; fileRef = 452FCA3A1B6A3DF7007019AB /* colors.txt */; };
454040621AD2D75E007A9B12 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 46F26C7210F61FD600ECCA39 /* OpenGLES.framework */; };
454040631AD2D83A007A9B12 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 97C98655186C734000AF7E9E /* AVFoundation.framework */; };
454040641AD2D862007A9B12 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
@@ -1009,6 +1011,7 @@
34F8ADD81B97229A004184CC /* MWMSearchTableView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMSearchTableView.mm; sourceTree = "<group>"; };
3D443C9C19E421EE0025C2FC /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/Localizable.strings; sourceTree = "<group>"; };
45159BF81B0CA2D5009BFA85 /* resources-6plus */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "resources-6plus"; path = "../../data/resources-6plus"; sourceTree = "<group>"; };
+ 452FCA3A1B6A3DF7007019AB /* colors.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = colors.txt; path = ../../data/colors.txt; sourceTree = "<group>"; };
454040681AD2D8D2007A9B12 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; };
4540406E1AD2D9C5007A9B12 /* WatchKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WatchKit.framework; path = System/Library/Frameworks/WatchKit.framework; sourceTree = SDKROOT; };
458287C21AD3BE2000BA8940 /* DownloadIndicatorProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DownloadIndicatorProtocol.h; sourceTree = "<group>"; };
@@ -2726,6 +2729,7 @@
97FC99DB19C1A2CD00C1CF98 /* resources-xxhdpi */,
FAAFD696139D9BE2000AE70C /* categories.txt */,
FA64D9A813F975AD00350ECF /* types.txt */,
+ 452FCA3A1B6A3DF7007019AB /* colors.txt */,
FAF30A94173AB23900818BF6 /* 00_roboto_regular.ttf */,
EEA615E5134C4968003A9827 /* 01_dejavusans.ttf */,
9DF04B231B71010E00DACAF1 /* 02_droidsans-fallback.ttf */,
@@ -3025,6 +3029,7 @@
buildActionMask = 2147483647;
files = (
5605022F1B6211E100169CAD /* sound-strings in Resources */,
+ 452FCA3B1B6A3DF7007019AB /* colors.txt in Resources */,
F67BC26F1B254B2000FE1D7B /* MWMPlacePageDescriptionView.xib in Resources */,
342BB7AB1BC7CC5C00DF6443 /* PlacePageBookmarkCell.xib in Resources */,
EE026F0611D6AC0D00645242 /* classificator.txt in Resources */,
@@ -3283,6 +3288,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ 452FCA3E1B6A3E83007019AB /* colors.txt in Resources */,
F6C7B7141BA8443C004233F4 /* drules_proto_clear.bin in Resources */,
F6C7B7121BA840A4004233F4 /* resources-xhdpi_clear in Resources */,
F6C7B7131BA840A4004233F4 /* resources-xhdpi_dark in Resources */,
diff --git a/tools/unix/generate_drules.sh b/tools/unix/generate_drules.sh
index 76fe6e5dec..c6d4277945 100755
--- a/tools/unix/generate_drules.sh
+++ b/tools/unix/generate_drules.sh
@@ -22,7 +22,7 @@ function BuildDrawingRules() {
}
# Cleanup
-cleanup=(classificator.txt types.txt visibility.txt)
+cleanup=(classificator.txt types.txt visibility.txt colors.txt)
for item in ${cleanup[*]}
do
rm $DATA_PATH/$item || true