diff options
author | Romain Guy <romainguy@google.com> | 2011-03-14 18:21:21 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-03-14 18:21:21 -0700 |
commit | 8329db39f2f55484352d58b1820eb31a22698f11 (patch) | |
tree | 10bbdf4e30a7754b144a7bff01e3266f57ea3cdb /tests | |
parent | 29ef11f52e5cc610181d0d5aa2e14c2b78d200b8 (diff) | |
parent | b245e31fa8dd1ad6a59ccf858154f3c7b92e0eb8 (diff) | |
download | frameworks_base-8329db39f2f55484352d58b1820eb31a22698f11.zip frameworks_base-8329db39f2f55484352d58b1820eb31a22698f11.tar.gz frameworks_base-8329db39f2f55484352d58b1820eb31a22698f11.tar.bz2 |
am b245e31f: am ee7ace06: Merge "Fix rendering artifact in edge fades. Bug #4092053" into honeycomb-mr1
* commit 'b245e31fa8dd1ad6a59ccf858154f3c7b92e0eb8':
Fix rendering artifact in edge fades. Bug #4092053
Diffstat (limited to 'tests')
3 files changed, 40 insertions, 1 deletions
diff --git a/tests/HwAccelerationTest/res/drawable/gradient.xml b/tests/HwAccelerationTest/res/drawable/gradient.xml new file mode 100644 index 0000000..756db0b --- /dev/null +++ b/tests/HwAccelerationTest/res/drawable/gradient.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2010 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <gradient + android:startColor="#FF707070" + android:endColor="#FF0C0C0C" + android:angle="270" /> +</shape> 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); |