From: Søren Sandmann Pedersen <s...@redhat.com> In the component alpha part of the PDF_SEPARABLE_BLEND_MODE macro, the expression ~RED_8 (m) is used. Because RED_8(m) gets promoted to int before ~ is applied, the whole expression typically becomes some negative value rather than (255 - RED_8(m)) as desired.
Fix this by using unsigned temporary variables. This reduces the number of failures in pixel-test to 363. --- pixman/pixman-combine32.c | 11 ++++++++--- test/blitters-test.c | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pixman/pixman-combine32.c b/pixman/pixman-combine32.c index 977c057..01c2523 100644 --- a/pixman/pixman-combine32.c +++ b/pixman/pixman-combine32.c @@ -640,13 +640,18 @@ combine_multiply_ca (pixman_implementation_t *imp, uint8_t da = ALPHA_8 (d); \ uint8_t ida = ~da; \ int32_t ra, rr, rg, rb; \ + uint8_t ira, iga, iba; \ \ combine_mask_ca (&s, &m); \ \ + ira = ~RED_8 (m); \ + iga = ~GREEN_8 (m); \ + iba = ~BLUE_8 (m); \ + \ ra = da * 0xff + ALPHA_8 (s) * 0xff - ALPHA_8 (s) * da; \ - rr = (~RED_8 (m)) * RED_8 (d) + ida * RED_8 (s); \ - rg = (~GREEN_8 (m)) * GREEN_8 (d) + ida * GREEN_8 (s); \ - rb = (~BLUE_8 (m)) * BLUE_8 (d) + ida * BLUE_8 (s); \ + rr = ira * RED_8 (d) + ida * RED_8 (s); \ + rg = iga * GREEN_8 (d) + ida * GREEN_8 (s); \ + rb = iba * BLUE_8 (d) + ida * BLUE_8 (s); \ \ rr += blend_ ## name (RED_8 (d), da, RED_8 (s), RED_8 (m)); \ rg += blend_ ## name (GREEN_8 (d), da, GREEN_8 (s), GREEN_8 (m)); \ diff --git a/test/blitters-test.c b/test/blitters-test.c index ac8901f..e2a2e7f 100644 --- a/test/blitters-test.c +++ b/test/blitters-test.c @@ -394,6 +394,6 @@ main (int argc, const char *argv[]) } return fuzzer_test_main("blitters", 2000000, - 0x613BBD64, + 0xB1D1F40E, test_composite, argc, argv); } -- 1.8.3.1 _______________________________________________ Pixman mailing list Pixman@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pixman