Join GitHub today
support color masking of images #2969
This is to help support the necessary fixes for Gecko bug https://bugzilla.mozilla.org/show_bug.cgi?id=1479196
Tofu glyphs will be drawn out of an atlas, and to avoid the need to have to generate a new atlas for every single color or opacity combination, this just allows push_image to specify a color which can then be used for masking or opacity.
Most of the plumbing is already there, just some parameters need to be added to support this.
let prim_header_index = prim_headers.push(&prim_header, [ uv_rect_address.as_int(), (ShaderColorMode::Image as i32) << 16 |
How did this used to work previously and why do we need to change it now on types other than images?
This basically looks good, but I'm somewhat confused about the shader color mode change on some of the batching code. If I'm reading it correctly it looks like it was wrong previously, and is now right? But if so, how come we don't have test failures from those? I feel like I'm mis-reading part of the patch :)
We'll also need a try run before merging.
It worked previously because we always passed in the premultiplied color white to the shader. The old shader color mode only accessed color.a, which if you squint at it, behaves exactly the same as the premultiplied color white, but would break if any other color was passed. So I had to change the color mode to access the RGB components of the color as well, not just the alpha component.