Bug 17242 - Do cairo_mask on a rgba source produces wrong result
Summary: Do cairo_mask on a rgba source produces wrong result
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: image backend (show other bugs)
Version: 1.6.0
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Carl Worth
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-21 06:43 UTC by david_wu
Modified: 2008-09-28 09:54 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
testing sample code (1.33 KB, text/x-c++src)
2008-08-21 06:43 UTC, david_wu
Details

Description david_wu 2008-08-21 06:43:03 UTC
Created attachment 18451 [details]
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))
Comment 1 Chris Wilson 2008-08-21 18:41:56 UTC
I am able to reproduce the bug with 1.6.4 and it is gone in master. Inspection and bisection point towards the solid pattern cache.
Comment 2 Chris Wilson 2008-09-28 09:54:09 UTC
1.8.0 has been released and this regression has been fixed - thanks for the bug report!


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.