summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/transforms
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/graphics/transforms')
-rw-r--r--WebCore/platform/graphics/transforms/AffineTransform.cpp14
-rw-r--r--WebCore/platform/graphics/transforms/AffineTransform.h5
-rw-r--r--WebCore/platform/graphics/transforms/Matrix3DTransformOperation.h2
-rw-r--r--WebCore/platform/graphics/transforms/MatrixTransformOperation.h2
-rw-r--r--WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h2
-rw-r--r--WebCore/platform/graphics/transforms/RotateTransformOperation.h3
-rw-r--r--WebCore/platform/graphics/transforms/SkewTransformOperation.h3
-rw-r--r--WebCore/platform/graphics/transforms/TranslateTransformOperation.h4
8 files changed, 32 insertions, 3 deletions
diff --git a/WebCore/platform/graphics/transforms/AffineTransform.cpp b/WebCore/platform/graphics/transforms/AffineTransform.cpp
index be18e07..f275526 100644
--- a/WebCore/platform/graphics/transforms/AffineTransform.cpp
+++ b/WebCore/platform/graphics/transforms/AffineTransform.cpp
@@ -41,8 +41,8 @@ static void affineTransformDecompose(const AffineTransform& matrix, double sr[9]
AffineTransform m(matrix);
// Compute scaling factors
- double sx = sqrt(m.a() * m.a() + m.b() * m.b());
- double sy = sqrt(m.c() * m.c() + m.d() * m.d());
+ double sx = matrix.xScale();
+ double sy = matrix.yScale();
// Compute cross product of transformed unit vectors. If negative,
// one axis was flipped.
@@ -119,6 +119,16 @@ bool AffineTransform::isIdentity() const
&& m_transform[4] == 0 && m_transform[5] == 0);
}
+double AffineTransform::xScale() const
+{
+ return sqrt(m_transform[0] * m_transform[0] + m_transform[1] * m_transform[1]);
+}
+
+double AffineTransform::yScale() const
+{
+ return sqrt(m_transform[2] * m_transform[2] + m_transform[3] * m_transform[3]);
+}
+
double AffineTransform::det() const
{
return m_transform[0] * m_transform[3] - m_transform[1] * m_transform[2];
diff --git a/WebCore/platform/graphics/transforms/AffineTransform.h b/WebCore/platform/graphics/transforms/AffineTransform.h
index 289ec54..baee102 100644
--- a/WebCore/platform/graphics/transforms/AffineTransform.h
+++ b/WebCore/platform/graphics/transforms/AffineTransform.h
@@ -110,7 +110,10 @@ public:
AffineTransform& skew(double angleX, double angleY);
AffineTransform& skewX(double angle);
AffineTransform& skewY(double angle);
-
+
+ double xScale() const;
+ double yScale() const;
+
double det() const;
bool isInvertible() const;
AffineTransform inverse() const;
diff --git a/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.h b/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.h
index 7430dbc..0a0aaf0 100644
--- a/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.h
+++ b/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.h
@@ -37,6 +37,8 @@ public:
return adoptRef(new Matrix3DTransformOperation(matrix));
}
+ TransformationMatrix matrix() const {return m_matrix; }
+
private:
virtual bool isIdentity() const { return m_matrix.isIdentity(); }
diff --git a/WebCore/platform/graphics/transforms/MatrixTransformOperation.h b/WebCore/platform/graphics/transforms/MatrixTransformOperation.h
index ee47a11..fd9b27e 100644
--- a/WebCore/platform/graphics/transforms/MatrixTransformOperation.h
+++ b/WebCore/platform/graphics/transforms/MatrixTransformOperation.h
@@ -42,6 +42,8 @@ public:
return adoptRef(new MatrixTransformOperation(t));
}
+ TransformationMatrix matrix() const { return TransformationMatrix(m_a, m_b, m_c, m_d, m_e, m_f); }
+
private:
virtual bool isIdentity() const { return m_a == 1 && m_b == 0 && m_c == 0 && m_d == 1 && m_e == 0 && m_f == 0; }
diff --git a/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h b/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h
index a665f3e..834cc83 100644
--- a/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h
+++ b/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h
@@ -36,6 +36,8 @@ public:
{
return adoptRef(new PerspectiveTransformOperation(p));
}
+
+ double perspective() const { return m_p; }
private:
virtual bool isIdentity() const { return m_p == 0; }
diff --git a/WebCore/platform/graphics/transforms/RotateTransformOperation.h b/WebCore/platform/graphics/transforms/RotateTransformOperation.h
index 699ea43..2acb002 100644
--- a/WebCore/platform/graphics/transforms/RotateTransformOperation.h
+++ b/WebCore/platform/graphics/transforms/RotateTransformOperation.h
@@ -41,6 +41,9 @@ public:
return adoptRef(new RotateTransformOperation(x, y, z, angle, type));
}
+ double x() const { return m_x; }
+ double y() const { return m_y; }
+ double z() const { return m_z; }
double angle() const { return m_angle; }
private:
diff --git a/WebCore/platform/graphics/transforms/SkewTransformOperation.h b/WebCore/platform/graphics/transforms/SkewTransformOperation.h
index 6343710..afe9a7b 100644
--- a/WebCore/platform/graphics/transforms/SkewTransformOperation.h
+++ b/WebCore/platform/graphics/transforms/SkewTransformOperation.h
@@ -36,6 +36,9 @@ public:
return adoptRef(new SkewTransformOperation(angleX, angleY, type));
}
+ double angleX() const { return m_angleX; }
+ double angleY() const { return m_angleY; }
+
private:
virtual bool isIdentity() const { return m_angleX == 0 && m_angleY == 0; }
virtual OperationType getOperationType() const { return m_type; }
diff --git a/WebCore/platform/graphics/transforms/TranslateTransformOperation.h b/WebCore/platform/graphics/transforms/TranslateTransformOperation.h
index a66cc3d..ea48d49 100644
--- a/WebCore/platform/graphics/transforms/TranslateTransformOperation.h
+++ b/WebCore/platform/graphics/transforms/TranslateTransformOperation.h
@@ -46,6 +46,10 @@ public:
double y(const IntSize& borderBoxSize) const { return m_y.calcFloatValue(borderBoxSize.height()); }
double z(const IntSize&) const { return m_z.calcFloatValue(1); }
+ Length x() const { return m_x; }
+ Length y() const { return m_y; }
+ Length z() const { return m_z; }
+
private:
virtual bool isIdentity() const { return m_x.calcFloatValue(1) == 0 && m_y.calcFloatValue(1) == 0 && m_z.calcFloatValue(1) == 0; }