forked from organicmaps/organicmaps
fixed plenty of casting warnings.
This commit is contained in:
parent
1a138df489
commit
544b62728e
18 changed files with 62 additions and 59 deletions
|
@ -133,7 +133,7 @@ void DrawerYG::drawSymbol(m2::PointD const & pt, rule_ptr_t pRule, yg::EPosition
|
|||
// Use BaseRule::m_id to cache for point draw rule.
|
||||
// This rules doesn't mix with other rule-types.
|
||||
|
||||
uint32_t id = pRule->GetID(m_threadID);
|
||||
// uint32_t id = pRule->GetID(m_threadID);
|
||||
|
||||
string name;
|
||||
pRule->GetSymbol(name);
|
||||
|
@ -285,7 +285,7 @@ bool DrawerYG::drawPathText(di::PathInfo const & info, string const & name, uint
|
|||
|
||||
void DrawerYG::drawPathNumber(di::PathInfo const & path, di::DrawInfo const * pInfo)
|
||||
{
|
||||
int const textHeight = 12 * m_visualScale;
|
||||
int const textHeight = static_cast<int>(12 * m_visualScale);
|
||||
m2::PointD pt;
|
||||
double const length = path.GetFullLength();
|
||||
if (length >= (pInfo->m_road.size() + 2)*textHeight)
|
||||
|
@ -313,7 +313,7 @@ shared_ptr<yg::gl::Screen> DrawerYG::screen() const
|
|||
return m_pScreen;
|
||||
}
|
||||
|
||||
int DrawerYG::VisualScale() const
|
||||
double DrawerYG::VisualScale() const
|
||||
{
|
||||
return m_visualScale;
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ public:
|
|||
|
||||
shared_ptr<yg::gl::Screen> screen() const;
|
||||
|
||||
int VisualScale() const;
|
||||
double VisualScale() const;
|
||||
void SetScale(int level);
|
||||
|
||||
void Draw(di::DrawInfo const * pInfo, di::DrawRule const * rules, size_t count);
|
||||
|
|
|
@ -104,7 +104,7 @@ void InformationDisplay::drawRuler(DrawerYG * pDrawer)
|
|||
|
||||
/// finding the closest higher metric value
|
||||
unsigned curFirstDigit = 2;
|
||||
unsigned curVal = m_metresMinWidth;
|
||||
unsigned curVal = static_cast<unsigned>(m_metresMinWidth);
|
||||
unsigned maxVal = 1000000;
|
||||
bool lessThanMin = false;
|
||||
bool isInfinity = false;
|
||||
|
@ -193,8 +193,8 @@ void InformationDisplay::setVisualScale(double visualScale)
|
|||
{
|
||||
m_visualScale = visualScale;
|
||||
|
||||
m_fontDesc.m_size = 12 * visualScale;
|
||||
m_emptyMessageFont.m_size = 14 * visualScale;
|
||||
m_fontDesc.m_size = static_cast<uint32_t>(12 * visualScale);
|
||||
m_emptyMessageFont.m_size = static_cast<uint32_t>(14 * visualScale);
|
||||
}
|
||||
|
||||
void InformationDisplay::enableCenter(bool doEnable)
|
||||
|
|
|
@ -40,32 +40,32 @@ m2::RectI const RenderPolicy::OnSize(int w, int h)
|
|||
return m2::RectI(0, 0, w, h);
|
||||
}
|
||||
|
||||
void RenderPolicy::StartDrag(m2::PointD const & pt, double timeInSec)
|
||||
void RenderPolicy::StartDrag(m2::PointD const &, double)
|
||||
{
|
||||
m_windowHandle->invalidate();
|
||||
}
|
||||
|
||||
void RenderPolicy::DoDrag(m2::PointD const & pt, double timeInSec)
|
||||
void RenderPolicy::DoDrag(m2::PointD const &, double)
|
||||
{
|
||||
m_windowHandle->invalidate();
|
||||
}
|
||||
|
||||
void RenderPolicy::StopDrag(m2::PointD const & pt, double timeInSec)
|
||||
void RenderPolicy::StopDrag(m2::PointD const &, double)
|
||||
{
|
||||
m_windowHandle->invalidate();
|
||||
}
|
||||
|
||||
void RenderPolicy::StartScale(m2::PointD const & pt1, m2::PointD const & pt2, double timeInSec)
|
||||
void RenderPolicy::StartScale(m2::PointD const &, m2::PointD const &, double)
|
||||
{
|
||||
m_windowHandle->invalidate();
|
||||
}
|
||||
|
||||
void RenderPolicy::DoScale(m2::PointD const & pt1, m2::PointD const & pt2, double timeInSec)
|
||||
void RenderPolicy::DoScale(m2::PointD const &, m2::PointD const &, double)
|
||||
{
|
||||
m_windowHandle->invalidate();
|
||||
}
|
||||
|
||||
void RenderPolicy::StopScale(m2::PointD const & pt1, m2::PointD const & pt2, double timeInSec)
|
||||
void RenderPolicy::StopScale(m2::PointD const &, m2::PointD const &, double)
|
||||
{
|
||||
m_windowHandle->invalidate();
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ void RenderQueueRoutine::getUpdateAreas(
|
|||
return;
|
||||
if (!o.IsIntersect(n))
|
||||
{
|
||||
areas.push_back(m2::RectI(n));
|
||||
areas.push_back(newRect);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -164,14 +164,14 @@ void RenderQueueRoutine::getUpdateAreas(
|
|||
if (o.maxY() < n.maxY())
|
||||
bottomBarMinY = floor(o.maxY());
|
||||
|
||||
if (leftBarMinX != leftBarMaxX)
|
||||
areas.push_back(m2::RectI(leftBarMinX, topBarMinY, leftBarMaxX, bottomBarMinY));
|
||||
if (topBarMinY != topBarMaxY)
|
||||
areas.push_back(m2::RectI(leftBarMaxX, topBarMinY, rightBarMaxX, topBarMaxY));
|
||||
if (rightBarMinX != rightBarMaxX)
|
||||
areas.push_back(m2::RectI(rightBarMinX, topBarMaxY, rightBarMaxX, bottomBarMaxY));
|
||||
if (bottomBarMinY != bottomBarMaxY)
|
||||
areas.push_back(m2::RectI(leftBarMinX, bottomBarMinY, rightBarMinX, bottomBarMaxY));
|
||||
if ((int)leftBarMinX != (int)leftBarMaxX)
|
||||
areas.push_back(m2::RectI((int)leftBarMinX, (int)topBarMinY, (int)leftBarMaxX, (int)bottomBarMinY));
|
||||
if ((int)topBarMinY != (int)topBarMaxY)
|
||||
areas.push_back(m2::RectI((int)leftBarMaxX, (int)topBarMinY, (int)rightBarMaxX, (int)topBarMaxY));
|
||||
if ((int)rightBarMinX != (int)rightBarMaxX)
|
||||
areas.push_back(m2::RectI((int)rightBarMinX, (int)topBarMaxY, (int)rightBarMaxX, (int)bottomBarMaxY));
|
||||
if ((int)bottomBarMinY != (int)bottomBarMaxY)
|
||||
areas.push_back(m2::RectI((int)leftBarMinX, (int)bottomBarMinY, (int)rightBarMinX, (int)bottomBarMaxY));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -386,8 +386,8 @@ void RenderQueueRoutine::Do()
|
|||
|
||||
ScreenBase const & frameScreen = m_currentRenderCommand->m_frameScreen;
|
||||
m2::RectD glbRect;
|
||||
frameScreen.PtoG(m2::RectD(textureRect.Center() - m2::PointD(m_scaleEtalonSize / 2, m_scaleEtalonSize / 2),
|
||||
textureRect.Center() + m2::PointD(m_scaleEtalonSize / 2, m_scaleEtalonSize / 2)),
|
||||
frameScreen.PtoG(m2::RectD(m2::RectD(textureRect).Center() - m2::PointD(m_scaleEtalonSize / 2, m_scaleEtalonSize / 2),
|
||||
m2::RectD(textureRect).Center() + m2::PointD(m_scaleEtalonSize / 2, m_scaleEtalonSize / 2)),
|
||||
glbRect);
|
||||
// frameScreen.PtoG(m2::RectD(surfaceRect), glbRect);
|
||||
int scaleLevel = scales::GetScaleLevel(glbRect);
|
||||
|
|
|
@ -101,7 +101,7 @@ bool LessRectInfo::operator()(Tile const * l, Tile const * r) const
|
|||
return l->m_rectInfo.toUInt64Cell() < r->m_rectInfo.toUInt64Cell();
|
||||
}
|
||||
|
||||
void ScreenCoverage::SetScreen(ScreenBase const & screen, bool mergePathNames)
|
||||
void ScreenCoverage::SetScreen(ScreenBase const & screen, bool /*mergePathNames*/)
|
||||
{
|
||||
m_screen = screen;
|
||||
|
||||
|
@ -123,7 +123,7 @@ void ScreenCoverage::SetScreen(ScreenBase const & screen, bool mergePathNames)
|
|||
if (drawScale == -1)
|
||||
drawScale = allRects[i].m_drawScale;
|
||||
else
|
||||
ASSERT(drawScale == allRects[i].m_drawScale, (drawScale, allRects[i].m_drawScale));
|
||||
CHECK(drawScale == allRects[i].m_drawScale, (drawScale, allRects[i].m_drawScale));
|
||||
|
||||
for (unsigned i = 0; i < allRects.size(); ++i)
|
||||
{
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
TileRenderer::TileRenderer(
|
||||
string const & skinName,
|
||||
unsigned scaleEtalonSize,
|
||||
unsigned maxTilesCount,
|
||||
unsigned executorsCount,
|
||||
yg::Color const & bgColor,
|
||||
|
@ -76,7 +75,7 @@ TileRenderer::~TileRenderer()
|
|||
m_queue.Cancel();
|
||||
}
|
||||
|
||||
void TileRenderer::CancelThread(core::CommandsQueue::Environment const & env)
|
||||
void TileRenderer::CancelThread(core::CommandsQueue::Environment const & /*env*/)
|
||||
{
|
||||
m_resourceManager->renderTargets().Cancel();
|
||||
}
|
||||
|
|
|
@ -60,7 +60,6 @@ public:
|
|||
|
||||
/// constructor.
|
||||
TileRenderer(string const & skinName,
|
||||
unsigned scaleEtalonSize,
|
||||
unsigned maxTilesCount,
|
||||
unsigned tasksCount,
|
||||
yg::Color const & bgColor,
|
||||
|
|
|
@ -81,7 +81,7 @@ void Tiler::seed(ScreenBase const & screen, m2::PointD const & centerPt)
|
|||
m2::RectD const screenRect = m_screen.GlobalRect();
|
||||
|
||||
/// slightly smaller than original to produce "antialiasing" effect using bilinear filtration.
|
||||
size_t tileSize = m_tileSize / 1.05;
|
||||
size_t tileSize = static_cast<size_t>(m_tileSize / 1.05);
|
||||
|
||||
screen.PtoG(m2::RectD(pxCenter - m2::PointD(tileSize / 2, tileSize / 2),
|
||||
pxCenter + m2::PointD(tileSize / 2, tileSize / 2)),
|
||||
|
@ -89,15 +89,15 @@ void Tiler::seed(ScreenBase const & screen, m2::PointD const & centerPt)
|
|||
|
||||
double glbRectSize = min(glbRect.SizeX(), glbRect.SizeY());
|
||||
|
||||
m_tileScale = ceil(log((MercatorBounds::maxX - MercatorBounds::minX) / glbRectSize) / log(2.0));
|
||||
m_tileScale = static_cast<int>(ceil(log((MercatorBounds::maxX - MercatorBounds::minX) / glbRectSize) / log(2.0)));
|
||||
|
||||
double rectSizeX = (MercatorBounds::maxX - MercatorBounds::minX) / (1 << m_tileScale);
|
||||
double rectSizeY = (MercatorBounds::maxY - MercatorBounds::minY) / (1 << m_tileScale);
|
||||
|
||||
int minTileX = floor(screenRect.minX() / rectSizeX);
|
||||
int maxTileX = ceil(screenRect.maxX() / rectSizeX);
|
||||
int minTileY = floor(screenRect.minY() / rectSizeY);
|
||||
int maxTileY = ceil(screenRect.maxY() / rectSizeY);
|
||||
int minTileX = static_cast<int>(floor(screenRect.minX() / rectSizeX));
|
||||
int maxTileX = static_cast<int>(ceil(screenRect.maxX() / rectSizeX));
|
||||
int minTileY = static_cast<int>(floor(screenRect.minY() / rectSizeY));
|
||||
int maxTileY = static_cast<int>(ceil(screenRect.maxY() / rectSizeY));
|
||||
|
||||
/// clearing previous coverage
|
||||
m_coverage.clear();
|
||||
|
|
|
@ -17,7 +17,6 @@ TilingRenderPolicyMT::TilingRenderPolicyMT(shared_ptr<WindowHandle> const & wind
|
|||
RenderPolicy::TRenderFn const & renderFn)
|
||||
: RenderPolicy(windowHandle, renderFn),
|
||||
m_tileRenderer(GetPlatform().SkinName(),
|
||||
GetPlatform().ScaleEtalonSize(),
|
||||
GetPlatform().MaxTilesCount(),
|
||||
1, //GetPlatform().CpuCores(),
|
||||
bgColor(),
|
||||
|
|
|
@ -290,7 +290,7 @@ namespace yg
|
|||
double len = 0;
|
||||
for (unsigned i = 0; i < s.size(); ++i)
|
||||
{
|
||||
GlyphKey k(s[i], fontSize, false, yg::Color(0, 0, 0, 255));
|
||||
GlyphKey k(s[i], static_cast<uint32_t>(fontSize), false, yg::Color(0, 0, 0, 255));
|
||||
len += getGlyphMetrics(k).m_xAdvance;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace yg
|
|||
}
|
||||
|
||||
/// Geometry width. It's 1px wider than the pattern width.
|
||||
int geomWidth = lineStyle->m_penInfo.m_w + 4 - 2 * aaShift();
|
||||
int geomWidth = static_cast<uint32_t>(lineStyle->m_penInfo.m_w) + 4 - 2 * aaShift();
|
||||
float geomHalfWidth = geomWidth / 2.0;
|
||||
|
||||
/// Starting point of the tiles on this segment
|
||||
|
|
|
@ -108,12 +108,12 @@ namespace yg
|
|||
m2::PointU const PenInfo::patternSize() const
|
||||
{
|
||||
if (m_isSolid)
|
||||
return m2::PointU(ceil(m_w / 2) * 2 + 4,
|
||||
ceil(m_w / 2) * 2 + 4);
|
||||
return m2::PointU(static_cast<uint32_t>(ceil(m_w / 2)) * 2 + 4,
|
||||
static_cast<uint32_t>(ceil(m_w / 2)) * 2 + 4);
|
||||
else
|
||||
{
|
||||
uint32_t len = static_cast<uint32_t>(accumulate(m_pat.begin(), m_pat.end(), 0.0));
|
||||
return m2::PointU(len + 4, m_w + 4);
|
||||
return m2::PointU(len + 4, static_cast<uint32_t>(m_w) + 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,8 +57,8 @@ namespace yg
|
|||
//unsigned oldTextureWidth = m_textureWidth;
|
||||
//unsigned oldTextureHeight = m_textureHeight;
|
||||
|
||||
m_textureWidth = pow(2, ceil(log(double(w)) / log2));
|
||||
m_textureHeight = pow(2, ceil(log(double(h)) / log2));
|
||||
m_textureWidth = static_cast<uint32_t>(pow(2, ceil(log(double(w)) / log2)));
|
||||
m_textureHeight = static_cast<uint32_t>(pow(2, ceil(log(double(h)) / log2)));
|
||||
|
||||
//bool hasChangedTextureSize;
|
||||
//if ((oldTextureWidth != m_textureWidth) || (oldTextureHeight != m_textureHeight))
|
||||
|
|
|
@ -37,8 +37,10 @@ namespace yg
|
|||
else
|
||||
{
|
||||
double firstDashOffset = penInfo.firstDashOffset();
|
||||
m_centerColorPixel = m2::PointU(firstDashOffset + texRect.minX() + 3, texRect.minY() + texRect.SizeY() / 2.0);
|
||||
m_borderColorPixel = m2::PointU(firstDashOffset + texRect.minX() + 3, texRect.minY() + 1);
|
||||
m_centerColorPixel = m2::PointU(static_cast<uint32_t>(firstDashOffset + texRect.minX() + 3),
|
||||
static_cast<uint32_t>(texRect.minY() + texRect.SizeY() / 2.0));
|
||||
m_borderColorPixel = m2::PointU(static_cast<uint32_t>(firstDashOffset + texRect.minX() + 3),
|
||||
static_cast<uint32_t>(texRect.minY() + 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace yg
|
|||
void ShapeRenderer::approximateArc(m2::PointD const & center, double startA, double endA, double r, vector<m2::PointD> & pts)
|
||||
{
|
||||
double sectorA = math::pi / 30.0;
|
||||
size_t const sectorsCount = floor(fabs(endA - startA) / sectorA);
|
||||
size_t const sectorsCount = static_cast<size_t>(floor(fabs(endA - startA) / sectorA));
|
||||
sectorA = (endA - startA) / sectorsCount;
|
||||
|
||||
for (size_t i = 0; i <= sectorsCount; ++i)
|
||||
|
@ -88,7 +88,7 @@ namespace yg
|
|||
for (int i = 0; i < 4; ++i)
|
||||
rectPtsF[i] = m2::PointF(rectPts[i].x, rectPts[i].y);
|
||||
|
||||
m2::PointF texPt = skin()->pages()[style->m_pageID]->texture()->mapPixel(style->m_texRect.Center());
|
||||
m2::PointF texPt = skin()->pages()[style->m_pageID]->texture()->mapPixel(m2::RectF(style->m_texRect).Center());
|
||||
|
||||
addTexturedStripStrided(
|
||||
rectPtsF,
|
||||
|
@ -117,7 +117,7 @@ namespace yg
|
|||
m2::PointD(r.maxX(), r.maxY())
|
||||
};
|
||||
|
||||
m2::PointF texPt = skin()->pages()[style->m_pageID]->texture()->mapPixel(style->m_texRect.Center());
|
||||
m2::PointF texPt = skin()->pages()[style->m_pageID]->texture()->mapPixel(m2::RectF(style->m_texRect).Center());
|
||||
|
||||
addTexturedStripStrided(
|
||||
rectPts,
|
||||
|
|
|
@ -378,11 +378,13 @@ namespace yg
|
|||
penInfo.m_color.b,
|
||||
penInfo.m_color.a));
|
||||
|
||||
uint32_t ri = static_cast<uint32_t>(r);
|
||||
|
||||
/// pixels that are used to texture inner part of the line should be fully opaque
|
||||
v(2 + r - 1, 2) = penColor;
|
||||
v(2 + r , 2) = penColor;
|
||||
v(2 + r - 1, 2 + r * 2 - 1) = penColor;
|
||||
v(2 + r , 2 + r * 2 - 1) = penColor;
|
||||
v(2 + ri - 1, 2) = penColor;
|
||||
v(2 + ri , 2) = penColor;
|
||||
v(2 + ri - 1, 2 + ri * 2 - 1) = penColor;
|
||||
v(2 + ri , 2 + ri * 2 - 1) = penColor;
|
||||
|
||||
/// in non-transparent areas - premultiply color value with alpha and make it opaque
|
||||
for (size_t x = 2; x < v.width() - 2; ++x)
|
||||
|
@ -435,8 +437,10 @@ namespace yg
|
|||
|
||||
/// In general case this code is incorrect.
|
||||
/// TODO : Make a pattern start and end with a dash.
|
||||
v(curLen, y) = px;
|
||||
v(curLen + 1, y) = px;
|
||||
uint32_t curLenI = static_cast<uint32_t>(curLen);
|
||||
|
||||
v(curLenI, y) = px;
|
||||
v(curLenI + 1, y) = px;
|
||||
|
||||
for (size_t i = 0; i < penInfo.m_pat.size(); ++i)
|
||||
{
|
||||
|
@ -449,11 +453,11 @@ namespace yg
|
|||
else
|
||||
gil::get_color(px, gil::alpha_t()) = penInfoColor.a;
|
||||
|
||||
v(curLen + j + 2, y) = px;
|
||||
v(curLenI + j + 2, y) = px;
|
||||
}
|
||||
|
||||
v(curLen + 2 + penInfo.m_pat[i], y) = px;
|
||||
v(curLen + 2 + penInfo.m_pat[i] + 1, y) = px;
|
||||
v(static_cast<uint32_t>(curLen + 2 + penInfo.m_pat[i]), y) = px;
|
||||
v(static_cast<uint32_t>(curLen + 2 + penInfo.m_pat[i] + 1), y) = px;
|
||||
|
||||
curLen += penInfo.m_pat[i];
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace yg
|
|||
|
||||
m2::AARectD const SymbolElement::boundRect() const
|
||||
{
|
||||
m2::RectU texRect = m_symbolRect;
|
||||
m2::RectI texRect(m_symbolRect);
|
||||
texRect.Inflate(-1, -1);
|
||||
|
||||
m2::PointD posPt = tieRect(m2::RectD(texRect), math::Identity<double, 3>());
|
||||
|
@ -56,7 +56,7 @@ namespace yg
|
|||
if (m_style == 0)
|
||||
return;
|
||||
|
||||
m2::RectU texRect = m_symbolRect;
|
||||
m2::RectI texRect(m_symbolRect);
|
||||
texRect.Inflate(-1, -1);
|
||||
|
||||
m2::PointD posPt = tieRect(m2::RectD(texRect), m);
|
||||
|
|
Loading…
Add table
Reference in a new issue