diff --git a/android/res/values/dimens.xml b/android/res/values/dimens.xml index f34d99629d..c4e09819ec 100644 --- a/android/res/values/dimens.xml +++ b/android/res/values/dimens.xml @@ -69,6 +69,8 @@ 26dp 10dp 58dp + 10dp + 58dp 40dp 20dp 2dp diff --git a/android/src/com/mapswithme/maps/MapFragment.java b/android/src/com/mapswithme/maps/MapFragment.java index c76e9b8df9..9c7ac70623 100644 --- a/android/src/com/mapswithme/maps/MapFragment.java +++ b/android/src/com/mapswithme/maps/MapFragment.java @@ -43,6 +43,7 @@ public class MapFragment extends BaseMwmFragment private static final int WIDGET_COMPASS = 0x02; private static final int WIDGET_COPYRIGHT = 0x04; private static final int WIDGET_SCALE_LABEL = 0x08; + private static final int WIDGET_WATERMARK = 0x10; // Should correspond to dp::Anchor from drape_global.hpp private static final int ANCHOR_CENTER = 0x00; @@ -96,6 +97,11 @@ public class MapFragment extends BaseMwmFragment mHeight - UiUtils.dimen(R.dimen.margin_ruler_bottom), ANCHOR_LEFT_BOTTOM); + nativeSetupWidget(WIDGET_WATERMARK, + UiUtils.dimen(R.dimen.margin_watermark_right), + mHeight - UiUtils.dimen(R.dimen.margin_watermark_bottom), + ANCHOR_RIGHT_BOTTOM); + if (BuildConfig.DEBUG) { nativeSetupWidget(WIDGET_SCALE_LABEL, @@ -130,6 +136,16 @@ public class MapFragment extends BaseMwmFragment nativeApplyWidgets(); } + void setupWatermark(int offsetX, int offsetY, boolean forceRedraw) + { + nativeSetupWidget(WIDGET_WATERMARK, + UiUtils.dimen(R.dimen.margin_watermark_right) + offsetX, + mHeight - UiUtils.dimen(R.dimen.margin_watermark_bottom) + offsetY, + ANCHOR_RIGHT_BOTTOM); + if (forceRedraw && mContextCreated) + nativeApplyWidgets(); + } + private void onRenderingInitialized() { final Activity activity = getActivity(); diff --git a/android/src/com/mapswithme/maps/MwmActivity.java b/android/src/com/mapswithme/maps/MwmActivity.java index f198742671..4f25d578d9 100644 --- a/android/src/com/mapswithme/maps/MwmActivity.java +++ b/android/src/com/mapswithme/maps/MwmActivity.java @@ -1539,7 +1539,7 @@ public class MwmActivity extends BaseMwmFragmentActivity public void run() { final int menuHeight = menu.getFrame().getHeight(); - adjustRuler(0, menuHeight); + adjustBottomWidgets(0, menuHeight); mIsFullscreenAnimating = false; if (mIsAppearMenuLater) @@ -1573,7 +1573,7 @@ public class MwmActivity extends BaseMwmFragmentActivity @Override public void run() { - adjustRuler(0, 0); + adjustBottomWidgets(0, 0); } }); if (mNavMyPosition != null) @@ -1762,12 +1762,13 @@ public class MwmActivity extends BaseMwmFragmentActivity MapFragment.nativeCompassUpdated(compass.getMagneticNorth(), compass.getTrueNorth(), true); } - private void adjustRuler(int offsetX, int offsetY) + private void adjustBottomWidgets(int offsetX, int offsetY) { if (mMapFragment == null || !mMapFragment.isAdded()) return; mMapFragment.setupRuler(offsetX, offsetY, true); + mMapFragment.setupWatermark(offsetX, offsetY, true); } @Override @@ -1854,7 +1855,7 @@ public class MwmActivity extends BaseMwmFragmentActivity public void run() { final int menuHeight = getCurrentMenu().getFrame().getHeight(); - adjustRuler(0, menuHeight); + adjustBottomWidgets(0, menuHeight); if (completion != null) completion.run(); } @@ -1956,7 +1957,7 @@ public class MwmActivity extends BaseMwmFragmentActivity @Override public void run() { - adjustRuler(0, 0); + adjustBottomWidgets(0, 0); } }); } diff --git a/data/resources-default/default.ui b/data/resources-default/default.ui index e808493d6a..d2dd14fbf7 100644 --- a/data/resources-default/default.ui +++ b/data/resources-default/default.ui @@ -35,4 +35,16 @@ + + + + + + + + + + + + diff --git a/drape_frontend/CMakeLists.txt b/drape_frontend/CMakeLists.txt index 33fad5d37a..c497e442aa 100644 --- a/drape_frontend/CMakeLists.txt +++ b/drape_frontend/CMakeLists.txt @@ -114,6 +114,8 @@ set( gui/shape.hpp gui/skin.cpp gui/skin.hpp + gui/watermark.cpp + gui/watermark.hpp kinetic_scroller.cpp kinetic_scroller.hpp line_shape.cpp diff --git a/drape_frontend/backend_renderer.cpp b/drape_frontend/backend_renderer.cpp index 566e45cce6..2ff33c5092 100644 --- a/drape_frontend/backend_renderer.cpp +++ b/drape_frontend/backend_renderer.cpp @@ -91,7 +91,7 @@ void BackendRenderer::RecacheGui(gui::TWidgetsInitInfo const & initInfo, bool ne m_commutator->PostMessage(ThreadsCommutator::RenderThread, move(outputMsg), MessagePriority::Normal); } -#ifdef RENRER_DEBUG_INFO_LABELS +#ifdef RENDER_DEBUG_INFO_LABELS void BackendRenderer::RecacheDebugLabels() { drape_ptr layerRenderer = m_guiCacher.RecacheDebugLabels(m_texMng); @@ -149,7 +149,7 @@ void BackendRenderer::AcceptMessage(ref_ptr message) ref_ptr msg = message; RecacheGui(msg->GetInitInfo(), msg->NeedResetOldGui()); -#ifdef RENRER_DEBUG_INFO_LABELS +#ifdef RENDER_DEBUG_INFO_LABELS RecacheDebugLabels(); #endif break; diff --git a/drape_frontend/backend_renderer.hpp b/drape_frontend/backend_renderer.hpp index 670728d3bb..3f945f9aec 100644 --- a/drape_frontend/backend_renderer.hpp +++ b/drape_frontend/backend_renderer.hpp @@ -77,7 +77,7 @@ private: void RecacheChoosePositionMark(); void RecacheMapShapes(); -#ifdef RENRER_DEBUG_INFO_LABELS +#ifdef RENDER_DEBUG_INFO_LABELS void RecacheDebugLabels(); #endif diff --git a/drape_frontend/gui/choose_position_mark.cpp b/drape_frontend/gui/choose_position_mark.cpp index 1a5cd2b2d3..f1cb552ac0 100644 --- a/drape_frontend/gui/choose_position_mark.cpp +++ b/drape_frontend/gui/choose_position_mark.cpp @@ -4,19 +4,19 @@ #include "drape/utils/vertex_decl.hpp" -#include "std/bind.hpp" +#include +#include + +using namespace std::placeholders; namespace gui { - namespace { - struct ChoosePositionMarkVertex { ChoosePositionMarkVertex(glsl::vec2 const & position, glsl::vec2 const & texCoord) - : m_position(position) - , m_texCoord(texCoord) + : m_position(position), m_texCoord(texCoord) {} glsl::vec2 m_position; @@ -40,8 +40,7 @@ public: return TBase::Update(screen); } }; - -} // namespace +} // namespace drape_ptr ChoosePositionMark::Draw(ref_ptr tex) const { @@ -82,16 +81,14 @@ drape_ptr ChoosePositionMark::Draw(ref_ptr te provider.InitStream(0, info, make_ref(&vertexes)); m2::PointF const markSize = region.GetPixelSize(); - drape_ptr handle = make_unique_dp(EGuiHandle::GuiHandleChoosePositionMark, - m_position.m_pixelPivot, - markSize); + drape_ptr handle = make_unique_dp( + EGuiHandle::GuiHandleChoosePositionMark, m_position.m_pixelPivot, markSize); drape_ptr renderer = make_unique_dp(); dp::Batcher batcher(dp::Batcher::IndexPerQuad, dp::Batcher::VertexPerQuad); - dp::SessionGuard guard(batcher, bind(&ShapeRenderer::AddShape, renderer.get(), _1, _2)); - batcher.InsertTriangleStrip(state, make_ref(&provider), move(handle)); + dp::SessionGuard guard(batcher, std::bind(&ShapeRenderer::AddShape, renderer.get(), _1, _2)); + batcher.InsertTriangleStrip(state, make_ref(&provider), std::move(handle)); return renderer; } - -} // namespace gui +} // namespace gui diff --git a/drape_frontend/gui/choose_position_mark.hpp b/drape_frontend/gui/choose_position_mark.hpp index 6696df7df0..8965906e2b 100644 --- a/drape_frontend/gui/choose_position_mark.hpp +++ b/drape_frontend/gui/choose_position_mark.hpp @@ -1,18 +1,14 @@ #pragma once -#include "shape.hpp" +#include "drape_frontend/gui/shape.hpp" namespace gui { - class ChoosePositionMark : public Shape { public: - ChoosePositionMark(gui::Position const & position) - : Shape(position) - {} + explicit ChoosePositionMark(gui::Position const & position) : Shape(position) {} drape_ptr Draw(ref_ptr tex) const; }; - -} // namespace gui +} // namespace gui diff --git a/drape_frontend/gui/compass.cpp b/drape_frontend/gui/compass.cpp index 3f0efdb133..d2ae879ea0 100644 --- a/drape_frontend/gui/compass.cpp +++ b/drape_frontend/gui/compass.cpp @@ -9,91 +9,93 @@ #include "drape/utils/vertex_decl.hpp" -#include "std/bind.hpp" +#include +#include + +using namespace std::placeholders; namespace gui { - namespace { - struct CompassVertex +struct CompassVertex +{ + CompassVertex(glsl::vec2 const & position, glsl::vec2 const & texCoord) + : m_position(position) + , m_texCoord(texCoord) + {} + + glsl::vec2 m_position; + glsl::vec2 m_texCoord; +}; + +class CompassHandle : public TappableHandle +{ + using TBase = TappableHandle; + double const VisibleStartAngle = my::DegToRad(5.0); + double const VisibleEndAngle = my::DegToRad(355.0); + +public: + CompassHandle(uint32_t id, m2::PointF const & pivot, m2::PointF const & size, + Shape::TTapHandler const & tapHandler) + : TappableHandle(id, dp::Center, pivot, size) + , m_tapHandler(tapHandler) + , m_animation(false, 0.25) + {} + + void OnTap() override { - CompassVertex(glsl::vec2 const & position, glsl::vec2 const & texCoord) - : m_position(position) - , m_texCoord(texCoord) {} + if (m_tapHandler != nullptr) + m_tapHandler(); + } - glsl::vec2 m_position; - glsl::vec2 m_texCoord; - }; - - class CompassHandle : public TappableHandle + bool Update(ScreenBase const & screen) override { - using TBase = TappableHandle; - double const VisibleStartAngle = my::DegToRad(5.0); - double const VisibleEndAngle = my::DegToRad(355.0); + float angle = ang::AngleIn2PI(screen.GetAngle()); - public: - CompassHandle(uint32_t id, m2::PointF const & pivot, m2::PointF const & size, - Shape::TTapHandler const & tapHandler) - : TappableHandle(id, dp::Center, pivot, size) - , m_tapHandler(tapHandler) - , m_animation(false, 0.25) + bool isVisiblePrev = IsVisible(); + bool isVisibleAngle = angle > VisibleStartAngle && angle < VisibleEndAngle; + + bool isVisible = isVisibleAngle || (isVisiblePrev && DrapeGui::Instance().IsInUserAction()); + + if (isVisible) { + m_animation.ShowAnimated(); + SetIsVisible(true); + } + else + m_animation.HideAnimated(); + + if (IsVisible()) + { + TBase::Update(screen); + + glsl::mat4 r = glsl::rotate(glsl::mat4(), angle, glsl::vec3(0.0, 0.0, 1.0)); + glsl::mat4 m = glsl::translate(glsl::mat4(), glsl::vec3(m_pivot, 0.0)); + m = glsl::transpose(m * r); + m_uniforms.SetMatrix4x4Value("modelView", glsl::value_ptr(m)); + m_uniforms.SetFloatValue("u_opacity", static_cast(m_animation.GetT())); } - void OnTap() override - { - if (m_tapHandler != nullptr) - m_tapHandler(); - } + if (m_animation.IsFinished()) + SetIsVisible(isVisible); - bool Update(ScreenBase const & screen) override - { - float angle = ang::AngleIn2PI(screen.GetAngle()); + return true; + } - bool isVisiblePrev = IsVisible(); - bool isVisibleAngle = angle > VisibleStartAngle && angle < VisibleEndAngle; - - bool isVisible = isVisibleAngle || (isVisiblePrev && DrapeGui::Instance().IsInUserAction()); - - if (isVisible) - { - m_animation.ShowAnimated(); - SetIsVisible(true); - } - else - m_animation.HideAnimated(); - - if (IsVisible()) - { - TBase::Update(screen); - - glsl::mat4 r = glsl::rotate(glsl::mat4(), angle, glsl::vec3(0.0, 0.0, 1.0)); - glsl::mat4 m = glsl::translate(glsl::mat4(), glsl::vec3(m_pivot, 0.0)); - m = glsl::transpose(m * r); - m_uniforms.SetMatrix4x4Value("modelView", glsl::value_ptr(m)); - m_uniforms.SetFloatValue("u_opacity", m_animation.GetT()); - } - - if (m_animation.IsFinished()) - SetIsVisible(isVisible); - - return true; - } - - private: - Shape::TTapHandler m_tapHandler; - df::ShowHideAnimation m_animation; - }; -} +private: + Shape::TTapHandler m_tapHandler; + df::ShowHideAnimation m_animation; +}; +} // namespace drape_ptr Compass::Draw(m2::PointF & compassSize, ref_ptr tex, TTapHandler const & tapHandler) const { dp::TextureManager::SymbolRegion region; tex->GetSymbolRegion("compass-image", region); - glsl::vec2 halfSize = glsl::ToVec2(region.GetPixelSize() * 0.5f); - m2::RectF texRect = region.GetTexRect(); + auto const halfSize = glsl::ToVec2(region.GetPixelSize() * 0.5f); + auto const texRect = region.GetTexRect(); ASSERT_EQUAL(m_position.m_anchor, dp::Center, ()); CompassVertex vertexes[] = @@ -133,10 +135,9 @@ drape_ptr Compass::Draw(m2::PointF & compassSize, ref_ptr renderer = make_unique_dp(); dp::Batcher batcher(dp::Batcher::IndexPerQuad, dp::Batcher::VertexPerQuad); - dp::SessionGuard guard(batcher, bind(&ShapeRenderer::AddShape, renderer.get(), _1, _2)); - batcher.InsertTriangleStrip(state, make_ref(&provider), move(handle)); + dp::SessionGuard guard(batcher, std::bind(&ShapeRenderer::AddShape, renderer.get(), _1, _2)); + batcher.InsertTriangleStrip(state, make_ref(&provider), std::move(handle)); return renderer; } - -} +} // namespace gui diff --git a/drape_frontend/gui/compass.hpp b/drape_frontend/gui/compass.hpp index 1a93c74b2d..5f447431b6 100644 --- a/drape_frontend/gui/compass.hpp +++ b/drape_frontend/gui/compass.hpp @@ -1,19 +1,15 @@ #pragma once -#include "shape.hpp" +#include "drape_frontend/gui/shape.hpp" namespace gui { - class Compass : public Shape { public: - Compass(gui::Position const & position) - : Shape(position) - {} + Compass(gui::Position const & position) : Shape(position) {} drape_ptr Draw(m2::PointF & compassSize, ref_ptr tex, TTapHandler const & tapHandler) const; }; - -} +} // namespace gui diff --git a/drape_frontend/gui/copyright_label.cpp b/drape_frontend/gui/copyright_label.cpp index ec71c71ffa..15901df98e 100644 --- a/drape_frontend/gui/copyright_label.cpp +++ b/drape_frontend/gui/copyright_label.cpp @@ -8,65 +8,69 @@ #include "base/timer.hpp" -#include "std/bind.hpp" +#include +#include + +using namespace std::placeholders; namespace gui { - namespace { - double const kCopyrightVisibleTime = 2.0f; - double const kCopyrightHideTime = 0.25f; +double const kCopyrightVisibleTime = 2.0f; +double const kCopyrightHideTime = 0.25f; - class CopyrightHandle : public StaticLabelHandle +class CopyrightHandle : public StaticLabelHandle +{ + using TBase = StaticLabelHandle; + +public: + CopyrightHandle(uint32_t id, ref_ptr textureManager, + dp::Anchor anchor, m2::PointF const & pivot, + m2::PointF const & size, TAlphabet const & alphabet) + : TBase(id, textureManager, anchor, pivot, size, alphabet) { - using TBase = StaticLabelHandle; + SetIsVisible(true); + } - public: - CopyrightHandle(uint32_t id, ref_ptr textureManager, - dp::Anchor anchor, m2::PointF const & pivot, - m2::PointF const & size, TAlphabet const & alphabet) - : TBase(id, textureManager, anchor, pivot, size, alphabet) + bool Update(ScreenBase const & screen) override + { + if (!IsVisible()) + return false; + + if (!TBase::Update(screen)) + return false; + + if (!DrapeGui::Instance().IsCopyrightActive()) { - SetIsVisible(true); + SetIsVisible(false); + return false; } - bool Update(ScreenBase const & screen) override + if (m_animation == nullptr) { - if (!IsVisible()) - return false; - - if (!TBase::Update(screen)) - return false; - - if (!DrapeGui::Instance().IsCopyrightActive()) - { - SetIsVisible(false); - return false; - } - - if (m_animation == nullptr) - m_animation.reset(new df::OpacityAnimation(kCopyrightHideTime, kCopyrightVisibleTime, 1.0f, 0.0f)); - else if (m_animation->IsFinished()) - { - DrapeGui::Instance().DeactivateCopyright(); - SetIsVisible(false); - } - - m_uniforms.SetFloatValue("u_opacity", m_animation->GetOpacity()); - - return true; + m_animation = make_unique_dp(kCopyrightHideTime, + kCopyrightVisibleTime, 1.0f, 0.0f); + } + else if (m_animation->IsFinished()) + { + DrapeGui::Instance().DeactivateCopyright(); + SetIsVisible(false); } - private: - drape_ptr m_animation; - }; -} + m_uniforms.SetFloatValue("u_opacity", static_cast(m_animation->GetOpacity())); + + return true; + } + +private: + drape_ptr m_animation; +}; +} // namespace CopyrightLabel::CopyrightLabel(Position const & position) : TBase(position) -{ -} +{} drape_ptr CopyrightLabel::Draw(m2::PointF & size, ref_ptr tex) const { @@ -78,9 +82,9 @@ drape_ptr CopyrightLabel::Draw(m2::PointF & size, ref_ptr(result.m_buffer.size()); + auto const vertexCount = static_cast(result.m_buffer.size()); ASSERT(vertexCount % dp::Batcher::VertexPerQuad == 0, ()); - uint32_t indexCount = dp::Batcher::IndexPerQuad * vertexCount / dp::Batcher::VertexPerQuad; + auto const indexCount = dp::Batcher::IndexPerQuad * vertexCount / dp::Batcher::VertexPerQuad; size = m2::PointF(result.m_boundRect.SizeX(), result.m_boundRect.SizeY()); drape_ptr handle = make_unique_dp(EGuiHandle::GuiHandleCopyright, @@ -90,11 +94,10 @@ drape_ptr CopyrightLabel::Draw(m2::PointF & size, ref_ptr renderer = make_unique_dp(); dp::Batcher batcher(indexCount, vertexCount); - dp::SessionGuard guard(batcher, bind(&ShapeRenderer::AddShape, renderer.get(), _1, _2)); + dp::SessionGuard guard(batcher, std::bind(&ShapeRenderer::AddShape, renderer.get(), _1, _2)); batcher.InsertListOfStrip(result.m_state, make_ref(&provider), - move(handle), dp::Batcher::VertexPerQuad); + std::move(handle), dp::Batcher::VertexPerQuad); return renderer; } - -} +} // namespace gui diff --git a/drape_frontend/gui/copyright_label.hpp b/drape_frontend/gui/copyright_label.hpp index 9345b19849..856eca87df 100644 --- a/drape_frontend/gui/copyright_label.hpp +++ b/drape_frontend/gui/copyright_label.hpp @@ -1,16 +1,15 @@ #pragma once -#include "shape.hpp" +#include "drape_frontend/gui/shape.hpp" namespace gui { - class CopyrightLabel : public Shape { using TBase = Shape; + public: - CopyrightLabel(gui::Position const & position); + explicit CopyrightLabel(gui::Position const & position); drape_ptr Draw(m2::PointF & size, ref_ptr tex) const; }; - -} +} // namespace gui diff --git a/drape_frontend/gui/debug_label.cpp b/drape_frontend/gui/debug_label.cpp index 7b8c5116ef..f9313d57e0 100644 --- a/drape_frontend/gui/debug_label.cpp +++ b/drape_frontend/gui/debug_label.cpp @@ -1,12 +1,15 @@ -#include "debug_label.hpp" +#include "drape_frontend/gui/debug_label.hpp" -#include "drape_gui.hpp" +#include "drape_frontend/gui/drape_gui.hpp" -#include "std/bind.hpp" +#include +#include +#include + +using namespace std::placeholders; namespace gui { - class DebugLabelHandle : public MutableLabelHandle { using TBase = MutableLabelHandle; @@ -22,7 +25,7 @@ public: bool Update(ScreenBase const & screen) override { - string content; + std::string content; bool const isVisible = m_onUpdateFn(screen, content); SetIsVisible(isVisible); @@ -35,16 +38,17 @@ private: TUpdateDebugLabelFn m_onUpdateFn; }; -void AddSymbols(string const & str, set & symbols) +void AddSymbols(std::string const & str, std::set & symbols) { for (size_t i = 0, sz = str.length(); i < sz; ++i) symbols.insert(str[i]); } -void DebugInfoLabels::AddLabel(ref_ptr tex, string const & caption, TUpdateDebugLabelFn const & onUpdateFn) +void DebugInfoLabels::AddLabel(ref_ptr tex, std::string const & caption, + TUpdateDebugLabelFn const & onUpdateFn) { - string alphabet; - set symbols; + std::string alphabet; + std::set symbols; AddSymbols(caption, symbols); AddSymbols("0123456789.-e", symbols); @@ -61,11 +65,10 @@ void DebugInfoLabels::AddLabel(ref_ptr tex, string const & c params.m_font.m_size *= 1.2; params.m_pivot = m_position.m_pixelPivot; -#ifdef RENRER_DEBUG_INFO_LABELS +#ifdef RENDER_DEBUG_INFO_LABELS uint32_t const id = GuiHandleDebugLabel + m_labelsCount; - params.m_handleCreator = [id, onUpdateFn, tex](dp::Anchor anchor, m2::PointF const & pivot) - { + params.m_handleCreator = [id, onUpdateFn, tex](dp::Anchor anchor, m2::PointF const & pivot) { return make_unique_dp(id, anchor, pivot, tex, onUpdateFn); }; #endif @@ -82,7 +85,8 @@ drape_ptr DebugInfoLabels::Draw(ref_ptr tex) for (auto & params : m_labelsParams) { params.m_pivot.y = pos.y; - m2::PointF textSize = MutableLabelDrawer::Draw(params, tex, bind(&ShapeRenderer::AddShape, renderer.get(), _1, _2)); + m2::PointF textSize = MutableLabelDrawer::Draw( + params, tex, std::bind(&ShapeRenderer::AddShape, renderer.get(), _1, _2)); pos.y += 2 * textSize.y; } @@ -90,5 +94,4 @@ drape_ptr DebugInfoLabels::Draw(ref_ptr tex) return renderer; } - -} // namespace gui +} // namespace gui diff --git a/drape_frontend/gui/debug_label.hpp b/drape_frontend/gui/debug_label.hpp index b4cf4917cb..5c9fdadb8b 100644 --- a/drape_frontend/gui/debug_label.hpp +++ b/drape_frontend/gui/debug_label.hpp @@ -1,28 +1,27 @@ #pragma once -#include "gui_text.hpp" -#include "shape.hpp" +#include "drape_frontend/gui/gui_text.hpp" +#include "drape_frontend/gui/shape.hpp" -#include "std/vector.hpp" +#include +#include +#include namespace gui { - -using TUpdateDebugLabelFn = function; +using TUpdateDebugLabelFn = std::function; class DebugInfoLabels : public Shape { public: - DebugInfoLabels(gui::Position const & position) - : Shape(position) - {} + explicit DebugInfoLabels(gui::Position const & position) : Shape(position) {} - void AddLabel(ref_ptr tex, string const & caption, TUpdateDebugLabelFn const & onUpdateFn); + void AddLabel(ref_ptr tex, std::string const & caption, + TUpdateDebugLabelFn const & onUpdateFn); drape_ptr Draw(ref_ptr tex); private: - vector m_labelsParams; + std::vector m_labelsParams; uint32_t m_labelsCount = 0; }; - -} // namespace gui +} // namespace gui diff --git a/drape_frontend/gui/gui_text.cpp b/drape_frontend/gui/gui_text.cpp index ba0efd725c..b0cc0f7189 100644 --- a/drape_frontend/gui/gui_text.cpp +++ b/drape_frontend/gui/gui_text.cpp @@ -9,16 +9,14 @@ #include "drape/bidi.hpp" #include "drape/glsl_func.hpp" -#include "std/algorithm.hpp" -#include "std/type_traits.hpp" -#include "std/unique_ptr.hpp" +#include +#include +#include namespace gui { - namespace { - glsl::vec2 GetNormalsAndMask(dp::TextureManager::GlyphRegion const & glyph, float textRatio, array & normals, array & maskTexCoord) { @@ -44,7 +42,8 @@ glsl::vec2 GetNormalsAndMask(dp::TextureManager::GlyphRegion const & glyph, floa return glsl::vec2(xOffset, yOffset); } -void FillCommonDecl(dp::BindingDecl & decl, string const & name, uint8_t compCount, uint8_t stride, uint8_t offset) +void FillCommonDecl(dp::BindingDecl & decl, std::string const & name, uint8_t compCount, + uint8_t stride, uint8_t offset) { decl.m_attributeName = name; decl.m_componentCount = compCount; @@ -77,8 +76,7 @@ void FillMaskDecl(dp::BindingDecl & decl, uint8_t stride, uint8_t offset) { FillCommonDecl(decl, "a_maskTexCoord", 2, stride, offset); } - -} +} // namespace dp::BindingInfo const & StaticLabel::Vertex::GetBindingInfo() { @@ -111,14 +109,14 @@ StaticLabel::LabelResult::LabelResult() char const * StaticLabel::DefaultDelim = "\n"; -void StaticLabel::CacheStaticText(string const & text, char const * delim, +void StaticLabel::CacheStaticText(std::string const & text, char const * delim, dp::Anchor anchor, dp::FontDecl const & font, ref_ptr mng, LabelResult & result) { ASSERT(!text.empty(), ()); dp::TextureManager::TMultilineText textParts; - strings::Tokenize(text, delim, [&textParts](string const & part) + strings::Tokenize(text, delim, [&textParts](std::string const & part) { textParts.push_back(bidi::log2vis(strings::MakeUniString(part))); }); @@ -157,7 +155,8 @@ void StaticLabel::CacheStaticText(string const & text, char const * delim, glsl::vec2 outlineTex = glsl::ToVec2(outline.GetTexRect().Center()); df::VisualParams const & vparams = df::VisualParams::Instance(); - float const textRatio = font.m_size * vparams.GetVisualScale() / vparams.GetGlyphBaseSize(); + auto const textRatio = font.m_size * static_cast(vparams.GetVisualScale()) / + vparams.GetGlyphBaseSize(); buffer_vector lineLengths; lineLengths.reserve(buffers.size()); @@ -297,12 +296,13 @@ void MutableLabel::SetMaxLength(uint16_t maxLength) m_maxLength = maxLength; } -ref_ptr MutableLabel::SetAlphabet(string const & alphabet, ref_ptr mng) +ref_ptr MutableLabel::SetAlphabet(std::string const & alphabet, + ref_ptr mng) { strings::UniString str = strings::MakeUniString(alphabet + "."); sort(str.begin(), str.end()); strings::UniString::iterator it = unique(str.begin(), str.end()); - str.resize(distance(str.begin(), it)); + str.resize(std::distance(str.begin(), it)); dp::TextureManager::TGlyphsBuffer buffer; mng->GetGlyphRegions(str, dp::GlyphManager::kDynamicGlyphSize, buffer); @@ -310,13 +310,14 @@ ref_ptr MutableLabel::SetAlphabet(string const & alphabet, ref_ptr< ASSERT_EQUAL(str.size(), buffer.size(), ()); m_alphabet.resize(str.size()); - transform(str.begin(), str.end(), buffer.begin(), m_alphabet.begin(), - [this](strings::UniChar const & c, dp::TextureManager::GlyphRegion const & r) + std::transform(str.begin(), str.end(), buffer.begin(), m_alphabet.begin(), + [](strings::UniChar const & c, dp::TextureManager::GlyphRegion const & r) { - return make_pair(c, r); + return std::make_pair(c, r); }); - sort(m_alphabet.begin(), m_alphabet.end(), [](TAlphabetNode const & n1, TAlphabetNode const & n2) + std::sort(m_alphabet.begin(), m_alphabet.end(), + [](TAlphabetNode const & n1, TAlphabetNode const & n2) { return n1.first < n2.first; }); @@ -327,10 +328,11 @@ ref_ptr MutableLabel::SetAlphabet(string const & alphabet, ref_ptr< void MutableLabel::Precache(PrecacheParams const & params, PrecacheResult & result, ref_ptr mng) { - SetMaxLength(params.m_maxLength); + SetMaxLength(static_cast(params.m_maxLength)); result.m_state.SetMaskTexture(SetAlphabet(params.m_alphabet, mng)); df::VisualParams const & vparams = df::VisualParams::Instance(); - m_textRatio = params.m_font.m_size * vparams.GetVisualScale() / vparams.GetGlyphBaseSize(); + m_textRatio = params.m_font.m_size * static_cast(vparams.GetVisualScale()) / + vparams.GetGlyphBaseSize(); dp::TextureManager::ColorRegion color; dp::TextureManager::ColorRegion outlineColor; @@ -342,7 +344,7 @@ void MutableLabel::Precache(PrecacheParams const & params, PrecacheResult & resu glsl::vec2 colorTex = glsl::ToVec2(color.GetTexRect().Center()); glsl::vec2 outlineTex = glsl::ToVec2(outlineColor.GetTexRect().Center()); - size_t vertexCount = 4 * m_maxLength; + auto const vertexCount = static_cast(4 * m_maxLength); result.m_buffer.resize(vertexCount, StaticVertex(glsl::vec3(0.0, 0.0, 0.0), colorTex, outlineTex)); @@ -356,23 +358,23 @@ void MutableLabel::Precache(PrecacheParams const & params, PrecacheResult & resu depth += 10.0f; } - uint32_t maxGlyphWidth = 0.0; - uint32_t maxGlyphHeight = 0.0; + uint32_t maxGlyphWidth = 0; + uint32_t maxGlyphHeight = 0; for (auto node : m_alphabet) { dp::TextureManager::GlyphRegion const & reg = node.second; m2::PointU pixelSize(reg.GetPixelSize()); - maxGlyphWidth = max(maxGlyphWidth, pixelSize.x); - maxGlyphHeight = max(maxGlyphHeight, pixelSize.y); + maxGlyphWidth = std::max(maxGlyphWidth, pixelSize.x); + maxGlyphHeight = std::max(maxGlyphHeight, pixelSize.y); } result.m_maxPixelSize = m2::PointF(m_maxLength * maxGlyphWidth, maxGlyphHeight); } -void MutableLabel::SetText(LabelResult & result, string text) const +void MutableLabel::SetText(LabelResult & result, std::string text) const { if (text.size() > m_maxLength) - text = text.erase(m_maxLength - 3) + "..."; + text = text.erase(static_cast(m_maxLength - 3)) + "..."; strings::UniString uniText = bidi::log2vis(strings::MakeUniString(text)); @@ -383,7 +385,8 @@ void MutableLabel::SetText(LabelResult & result, string text) const for (size_t i = 0; i < uniText.size(); ++i) { strings::UniChar c = uniText[i]; - TAlphabet::const_iterator it = find_if(m_alphabet.begin(), m_alphabet.end(), [&c](TAlphabetNode const & n) + auto const it = std::find_if(m_alphabet.begin(), m_alphabet.end(), + [&c](TAlphabetNode const & n) { return n.first == c; }); @@ -431,7 +434,7 @@ void MutableLabel::SetText(LabelResult & result, string text) const m2::PointF MutableLabel::GetAvarageSize() const { float h = 0, w = 0; - for (TAlphabetNode const & node : m_alphabet) + for (auto const & node : m_alphabet) { dp::TextureManager::GlyphRegion const & reg = node.second; m2::PointF size = reg.GetPixelSize() * m_textRatio; @@ -468,9 +471,11 @@ void MutableLabelHandle::GetAttributeMutation(ref_ptrSetText(result, m_content); - m_size = m2::PointF(result.m_boundRect.SizeX(), result.m_boundRect.SizeY()); + m_size = m2::PointF(static_cast(result.m_boundRect.SizeX()), + static_cast(result.m_boundRect.SizeY())); - uint32_t byteCount = static_cast(result.m_buffer.size()) * sizeof(MutableLabel::DynamicVertex); + uint32_t byteCount = + static_cast(result.m_buffer.size()) * sizeof(MutableLabel::DynamicVertex); MutableLabel::DynamicVertex * dataPointer = reinterpret_cast(mutator->AllocateMutationBuffer(byteCount)); @@ -493,7 +498,8 @@ bool MutableLabelHandle::Update(ScreenBase const & screen) for (auto const & node : m_textView->GetAlphabet()) alphabetStr.push_back(node.first); - m_glyphsReady = m_textureManager->AreGlyphsReady(alphabetStr, dp::GlyphManager::kDynamicGlyphSize); + m_glyphsReady = m_textureManager->AreGlyphsReady(alphabetStr, + dp::GlyphManager::kDynamicGlyphSize); } if (!m_glyphsReady) @@ -512,18 +518,21 @@ ref_ptr MutableLabelHandle::GetTextView() return make_ref(m_textView); } -void MutableLabelHandle::UpdateSize(m2::PointF const & size) { m_size = size; } +void MutableLabelHandle::UpdateSize(m2::PointF const & size) +{ + m_size = size; +} -void MutableLabelHandle::SetContent(string && content) +void MutableLabelHandle::SetContent(std::string && content) { if (m_content != content) { m_isContentDirty = true; - m_content = move(content); + m_content = std::move(content); } } -void MutableLabelHandle::SetContent(string const & content) +void MutableLabelHandle::SetContent(std::string const & content) { if (m_content != content) { @@ -592,5 +601,4 @@ bool StaticLabelHandle::Update(ScreenBase const & screen) return TBase::Update(screen); } - -} +} // namespace gui diff --git a/drape_frontend/gui/gui_text.hpp b/drape_frontend/gui/gui_text.hpp index 1d1e20c330..d35a81c3ae 100644 --- a/drape_frontend/gui/gui_text.hpp +++ b/drape_frontend/gui/gui_text.hpp @@ -8,14 +8,16 @@ #include "drape/glsl_types.hpp" #include "drape/texture_manager.hpp" -#include "std/cstdint.hpp" -#include "std/unordered_set.hpp" -#include "std/utility.hpp" +#include +#include +#include +#include +#include +#include namespace gui { - -using TAlphabet = unordered_set; +using TAlphabet = std::unordered_set; class StaticLabel { @@ -31,8 +33,7 @@ public: , m_colorTexCoord(color) , m_outlineColorTexCoord(outline) , m_maskTexCoord(mask) - { - } + {} static dp::BindingInfo const & GetBindingInfo(); @@ -53,9 +54,9 @@ public: TAlphabet m_alphabet; }; - static void CacheStaticText(string const & text, char const * delim, - dp::Anchor anchor, dp::FontDecl const & font, - ref_ptr mng, LabelResult & result); + static void CacheStaticText(std::string const & text, char const * delim, dp::Anchor anchor, + dp::FontDecl const & font, ref_ptr mng, + LabelResult & result); }; class MutableLabel @@ -64,12 +65,10 @@ public: struct StaticVertex { StaticVertex() = default; - StaticVertex(glsl::vec3 const & position, glsl::vec2 const & color, glsl::vec2 const & outlineColor) - : m_position(position) - , m_color(color) - , m_outline(outlineColor) - { - } + StaticVertex(glsl::vec3 const & position, glsl::vec2 const & color, + glsl::vec2 const & outlineColor) + : m_position(position), m_color(color), m_outline(outlineColor) + {} static dp::BindingInfo const & GetBindingInfo(); @@ -82,10 +81,8 @@ public: { DynamicVertex() = default; DynamicVertex(glsl::vec2 const & normal, glsl::vec2 const & mask) - : m_normal(normal) - , m_maskTexCoord(mask) - { - } + : m_normal(normal), m_maskTexCoord(mask) + {} static dp::BindingInfo const & GetBindingInfo(); @@ -93,11 +90,11 @@ public: glsl::vec2 m_maskTexCoord; }; - MutableLabel(dp::Anchor anchor); + explicit MutableLabel(dp::Anchor anchor); struct PrecacheParams { - string m_alphabet; + std::string m_alphabet; size_t m_maxLength; dp::FontDecl m_font; }; @@ -120,17 +117,17 @@ public: void Precache(PrecacheParams const & params, PrecacheResult & result, ref_ptr mng); - void SetText(LabelResult & result, string text) const; + void SetText(LabelResult & result, std::string text) const; m2::PointF GetAvarageSize() const; - using TAlphabetNode = pair; - using TAlphabet = vector; + using TAlphabetNode = std::pair; + using TAlphabet = std::vector; TAlphabet const & GetAlphabet() const { return m_alphabet; } private: void SetMaxLength(uint16_t maxLength); - ref_ptr SetAlphabet(string const & alphabet, ref_ptr mng); + ref_ptr SetAlphabet(std::string const & alphabet, ref_ptr mng); private: dp::Anchor m_anchor; @@ -158,14 +155,14 @@ public: void UpdateSize(m2::PointF const & size); protected: - void SetContent(string && content); - void SetContent(string const & content); + void SetContent(std::string && content); + void SetContent(std::string const & content); void SetTextureManager(ref_ptr textures); private: drape_ptr m_textView; mutable bool m_isContentDirty; - string m_content; + std::string m_content; ref_ptr m_textureManager; bool m_glyphsReady; }; @@ -174,19 +171,19 @@ class MutableLabelDrawer { public: using TCreatoreResult = drape_ptr; - using THandleCreator = function; + using THandleCreator = std::function; struct Params { dp::Anchor m_anchor; dp::FontDecl m_font; m2::PointF m_pivot; - string m_alphabet; + std::string m_alphabet; uint32_t m_maxLength; THandleCreator m_handleCreator; }; - /// return maximum pixel size + // Return maximum pixel size. static m2::PointF Draw(Params const & params, ref_ptr mng, dp::Batcher::TFlushFn const & flushFn); }; @@ -196,10 +193,8 @@ class StaticLabelHandle : public Handle using TBase = Handle; public: - StaticLabelHandle(uint32_t id, ref_ptr textureManager, - dp::Anchor anchor, m2::PointF const & pivot, - m2::PointF const & size, - TAlphabet const & alphabet); + StaticLabelHandle(uint32_t id, ref_ptr textureManager, dp::Anchor anchor, + m2::PointF const & pivot, m2::PointF const & size, TAlphabet const & alphabet); bool Update(ScreenBase const & screen) override; @@ -208,5 +203,4 @@ private: ref_ptr m_textureManager; bool m_glyphsReady; }; - -} +} // namespace gui diff --git a/drape_frontend/gui/layer_render.cpp b/drape_frontend/gui/layer_render.cpp index 499ad82905..26756d02e6 100644 --- a/drape_frontend/gui/layer_render.cpp +++ b/drape_frontend/gui/layer_render.cpp @@ -1,12 +1,13 @@ -#include "choose_position_mark.hpp" -#include "compass.hpp" -#include "copyright_label.hpp" -#include "debug_label.hpp" -#include "drape_gui.hpp" -#include "gui_text.hpp" -#include "layer_render.hpp" -#include "ruler.hpp" -#include "ruler_helper.hpp" +#include "drape_frontend/gui/choose_position_mark.hpp" +#include "drape_frontend/gui/compass.hpp" +#include "drape_frontend/gui/copyright_label.hpp" +#include "drape_frontend/gui/debug_label.hpp" +#include "drape_frontend/gui/drape_gui.hpp" +#include "drape_frontend/gui/gui_text.hpp" +#include "drape_frontend/gui/layer_render.hpp" +#include "drape_frontend/gui/ruler.hpp" +#include "drape_frontend/gui/ruler_helper.hpp" +#include "drape_frontend/gui/watermark.hpp" #include "drape_frontend/visual_params.hpp" @@ -18,11 +19,15 @@ #include "base/stl_add.hpp" -#include "std/bind.hpp" +#include +#include +#include +#include + +using namespace std::placeholders; namespace gui { - LayerRenderer::~LayerRenderer() { DestroyRenderers(); @@ -30,7 +35,7 @@ LayerRenderer::~LayerRenderer() void LayerRenderer::Build(ref_ptr mng) { - for (TRenderers::value_type & r : m_renderers) + for (auto & r : m_renderers) r.second->Build(mng); } @@ -43,7 +48,7 @@ void LayerRenderer::Render(ref_ptr mng, bool routingActiv DrapeGui::GetRulerHelper().Update(screen); } - for (TRenderers::value_type & r : m_renderers) + for (auto & r : m_renderers) { if (routingActive && (r.first == gui::WIDGET_COMPASS || r.first == gui::WIDGET_RULER)) continue; @@ -55,14 +60,14 @@ void LayerRenderer::Render(ref_ptr mng, bool routingActiv void LayerRenderer::Merge(ref_ptr other) { bool activeOverlayFound = false; - for (TRenderers::value_type & r : other->m_renderers) + for (auto & r : other->m_renderers) { - TRenderers::iterator it = m_renderers.find(r.first); + auto const it = m_renderers.find(r.first); if (it != m_renderers.end()) { auto newActiveOverlay = r.second->FindHandle(m_activeOverlayId); bool const updateActive = (m_activeOverlay != nullptr && newActiveOverlay != nullptr); - it->second = move(r.second); + it->second = std::move(r.second); if (!activeOverlayFound && updateActive) { activeOverlayFound = true; @@ -73,16 +78,15 @@ void LayerRenderer::Merge(ref_ptr other) } else { - m_renderers.insert(make_pair(r.first, move(r.second))); + m_renderers.insert(std::make_pair(r.first, std::move(r.second))); } } - other->m_renderers.clear(); } void LayerRenderer::SetLayout(TWidgetsLayoutInfo const & info) { - for (auto node : info) + for (auto const & node : info) { auto renderer = m_renderers.find(node.first); if (renderer != m_renderers.end()) @@ -100,12 +104,12 @@ void LayerRenderer::AddShapeRenderer(EWidget widget, drape_ptr && if (shape == nullptr) return; - VERIFY(m_renderers.insert(make_pair(widget, move(shape))).second, ()); + VERIFY(m_renderers.insert(std::make_pair(widget, std::move(shape))).second, ()); } bool LayerRenderer::OnTouchDown(m2::RectD const & touchArea) { - for (TRenderers::value_type & r : m_renderers) + for (auto & r : m_renderers) { m_activeOverlay = r.second->ProcessTapEvent(touchArea); if (m_activeOverlay != nullptr) @@ -150,28 +154,26 @@ bool LayerRenderer::HasWidget(EWidget widget) const namespace { - class ScaleLabelHandle : public MutableLabelHandle { using TBase = MutableLabelHandle; public: ScaleLabelHandle(uint32_t id, ref_ptr textures) - : TBase(id, dp::LeftBottom, m2::PointF::Zero(), textures) - , m_scale(0) + : TBase(id, dp::LeftBottom, m2::PointF::Zero(), textures), m_scale(0) { SetIsVisible(true); } bool Update(ScreenBase const & screen) override { - int newScale = df::GetDrawTileScale(screen); + int const newScale = df::GetDrawTileScale(screen); if (m_scale != newScale) { m_scale = newScale; SetContent("Scale : " + strings::to_string(m_scale)); } - float vs = df::VisualParams::Instance().GetVisualScale(); + auto const vs = static_cast(df::VisualParams::Instance().GetVisualScale()); m2::PointF offset(10.0f * vs, 30.0f * vs); SetPivot(glsl::ToVec2(m2::PointF(screen.PixelRect().LeftBottom()) + offset)); @@ -181,22 +183,22 @@ public: private: int m_scale; }; +} // namespace -} // namespace - -drape_ptr LayerCacher::RecacheWidgets(TWidgetsInitInfo const & initInfo, ref_ptr textures) +drape_ptr LayerCacher::RecacheWidgets(TWidgetsInitInfo const & initInfo, + ref_ptr textures) { - using TCacheShape = function renderer, ref_ptr textures)>; - static map cacheFunctions - { - make_pair(WIDGET_COMPASS, bind(&LayerCacher::CacheCompass, this, _1, _2, _3)), - make_pair(WIDGET_RULER, bind(&LayerCacher::CacheRuler, this, _1, _2, _3)), - make_pair(WIDGET_COPYRIGHT, bind(&LayerCacher::CacheCopyright, this, _1, _2, _3)), - make_pair(WIDGET_SCALE_LABEL, bind(&LayerCacher::CacheScaleLabel, this, _1, _2, _3)) - }; + using TCacheShape = std::function renderer, + ref_ptr textures)>; + static std::map cacheFunctions{ + std::make_pair(WIDGET_COMPASS, std::bind(&LayerCacher::CacheCompass, this, _1, _2, _3)), + std::make_pair(WIDGET_RULER, std::bind(&LayerCacher::CacheRuler, this, _1, _2, _3)), + std::make_pair(WIDGET_COPYRIGHT, std::bind(&LayerCacher::CacheCopyright, this, _1, _2, _3)), + std::make_pair(WIDGET_SCALE_LABEL, std::bind(&LayerCacher::CacheScaleLabel, this, _1, _2, _3)), + std::make_pair(WIDGET_WATERMARK, std::bind(&LayerCacher::CacheWatermark, this, _1, _2, _3))}; drape_ptr renderer = make_unique_dp(); - for (auto node : initInfo) + for (auto const & node : initInfo) { auto cacheFunction = cacheFunctions.find(node.first); if (cacheFunction != cacheFunctions.end()) @@ -223,12 +225,12 @@ drape_ptr LayerCacher::RecacheChoosePositionMark(ref_ptr LayerCacher::RecacheDebugLabels(ref_ptr textures) { drape_ptr renderer = make_unique_dp(); - float const vs = df::VisualParams::Instance().GetVisualScale(); + float const vs = static_cast(df::VisualParams::Instance().GetVisualScale()); DebugInfoLabels debugLabels = DebugInfoLabels(Position(m2::PointF(10.0f * vs, 50.0f * vs), dp::Center)); debugLabels.AddLabel(textures, "visible: km2, readed: km2, ratio:", @@ -256,8 +258,8 @@ drape_ptr LayerCacher::RecacheDebugLabels(ref_ptr LayerCacher::RecacheDebugLabels(ref_ptr LayerCacher::RecacheDebugLabels(ref_ptr LayerCacher::RecacheDebugLabels(ref_ptr bool { ostringstream out; - out << fixed << setprecision(2) + out << std::fixed << std::setprecision(2) << "angle: " << screen.GetRotationAngle() * 180.0 / math::pi; content.assign(out.str()); return true; @@ -322,10 +325,10 @@ m2::PointF LayerCacher::CacheCompass(Position const & position, ref_ptr shape = compass.Draw(compassSize, textures, bind(&DrapeGui::CallOnCompassTappedHandler, - &DrapeGui::Instance())); + drape_ptr shape = compass.Draw(compassSize, textures, + std::bind(&DrapeGui::CallOnCompassTappedHandler, &DrapeGui::Instance())); - renderer->AddShapeRenderer(WIDGET_COMPASS, move(shape)); + renderer->AddShapeRenderer(WIDGET_COMPASS, std::move(shape)); return compassSize; } @@ -334,8 +337,7 @@ m2::PointF LayerCacher::CacheRuler(Position const & position, ref_ptr textures) { m2::PointF rulerSize; - renderer->AddShapeRenderer(WIDGET_RULER, - Ruler(position).Draw(rulerSize, textures)); + renderer->AddShapeRenderer(WIDGET_RULER, Ruler(position).Draw(rulerSize, textures)); return rulerSize; } @@ -343,13 +345,12 @@ m2::PointF LayerCacher::CacheCopyright(Position const & position, ref_ptr textures) { m2::PointF size; - renderer->AddShapeRenderer(WIDGET_COPYRIGHT, - CopyrightLabel(position).Draw(size, textures)); - + renderer->AddShapeRenderer(WIDGET_COPYRIGHT, CopyrightLabel(position).Draw(size, textures)); return size; } -m2::PointF LayerCacher::CacheScaleLabel(Position const & position, ref_ptr renderer, ref_ptr textures) +m2::PointF LayerCacher::CacheScaleLabel(Position const & position, ref_ptr renderer, + ref_ptr textures) { MutableLabelDrawer::Params params; params.m_alphabet = "Scale: 1234567890"; @@ -363,10 +364,18 @@ m2::PointF LayerCacher::CacheScaleLabel(Position const & position, ref_ptr scaleRenderer = make_unique_dp(); - m2::PointF size = MutableLabelDrawer::Draw(params, textures, bind(&ShapeRenderer::AddShape, scaleRenderer.get(), _1, _2)); + m2::PointF size = MutableLabelDrawer::Draw(params, textures, + std::bind(&ShapeRenderer::AddShape, scaleRenderer.get(), _1, _2)); - renderer->AddShapeRenderer(WIDGET_SCALE_LABEL, move(scaleRenderer)); + renderer->AddShapeRenderer(WIDGET_SCALE_LABEL, std::move(scaleRenderer)); return size; } -} // namespace gui +m2::PointF LayerCacher::CacheWatermark(Position const & position, ref_ptr renderer, + ref_ptr textures) +{ + m2::PointF size; + renderer->AddShapeRenderer(WIDGET_WATERMARK, Watermark(position).Draw(size, textures)); + return size; +} +} // namespace gui diff --git a/drape_frontend/gui/layer_render.hpp b/drape_frontend/gui/layer_render.hpp index 320b88e9aa..8391e9f5aa 100644 --- a/drape_frontend/gui/layer_render.hpp +++ b/drape_frontend/gui/layer_render.hpp @@ -1,29 +1,23 @@ #pragma once -#include "skin.hpp" -#include "shape.hpp" +#include "drape_frontend/gui/skin.hpp" +#include "drape_frontend/gui/shape.hpp" #include "drape/gpu_program_manager.hpp" #include "drape/texture_manager.hpp" #include "geometry/screenbase.hpp" -#include "std/map.hpp" -#include "std/unique_ptr.hpp" +#include "base/macros.hpp" + +#include namespace gui { - class LayerRenderer { public: LayerRenderer() = default; - LayerRenderer(LayerRenderer && other) = delete; - LayerRenderer(LayerRenderer const & other) = delete; - - LayerRenderer & operator=(LayerRenderer && other) = delete; - LayerRenderer & operator=(LayerRenderer const & other) = delete; - ~LayerRenderer(); void Build(ref_ptr mng); @@ -45,11 +39,13 @@ private: void AddShapeRenderer(EWidget widget, drape_ptr && shape); private: - typedef map > TRenderers; + using TRenderers = std::map>; TRenderers m_renderers; ref_ptr m_activeOverlay; FeatureID m_activeOverlayId; + + DISALLOW_COPY_AND_MOVE(LayerRenderer); }; class LayerCacher @@ -59,15 +55,20 @@ public: ref_ptr textures); drape_ptr RecacheChoosePositionMark(ref_ptr textures); -#ifdef RENRER_DEBUG_INFO_LABELS +#ifdef RENDER_DEBUG_INFO_LABELS drape_ptr RecacheDebugLabels(ref_ptr textures); #endif private: - m2::PointF CacheCompass(Position const & position, ref_ptr renderer, ref_ptr textures); - m2::PointF CacheRuler(Position const & position, ref_ptr renderer, ref_ptr textures); - m2::PointF CacheCopyright(Position const & position, ref_ptr renderer, ref_ptr textures); - m2::PointF CacheScaleLabel(Position const & position, ref_ptr renderer, ref_ptr textures); + m2::PointF CacheCompass(Position const & position, ref_ptr renderer, + ref_ptr textures); + m2::PointF CacheRuler(Position const & position, ref_ptr renderer, + ref_ptr textures); + m2::PointF CacheCopyright(Position const & position, ref_ptr renderer, + ref_ptr textures); + m2::PointF CacheScaleLabel(Position const & position, ref_ptr renderer, + ref_ptr textures); + m2::PointF CacheWatermark(Position const & position, ref_ptr renderer, + ref_ptr textures); }; - -} // namespace gui +} // namespace gui diff --git a/drape_frontend/gui/ruler.cpp b/drape_frontend/gui/ruler.cpp index 0127d7bc9f..be1ab9a82d 100644 --- a/drape_frontend/gui/ruler.cpp +++ b/drape_frontend/gui/ruler.cpp @@ -9,23 +9,20 @@ #include "drape/glsl_func.hpp" #include "drape/glsl_types.hpp" -#include "std/bind.hpp" +#include + +using namespace std::placeholders; namespace gui { - namespace { - struct RulerVertex { RulerVertex() = default; RulerVertex(glsl::vec2 const & pos, glsl::vec2 const & normal, glsl::vec2 const & texCoord) - : m_position(pos) - , m_normal(normal) - , m_texCoord(texCoord) - { - } + : m_position(pos), m_normal(normal), m_texCoord(texCoord) + {} glsl::vec2 m_position; glsl::vec2 m_normal; @@ -52,8 +49,7 @@ public: , m_isAppearing(isAppearing) , m_isVisibleAtEnd(true) , m_animation(false, 0.4) - { - } + {} bool Update(ScreenBase const & screen) { @@ -97,7 +93,7 @@ protected: virtual void UpdateImpl(ScreenBase const & /*screen*/, RulerHelper const & /*helper*/) {} bool IsAppearing() const { return m_isAppearing; } - float GetOpacity() const { return m_animation.GetT(); } + float GetOpacity() const { return static_cast(m_animation.GetT()); } private: bool m_isAppearing; @@ -117,14 +113,14 @@ public: private: void UpdateImpl(ScreenBase const & screen, RulerHelper const & helper) override { - if (IsVisible()) - { - m_size = m2::PointF(helper.GetRulerPixelLength(), 2 * helper.GetRulerHalfHeight()); - if (IsAppearing()) - m_uniforms.SetFloatValue("u_length", helper.GetRulerPixelLength()); - m_uniforms.SetFloatValue("u_position", m_pivot.x, m_pivot.y); - m_uniforms.SetFloatValue("u_opacity", GetOpacity()); - } + if (!IsVisible()) + return; + + m_size = m2::PointF(helper.GetRulerPixelLength(), 2 * helper.GetRulerHalfHeight()); + if (IsAppearing()) + m_uniforms.SetFloatValue("u_length", helper.GetRulerPixelLength()); + m_uniforms.SetFloatValue("u_position", m_pivot.x, m_pivot.y); + m_uniforms.SetFloatValue("u_opacity", GetOpacity()); } }; @@ -169,8 +165,7 @@ protected: private: bool m_firstUpdate; }; - -} +} // namespace drape_ptr Ruler::Draw(m2::PointF & size, ref_ptr tex) const { @@ -182,11 +177,12 @@ drape_ptr Ruler::Draw(m2::PointF & size, ref_ptr renderer = make_unique_dp(); - renderer->AddShapeControl(move(control)); + renderer->AddShapeControl(std::move(control)); return renderer; } -void Ruler::DrawRuler(m2::PointF & size, ShapeControl & control, ref_ptr tex, bool isAppearing) const +void Ruler::DrawRuler(m2::PointF & size, ShapeControl & control, ref_ptr tex, + bool isAppearing) const { buffer_vector data; @@ -194,8 +190,8 @@ void Ruler::DrawRuler(m2::PointF & size, ShapeControl & control, ref_ptrGetColorRegion(DrapeGui::GetGuiTextFont().m_color, reg); glsl::vec2 texCoord = glsl::ToVec2(reg.GetTexRect().Center()); - float h = DrapeGui::GetRulerHelper().GetRulerHalfHeight(); - size += m2::PointF(DrapeGui::GetRulerHelper().GetMaxRulerPixelLength(), 2.0 * h); + float const h = DrapeGui::GetRulerHelper().GetRulerHalfHeight(); + size += m2::PointF(DrapeGui::GetRulerHelper().GetMaxRulerPixelLength(), 2.0f * h); glsl::vec2 normals[] = { @@ -222,34 +218,34 @@ void Ruler::DrawRuler(m2::PointF & size, ShapeControl & control, ref_ptr(EGuiHandle::GuiHandleRuler, m_position.m_anchor, - m_position.m_pixelPivot, isAppearing)); + make_unique_dp(EGuiHandle::GuiHandleRuler, + m_position.m_anchor, m_position.m_pixelPivot, isAppearing)); } } -void Ruler::DrawText(m2::PointF & size, ShapeControl & control, ref_ptr tex, bool isAppearing) const +void Ruler::DrawText(m2::PointF & size, ShapeControl & control, ref_ptr tex, + bool isAppearing) const { - string alphabet; + std::string alphabet; uint32_t maxTextLength; RulerHelper & helper = DrapeGui::GetRulerHelper(); helper.GetTextInitInfo(alphabet, maxTextLength); MutableLabelDrawer::Params params; - params.m_anchor = - static_cast((m_position.m_anchor & (dp::Right | dp::Left)) | dp::Bottom); + params.m_anchor = static_cast((m_position.m_anchor & (dp::Right | dp::Left)) | dp::Bottom); params.m_alphabet = alphabet; params.m_maxLength = maxTextLength; params.m_font = DrapeGui::GetGuiTextFont(); params.m_pivot = m_position.m_pixelPivot + m2::PointF(0.0, helper.GetVerticalTextOffset()); - params.m_handleCreator = [isAppearing, tex](dp::Anchor anchor, m2::PointF const & pivot) - { - return make_unique_dp(EGuiHandle::GuiHandleRulerLabel, anchor, pivot, isAppearing, tex); + params.m_handleCreator = [isAppearing, tex](dp::Anchor anchor, m2::PointF const & pivot) { + return make_unique_dp(EGuiHandle::GuiHandleRulerLabel, anchor, pivot, + isAppearing, tex); }; - m2::PointF textSize = MutableLabelDrawer::Draw(params, tex, bind(&ShapeControl::AddShape, &control, _1, _2)); + m2::PointF textSize = MutableLabelDrawer::Draw(params, tex, + std::bind(&ShapeControl::AddShape, &control, _1, _2)); size.y += (textSize.y + abs(helper.GetVerticalTextOffset())); } - -} +} // namespace gui diff --git a/drape_frontend/gui/ruler.hpp b/drape_frontend/gui/ruler.hpp index d9cce025ae..23d1f307db 100644 --- a/drape_frontend/gui/ruler.hpp +++ b/drape_frontend/gui/ruler.hpp @@ -1,19 +1,21 @@ #pragma once -#include "shape.hpp" +#include "drape_frontend/gui/shape.hpp" namespace gui { - class Ruler : public Shape { public: - Ruler(gui::Position const & position) : Shape(position) {} + explicit Ruler(gui::Position const & position) + : Shape(position) + {} drape_ptr Draw(m2::PointF & size, ref_ptr tex) const; private: - void DrawRuler(m2::PointF & size, ShapeControl & control, ref_ptr tex, bool isAppearing) const; - void DrawText(m2::PointF & size, ShapeControl & control, ref_ptr tex, bool isAppearing) const; + void DrawRuler(m2::PointF & size, ShapeControl & control, ref_ptr tex, + bool isAppearing) const; + void DrawText(m2::PointF & size, ShapeControl & control, ref_ptr tex, + bool isAppearing) const; }; - -} +} // namespace gui diff --git a/drape_frontend/gui/ruler_helper.cpp b/drape_frontend/gui/ruler_helper.cpp index 13f1dc9f22..06067e337e 100644 --- a/drape_frontend/gui/ruler_helper.cpp +++ b/drape_frontend/gui/ruler_helper.cpp @@ -1,33 +1,33 @@ #include "drape_frontend/gui/ruler_helper.hpp" #include "drape_frontend/gui/drape_gui.hpp" - #include "drape_frontend/visual_params.hpp" -#include "platform/settings.hpp" #include "platform/measurement_utils.hpp" +#include "platform/settings.hpp" #include "geometry/mercator.hpp" #include "geometry/screenbase.hpp" #include "base/macros.hpp" -#include "std/algorithm.hpp" -#include "std/numeric.hpp" -#include "std/iterator.hpp" +#include +#include +#include +#include namespace gui { - namespace { +int constexpr kMinPixelWidth = 60; +int constexpr kMinMetersWidth = 10; +int constexpr kMaxMetersWidth = 1000000; -static int const MinPixelWidth = 60; -static int const MinMetersWidth = 10; -static int const MaxMetersWidth = 1000000; +int constexpr kMinUnitValue = -1; +int constexpr kMaxUnitValue = std::numeric_limits::max() - 1; +int constexpr kInvalidUnitValue = kMaxUnitValue + 1; -static int const MinUnitValue = -1; -static int const MaxUnitValue = numeric_limits::max() - 1; -static int const InvalidUnitValue = MaxUnitValue + 1; +int constexpr kVisibleRulerBottomScale = 5; struct UnitValue { @@ -94,41 +94,37 @@ UnitValue g_arrMetres[] = { { "1000 km", 1000000 } }; -double identity(double val) +double Identity(double val) { return val; } - -int const VISIBLE_RULER_BOTTOM_SCALE = 5; - -} +} // namespace RulerHelper::RulerHelper() : m_pixelLength(0.0) - , m_rangeIndex(InvalidUnitValue) + , m_rangeIndex(kInvalidUnitValue) , m_isTextDirty(false) , m_dirtyTextRequested(false) -{ -} +{} void RulerHelper::Update(ScreenBase const & screen) { m2::PointD pivot = screen.PixelRect().Center(); - int const minPxWidth = my::rounds(MinPixelWidth * df::VisualParams::Instance().GetVisualScale()); + int const minPxWidth = my::rounds(kMinPixelWidth * df::VisualParams::Instance().GetVisualScale()); m2::PointD pt1 = screen.PtoG(pivot); m2::PointD pt0 = screen.PtoG(pivot - m2::PointD(minPxWidth, 0)); double const distanceInMetres = MercatorBounds::DistanceOnEarth(pt0, pt1); - // convert metres to units for calculating m_metresDiff + // convert metres to units for calculating m_metresDiff. double metersDiff = CalcMetresDiff(distanceInMetres); - bool const higherThanMax = metersDiff > MaxMetersWidth; - bool const lessThanMin = metersDiff < MinMetersWidth; - m_pixelLength = minPxWidth; + bool const higherThanMax = metersDiff > kMaxMetersWidth; + bool const lessThanMin = metersDiff < kMinMetersWidth; + m_pixelLength = static_cast(minPxWidth); if (higherThanMax) - m_pixelLength = minPxWidth * 3 / 2; + m_pixelLength = static_cast(minPxWidth) * 3.0f / 2.0f; else if (!lessThanMin) { double const a = ang::AngleTo(pt1, pt0); @@ -138,8 +134,8 @@ void RulerHelper::Update(ScreenBase const & screen) } int drawScale = df::GetDrawTileScale(screen); - if (m_currentDrawScale < VISIBLE_RULER_BOTTOM_SCALE && - drawScale >= VISIBLE_RULER_BOTTOM_SCALE) + if (m_currentDrawScale < kVisibleRulerBottomScale && + drawScale >= kVisibleRulerBottomScale) { SetTextDirty(); } @@ -150,7 +146,7 @@ void RulerHelper::Update(ScreenBase const & screen) bool RulerHelper::IsVisible(ScreenBase const & screen) const { DrapeGui & gui = DrapeGui::Instance(); - return !gui.IsCopyrightActive() && df::GetDrawTileScale(screen) >= VISIBLE_RULER_BOTTOM_SCALE; + return !gui.IsCopyrightActive() && df::GetDrawTileScale(screen) >= kVisibleRulerBottomScale; } void RulerHelper::Invalidate() @@ -161,7 +157,7 @@ void RulerHelper::Invalidate() float RulerHelper::GetRulerHalfHeight() const { float const kRulerHalfHeight = 1.0f; - return kRulerHalfHeight * df::VisualParams::Instance().GetVisualScale(); + return kRulerHalfHeight * static_cast(df::VisualParams::Instance().GetVisualScale()); } float RulerHelper::GetRulerPixelLength() const @@ -171,12 +167,12 @@ float RulerHelper::GetRulerPixelLength() const float RulerHelper::GetMaxRulerPixelLength() const { - return MinPixelWidth * 3.0 / 2.0; + return static_cast(kMinPixelWidth) * 3.0f / 2.0f; } int RulerHelper::GetVerticalTextOffset() const { - return -5 * df::VisualParams::Instance().GetVisualScale(); + return static_cast(-5 * df::VisualParams::Instance().GetVisualScale()); } bool RulerHelper::IsTextDirty() const @@ -198,7 +194,7 @@ void RulerHelper::ResetTextDirtyFlag() void RulerHelper::GetTextInitInfo(string & alphabet, uint32_t & size) const { - set symbols; + std::set symbols; size_t result = 0; auto const functor = [&result, &symbols](UnitValue const & v) { @@ -208,17 +204,17 @@ void RulerHelper::GetTextInitInfo(string & alphabet, uint32_t & size) const symbols.insert(v.m_s[i]); }; - for_each(begin(g_arrFeets), end(g_arrFeets), functor); - for_each(begin(g_arrMetres), end(g_arrMetres), functor); - for_each(begin(g_arrYards), end(g_arrYards), functor); + std::for_each(std::begin(g_arrFeets), std::end(g_arrFeets), functor); + std::for_each(std::begin(g_arrMetres), std::end(g_arrMetres), functor); + std::for_each(std::begin(g_arrYards), std::end(g_arrYards), functor); - for_each(begin(symbols), end(symbols), [&alphabet](char c) + std::for_each(begin(symbols), end(symbols), [&alphabet](char c) { alphabet.push_back(c); }); alphabet.append("<>"); - size = static_cast(result) + 2; // add 2 char for symbols "< " and "> " + size = static_cast(result) + 2; // add 2 char for symbols "< " and "> ". } double RulerHelper::CalcMetresDiff(double value) @@ -226,8 +222,7 @@ double RulerHelper::CalcMetresDiff(double value) UnitValue * arrU = g_arrMetres; int count = ARRAY_SIZE(g_arrMetres); - typedef double (*ConversionFn)(double); - ConversionFn conversionFn = &identity; + auto conversionFn = &Identity; auto units = measurement_utils::Units::Metric; UNUSED_VALUE(settings::Get(settings::kMeasurementUnits, units)); @@ -244,17 +239,18 @@ double RulerHelper::CalcMetresDiff(double value) double v = conversionFn(value); if (arrU[0].m_i > v) { - m_rangeIndex = MinUnitValue; + m_rangeIndex = kMinUnitValue; m_rulerText = string("< ") + arrU[0].m_s; - result = MinMetersWidth - 1.0; + result = kMinMetersWidth - 1.0; } else if (arrU[count-1].m_i <= v) { - m_rangeIndex = MaxUnitValue; + m_rangeIndex = kMaxUnitValue; m_rulerText = string("> ") + arrU[count-1].m_s; - result = MaxMetersWidth + 1.0; + result = kMaxMetersWidth + 1.0; } else + { for (int i = 0; i < count; ++i) { if (arrU[i].m_i > v) @@ -265,6 +261,7 @@ double RulerHelper::CalcMetresDiff(double value) break; } } + } if (m_rangeIndex != prevUnitRange) SetTextDirty(); @@ -277,5 +274,4 @@ void RulerHelper::SetTextDirty() m_dirtyTextRequested = false; m_isTextDirty = true; } - -} +} // namespace gui diff --git a/drape_frontend/gui/ruler_helper.hpp b/drape_frontend/gui/ruler_helper.hpp index 16e3fc685e..e724ffe9c8 100644 --- a/drape_frontend/gui/ruler_helper.hpp +++ b/drape_frontend/gui/ruler_helper.hpp @@ -2,13 +2,12 @@ #include "drape_frontend/animation/show_hide_animation.hpp" -#include "std/string.hpp" +#include class ScreenBase; namespace gui { - class RulerHelper { public: @@ -23,9 +22,9 @@ public: float GetMaxRulerPixelLength() const; int GetVerticalTextOffset() const; bool IsTextDirty() const; - string const & GetRulerText() const; + std::string const & GetRulerText() const; void ResetTextDirtyFlag(); - void GetTextInitInfo(string & alphabet, uint32_t & size) const; + void GetTextInitInfo(std::string & alphabet, uint32_t & size) const; private: double CalcMetresDiff(double value); @@ -34,10 +33,9 @@ private: private: float m_pixelLength; int m_rangeIndex; - string m_rulerText; + std::string m_rulerText; bool m_isTextDirty; mutable bool m_dirtyTextRequested; int m_currentDrawScale = 0; }; - -} +} // namespace gui diff --git a/drape_frontend/gui/shape.cpp b/drape_frontend/gui/shape.cpp index e7f78536cb..de0124eff5 100644 --- a/drape_frontend/gui/shape.cpp +++ b/drape_frontend/gui/shape.cpp @@ -1,4 +1,4 @@ -#include "shape.hpp" +#include "drape_frontend/gui/shape.hpp" #include "drape_frontend/visual_params.hpp" @@ -7,14 +7,15 @@ #include "base/logging.hpp" +#include + namespace gui { - -Handle::Handle(uint32_t id, dp::Anchor anchor, const m2::PointF & pivot, const m2::PointF & size) +Handle::Handle(uint32_t id, dp::Anchor anchor, m2::PointF const & pivot, m2::PointF const & size) : dp::OverlayHandle(FeatureID(MwmSet::MwmId(), id), anchor, 0, false) - , m_pivot(glsl::ToVec2(pivot)), m_size(size) -{ -} + , m_pivot(glsl::ToVec2(pivot)) + , m_size(size) +{} bool Handle::Update(ScreenBase const & screen) { @@ -39,13 +40,15 @@ bool Handle::IndexesRequired() const return false; } -m2::RectD Handle::GetPixelRect(const ScreenBase & screen, bool perspective) const +m2::RectD Handle::GetPixelRect(ScreenBase const & screen, bool perspective) const { // There is no need to check intersection of gui elements. + UNUSED_VALUE(perspective); return m2::RectD(); } -void Handle::GetPixelShape(const ScreenBase & screen, bool perspective, dp::OverlayHandle::Rects & rects) const +void Handle::GetPixelShape(ScreenBase const & screen, bool perspective, + dp::OverlayHandle::Rects & rects) const { // There is no need to check intersection of gui elements. UNUSED_VALUE(screen); @@ -74,18 +77,15 @@ bool TappableHandle::IsTapped(m2::RectD const & touchArea) const ShapeRenderer::~ShapeRenderer() { - ForEachShapeInfo([](ShapeControl::ShapeInfo & info) - { - info.Destroy(); - }); + ForEachShapeInfo([](ShapeControl::ShapeInfo & info) { info.Destroy(); }); } void ShapeRenderer::Build(ref_ptr mng) { ForEachShapeInfo([mng](ShapeControl::ShapeInfo & info) mutable - { - info.m_buffer->Build(mng->GetProgram(info.m_state.GetProgramIndex())); - }); + { + info.m_buffer->Build(mng->GetProgram(info.m_state.GetProgramIndex())); + }); } void ShapeRenderer::Render(ScreenBase const & screen, ref_ptr mng) @@ -97,74 +97,73 @@ void ShapeRenderer::Render(ScreenBase const & screen, ref_ptrUpdate(screen)) - return; + ForEachShapeInfo([&uniformStorage, &screen, mng](ShapeControl::ShapeInfo & info) mutable + { + if (!info.m_handle->Update(screen)) + return; - if (!info.m_handle->IsVisible()) - return; + if (!info.m_handle->IsVisible()) + return; - ref_ptr prg = mng->GetProgram(info.m_state.GetProgramIndex()); - prg->Bind(); - dp::ApplyState(info.m_state, prg); - dp::ApplyUniforms(info.m_handle->GetUniforms(), prg); - dp::ApplyUniforms(uniformStorage, prg); + ref_ptr prg = mng->GetProgram(info.m_state.GetProgramIndex()); + prg->Bind(); + dp::ApplyState(info.m_state, prg); + dp::ApplyUniforms(info.m_handle->GetUniforms(), prg); + dp::ApplyUniforms(uniformStorage, prg); - if (info.m_handle->HasDynamicAttributes()) - { - dp::AttributeBufferMutator mutator; - ref_ptr mutatorRef = make_ref(&mutator); - info.m_handle->GetAttributeMutation(mutatorRef); - info.m_buffer->ApplyMutation(nullptr, mutatorRef); - } + if (info.m_handle->HasDynamicAttributes()) + { + dp::AttributeBufferMutator mutator; + ref_ptr mutatorRef = make_ref(&mutator); + info.m_handle->GetAttributeMutation(mutatorRef); + info.m_buffer->ApplyMutation(nullptr, mutatorRef); + } - info.m_buffer->Render(info.m_state.GetDrawAsLine()); - }); + info.m_buffer->Render(info.m_state.GetDrawAsLine()); + }); } void ShapeRenderer::AddShape(dp::GLState const & state, drape_ptr && bucket) { m_shapes.push_back(ShapeControl()); - m_shapes.back().AddShape(state, move(bucket)); + m_shapes.back().AddShape(state, std::move(bucket)); } void ShapeRenderer::AddShapeControl(ShapeControl && control) { - m_shapes.push_back(move(control)); + m_shapes.push_back(std::move(control)); } void ShapeRenderer::SetPivot(m2::PointF const & pivot) { - for (ShapeControl & control : m_shapes) + for (auto & control : m_shapes) { - for (ShapeControl::ShapeInfo & info : control.m_shapesInfo) + for (auto & info : control.m_shapesInfo) info.m_handle->SetPivot(glsl::ToVec2(pivot)); } } void ShapeRenderer::ForEachShapeControl(TShapeControlEditFn const & fn) { - for_each(m_shapes.begin(), m_shapes.end(), fn); + std::for_each(m_shapes.begin(), m_shapes.end(), fn); } void ShapeRenderer::ForEachShapeInfo(ShapeRenderer::TShapeInfoEditFn const & fn) { ForEachShapeControl([&fn](ShapeControl & shape) - { - for_each(shape.m_shapesInfo.begin(), shape.m_shapesInfo.end(), fn); - }); + { + std::for_each(shape.m_shapesInfo.begin(), shape.m_shapesInfo.end(), fn); + }); } ref_ptr ShapeRenderer::ProcessTapEvent(m2::RectD const & touchArea) { ref_ptr resultHandle = nullptr; ForEachShapeInfo([&resultHandle, &touchArea](ShapeControl::ShapeInfo & shapeInfo) - { - if (shapeInfo.m_handle->IsTapped(touchArea)) - resultHandle = make_ref(shapeInfo.m_handle); - }); + { + if (shapeInfo.m_handle->IsTapped(touchArea)) + resultHandle = make_ref(shapeInfo.m_handle); + }); return resultHandle; } @@ -173,10 +172,10 @@ ref_ptr ShapeRenderer::FindHandle(FeatureID const & id) { ref_ptr resultHandle = nullptr; ForEachShapeInfo([&resultHandle, &id](ShapeControl::ShapeInfo & shapeInfo) - { - if (shapeInfo.m_handle->GetOverlayID().m_featureId == id) - resultHandle = make_ref(shapeInfo.m_handle); - }); + { + if (shapeInfo.m_handle->GetOverlayID().m_featureId == id) + resultHandle = make_ref(shapeInfo.m_handle); + }); return resultHandle; } @@ -184,9 +183,10 @@ ref_ptr ShapeRenderer::FindHandle(FeatureID const & id) ShapeControl::ShapeInfo::ShapeInfo(dp::GLState const & state, drape_ptr && buffer, drape_ptr && handle) - : m_state(state), m_buffer(move(buffer)), m_handle(move(handle)) -{ -} + : m_state(state) + , m_buffer(std::move(buffer)) + , m_handle(std::move(handle)) +{} void ShapeControl::ShapeInfo::Destroy() { @@ -205,12 +205,11 @@ void ShapeControl::AddShape(dp::GLState const & state, drape_ptrMoveBuffer(); - info.m_handle = drape_ptr(static_cast(handle.release())); + info.m_handle = drape_ptr(static_cast(handle.release())); } void ArrangeShapes(ref_ptr renderer, ShapeRenderer::TShapeControlEditFn const & fn) { renderer->ForEachShapeControl(fn); } - -} +} // namespace gui diff --git a/drape_frontend/gui/shape.hpp b/drape_frontend/gui/shape.hpp index e7ad5b38c3..74aadb9c96 100644 --- a/drape_frontend/gui/shape.hpp +++ b/drape_frontend/gui/shape.hpp @@ -10,26 +10,29 @@ #include "drape/texture_manager.hpp" #include "drape/vertex_array_buffer.hpp" +#include +#include + namespace gui { - class Handle : public dp::OverlayHandle { public: - Handle(uint32_t id, dp::Anchor anchor, m2::PointF const & pivot, m2::PointF const & size = m2::PointF::Zero()); + Handle(uint32_t id, dp::Anchor anchor, m2::PointF const & pivot, + m2::PointF const & size = m2::PointF::Zero()); dp::UniformValuesStorage const & GetUniforms() const { return m_uniforms; } bool Update(ScreenBase const & screen) override; - virtual bool IsTapped(m2::RectD const & /*touchArea*/) const { return false; } - virtual void OnTapBegin(){} - virtual void OnTap(){} - virtual void OnTapEnd(){} + virtual bool IsTapped(m2::RectD const & /* touchArea */) const { return false; } + virtual void OnTapBegin() {} + virtual void OnTap() {} + virtual void OnTapEnd() {} - virtual bool IndexesRequired() const override; - virtual m2::RectD GetPixelRect(ScreenBase const & screen, bool perspective) const override; - virtual void GetPixelShape(ScreenBase const & screen, bool perspective, Rects & rects) const override; + bool IndexesRequired() const override; + m2::RectD GetPixelRect(ScreenBase const & screen, bool perspective) const override; + void GetPixelShape(ScreenBase const & screen, bool perspective, Rects & rects) const override; m2::PointF GetSize() const { return m_size; } virtual void SetPivot(glsl::vec2 const & pivot) { m_pivot = pivot; } @@ -74,13 +77,13 @@ struct ShapeControl void AddShape(dp::GLState const & state, drape_ptr && bucket); - vector m_shapesInfo; + std::vector m_shapesInfo; }; class ShapeRenderer final { public: - using TShapeControlEditFn = function; + using TShapeControlEditFn = std::function; ~ShapeRenderer(); @@ -95,15 +98,14 @@ public: ref_ptr FindHandle(FeatureID const & id); private: - friend void ArrangeShapes(ref_ptr, - ShapeRenderer::TShapeControlEditFn const &); + friend void ArrangeShapes(ref_ptr, ShapeRenderer::TShapeControlEditFn const &); void ForEachShapeControl(TShapeControlEditFn const & fn); - using TShapeInfoEditFn = function; + using TShapeInfoEditFn = std::function; void ForEachShapeInfo(TShapeInfoEditFn const & fn); private: - vector m_shapes; + std::vector m_shapes; }; void ArrangeShapes(ref_ptr renderer, @@ -112,11 +114,13 @@ void ArrangeShapes(ref_ptr renderer, class Shape { public: - Shape(gui::Position const & position) : m_position(position) {} - using TTapHandler = function; + explicit Shape(gui::Position const & position) + : m_position(position) + {} + + using TTapHandler = std::function; protected: gui::Position m_position; }; - -} +} // namespace gui diff --git a/drape_frontend/gui/skin.cpp b/drape_frontend/gui/skin.cpp index a5d2ec015c..a0b8fe27dd 100644 --- a/drape_frontend/gui/skin.cpp +++ b/drape_frontend/gui/skin.cpp @@ -1,18 +1,18 @@ -#include "skin.hpp" +#include "drape_frontend/gui/skin.hpp" #include "platform/platform.hpp" + #include "coding/parse_xml.hpp" + #include "base/string_utils.hpp" -#include "std/function.hpp" + +#include namespace gui { - namespace { - #ifdef DEBUG - bool IsSimple(dp::Anchor anchor) { return anchor >= 0 && anchor <= 8; @@ -22,20 +22,19 @@ bool IsAnchor(dp::Anchor anchor) { return anchor >= 0 && anchor <= 10; } - #endif -dp::Anchor ParseValueAnchor(string const & value) +dp::Anchor ParseValueAnchor(std::string const & value) { if (value == "center") return dp::Center; - else if (value == "left") + if (value == "left") return dp::Left; - else if (value == "right") + if (value == "right") return dp::Right; - else if (value == "top") + if (value == "top") return dp::Top; - else if (value == "bottom") + if (value == "bottom") return dp::Bottom; else ASSERT(false, ()); @@ -52,11 +51,11 @@ dp::Anchor MergeAnchors(dp::Anchor src, dp::Anchor dst) return result; } -float ParseFloat(string const & v) +float ParseFloat(std::string const & v) { - double d = 0.0f; + double d = 0.0; VERIFY(strings::to_double(v, d), ()); - return d; + return static_cast(d); } class ResolverParser @@ -71,9 +70,10 @@ public: }; ResolverParser() - : m_element(Element::Empty) {} + : m_element(Element::Empty) + {} - void Parse(string const & attr, string const & value) + void Parse(std::string const & attr, std::string const & value) { ASSERT(m_element != Element::Empty, ()); @@ -121,12 +121,13 @@ private: class SkinLoader { public: - explicit SkinLoader(map > & skin) - : m_skin(skin) {} + explicit SkinLoader(std::map> & skin) + : m_skin(skin) + {} - bool Push(string const & element) + bool Push(std::string const & element) { - if (m_inElement == false) + if (!m_inElement) { if (element == "root") return true; @@ -138,10 +139,12 @@ public: m_currentElement = WIDGET_COMPASS; else if (element == "copyright") m_currentElement = WIDGET_COPYRIGHT; + else if (element == "watermark") + m_currentElement = WIDGET_WATERMARK; else ASSERT(false, ()); } - else if (m_inConfiguration == false) + else if (!m_inConfiguration) { if (element == "portrait" || element == "landscape") m_inConfiguration = true; @@ -163,7 +166,7 @@ public: return true; } - void Pop(string const & element) + void Pop(std::string const & element) { if (element == "anchor" || element == "relative" || element == "offset") m_parser.SetElement(ResolverParser::Element::Empty); @@ -179,19 +182,19 @@ public: m_parser.Reset(); m_inConfiguration = false; } - else if (element == "ruler" || element == "compass" || - element == "copyright" || element == "country_status") + else if (element == "ruler" || element == "compass" || element == "copyright" || + element == "country_status" || element == "watermark") { m_inElement = false; } } - void AddAttr(string const & attribute, string const & value) + void AddAttr(std::string const & attribute, std::string const & value) { m_parser.Parse(attribute, value); } - void CharData(string const &) {} + void CharData(std::string const &) {} private: bool m_inConfiguration = false; @@ -202,7 +205,6 @@ private: map > & m_skin; }; - } Position PositionResolver::Resolve(int w, int h, double vs) const @@ -272,10 +274,10 @@ void Skin::Resize(int w, int h) m_displayHeight = h; } -ReaderPtr ResolveGuiSkinFile(string const & deviceType) +ReaderPtr ResolveGuiSkinFile(std::string const & deviceType) { Platform & pl = GetPlatform(); - unique_ptr reader; + std::unique_ptr reader; try { reader = pl.GetReader("resources-default/" + deviceType + ".ui"); @@ -298,6 +300,6 @@ ReaderPtr ResolveGuiSkinFile(string const & deviceType) } } - return move(reader); -} + return ReaderPtr(std::move(reader)); } +} // namespace gui diff --git a/drape_frontend/gui/skin.hpp b/drape_frontend/gui/skin.hpp index de1cbb894b..72a194a5d9 100644 --- a/drape_frontend/gui/skin.hpp +++ b/drape_frontend/gui/skin.hpp @@ -1,26 +1,28 @@ #pragma once #include "drape/drape_global.hpp" + #include "geometry/point2d.hpp" + #include "coding/reader.hpp" -#include "std/map.hpp" -#include "std/utility.hpp" +#include +#include -//#define RENRER_DEBUG_INFO_LABELS +//#define RENDER_DEBUG_INFO_LABELS namespace gui { - enum EWidget { WIDGET_RULER = 0x1, WIDGET_COMPASS = 0x2, WIDGET_COPYRIGHT = 0x4, WIDGET_SCALE_LABEL = 0x8, + WIDGET_WATERMARK = 0x10, /// Following widgets controlled by rendering kernel. Don't use them in platform code WIDGET_CHOOSE_POSITION_MARK = 0x8000, -#ifdef RENRER_DEBUG_INFO_LABELS +#ifdef RENDER_DEBUG_INFO_LABELS WIDGET_DEBUG_INFO #endif }; @@ -32,40 +34,39 @@ enum EGuiHandle GuiHandleCompass, GuiHandleRuler, GuiHandleRulerLabel, - GuiHandleCountryLabel, - GuiHandleCountryProgress, - GuiHandleDownloadButton, - GuiHandleDownloadButtonLabel, - GuiHandleRetryButton, - GuiHandleRetryButtonLabel, - GuiHandleCancelButton, - GuiHandleCancelButtonLabel, GuiHandleChoosePositionMark, -#ifdef RENRER_DEBUG_INFO_LABELS + GuiHandleWatermark, +#ifdef RENDER_DEBUG_INFO_LABELS GuiHandleDebugLabel = 100 #endif }; struct Position { - Position() : m_pixelPivot(m2::PointF::Zero()), m_anchor(dp::Center) {} + Position() + : m_pixelPivot(m2::PointF::Zero()) + , m_anchor(dp::Center) + {} + explicit Position(dp::Anchor anchor) : m_pixelPivot(m2::PointF::Zero()) - , m_anchor(anchor) {} + , m_anchor(anchor) + {} Position(m2::PointF const & pt, dp::Anchor anchor) : m_pixelPivot(pt) - , m_anchor(anchor) {} + , m_anchor(anchor) + {} m2::PointF m_pixelPivot; dp::Anchor m_anchor; }; -/// TWidgetsInitInfo - static information about gui widgets (geometry align) -using TWidgetsInitInfo = map; -/// TWidgetsLayoutInfo - dynamic info. Pivot point of each widget in pixel coordinates -using TWidgetsLayoutInfo = map; -/// TWidgetsSizeInfo - info about widget pixel sizes +// TWidgetsInitInfo - static information about gui widgets (geometry align). +using TWidgetsInitInfo = std::map; +// TWidgetsLayoutInfo - dynamic info. Pivot point of each widget in pixel coordinates. +using TWidgetsLayoutInfo = std::map; +// TWidgetsSizeInfo - info about widget pixel sizes. using TWidgetsSizeInfo = TWidgetsLayoutInfo; class PositionResolver @@ -88,7 +89,7 @@ class Skin public: Skin(ReaderPtr const & reader, float visualScale); - /// @param name - must be single flag, not combination + // @param name - must be single flag, not combination. Position ResolvePosition(EWidget name); void Resize(int w, int h); int GetWidth() const { return m_displayWidth; } @@ -97,21 +98,20 @@ public: template void ForEach(ToDo todo) { - for (auto node : m_resolvers) + for (auto const & node : m_resolvers) todo(node.first, ResolvePosition(node.first)); } private: - /// TResolversPair.first - Portrait (when weight < height) - /// TResolversPair.second - Landscape (when weight >= height) - typedef pair TResolversPair; - map m_resolvers; + // TResolversPair.first - Portrait (when weight < height). + // TResolversPair.second - Landscape (when weight >= height). + using TResolversPair = std::pair; + std::map m_resolvers; int m_displayWidth; int m_displayHeight; float m_visualScale; }; -ReaderPtr ResolveGuiSkinFile(string const & deviceType); - -} +ReaderPtr ResolveGuiSkinFile(std::string const & deviceType); +} // namespace gui diff --git a/drape_frontend/gui/watermark.cpp b/drape_frontend/gui/watermark.cpp new file mode 100644 index 0000000000..1905376635 --- /dev/null +++ b/drape_frontend/gui/watermark.cpp @@ -0,0 +1,118 @@ +#include "drape_frontend/gui/watermark.hpp" +#include "drape_frontend/gui/drape_gui.hpp" +#include "drape_frontend/shader_def.hpp" + +#include "drape/glsl_func.hpp" +#include "drape/utils/vertex_decl.hpp" + +#include +#include + +using namespace std::placeholders; + +namespace gui +{ +namespace +{ +struct WatermarkVertex +{ + WatermarkVertex(glsl::vec2 const & position, glsl::vec2 const & texCoord) + : m_position(position), m_texCoord(texCoord) + {} + + glsl::vec2 m_position; + glsl::vec2 m_texCoord; +}; + +class WatermarkVertexHandle : public Handle +{ + using TBase = Handle; + +public: + WatermarkVertexHandle(uint32_t id, m2::PointF const & pivot, dp::Anchor anchor, + m2::PointF const & size) + : Handle(id, anchor, pivot, size) + { + SetIsVisible(true); + + m2::PointD halfSize(0.5 * size.x , 0.5 * size.y); + m_offset = glsl::vec2(0.0f, 0.0f); + + if (anchor & dp::Left) + m_offset.x = halfSize.x; + else if (m_anchor & dp::Right) + m_offset.x = -halfSize.x; + + if (anchor & dp::Top) + m_offset.y = halfSize.y; + else if (m_anchor & dp::Bottom) + m_offset.y = -halfSize.y; + } + + bool Update(ScreenBase const & screen) override + { + using namespace glsl; + + if (IsVisible()) + { + m_uniforms.SetMatrix4x4Value( + "modelView", value_ptr(transpose(translate(mat4(), vec3(m_pivot + m_offset, 0.0))))); + m_uniforms.SetFloatValue("u_opacity", 1.0); + } + return true; + } + +private: + glsl::vec2 m_offset; +}; +} // namespace + +drape_ptr Watermark::Draw(m2::PointF & size, ref_ptr tex) const +{ + dp::TextureManager::SymbolRegion region; + tex->GetSymbolRegion("watermark", region); + glsl::vec2 const halfSize = glsl::ToVec2(region.GetPixelSize() * 0.5f); + m2::RectF const texRect = region.GetTexRect(); + + WatermarkVertex vertexes[] = + { + WatermarkVertex(glsl::vec2(-halfSize.x, halfSize.y), glsl::ToVec2(texRect.LeftTop())), + WatermarkVertex(glsl::vec2(-halfSize.x, -halfSize.y), glsl::ToVec2(texRect.LeftBottom())), + WatermarkVertex(glsl::vec2(halfSize.x, halfSize.y), glsl::ToVec2(texRect.RightTop())), + WatermarkVertex(glsl::vec2(halfSize.x, -halfSize.y), glsl::ToVec2(texRect.RightBottom())) + }; + + auto state = df::CreateGLState(gpu::TEXTURING_GUI_PROGRAM, df::RenderState::GuiLayer); + state.SetColorTexture(region.GetTexture()); + + dp::AttributeProvider provider(1 /* streamCount */, 4 /* vertexCount */); + dp::BindingInfo info(2 /* count */); + + dp::BindingDecl & posDecl = info.GetBindingDecl(0); + posDecl.m_attributeName = "a_position"; + posDecl.m_componentCount = 2; + posDecl.m_componentType = gl_const::GLFloatType; + posDecl.m_offset = 0; + posDecl.m_stride = sizeof(WatermarkVertex); + + dp::BindingDecl & texDecl = info.GetBindingDecl(1); + texDecl.m_attributeName = "a_colorTexCoords"; + texDecl.m_componentCount = 2; + texDecl.m_componentType = gl_const::GLFloatType; + texDecl.m_offset = sizeof(glsl::vec2); + texDecl.m_stride = posDecl.m_stride; + + provider.InitStream(0, info, make_ref(&vertexes)); + + size = region.GetPixelSize(); + drape_ptr handle = make_unique_dp( + EGuiHandle::GuiHandleWatermark, m_position.m_pixelPivot, m_position.m_anchor, size); + + drape_ptr renderer = make_unique_dp(); + dp::Batcher batcher(dp::Batcher::IndexPerQuad, dp::Batcher::VertexPerQuad); + dp::SessionGuard guard(batcher, std::bind(&ShapeRenderer::AddShape, renderer.get(), _1, _2)); + batcher.InsertTriangleStrip(state, make_ref(&provider), std::move(handle)); + + return renderer; +} +} // namespace gui diff --git a/drape_frontend/gui/watermark.hpp b/drape_frontend/gui/watermark.hpp new file mode 100644 index 0000000000..a963922249 --- /dev/null +++ b/drape_frontend/gui/watermark.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include "drape_frontend/gui/shape.hpp" + +namespace gui +{ +class Watermark : public Shape +{ +public: + explicit Watermark(gui::Position const & position) : Shape(position) {} + + drape_ptr Draw(m2::PointF & size, ref_ptr tex) const; +}; +} // namespace gui diff --git a/iphone/Maps/Classes/Widgets/MWMMapWidgets.mm b/iphone/Maps/Classes/Widgets/MWMMapWidgets.mm index f107b72493..49f798781d 100644 --- a/iphone/Maps/Classes/Widgets/MWMMapWidgets.mm +++ b/iphone/Maps/Classes/Widgets/MWMMapWidgets.mm @@ -59,6 +59,7 @@ switch (w) { case gui::WIDGET_RULER: + case gui::WIDGET_WATERMARK: case gui::WIDGET_COPYRIGHT: pivot += rulerOffset; break; case gui::WIDGET_COMPASS: pivot += compassOffset; break; case gui::WIDGET_SCALE_LABEL: diff --git a/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj b/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj index 26c328d724..eee62ed617 100644 --- a/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj +++ b/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj @@ -51,6 +51,10 @@ 45580ABB1E28DB2600CD535D /* scenario_manager.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 45580AB91E28DB2600CD535D /* scenario_manager.hpp */; }; 456B3F991ED464FE009B3D1F /* postprocess_renderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 456B3F971ED464FE009B3D1F /* postprocess_renderer.cpp */; }; 456B3F9A1ED464FE009B3D1F /* postprocess_renderer.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 456B3F981ED464FE009B3D1F /* postprocess_renderer.hpp */; }; + 45A3781D20B324E6005FBDBB /* watermark.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 45A3781920B324E5005FBDBB /* watermark.hpp */; }; + 45A3781E20B324E6005FBDBB /* watermark.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45A3781A20B324E6005FBDBB /* watermark.cpp */; }; + 45A3781F20B324E6005FBDBB /* debug_label.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45A3781B20B324E6005FBDBB /* debug_label.cpp */; }; + 45A3782020B324E6005FBDBB /* debug_label.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 45A3781C20B324E6005FBDBB /* debug_label.hpp */; }; 45B4B8CB1CF5C16B00A54761 /* screen_animations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45B4B8C71CF5C16B00A54761 /* screen_animations.cpp */; }; 45B4B8CC1CF5C16B00A54761 /* screen_animations.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 45B4B8C81CF5C16B00A54761 /* screen_animations.hpp */; }; 45B4B8CD1CF5C16B00A54761 /* screen_operations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45B4B8C91CF5C16B00A54761 /* screen_operations.cpp */; }; @@ -261,6 +265,10 @@ 4560692B1EB9F9D2009AB7B7 /* shaders_lib.glsl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = shaders_lib.glsl; path = shaders/shaders_lib.glsl; sourceTree = ""; }; 456B3F971ED464FE009B3D1F /* postprocess_renderer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = postprocess_renderer.cpp; sourceTree = ""; }; 456B3F981ED464FE009B3D1F /* postprocess_renderer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = postprocess_renderer.hpp; sourceTree = ""; }; + 45A3781920B324E5005FBDBB /* watermark.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = watermark.hpp; sourceTree = ""; }; + 45A3781A20B324E6005FBDBB /* watermark.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = watermark.cpp; sourceTree = ""; }; + 45A3781B20B324E6005FBDBB /* debug_label.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = debug_label.cpp; sourceTree = ""; }; + 45A3781C20B324E6005FBDBB /* debug_label.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = debug_label.hpp; sourceTree = ""; }; 45B4B8C71CF5C16B00A54761 /* screen_animations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = screen_animations.cpp; sourceTree = ""; }; 45B4B8C81CF5C16B00A54761 /* screen_animations.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = screen_animations.hpp; sourceTree = ""; }; 45B4B8C91CF5C16B00A54761 /* screen_operations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = screen_operations.cpp; sourceTree = ""; }; @@ -768,6 +776,8 @@ 670948241BDF9C48005014C0 /* compass.hpp */, 670948251BDF9C48005014C0 /* copyright_label.cpp */, 670948261BDF9C48005014C0 /* copyright_label.hpp */, + 45A3781B20B324E6005FBDBB /* debug_label.cpp */, + 45A3781C20B324E6005FBDBB /* debug_label.hpp */, 6709482B1BDF9C48005014C0 /* drape_gui.cpp */, 6709482C1BDF9C48005014C0 /* drape_gui.hpp */, 6709482D1BDF9C48005014C0 /* gui_text.cpp */, @@ -782,6 +792,8 @@ 670948361BDF9C48005014C0 /* shape.hpp */, 670948371BDF9C48005014C0 /* skin.cpp */, 670948381BDF9C48005014C0 /* skin.hpp */, + 45A3781A20B324E6005FBDBB /* watermark.cpp */, + 45A3781920B324E5005FBDBB /* watermark.hpp */, ); path = gui; sourceTree = ""; @@ -798,6 +810,7 @@ BB7D67D21F34A62C002FD122 /* custom_features_context.hpp in Headers */, EB2B78001EEDD418002697B6 /* metaline_manager.hpp in Headers */, 45580ABB1E28DB2600CD535D /* scenario_manager.hpp in Headers */, + 45A3782020B324E6005FBDBB /* debug_label.hpp in Headers */, 670948031BDF9BF5005014C0 /* drape_engine.hpp in Headers */, 670948191BDF9C39005014C0 /* interpolations.hpp in Headers */, 456B3F9A1ED464FE009B3D1F /* postprocess_renderer.hpp in Headers */, @@ -872,6 +885,7 @@ 670947B01BDF9BE1005014C0 /* read_manager.hpp in Headers */, 670947CF1BDF9BE1005014C0 /* tile_key.hpp in Headers */, 670947BA1BDF9BE1005014C0 /* route_renderer.hpp in Headers */, + 45A3781D20B324E6005FBDBB /* watermark.hpp in Headers */, 453EEA6E1E3A28F400505E09 /* colored_symbol_shape.hpp in Headers */, 670948201BDF9C39005014C0 /* value_mapping.hpp in Headers */, 670948441BDF9C48005014C0 /* drape_gui.hpp in Headers */, @@ -1018,6 +1032,7 @@ 670947961BDF9BE1005014C0 /* line_shape.cpp in Sources */, 670947A91BDF9BE1005014C0 /* path_symbol_shape.cpp in Sources */, 670947FA1BDF9BF5005014C0 /* backend_renderer.cpp in Sources */, + 45A3781E20B324E6005FBDBB /* watermark.cpp in Sources */, 45BB025D1EB8BE5200FE5C0C /* shader_def.cpp in Sources */, 670948451BDF9C48005014C0 /* gui_text.cpp in Sources */, EB2B78031EEDD439002697B6 /* read_metaline_task.cpp in Sources */, @@ -1048,6 +1063,7 @@ 456B3F991ED464FE009B3D1F /* postprocess_renderer.cpp in Sources */, 670947CA1BDF9BE1005014C0 /* threads_commutator.cpp in Sources */, 670947981BDF9BE1005014C0 /* map_data_provider.cpp in Sources */, + 45A3781F20B324E6005FBDBB /* debug_label.cpp in Sources */, 670948181BDF9C39005014C0 /* interpolations.cpp in Sources */, 670948021BDF9BF5005014C0 /* drape_engine.cpp in Sources */, 56D545661C74A44900E3719C /* overlay_batcher.cpp in Sources */,