-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
skin preview: consider devicePixelRatio when scaling #3941
Conversation
src/skin/skinloader.cpp
Outdated
preview = preview.scaled(QSize(640, 360), Qt::KeepAspectRatio, Qt::SmoothTransformation); | ||
QSize scaledSize(static_cast<int>(640 * devicePixelRatio), | ||
static_cast<int>(360 * devicePixelRatio)); | ||
preview.setDevicePixelRatio(devicePixelRatio); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this line redundant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope. without line79 the image would just be as big as set by the QSize.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops, you refer to the duplicate setDevicePixelRatio line above the code quote here.
yes, that's unnnecessary.
fixed.
src/skin/skinloader.cpp
Outdated
QSize scaledSize(static_cast<int>(640 * devicePixelRatio), | ||
static_cast<int>(360 * devicePixelRatio)); | ||
preview.setDevicePixelRatio(devicePixelRatio); | ||
preview = preview.scaled(scaledSize, Qt::KeepAspectRatio, Qt::SmoothTransformation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be shortened to
preview = preview.scaled(scaledSize, Qt::KeepAspectRatio, Qt::SmoothTransformation); | |
preview = preview.scaled(QSize(640, 360) * devicePixelRatio, Qt::KeepAspectRatio, Qt::SmoothTransformation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't find docu on how to scale a QSize with just a factor. did you try it?
if yes, feel free to push the shorter version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't find docu on how to scale a QSize with just a factor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha! thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering if this would be automatic or not. thanks for the fix
Thanks for the quick review. Ready! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Thank you.
follow-up for #3926
fixes blurry preview images.
before
this PR (not ethat you can now read the library : ) try with
QT_SCALE_FACTORS=3
for full effect