#83 Hack for slow devices

open
NaviPOWM (72)
5
2010-03-29
2010-03-29
iiizio
No

Skip (one or more) redraw if last DrawTime was too high to avoid to add delay at every redraw.
The value 500 seems be fine with my htc kaiser, I don't know if it's ok with other devices but I think can be.

void CXMapPainter::DoWork() {
// skip redraw if last DrawTime was too high
if(CXDebugInfo::Instance()->GetDrawTime() > 500)
CXDebugInfo::Instance()->SetDrawTime(CXDebugInfo::Instance()->GetDrawTime() - 500);
else
OnDoWork();
}

Discussion

  • iiizio
    iiizio
    2010-08-18

    Another way to help on slow devices can be to draw e_Way_Unknown only if m_MeterPerPixel < 2 (or a configurable value) instead of 4.

    Index: trunk/NaviPOWM/src/common/CXMapPainter2D.cpp

    --- trunk/NaviPOWM/src/common/CXMapPainter2D.cpp (revision 485)
    +++ trunk/NaviPOWM/src/common/CXMapPainter2D.cpp (working copy)
    @@ -287,7 +287,7 @@

    //-------------------------------------
    void CXMapPainter2D::DrawWaysBg(IBitmap *pBMP, TWayBuffer *pWays, E_WAY_TYPE eWayType, int Width, int Height) {
    - if(pWays == NULL)
    + if(pWays == NULL || ((eWayType == e_Way_Unknown) && (m_MeterPerPixel >= 2)))
    return;
    // get pen for this type of way
    CXPen *pPen = m_PenHolder.GetScaledPenBg(eWayType);
    @@ -316,7 +316,7 @@

    //-------------------------------------
    void CXMapPainter2D::DrawWaysFg(IBitmap *pBMP, TWayBuffer *pWays, E_WAY_TYPE eWayType, int Width, int Height) {
    - if(pWays == NULL)
    + if(pWays == NULL || ((eWayType == e_Way_Unknown) && (m_MeterPerPixel >= 2)))
    return;
    // get pen for this type of way
    CXPen *pPen = m_PenHolder.GetScaledPenFg(eWayType);