mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 685322 - Create explicit conversion constructors for Rect and Point taking IntRect and IntPoint. r=roc
This commit is contained in:
parent
af1b95f9bb
commit
22c35b1a70
@ -45,26 +45,21 @@
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
||||
struct Point :
|
||||
public BasePoint<Float, Point> {
|
||||
typedef BasePoint<Float, Point> Super;
|
||||
Point() : Super() {}
|
||||
Point(Float aX, Float aY) : Super(aX, aY) {}
|
||||
};
|
||||
|
||||
struct IntPoint :
|
||||
public BasePoint<int32_t, Point> {
|
||||
typedef BasePoint<int32_t, Point> Super;
|
||||
public BasePoint<int32_t, IntPoint> {
|
||||
typedef BasePoint<int32_t, IntPoint> Super;
|
||||
|
||||
IntPoint() : Super() {}
|
||||
IntPoint(int32_t aX, int32_t aY) : Super(aX, aY) {}
|
||||
};
|
||||
|
||||
struct Size :
|
||||
public BaseSize<Float, Size> {
|
||||
typedef BaseSize<Float, Size> Super;
|
||||
struct Point :
|
||||
public BasePoint<Float, Point> {
|
||||
typedef BasePoint<Float, Point> Super;
|
||||
|
||||
Size() : Super() {}
|
||||
Size(Float aWidth, Float aHeight) : Super(aWidth, aHeight) {}
|
||||
Point() : Super() {}
|
||||
Point(Float aX, Float aY) : Super(aX, aY) {}
|
||||
Point(const IntPoint& point) : Super(point.x, point.y) {}
|
||||
};
|
||||
|
||||
struct IntSize :
|
||||
@ -75,6 +70,15 @@ struct IntSize :
|
||||
IntSize(int32_t aWidth, int32_t aHeight) : Super(aWidth, aHeight) {}
|
||||
};
|
||||
|
||||
struct Size :
|
||||
public BaseSize<Float, Size> {
|
||||
typedef BaseSize<Float, Size> Super;
|
||||
|
||||
Size() : Super() {}
|
||||
Size(Float aWidth, Float aHeight) : Super(aWidth, aHeight) {}
|
||||
explicit Size(const IntSize& size) : Super(size.width, size.height) {}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,17 +55,6 @@ struct Margin :
|
||||
: Super(aLeft, aTop, aRight, aBottom) {}
|
||||
};
|
||||
|
||||
struct Rect :
|
||||
public BaseRect<Float, Rect, Point, Size, Margin> {
|
||||
typedef BaseRect<Float, Rect, Point, mozilla::gfx::Size, Margin> Super;
|
||||
|
||||
Rect() : Super() {}
|
||||
Rect(Point aPos, mozilla::gfx::Size aSize) :
|
||||
Super(aPos, aSize) {}
|
||||
Rect(Float _x, Float _y, Float _width, Float _height) :
|
||||
Super(_x, _y, _width, _height) {}
|
||||
};
|
||||
|
||||
struct IntRect :
|
||||
public BaseRect<int32_t, IntRect, IntPoint, IntSize, Margin> {
|
||||
typedef BaseRect<int32_t, IntRect, IntPoint, mozilla::gfx::IntSize, Margin> Super;
|
||||
@ -77,6 +66,19 @@ struct IntRect :
|
||||
Super(_x, _y, _width, _height) {}
|
||||
};
|
||||
|
||||
struct Rect :
|
||||
public BaseRect<Float, Rect, Point, Size, Margin> {
|
||||
typedef BaseRect<Float, Rect, Point, mozilla::gfx::Size, Margin> Super;
|
||||
|
||||
Rect() : Super() {}
|
||||
Rect(Point aPos, mozilla::gfx::Size aSize) :
|
||||
Super(aPos, aSize) {}
|
||||
Rect(Float _x, Float _y, Float _width, Float _height) :
|
||||
Super(_x, _y, _width, _height) {}
|
||||
explicit Rect(const IntRect& rect) :
|
||||
Super(rect.x, rect.y, rect.width, rect.height) {}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user