diff options
author | vng <viktor.govako@gmail.com> | 2015-05-15 13:09:27 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:48:08 +0300 |
commit | 1f50787b057ea3fef8c5f0b3a3945286ce07ea6a (patch) | |
tree | e570520307996acf9acb9742435b1d17f567010c /qt/draw_widget.cpp | |
parent | eefa43a2b1e4d0bc73ca81922b8614ec05dff6c4 (diff) |
Render policies refactoring to support GPU and Software rendering.
Diffstat (limited to 'qt/draw_widget.cpp')
-rw-r--r-- | qt/draw_widget.cpp | 78 |
1 files changed, 56 insertions, 22 deletions
diff --git a/qt/draw_widget.cpp b/qt/draw_widget.cpp index a0d4e27c46..6f43945ca3 100644 --- a/qt/draw_widget.cpp +++ b/qt/draw_widget.cpp @@ -3,6 +3,7 @@ #include "map/render_policy.hpp" #include "map/country_status_display.hpp" +#include "map/frame_image.hpp" #include "search/result.hpp" @@ -464,33 +465,66 @@ namespace qt } else if (e->button() == Qt::RightButton) { - // show feature types - QMenu menu; - - // Get POI under cursor or nearest address by point. - m2::PointD dummy; - search::AddressInfo info; - feature::FeatureMetadata metadata; - if (m_framework->GetVisiblePOI(pt, dummy, info, metadata)) - add_string(menu, "POI"); + if (e->modifiers() & Qt::ShiftModifier) + { + if (!m_framework->IsSingleFrameRendererInited()) + m_framework->InitSingleFrameRenderer(graphics::EDensityXHDPI); + // Watch emulation on desktop + m2::PointD pt = GetDevicePoint(e); + Framework::SingleFrameSymbols symbols; + symbols.m_searchResult = m_framework->PtoG(pt) + m2::PointD(0.05, 0.03); + symbols.m_showSearchResult = true; + symbols.m_bottomZoom = 11; + + { + FrameImage img; + m_framework->DrawSingleFrame(m_framework->PtoG(pt), 0, 320, 320, img, symbols); + FileWriter writer(GetPlatform().WritablePathForFile("cpu-rendered-image.png")); + writer.Write(img.m_data.data(), img.m_data.size()); + } + { + FrameImage img; + m_framework->DrawSingleFrame(m_framework->PtoG(pt), -2, 320, 320, img, symbols); + FileWriter writer(GetPlatform().WritablePathForFile("cpu-rendered-image-1.png")); + writer.Write(img.m_data.data(), img.m_data.size()); + } + { + FrameImage img; + m_framework->DrawSingleFrame(m_framework->PtoG(pt), 2, 320, 320, img, symbols); + FileWriter writer(GetPlatform().WritablePathForFile("cpu-rendered-image+1.png")); + writer.Write(img.m_data.data(), img.m_data.size()); + } + } else - m_framework->GetAddressInfoForPixelPoint(pt, info); + { + // show feature types + QMenu menu; + + // Get POI under cursor or nearest address by point. + m2::PointD dummy; + search::AddressInfo info; + feature::FeatureMetadata metadata; + if (m_framework->GetVisiblePOI(pt, dummy, info, metadata)) + add_string(menu, "POI"); + else + m_framework->GetAddressInfoForPixelPoint(pt, info); - // Get feature types under cursor. - vector<string> types; - m_framework->GetFeatureTypes(pt, types); - for (size_t i = 0; i < types.size(); ++i) - add_string(menu, types[i]); + // Get feature types under cursor. + vector<string> types; + m_framework->GetFeatureTypes(pt, types); + for (size_t i = 0; i < types.size(); ++i) + add_string(menu, types[i]); - (void)menu.addSeparator(); + (void)menu.addSeparator(); - // Format address and types. - if (!info.m_name.empty()) - add_string(menu, info.m_name); - add_string(menu, info.FormatAddress()); - add_string(menu, info.FormatTypes()); + // Format address and types. + if (!info.m_name.empty()) + add_string(menu, info.m_name); + add_string(menu, info.FormatAddress()); + add_string(menu, info.FormatTypes()); - menu.exec(e->pos()); + menu.exec(e->pos()); + } } } |