diff options
author | Romain Guy <romainguy@google.com> | 2010-07-21 21:33:20 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2010-07-21 21:33:20 -0700 |
commit | 694b519ac647fe998fd396fe0784cc8e179aadc4 (patch) | |
tree | 80a5e423f90aba3ab74645ac7f3b2cbfd838c757 /tests/HwAccelerationTest | |
parent | 0119ba5bd3335fe026927eeb65de535a7bd8c838 (diff) | |
download | frameworks_base-694b519ac647fe998fd396fe0784cc8e179aadc4.zip frameworks_base-694b519ac647fe998fd396fe0784cc8e179aadc4.tar.gz frameworks_base-694b519ac647fe998fd396fe0784cc8e179aadc4.tar.bz2 |
Add text rendering.
Change-Id: Ibe5a9fa844d531b31b55e43de403a98d49f659b9
Diffstat (limited to 'tests/HwAccelerationTest')
-rw-r--r-- | tests/HwAccelerationTest/AndroidManifest.xml | 10 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/google/android/test/hwui/TextActivity.java | 59 |
2 files changed, 69 insertions, 0 deletions
diff --git a/tests/HwAccelerationTest/AndroidManifest.xml b/tests/HwAccelerationTest/AndroidManifest.xml index 098359c..8cb9e0d 100644 --- a/tests/HwAccelerationTest/AndroidManifest.xml +++ b/tests/HwAccelerationTest/AndroidManifest.xml @@ -105,6 +105,16 @@ <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> + + <activity + android:name="TextActivity" + android:label="_Text" + android:theme="@android:style/Theme.NoTitleBar"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> </application> </manifest> diff --git a/tests/HwAccelerationTest/src/com/google/android/test/hwui/TextActivity.java b/tests/HwAccelerationTest/src/com/google/android/test/hwui/TextActivity.java new file mode 100644 index 0000000..6665ef5 --- /dev/null +++ b/tests/HwAccelerationTest/src/com/google/android/test/hwui/TextActivity.java @@ -0,0 +1,59 @@ +/* + * 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. + */ + +package com.google.android.test.hwui; + +import android.app.Activity; +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.os.Bundle; +import android.view.View; + +@SuppressWarnings({"UnusedDeclaration"}) +public class TextActivity extends Activity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(new CustomTextView(this)); + } + + static class CustomTextView extends View { + private final Paint mMediumPaint; + private final Paint mLargePaint; + + CustomTextView(Context c) { + super(c); + + mMediumPaint = new Paint(); + mMediumPaint.setAntiAlias(true); + mMediumPaint.setColor(0xffff0000); + mLargePaint = new Paint(); + mLargePaint.setAntiAlias(true); + mLargePaint.setTextSize(36.0f); + } + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + canvas.drawRGB(255, 255, 255); + + canvas.drawText("Hello OpenGL renderer!", 100, 100, mMediumPaint); + canvas.drawText("Hello OpenGL renderer!", 100, 200, mLargePaint); + } + } +}
\ No newline at end of file |