/[classpath]/classpath/javax/swing/JComponent.java
ViewVC logotype

Diff of /classpath/javax/swing/JComponent.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.65 by rabbit78, Fri Oct 7 11:21:41 2005 UTC revision 1.66 by rabbit78, Mon Oct 10 08:53:27 2005 UTC
# Line 380  public abstract class JComponent extends Line 380  public abstract class JComponent extends
380    
381    private TransferHandler transferHandler;    private TransferHandler transferHandler;
382    
383      /**
384       * A cached Rectangle object to be reused. Be careful when you use that,
385       * so that it doesn't get modified in another context within the same
386       * method call chain.
387       */
388      private static transient Rectangle rectCache;
389    
390    /**    /**
391     * A lock held during recursive painting; this is used to serialize     * A lock held during recursive painting; this is used to serialize
392     * access to the double buffer, and also to select the "top level"     * access to the double buffer, and also to select the "top level"
# Line 1514  public abstract class JComponent extends Line 1521  public abstract class JComponent extends
1521    protected void paintChildren(Graphics g)    protected void paintChildren(Graphics g)
1522    {    {
1523      Shape originalClip = g.getClip();      Shape originalClip = g.getClip();
1524      Rectangle inner = SwingUtilities.calculateInnerArea(this, new Rectangle());      Rectangle inner = SwingUtilities.calculateInnerArea(this, rectCache);
1525      g.clipRect(inner.x, inner.y, inner.width, inner.height);      g.clipRect(inner.x, inner.y, inner.width, inner.height);
1526      Component[] children = getComponents();      Component[] children = getComponents();
1527      for (int i = children.length - 1; i >= 0; --i)      for (int i = children.length - 1; i >= 0; --i)
# Line 1522  public abstract class JComponent extends Line 1529  public abstract class JComponent extends
1529          if (!children[i].isVisible())          if (!children[i].isVisible())
1530            continue;            continue;
1531    
1532          Rectangle bounds = children[i].getBounds();          Rectangle bounds = children[i].getBounds(rectCache);
1533          Rectangle oldClip = g.getClipBounds();          Rectangle oldClip = g.getClipBounds();
1534          if (oldClip == null)          if (oldClip == null)
1535            oldClip = bounds;            oldClip = bounds;
1536    
1537          Rectangle clip = oldClip.intersection(bounds);          if (g.hitClip(bounds.x, bounds.y, bounds.width, bounds.height))
         if (clip.isEmpty())  
1538            continue;            continue;
1539          boolean translated = false;          boolean translated = false;
1540          try          try
1541            {            {
1542              g.setClip(clip.x, clip.y, clip.width, clip.height);              g.clipRect(bounds.x, bounds.y, bounds.width, bounds.height);
1543              g.translate(bounds.x, bounds.y);              g.translate(bounds.x, bounds.y);
1544              translated = true;              translated = true;
1545              children[i].paint(g);              children[i].paint(g);

Legend:
Removed from v.1.65  
changed lines
  Added in v.1.66

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26