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 the brightness and invert filters to work with premultiplied alpha. #1722

Merged
merged 1 commit into from Sep 25, 2017

Conversation

glennw
Copy link
Member

@glennw glennw commented Sep 19, 2017

Fixes #1507.
Fixes #1508.


This change is Reviewable

@glennw
Copy link
Member Author

glennw commented Sep 19, 2017

Servo/wrench tests pass OK.

@glennw
Copy link
Member Author

glennw commented Sep 21, 2017

@nical Happy to review this one too? :)

@nical
Copy link
Contributor

nical commented Sep 22, 2017

@glennw I think i am, but the gecko reftests don't look too happy. Might it be because we are making wrong assumptions in Gecko about pre-multiplication when using the bightness filter?

@glennw
Copy link
Member Author

glennw commented Sep 25, 2017

@nical Ah, I hadn't noticed the try failures. Pushed an updated version, and added several new reftests to cover the cases that Gecko tests for.

Try run (successful this time) here:

https://hg.mozilla.org/try/rev/bf466f065c0db5379a707e459ca184357f792544
https://treeherder.mozilla.org/#/jobs?repo=try&revision=bf466f065c0db5379a707e459ca184357f792544

vec4 color = mix(Cs, vec4(Cs.a) - vec4(Cs.rgb, 0.0), amount);

// Pre-multiply the alpha into the output value.
return vec4(color.rgb * clamp(color.a, 0.0, 1.0), color.a);
Copy link
Contributor

Choose a reason for hiding this comment

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

color is already premultiplied; here you're multiplying it a second time. Your yaml reftest doesn't catch it because it uses a black result, and multiplying black one more time still stays black.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, I guess we don't have an (enabled) gecko reftest that catches that either. Will add a specific reftest for this to wrench.

@glennw
Copy link
Member Author

glennw commented Sep 25, 2017

@mstange Switched the invert to do a normal un/pre-multiply and added a reftest with alpha. Does that look right to you?

@mstange
Copy link
Contributor

mstange commented Sep 25, 2017

Yes, looks good now. It took me a second to understand the test; I assume you're putting transparent blue on top of opaque blue in order to avoid the need to fuzz?

@glennw
Copy link
Member Author

glennw commented Sep 25, 2017

Yep, thanks.

r? @nical or @kvark

@nical
Copy link
Contributor

nical commented Sep 25, 2017

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit 3a09624 has been approved by nical

@bors-servo
Copy link
Contributor

⌛ Testing commit 3a09624 with merge c8c515d...

bors-servo pushed a commit that referenced this pull request Sep 25, 2017
Fix the brightness and invert filters to work with premultiplied alpha.

Fixes #1507.
Fixes #1508.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1722)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

☀️ Test successful - status-travis
Approved by: nical
Pushing c8c515d to master...

@bors-servo bors-servo merged commit 3a09624 into servo:master Sep 25, 2017
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

5 participants