Bug 324503 (MONO81828) - Alpha values in TextureBrush'es are incorrectly used
Summary: Alpha values in TextureBrush'es are incorrectly used
Status: RESOLVED FIXED
Alias: MONO81828
Product: Mono: Class Libraries
Classification: Mono
Component: libgdiplus (show other bugs)
Version: unspecified
Hardware: Other All
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Mono Bugs
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-07 19:00 UTC by Yves Bastide
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
C# program exhibiting the bug (973 bytes, text/plain)
2007-06-07 19:01 UTC, Thomas Wiest
Details
patch (5.72 KB, patch)
2007-07-06 23:51 UTC, Thomas Wiest
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 20:41:06 UTC


---- Reported by doc.formatique@gmail.com 2007-06-07 12:00:00 MST ----

Description of Problem:

Alpha values in TextureBrush'es are incorrectly used.

Steps to reproduce the problem:

1. Draw a solid background.
2. Draw a white rectangle with alpha:
            g.FillRectangle(new SolidBrush(Color.FromArgb(128, 255, 255,
255)), ...)
3. Draw another rectangle with a TextureBrush generated from a bitmap
identically filled:

            Bitmap bm_for_brush = new Bitmap(1, 1);
            bm_for_brush.SetPixel(0, 0, Color.FromArgb(128, 255, 255, 255));
            TextureBrush tb = new TextureBrush(bm_for_brush);
            g.FillRectangle(tb, ...);


Actual Results:

The colors are different.

Expected Results:

The colors should be the same.

Additional Information:

Isn't this a missing-alpha-pre-multiply bug (like #80323 and #79297)?
Tracing the program, _cairo_pixman_composite_src_8888x8888mmx receives
*src=0x80ffffff while the equivalent pycairo program passes 0x80808080



---- Additional Comments From doc.formatique@gmail.com 2007-06-07 12:01:39 MST ----

Created an attachment (id=172114)
C# program exhibiting the bug




---- Additional Comments From sebastien@ximian.com 2007-07-06 09:34:32 MST ----

Yes, it's a (lack of) premultiplication bug. It's easy to fix in
texture brush but that seems like the wrong place to make that fix.

Generalizing the fix (gdip_bitmap_ensure_surface seems the right
candidate) is not much harder but will require much more test (and
will have to wait after my vacations).




---- Additional Comments From sebastien@ximian.com 2007-07-06 16:51:00 MST ----

Created an attachment (id=172115)
patch




---- Additional Comments From sebastien@ximian.com 2007-07-06 16:54:02 MST ----

Attached is an incomplete(*) patch that fix the issue without
regression in the test suite. More testing is required before
committing it into SVN (but that'll be later).

(*) it only handles WrapModeTile, not the other modes (but that's not
the problematic part ;-)



---- Additional Comments From sebastien@ximian.com 2007-07-30 12:15:18 MST ----

Fixed in SVN r82997. Unit tests in r82999.

Note that this fix will not be part of the upcoming Mono 1.2.5 because
it needs some "in the wild" testing to ensure no regression has occurred.

Imported an attachment (id=172114)
Imported an attachment (id=172115)