diff options
author | Romain Guy <romainguy@google.com> | 2010-12-08 18:34:42 -0800 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2010-12-08 19:06:58 -0800 |
commit | a957eea78557cb47a91d44d9e6ee641c58cf1c07 (patch) | |
tree | bc6ee438bdb116feee2fef40ada876367544dcbb /tests | |
parent | 1e8b5fea90e6160f8cdd101767d0a8f6842751fd (diff) | |
download | frameworks_base-a957eea78557cb47a91d44d9e6ee641c58cf1c07.zip frameworks_base-a957eea78557cb47a91d44d9e6ee641c58cf1c07.tar.gz frameworks_base-a957eea78557cb47a91d44d9e6ee641c58cf1c07.tar.bz2 |
New, better line drawing implementation.
Bug #3207544
Bug #3225875
Change-Id: Ibdd1dfc64e01625d5c441f39eb0aa3ee647f6ff5
Diffstat (limited to 'tests')
-rw-r--r-- | tests/HwAccelerationTest/AndroidManifest.xml | 3 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/LinesActivity.java | 24 |
2 files changed, 20 insertions, 7 deletions
diff --git a/tests/HwAccelerationTest/AndroidManifest.xml b/tests/HwAccelerationTest/AndroidManifest.xml index 7f3a968..7fa71a9 100644 --- a/tests/HwAccelerationTest/AndroidManifest.xml +++ b/tests/HwAccelerationTest/AndroidManifest.xml @@ -261,8 +261,7 @@ <activity android:name="LinesActivity" - android:label="_Lines" - android:hardwareAccelerated="true"> + android:label="_Lines"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/LinesActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/LinesActivity.java index 0dc836d..6afbb01 100644 --- a/tests/HwAccelerationTest/src/com/android/test/hwui/LinesActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/LinesActivity.java @@ -36,6 +36,8 @@ public class LinesActivity extends Activity { } static class LinesView extends View { + private static final boolean LINE_AA = false; + private final Bitmap mBitmap1; private final Paint mSmallPaint; private final Paint mMediumPaint; @@ -43,6 +45,7 @@ public class LinesActivity extends Activity { private final BitmapShader mShader; private final float[] mPoints; private final Paint mAlphaPaint; + private final Paint mHairLinePaint; LinesView(Context c) { super(c); @@ -50,25 +53,30 @@ public class LinesActivity extends Activity { mBitmap1 = BitmapFactory.decodeResource(c.getResources(), R.drawable.sunset1); mSmallPaint = new Paint(); - mSmallPaint.setAntiAlias(true); + mSmallPaint.setAntiAlias(LINE_AA); mSmallPaint.setColor(0xffff0000); mSmallPaint.setStrokeWidth(1.0f); mMediumPaint = new Paint(); - mMediumPaint.setAntiAlias(true); + mMediumPaint.setAntiAlias(LINE_AA); mMediumPaint.setColor(0xff0000ff); mMediumPaint.setStrokeWidth(4.0f); mLargePaint = new Paint(); - mLargePaint.setAntiAlias(true); + mLargePaint.setAntiAlias(LINE_AA); mLargePaint.setColor(0xff00ff00); mLargePaint.setStrokeWidth(15.0f); mAlphaPaint = new Paint(); - mAlphaPaint.setAntiAlias(true); + mAlphaPaint.setAntiAlias(LINE_AA); mAlphaPaint.setColor(0x7fff0050); mAlphaPaint.setStrokeWidth(10.0f); + mHairLinePaint = new Paint(); + mHairLinePaint.setAntiAlias(LINE_AA); + mHairLinePaint.setColor(0xff0000ff); + mHairLinePaint.setStrokeWidth(0.0f); + mShader = new BitmapShader(mBitmap1, BitmapShader.TileMode.MIRROR, BitmapShader.TileMode.MIRROR); @@ -100,7 +108,7 @@ public class LinesActivity extends Activity { mSmallPaint.setAntiAlias(false); canvas.drawLine(0.0f, 0.0f, 400.0f, 0.0f, mSmallPaint); - mSmallPaint.setAntiAlias(true); + mSmallPaint.setAntiAlias(LINE_AA); canvas.drawLine(0.0f, 0.0f, 0.0f, 400.0f, mSmallPaint); canvas.drawLine(0.0f, 400.0f, 400.0f, 400.0f, mSmallPaint); @@ -110,6 +118,12 @@ public class LinesActivity extends Activity { mAlphaPaint.setShader(null); canvas.restore(); + + canvas.scale(10.0f, 10.0f); + canvas.drawLine(50.0f, 40.0f, 10.0f, 40.0f, mSmallPaint); + canvas.drawLine(10.0f, 50.0f, 50.0f, 50.0f, mSmallPaint); + canvas.drawLine(10.0f, 60.0f, 50.0f, 60.0f, mHairLinePaint); + canvas.restore(); } } } |