File indexing completed on 2024-04-21 03:50:01

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2010-2012 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
0004 //
0005 
0006 #ifndef MARBLE_TILESCALINGTEXTUREMAPPER_H
0007 #define MARBLE_TILESCALINGTEXTUREMAPPER_H
0008 
0009 
0010 #include <QObject>
0011 #include "TextureMapperInterface.h"
0012 
0013 #include "TileId.h"
0014 
0015 #include <QCache>
0016 #include <QImage>
0017 #include <QPixmap>
0018 
0019 namespace Marble
0020 {
0021 
0022 class StackedTileLoader;
0023 
0024 class TileScalingTextureMapper : public QObject, public TextureMapperInterface
0025 {
0026     Q_OBJECT
0027 
0028  public:
0029     explicit TileScalingTextureMapper( StackedTileLoader *tileLoader, QObject *parent = nullptr );
0030 
0031     void mapTexture( GeoPainter *painter,
0032                              const ViewportParams *viewport,
0033                              int tileZoomLevel,
0034                              const QRect &dirtyRect,
0035                              TextureColorizer *texColorizer ) override;
0036 
0037  private Q_SLOTS:
0038     void removePixmap( const TileId &tileId );
0039     void clearPixmaps();
0040 
0041  private:
0042     void mapTexture( GeoPainter *painter,
0043                      const ViewportParams *viewport,
0044                      int tileZoomLevel,
0045                      TextureColorizer *texColorizer );
0046 
0047  private:
0048     StackedTileLoader *const m_tileLoader;
0049     QCache<TileId, const QPixmap> m_cache;
0050     QImage m_canvasImage;
0051     int    m_radius;
0052 };
0053 
0054 }
0055 
0056 #endif