1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-06-27 11:39:16 +02:00

Only create/copy the sub-images when OpenGL is used

This commit is contained in:
2018-08-23 09:08:59 +02:00
parent d4b46a4bb6
commit 3176271955
7 changed files with 126 additions and 110 deletions

View File

@ -27,6 +27,7 @@ MapView::MapView(Map *map, POI *poi, QWidget *parent)
Q_ASSERT(map != 0);
Q_ASSERT(poi != 0);
_opengl = false;
_scene = new QGraphicsScene(this);
setScene(_scene);
setDragMode(QGraphicsView::ScrollHandDrag);
@ -271,6 +272,7 @@ void MapView::setMap(Map *map)
#ifdef ENABLE_HIDPI
_map->setDevicePixelRatio(_ratio);
#endif // ENABLE_HIDPI
_map->setOpenGLEnabled(_opengl);
_map->load();
connect(_map, SIGNAL(loaded()), this, SLOT(reloadMap()));
@ -507,6 +509,7 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
#ifdef ENABLE_HIDPI
_map->setDevicePixelRatio(1.0);
#endif // ENABLE_HIDPI
_map->setOpenGLEnabled(false);
// Compute sizes & ratios
orig = viewport()->rect();
@ -568,6 +571,7 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
#ifdef ENABLE_HIDPI
_map->setDevicePixelRatio(_ratio);
#endif // ENABLE_HIDPI
_map->setOpenGLEnabled(_opengl);
_plot = false;
setUpdatesEnabled(true);
}
@ -808,10 +812,14 @@ void MapView::scrollContentsBy(int dx, int dy)
void MapView::useOpenGL(bool use)
{
_opengl = use;
if (use)
setViewport(new OPENGL_WIDGET);
else
setViewport(new QWidget);
_map->setOpenGLEnabled(_opengl);
}
void MapView::useAntiAliasing(bool use)

View File

@ -142,6 +142,7 @@ private:
#ifdef ENABLE_HIDPI
qreal _ratio;
#endif // ENABLE_HIDPI
bool _opengl;
};
#endif // MAPVIEW_H