From: Stephan Witt Date: Sat, 18 Oct 2014 13:46:17 +0000 (+0200) Subject: #9130 Text in main work area isn't rendered with high resolution X-Git-Tag: 2.2.0alpha1~1631 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=8829eeed04c559821b8aeb14141764700c8eb0b4;p=features.git #9130 Text in main work area isn't rendered with high resolution Assign the pixel_ratio of graphics params to the Qt pixmap of the image. --- diff --git a/src/frontends/qt4/GuiImage.cpp b/src/frontends/qt4/GuiImage.cpp index 503ad5271d..7e3307f3e4 100644 --- a/src/frontends/qt4/GuiImage.cpp +++ b/src/frontends/qt4/GuiImage.cpp @@ -10,6 +10,7 @@ */ #include +#include /* ceil */ #include "GuiImage.h" #include "qt_helpers.h" @@ -63,13 +64,25 @@ QImage const & GuiImage::image() const unsigned int GuiImage::width() const { +#if QT_VERSION >= 0x050000 + return is_transformed_ ? + ceil(transformed_.width() / transformed_.devicePixelRatio()) : + ceil(original_.width() / original_.devicePixelRatio()); +#else return is_transformed_ ? transformed_.width() : original_.width(); +#endif } unsigned int GuiImage::height() const { +#if QT_VERSION >= 0x050000 + return is_transformed_ ? + ceil(transformed_.height() / transformed_.devicePixelRatio()) : + ceil(original_.height() / original_.devicePixelRatio()); +#else return is_transformed_ ? transformed_.height() : original_.height(); +#endif } @@ -103,7 +116,11 @@ bool GuiImage::setPixmap(Params const & params) if (!load()) return false; } - + +#if QT_VERSION >= 0x050000 + original_.setDevicePixelRatio(params.pixel_ratio); +#endif + is_transformed_ = clip(params); is_transformed_ |= rotate(params); is_transformed_ |= scale(params);