[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cp-patches] FYI: Fixed Swing painting (again)
From: |
Roman Kennke |
Subject: |
Re: [cp-patches] FYI: Fixed Swing painting (again) |
Date: |
Mon, 26 Sep 2005 11:50:43 +0200 |
Hi Mark,
Am Sonntag, den 25.09.2005, 23:38 +0200 schrieb Mark Wielaard:
> Hi Roman,
>
>
> > 2005-09-22 Roman Kennke <address@hidden>
> >
> > * javax/swing/JComponent.java
> > (paintChildren): If a child component is invisible, skip it.
> > Handle the (rare) case when no clip is set as if it's set to the
> > child component's bounds. These fixes should make Swing working
> > again as before.
> > [...]
> > Rectangle bounds = children[i].getBounds();
> > Rectangle oldClip = g.getClipBounds();
> > + if (oldClip == null)
> > + oldClip = bounds;
>
> And later you do:
>
> g.setClip(oldClip);
>
> Even when oldClip was originally null.
This is 100% ok. Handling of Graphics objects should be symetrically:
1. If you get a Graphics as parameter and set a clip, then the clip
should be reset to the orignal state when the method leaves, setting it
to null should be ok here.
2. When a Graphics object is aquired via Component.getGraphics or
Image.getGraphics, then it should be disposed in the same method after
all drawing is completed
3. #1 also applies for all other Graphics state like Color, Font,
Translation, etc
/Roman
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil