Use bilinear filtering when resizing graphics

This is used when scaling graphics previews. It is also used on a rare occasion
to scale instant previews when the user's configuration mixes low-dpi and
high-dpi monitors (#10114).
This commit is contained in:
Guillaume Munch 2016-04-30 19:56:57 +01:00
parent 791ef98016
commit a70f053a62
2 changed files with 8 additions and 1 deletions

View File

@ -207,7 +207,8 @@ bool GuiImage::scale(Params const & params)
QMatrix m;
m.scale(scale, scale);
transformed_ = image.transformed(m);
// Bilinear filtering is used to scale graphics preview
transformed_ = image.transformed(m, Qt::SmoothTransformation);
return true;
}

View File

@ -317,7 +317,13 @@ void GuiPainter::image(int x, int y, int w, int h, graphics::Image const & i)
QImage const image = qlimage.image();
QRectF const drect = QRectF(x, y, w, h);
QRectF const srect = QRectF(0, 0, image.width(), image.height());
// Bilinear filtering is needed on a rare occasion for instant previews when
// the user's configuration mixes low-dpi and high-dpi monitors (#10114).
// This filter is optimised by qt on pixel-aligned images, so this does not
// affect performances in other cases.
setRenderHint(SmoothPixmapTransform);
drawImage(drect, image, srect);
setRenderHint(SmoothPixmapTransform, false);
}