/work/obj-fuzz/dist/include/mozilla/gfx/BasePoint.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef MOZILLA_GFX_BASEPOINT_H_ |
8 | | #define MOZILLA_GFX_BASEPOINT_H_ |
9 | | |
10 | | #include <cmath> |
11 | | #include <ostream> |
12 | | #include "mozilla/Attributes.h" |
13 | | #include "mozilla/FloatingPoint.h" |
14 | | #include "mozilla/TypeTraits.h" |
15 | | |
16 | | namespace mozilla { |
17 | | namespace gfx { |
18 | | |
19 | | /** |
20 | | * Do not use this class directly. Subclass it, pass that subclass as the |
21 | | * Sub parameter, and only use that subclass. This allows methods to safely |
22 | | * cast 'this' to 'Sub*'. |
23 | | */ |
24 | | template <class T, class Sub, class Coord = T> |
25 | | struct BasePoint { |
26 | | union { |
27 | | struct { |
28 | | T x, y; |
29 | | }; |
30 | | T components[2]; |
31 | | }; |
32 | | |
33 | | // Constructors |
34 | 0 | constexpr BasePoint() : x(0), y(0) {} Unexecuted instantiation: mozilla::gfx::BasePoint<int, nsPoint, int>::BasePoint() Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntCoordTyped<mozilla::gfx::UnknownUnits> >::BasePoint() Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::LayoutDevicePixel, float>, mozilla::gfx::CoordTyped<mozilla::LayoutDevicePixel, float> >::BasePoint() Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::ScreenPixel, float>, mozilla::gfx::CoordTyped<mozilla::ScreenPixel, float> >::BasePoint() Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntCoordTyped<mozilla::LayoutDevicePixel> >::BasePoint() Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float>, mozilla::gfx::CoordTyped<mozilla::gfx::UnknownUnits, float> >::BasePoint() Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::CSSPixel, float>, mozilla::gfx::CoordTyped<mozilla::CSSPixel, float> >::BasePoint() Unexecuted instantiation: mozilla::gfx::BasePoint<double, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, double>, mozilla::gfx::CoordTyped<mozilla::gfx::UnknownUnits, double> >::BasePoint() Unexecuted instantiation: mozilla::gfx::BasePoint<double, mozilla::gfx::PointD, double>::BasePoint() Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::LayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::LayerPixel, float> >::BasePoint() Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntCoordTyped<mozilla::LayerPixel> >::BasePoint() Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::ParentLayerPixel, float> >::BasePoint() Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::ScreenPixel>, mozilla::gfx::IntCoordTyped<mozilla::ScreenPixel> >::BasePoint() Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntCoordTyped<mozilla::ParentLayerPixel> >::BasePoint() Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::TileCoordUnit>, mozilla::gfx::IntCoordTyped<mozilla::TileCoordUnit> >::BasePoint() Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::RenderTargetPixel, float>, mozilla::gfx::CoordTyped<mozilla::RenderTargetPixel, float> >::BasePoint() Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntCoordTyped<mozilla::CSSPixel> >::BasePoint() |
35 | 15 | constexpr BasePoint(Coord aX, Coord aY) : x(aX), y(aY) {} Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::CSSPixel, float>, mozilla::gfx::CoordTyped<mozilla::CSSPixel, float> >::BasePoint(mozilla::gfx::CoordTyped<mozilla::CSSPixel, float>, mozilla::gfx::CoordTyped<mozilla::CSSPixel, float>) mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntCoordTyped<mozilla::LayoutDevicePixel> >::BasePoint(mozilla::gfx::IntCoordTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntCoordTyped<mozilla::LayoutDevicePixel>) Line | Count | Source | 35 | 9 | constexpr BasePoint(Coord aX, Coord aY) : x(aX), y(aY) {} |
Unexecuted instantiation: mozilla::gfx::BasePoint<double, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, double>, mozilla::gfx::CoordTyped<mozilla::gfx::UnknownUnits, double> >::BasePoint(mozilla::gfx::CoordTyped<mozilla::gfx::UnknownUnits, double>, mozilla::gfx::CoordTyped<mozilla::gfx::UnknownUnits, double>) Unexecuted instantiation: mozilla::gfx::BasePoint<int, nsPoint, int>::BasePoint(int, int) Unexecuted instantiation: mozilla::gfx::BasePoint<double, mozilla::gfx::PointD, double>::BasePoint(double, double) Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::RenderTargetPixel>, mozilla::gfx::IntCoordTyped<mozilla::RenderTargetPixel> >::BasePoint(mozilla::gfx::IntCoordTyped<mozilla::RenderTargetPixel>, mozilla::gfx::IntCoordTyped<mozilla::RenderTargetPixel>) Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::TileCoordUnit>, mozilla::gfx::IntCoordTyped<mozilla::TileCoordUnit> >::BasePoint(mozilla::gfx::IntCoordTyped<mozilla::TileCoordUnit>, mozilla::gfx::IntCoordTyped<mozilla::TileCoordUnit>) Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntCoordTyped<mozilla::LayerPixel> >::BasePoint(mozilla::gfx::IntCoordTyped<mozilla::LayerPixel>, mozilla::gfx::IntCoordTyped<mozilla::LayerPixel>) Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::LayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::LayerPixel, float> >::BasePoint(mozilla::gfx::CoordTyped<mozilla::LayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::LayerPixel, float>) Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::LayoutDevicePixel, float>, mozilla::gfx::CoordTyped<mozilla::LayoutDevicePixel, float> >::BasePoint(mozilla::gfx::CoordTyped<mozilla::LayoutDevicePixel, float>, mozilla::gfx::CoordTyped<mozilla::LayoutDevicePixel, float>) Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::ScreenPixel, float>, mozilla::gfx::CoordTyped<mozilla::ScreenPixel, float> >::BasePoint(mozilla::gfx::CoordTyped<mozilla::ScreenPixel, float>, mozilla::gfx::CoordTyped<mozilla::ScreenPixel, float>) Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::ParentLayerPixel, float> >::BasePoint(mozilla::gfx::CoordTyped<mozilla::ParentLayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::ParentLayerPixel, float>) Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::ScreenPixel>, mozilla::gfx::IntCoordTyped<mozilla::ScreenPixel> >::BasePoint(mozilla::gfx::IntCoordTyped<mozilla::ScreenPixel>, mozilla::gfx::IntCoordTyped<mozilla::ScreenPixel>) Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntCoordTyped<mozilla::ParentLayerPixel> >::BasePoint(mozilla::gfx::IntCoordTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntCoordTyped<mozilla::ParentLayerPixel>) Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::RenderTargetPixel, float>, mozilla::gfx::CoordTyped<mozilla::RenderTargetPixel, float> >::BasePoint(mozilla::gfx::CoordTyped<mozilla::RenderTargetPixel, float>, mozilla::gfx::CoordTyped<mozilla::RenderTargetPixel, float>) mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntCoordTyped<mozilla::CSSPixel> >::BasePoint(mozilla::gfx::IntCoordTyped<mozilla::CSSPixel>, mozilla::gfx::IntCoordTyped<mozilla::CSSPixel>) Line | Count | Source | 35 | 6 | constexpr BasePoint(Coord aX, Coord aY) : x(aX), y(aY) {} |
Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::DesktopPixel, float>, mozilla::gfx::CoordTyped<mozilla::DesktopPixel, float> >::BasePoint(mozilla::gfx::CoordTyped<mozilla::DesktopPixel, float>, mozilla::gfx::CoordTyped<mozilla::DesktopPixel, float>) |
36 | | |
37 | 0 | MOZ_ALWAYS_INLINE T X() const { return x; } Unexecuted instantiation: mozilla::gfx::BasePoint<int, nsPoint, int>::X() const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntCoordTyped<mozilla::gfx::UnknownUnits> >::X() const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntCoordTyped<mozilla::LayerPixel> >::X() const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::ParentLayerPixel, float> >::X() const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::CSSPixel, float>, mozilla::gfx::CoordTyped<mozilla::CSSPixel, float> >::X() const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntCoordTyped<mozilla::LayoutDevicePixel> >::X() const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntCoordTyped<mozilla::CSSPixel> >::X() const |
38 | 0 | MOZ_ALWAYS_INLINE T Y() const { return y; } Unexecuted instantiation: mozilla::gfx::BasePoint<int, nsPoint, int>::Y() const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntCoordTyped<mozilla::gfx::UnknownUnits> >::Y() const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntCoordTyped<mozilla::LayerPixel> >::Y() const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::ParentLayerPixel, float> >::Y() const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::CSSPixel, float>, mozilla::gfx::CoordTyped<mozilla::CSSPixel, float> >::Y() const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntCoordTyped<mozilla::LayoutDevicePixel> >::Y() const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntCoordTyped<mozilla::CSSPixel> >::Y() const |
39 | | |
40 | 0 | void MoveTo(T aX, T aY) { x = aX; y = aY; } |
41 | 0 | void MoveBy(T aDx, T aDy) { x += aDx; y += aDy; } Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::ScreenPixel>, mozilla::gfx::IntCoordTyped<mozilla::ScreenPixel> >::MoveBy(int, int) Unexecuted instantiation: mozilla::gfx::BasePoint<int, nsPoint, int>::MoveBy(int, int) |
42 | | |
43 | | // Note that '=' isn't defined so we'll get the |
44 | | // compiler generated default assignment operator |
45 | | |
46 | 0 | bool operator==(const Sub& aPoint) const { |
47 | 0 | return x == aPoint.x && y == aPoint.y; |
48 | 0 | } Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float>, mozilla::gfx::CoordTyped<mozilla::gfx::UnknownUnits, float> >::operator==(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::CSSPixel, float>, mozilla::gfx::CoordTyped<mozilla::CSSPixel, float> >::operator==(mozilla::gfx::PointTyped<mozilla::CSSPixel, float> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<int, nsPoint, int>::operator==(nsPoint const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntCoordTyped<mozilla::gfx::UnknownUnits> >::operator==(mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::LayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::LayerPixel, float> >::operator==(mozilla::gfx::PointTyped<mozilla::LayerPixel, float> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntCoordTyped<mozilla::LayoutDevicePixel> >::operator==(mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntCoordTyped<mozilla::LayerPixel> >::operator==(mozilla::gfx::IntPointTyped<mozilla::LayerPixel> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::ParentLayerPixel, float> >::operator==(mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<double, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, double>, mozilla::gfx::CoordTyped<mozilla::gfx::UnknownUnits, double> >::operator==(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, double> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::ScreenPixel, float>, mozilla::gfx::CoordTyped<mozilla::ScreenPixel, float> >::operator==(mozilla::gfx::PointTyped<mozilla::ScreenPixel, float> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::LayoutDevicePixel, float>, mozilla::gfx::CoordTyped<mozilla::LayoutDevicePixel, float> >::operator==(mozilla::gfx::PointTyped<mozilla::LayoutDevicePixel, float> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::ScreenPixel>, mozilla::gfx::IntCoordTyped<mozilla::ScreenPixel> >::operator==(mozilla::gfx::IntPointTyped<mozilla::ScreenPixel> const&) const |
49 | 0 | bool operator!=(const Sub& aPoint) const { |
50 | 0 | return x != aPoint.x || y != aPoint.y; |
51 | 0 | } Unexecuted instantiation: mozilla::gfx::BasePoint<int, nsPoint, int>::operator!=(nsPoint const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<double, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, double>, mozilla::gfx::CoordTyped<mozilla::gfx::UnknownUnits, double> >::operator!=(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, double> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntCoordTyped<mozilla::gfx::UnknownUnits> >::operator!=(mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::LayoutDevicePixel, float>, mozilla::gfx::CoordTyped<mozilla::LayoutDevicePixel, float> >::operator!=(mozilla::gfx::PointTyped<mozilla::LayoutDevicePixel, float> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::LayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::LayerPixel, float> >::operator!=(mozilla::gfx::PointTyped<mozilla::LayerPixel, float> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::CSSPixel, float>, mozilla::gfx::CoordTyped<mozilla::CSSPixel, float> >::operator!=(mozilla::gfx::PointTyped<mozilla::CSSPixel, float> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::ParentLayerPixel, float> >::operator!=(mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel>, mozilla::gfx::IntCoordTyped<mozilla::ParentLayerPixel> >::operator!=(mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntCoordTyped<mozilla::CSSPixel> >::operator!=(mozilla::gfx::IntPointTyped<mozilla::CSSPixel> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntCoordTyped<mozilla::LayoutDevicePixel> >::operator!=(mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel> const&) const |
52 | | |
53 | 0 | Sub operator+(const Sub& aPoint) const { |
54 | 0 | return Sub(x + aPoint.x, y + aPoint.y); |
55 | 0 | } Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntCoordTyped<mozilla::LayoutDevicePixel> >::operator+(mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<double, mozilla::gfx::PointD, double>::operator+(mozilla::gfx::PointD const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<double, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, double>, mozilla::gfx::CoordTyped<mozilla::gfx::UnknownUnits, double> >::operator+(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, double> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::ScreenPixel, float>, mozilla::gfx::CoordTyped<mozilla::ScreenPixel, float> >::operator+(mozilla::gfx::PointTyped<mozilla::ScreenPixel, float> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::ParentLayerPixel, float> >::operator+(mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::CSSPixel, float>, mozilla::gfx::CoordTyped<mozilla::CSSPixel, float> >::operator+(mozilla::gfx::PointTyped<mozilla::CSSPixel, float> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::LayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::LayerPixel, float> >::operator+(mozilla::gfx::PointTyped<mozilla::LayerPixel, float> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<int, nsPoint, int>::operator+(nsPoint const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntCoordTyped<mozilla::CSSPixel> >::operator+(mozilla::gfx::IntPointTyped<mozilla::CSSPixel> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::LayoutDevicePixel, float>, mozilla::gfx::CoordTyped<mozilla::LayoutDevicePixel, float> >::operator+(mozilla::gfx::PointTyped<mozilla::LayoutDevicePixel, float> const&) const |
56 | 0 | Sub operator-(const Sub& aPoint) const { |
57 | 0 | return Sub(x - aPoint.x, y - aPoint.y); |
58 | 0 | } Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntCoordTyped<mozilla::gfx::UnknownUnits> >::operator-(mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<double, mozilla::gfx::PointD, double>::operator-(mozilla::gfx::PointD const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<int, nsPoint, int>::operator-(nsPoint const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<double, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, double>, mozilla::gfx::CoordTyped<mozilla::gfx::UnknownUnits, double> >::operator-(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, double> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::LayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::LayerPixel, float> >::operator-(mozilla::gfx::PointTyped<mozilla::LayerPixel, float> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::ScreenPixel, float>, mozilla::gfx::CoordTyped<mozilla::ScreenPixel, float> >::operator-(mozilla::gfx::PointTyped<mozilla::ScreenPixel, float> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::ParentLayerPixel, float> >::operator-(mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::CSSPixel, float>, mozilla::gfx::CoordTyped<mozilla::CSSPixel, float> >::operator-(mozilla::gfx::PointTyped<mozilla::CSSPixel, float> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::ScreenPixel>, mozilla::gfx::IntCoordTyped<mozilla::ScreenPixel> >::operator-(mozilla::gfx::IntPointTyped<mozilla::ScreenPixel> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntCoordTyped<mozilla::LayoutDevicePixel> >::operator-(mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntCoordTyped<mozilla::CSSPixel> >::operator-(mozilla::gfx::IntPointTyped<mozilla::CSSPixel> const&) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::LayoutDevicePixel, float>, mozilla::gfx::CoordTyped<mozilla::LayoutDevicePixel, float> >::operator-(mozilla::gfx::PointTyped<mozilla::LayoutDevicePixel, float> const&) const |
59 | 0 | Sub& operator+=(const Sub& aPoint) { |
60 | 0 | x += aPoint.x; |
61 | 0 | y += aPoint.y; |
62 | 0 | return *static_cast<Sub*>(this); |
63 | 0 | } Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::CSSPixel, float>, mozilla::gfx::CoordTyped<mozilla::CSSPixel, float> >::operator+=(mozilla::gfx::PointTyped<mozilla::CSSPixel, float> const&) Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float>, mozilla::gfx::CoordTyped<mozilla::gfx::UnknownUnits, float> >::operator+=(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) Unexecuted instantiation: mozilla::gfx::BasePoint<int, nsPoint, int>::operator+=(nsPoint const&) Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntCoordTyped<mozilla::gfx::UnknownUnits> >::operator+=(mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits> const&) Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::ParentLayerPixel, float> >::operator+=(mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float> const&) Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntCoordTyped<mozilla::LayoutDevicePixel> >::operator+=(mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel> const&) Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::CSSPixel>, mozilla::gfx::IntCoordTyped<mozilla::CSSPixel> >::operator+=(mozilla::gfx::IntPointTyped<mozilla::CSSPixel> const&) Unexecuted instantiation: mozilla::gfx::BasePoint<double, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, double>, mozilla::gfx::CoordTyped<mozilla::gfx::UnknownUnits, double> >::operator+=(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, double> const&) |
64 | 0 | Sub& operator-=(const Sub& aPoint) { |
65 | 0 | x -= aPoint.x; |
66 | 0 | y -= aPoint.y; |
67 | 0 | return *static_cast<Sub*>(this); |
68 | 0 | } Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float>, mozilla::gfx::CoordTyped<mozilla::gfx::UnknownUnits, float> >::operator-=(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntCoordTyped<mozilla::gfx::UnknownUnits> >::operator-=(mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits> const&) Unexecuted instantiation: mozilla::gfx::BasePoint<int, nsPoint, int>::operator-=(nsPoint const&) Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntCoordTyped<mozilla::LayoutDevicePixel> >::operator-=(mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel> const&) Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::CSSPixel, float>, mozilla::gfx::CoordTyped<mozilla::CSSPixel, float> >::operator-=(mozilla::gfx::PointTyped<mozilla::CSSPixel, float> const&) |
69 | | |
70 | 0 | Sub operator*(T aScale) const { |
71 | 0 | return Sub(x * aScale, y * aScale); |
72 | 0 | } Unexecuted instantiation: mozilla::gfx::BasePoint<double, mozilla::gfx::PointD, double>::operator*(double) const Unexecuted instantiation: mozilla::gfx::BasePoint<double, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, double>, mozilla::gfx::CoordTyped<mozilla::gfx::UnknownUnits, double> >::operator*(double) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::ParentLayerPixel, float> >::operator*(float) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::CSSPixel, float>, mozilla::gfx::CoordTyped<mozilla::CSSPixel, float> >::operator*(float) const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntCoordTyped<mozilla::gfx::UnknownUnits> >::operator*(int) const Unexecuted instantiation: mozilla::gfx::BasePoint<int, nsPoint, int>::operator*(int) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::LayoutDevicePixel, float>, mozilla::gfx::CoordTyped<mozilla::LayoutDevicePixel, float> >::operator*(float) const |
73 | 0 | Sub operator/(T aScale) const { |
74 | 0 | return Sub(x / aScale, y / aScale); |
75 | 0 | } Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float>, mozilla::gfx::CoordTyped<mozilla::gfx::UnknownUnits, float> >::operator/(float) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::ParentLayerPixel, float> >::operator/(float) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::CSSPixel, float>, mozilla::gfx::CoordTyped<mozilla::CSSPixel, float> >::operator/(float) const Unexecuted instantiation: mozilla::gfx::BasePoint<int, nsPoint, int>::operator/(int) const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::LayoutDevicePixel, float>, mozilla::gfx::CoordTyped<mozilla::LayoutDevicePixel, float> >::operator/(float) const Unexecuted instantiation: mozilla::gfx::BasePoint<double, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, double>, mozilla::gfx::CoordTyped<mozilla::gfx::UnknownUnits, double> >::operator/(double) const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntCoordTyped<mozilla::gfx::UnknownUnits> >::operator/(int) const |
76 | | |
77 | 0 | Sub operator-() const { |
78 | 0 | return Sub(-x, -y); |
79 | 0 | } Unexecuted instantiation: mozilla::gfx::BasePoint<double, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, double>, mozilla::gfx::CoordTyped<mozilla::gfx::UnknownUnits, double> >::operator-() const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntCoordTyped<mozilla::gfx::UnknownUnits> >::operator-() const Unexecuted instantiation: mozilla::gfx::BasePoint<int, nsPoint, int>::operator-() const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::RenderTargetPixel>, mozilla::gfx::IntCoordTyped<mozilla::RenderTargetPixel> >::operator-() const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::LayerPixel>, mozilla::gfx::IntCoordTyped<mozilla::LayerPixel> >::operator-() const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::LayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::LayerPixel, float> >::operator-() const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::ParentLayerPixel, float> >::operator-() const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel>, mozilla::gfx::IntCoordTyped<mozilla::LayoutDevicePixel> >::operator-() const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::ScreenPixel, float>, mozilla::gfx::CoordTyped<mozilla::ScreenPixel, float> >::operator-() const |
80 | | |
81 | 0 | T DotProduct(const Sub& aPoint) const { |
82 | 0 | return x * aPoint.x + y * aPoint.y; |
83 | 0 | } |
84 | | |
85 | 0 | Coord Length() const { |
86 | 0 | return hypot(x, y); |
87 | 0 | } Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float>, mozilla::gfx::CoordTyped<mozilla::gfx::UnknownUnits, float> >::Length() const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::ScreenPixel, float>, mozilla::gfx::CoordTyped<mozilla::ScreenPixel, float> >::Length() const Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::ParentLayerPixel, float> >::Length() const Unexecuted instantiation: mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::ScreenPixel>, mozilla::gfx::IntCoordTyped<mozilla::ScreenPixel> >::Length() const |
88 | | |
89 | 0 | T LengthSquare() const { |
90 | 0 | return x * x + y * y; |
91 | 0 | } |
92 | | |
93 | | // Round() is *not* rounding to nearest integer if the values are negative. |
94 | | // They are always rounding as floor(n + 0.5). |
95 | | // See https://bugzilla.mozilla.org/show_bug.cgi?id=410748#c14 |
96 | 0 | Sub& Round() { |
97 | 0 | x = Coord(std::floor(T(x) + T(0.5f))); |
98 | 0 | y = Coord(std::floor(T(y) + T(0.5f))); |
99 | 0 | return *static_cast<Sub*>(this); |
100 | 0 | } Unexecuted instantiation: mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float>, mozilla::gfx::CoordTyped<mozilla::gfx::UnknownUnits, float> >::Round() Unexecuted instantiation: mozilla::gfx::BasePoint<double, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, double>, mozilla::gfx::CoordTyped<mozilla::gfx::UnknownUnits, double> >::Round() |
101 | | |
102 | | // "Finite" means not inf and not NaN |
103 | | bool IsFinite() const |
104 | 0 | { |
105 | 0 | typedef typename mozilla::Conditional<mozilla::IsSame<T, float>::value, float, double>::Type FloatType; |
106 | 0 | return (mozilla::IsFinite(FloatType(x)) && mozilla::IsFinite(FloatType(y))); |
107 | 0 | return true; |
108 | 0 | } |
109 | | |
110 | | void Clamp(T aMaxAbsValue) |
111 | 0 | { |
112 | 0 | x = std::max(std::min(x, aMaxAbsValue), -aMaxAbsValue); |
113 | 0 | y = std::max(std::min(y, aMaxAbsValue), -aMaxAbsValue); |
114 | 0 | } |
115 | | |
116 | 0 | friend std::ostream& operator<<(std::ostream& stream, const BasePoint<T, Sub, Coord>& aPoint) { |
117 | 0 | return stream << '(' << aPoint.x << ',' << aPoint.y << ')'; |
118 | 0 | } Unexecuted instantiation: mozilla::gfx::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float>, mozilla::gfx::CoordTyped<mozilla::gfx::UnknownUnits, float> > const&) Unexecuted instantiation: mozilla::gfx::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, mozilla::gfx::BasePoint<int, mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::IntCoordTyped<mozilla::gfx::UnknownUnits> > const&) Unexecuted instantiation: mozilla::gfx::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::LayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::LayerPixel, float> > const&) Unexecuted instantiation: mozilla::gfx::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::CSSPixel, float>, mozilla::gfx::CoordTyped<mozilla::CSSPixel, float> > const&) Unexecuted instantiation: mozilla::gfx::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float>, mozilla::gfx::CoordTyped<mozilla::ParentLayerPixel, float> > const&) |
119 | | |
120 | | }; |
121 | | |
122 | | } // namespace gfx |
123 | | } // namespace mozilla |
124 | | |
125 | | #endif /* MOZILLA_GFX_BASEPOINT_H_ */ |