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

List:       kde-commits
Subject:    branches/KDE/4.6/kdeedu/marble/src/lib
From:       Bernhard Beschow <bbeschow () cs ! tu-berlin ! de>
Date:       2010-12-29 22:03:45
Message-ID: 20101229220345.0F4AEAC8B1 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1210169 by beschow:

backport of trunk-r1209049: don't get a hold on GeoSceneTexture in \
AbstractScanlineTextureMapper

* AbstractScanlineTextureMapper should only use the StackedTileLoader for tile \
handling in the future, since GeoSceneTexture is below the StackedTileLoader in the \
texture rendering stack

 M  +4 -4      AbstractScanlineTextureMapper.cpp  
 M  +2 -2      AbstractScanlineTextureMapper.h  
 M  +2 -3      DownloadRegionDialog.cpp  
 M  +32 -0     StackedTileLoader.cpp  
 M  +11 -2     StackedTileLoader.h  
 M  +4 -4      TextureLayer.cpp  
 M  +2 -2      TextureLayer.h  


--- branches/KDE/4.6/kdeedu/marble/src/lib/AbstractScanlineTextureMapper.cpp \
#1210168:1210169 @@ -36,8 +36,8 @@
       m_tileLoader( tileLoader ),
       m_tilePosX( 0 ),
       m_tilePosY( 0 ),
-      m_textureLayer( textureLayer ),
-      m_tileSize( textureLayer->tileSize() ),  // cache tile size
+      m_textureProjection( tileLoader->tileProjection() ),
+      m_tileSize( tileLoader->tileSize() ),  // cache tile size
       m_tile( 0 ),
       m_previousRadius( 0 ),
       m_tileLevel( 0 ),
@@ -561,13 +561,13 @@
 void AbstractScanlineTextureMapper::initGlobalWidth()
 {
     m_globalWidth = m_tileSize.width()
-        * TileLoaderHelper::levelToColumn( m_textureLayer->levelZeroColumns(), \
m_tileLevel ); +        * m_tileLoader->tileColumnCount( m_tileLevel );
 }
 
 void AbstractScanlineTextureMapper::initGlobalHeight()
 {
     m_globalHeight = m_tileSize.height()
-        * TileLoaderHelper::levelToRow( m_textureLayer->levelZeroRows(), m_tileLevel \
); +        * m_tileLoader->tileRowCount( m_tileLevel );
 }
 
 #include "AbstractScanlineTextureMapper.moc"
--- branches/KDE/4.6/kdeedu/marble/src/lib/AbstractScanlineTextureMapper.h \
#1210168:1210169 @@ -120,7 +120,7 @@
     void initGlobalWidth();
     void initGlobalHeight();
 
-    GeoSceneTexture const * const m_textureLayer;
+    GeoSceneTexture::Projection const m_textureProjection;
     /// size of the tiles of of the current texture layer
     QSize const m_tileSize;
     StackedTile *m_tile;
