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

Image masks and rounded clips not respected on text #1765

Closed
mstange opened this issue Sep 27, 2017 · 6 comments
Closed

Image masks and rounded clips not respected on text #1765

mstange opened this issue Sep 27, 2017 · 6 comments

Comments

@mstange
Copy link
Contributor

@mstange mstange commented Sep 27, 2017

https://bugzilla.mozilla.org/show_bug.cgi?id=1403333

The text in this testcase is drawn without any fade-out effect:

---
root:
  items:
    - type: clip
      id: 1
      bounds: [0, 0, 240, 50]
      image-mask:
        image: "linear-gradient.png"
        rect: [0, 0, 240, 50]
        repeat: false
    - type: rect
      bounds: [0, 0, 240, 50]
      color: blue
      "clip-and-scroll": 1
    - bounds: [0, 0, 240, 50]
      glyphs: [55, 75, 76, 86, 3, 76, 86, 3, 87, 75, 72, 3, 69, 72, 86, 87]
      offsets: [16, 33, 35.533333, 33, 51.533333, 33, 60.4, 33, 72.833336, 33, 80.833336, 33, 89.7, 33, 102.13333, 33, 110.13333, 33, 119, 33, 135, 33, 149.2, 33, 157.2, 33, 173.2, 33, 187.4, 33, 196.26666, 33]
      size: 18
      color: black
      font: "../text/VeraBd.ttf"
      "clip-and-scroll": 1

Save to wrench/reftests/mask/text.yaml, and add this image with the name linear-gradient.png next to it: linear-gradient.png <img width="502" alt="screen shot 2017-09-27 at 5 20 28 pm" src="https://user-images.githubusercontent.com/961291/30938505-349cca84-a3a8-11e7-8a42-83e7a8fcf087.png">

Screenshot:
screen shot 2017-09-27 at 5 20 28 pm

You can see that the blue rectangle respects the mask but the text does not.

@mstange mstange changed the title Image masks not respected on text Image masks and rounded clips not respected on text Sep 27, 2017
@mstange
Copy link
Contributor Author

@mstange mstange commented Sep 27, 2017

Text also doesn't appear to respect rounded clip rects. So the testcase can probably be a lot simpler.

@glennw
Copy link
Member

@glennw glennw commented Sep 28, 2017

We need to draw subpixel text that has a clip mask with a different blend mode. I'm going to hold off on this until the text-related work that @lsalzman is doing lands, so we don't conflict.

@mstange
Copy link
Contributor Author

@mstange mstange commented Oct 10, 2017

@lsalzman's work has landed, so this is can now be worked on, I think.

@glennw
Copy link
Member

@glennw glennw commented Oct 11, 2017

Yup, I will start on this once #1811 and #1839 are resolved.

@mstange
Copy link
Contributor Author

@mstange mstange commented Oct 13, 2017

#1855 fixed this for black text but causes buggy rendering with brighter text.

I've created a testcase at http://tests.themasta.com/text-masking.zip that renders text with a fade-out mask with different text colors:
screen shot 2017-10-13 at 5 51 02 pm

You can see that, the brighter the text is, the more a low alpha value is counted as "draw this text as extra opaque white" instead of "draw this text at a given alpha".

@glennw
Copy link
Member

@glennw glennw commented Oct 17, 2017

@mstange Thanks for the test case! Fix is #1886.

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

Successfully merging a pull request may close this issue.

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