[PATCH] d2d1/tests: Adjust a color to prevent test failures.

Henri Verbeet hverbeet at gmail.com
Mon Mar 23 11:32:03 CDT 2020

On Mon, 23 Mar 2020 at 03:42, Zebediah Figura <z.figura12 at gmail.com> wrote:
> Different drivers may produce either #ff7f00 or #ff8000 here, both on Windows
> and Linux.
It should be noted that 0x80 is actually the reasonable way to
quantise 0.5f. (I.e., 0.5 * 255 = 127.5, which rounds to 128 both when
rounding to nearest even and when rounding half either towards +∞, or
away from 0. Other rounding modes exist of course, but would be much
more unusual.) Nevertheless, using 0.5f is asking for problems when
you need exact results; use either 127.0f / 255.0f for 0x7f, or 128.0f
/ 255.0f for 0x80.

> Perhaps better would be to avoid depending on pixel-exact color, but it's not
> clear to me what the preferred way of doing that is.
It depends on what you're trying to test. For tests like these, exact
colours should be achievable simply by picking reasonable inputs. For
things involving more complex calculations like e.g. blending and/or
texturing we can probe specific parts of the result with
get_readback_colour() + compare_colour(). For cases where we care more
about the general shape of the result, there's compare_figure().

More information about the wine-devel mailing list