summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/transforms
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2009-08-11 17:01:47 +0100
committerBen Murdoch <benm@google.com>2009-08-11 18:21:02 +0100
commit0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5 (patch)
tree2943df35f62d885c89d01063cc528dd73b480fea /WebCore/platform/graphics/transforms
parent7e7a70bfa49a1122b2597a1e6367d89eb4035eca (diff)
downloadexternal_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.zip
external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.gz
external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.bz2
Merge in WebKit r47029.
Diffstat (limited to 'WebCore/platform/graphics/transforms')
-rw-r--r--WebCore/platform/graphics/transforms/Matrix3DTransformOperation.cpp2
-rw-r--r--WebCore/platform/graphics/transforms/MatrixTransformOperation.cpp2
-rw-r--r--WebCore/platform/graphics/transforms/TransformOperations.h3
-rw-r--r--WebCore/platform/graphics/transforms/TransformationMatrix.cpp11
-rw-r--r--WebCore/platform/graphics/transforms/TransformationMatrix.h9
5 files changed, 24 insertions, 3 deletions
diff --git a/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.cpp b/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.cpp
index ab3413b..230be3c 100644
--- a/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.cpp
+++ b/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.cpp
@@ -47,7 +47,7 @@ PassRefPtr<TransformOperation> Matrix3DTransformOperation::blend(const Transform
apply(toT, size);
if (blendToIdentity)
- swap(fromT, toT);
+ std::swap(fromT, toT);
toT.blend(fromT, progress);
return Matrix3DTransformOperation::create(toT);
diff --git a/WebCore/platform/graphics/transforms/MatrixTransformOperation.cpp b/WebCore/platform/graphics/transforms/MatrixTransformOperation.cpp
index 4934fa6..0eaccea 100644
--- a/WebCore/platform/graphics/transforms/MatrixTransformOperation.cpp
+++ b/WebCore/platform/graphics/transforms/MatrixTransformOperation.cpp
@@ -43,7 +43,7 @@ PassRefPtr<TransformOperation> MatrixTransformOperation::blend(const TransformOp
}
if (blendToIdentity)
- swap(fromT, toT);
+ std::swap(fromT, toT);
toT.blend(fromT, progress);
return MatrixTransformOperation::create(toT.a(), toT.b(), toT.c(), toT.d(), toT.e(), toT.f());
diff --git a/WebCore/platform/graphics/transforms/TransformOperations.h b/WebCore/platform/graphics/transforms/TransformOperations.h
index 11605e8..dd56408 100644
--- a/WebCore/platform/graphics/transforms/TransformOperations.h
+++ b/WebCore/platform/graphics/transforms/TransformOperations.h
@@ -60,6 +60,9 @@ public:
Vector<RefPtr<TransformOperation> >& operations() { return m_operations; }
const Vector<RefPtr<TransformOperation> >& operations() const { return m_operations; }
+ size_t size() const { return m_operations.size(); }
+ const TransformOperation* at(size_t index) const { return index < m_operations.size() ? m_operations.at(index).get() : 0; }
+
private:
Vector<RefPtr<TransformOperation> > m_operations;
};
diff --git a/WebCore/platform/graphics/transforms/TransformationMatrix.cpp b/WebCore/platform/graphics/transforms/TransformationMatrix.cpp
index a358aaf..13ef281 100644
--- a/WebCore/platform/graphics/transforms/TransformationMatrix.cpp
+++ b/WebCore/platform/graphics/transforms/TransformationMatrix.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2009 Torch Mobile, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -865,6 +866,16 @@ TransformationMatrix& TransformationMatrix::applyPerspective(double p)
return *this;
}
+TransformationMatrix TransformationMatrix::rectToRect(const FloatRect& from, const FloatRect& to)
+{
+ ASSERT(!from.isEmpty());
+ return TransformationMatrix(to.width() / from.width(),
+ 0, 0,
+ to.height() / from.height(),
+ to.x() - from.x(),
+ to.y() - from.y());
+}
+
//
// *this = mat * *this
//
diff --git a/WebCore/platform/graphics/transforms/TransformationMatrix.h b/WebCore/platform/graphics/transforms/TransformationMatrix.h
index 7b93e04..a7fbb3d 100644
--- a/WebCore/platform/graphics/transforms/TransformationMatrix.h
+++ b/WebCore/platform/graphics/transforms/TransformationMatrix.h
@@ -225,6 +225,9 @@ public:
TransformationMatrix& applyPerspective(double p);
bool hasPerspective() const { return m_matrix[2][3] != 0.0f; }
+ // returns a transformation that maps a rect to a rect
+ static TransformationMatrix rectToRect(const FloatRect&, const FloatRect&);
+
bool isInvertible() const;
// This method returns the identity matrix if it is not invertible.
@@ -284,7 +287,7 @@ public:
}
// result = *this * t (i.e., a multRight)
- TransformationMatrix operator*(const TransformationMatrix& t)
+ TransformationMatrix operator*(const TransformationMatrix& t) const
{
TransformationMatrix result = t;
result.multLeft(*this);
@@ -303,6 +306,10 @@ public:
operator wxGraphicsMatrix() const;
#endif
+#if PLATFORM(WIN)
+ operator XFORM() const;
+#endif
+
private:
// multiply passed 2D point by matrix (assume z=0)
void multVecMatrix(double x, double y, double& dstX, double& dstY) const;