Revision: 1008
Author: allain.lalonde
Date: Sat Apr 17 05:36:49 2010
Log: Removing unnecessary local variables from validateFullBounds.
http://code.google.com/p/piccolo2d/source/detail?r=1008

Modified:
 /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PNode.java

=======================================
--- /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PNode.java Thu Apr 15 19:27:24 2010 +++ /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PNode.java Sat Apr 17 05:36:49 2010
@@ -1902,22 +1902,15 @@
// bounds cache here after our own bounds and the children's bounds
             // have been computed above.
             if (fullBoundsInvalid) {
-                final double oldX = fullBoundsCache.x;
-                final double oldY = fullBoundsCache.y;
-                final double oldWidth = fullBoundsCache.width;
-                final double oldHeight = fullBoundsCache.height;
-                final boolean oldEmpty = fullBoundsCache.isEmpty();
-
                 // 6. This will call getFullBoundsReference on all of the
                 // children. So if the above
                 // layoutChildren method changed the bounds of any of the
                 // children they will be
                 // validated again here.
+                PBounds oldFullBoundsCache = fullBoundsCache;
                 fullBoundsCache = computeFullBounds(fullBoundsCache);

- final boolean fullBoundsChanged = fullBoundsCache.x != oldX || fullBoundsCache.y != oldY - || fullBoundsCache.width != oldWidth || fullBoundsCache.height != oldHeight
-                        || fullBoundsCache.isEmpty() != oldEmpty;
+ final boolean fullBoundsChanged = !oldFullBoundsCache.equals(fullBoundsCache);

// 7. If the new full bounds cache differs from the previous
                 // cache then
@@ -1928,14 +1921,16 @@
                     if (parent != null) {
                         parent.invalidateFullBounds();
                     }
+
firePropertyChange(PROPERTY_CODE_FULL_BOUNDS, PROPERTY_FULL_BOUNDS, null, fullBoundsCache);

// 8. If our paint was invalid make sure to repaint our old
                     // full bounds. The
// new bounds will be computed later in the validatePaint
                     // pass.
-                    if (paintInvalid && !oldEmpty) {
- TEMP_REPAINT_BOUNDS.setRect(oldX, oldY, oldWidth, oldHeight);
+                    if (paintInvalid && !oldFullBoundsCache.isEmpty()) {
+ TEMP_REPAINT_BOUNDS.setRect(oldFullBoundsCache.x, oldFullBoundsCache.getY(), oldFullBoundsCache + .getWidth(), oldFullBoundsCache.getHeight());
                         repaintFrom(TEMP_REPAINT_BOUNDS, this);
                     }
                 }

--
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en

Reply via email to