зеркало из https://github.com/mozilla/gecko-dev.git
Bug 924102 - Add the types Point3D and Matrix5x4. r=Bas
This commit is contained in:
Родитель
7e6095b9db
Коммит
46bb478bac
|
@ -253,6 +253,34 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class Matrix5x4
|
||||
{
|
||||
public:
|
||||
Matrix5x4()
|
||||
: _11(1.0f), _12(0), _13(0), _14(0)
|
||||
, _21(0), _22(1.0f), _23(0), _24(0)
|
||||
, _31(0), _32(0), _33(1.0f), _34(0)
|
||||
, _41(0), _42(0), _43(0), _44(1.0f)
|
||||
, _51(0), _52(0), _53(0), _54(0)
|
||||
{}
|
||||
Matrix5x4(Float a11, Float a12, Float a13, Float a14,
|
||||
Float a21, Float a22, Float a23, Float a24,
|
||||
Float a31, Float a32, Float a33, Float a34,
|
||||
Float a41, Float a42, Float a43, Float a44,
|
||||
Float a51, Float a52, Float a53, Float a54)
|
||||
: _11(a11), _12(a12), _13(a13), _14(a14)
|
||||
, _21(a21), _22(a22), _23(a23), _24(a24)
|
||||
, _31(a31), _32(a32), _33(a33), _34(a34)
|
||||
, _41(a41), _42(a42), _43(a43), _44(a44)
|
||||
, _51(a51), _52(a52), _53(a53), _54(a54)
|
||||
{}
|
||||
Float _11, _12, _13, _14;
|
||||
Float _21, _22, _23, _24;
|
||||
Float _31, _32, _33, _34;
|
||||
Float _41, _42, _43, _44;
|
||||
Float _51, _52, _53, _54;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "Types.h"
|
||||
#include "BasePoint.h"
|
||||
#include "BasePoint3D.h"
|
||||
#include "BaseSize.h"
|
||||
|
||||
#include <cmath>
|
||||
|
@ -70,6 +71,27 @@ IntPointTyped<units> RoundedToInt(const PointTyped<units>& aPoint) {
|
|||
int32_t(floorf(aPoint.y + 0.5f)));
|
||||
}
|
||||
|
||||
template<class units>
|
||||
struct Point3DTyped :
|
||||
public BasePoint3D< Float, Point3DTyped<units> > {
|
||||
typedef BasePoint3D< Float, Point3DTyped<units> > Super;
|
||||
|
||||
Point3DTyped() : Super() {}
|
||||
Point3DTyped(Float aX, Float aY, Float aZ) : Super(aX, aY, aZ) {}
|
||||
|
||||
// XXX When all of the code is ported, the following functions to convert to and from
|
||||
// unknown types should be removed.
|
||||
|
||||
static Point3DTyped<units> FromUnknownPoint(const Point3DTyped<UnknownUnits>& aPoint) {
|
||||
return Point3DTyped<units>(aPoint.x, aPoint.y, aPoint.z);
|
||||
}
|
||||
|
||||
Point3DTyped<UnknownUnits> ToUnknownPoint() const {
|
||||
return Point3DTyped<UnknownUnits>(this->x, this->y, this->z);
|
||||
}
|
||||
};
|
||||
typedef Point3DTyped<UnknownUnits> Point3D;
|
||||
|
||||
template<class units>
|
||||
struct IntSizeTyped :
|
||||
public BaseSize< int32_t, IntSizeTyped<units> >,
|
||||
|
|
Загрузка…
Ссылка в новой задаче