From kde-commits Wed Feb 29 23:35:23 2012 From: =?utf-8?q?J=C3=A9r=C3=B4me_SONRIER?= Date: Wed, 29 Feb 2012 23:35:23 +0000 To: kde-commits Subject: [kstars] kstars: With QPainter, draw a line only if the two points are visible (to prevent random Message-Id: <20120229233523.7E728A60A9 () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=133055859409532 Git commit 1e4ba1c87357ccfbd3bf7abe2ed9ed8f7e94a2e7 by J=C3=A9r=C3=B4me SON= RIER. Committed on 01/03/2012 at 00:35. Pushed by jsonrier into branch 'master'. With QPainter, draw a line only if the two points are visible (to prevent r= andom lines with gnomonic projection). CCBUG: 294881 CCMAIL: kstars-devel@kde.org M +10 -8 kstars/skyqpainter.cpp http://commits.kde.org/kstars/1e4ba1c87357ccfbd3bf7abe2ed9ed8f7e94a2e7 diff --git a/kstars/skyqpainter.cpp b/kstars/skyqpainter.cpp index 2bd2c2f..43f06e8 100644 --- a/kstars/skyqpainter.cpp +++ b/kstars/skyqpainter.cpp @@ -226,26 +226,28 @@ void SkyQPainter::drawSkyPolyline(LineList* list, Ski= pList* skipList, LineListLa { SkyList *points =3D list->points(); bool isVisible, isVisibleLast; - QPointF oLast =3D m_proj->toScreen( points->first(), true, &isVisibl= eLast ); // & with the result of checkVisibility to clip away things below hori= zon isVisibleLast &=3D m_proj->checkVisibility( points->first() ); - + QPointF oLast =3D m_proj->toScreen( points->first(), true, &isVisibl= eLast ); + = QPointF oThis, oThis2; for ( int j =3D 1 ; j < points->size() ; j++ ) { SkyPoint* pThis =3D points->at( j ); - oThis2 =3D oThis =3D m_proj->toScreen( pThis, true, &isVisible ); // & with the result of checkVisibility to clip away things below = horizon isVisible &=3D m_proj->checkVisibility(pThis); + oThis2 =3D oThis =3D m_proj->toScreen( pThis, true, &isVisible ); + = bool doSkip =3D false; if( skipList ) { doSkip =3D skipList->skip(j); } - //FIXME: check whether this works. (it doesn't) + = if ( !doSkip ) { - if ( isVisible && isVisibleLast && label ) - label->updateLabelCandidates(oThis.x(), oThis.y(), list, j= ); - if ( isVisible || isVisibleLast ) - drawLine( oLast, oThis); + if ( isVisible && isVisibleLast ) { + drawLine( oLast, oThis ); + if ( label ) + label->updateLabelCandidates( oThis.x(), oThis.y(), li= st, j ); + } } = oLast =3D oThis2;