From d15432548fa3a8b25d8bbce6a6b7212db10a080e Mon Sep 17 00:00:00 2001 From: "r.kuznetsov" Date: Wed, 16 Dec 2015 13:10:26 +0300 Subject: [PATCH] Fixed artefacts on fetching from symbols texture --- drape/font_texture.cpp | 14 ++++++++++---- drape_frontend/visual_params.cpp | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drape/font_texture.cpp b/drape/font_texture.cpp index d17f5e0646..3855f7f4dc 100644 --- a/drape/font_texture.cpp +++ b/drape/font_texture.cpp @@ -69,10 +69,16 @@ m2::RectF GlyphPacker::MapTextureCoords(const m2::RectU & pixelRect) const { float fWidth = static_cast(m_size.x); float fHeight = static_cast(m_size.y); - return m2::RectF(pixelRect.minX() / fWidth, - pixelRect.minY() / fHeight, - pixelRect.maxX() / fWidth, - pixelRect.maxY() / fHeight); + + // Half-pixel offset to eliminate arfefacts on fetching from texture. + float offset = 0.0; + if (pixelRect.SizeX() != 0 && pixelRect.SizeY() != 0) + offset = 0.5; + + return m2::RectF((pixelRect.minX() + offset) / fWidth, + (pixelRect.minY() + offset) / fHeight, + (pixelRect.maxX() - offset) / fWidth, + (pixelRect.maxY() - offset) / fHeight); } bool GlyphPacker::IsFull() const { return m_isFull; } diff --git a/drape_frontend/visual_params.cpp b/drape_frontend/visual_params.cpp index 7d31b28134..2ff8f0425b 100644 --- a/drape_frontend/visual_params.cpp +++ b/drape_frontend/visual_params.cpp @@ -44,7 +44,7 @@ void VisualParams::Init(double vs, uint32_t tileSize, vector const & a if (vs <= 1.0) g_VizParams.m_glyphVisualParams = { 0.48f, 0.08f, 0.2f, 0.01f, 0.49f, 0.04f }; else - g_VizParams.m_glyphVisualParams = { 0.5f, 0.05f, 0.2f, 0.01f, 0.49f, 0.04f }; + g_VizParams.m_glyphVisualParams = { 0.5f, 0.06f, 0.2f, 0.01f, 0.49f, 0.04f }; RISE_INITED; }