1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-01-18 19:52:09 +01:00

Some more code cleanup

This commit is contained in:
Martin Tůma 2018-08-24 00:14:40 +02:00
parent 21dbd3958d
commit 9f74bbb27a
2 changed files with 4 additions and 5 deletions

View File

@ -3,13 +3,14 @@
#include "image.h"
Image::Image(const QString &fileName) : _img(fileName), _ratio(1.0)
Image::Image(const QString &fileName) : _img(fileName)
{
}
void Image::draw(QPainter *painter, const QRectF &rect, Map::Flags flags)
{
QRectF sr(rect.topLeft() * _ratio, rect.size() * _ratio);
qreal ratio = _img.devicePixelRatioF();
QRectF sr(rect.topLeft() * ratio, rect.size() * ratio);
if (flags & Map::OpenGL) {
QImage img(_img.copy(sr.toRect()));
@ -21,7 +22,6 @@ void Image::draw(QPainter *painter, const QRectF &rect, Map::Flags flags)
void Image::setDevicePixelRatio(qreal ratio)
{
#ifdef ENABLE_HIDPI
_ratio = ratio;
_img.setDevicePixelRatio(_ratio);
_img.setDevicePixelRatio(ratio);
#endif // ENABLE_HIDPI
}

View File

@ -16,7 +16,6 @@ public:
private:
QImage _img;
qreal _ratio;
};
#endif // IMAGE_H