Various fixes to new Cards
ClosedPublic

Authored by ahiemstra on Apr 22 2020, 12:34 PM.

Details

Summary

This contains various small fixes to the new Cards.

  • Still show the border of AbstractCard on Cards with images.
  • Round bottom corners of the banner when the card doesn't have any other contents.
  • Don't use fwidth for smoothing, instead just use a fixed value, this increases the accuracy of lines rendered by cards.
  • Fix batching test for ShadowedTexture, prevents cards being rendered with the wrong texture.

BUG: 420406

Test Plan

The new Kirigami Gallery displays more correct now, though there are some layout issues that are not regressions.

Diff Detail

Repository
R169 Kirigami
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
ahiemstra created this revision.Apr 22 2020, 12:34 PM
Restricted Application added a project: Kirigami. · View Herald TranscriptApr 22 2020, 12:34 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
ahiemstra requested review of this revision.Apr 22 2020, 12:34 PM
ahiemstra edited the summary of this revision. (Show Details)Apr 22 2020, 12:43 PM
ahiemstra updated this revision to Diff 80878.Apr 22 2020, 12:48 PM
  • Slightly increase smoothing, to avoid too harsh corners
ndavis added a subscriber: ndavis.EditedApr 22 2020, 1:15 PM

I found something very curious and I don't know what the cause could be. The corners are smoother when the cards are taller and rougher when they are shorter. Width doesn't affect smoothness.

ndavis added a comment.EditedApr 22 2020, 1:26 PM

Actually, width does affect the roughness. The corners are at their smoothest when the card is a square.

ahiemstra updated this revision to Diff 80885.Apr 22 2020, 1:44 PM
  • Remove sdf_polygon, it is unused and causes breakage on Android
ahiemstra updated this revision to Diff 80891.Apr 22 2020, 2:14 PM
  • Restore fwidth() call in shader, tweak smoothing values more

Urgh, I knew there was a point to that damn fwidth() call. As far as I can tell this version has about the same visual appearance without it changing dependent on resolution.

ndavis accepted this revision.Apr 22 2020, 2:32 PM

Much better and thanks! LGTM

This revision is now accepted and ready to land.Apr 22 2020, 2:32 PM
ndavis added a comment.EditedApr 22 2020, 3:54 PM

This has a ShadowedRectangle underneath and a transparent Rectangle with a border on top:

Is there nothing that can be done about that? I have to deal with similar issues when working with SVGs, so I'll understand if you can't. We'll just have to slightly shrink the rectangle underneath instead.

ndavis added inline comments.Apr 22 2020, 5:07 PM
src/scenegraph/shaders/sdf.glsl
199

I played around with this value and found that 0.625 was pretty decent. It slightly improved the corners in bigscreen and made the corners of Kirigami.Card a bit smoother without making the lines blurry. Top: 0.625; Bottom: 0.4

This has a ShadowedRectangle underneath and a transparent Rectangle with a border on top:

Is there nothing that can be done about that? I have to deal with similar issues when working with SVGs, so I'll understand if you can't. We'll just have to slightly shrink the rectangle underneath instead.

Not really. These kinds of artifacts occur because you're blending two semi-transparent pixels together, so the pixel from the rectangle below ends up shining through the pixel above it.

That said, why are you using a second rectangle with a border instead of just adding a border to the shadowedrectangle?

ahiemstra updated this revision to Diff 80962.Apr 23 2020, 8:41 AM
  • Use a slightly higher smoothing value.
ahiemstra marked an inline comment as done.Apr 23 2020, 8:43 AM
ahiemstra added inline comments.
src/scenegraph/shaders/sdf.glsl
199

Great, I'll use that.

mart accepted this revision.Apr 23 2020, 8:51 AM
This revision was automatically updated to reflect the committed changes.
ahiemstra marked an inline comment as done.