[Kstars-devel] [kstars] kstars: Make sure the ground is the last thing drawn, so nothing will be drawn over it.

Jérôme SONRIER jsid at emor3j.fr.eu.org
Fri Mar 9 23:19:28 UTC 2012


Git commit ffd9cbacf9b10c2eba6a5fb5c9db07f124011f28 by Jérôme SONRIER.
Committed on 10/03/2012 at 00:05.
Pushed by jsonrier into branch 'master'.

Make sure the ground is the last thing drawn, so nothing will be drawn over it.
This fix bug 267731 (my last commit does not fix it).

CCBUG: 267731
CCMAIL: kstars-devel at kde.org

M  +1    -1    kstars/projections/projector.cpp
M  +7    -2    kstars/skycomponents/horizoncomponent.cpp
M  +2    -2    kstars/skycomponents/skymapcomposite.cpp

http://commits.kde.org/kstars/ffd9cbacf9b10c2eba6a5fb5c9db07f124011f28

diff --git a/kstars/projections/projector.cpp b/kstars/projections/projector.cpp
index 34d3747..e8c1aff 100644
--- a/kstars/projections/projector.cpp
+++ b/kstars/projections/projector.cpp
@@ -197,7 +197,7 @@ bool Projector::checkVisibility( SkyPoint *p ) const
         if( p->alt().Degrees() < -1.0 ) return false;
     }
     */ //Here we hope that the point has already been 'synchronized'
-    if( m_vp.fillGround /*&& m_vp.useAltAz*/ && p->alt().Degrees() < -0.5 ) return false;
+    if( m_vp.fillGround /*&& m_vp.useAltAz*/ && p->alt().Degrees() < -1.0 ) return false;
 
     if ( m_vp.useAltAz ) {
         /** To avoid calculating refraction, we just use the unrefracted
diff --git a/kstars/skycomponents/horizoncomponent.cpp b/kstars/skycomponents/horizoncomponent.cpp
index 027a126..485856c 100644
--- a/kstars/skycomponents/horizoncomponent.cpp
+++ b/kstars/skycomponents/horizoncomponent.cpp
@@ -79,8 +79,11 @@ void HorizonComponent::draw( SkyPainter *skyp )
 
     KStarsData *data = KStarsData::Instance();
     
-    SkyPoint labelPoint;
-    bool drawLabel;
+    // If we are in GL mode, we need to flush buffers now since we don't do it before 
+    // drawing ground, otherwise, objects remaining in buffers will be drawn after 
+    // the ground and will appears over it.
+    if ( Options::useGL() )
+        skyp->end();
 
     skyp->setPen( QPen( QColor( data->colorScheme()->colorNamed( "HorzColor" ) ), 2, Qt::SolidLine ) );
 
@@ -89,6 +92,8 @@ void HorizonComponent::draw( SkyPainter *skyp )
     else
         skyp->setBrush( Qt::NoBrush );
 
+    SkyPoint labelPoint;
+    bool drawLabel;
     skyp->drawHorizon( Options::showGround(), &labelPoint, &drawLabel );
 
     if( drawLabel ) {
diff --git a/kstars/skycomponents/skymapcomposite.cpp b/kstars/skycomponents/skymapcomposite.cpp
index 1b8beb6..8b83c08 100644
--- a/kstars/skycomponents/skymapcomposite.cpp
+++ b/kstars/skycomponents/skymapcomposite.cpp
@@ -249,8 +249,6 @@ void SkyMapComposite::draw( SkyPainter *skyp )
 
     m_Supernovae->draw(skyp);
 
-    m_Horizon->draw( skyp );
-
     map->drawObjectLabels( labelObjects() );
 
     m_skyLabeler->drawQueuedLabels();
@@ -268,6 +266,8 @@ void SkyMapComposite::draw( SkyPainter *skyp )
 
     m_StarHopRouteList->pen = QPen( QColor(data->colorScheme()->colorNamed( "StarHopRouteColor" )), 1. );
     m_StarHopRouteList->draw( skyp );
+    
+    m_Horizon->draw( skyp );
 
     m_skyMesh->inDraw( false );
 



More information about the Kstars-devel mailing list