2011-06-24 10:41:16 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
2012-05-21 04:12:37 -07:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2011-05-26 12:41:33 -07:00
|
|
|
|
2011-06-24 10:41:16 -07:00
|
|
|
#ifndef MOZILLA_GFX_POINT_H_
|
|
|
|
#define MOZILLA_GFX_POINT_H_
|
2011-05-26 12:41:33 -07:00
|
|
|
|
2011-06-24 10:41:16 -07:00
|
|
|
#include "Types.h"
|
|
|
|
#include "BasePoint.h"
|
|
|
|
#include "BaseSize.h"
|
2011-05-26 12:41:33 -07:00
|
|
|
|
2011-06-24 10:41:16 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
2011-05-26 12:41:33 -07:00
|
|
|
|
2013-05-29 06:32:30 -07:00
|
|
|
// This should only be used by the typedefs below.
|
|
|
|
struct UnknownUnits {};
|
2011-11-13 20:29:01 -08:00
|
|
|
|
2013-05-29 06:32:30 -07:00
|
|
|
template<class units>
|
|
|
|
struct IntPointTyped :
|
|
|
|
public BasePoint< int32_t, IntPointTyped<units> >,
|
|
|
|
public units {
|
|
|
|
typedef BasePoint< int32_t, IntPointTyped<units> > Super;
|
|
|
|
|
|
|
|
IntPointTyped() : Super() {}
|
|
|
|
IntPointTyped(int32_t aX, int32_t aY) : Super(aX, aY) {}
|
2011-11-13 20:29:01 -08:00
|
|
|
};
|
2013-05-29 06:32:30 -07:00
|
|
|
typedef IntPointTyped<UnknownUnits> IntPoint;
|
2011-11-13 20:29:01 -08:00
|
|
|
|
2013-05-29 06:32:30 -07:00
|
|
|
template<class units>
|
|
|
|
struct PointTyped :
|
|
|
|
public BasePoint< Float, PointTyped<units> >,
|
|
|
|
public units {
|
|
|
|
typedef BasePoint< Float, PointTyped<units> > Super;
|
2011-11-13 20:29:01 -08:00
|
|
|
|
2013-05-29 06:32:30 -07:00
|
|
|
PointTyped() : Super() {}
|
|
|
|
PointTyped(Float aX, Float aY) : Super(aX, aY) {}
|
|
|
|
PointTyped(const IntPointTyped<units>& point) : Super(float(point.x), float(point.y)) {}
|
2011-06-24 10:41:16 -07:00
|
|
|
};
|
2013-05-29 06:32:30 -07:00
|
|
|
typedef PointTyped<UnknownUnits> Point;
|
2011-05-26 12:41:33 -07:00
|
|
|
|
2013-05-29 06:32:30 -07:00
|
|
|
template<class units>
|
|
|
|
struct IntSizeTyped :
|
|
|
|
public BaseSize< int32_t, IntSizeTyped<units> >,
|
|
|
|
public units {
|
|
|
|
typedef BaseSize< int32_t, IntSizeTyped<units> > Super;
|
2011-11-13 20:29:01 -08:00
|
|
|
|
2013-05-29 06:32:30 -07:00
|
|
|
IntSizeTyped() : Super() {}
|
|
|
|
IntSizeTyped(int32_t aWidth, int32_t aHeight) : Super(aWidth, aHeight) {}
|
2011-06-24 10:41:16 -07:00
|
|
|
};
|
2013-05-29 06:32:30 -07:00
|
|
|
typedef IntSizeTyped<UnknownUnits> IntSize;
|
2011-05-26 12:41:33 -07:00
|
|
|
|
2013-05-29 06:32:30 -07:00
|
|
|
template<class units>
|
|
|
|
struct SizeTyped :
|
|
|
|
public BaseSize< Float, SizeTyped<units> >,
|
|
|
|
public units {
|
|
|
|
typedef BaseSize< Float, SizeTyped<units> > Super;
|
2011-05-26 12:41:33 -07:00
|
|
|
|
2013-05-29 06:32:30 -07:00
|
|
|
SizeTyped() : Super() {}
|
|
|
|
SizeTyped(Float aWidth, Float aHeight) : Super(aWidth, aHeight) {}
|
|
|
|
explicit SizeTyped(const IntSizeTyped<units>& size) :
|
2013-03-04 06:38:11 -08:00
|
|
|
Super(float(size.width), float(size.height)) {}
|
2011-05-26 12:41:33 -07:00
|
|
|
};
|
2013-05-29 06:32:30 -07:00
|
|
|
typedef SizeTyped<UnknownUnits> Size;
|
2011-05-26 12:41:33 -07:00
|
|
|
|
2011-06-24 10:41:16 -07:00
|
|
|
}
|
2011-05-26 12:41:33 -07:00
|
|
|
}
|
|
|
|
|
2011-06-24 10:41:16 -07:00
|
|
|
#endif /* MOZILLA_GFX_POINT_H_ */
|