summaryrefslogtreecommitdiffstats
path: root/tests/CanvasCompare
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2013-02-15 11:58:14 -0800
committerChris Craik <ccraik@google.com>2013-02-15 14:53:12 -0800
commit62a42c13a6e86255a0118688a60c9248030c95a9 (patch)
tree3f7e12c3f6c7dcc4ae571a792fda5d9780afa429 /tests/CanvasCompare
parent101ae3bb3909827303121e5e11ed16b7efe36538 (diff)
downloadframeworks_base-62a42c13a6e86255a0118688a60c9248030c95a9.zip
frameworks_base-62a42c13a6e86255a0118688a60c9248030c95a9.tar.gz
frameworks_base-62a42c13a6e86255a0118688a60c9248030c95a9.tar.bz2
Adjust offset for non-AA line drawing
bug:8114304 The original .375 was chosen to make GL_LINES align with Skia drawing. The new value of .065 is chosen to be as small as possible to make triangle-based lines align with Skia, while keeping lines drawn on integer coordinates unambiguous as to which column/row they draw on. Also adds more lines in CanvasCompare test to highlight the difference Change-Id: If578684f2db320682219c3caa625cf79bc62d88f
Diffstat (limited to 'tests/CanvasCompare')
-rw-r--r--tests/CanvasCompare/src/com/android/test/hwuicompare/DisplayModifier.java35
1 files changed, 31 insertions, 4 deletions
diff --git a/tests/CanvasCompare/src/com/android/test/hwuicompare/DisplayModifier.java b/tests/CanvasCompare/src/com/android/test/hwuicompare/DisplayModifier.java
index fb818d4..9939c08 100644
--- a/tests/CanvasCompare/src/com/android/test/hwuicompare/DisplayModifier.java
+++ b/tests/CanvasCompare/src/com/android/test/hwuicompare/DisplayModifier.java
@@ -41,13 +41,40 @@ public abstract class DisplayModifier {
protected int mask() { return 0x0; };
private static final RectF gRect = new RectF(0, 0, 200, 175);
- private static final float[] gLinePts = new float[] {
- 100, 0, 200, 200, 200, 200, 0, 200, 0, 200, 100, 0
- };
private static final float[] gPts = new float[] {
0, 100, 100, 0, 100, 200, 200, 100
};
+ private static final int NUM_PARALLEL_LINES = 24;
+ private static final float[] gTriPts = new float[] {
+ 75, 0, 130, 130, 130, 130, 0, 130, 0, 130, 75, 0
+ };
+ private static final float[] gLinePts = new float[NUM_PARALLEL_LINES * 8 + gTriPts.length];
+ static {
+ int index;
+ for (index = 0; index < gTriPts.length; index++) {
+ gLinePts[index] = gTriPts[index];
+ }
+ float val = 0;
+ for (int i = 0; i < NUM_PARALLEL_LINES; i++) {
+ gLinePts[index + 0] = 150;
+ gLinePts[index + 1] = val;
+ gLinePts[index + 2] = 300;
+ gLinePts[index + 3] = val;
+ index += 4;
+ val += 8 + (2.0f/NUM_PARALLEL_LINES);
+ }
+ val = 0;
+ for (int i = 0; i < NUM_PARALLEL_LINES; i++) {
+ gLinePts[index + 0] = val;
+ gLinePts[index + 1] = 150;
+ gLinePts[index + 2] = val;
+ gLinePts[index + 3] = 300;
+ index += 4;
+ val += 8 + (2.0f/NUM_PARALLEL_LINES);
+ }
+ };
+
@SuppressWarnings("serial")
private static final LinkedHashMap<String, LinkedHashMap<String, DisplayModifier>> gMaps = new LinkedHashMap<String, LinkedHashMap<String, DisplayModifier>>() {
{
@@ -307,7 +334,7 @@ public abstract class DisplayModifier {
canvas.drawOval(gRect, paint);
}
});
- put("triLines", new DisplayModifier() {
+ put("lines", new DisplayModifier() {
@Override
public void modifyDrawing(Paint paint, Canvas canvas) {
canvas.drawLines(gLinePts, paint);