[Marble-commits] KDE/kdeedu/marble/src/lib
Jens-Michael Hoffmann
jensmh at gmx.de
Sat May 22 21:24:19 CEST 2010
SVN commit 1129534 by jmhoffmann:
Partially fix for blending: Make sure the result tile is converted to
ARGB32_Premultiplied if we have more than one active texture layer.
M +11 -3 StackedTile.cpp
M +2 -1 StackedTile_p.h
--- trunk/KDE/kdeedu/marble/src/lib/StackedTile.cpp #1129533:1129534
@@ -206,10 +206,15 @@
return topLeftValue;
}
-inline void StackedTilePrivate::mergeCopyToResult( QSharedPointer<TextureTile> const & other )
+inline void StackedTilePrivate::setResultTile( QSharedPointer<TextureTile> const & tile,
+ bool const withConversion )
{
- m_resultTile = other->image()->copy();
+ if ( withConversion ) {
+ m_resultTile = tile->image()->convertToFormat( QImage::Format_ARGB32_Premultiplied );
+ } else {
+ m_resultTile = tile->image()->copy();
}
+}
void StackedTilePrivate::calcByteCount()
{
@@ -364,6 +369,9 @@
void StackedTile::initResultTile()
{
Q_ASSERT( hasTiles() );
+ // if there are more than one active texture layers, we have to convert the
+ // result tile into QImage::Format_ARGB32_Premultiplied to make blending possible
+ const bool withConversion = d->m_tiles.count() > 1;
QVector<QSharedPointer<TextureTile> >::const_iterator pos = d->m_tiles.constBegin();
QVector<QSharedPointer<TextureTile> >::const_iterator const end = d->m_tiles.constEnd();
for (; pos != end; ++pos )
@@ -375,7 +383,7 @@
}
else {
mDebug() << "StackedTile::initResultTile: no blending defined => copying top over bottom image";
- d->mergeCopyToResult( *pos );
+ d->setResultTile( *pos, withConversion );
}
}
--- trunk/KDE/kdeedu/marble/src/lib/StackedTile_p.h #1129533:1129534
@@ -48,7 +48,8 @@
inline uint pixel( int x, int y ) const;
inline uint pixelF( qreal x, qreal y, const QRgb& pixel ) const;
- void mergeCopyToResult( QSharedPointer<TextureTile> const & tile );
+ void setResultTile( QSharedPointer<TextureTile> const & tile,
+ const bool withConversion = true );
void calcByteCount();
};
More information about the Marble-commits
mailing list