summaryrefslogtreecommitdiffstats
path: root/tests/HwAccelerationTest/src/com/android
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2012-01-23 17:09:05 -0800
committerRomain Guy <romainguy@google.com>2012-01-23 17:09:05 -0800
commit5ff9df658230d49e42c43586997a02d8e4dd417e (patch)
tree4b6f2b97036285bd8e114c2f476bcfd0c812d4c9 /tests/HwAccelerationTest/src/com/android
parent36d7549181af397cfaf879f46e407e762e0e8cba (diff)
downloadframeworks_base-5ff9df658230d49e42c43586997a02d8e4dd417e.zip
frameworks_base-5ff9df658230d49e42c43586997a02d8e4dd417e.tar.gz
frameworks_base-5ff9df658230d49e42c43586997a02d8e4dd417e.tar.bz2
Add full support for Canvas.setDrawFilter()
Change-Id: I0ad35d0603c4eeda469014803be14c1dcdde918c
Diffstat (limited to 'tests/HwAccelerationTest/src/com/android')
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/PaintDrawFilterActivity.java64
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/PaintDrawFilterActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/PaintDrawFilterActivity.java
new file mode 100644
index 0000000..8523272
--- /dev/null
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/PaintDrawFilterActivity.java
@@ -0,0 +1,64 @@
+/*
+ * 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.android.test.hwui;
+
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.PaintFlagsDrawFilter;
+import android.os.Bundle;
+import android.view.View;
+
+@SuppressWarnings({"UnusedDeclaration"})
+public class PaintDrawFilterActivity 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 PaintFlagsDrawFilter mDrawFilter;
+
+ CustomTextView(Context c) {
+ super(c);
+
+ mMediumPaint = new Paint();
+ mMediumPaint.setAntiAlias(true);
+ mMediumPaint.setColor(0xff000000);
+ mMediumPaint.setFakeBoldText(true);
+ mMediumPaint.setTextSize(24.0f);
+
+ mDrawFilter = new PaintFlagsDrawFilter(
+ Paint.FAKE_BOLD_TEXT_FLAG, Paint.UNDERLINE_TEXT_FLAG);
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+ canvas.drawRGB(255, 255, 255);
+
+ canvas.setDrawFilter(null);
+ canvas.drawText("Hello OpenGL renderer!", 100, 120, mMediumPaint);
+ canvas.setDrawFilter(mDrawFilter);
+ canvas.drawText("Hello OpenGL renderer!", 100, 220, mMediumPaint);
+ }
+ }
+}