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

Enable antialiasing for reply button #5491

Merged
merged 4 commits into from
Jul 7, 2024

Conversation

dnsge
Copy link
Contributor

@dnsge dnsge commented Jul 4, 2024

Description

Enables antialiasing for the reply button. This has always bugged me. I saw a screenshot of Chatterino on Twitter and was instantly compelled to fix it. Before/after:

image

Copy link
Contributor

@jupjohn jupjohn left a comment

Choose a reason for hiding this comment

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

Would be nice to do a sweep of any other images that could do with the same hint - but that's for another day. Looks good to me!

@@ -392,6 +392,7 @@ void ImageWithCircleBackgroundLayoutElement::paint(
if (pixmap && !this->image_->animated())
{
QRectF boxRect(this->getRect());
painter.setRenderHint(QPainter::Antialiasing);
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be changed to the value it had before, after calling drawPixmap (probably best to read it before calling setRenderHint rather than pushing the state).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went ahead and added QPainter::save and QPainter::restore calls around every message layout element paint in a4daddf

Copy link
Contributor Author

@dnsge dnsge Jul 5, 2024

Choose a reason for hiding this comment

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

@dnsge dnsge requested a review from Nerixyz July 5, 2024 19:44
Copy link
Contributor

@Nerixyz Nerixyz left a comment

Choose a reason for hiding this comment

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

First off: this works.

The main thing I'm/was concerned with is that we do a bit too much, since we don't really need to save for every element.

Also noticed that the button is antialiased if you reply to a message (since the reply curve is antialiased).

@dnsge
Copy link
Contributor Author

dnsge commented Jul 5, 2024

Save/restore also affects all writes to pen, brush, etc so I added it outside since it seemed like we wanted to isolate the effects to the painter from inside each message element. But we could instead have it only wherever we use render hints, which is perhaps where it really matters.

@pajlada pajlada enabled auto-merge (squash) July 7, 2024 09:16
@pajlada pajlada merged commit 8e29f75 into Chatterino:master Jul 7, 2024
16 checks passed
@dnsge dnsge deleted the dnsge/reply-button-antialiasing branch July 7, 2024 16:16
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.

4 participants