1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00

Broken OpenGL image part drawing workaround

This commit is contained in:
Martin Tůma 2018-08-22 00:14:07 +02:00
parent 3b2d4dcd31
commit d4b46a4bb6
2 changed files with 14 additions and 5 deletions

View File

@ -79,7 +79,12 @@ void GeoTIFFMap::draw(QPainter *painter, const QRectF &rect, bool block)
{ {
Q_UNUSED(block) Q_UNUSED(block)
if (_img && !_img->isNull()) if (_img && !_img->isNull()) {
painter->drawImage(rect.topLeft(), *_img, QRectF(rect.topLeft() /* Drawing directly a sub-rectangle without an image copy does not work
* _ratio, rect.size() * _ratio)); for big images under OpenGL. The image is most probably loaded as
whole which exceeds the texture size limit. */
QRectF sr(rect.topLeft() * _ratio, rect.size() * _ratio);
QImage img(_img->copy(sr.toRect()));
painter->drawImage(rect.topLeft(), img);
}
} }

View File

@ -302,8 +302,12 @@ void OziMap::drawOZF(QPainter *painter, const QRectF &rect) const
void OziMap::drawImage(QPainter *painter, const QRectF &rect) const void OziMap::drawImage(QPainter *painter, const QRectF &rect) const
{ {
painter->drawImage(rect.topLeft(), *_img, QRectF(rect.topLeft() * _ratio, /* Drawing directly a sub-rectangle without an image copy does not work
rect.size() * _ratio)); for big images under OpenGL. The image is most probably loaded as
whole which exceeds the texture size limit. */
QRectF sr(rect.topLeft() * _ratio, rect.size() * _ratio);
QImage img(_img->copy(sr.toRect()));
painter->drawImage(rect.topLeft(), img);
} }
void OziMap::draw(QPainter *painter, const QRectF &rect, bool block) void OziMap::draw(QPainter *painter, const QRectF &rect, bool block)