summaryrefslogtreecommitdiffstats
path: root/tests/HwAccelerationTest/src/com/android/test/hwui/ThinPatchesActivity.java
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2010-09-13 17:27:57 -0700
committerRomain Guy <romainguy@google.com>2010-09-13 17:27:57 -0700
commit8411f336c786379c5a03106e9ed3bc8622b579a5 (patch)
treea84342e818982f1075d6c1722706e3bf4bd14ddb /tests/HwAccelerationTest/src/com/android/test/hwui/ThinPatchesActivity.java
parent1510770165b7bc675e5171560e907c0269dbe0fa (diff)
downloadframeworks_base-8411f336c786379c5a03106e9ed3bc8622b579a5.zip
frameworks_base-8411f336c786379c5a03106e9ed3bc8622b579a5.tar.gz
frameworks_base-8411f336c786379c5a03106e9ed3bc8622b579a5.tar.bz2
Fix rendering issue with layers intersecting the clip rect.
Change-Id: Icbe35194fa219ef13ce639d33631235f8d7df3d7
Diffstat (limited to 'tests/HwAccelerationTest/src/com/android/test/hwui/ThinPatchesActivity.java')
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/ThinPatchesActivity.java65
1 files changed, 65 insertions, 0 deletions
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/ThinPatchesActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/ThinPatchesActivity.java
new file mode 100644
index 0000000..d374c32
--- /dev/null
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/ThinPatchesActivity.java
@@ -0,0 +1,65 @@
+/*
+ * 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.res.Resources;
+import android.graphics.Canvas;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.FrameLayout;
+
+@SuppressWarnings({"UnusedDeclaration"})
+public class ThinPatchesActivity extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ FrameLayout layout = new FrameLayout(this);
+ PatchView b = new PatchView(this);
+ b.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
+ FrameLayout.LayoutParams.MATCH_PARENT));
+ layout.addView(b);
+ layout.setBackgroundColor(0xffffffff);
+
+ setContentView(layout);
+ }
+
+ private class PatchView extends View {
+ private Drawable mPatch;
+
+ public PatchView(Activity activity) {
+ super(activity);
+
+ final Resources resources = activity.getResources();
+ mPatch = resources.getDrawable(R.drawable.btn_toggle_on);
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ final int width = 100;
+ final int height = 60;
+
+ final int left = (getWidth() - width) / 2;
+ final int top = (getHeight() - height) / 2;
+
+ mPatch.setBounds(left, top, left + width, top + height);
+ mPatch.draw(canvas);
+ }
+ }
+}