Modified: trunk/Source/Platform/chromium/public/WebTransformationMatrix.h (118856 => 118857)
--- trunk/Source/Platform/chromium/public/WebTransformationMatrix.h 2012-05-29 23:40:26 UTC (rev 118856)
+++ trunk/Source/Platform/chromium/public/WebTransformationMatrix.h 2012-05-29 23:42:28 UTC (rev 118857)
@@ -35,15 +35,12 @@
#include "FloatPoint.h"
#include "FloatPoint3D.h"
#include "FloatQuad.h"
+#include "TransformationMatrix.h"
#endif
#include "WebCommon.h"
#include "WebPrivateOwnPtr.h"
-namespace WebCore {
-class TransformationMatrix;
-}
-
namespace WebKit {
class WebTransformationMatrix {
@@ -51,8 +48,7 @@
WebTransformationMatrix();
WebTransformationMatrix(double a, double b, double c, double d, double e, double f);
WebTransformationMatrix(const WebTransformationMatrix&);
- ~WebTransformationMatrix() { reset(); }
- void reset();
+ ~WebTransformationMatrix() { }
// Operations that return a separate matrix and do not modify this one.
WebTransformationMatrix inverse() const;
@@ -136,7 +132,7 @@
#if WEBKIT_IMPLEMENTATION
// Conversions between WebKit::WebTransformationMatrix and WebCore::TransformationMatrix
explicit WebTransformationMatrix(const WebCore::TransformationMatrix&);
- WebCore::TransformationMatrix& toWebCoreTransform() const;
+ WebCore::TransformationMatrix toWebCoreTransform() const;
// FIXME: these map functions should not exist, should be using CCMathUtil
// instead. Eventually CCMathUtil functions could be merged here, but its
@@ -151,9 +147,27 @@
#endif
protected:
- WebPrivateOwnPtr<WebCore::TransformationMatrix> m_private;
+
+ // While migrating this code: Code that is external to WebKit should have no knowledge
+ // of WebCore::TransformationMatrix. But in those cases, this class still needs to
+ // be the same size so that the class can be passed back and forth between WebKit and
+ // non-WebKit code.
+ //
+ // The end goal is eventually for this class to only exist at the API boundary, as a
+ // conversion between WebCore TransformationMatrix and the compositor's internal
+ // implementation of matrix transforms.
+ //
+#if WEBKIT_IMPLEMENTATION
+ WebCore::TransformationMatrix m_private;
+#else
+ double m_matrix[4][4];
+#endif
};
+#if WEBKIT_IMPLEMENTATION
+COMPILE_ASSERT(sizeof(WebCore::TransformationMatrix) == sizeof(double[4][4]), WebTransformationMatrix_has_unexpected_size);
+#endif
+
} // namespace WebKit
#endif
Modified: trunk/Source/WebCore/platform/chromium/support/WebTransformationMatrix.cpp (118856 => 118857)
--- trunk/Source/WebCore/platform/chromium/support/WebTransformationMatrix.cpp 2012-05-29 23:40:26 UTC (rev 118856)
+++ trunk/Source/WebCore/platform/chromium/support/WebTransformationMatrix.cpp 2012-05-29 23:42:28 UTC (rev 118857)
@@ -32,44 +32,35 @@
namespace WebKit {
-// FIXME: The overhead of allocating a new TransformationMatrix in these constructors needs to go away as soon
-// as possible.
-
WebTransformationMatrix::WebTransformationMatrix()
- : m_private(new TransformationMatrix())
+ : m_private()
{
}
WebTransformationMatrix::WebTransformationMatrix(double a, double b, double c, double d, double e, double f)
- : m_private(new TransformationMatrix(a, b, c, d, e, f))
+ : m_private(a, b, c, d, e, f)
{
}
WebTransformationMatrix::WebTransformationMatrix(const WebTransformationMatrix& t)
- : m_private(new TransformationMatrix(*t.m_private.get()))
+ : m_private(t.m_private)
{
}
WebTransformationMatrix::WebTransformationMatrix(const TransformationMatrix& t)
- : m_private(new TransformationMatrix(t))
+ : m_private(t)
{
}
-void WebTransformationMatrix::reset()
-{
- m_private.reset(0);
-}
-
WebTransformationMatrix& WebTransformationMatrix::operator=(const WebTransformationMatrix& t)
{
- *m_private.get() = *t.m_private.get();
+ m_private = t.m_private;
return *this;
}
bool WebTransformationMatrix::operator==(const WebTransformationMatrix& t) const
{
- bool isEqual = (*m_private.get() == *t.m_private.get());
- return isEqual;
+ return m_private == t.m_private;
}
WebTransformationMatrix WebTransformationMatrix::operator*(const WebTransformationMatrix& t) const
@@ -82,380 +73,380 @@
WebTransformationMatrix WebTransformationMatrix::inverse() const
{
WebTransformationMatrix result;
- *result.m_private.get() = m_private->inverse();
+ result.m_private = m_private.inverse();
return result;
}
WebTransformationMatrix WebTransformationMatrix::to2dTransform() const
{
WebTransformationMatrix result;
- *result.m_private.get() = m_private->to2dTransform();
+ result.m_private = m_private.to2dTransform();
return result;
}
void WebTransformationMatrix::multiply(const WebTransformationMatrix& t)
{
- m_private->multiply(*t.m_private.get());
+ m_private.multiply(t.m_private);
}
void WebTransformationMatrix::makeIdentity()
{
- m_private->makeIdentity();
+ m_private.makeIdentity();
}
void WebTransformationMatrix::translate(double tx, double ty)
{
- m_private->translate(tx, ty);
+ m_private.translate(tx, ty);
}
void WebTransformationMatrix::translate3d(double tx, double ty, double tz)
{
- m_private->translate3d(tx, ty, tz);
+ m_private.translate3d(tx, ty, tz);
}
void WebTransformationMatrix::translateRight3d(double tx, double ty, double tz)
{
- m_private->translateRight3d(tx, ty, tz);
+ m_private.translateRight3d(tx, ty, tz);
}
void WebTransformationMatrix::scale(double s)
{
- m_private->scale(s);
+ m_private.scale(s);
}
void WebTransformationMatrix::scaleNonUniform(double sx, double sy)
{
- m_private->scaleNonUniform(sx, sy);
+ m_private.scaleNonUniform(sx, sy);
}
void WebTransformationMatrix::scale3d(double sx, double sy, double sz)
{
- m_private->scale3d(sx, sy, sz);
+ m_private.scale3d(sx, sy, sz);
}
void WebTransformationMatrix::rotate(double angle)
{
- m_private->rotate(angle);
+ m_private.rotate(angle);
}
void WebTransformationMatrix::rotate3d(double rx, double ry, double rz)
{
- m_private->rotate3d(rx, ry, rz);
+ m_private.rotate3d(rx, ry, rz);
}
void WebTransformationMatrix::rotate3d(double x, double y, double z, double angle)
{
- m_private->rotate3d(x, y, z, angle);
+ m_private.rotate3d(x, y, z, angle);
}
void WebTransformationMatrix::skewX(double angle)
{
- m_private->skewX(angle);
+ m_private.skewX(angle);
}
void WebTransformationMatrix::skewY(double angle)
{
- m_private->skewY(angle);
+ m_private.skewY(angle);
}
void WebTransformationMatrix::applyPerspective(double p)
{
- m_private->applyPerspective(p);
+ m_private.applyPerspective(p);
}
void WebTransformationMatrix::blend(const WebTransformationMatrix& from, double progress)
{
- m_private->blend(*from.m_private.get(), progress);
+ m_private.blend(from.m_private, progress);
}
bool WebTransformationMatrix::hasPerspective() const
{
- return m_private->hasPerspective();
+ return m_private.hasPerspective();
}
bool WebTransformationMatrix::isInvertible() const
{
- return m_private->isInvertible();
+ return m_private.isInvertible();
}
bool WebTransformationMatrix::isBackFaceVisible() const
{
- return m_private->isBackFaceVisible();
+ return m_private.isBackFaceVisible();
}
bool WebTransformationMatrix::isIdentity() const
{
- return m_private->isIdentity();
+ return m_private.isIdentity();
}
bool WebTransformationMatrix::isIdentityOrTranslation() const
{
- return m_private->isIdentityOrTranslation();
+ return m_private.isIdentityOrTranslation();
}
bool WebTransformationMatrix::isIntegerTranslation() const
{
- return m_private->isIntegerTranslation();
+ return m_private.isIntegerTranslation();
}
double WebTransformationMatrix::m11() const
{
- return m_private->m11();
+ return m_private.m11();
}
void WebTransformationMatrix::setM11(double f)
{
- m_private->setM11(f);
+ m_private.setM11(f);
}
double WebTransformationMatrix::m12() const
{
- return m_private->m12();
+ return m_private.m12();
}
void WebTransformationMatrix::setM12(double f)
{
- m_private->setM12(f);
+ m_private.setM12(f);
}
double WebTransformationMatrix::m13() const
{
- return m_private->m13();
+ return m_private.m13();
}
void WebTransformationMatrix::setM13(double f)
{
- m_private->setM13(f);
+ m_private.setM13(f);
}
double WebTransformationMatrix::m14() const
{
- return m_private->m14();
+ return m_private.m14();
}
void WebTransformationMatrix::setM14(double f)
{
- m_private->setM14(f);
+ m_private.setM14(f);
}
double WebTransformationMatrix::m21() const
{
- return m_private->m21();
+ return m_private.m21();
}
void WebTransformationMatrix::setM21(double f)
{
- m_private->setM21(f);
+ m_private.setM21(f);
}
double WebTransformationMatrix::m22() const
{
- return m_private->m22();
+ return m_private.m22();
}
void WebTransformationMatrix::setM22(double f)
{
- m_private->setM22(f);
+ m_private.setM22(f);
}
double WebTransformationMatrix::m23() const
{
- return m_private->m23();
+ return m_private.m23();
}
void WebTransformationMatrix::setM23(double f)
{
- m_private->setM23(f);
+ m_private.setM23(f);
}
double WebTransformationMatrix::m24() const
{
- return m_private->m24();
+ return m_private.m24();
}
void WebTransformationMatrix::setM24(double f)
{
- m_private->setM24(f);
+ m_private.setM24(f);
}
double WebTransformationMatrix::m31() const
{
- return m_private->m31();
+ return m_private.m31();
}
void WebTransformationMatrix::setM31(double f)
{
- m_private->setM31(f);
+ m_private.setM31(f);
}
double WebTransformationMatrix::m32() const
{
- return m_private->m32();
+ return m_private.m32();
}
void WebTransformationMatrix::setM32(double f)
{
- m_private->setM32(f);
+ m_private.setM32(f);
}
double WebTransformationMatrix::m33() const
{
- return m_private->m33();
+ return m_private.m33();
}
void WebTransformationMatrix::setM33(double f)
{
- m_private->setM33(f);
+ m_private.setM33(f);
}
double WebTransformationMatrix::m34() const
{
- return m_private->m34();
+ return m_private.m34();
}
void WebTransformationMatrix::setM34(double f)
{
- m_private->setM34(f);
+ m_private.setM34(f);
}
double WebTransformationMatrix::m41() const
{
- return m_private->m41();
+ return m_private.m41();
}
void WebTransformationMatrix::setM41(double f)
{
- m_private->setM41(f);
+ m_private.setM41(f);
}
double WebTransformationMatrix::m42() const
{
- return m_private->m42();
+ return m_private.m42();
}
void WebTransformationMatrix::setM42(double f)
{
- m_private->setM42(f);
+ m_private.setM42(f);
}
double WebTransformationMatrix::m43() const
{
- return m_private->m43();
+ return m_private.m43();
}
void WebTransformationMatrix::setM43(double f)
{
- m_private->setM43(f);
+ m_private.setM43(f);
}
double WebTransformationMatrix::m44() const
{
- return m_private->m44();
+ return m_private.m44();
}
void WebTransformationMatrix::setM44(double f)
{
- m_private->setM44(f);
+ m_private.setM44(f);
}
double WebTransformationMatrix::a() const
{
- return m_private->a();
+ return m_private.a();
}
void WebTransformationMatrix::setA(double a)
{
- m_private->setA(a);
+ m_private.setA(a);
}
double WebTransformationMatrix::b() const
{
- return m_private->b();
+ return m_private.b();
}
void WebTransformationMatrix::setB(double b)
{
- m_private->setB(b);
+ m_private.setB(b);
}
double WebTransformationMatrix::c() const
{
- return m_private->c();
+ return m_private.c();
}
void WebTransformationMatrix::setC(double c)
{
- m_private->setC(c);
+ m_private.setC(c);
}
double WebTransformationMatrix::d() const
{
- return m_private->d();
+ return m_private.d();
}
void WebTransformationMatrix::setD(double d)
{
- m_private->setD(d);
+ m_private.setD(d);
}
double WebTransformationMatrix::e() const
{
- return m_private->e();
+ return m_private.e();
}
void WebTransformationMatrix::setE(double e)
{
- m_private->setE(e);
+ m_private.setE(e);
}
double WebTransformationMatrix::f() const
{
- return m_private->f();
+ return m_private.f();
}
void WebTransformationMatrix::setF(double f)
{
- m_private->setF(f);
+ m_private.setF(f);
}
-TransformationMatrix& WebTransformationMatrix::toWebCoreTransform() const
+TransformationMatrix WebTransformationMatrix::toWebCoreTransform() const
{
- return *m_private.get();
+ return m_private;
}
FloatRect WebTransformationMatrix::mapRect(const FloatRect& rect) const
{
- return m_private->mapRect(rect);
+ return m_private.mapRect(rect);
}
IntRect WebTransformationMatrix::mapRect(const IntRect& rect) const
{
- return m_private->mapRect(rect);
+ return m_private.mapRect(rect);
}
FloatPoint3D WebTransformationMatrix::mapPoint(const FloatPoint3D& p) const
{
- return m_private->mapPoint(p);
+ return m_private.mapPoint(p);
}
FloatPoint WebTransformationMatrix::mapPoint(const FloatPoint& p) const
{
- return m_private->mapPoint(p);
+ return m_private.mapPoint(p);
}
IntPoint WebTransformationMatrix::mapPoint(const IntPoint& p) const
{
- return m_private->mapPoint(p);
+ return m_private.mapPoint(p);
}
FloatQuad WebTransformationMatrix::mapQuad(const FloatQuad& quad) const
{
- return m_private->mapQuad(quad);
+ return m_private.mapQuad(quad);
}
FloatPoint WebTransformationMatrix::projectPoint(const FloatPoint& p, bool* clamped) const
{
- return m_private->projectPoint(p, clamped);
+ return m_private.projectPoint(p, clamped);
}
} // namespace WebKit