summaryrefslogtreecommitdiff
path: root/base/matrix.c
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2004-10-05 11:05:26 +0200
committerTor Andersson <tor@ghostscript.com>2004-10-05 11:05:26 +0200
commit7edeed5a4fae0199a65dc724c2c131d4d120bf28 (patch)
treec27e90705a7c083643913a82a4deb2d74b385e57 /base/matrix.c
parent98e44466052e654c6b34a685fe7dbc433632aecc (diff)
downloadmupdf-7edeed5a4fae0199a65dc724c2c131d4d120bf28.tar.xz
strip out c99-isms for msvc
Diffstat (limited to 'base/matrix.c')
-rw-r--r--base/matrix.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/base/matrix.c b/base/matrix.c
index 70193427..659193f5 100644
--- a/base/matrix.c
+++ b/base/matrix.c
@@ -16,27 +16,43 @@ fz_concat(fz_matrix one, fz_matrix two)
fz_matrix
fz_identity(void)
{
- return (fz_matrix) { 1, 0, 0, 1, 0, 0 };
+ fz_matrix m;
+ m.a = 1; m.b = 0;
+ m.c = 0; m.d = 1;
+ m.e = 0; m.f = 0;
+ return m;
}
fz_matrix
fz_scale(float sx, float sy)
{
- return (fz_matrix) { sx, 0, 0, sy, 0, 0 };
+ fz_matrix m;
+ m.a = sx; m.b = 0;
+ m.c = 0; m.d = sy;
+ m.e = 0; m.f = 0;
+ return m;
}
fz_matrix
fz_rotate(float theta)
{
+ fz_matrix m;
float s = sin(theta * M_PI / 180.0);
float c = cos(theta * M_PI / 180.0);
- return (fz_matrix) { c, s, -s, c, 0 ,0 };
+ m.a = c; m.b = s;
+ m.c = -s; m.d = c;
+ m.e = 0; m.f = 0;
+ return m;
}
fz_matrix
fz_translate(float tx, float ty)
{
- return (fz_matrix) { 1, 0, 0, 1, tx, ty };
+ fz_matrix m;
+ m.a = 1; m.b = 0;
+ m.c = 0; m.d = 1;
+ m.e = tx; m.f = ty;
+ return m;
}
fz_matrix
@@ -63,8 +79,9 @@ fz_isrectilinear(fz_matrix m)
fz_point
fz_transformpoint(fz_matrix m, fz_point p)
{
- float x = p.x * m.a + p.y * m.c + m.e;
- float y = p.x * m.b + p.y * m.d + m.f;
- return (fz_point) { x, y };
+ fz_point t;
+ t.x = p.x * m.a + p.y * m.c + m.e;
+ t.y = p.x * m.b + p.y * m.d + m.f;
+ return t;
}