summaryrefslogtreecommitdiffstats
path: root/tests/HwAccelerationTest
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2013-03-04 11:14:26 -0800
committerRomain Guy <romainguy@google.com>2013-03-04 13:48:43 -0800
commit19d4dd8599cb870923ab349d2ab96cacffd9c6f5 (patch)
tree86b0575167b2c27642a1e7a7296be2de2877474a /tests/HwAccelerationTest
parentcdac497289fd2c39a352f6167dae3f77cc608cb8 (diff)
downloadframeworks_base-19d4dd8599cb870923ab349d2ab96cacffd9c6f5.zip
frameworks_base-19d4dd8599cb870923ab349d2ab96cacffd9c6f5.tar.gz
frameworks_base-19d4dd8599cb870923ab349d2ab96cacffd9c6f5.tar.bz2
Take text scale/skew into account only when rendering into a layer
3D rotations can undo scale/skew transforms; since FreeType only accepts 2x2 matrices we can end up generating very large glyphs that are drawn at a 1:1 scale on screen. For instance, if the current transform has a scale of 2000 set on both X and Y axis and a perspective Z factor set to Z, the actual scale factor on screen ends up being 1. We would however generate glyphs with a scale factor of 2000 causing the font renderer to blow up. Change-Id: Ia5c3618d36644e817825cb9c89e2f53aece2074e
Diffstat (limited to 'tests/HwAccelerationTest')
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/Rotate3dTextActivity.java30
1 files changed, 24 insertions, 6 deletions
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/Rotate3dTextActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/Rotate3dTextActivity.java
index 93b8705..0368b2f 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/Rotate3dTextActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/Rotate3dTextActivity.java
@@ -22,6 +22,8 @@ import android.graphics.Canvas;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.View;
+import android.widget.FrameLayout;
+import android.widget.LinearLayout;
@SuppressWarnings({"UnusedDeclaration"})
public class Rotate3dTextActivity extends Activity {
@@ -30,8 +32,28 @@ public class Rotate3dTextActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- final Rotate3dTextView view = new Rotate3dTextView(this);
- setContentView(view);
+ final LinearLayout layout = new LinearLayout(this);
+ layout.setOrientation(LinearLayout.VERTICAL);
+
+ Rotate3dTextView view = new Rotate3dTextView(this);
+ layout.addView(view, makeLayoutParams());
+
+ view = new Rotate3dTextView(this);
+
+ FrameLayout container = new FrameLayout(this);
+ container.setLayerType(View.LAYER_TYPE_HARDWARE, null);
+ container.addView(view);
+
+ layout.addView(container, makeLayoutParams());
+
+ setContentView(layout);
+ }
+
+ private static LinearLayout.LayoutParams makeLayoutParams() {
+ LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
+ LinearLayout.LayoutParams.MATCH_PARENT, 0);
+ lp.weight = 1.0f;
+ return lp;
}
public static class Rotate3dTextView extends View {
@@ -54,11 +76,7 @@ public class Rotate3dTextActivity extends Activity {
@Override
protected void onDraw(Canvas canvas) {
- super.onDraw(canvas);
-
canvas.drawText(TEXT, getWidth() / 2.0f, getHeight() / 2.0f, mPaint);
-
- invalidate();
}
}
}