[Folder View] Improve label crispness
ClosedPublic

Authored by ngraham on Tue, Apr 9, 1:43 PM.

Details

Summary

Without rounding the result, sub-pixel rounding errors accumulate over time, making the
label blurry.

Test Plan

Nice and crisp now:

Diff Detail

Repository
R119 Plasma Desktop
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
ngraham created this revision.Tue, Apr 9, 1:43 PM
Restricted Application added a project: Plasma. · View Herald TranscriptTue, Apr 9, 1:43 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
ngraham requested review of this revision.Tue, Apr 9, 1:43 PM
ngraham added a reviewer: hein.Tue, Apr 9, 1:45 PM
filipf accepted this revision.EditedTue, Apr 9, 2:27 PM
filipf added a subscriber: filipf.

Huge improvement, Nate, and an excellent find. The rest of the reviewers can also have a look at my before and after photos for more proof:

Before:

After:

This revision is now accepted and ready to land.Tue, Apr 9, 2:27 PM
fvogt added a comment.Tue, Apr 9, 2:44 PM

It was actually discovered by openQA as a regression introduced yesterday: https://openqa.opensuse.org/tests/902646#step/finish_desktop/8 (bad) vs https://openqa.opensuse.org/tests/902110#step/finish_desktop/2 (good)
Probably a side effect of the label width change(s).

This diff might not be entirely correct as the rounding error can accumulate across all columns, thus making the width of all cells combined greater than the container's width.

It was actually discovered by openQA as a regression introduced yesterday: https://openqa.opensuse.org/tests/902646#step/finish_desktop/8 (bad) vs https://openqa.opensuse.org/tests/902110#step/finish_desktop/2 (good)
Probably a side effect of the label width change(s).

This diff might not be entirely correct as the rounding error can accumulate across all columns, thus making the width of all cells combined greater than the container's width.

I just added a ton of items to the desktop and tested with all combinations of icon sizes and label widths; in no case did the content ever overflow the container. I didn't see any other visual artifacts, either.

fvogt added a comment.Tue, Apr 9, 4:51 PM

Sounds good enough to me, let's get this in so openQA won't complain anymore

This revision was automatically updated to reflect the committed changes.
hein added a comment.Tue, Apr 9, 9:15 PM

I think it would be safer to Math.floor() rather than Math.round().