mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
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:
parent
791ef98016
commit
a70f053a62
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user