#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.
This commit is contained in:
Stephan Witt 2014-10-18 15:46:17 +02:00
parent f9bff2d9b1
commit 8829eeed04

View 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);