[yopme] fix scales for rendering

This commit is contained in:
ExMix 2013-09-13 19:28:19 +03:00 committed by Alex Zolotarev
parent dd3c6a2e16
commit 96f4629a38
2 changed files with 15 additions and 8 deletions

View file

@ -86,7 +86,17 @@ void YopmeRP::DrawFrame(shared_ptr<PaintEvent> const & e, ScreenBase const & s)
pScreen->clear(m_bgColor);
shared_ptr<PaintEvent> paintEvent(new PaintEvent(m_offscreenDrawer.get()));
m_renderFn(paintEvent, s, m2::RectD(renderRect), scales::GetScaleLevel(s.GlobalRect().GetGlobalRect()));
size_t const scaleEtalonSize = 256;
m2::RectD glbRect;
m2::PointD const pxCenter = s.PixelRect().Center();
s.PtoG(m2::RectD(pxCenter - m2::PointD(scaleEtalonSize / 2, scaleEtalonSize / 2),
pxCenter + m2::PointD(scaleEtalonSize / 2, scaleEtalonSize / 2)),
glbRect);
m_renderFn(paintEvent, s, m2::RectD(renderRect), scales::GetScaleLevel(glbRect));
pScreen->endFrame();
pScreen->resetOverlay();

View file

@ -36,7 +36,7 @@ void GLWidget::initializeGL()
rpParams.m_density = graphics::EDensityMDPI;
rpParams.m_skinName = "basic.skn";
rpParams.m_screenHeight = 640;
rpParams.m_screenWidth = 340;
rpParams.m_screenWidth = 360;
try
{
@ -47,6 +47,8 @@ void GLWidget::initializeGL()
{
LOG(LERROR, (e.what()));
}
resize(360, 640);
}
void GLWidget::resizeGL(int w, int h)
@ -58,12 +60,7 @@ void GLWidget::resizeGL(int w, int h)
void GLWidget::paintGL()
{
m_f.GetNavigator().SetFromRect(m2::AnyRectD(
m2::RectD(MercatorBounds::LonToX(26.90),
MercatorBounds::LatToY(53.42),
MercatorBounds::LonToX(27.80),
MercatorBounds::LatToY(54.64))));
m_f.ShowRect(53.54, 27.34, 11.0);
shared_ptr<PaintEvent> e(new PaintEvent(m_f.GetRenderPolicy()->GetDrawer().get()));
m_f.BeginPaint(e);