[cairo-bugs] [Bug 17242] New: Do cairo_mask on a rgba source produces wrong result

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Aug 21 06:43:16 PDT 2008


http://bugs.freedesktop.org/show_bug.cgi?id=17242

           Summary: Do cairo_mask on a rgba source produces wrong result
           Product: cairo
           Version: 1.6.0
          Platform: x86 (IA32)
        OS/Version: Linux (All)
            Status: NEW
          Severity: normal
          Priority: medium
         Component: image backend
        AssignedTo: cworth at cworth.org
        ReportedBy: david_wu at cyberlink.com
         QAContact: cairo-bugs at cairographics.org


Created an attachment (id=18451)
 --> (http://bugs.freedesktop.org/attachment.cgi?id=18451)
testing sample code

The following sequence produces wrong masked color:

        cairo_t* cr = cairo_create(target);

        cairo_set_source_surface(cr, source, 0, 0);
        cairo_paint_with_alpha(cr, alpha);

        cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, alpha);
        cairo_mask_surface(cr, mask, 0, 0);

where target, source, and mask are image surfaces, and alpha is an arbitrary
value other than 1.0.
For example, when data is as follows:

        uchar sourceWhite[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff };
        uchar maskA8[] = { 0x00,0xff,0x00,0x00 };
        double alpha = 0.5;

we will get this result in target surface: 80808080404040C0 while the expected
should be: 80808080C0C0C0C0.


Please see the attached for a sample code.
(compile command was: g++ -Wall -ffast-math -g `pkg-config --cflags --libs
cairo` cairo_mask.cpp
 g++ version: g++ (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu7))


-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the cairo-bugs mailing list