[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kstars] kstars: With QPainter, draw a line only if the two points are visible (to prevent random
From:       Jérôme_SONRIER <jsid () emor3j ! fr ! eu ! org>
Date:       2012-02-29 23:35:23
Message-ID: 20120229233523.7E728A60A9 () git ! kde ! org
[Download RAW message or body]

Git commit 1e4ba1c87357ccfbd3bf7abe2ed9ed8f7e94a2e7 by Jérôme SONRIER.
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 random \
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, SkipList* \
skipList, LineListLa  {
     SkyList *points = list->points();
     bool isVisible, isVisibleLast;
-    QPointF   oLast = m_proj->toScreen( points->first(), true, &isVisibleLast );
     // & with the result of checkVisibility to clip away things below horizon
     isVisibleLast &= m_proj->checkVisibility( points->first() );
-
+    QPointF   oLast = m_proj->toScreen( points->first(), true, &isVisibleLast );
+    
     QPointF oThis, oThis2;
     for ( int j = 1 ; j < points->size() ; j++ ) {
         SkyPoint* pThis = points->at( j );
-        oThis2 = oThis = m_proj->toScreen( pThis, true, &isVisible );
         // & with the result of checkVisibility to clip away things below horizon
         isVisible &= m_proj->checkVisibility(pThis);
+        oThis2 = oThis = m_proj->toScreen( pThis, true, &isVisible );
+        
         bool doSkip = false;
         if( skipList ) {
             doSkip = 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(), list, j );
+            }
         }
 
         oLast = oThis2;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic