diff options
Diffstat (limited to 'tests/HwAccelerationTest/src/com')
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java | 17 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/TransparentListActivity.java | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java index f8422f4..90db818 100644 --- a/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java @@ -193,6 +193,7 @@ public class GradientsActivity extends Activity { private final float mDrawWidth; private final float mDrawHeight; private final LinearGradient mGradient; + private final LinearGradient mGradientStops; private final Matrix mMatrix; ShadersView(Context c) { @@ -202,6 +203,9 @@ public class GradientsActivity extends Activity { mDrawHeight = 200; mGradient = new LinearGradient(0, 0, 0, 1, 0xFF000000, 0, Shader.TileMode.CLAMP); + mGradientStops = new LinearGradient(0, 0, 0, 1, + new int[] { 0xFFFF0000, 0xFF00FF00, 0xFF0000FF }, null, Shader.TileMode.CLAMP); + mMatrix = new Matrix(); mPaint = new Paint(); @@ -255,6 +259,19 @@ public class GradientsActivity extends Activity { mGradient.setLocalMatrix(mMatrix); canvas.drawRect(left, top, left + mDrawWidth, bottom, mPaint); + right = left + mDrawWidth; + left = 40.0f; + top = bottom + 20.0f; + bottom = top + 50.0f; + + mPaint.setShader(mGradientStops); + + mMatrix.setScale(1, mDrawWidth); + mMatrix.postRotate(90); + mMatrix.postTranslate(right, top); + mGradientStops.setLocalMatrix(mMatrix); + canvas.drawRect(left, top, right, bottom, mPaint); + canvas.restore(); } } diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/TransparentListActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/TransparentListActivity.java index 763169a..535f865 100644 --- a/tests/HwAccelerationTest/src/com/android/test/hwui/TransparentListActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/TransparentListActivity.java @@ -79,7 +79,7 @@ public class TransparentListActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - getWindow().setBackgroundDrawable(getResources().getDrawable(R.drawable.default_wallpaper)); + getWindow().setBackgroundDrawable(getResources().getDrawable(R.drawable.gradient)); setContentView(R.layout.list_activity); ListAdapter adapter = new SimpleListAdapter(this); |