ICO: Handle 0RGB format#3012
Conversation
|
I don't understand that this alone is how it works, from the description.
Rather, this seems to be the detection mechanism. Indeed, it is allowed but dubious to use an image color for a masked-away pixel as in the last line of the table:
|
|
That is: alpha-blended images are an evolution on 0RGB images and Windows has learned to interpret the 'dubious' row of the above table to do true blending but the mask for all of this would still follow in the mask. What's confusing to me here is that this only matters for compositing onto existing data. Or put another way: which of DI_NORMAL, DI_IMAGE, DI_MASK do we want to do? |
|
Ahh, I messed up. 0RGB has nothing to do with AND mask, so the detection should be done unconditionally. I think this is also where your questions about the mask come from. To quote from part 2:
So 0RGB is just a color format like R5G6B5. |
While reviewing #3002, I realized that we don't decode 0RGB BMPs correctly.
See https://devblogs.microsoft.com/oldnewthing/20101021-00/?p=12483
Not only did we not apply the AND mask for 0RGB, we also didn't ignore the all-zero fourth channel.
This PR fixes this by (1) detecting 0RGB, (2) fixing up the alpha channel for 0RGB, and (3) applying the AND mask for 0RGB.
I added a test image for this that is either fully transparent or shows the word "BAD" when decoded incorrectly (depending on how incorrectly it is decoded) and a happy white smiley when decoded correctly.
I also added a reference for the image added in #3002, because our dumb test infra still doesn't detect this.