Fix avatar picture aliasing and stretching in kickoff

Authored by ktatunov on Apr 23 2018, 3:39 PM.



QML Image element has some smoothing when scaling an image by default but it's not enough and the picture still looks a bit pixelated. This patch fixes that.
Also while I was at it, I added keeping the aspect ratio, because no one likes their avatars stretched.

BUG: 369327

Test Plan



Diff Detail

R119 Plasma Desktop
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
ktatunov created this revision.Apr 23 2018, 3:39 PM
Restricted Application added a project: Plasma. · View Herald TranscriptApr 23 2018, 3:39 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
ktatunov requested review of this revision.Apr 23 2018, 3:39 PM

why mipmap?

Because smooth property is enabled by default and it's apparently not enough for a good looking image.
Unless I'm missing something, nothing else is available that controls smoothing of an Image element.

setting sourceWidth/height so that it resizes before the texture upload

Thanks for the pointer. Upon further investigation it looks like setting

sourceSize.width: width
sourceSize.height: height

instead of mipmap works well for more or less square images. However, for images that are significantly wider than they are taller (or vice versa) quality is degrading.

AFAICT, Image in qml loads the image in a mode equivalent to Image.PreserveAspectCrop (at least in this case) after which Image's scaling kicks in. So images that are really wide or really tall end up being loaded at a resolution that is way off and then scaled.
I guess it's not that big of a price to pay so I'll replace mipmap with sourceSize.

ktatunov updated this revision to Diff 32902.Apr 23 2018, 6:45 PM

Replace mipmap with sourceSize.

mart accepted this revision.May 2 2018, 9:27 AM
This revision is now accepted and ready to land.May 2 2018, 9:27 AM

Could someone commit this for me please?

This revision was automatically updated to reflect the committed changes.