[Mono-winforms-list] [Patch] Invalidate non visible areas in scrolling

Jonathan Pobst monkey at jpobst.com
Mon Jan 21 21:37:34 EST 2008


Sure, either will work.  In the current implementation, bmp_g will never 
be null anyways, because it is instantiated when it is declared. 
However, in the future, I want to make the variable ThreadStatic so it 
is thread safe.  Then this getter will come into play.

Jon


Geoff Norton wrote:
> Jon,
> 
>   You implemented this as:
> 
>                                 if (bmp_g == null) {
>                                         bmp = new Bitmap (1, 1, 
> System.Drawing.Imaging.PixelFormat.Format32bppArgb);
>                                         bmp_g = Graphics.FromImage (bmp);
>                                 }
> 
> We should likely switch this to
> 
> if (bmp_g == null) {
>     bmp_g = Graphics.FromHwnd (IntPtr.Zero);
> }
> 
> (and rename bmp_g to root_g or some such).
> 
> Our implementation currently wont matter for this for things like dpi; 
> but device independent scaling int he future will likely work better in 
> the latter case.
> 
> Thoughts?
> 
> -g
> 
> ps> I just commited the support today for mac/x11 support of that Hwnd case
> 
> On 21-Jan-08, at 8:25 PM, Jonathan Pobst wrote:
> 
>> I just added a public property called Hwnd.GraphicsContext that is a
>> cached Graphics we keep around for measuring and such.  If you don't
>> need a specific Graphics, you can just use this one.
>>
>> Jon
>>
>>
>> Carlos Alberto Cortez wrote:
>>> Hey Chris,
>>>
>>> Attached is an updated patch that basically incorporates all the things
>>> you mentioned in your last mail:
>>>
>>> * Determines the visible rectangle, and intersects it with the required
>>> area (this is, we copy only the visible area).
>>>     - First by determining the visible area based on its size and its
>>> parents.
>>>     - Second, by looking for toplevel windows that intersect the window,
>>> and excluding that area.
>>>
>>> * Then compute the destination rectangle, by applying the
>>> XAmount/YAmount values and intersecting it with the area passed to
>>> ScrollWindow (thus we clip it as needed). This is the way Gdk does it.
>>>
>>> * Finally, exclude the destination rectangle from the total requested
>>> area, and pass it to AddExpose method.
>>>
>>> With this patch everyting is working as expected, but I have some
>>> issues:
>>>
>>> * Region needs a Graphics instance to return its Bounds, which *could*
>>> be expensive.
>>> * After taking a look at the way scrolling is done in Gdk, it *seems*
>>> that the Region implementation lack some of the functionality we need
>>> (like, returning in a simple operation the Rectangles describing the
>>> region).
>>>
>>> Comments?
>>>
>>> Carlos.
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
>>> http://lists.ximian.com/mailman/listinfo/mono-winforms-list
>>
>> _______________________________________________
>> Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-winforms-list
> 
> 
> 



More information about the Mono-winforms-list mailing list