Merge "Adjust offset for non-AA line drawing"
This commit is contained in:
@@ -160,7 +160,7 @@ void Program::set(const mat4& projectionMatrix, const mat4& modelViewMatrix,
|
|||||||
// up and to the left.
|
// up and to the left.
|
||||||
// This offset value is based on an assumption that some hardware may use as
|
// This offset value is based on an assumption that some hardware may use as
|
||||||
// little as 12.4 precision, so we offset by slightly more than 1/16.
|
// little as 12.4 precision, so we offset by slightly more than 1/16.
|
||||||
p.translate(.375, .375, 0);
|
p.translate(.065, .065, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
mat4 t(transformMatrix);
|
mat4 t(transformMatrix);
|
||||||
|
|||||||
@@ -41,13 +41,40 @@ public abstract class DisplayModifier {
|
|||||||
protected int mask() { return 0x0; };
|
protected int mask() { return 0x0; };
|
||||||
|
|
||||||
private static final RectF gRect = new RectF(0, 0, 200, 175);
|
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[] {
|
private static final float[] gPts = new float[] {
|
||||||
0, 100, 100, 0, 100, 200, 200, 100
|
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")
|
@SuppressWarnings("serial")
|
||||||
private static final LinkedHashMap<String, LinkedHashMap<String, DisplayModifier>> gMaps = new LinkedHashMap<String, LinkedHashMap<String, DisplayModifier>>() {
|
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);
|
canvas.drawOval(gRect, paint);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
put("triLines", new DisplayModifier() {
|
put("lines", new DisplayModifier() {
|
||||||
@Override
|
@Override
|
||||||
public void modifyDrawing(Paint paint, Canvas canvas) {
|
public void modifyDrawing(Paint paint, Canvas canvas) {
|
||||||
canvas.drawLines(gLinePts, paint);
|
canvas.drawLines(gLinePts, paint);
|
||||||
|
|||||||
Reference in New Issue
Block a user