[Mono-winforms-list] ClipRectangles and Paint.NET

Miguel de Icaza miguel at ximian.com
Mon Apr 9 10:51:51 EDT 2007


Hey Chris!

    To optimize the rendering in Paint.NET, the application gets a list
of clipping rectangles.   

    I tried to use the get_ClipRectangles on the Hwnd class through
reflection and it works, but it returns some strange rectangles which
can make the application hang for 20-30 at a time.

    I have added some instrumentation code to look at the rectangles
returned and they seem to be out of range, and this seems to hang the
application.   Notice that the control's boundary is 212, 159:

Returning 3 rectangles for PaintDotNet.SurfaceBox that has 212,159
{X=-58655,Y=-58655,Width=59013,Height=58923}
{X=0,Y=0,Width=800,Height=600}
{X=0,Y=0,Width=212,Height=159}
Returning 2 rectangles for PaintDotNet.SurfaceBox that has 212,159
{X=-138,Y=-138,Width=267,Height=156}
{X=118,Y=7,Width=11,Height=21}

    The hang goes away if I replace the code in SystemLayer/UI.cs with
code that just returns a rectangle that is 0, 0, control.Width,
control.Height, but this is not optimal.

    I tried using "Rectangle.Intersect" with the  control.Bounds, but it
got me too much of a clipped rectangle, so I suspect am getting
rectangles that have a different origin.

    The entire code is in:

	svn+ssh://miguel@mono-cvs.ximian.com/extras/trunk/pdn3/trunk/src

Miguel.


More information about the Mono-winforms-list mailing list