save some multiplications

This commit is contained in:
Hannes Janetzek 2013-02-10 12:23:06 +01:00
parent 27a51708fb
commit 0aaca70a94

View File

@ -33,7 +33,7 @@ public final class TextLayer extends TextureLayer {
private static int mFontPadY = 1; private static int mFontPadY = 1;
public TextItem labels; public TextItem labels;
private Canvas mCanvas; private final Canvas mCanvas;
private float mScale; private float mScale;
public TextItem getLabels() { public TextItem getLabels() {
@ -210,17 +210,23 @@ public final class TextLayer extends TextureLayer {
vx = vx / a; vx = vx / a;
vy = vy / a; vy = vy / a;
float ux = -vy; float ux = -vy * hh;
float uy = vx; float uy = vx * hh;
x1 = (short) (SCALE * (vx * hw - ux * hh)); float ux2 = -vy * hh2;
y1 = (short) (SCALE * (vy * hw - uy * hh)); float uy2 = vx * hh2;
x2 = (short) (SCALE * (-vx * hw - ux * hh));
y2 = (short) (SCALE * (-vy * hw - uy * hh)); vx *= hw;
x4 = (short) (SCALE * (-vx * hw + ux * hh2)); vy *= hw;
y4 = (short) (SCALE * (-vy * hw + uy * hh2));
x3 = (short) (SCALE * (vx * hw + ux * hh2)); x1 = (short) (SCALE * (vx - ux));
y3 = (short) (SCALE * (vy * hw + uy * hh2)); y1 = (short) (SCALE * (vy - uy));
x2 = (short) (SCALE * (-vx - ux));
y2 = (short) (SCALE * (-vy - uy));
x4 = (short) (SCALE * (-vx + ux2));
y4 = (short) (SCALE * (-vy + uy2));
x3 = (short) (SCALE * (vx + ux2));
y3 = (short) (SCALE * (vy + uy2));
} }
// add vertices // add vertices