aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/imageviewer
diff options
context:
space:
mode:
authorAlessandro Portale <alessandro.portale@digia.com>2014-07-24 16:29:40 +0200
committerAlessandro Portale <alessandro.portale@digia.com>2014-08-01 12:50:16 +0200
commit3efa2cf9641d29a11fceac309fffbe6b47263f01 (patch)
treed37c03cc945bd3b58d3d7ce7c9e1367add5950a8 /src/plugins/imageviewer
parent49707ff3f08834735bba85ca4728eeec095f5a1c (diff)
ImageViewer: No interpolation when zooming in
The imageViewer currently always renders the images smooth/interpolated. When loading an image in an IDE and zooming in, I usually do that in order to examine the details on pixel level. Therefore, I believe that smoothing/interpolation should be turned off with a scalefactor >= 1. This patch does that for images and movies. Svg files remain always smooth. Change-Id: I327583b1f46132d179a1e0425f146106d962377b Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Diffstat (limited to 'src/plugins/imageviewer')
-rw-r--r--src/plugins/imageviewer/imageview.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/imageviewer/imageview.cpp b/src/plugins/imageviewer/imageview.cpp
index 0767a68eb32..8659344133a 100644
--- a/src/plugins/imageviewer/imageview.cpp
+++ b/src/plugins/imageviewer/imageview.cpp
@@ -69,7 +69,8 @@ public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
- painter->setRenderHint(QPainter::SmoothPixmapTransform, true);
+ const bool smoothTransform = painter->worldTransform().m11() < 1;
+ painter->setRenderHint(QPainter::SmoothPixmapTransform, smoothTransform);
painter->drawPixmap(offset(), m_movie->currentPixmap());
}
@@ -257,6 +258,9 @@ void ImageView::doScale(qreal factor)
scale(actualFactor, actualFactor);
emitScaleFactor();
+ if (QGraphicsPixmapItem *pixmapItem = dynamic_cast<QGraphicsPixmapItem *>(d->imageItem))
+ pixmapItem->setTransformationMode(
+ transform().m11() < 1 ? Qt::SmoothTransformation : Qt::FastTransformation);
}
void ImageView::updatePixmap(const QRect &rect)