[Mono-bugs] [Bug 383878] Region.Complement makes error with some data

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Apr 25 15:32:35 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=383878

User spouliot at novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=383878#c2





--- Comment #2 from Sebastien Pouliot <spouliot at novell.com>  2008-04-25 13:32:34 MST ---
using System;
using System.Drawing;
using System.Drawing.Drawing2D;

class Program {

        static void Main ()
        {
                Bitmap bitmap = new Bitmap (10, 10);
                Graphics graphic = Graphics.FromImage (bitmap);
                Matrix matrix = new Matrix ();

                Region clipRegion = new Region ();
                clipRegion.MakeInfinite ();

                Rectangle smaller = new Rectangle (5, 5, -10, -10);
                Rectangle bigger = new Rectangle (-5, -5, 12, 12);

                clipRegion.Intersect (smaller);
                Console.WriteLine ("INTERSECT");
                Console.WriteLine (clipRegion.IsEmpty (graphic));
                Console.WriteLine (clipRegion.IsInfinite (graphic));
                RectangleF [] rects = clipRegion.GetRegionScans (matrix);
                foreach (RectangleF rect in rects)
                        Console.WriteLine (rect);

                // this makes error in mono - linux, but not under Windows
(xp):
                clipRegion.Complement (bigger);
                Console.WriteLine ("COMPLEMENT");
                Console.WriteLine (clipRegion.IsEmpty (graphic));
                Console.WriteLine (clipRegion.IsInfinite (graphic));
                rects = clipRegion.GetRegionScans (matrix);
                foreach (RectangleF rect in rects)
                        Console.WriteLine (rect);
        }
}


Under MS/WINDOWS

INTERSECT
False
False
{X=-5,Y=-5,Width=10,Height=10}
COMPLEMENT
False
False
{X=5,Y=-5,Width=2,Height=10}
{X=-5,Y=5,Width=12,Height=2}

Under Mono/Linux

INTERSECT
True
False
COMPLEMENT
False
False
{X=-5,Y=-5,Width=12,Height=12}


The negative width and height are the probable problem in the current code
(i.e. it's considered empty by Mono's libgdiplus).


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list