[Kstars-devel] KDE/kdeedu/kstars/kstars

Jason Harris kstars at 30doradus.org
Tue Jul 15 08:13:06 CEST 2008


SVN commit 832684 by harris:

Fixing the bug that was causing runaway CPU usage when drawn lines moved 
off-screen at high zoom.  Akarsh submitted a patch which fixed the symptom, but 
had some side effects.  This patch reverts his change and corrects a very simple 
bug that was causing the problem.

We have a function SkyMap::onScreenLine( QPointF &p1, QPointF &p2 ) that returns 
the o-screen segment of a line, given endpoints p1 and p2.  The modified on-screen 
endpoints are returned through the same reference values.  In the case that no 
segment of the line connecting p1 and p2 passes through the SkyMap widget, null 
values of -10000000 are returned.

At some point, IIRC, James created an alternative onscreenLine2() function which 
does essentially the same thing, except it returns a bool instead of void, and the 
return value is used to indicate whether an onscreen line segment was found or 
not.  There are no null values in this version of the function.

However, in one of the places where onscreenLine2() should have returned false 
(indicating the line was totally off-screen with no onscreen segment), it actually 
returned true.  This was the cause of the runaway CPU usage.

James, can you confirm this patch, and then I will backport it to the 4.1 branch.

I don't remember why James created a second version of this function rather than 
modifying onscreenLine().  

CCMAIL: kstars-devel at kde.org



 M  +1 -8      skymap.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/skymap.cpp #832683:832684
@@ -1041,13 +1041,6 @@
     p.setX( 0.5*Width  - zoomscale*k*cosY*sindX );
     p.setY( 0.5*Height - zoomscale*k*( cosY0*sinY - sinY0*cosY*cosdX ) );
 
-    if ( onVisibleHemisphere != NULL ) {
-        if ( scaledRect().contains( p.toPoint() ) )  //FIXME -jbb
-            *onVisibleHemisphere = true;
-        else
-            *onVisibleHemisphere = false;
-    }
-    
     return p;
 }
 
@@ -1228,7 +1221,7 @@
     //If no intersection points were found, the line must be totally offscreen
     //return a null point
     if ( edgePoint2.isNull() ) {
-        return true;
+        return false;
     }
 
     //If one intersection point was found, then one of the original endpoints


More information about the Kstars-devel mailing list