aboutsummaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes/javax
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-10-16 14:28:27 +0200
committerSven Gothel <[email protected]>2013-10-16 14:28:27 +0200
commitb831ebadcaea1eea7370f7ec0bffc59eaba7a5ba (patch)
treeda1bbe7671b27db55859b5beb9dc0fe6fc750e3b /src/nativewindow/classes/javax
parent12d1142d197afb17828056252282fb5a6186b325 (diff)
Add efficient set(..all..) to Dimension, Insets, Point and Rectangle of NativeWindow's util types.
Diffstat (limited to 'src/nativewindow/classes/javax')
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java16
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/util/Insets.java11
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/util/Point.java11
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java11
4 files changed, 30 insertions, 19 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java b/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java
index b52414146..17b4930c5 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java
@@ -58,22 +58,26 @@ public class Dimension implements Cloneable, DimensionImmutable {
}
@Override
- public int getWidth() { return width; }
+ public final int getWidth() { return width; }
@Override
- public int getHeight() { return height; }
+ public final int getHeight() { return height; }
- public void setWidth(int width) {
+ public final void set(int width, int height) {
+ this.width = width;
+ this.height = height;
+ }
+ public final void setWidth(int width) {
this.width = width;
}
- public void setHeight(int height) {
+ public final void setHeight(int height) {
this.height = height;
}
- public Dimension scale(int s) {
+ public final Dimension scale(int s) {
width *= s;
height *= s;
return this;
}
- public Dimension add(Dimension pd) {
+ public final Dimension add(Dimension pd) {
width += pd.width ;
height += pd.height ;
return this;
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java b/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java
index f22668f55..942c12c2b 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java
@@ -70,10 +70,13 @@ public class Insets implements Cloneable, InsetsImmutable {
@Override
public final int getTotalHeight() { return t + b; }
- public void setLeftWidth(int left) { l = left; }
- public void setRightWidth(int right) { r = right; }
- public void setTopHeight(int top) { t = top; }
- public void setBottomHeight(int bottom) { b = bottom; }
+ public final void set(int left, int right, int top, int bottom) {
+ l = left; r = right; t = top; b = bottom;
+ }
+ public final void setLeftWidth(int left) { l = left; }
+ public final void setRightWidth(int right) { r = right; }
+ public final void setTopHeight(int top) { t = top; }
+ public final void setBottomHeight(int bottom) { b = bottom; }
@Override
public boolean equals(Object obj) {
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Point.java b/src/nativewindow/classes/javax/media/nativewindow/util/Point.java
index a30d3030e..4c233bb16 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/Point.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/Point.java
@@ -99,22 +99,23 @@ public class Point implements Cloneable, PointImmutable {
return new String( x + " / " + y );
}
- public void setX(int x) { this.x = x; }
- public void setY(int y) { this.y = y; }
+ public final void set(int x, int y) { this.x = x; this.y = y; }
+ public final void setX(int x) { this.x = x; }
+ public final void setY(int y) { this.y = y; }
- public Point translate(Point pd) {
+ public final Point translate(Point pd) {
x += pd.x ;
y += pd.y ;
return this;
}
- public Point translate(int dx, int dy) {
+ public final Point translate(int dx, int dy) {
x += dx ;
y += dy ;
return this;
}
- public Point scale(int sx, int sy) {
+ public final Point scale(int sx, int sy) {
x *= sx ;
y *= sy ;
return this;
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java b/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java
index 7576f4ec7..bbbfa2932 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java
@@ -68,6 +68,12 @@ public class Rectangle implements Cloneable, RectangleImmutable {
@Override
public final int getHeight() { return height; }
+ public final void set(int x, int y, int width, int height) {
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
+ }
public final void setX(int x) { this.x = x; }
public final void setY(int y) { this.y = y; }
public final void setWidth(int width) { this.width = width; }
@@ -100,10 +106,7 @@ public class Rectangle implements Cloneable, RectangleImmutable {
y1 = Math.min(y1, vp.getY());
y2 = Math.max(y2, vp.getY() + vp.getHeight());
}
- setX(x1);
- setY(y1);
- setWidth(x2 - x1);
- setHeight(y2 - y1);
+ set(x1, y1, x2 - x1, y2 - y1);
return this;
}