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

Premultiply gradient stop colors #1250

Merged
merged 1 commit into from May 15, 2017
Merged

Conversation

@eqrion
Copy link
Contributor

eqrion commented May 12, 2017

CSS gradient stop colors are interpolated in premultiplied space.
Currently we assume that color stops that are passed in are
premultiplied, but because it's needed in both Servo and Gecko, it makes
sense to do the premultiplication in WebRender and expose a straight
alpha color like the rest of the API does.

The premultiplication is purposefully not done in DisplayListBuilder
to prevent it from being saved for replay and then premultiplied again
when we replay the display list.


This change is Reviewable

CSS gradient stop colors are interpolated in premultiplied space.
Currently we assume that color stops that are passed in are
premultiplied, but because it's needed in both Servo and Gecko, it makes
sense to do the premultiplication in WebRender and expose a straight
alpha color like the rest of the API does.

The premultiplication is purposefully not done in DisplayListBuilder
to prevent it from being saved for replay and then premultiplied again
when we replay the display list.
@eqrion
Copy link
Contributor Author

eqrion commented May 12, 2017

r? @glennw @kvark
cc @pyfisch

This is for #1219

Note: this was done on the Gecko side before, but Servo needs it too, so I think it makes sense to make the API less confusing and move the work here.

@kvark
Copy link
Member

kvark commented May 12, 2017

Since we are using premultiplied alpha for gradients, shouldn't we also change the blending mode used for rendering of them?

@eqrion
Copy link
Contributor Author

eqrion commented May 13, 2017

Sorry, forgot to respond. The gradients should be using a premultiplied alpha blend mode, as before. The change here is to make the API expect unpremultiplied alpha, instead of expecting the client to premultiply the stops.

@kvark
Copy link
Member

kvark commented May 15, 2017

@bors-servo
Copy link
Contributor

bors-servo commented May 15, 2017

📌 Commit a51628b has been approved by kvark

bors-servo added a commit that referenced this pull request May 15, 2017
Premultiply gradient stop colors

CSS gradient stop colors are interpolated in premultiplied space.
Currently we assume that color stops that are passed in are
premultiplied, but because it's needed in both Servo and Gecko, it makes
sense to do the premultiplication in WebRender and expose a straight
alpha color like the rest of the API does.

The premultiplication is purposefully not done in DisplayListBuilder
to prevent it from being saved for replay and then premultiplied again
when we replay the display list.

<!-- 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/1250)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented May 15, 2017

Testing commit a51628b with merge 7f37799...

@bors-servo
Copy link
Contributor

bors-servo commented May 15, 2017

☀️ Test successful - status-travis
Approved by: kvark
Pushing 7f37799 to master...

@bors-servo bors-servo merged commit a51628b into servo:master May 15, 2017
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@eqrion eqrion deleted the eqrion:gradient-premultiply branch May 15, 2017
@eqrion
Copy link
Contributor Author

eqrion commented May 15, 2017

@kvark Thanks!

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

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.