]> git.lyx.org Git - lyx.git/commitdiff
#9130 Text in main work area isn't rendered with high resolution
authorStephan Witt <switt@lyx.org>
Sat, 18 Oct 2014 13:46:17 +0000 (15:46 +0200)
committerStephan Witt <switt@lyx.org>
Sat, 18 Oct 2014 13:46:17 +0000 (15:46 +0200)
Assign the pixel_ratio of graphics params to the Qt pixmap of the image.

src/frontends/qt4/GuiImage.cpp

index 503ad5271d96418b237563538745389267f36e84..7e3307f3e4c44469f313950d2f09e8f73860caa2 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <config.h>
+#include <math.h> /* 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);