Skip to content

Commit 9fc4b35

Browse files
author
Romain Guy
committed
Add new hw acceleration test
Change-Id: Id2b94286cf62ab77d8c843cffaba09b3070a6332
1 parent 599943e commit 9fc4b35

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

tests/HwAccelerationTest/AndroidManifest.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@
3232

3333
<meta-data android:name="android.graphics.renderThread" android:value="true" />
3434

35+
<activity
36+
android:name="PathOffsetActivity"
37+
android:label="_PathOffset">
38+
<intent-filter>
39+
<action android:name="android.intent.action.MAIN" />
40+
<category android:name="android.intent.category.LAUNCHER" />
41+
</intent-filter>
42+
</activity>
43+
3544
<activity
3645
android:name="TextPathActivity"
3746
android:label="_TextPath">
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Copyright (C) 2010 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.android.test.hwui;
18+
19+
import android.app.Activity;
20+
import android.content.Context;
21+
import android.graphics.Canvas;
22+
import android.graphics.Color;
23+
import android.graphics.Paint;
24+
import android.graphics.Path;
25+
import android.os.Bundle;
26+
import android.view.MotionEvent;
27+
import android.view.View;
28+
29+
@SuppressWarnings({"UnusedDeclaration"})
30+
public class PathOffsetActivity extends Activity {
31+
@Override
32+
protected void onCreate(Bundle savedInstanceState) {
33+
super.onCreate(savedInstanceState);
34+
final PathsView view = new PathsView(this);
35+
setContentView(view);
36+
}
37+
38+
public class PathsView extends View {
39+
private Path mPath;
40+
private Paint mPaint;
41+
42+
public PathsView(Context context) {
43+
super(context);
44+
45+
mPaint = new Paint();
46+
mPaint.setStyle(Paint.Style.STROKE);
47+
mPaint.setStrokeWidth(3);
48+
49+
mPath = new Path();
50+
mPath.lineTo(100, 100);
51+
mPath.lineTo(200, 300);
52+
}
53+
54+
@Override
55+
protected void onDraw(Canvas canvas) {
56+
mPath.offset(1, 1);
57+
mPaint.setColor(Color.RED);
58+
canvas.drawPath(mPath, mPaint);
59+
}
60+
61+
@Override
62+
public boolean onTouchEvent(MotionEvent event) {
63+
invalidate();
64+
return super.onTouchEvent(event);
65+
}
66+
}
67+
}

0 commit comments

Comments
 (0)