summaryrefslogtreecommitdiffstats
path: root/tests/HwAccelerationTest
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2014-07-18 13:48:09 -0700
committerChris Craik <ccraik@google.com>2014-07-19 00:13:59 +0000
commit31ba192dd201df2cad96a8c503f730130ab0d80f (patch)
tree6c2be2ad287e826bf2f7f7fc6316b55c2fd36834 /tests/HwAccelerationTest
parent5552cc5c9dd111c5fb1db512240b5daf15866c88 (diff)
downloadframeworks_base-31ba192dd201df2cad96a8c503f730130ab0d80f.zip
frameworks_base-31ba192dd201df2cad96a8c503f730130ab0d80f.tar.gz
frameworks_base-31ba192dd201df2cad96a8c503f730130ab0d80f.tar.bz2
Tweaks to outline API
b/15283203 b/16142564 Remove boolean return value chaining, as it's redundant with the data in the Outline itself. Change-Id: I3116e57cd1b35c98b74e95195117edd7e39fb2df
Diffstat (limited to 'tests/HwAccelerationTest')
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/ClipOutlineActivity.java25
1 files changed, 16 insertions, 9 deletions
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/ClipOutlineActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/ClipOutlineActivity.java
index af448e8..23bb6b4 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/ClipOutlineActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/ClipOutlineActivity.java
@@ -25,6 +25,8 @@ import android.graphics.Outline;
import android.graphics.Path;
import android.graphics.Rect;
import android.os.Bundle;
+import android.view.View;
+import android.view.ViewOutlineProvider;
import android.widget.FrameLayout;
import android.widget.TextView;
@@ -58,11 +60,23 @@ public class ClipOutlineActivity extends Activity {
public static class RegionView extends FrameLayout {
private float mClipPosition = 0.0f;
- private Outline mOutline = new Outline();
private Rect mRect = new Rect();
public RegionView(Context c) {
super(c);
+ setOutlineProvider(new ViewOutlineProvider() {
+
+ @Override
+ public void getOutline(View view, Outline outline) {
+ int w = getWidth() / 2;
+ int h = getHeight() / 2;
+
+ mRect.set(0, 0, w, h);
+ mRect.offset((int) (mClipPosition * w), getHeight() / 4);
+
+ outline.setRoundRect(mRect, w / 2);
+ }
+ });
setClipToOutline(true);
}
@@ -72,14 +86,7 @@ public class ClipOutlineActivity extends Activity {
public void setClipPosition(float clipPosition) {
mClipPosition = clipPosition;
- int w = getWidth() / 2;
- int h = getHeight() / 2;
-
- mRect.set(0, 0, w, h);
- mRect.offset((int) (clipPosition * w), getHeight() / 4);
- mOutline.setRoundRect(mRect, w / 2);
- setOutline(mOutline);
- invalidate();
+ invalidateOutline();
}
}