mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1205511 - Add overloaded operators for multiplying and dividing an IntPointTyped by a ScaleFactor[2D]. r=kats
The overloads return PointTyped, leaving it to the caller to round or truncate if desired, much like the existing Rect counterparts.
This commit is contained in:
parent
6f5d9f43e2
commit
2ef7ce7a80
@ -448,6 +448,30 @@ gfx::PointTyped<dst> operator/(const gfx::PointTyped<src>& aPoint, const gfx::Sc
|
||||
aPoint.y / aScale.yScale);
|
||||
}
|
||||
|
||||
template<class src, class dst>
|
||||
gfx::PointTyped<dst> operator*(const gfx::IntPointTyped<src>& aPoint, const gfx::ScaleFactor<src, dst>& aScale) {
|
||||
return gfx::PointTyped<dst>(float(aPoint.x) * aScale.scale,
|
||||
float(aPoint.y) * aScale.scale);
|
||||
}
|
||||
|
||||
template<class src, class dst>
|
||||
gfx::PointTyped<dst> operator/(const gfx::IntPointTyped<src>& aPoint, const gfx::ScaleFactor<dst, src>& aScale) {
|
||||
return gfx::PointTyped<dst>(float(aPoint.x) / aScale.scale,
|
||||
float(aPoint.y) / aScale.scale);
|
||||
}
|
||||
|
||||
template<class src, class dst>
|
||||
gfx::PointTyped<dst> operator*(const gfx::IntPointTyped<src>& aPoint, const gfx::ScaleFactors2D<src, dst>& aScale) {
|
||||
return gfx::PointTyped<dst>(float(aPoint.x) * aScale.xScale,
|
||||
float(aPoint.y) * aScale.yScale);
|
||||
}
|
||||
|
||||
template<class src, class dst>
|
||||
gfx::PointTyped<dst> operator/(const gfx::IntPointTyped<src>& aPoint, const gfx::ScaleFactors2D<dst, src>& aScale) {
|
||||
return gfx::PointTyped<dst>(float(aPoint.x) / aScale.xScale,
|
||||
float(aPoint.y) / aScale.yScale);
|
||||
}
|
||||
|
||||
template<class src, class dst>
|
||||
gfx::RectTyped<dst> operator*(const gfx::RectTyped<src>& aRect, const gfx::ScaleFactor<src, dst>& aScale) {
|
||||
return gfx::RectTyped<dst>(aRect.x * aScale.scale,
|
||||
|
Loading…
Reference in New Issue
Block a user