[Marble-commits] branches/KDE/4.6/kdeedu/marble/src/lib

Bernhard Beschow bbeschow at cs.tu-berlin.de
Wed Dec 29 23:04:01 CET 2010


SVN commit 1210171 by beschow:

backport of trunk-r1209186: introduce TileScalingTextureMapper

This patch introduces an optimized code path for the case that both the tile projection and the map projection are of type Mercator. In this very common case, the tiles can
be scaled rather than reprojected, promising a significant speedup, especially on the N900. Moreover, it seems to avoid crashes in high zoom levels on the N900, too.

REVIEW: 6109

 M  +1 -2      AbstractScanlineTextureMapper.cpp  
 M  +4 -3      AbstractScanlineTextureMapper.h  
 M  +1 -0      CMakeLists.txt  
 M  +5 -0      TextureLayer.cpp  
 A             TileScalingTextureMapper.cpp   [License: LGPL]
 A             TileScalingTextureMapper.h   [License: LGPL]


--- branches/KDE/4.6/kdeedu/marble/src/lib/AbstractScanlineTextureMapper.cpp #1210170:1210171
@@ -35,7 +35,7 @@
       m_tileLoader( tileLoader ),
       m_tilePosX( 0 ),
       m_tilePosY( 0 ),
-      m_textureProjection( tileLoader->tileProjection() ),
+      m_textureProjection( tileLoader->tileProjection() ),  // cache texture projection
       m_tileSize( tileLoader->tileSize() ),  // cache tile size
       m_tile( 0 ),
       m_previousRadius( 0 ),
@@ -45,7 +45,6 @@
       m_normGlobalWidth( 0.0 ),
       m_normGlobalHeight( 0.0 )
 {
-    Q_ASSERT( textureLayer );  // just for documentation
 }
 
 
--- branches/KDE/4.6/kdeedu/marble/src/lib/AbstractScanlineTextureMapper.h #1210170:1210171
@@ -114,14 +114,15 @@
     int          m_tilePosX;
     int          m_tilePosY;
 
+    GeoSceneTexture::Projection const m_textureProjection;
+    /// size of the tiles of of the current texture layer
+    QSize const m_tileSize;
+
  private:
     Q_DISABLE_COPY( AbstractScanlineTextureMapper )
     void initGlobalWidth();
     void initGlobalHeight();
 
-    GeoSceneTexture::Projection const m_textureProjection;
-    /// size of the tiles of of the current texture layer
-    QSize const m_tileSize;
     StackedTile *m_tile;
     int         m_previousRadius;
 
--- branches/KDE/4.6/kdeedu/marble/src/lib/CMakeLists.txt #1210170:1210171
@@ -130,6 +130,7 @@
     SphericalScanlineTextureMapper.cpp
     EquirectScanlineTextureMapper.cpp
     MercatorScanlineTextureMapper.cpp
+    TileScalingTextureMapper.cpp
     DiscCache.cpp
     ServerLayout.cpp
     StoragePolicy.cpp
--- branches/KDE/4.6/kdeedu/marble/src/lib/TextureLayer.cpp #1210170:1210171
@@ -18,6 +18,7 @@
 #include "SphericalScanlineTextureMapper.h"
 #include "EquirectScanlineTextureMapper.h"
 #include "MercatorScanlineTextureMapper.h"
+#include "TileScalingTextureMapper.h"
 #include "GeoPainter.h"
 #include "GeoSceneDocument.h"
 #include "GeoSceneFilter.h"
@@ -225,7 +226,11 @@
             d->m_texmapper = new EquirectScanlineTextureMapper( &d->m_tileLoader, this );
             break;
         case Mercator:
+            if ( d->m_tileLoader.tileProjection() == GeoSceneTexture::Mercator ) {
+                d->m_texmapper = new TileScalingTextureMapper( &d->m_tileLoader, this );
+            } else {
             d->m_texmapper = new MercatorScanlineTextureMapper( &d->m_tileLoader, this );
+            }
             break;
         default:
             d->m_texmapper = 0;


More information about the Marble-commits mailing list