summaryrefslogtreecommitdiffstats
path: root/graphics/java
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-05-12 15:45:25 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-05-12 15:45:25 -0700
commit807f23b2d8c7148cf6fc95bb88cfc2f78e4be66a (patch)
treea4ef7681cf3331f1f873bb8276f2aa867d841879 /graphics/java
parent2bb3ea162a58c0f1dddccdbe68b64e02456f11f9 (diff)
parentb10f138e125b5656e810901d14c5f956ff5d9b64 (diff)
downloadframeworks_base-807f23b2d8c7148cf6fc95bb88cfc2f78e4be66a.zip
frameworks_base-807f23b2d8c7148cf6fc95bb88cfc2f78e4be66a.tar.gz
frameworks_base-807f23b2d8c7148cf6fc95bb88cfc2f78e4be66a.tar.bz2
Merge change 1057 into donut
* changes: * Add regoin scaling for transparent support
Diffstat (limited to 'graphics/java')
-rw-r--r--graphics/java/android/graphics/Region.java33
1 files changed, 32 insertions, 1 deletions
diff --git a/graphics/java/android/graphics/Region.java b/graphics/java/android/graphics/Region.java
index 544ff4f..2b080aa 100644
--- a/graphics/java/android/graphics/Region.java
+++ b/graphics/java/android/graphics/Region.java
@@ -211,6 +211,26 @@ public class Region implements Parcelable {
*/
public native void translate(int dx, int dy, Region dst);
+ /**
+ * Scale the region by the given scale amount. This re-constructs new region by
+ * scaling the rects that this region consists of. New rectis are computed by scaling
+ * coordinates by float, then rounded by roundf() function to integers. This may results
+ * in less internal rects if 0 < scale < 1. Zero and Negative scale result in
+ * an empty region. If this region is empty, do nothing.
+ *
+ * @hide
+ */
+ public void scale(float scale) {
+ scale(scale, null);
+ }
+
+ /**
+ * Set the dst region to the result of scaling this region by the given scale amount.
+ * If this region is empty, then dst will be set to empty.
+ * @hide
+ */
+ public native void scale(float scale, Region dst);
+
public final boolean union(Rect r) {
return op(r, Op.UNION);
}
@@ -294,7 +314,16 @@ public class Region implements Parcelable {
throw new RuntimeException();
}
}
-
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null || !(obj instanceof Region)) {
+ return false;
+ }
+ Region peer = (Region) obj;
+ return nativeEquals(mNativeRegion, peer.mNativeRegion);
+ }
+
protected void finalize() throws Throwable {
nativeDestructor(mNativeRegion);
}
@@ -340,5 +369,7 @@ public class Region implements Parcelable {
private static native boolean nativeWriteToParcel(int native_region,
Parcel p);
+ private static native boolean nativeEquals(int native_r1, int native_r2);
+
private final int mNativeRegion;
}