summaryrefslogtreecommitdiffstats
path: root/tests/CanvasCompare/src/com/android/test/hwuicompare/MainView.java
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2012-10-01 18:22:38 -0700
committerChris Craik <ccraik@google.com>2012-11-20 12:41:19 -0800
commitc3683b552f592d8039a466c663f7de8c8286e975 (patch)
treef7685a25563d42394739ab768e3daa02248b47af /tests/CanvasCompare/src/com/android/test/hwuicompare/MainView.java
parent74e6489d8910cfa5354b5ac35ffb4ac5968ebe62 (diff)
downloadframeworks_base-c3683b552f592d8039a466c663f7de8c8286e975.zip
frameworks_base-c3683b552f592d8039a466c663f7de8c8286e975.tar.gz
frameworks_base-c3683b552f592d8039a466c663f7de8c8286e975.tar.bz2
Hardware / Software Canvas comparison tool
Has automated and manual testing modes Change-Id: I84d27447ad64021540525372022ab13a36ffc116
Diffstat (limited to 'tests/CanvasCompare/src/com/android/test/hwuicompare/MainView.java')
-rw-r--r--tests/CanvasCompare/src/com/android/test/hwuicompare/MainView.java56
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/CanvasCompare/src/com/android/test/hwuicompare/MainView.java b/tests/CanvasCompare/src/com/android/test/hwuicompare/MainView.java
new file mode 100644
index 0000000..454fe7b
--- /dev/null
+++ b/tests/CanvasCompare/src/com/android/test/hwuicompare/MainView.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2012 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.android.test.hwuicompare;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.util.AttributeSet;
+import android.view.View;
+
+public class MainView extends View {
+ Paint mPaint = new Paint();
+
+ public MainView(Context context) {
+ super(context);
+ }
+
+ public MainView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public MainView(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+
+ mPaint.reset();
+ DisplayModifier.apply(mPaint, canvas);
+
+ if (mDrawCallback != null) {
+ mDrawCallback.run();
+ }
+ }
+
+ private Runnable mDrawCallback;
+ public void addDrawCallback(Runnable drawCallback) {
+ mDrawCallback = drawCallback;
+ }
+}