@@ -161,7 +161,7 @@
 
 inline qreal AbstractScanlineTextureMapper::rad2PixelY( const qreal lat ) const
 {
-    switch ( m_textureLayer->projection() ) {
+    switch ( m_textureProjection ) {
     case GeoSceneTexture::Equirectangular:
         return -lat * m_normGlobalHeight;
     case GeoSceneTexture::Mercator:
--- branches/KDE/4.6/kdeedu/marble/src/lib/DownloadRegionDialog.cpp #1210168:1210169
@@ -210,8 +210,7 @@
 int DownloadRegionDialog::Private::rad2PixelX( qreal const lon ) const
 {
     qreal const globalWidth = m_textureLayer->tileSize().width()
-        * TileLoaderHelper::levelToColumn( m_textureLayer->levelZeroColumns(),
-                                           m_visibleTileLevel );
+        * m_textureLayer->tileColumnCount( m_visibleTileLevel );
     return static_cast<int>( globalWidth * 0.5 + lon * ( globalWidth / ( 2.0 * M_PI \
) ) );  }
 
@@ -219,7 +218,7 @@
 int DownloadRegionDialog::Private::rad2PixelY( qreal const lat ) const
 {
     qreal const globalHeight = m_textureLayer->tileSize().height()
-        * TileLoaderHelper::levelToRow( m_textureLayer->levelZeroRows(), \
m_visibleTileLevel ); +        * m_textureLayer->tileRowCount( m_visibleTileLevel );
     qreal const normGlobalHeight = globalHeight / M_PI;
     switch ( m_textureLayer->tileProjection() ) {
     case GeoSceneTexture::Equirectangular:
--- branches/KDE/4.6/kdeedu/marble/src/lib/StackedTileLoader.cpp #1210168:1210169
@@ -114,6 +114,38 @@
     d->m_layerDecorator.setShowTileId( show );
 }
 
+int StackedTileLoader::tileColumnCount( int level ) const
+{
+    Q_ASSERT( !d->m_textureLayers.isEmpty() );
+
+    const int levelZeroColumns = d->m_textureLayers.at( 0 )->levelZeroColumns();
+
+    return TileLoaderHelper::levelToColumn( levelZeroColumns, level );
+}
+
+int StackedTileLoader::tileRowCount( int level ) const
+{
+    Q_ASSERT( !d->m_textureLayers.isEmpty() );
+
+    const int levelZeroRows = d->m_textureLayers.at( 0 )->levelZeroRows();
+
+    return TileLoaderHelper::levelToRow( levelZeroRows, level );
+}
+
+GeoSceneTexture::Projection StackedTileLoader::tileProjection() const
+{
+    Q_ASSERT( !d->m_textureLayers.isEmpty() );
+
+    return d->m_textureLayers.at( 0 )->projection();
+}
+
+QSize StackedTileLoader::tileSize() const
+{
+    Q_ASSERT( !d->m_textureLayers.isEmpty() );
+
+    return d->m_textureLayers.at( 0 )->tileSize();
+}
+
 void StackedTileLoader::resetTilehash()
 {
     QHash<TileId, StackedTile*>::const_iterator it = \
                d->m_tilesOnDisplay.constBegin();
--- branches/KDE/4.6/kdeedu/marble/src/lib/StackedTileLoader.h #1210168:1210169
@@ -25,8 +25,10 @@
 #define MARBLE_STACKEDTILELOADER_H
 
 #include <QtCore/QObject>
+#include <QtCore/QSize>
 #include <QtCore/QVector>
 
+#include "GeoSceneTexture.h"
 #include "TileId.h"
 #include "global.h"
 
@@ -39,7 +41,6 @@
 class MapThemeManager;
 class GeoSceneDocument;
 class GeoSceneLayer;
-class GeoSceneTexture;
 class SunLocator;
 class TileLoader;
 
@@ -76,6 +77,14 @@
 
         void setShowTileId( bool show );
 
+        int tileColumnCount( int level ) const;
+
+        int tileRowCount( int level ) const;
+
+        GeoSceneTexture::Projection tileProjection() const;
+
+        QSize tileSize() const;
+
         /**
          * Loads a tile and returns it.
          *
@@ -120,7 +129,7 @@
 
         /**
          * Returns the highest level in which some tiles are theoretically
-         * available for the given @p texture layer.
+         * available for the current texture layers.
          */
         int maximumTileLevel() const;
 
--- branches/KDE/4.6/kdeedu/marble/src/lib/TextureLayer.cpp #1210168:1210169
@@ -350,14 +350,14 @@
     return d->textureLayer()->projection();
 }
 
-int TextureLayer::levelZeroColumns() const
+int TextureLayer::tileColumnCount( int level ) const
 {
-    return d->textureLayer()->levelZeroColumns();
+    return d->m_tileLoader.tileColumnCount( level );
 }
 
-int TextureLayer::levelZeroRows() const
+int TextureLayer::tileRowCount( int level ) const
 {
-    return d->textureLayer()->levelZeroRows();
+    return d->m_tileLoader.tileRowCount( level );
 }
 
 qint64 TextureLayer::volatileCacheLimit() const
--- branches/KDE/4.6/kdeedu/marble/src/lib/TextureLayer.h #1210168:1210169
@@ -75,8 +75,8 @@
 
     GeoSceneTexture::Projection tileProjection() const;
 
-    int levelZeroColumns() const;
-    int levelZeroRows() const;
+    int tileColumnCount( int level ) const;
+    int tileRowCount( int level ) const;
 
     qint64 volatileCacheLimit() const;
 


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

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