Skip to content
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

Fix jagged background for labels and widgets #2205

Conversation

pauldendulk
Copy link
Member

No description provided.

Copy link
Contributor

@inforithmics inforithmics left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good improvement.

Are there maybe more SkPaint Colors that need antialising?

@@ -298,7 +296,7 @@ private static void DrawBackground(LabelStyle style, SKRect rect, SKCanvas targe
if (color.HasValue)
{
var rounding = style.CornerRounding;
using var backgroundPaint = new SKPaint { Color = color.Value };
using var backgroundPaint = new SKPaint { Color = color.Value, IsAntialias = true };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix, first I didn't see the jagged background, but after I figured out how to compre the images (with the swipe feature, it is clearly an improvement.

Looking through the Code I saw in the PerformanceWidgetRenderer no antialiasing on the Background.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed the degradation on the corner radius and the PerformanceWidgetRenderer does not use the corner radius, so I did not change it, but I am not sure if would make a difference even with a regular square.

That said, higher quality does have a cost and sometimes quite noticeable. In de past I have often chosen a faster way of rendering. For instance when rendering a lot of svg point symbols you may not always want the fastest solution. Perhaps quality should even be configurable for individual layers.

@pauldendulk
Copy link
Member Author

Are there maybe more SkPaint Colors that need antialising?

Likely. But I think not every draw method benefits from it, and there is a performance penalty we may not always want to take. For instance, for drawing bitmaps there is the FilterQuality and we use FilterQuality.Low, while there is also High and Medium. For my purpose (some years ago) High was too slow. Btw, if you do not set the FilterQuality the default None is used, which is significantly worse than Low.

@pauldendulk pauldendulk merged commit 5290687 into master Oct 9, 2023
6 checks passed
@pauldendulk pauldendulk deleted the 2204-backfill-of-labels-is-jagged-because-of-missing-anti-aliasing branch October 9, 2023 19:33
@inforithmics
Copy link
Contributor

Yes, I thought about a configurable option could be helpful. I didn't see the problem because I have a 4K Monitor so Rounded Corners are smooth even without AntiAliasing and Smartphones have high Resolution too so you don't see much of a difference. But the Performance could be noticable.

Maybe the MapControl could have two Properties Antialiasing and FilterQuality with Antialiasing set to true and FilterQuality set to FilterQuality.Low.

Or maybe this can be set with Properties on the Renderer.

@charlenni
Copy link
Member

Is this nothing, that should be configurable for each layer or widget and not globally?

@pauldendulk
Copy link
Member Author

@charlenni @inforithmics I created an issue to discuss this #2213

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants