[Marble-commits] branches/KDE/4.5/kdeedu/marble/src/lib
Bastian Holst
bastianholst at gmx.de
Wed Jul 7 10:31:24 CEST 2010
SVN commit 1146997 by bholst:
Moved Marbles fog drawing to the right painting layer.
Moving Online Services one layer higher that they are painted after the fog.
Backport of r1146659
M +2 -2 AbstractDataPlugin.cpp
M +0 -44 MarbleMap.cpp
M +57 -1 MarbleModel.cpp
--- branches/KDE/4.5/kdeedu/marble/src/lib/AbstractDataPlugin.cpp #1146996:1146997
@@ -69,7 +69,7 @@
QStringList AbstractDataPlugin::renderPosition() const
{
- return QStringList( "HOVERS_ABOVE_SURFACE" );
+ return QStringList( "ALWAYS_ON_TOP" );
}
bool AbstractDataPlugin::isInitialized() const
@@ -84,7 +84,7 @@
return true;
}
- if ( renderPos != "HOVERS_ABOVE_SURFACE" ) {
+ if ( renderPos != "ALWAYS_ON_TOP" ) {
return true;
}
--- branches/KDE/4.5/kdeedu/marble/src/lib/MarbleMap.cpp #1146996:1146997
@@ -228,43 +228,6 @@
(int)( 2.1 * (qreal)(m_parent->radius()) ) );
}
-void MarbleMapPrivate::drawFog( QPainter &painter )
-{
- if ( m_viewParams.projection() != Spherical)
- return;
-
- // No use to draw the fog if it's not visible in the area.
- if ( m_viewParams.viewport()->mapCoversViewport() )
- return;
-
- int imgWidth2 = m_parent->width() / 2;
- int imgHeight2 = m_parent->height() / 2;
-
- // Recalculate the atmosphere effect and paint it to canvasImage.
- QRadialGradient grad1( QPointF( imgWidth2, imgHeight2 ), m_parent->radius() );
-
- // FIXME: Add a cosine relationship
- grad1.setColorAt( 0.85, QColor( 255, 255, 255, 0 ) );
- grad1.setColorAt( 1.00, QColor( 255, 255, 255, 64 ) );
-
- QBrush brush1( grad1 );
- QPen pen1( Qt::NoPen );
-
- painter.save();
-
- painter.setBrush( brush1 );
- painter.setPen( pen1 );
- painter.setRenderHint( QPainter::Antialiasing, false );
-
- // FIXME: Cut out what's really needed
- painter.drawEllipse( imgWidth2 - m_parent->radius(),
- imgHeight2 - m_parent->radius(),
- 2 * m_parent->radius(),
- 2 * m_parent->radius() );
-
- painter.restore();
-}
-
void MarbleMapPrivate::paintGround( GeoPainter &painter, QRect &dirtyRect )
{
if ( !m_viewParams.mapTheme() ) {
@@ -287,13 +250,6 @@
// FIXME: this is ugly, add method updateRadius() to ViewParams
m_viewParams.setRadiusUpdated( m_viewParams.radius() );
m_justModified = false;
-
- // FIXME: This is really slow. That's why we defer this to
- // PrintQuality. Either cache on a pixmap - or maybe
- // better: Add to GlobeScanlineTextureMapper.
-
- if ( m_viewParams.mapQuality() == PrintQuality )
- drawFog( painter );
}
void MarbleMapPrivate::paintOverlay( GeoPainter &painter, QRect &dirtyRect )
--- branches/KDE/4.5/kdeedu/marble/src/lib/MarbleModel.cpp #1146996:1146997
@@ -108,6 +108,8 @@
void notifyModelChanged();
GeoSceneGroup * textureLayerProperties() const;
+ void drawFog( QPainter *painter, ViewParams *viewParams, int width, int height );
+
static QAtomicInt refCounter;
MarbleModel *m_parent;
MarbleDataFacade *m_dataFacade;
@@ -671,7 +673,19 @@
viewParams );
renderPositions.clear();
- renderPositions << "HOVERS_ABOVE_SURFACE" << "ATMOSPHERE"
+ renderPositions << "HOVERS_ABOVE_SURFACE";
+ d->m_layerManager->renderLayers( painter, viewParams, renderPositions );
+
+ // FIXME: This is really slow. That's why we defer this to
+ // PrintQuality. Either cache on a pixmap - or maybe
+ // better: Add to GlobeScanlineTextureMapper.
+
+ if ( viewParams->mapQuality() == PrintQuality )
+ d->drawFog( painter, viewParams,
+ width, height );
+
+ renderPositions.clear();
+ renderPositions << "ATMOSPHERE"
<< "ORBIT" << "ALWAYS_ON_TOP" << "FLOAT_ITEM" << "USER_TOOLS";
d->m_layerManager->renderLayers( painter, viewParams, renderPositions );
@@ -761,6 +775,48 @@
emit m_parent->modelChanged();
}
+void MarbleModelPrivate::drawFog( QPainter *painter,
+ ViewParams *viewParams,
+ int width,
+ int height )
+{
+ if ( viewParams->projection() != Spherical)
+ return;
+
+ // No use to draw the fog if it's not visible in the area.
+ if ( viewParams->viewport()->mapCoversViewport() )
+ return;
+
+ int imgWidth2 = width / 2;
+ int imgHeight2 = height / 2;
+
+ int radius = viewParams->radius();
+
+ // Recalculate the atmosphere effect and paint it to canvasImage.
+ QRadialGradient grad1( QPointF( imgWidth2, imgHeight2 ), radius );
+
+ // FIXME: Add a cosine relationship
+ grad1.setColorAt( 0.85, QColor( 255, 255, 255, 0 ) );
+ grad1.setColorAt( 1.00, QColor( 255, 255, 255, 64 ) );
+
+ QBrush brush1( grad1 );
+ QPen pen1( Qt::NoPen );
+
+ painter->save();
+
+ painter->setBrush( brush1 );
+ painter->setPen( pen1 );
+ painter->setRenderHint( QPainter::Antialiasing, false );
+
+ // FIXME: Cut out what's really needed
+ painter->drawEllipse( imgWidth2 - radius,
+ imgHeight2 - radius,
+ 2 * radius,
+ 2 * radius );
+
+ painter->restore();
+}
+
void MarbleModel::update()
{
mDebug() << "MarbleModel::update()";
More information about the Marble-commits
mailing list