Commit 59344a60 authored by Eddie Kohler's avatar Eddie Kohler

rearrange order of Transform elements

parent 4b4513bb
......@@ -12,7 +12,6 @@ class Transform { public:
// Transform(const Transform &) generated by compiler
// ~Transform() generated by compiler
//double value(int i) const { assert(i>=0&&i<6); return _m[i]; }
double operator[](int i) const { assert(i>=0&&i<6); return _m[i]; }
bool null() const { return _null; }
void check_null(double tolerance);
......
......@@ -1175,8 +1175,8 @@ EfontCFF::Font::font_matrix(double matrix[6]) const
if (dict_value(oFontMatrix, t1d_matrix) && t1d_matrix.size() == 6)
memcpy(&matrix[0], &t1d_matrix[0], sizeof(double) * 6);
else {
matrix[0] = matrix[4] = 0.001;
matrix[1] = matrix[2] = matrix[3] = matrix[5] = 0;
matrix[0] = matrix[3] = 0.001;
matrix[1] = matrix[2] = matrix[4] = matrix[5] = 0;
}
}
......
......@@ -269,8 +269,8 @@ Type2Charstring::run(CharstringInterp &interp) const
void
EfontProgram::font_matrix(double matrix[6]) const
{
matrix[0] = matrix[4] = 0.001;
matrix[1] = matrix[2] = matrix[3] = matrix[5] = 0;
matrix[0] = matrix[3] = 0.001;
matrix[1] = matrix[2] = matrix[4] = matrix[5] = 0;
}
void
......
......@@ -803,8 +803,8 @@ Type1Font::font_matrix(double matrix[6]) const
if (t1d && t1d->value_numvec(t1d_matrix) && t1d_matrix.size() == 6)
memcpy(&matrix[0], &t1d_matrix[0], sizeof(double) * 6);
else {
matrix[0] = matrix[4] = 0.001;
matrix[1] = matrix[2] = matrix[3] = matrix[5] = 0;
matrix[0] = matrix[3] = 0.001;
matrix[1] = matrix[2] = matrix[4] = matrix[5] = 0;
}
}
......
......@@ -7,8 +7,8 @@
Transform::Transform()
{
_m[0] = _m[4] = 1;
_m[1] = _m[2] = _m[3] = _m[5] = 0;
_m[0] = _m[3] = 1;
_m[1] = _m[2] = _m[4] = _m[5] = 0;
_null = true;
}
......@@ -39,46 +39,46 @@ void
Transform::check_null(double tolerance)
{
_null = (fabs(_m[0] - 1) < tolerance && fabs(_m[1]) < tolerance
&& fabs(_m[2]) < tolerance && fabs(_m[3]) < tolerance
&& fabs(_m[4] - 1) < tolerance && fabs(_m[5]) < tolerance);
&& fabs(_m[2]) < tolerance && fabs(_m[3] - 1) < tolerance
&& fabs(_m[4]) < tolerance && fabs(_m[5]) < tolerance);
}
void
Transform::add_scale(double x, double y)
Transform::scale(double x, double y)
{
_m[0] *= x;
_m[1] *= y;
_m[3] *= x;
_m[4] *= y;
_m[1] *= x;
_m[2] *= y;
_m[3] *= y;
if (x != 1 || y != 1)
_null = false;
}
void
Transform::add_rotate(double r)
Transform::rotate(double r)
{
double c = cos(r);
double s = sin(r);
double a = _m[0], b = _m[1];
double a = _m[0], b = _m[2];
_m[0] = a*c + b*s;
_m[1] = b*c - a*s;
_m[2] = b*c - a*s;
a = _m[3], b = _m[4];
_m[3] = a*c + b*s;
_m[4] = b*c - a*s;
a = _m[1], b = _m[3];
_m[1] = a*c + b*s;
_m[3] = b*c - a*s;
if (r != 0)
_null = false;
}
void
Transform::add_translate(double x, double y)
Transform::translate(double x, double y)
{
_m[2] += _m[0]*x + _m[1]*y;
_m[5] += _m[3]*x + _m[4]*y;
_m[4] += _m[0]*x + _m[2]*y;
_m[5] += _m[1]*x + _m[3]*y;
if (x != 0 || y != 0)
_null = false;
......@@ -87,12 +87,12 @@ Transform::add_translate(double x, double y)
Transform
Transform::transformed(const Transform &t) const
{
return Transform(_m[0] * t._m[0] + _m[1] * t._m[3],
_m[0] * t._m[1] + _m[1] * t._m[4],
_m[0] * t._m[2] + _m[1] * t._m[5] + _m[2],
_m[3] * t._m[0] + _m[4] * t._m[3],
_m[3] * t._m[1] + _m[4] * t._m[4],
_m[3] * t._m[2] + _m[4] * t._m[5] + _m[5]);
return Transform(_m[0] * t._m[0] + _m[2] * t._m[1],
_m[1] * t._m[0] + _m[3] * t._m[1],
_m[0] * t._m[2] + _m[2] * t._m[3],
_m[1] * t._m[2] + _m[3] * t._m[3],
_m[0] * t._m[4] + _m[2] * t._m[5] + _m[4],
_m[1] * t._m[4] + _m[3] * t._m[5] + _m[5]);
}
......@@ -100,15 +100,15 @@ void
Transform::real_apply_to(Point &p) const
{
double x = p.x;
p.x = x*_m[0] + p.y*_m[1] + _m[2];
p.y = x*_m[3] + p.y*_m[4] + _m[5];
p.x = x*_m[0] + p.y*_m[2] + _m[4];
p.y = x*_m[1] + p.y*_m[3] + _m[5];
}
Point
Transform::real_apply(const Point &p) const
{
return Point(p.x*_m[0] + p.y*_m[1] + _m[2],
p.x*_m[3] + p.y*_m[4] + _m[5]);
return Point(p.x*_m[0] + p.y*_m[2] + _m[4],
p.x*_m[1] + p.y*_m[3] + _m[5]);
}
Bezier &
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment