*better-rer* character scaling algorithm
This commit is contained in:
parent
6dd0845f1c
commit
520c4f5947
@ -234,19 +234,19 @@ QPixmap AOCharMovie::get_pixmap(QImage image)
|
||||
auto aspect_ratio = Qt::KeepAspectRatio;
|
||||
auto transform_mode = Qt::SmoothTransformation;
|
||||
|
||||
if (f_pixmap.size().width() > this->size().width() && f_pixmap.size().height() <= this->size().height())
|
||||
if (f_pixmap.size().width() > this->size().width() || f_pixmap.size().height() > this->size().height())
|
||||
{
|
||||
f_pixmap = f_pixmap.scaledToHeight(this->height(), transform_mode);
|
||||
}
|
||||
else if (f_pixmap.size().height() > this->size().height())
|
||||
{
|
||||
f_pixmap = f_pixmap.scaledToWidth(this->width(), transform_mode);
|
||||
}
|
||||
// else if (f_pixmap.size().height() > this->size().height())
|
||||
// {
|
||||
// f_pixmap = f_pixmap.scaledToWidth(this->width(), transform_mode);
|
||||
// }
|
||||
else
|
||||
{
|
||||
f_pixmap = f_pixmap.scaled(this->width(), this->height(), aspect_ratio, transform_mode);
|
||||
}
|
||||
this->move((f_w - f_pixmap.width())/2, (f_h - f_pixmap.height())/2);
|
||||
this->move((f_w - f_pixmap.width())/2, (f_pixmap.height() - f_h)); //Always center horizontally, always put at the bottom vertically
|
||||
this->resize(f_pixmap.size());
|
||||
|
||||
return f_pixmap;
|
||||
|
Loading…
Reference in New Issue
Block a user