You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by no...@apache.org on 2011/04/06 13:33:03 UTC
svn commit: r1089405 - in /pivot/trunk/wtk/src/org/apache/pivot/wtk:
Bounds.java Container.java skin/TextPaneSkinElementView.java
Author: noelgrandin
Date: Wed Apr 6 11:33:03 2011
New Revision: 1089405
URL: http://svn.apache.org/viewvc?rev=1089405&view=rev
Log:
optimisation: reduce object allocation in painting path by adding intersect(Rectangle) method to Bounds
Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinElementView.java
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java?rev=1089405&r1=1089404&r2=1089405&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java Wed Apr 6 11:33:03 2011
@@ -147,6 +147,10 @@ public final class Bounds implements Ser
return intersect(bounds.x, bounds.y, bounds.width, bounds.height);
}
+ public Bounds intersect(java.awt.Rectangle rect) {
+ return intersect(rect.x, rect.y, rect.width, rect.height);
+ }
+
public Bounds translate(int dx, int dy) {
return new Bounds(x + dx, y + dy, width, height);
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java?rev=1089405&r1=1089404&r2=1089405&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java Wed Apr 6 11:33:03 2011
@@ -353,7 +353,7 @@ public abstract class Container extends
Bounds paintBounds = new Bounds(0, 0, getWidth(), getHeight());
Rectangle clipBounds = graphics.getClipBounds();
if (clipBounds != null) {
- paintBounds = paintBounds.intersect(new Bounds(clipBounds));
+ paintBounds = paintBounds.intersect(clipBounds);
}
// Determine if we need to paint the container, or if it's completely
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinElementView.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinElementView.java?rev=1089405&r1=1089404&r2=1089405&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinElementView.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinElementView.java Wed Apr 6 11:33:03 2011
@@ -131,7 +131,7 @@ abstract class TextPaneSkinElementView e
Bounds paintBounds = new Bounds(0, 0, getWidth(), getHeight());
Rectangle clipBounds = graphics.getClipBounds();
if (clipBounds != null) {
- paintBounds = paintBounds.intersect(new Bounds(clipBounds));
+ paintBounds = paintBounds.intersect(clipBounds);
}
for (TextPaneSkinNodeView nodeView : nodeViews) {