forked from organicmaps/organicmaps
decreasing the size of drawPathText font size, to reduce the "text garbage" effect.
This commit is contained in:
parent
03235bbc47
commit
9842cb7f1c
7 changed files with 84 additions and 21 deletions
|
@ -1,9 +1,9 @@
|
|||
#include "drawer_yg.hpp"
|
||||
|
||||
|
||||
#include "../indexer/drawing_rules.hpp"
|
||||
#include "../indexer/scales.hpp"
|
||||
|
||||
#include "../yg/defines.hpp"
|
||||
#include "../yg/screen.hpp"
|
||||
#include "../yg/skin.hpp"
|
||||
#include "../yg/resource_manager.hpp"
|
||||
|
@ -148,16 +148,15 @@ uint8_t DrawerYG::get_font_size(rule_ptr_t pRule)
|
|||
|
||||
void DrawerYG::drawText(m2::PointD const & pt, string const & name, rule_ptr_t pRule, int /*depth*/)
|
||||
{
|
||||
uint8_t fontSize = get_font_size(pRule);
|
||||
if (fontSize > 3 * m_visualScale)
|
||||
m_pScreen->drawText(pt, 0.0, fontSize, name, 10000);
|
||||
uint8_t fontSize = max(get_font_size(pRule), (uint8_t)(yg::minTextSize * m_visualScale));
|
||||
m_pScreen->drawText(pt, 0.0, fontSize, name, yg::maxDepth);
|
||||
}
|
||||
|
||||
void DrawerYG::drawPathText(vector<m2::PointD> const & pts, double pathLength, string const & name, rule_ptr_t pRule, int /*depth*/)
|
||||
{
|
||||
uint8_t fontSize = get_font_size(pRule);
|
||||
if (fontSize > 3 * m_visualScale)
|
||||
m_pScreen->drawPathText(&pts[0], pts.size(), fontSize, name, pathLength, yg::gl::Screen::middle_line, true, 10000);
|
||||
uint8_t fontSize = get_font_size(pRule) - 2;
|
||||
if (fontSize >= yg::minTextSize * m_visualScale)
|
||||
m_pScreen->drawPathText(&pts[0], pts.size(), fontSize, name, pathLength, yg::gl::Screen::middle_line, true, yg::maxDepth);
|
||||
}
|
||||
|
||||
shared_ptr<yg::gl::Screen> DrawerYG::screen() const
|
||||
|
@ -251,9 +250,9 @@ void DrawerYG::drawStats(double duration, int scale, double lat, double lng)
|
|||
out << " FPS: inf";
|
||||
else
|
||||
out << " FPS: " << 1.0 / duration;
|
||||
m_pScreen->drawText(m2::PointD(10, 20), 0, 14, out.str().c_str(), 10000);
|
||||
m_pScreen->drawText(m2::PointD(10, 20), 0, 14, out.str().c_str(), yg::maxDepth);
|
||||
|
||||
out.str("");
|
||||
out << "(" << lat << ", " << lng << ") Scale: " << scale;
|
||||
m_pScreen->drawText(m2::PointD(10, 40), 0, 14, out.str().c_str(), 10000);*/
|
||||
m_pScreen->drawText(m2::PointD(10, 40), 0, 14, out.str().c_str(), yg::maxDepth);*/
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "../platform/platform.hpp"
|
||||
|
||||
#include "../yg/defines.hpp"
|
||||
#include "../yg/screen.hpp"
|
||||
#include "../yg/color.hpp"
|
||||
#include "../yg/render_state.hpp"
|
||||
|
@ -343,7 +344,7 @@ public:
|
|||
m2::PointD ptShift = m_renderQueue.renderState().coordSystemShift(false);
|
||||
/// Drawing position and heading
|
||||
m2::PointD pxPosition = m_navigator.Screen().GtoP(m_position);
|
||||
pDrawer->drawSymbol(pxPosition - ptShift, "current-position", 12000);
|
||||
pDrawer->drawSymbol(pxPosition - ptShift, "current-position", yg::maxDepth);
|
||||
|
||||
double pxConfidenceRadius = pxPosition.Length(m_navigator.Screen().GtoP(m_position + m2::PointD(m_confidenceRadius, 0)));
|
||||
|
||||
|
@ -374,14 +375,14 @@ public:
|
|||
&borderPts[0],
|
||||
borderPts.size(),
|
||||
pDrawer->screen()->skin()->mapPenInfo(yg::PenInfo(yg::Color(0, 0, 255, 64), 4, 0, 0, 0)),
|
||||
11999
|
||||
yg::maxDepth - 1
|
||||
);
|
||||
|
||||
pDrawer->screen()->drawTriangles(
|
||||
&areaPts[0],
|
||||
areaPts.size(),
|
||||
pDrawer->screen()->skin()->mapColor(yg::Color(0, 0, 255, 32)),
|
||||
11998);
|
||||
yg::maxDepth - 2);
|
||||
|
||||
/* if (m_isHeadingEnabled)
|
||||
{
|
||||
|
@ -397,7 +398,7 @@ public:
|
|||
pts,
|
||||
2,
|
||||
pDrawer->screen()->skin()->mapPenInfo(yg::PenInfo(yg::Color(255, 0, 0, 255), 4, 0, 0, 0)),
|
||||
12000
|
||||
yg::maxDepth
|
||||
);
|
||||
}
|
||||
*/
|
||||
|
|
7
yg/defines.hpp
Normal file
7
yg/defines.hpp
Normal file
|
@ -0,0 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
namespace yg
|
||||
{
|
||||
static const int maxDepth = 12000;
|
||||
static const int minTextSize = 10;
|
||||
}
|
55
yg/gpu_state.hpp
Normal file
55
yg/gpu_state.hpp
Normal file
|
@ -0,0 +1,55 @@
|
|||
#pragma once
|
||||
|
||||
#include <internal/opengl.hpp>
|
||||
|
||||
namespace yg
|
||||
{
|
||||
namespace gl
|
||||
{
|
||||
struct ArrayParams
|
||||
{
|
||||
/// vertexArray params
|
||||
bool m_enabled;
|
||||
GLint m_size;
|
||||
GLenum m_type;
|
||||
GLsizei m_stride;
|
||||
GLvoid * m_ptr;
|
||||
};
|
||||
|
||||
class GPUState
|
||||
{
|
||||
private:
|
||||
|
||||
int m_readFBO;
|
||||
int m_drawFBO;
|
||||
int m_fboColor0;
|
||||
int m_fboDepth;
|
||||
int m_fboStencil;
|
||||
|
||||
int m_tex0;
|
||||
int m_vb;
|
||||
int m_ib;
|
||||
|
||||
ArrayParams m_vertexAP;
|
||||
ArrayParams m_colorAP;
|
||||
ArrayParams m_texCoordAP;
|
||||
|
||||
bool m_depthTest;
|
||||
GLenum m_depthFunc;
|
||||
|
||||
bool m_alphaTest;
|
||||
GLenum m_alphaFunc;
|
||||
GLclampf m_ref;
|
||||
|
||||
bool m_alphaBlend;
|
||||
GLenum m_srcFactor;
|
||||
GLenum m_dstFactor;
|
||||
|
||||
yg::Color m_color;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
}
|
|
@ -53,7 +53,7 @@ namespace yg
|
|||
|
||||
if (m_isMultiSampled)
|
||||
OGLCHECK(glRenderbufferStorageMultisampleAPPLE(target,
|
||||
4,
|
||||
2,
|
||||
internalFormat,
|
||||
width,
|
||||
height));
|
||||
|
|
11
yg/utils.cpp
11
yg/utils.cpp
|
@ -1,5 +1,6 @@
|
|||
#include "../base/SRC_FIRST.hpp"
|
||||
|
||||
#include "defines.hpp"
|
||||
#include "utils.hpp"
|
||||
#include "memento.hpp"
|
||||
#include "vertexbuffer.hpp"
|
||||
|
@ -27,18 +28,16 @@ namespace yg
|
|||
OGLCHECK(glMatrixMode(GL_PROJECTION));
|
||||
OGLCHECK(glLoadIdentity());
|
||||
|
||||
int const bound = 12000;
|
||||
|
||||
#ifdef OMIM_GL_ES
|
||||
if (!doSwap)
|
||||
OGLCHECK(glOrthof(0, width, 0, height, -bound, bound));
|
||||
OGLCHECK(glOrthof(0, width, 0, height, -yg::maxDepth, yg::maxDepth));
|
||||
else
|
||||
OGLCHECK(glOrthof(0, width, height, 0, -bound, bound));
|
||||
OGLCHECK(glOrthof(0, width, height, 0, -yg::maxDepth, yg::maxDepth));
|
||||
#else
|
||||
if (!doSwap)
|
||||
OGLCHECK(glOrtho(0, width, 0, height, -bound, bound));
|
||||
OGLCHECK(glOrtho(0, width, 0, height, -yg::maxDepth, yg::maxDepth));
|
||||
else
|
||||
OGLCHECK(glOrtho(0, width, height, 0, -bound, bound));
|
||||
OGLCHECK(glOrtho(0, width, height, 0, -yg::maxDepth, yg::maxDepth));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,9 @@ HEADERS += \
|
|||
text_renderer.hpp \
|
||||
geometry_batcher.hpp \
|
||||
screen.hpp \
|
||||
layer_manager.hpp
|
||||
layer_manager.hpp \
|
||||
gpu_state.hpp \
|
||||
defines.hpp
|
||||
|
||||
!iphonesimulator-g++42 {
|
||||
!iphonedevice-g++42 {
|
||||
|
|
Loading…
Add table
Reference in a new issue