/src/mozilla-central/layout/base/UnitTransforms.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 MOZ_UNIT_TRANSFORMS_H_ |
8 | | #define MOZ_UNIT_TRANSFORMS_H_ |
9 | | |
10 | | #include "Units.h" |
11 | | #include "mozilla/gfx/Matrix.h" |
12 | | #include "mozilla/Maybe.h" |
13 | | #include "nsRegion.h" |
14 | | |
15 | | namespace mozilla { |
16 | | |
17 | | // Convenience functions for converting an entity from one strongly-typed |
18 | | // coordinate system to another without changing the values it stores (this |
19 | | // can be thought of as a cast). |
20 | | // To use these functions, you must provide a justification for each use! |
21 | | // Feel free to add more justifications to PixelCastJustification, along with |
22 | | // a comment that explains under what circumstances it is appropriate to use. |
23 | | |
24 | | enum class PixelCastJustification : uint8_t { |
25 | | // For the root layer, Screen Pixel = Parent Layer Pixel. |
26 | | ScreenIsParentLayerForRoot, |
27 | | // On the layout side, Screen Pixel = LayoutDevice at the outer-window level. |
28 | | LayoutDeviceIsScreenForBounds, |
29 | | // For the root layer, Render Target Pixel = Parent Layer Pixel. |
30 | | RenderTargetIsParentLayerForRoot, |
31 | | // For the root composition size we want to view it as layer pixels in any layer |
32 | | ParentLayerToLayerForRootComposition, |
33 | | // The Layer coordinate space for one layer is the ParentLayer coordinate |
34 | | // space for its children |
35 | | MovingDownToChildren, |
36 | | // The transform that is usually used to convert between two coordinate |
37 | | // systems is not available (for example, because the object that stores it |
38 | | // is being destroyed), so fall back to the identity. |
39 | | TransformNotAvailable, |
40 | | // When an OS event is initially constructed, its reference point is |
41 | | // technically in screen pixels, as it has not yet accounted for any |
42 | | // asynchronous transforms. This justification is for viewing the initial |
43 | | // reference point as a screen point. The reverse is useful when synthetically |
44 | | // created WidgetEvents need to be converted back to InputData. |
45 | | LayoutDeviceIsScreenForUntransformedEvent, |
46 | | // Similar to LayoutDeviceIsScreenForUntransformedEvent, PBrowser handles |
47 | | // some widget/tab dimension information as the OS does -- in screen units. |
48 | | LayoutDeviceIsScreenForTabDims, |
49 | | // A combination of LayoutDeviceIsScreenForBounds and |
50 | | // ScreenIsParentLayerForRoot, which is how we're using it. |
51 | | LayoutDeviceIsParentLayerForRCDRSF, |
52 | | // Used to treat the product of AsyncTransformComponentMatrix objects |
53 | | // as an AsyncTransformMatrix. See the definitions of these matrices in |
54 | | // LayersTypes.h for details. |
55 | | MultipleAsyncTransforms, |
56 | | // We have reason to believe a layer doesn't have a local transform. |
57 | | // Should only be used if we've already checked or asserted this. |
58 | | NoTransformOnLayer |
59 | | }; |
60 | | |
61 | | template <class TargetUnits, class SourceUnits> |
62 | 0 | gfx::CoordTyped<TargetUnits> ViewAs(const gfx::CoordTyped<SourceUnits>& aCoord, PixelCastJustification) { |
63 | 0 | return gfx::CoordTyped<TargetUnits>(aCoord.value); |
64 | 0 | } |
65 | | template <class TargetUnits, class SourceUnits> |
66 | 0 | gfx::SizeTyped<TargetUnits> ViewAs(const gfx::SizeTyped<SourceUnits>& aSize, PixelCastJustification) { |
67 | 0 | return gfx::SizeTyped<TargetUnits>(aSize.width, aSize.height); |
68 | 0 | } Unexecuted instantiation: mozilla::gfx::SizeTyped<mozilla::LayerPixel, float> mozilla::ViewAs<mozilla::LayerPixel, mozilla::ParentLayerPixel>(mozilla::gfx::SizeTyped<mozilla::ParentLayerPixel, float> const&, mozilla::PixelCastJustification) Unexecuted instantiation: mozilla::gfx::SizeTyped<mozilla::ScreenPixel, float> mozilla::ViewAs<mozilla::ScreenPixel, mozilla::ParentLayerPixel>(mozilla::gfx::SizeTyped<mozilla::ParentLayerPixel, float> const&, mozilla::PixelCastJustification) |
69 | | template <class TargetUnits, class SourceUnits> |
70 | 0 | gfx::IntSizeTyped<TargetUnits> ViewAs(const gfx::IntSizeTyped<SourceUnits>& aSize, PixelCastJustification) { |
71 | 0 | return gfx::IntSizeTyped<TargetUnits>(aSize.width, aSize.height); |
72 | 0 | } Unexecuted instantiation: mozilla::gfx::IntSizeTyped<mozilla::ScreenPixel> mozilla::ViewAs<mozilla::ScreenPixel, mozilla::LayoutDevicePixel>(mozilla::gfx::IntSizeTyped<mozilla::LayoutDevicePixel> const&, mozilla::PixelCastJustification) Unexecuted instantiation: mozilla::gfx::IntSizeTyped<mozilla::LayoutDevicePixel> mozilla::ViewAs<mozilla::LayoutDevicePixel, mozilla::ScreenPixel>(mozilla::gfx::IntSizeTyped<mozilla::ScreenPixel> const&, mozilla::PixelCastJustification) |
73 | | template <class TargetUnits, class SourceUnits> |
74 | 0 | gfx::PointTyped<TargetUnits> ViewAs(const gfx::PointTyped<SourceUnits>& aPoint, PixelCastJustification) { |
75 | 0 | return gfx::PointTyped<TargetUnits>(aPoint.x, aPoint.y); |
76 | 0 | } Unexecuted instantiation: mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float> mozilla::ViewAs<mozilla::ParentLayerPixel, mozilla::ScreenPixel>(mozilla::gfx::PointTyped<mozilla::ScreenPixel, float> const&, mozilla::PixelCastJustification) Unexecuted instantiation: mozilla::gfx::PointTyped<mozilla::LayerPixel, float> mozilla::ViewAs<mozilla::LayerPixel, mozilla::ParentLayerPixel>(mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float> const&, mozilla::PixelCastJustification) Unexecuted instantiation: mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float> mozilla::ViewAs<mozilla::ParentLayerPixel, mozilla::LayerPixel>(mozilla::gfx::PointTyped<mozilla::LayerPixel, float> const&, mozilla::PixelCastJustification) Unexecuted instantiation: mozilla::gfx::PointTyped<mozilla::LayoutDevicePixel, float> mozilla::ViewAs<mozilla::LayoutDevicePixel, mozilla::ScreenPixel>(mozilla::gfx::PointTyped<mozilla::ScreenPixel, float> const&, mozilla::PixelCastJustification) |
77 | | template <class TargetUnits, class SourceUnits> |
78 | 0 | gfx::IntPointTyped<TargetUnits> ViewAs(const gfx::IntPointTyped<SourceUnits>& aPoint, PixelCastJustification) { |
79 | 0 | return gfx::IntPointTyped<TargetUnits>(aPoint.x, aPoint.y); |
80 | 0 | } Unexecuted instantiation: mozilla::gfx::IntPointTyped<mozilla::ScreenPixel> mozilla::ViewAs<mozilla::ScreenPixel, mozilla::LayoutDevicePixel>(mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel> const&, mozilla::PixelCastJustification) Unexecuted instantiation: mozilla::gfx::IntPointTyped<mozilla::LayoutDevicePixel> mozilla::ViewAs<mozilla::LayoutDevicePixel, mozilla::ScreenPixel>(mozilla::gfx::IntPointTyped<mozilla::ScreenPixel> const&, mozilla::PixelCastJustification) |
81 | | template <class TargetUnits, class SourceUnits> |
82 | | gfx::RectTyped<TargetUnits> ViewAs(const gfx::RectTyped<SourceUnits>& aRect, PixelCastJustification) { |
83 | | return gfx::RectTyped<TargetUnits>(aRect.x, aRect.y, aRect.Width(), aRect.Height()); |
84 | | } |
85 | | template <class TargetUnits, class SourceUnits> |
86 | 0 | gfx::IntRectTyped<TargetUnits> ViewAs(const gfx::IntRectTyped<SourceUnits>& aRect, PixelCastJustification) { |
87 | 0 | return gfx::IntRectTyped<TargetUnits>(aRect.x, aRect.y, aRect.Width(), aRect.Height()); |
88 | 0 | } Unexecuted instantiation: mozilla::gfx::IntRectTyped<mozilla::RenderTargetPixel> mozilla::ViewAs<mozilla::RenderTargetPixel, mozilla::ParentLayerPixel>(mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel> const&, mozilla::PixelCastJustification) Unexecuted instantiation: mozilla::gfx::IntRectTyped<mozilla::LayerPixel> mozilla::ViewAs<mozilla::LayerPixel, mozilla::ParentLayerPixel>(mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel> const&, mozilla::PixelCastJustification) Unexecuted instantiation: mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel> mozilla::ViewAs<mozilla::ParentLayerPixel, mozilla::LayerPixel>(mozilla::gfx::IntRectTyped<mozilla::LayerPixel> const&, mozilla::PixelCastJustification) Unexecuted instantiation: mozilla::gfx::IntRectTyped<mozilla::ScreenPixel> mozilla::ViewAs<mozilla::ScreenPixel, mozilla::LayoutDevicePixel>(mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel> const&, mozilla::PixelCastJustification) Unexecuted instantiation: mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel> mozilla::ViewAs<mozilla::LayoutDevicePixel, mozilla::gfx::UnknownUnits>(mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits> const&, mozilla::PixelCastJustification) Unexecuted instantiation: mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel> mozilla::ViewAs<mozilla::ParentLayerPixel, mozilla::LayoutDevicePixel>(mozilla::gfx::IntRectTyped<mozilla::LayoutDevicePixel> const&, mozilla::PixelCastJustification) |
89 | | template <class TargetUnits, class SourceUnits> |
90 | 0 | gfx::MarginTyped<TargetUnits> ViewAs(const gfx::MarginTyped<SourceUnits>& aMargin, PixelCastJustification) { |
91 | 0 | return gfx::MarginTyped<TargetUnits>(aMargin.top, aMargin.right, aMargin.bottom, aMargin.left); |
92 | 0 | } |
93 | | template <class TargetUnits, class SourceUnits> |
94 | | gfx::IntMarginTyped<TargetUnits> ViewAs(const gfx::IntMarginTyped<SourceUnits>& aMargin, PixelCastJustification) { |
95 | | return gfx::IntMarginTyped<TargetUnits>(aMargin.top, aMargin.right, aMargin.bottom, aMargin.left); |
96 | | } |
97 | | template <class TargetUnits, class SourceUnits> |
98 | 0 | gfx::IntRegionTyped<TargetUnits> ViewAs(const gfx::IntRegionTyped<SourceUnits>& aRegion, PixelCastJustification) { |
99 | 0 | return gfx::IntRegionTyped<TargetUnits>::FromUnknownRegion(aRegion.ToUnknownRegion()); |
100 | 0 | } Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> mozilla::ViewAs<mozilla::LayerPixel, mozilla::CSSTransformedLayerPixel>(mozilla::gfx::IntRegionTyped<mozilla::CSSTransformedLayerPixel> const&, mozilla::PixelCastJustification) Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> mozilla::ViewAs<mozilla::LayerPixel, mozilla::gfx::UnknownUnits>(mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&, mozilla::PixelCastJustification) Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> mozilla::ViewAs<mozilla::LayerPixel, mozilla::ParentLayerPixel>(mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel> const&, mozilla::PixelCastJustification) |
101 | | template <class NewTargetUnits, class OldTargetUnits, class SourceUnits> |
102 | | gfx::ScaleFactor<SourceUnits, NewTargetUnits> ViewTargetAs( |
103 | | const gfx::ScaleFactor<SourceUnits, OldTargetUnits>& aScaleFactor, |
104 | 0 | PixelCastJustification) { |
105 | 0 | return gfx::ScaleFactor<SourceUnits, NewTargetUnits>(aScaleFactor.scale); |
106 | 0 | } Unexecuted instantiation: mozilla::gfx::ScaleFactor<mozilla::CSSPixel, mozilla::ParentLayerPixel> mozilla::ViewTargetAs<mozilla::ParentLayerPixel, mozilla::ScreenPixel, mozilla::CSSPixel>(mozilla::gfx::ScaleFactor<mozilla::CSSPixel, mozilla::ScreenPixel> const&, mozilla::PixelCastJustification) Unexecuted instantiation: mozilla::gfx::ScaleFactor<mozilla::CSSPixel, mozilla::ScreenPixel> mozilla::ViewTargetAs<mozilla::ScreenPixel, mozilla::ParentLayerPixel, mozilla::CSSPixel>(mozilla::gfx::ScaleFactor<mozilla::CSSPixel, mozilla::ParentLayerPixel> const&, mozilla::PixelCastJustification) |
107 | | template <class TargetUnits, class SourceUnits> |
108 | 0 | Maybe<gfx::IntRectTyped<TargetUnits>> ViewAs(const Maybe<gfx::IntRectTyped<SourceUnits>>& aRect, PixelCastJustification aJustification) { |
109 | 0 | if (aRect.isSome()) { |
110 | 0 | return Some(ViewAs<TargetUnits>(aRect.value(), aJustification)); |
111 | 0 | } |
112 | 0 | return Nothing(); |
113 | 0 | } |
114 | | // Unlike the other functions in this category, this function takes the |
115 | | // target matrix type, rather than its source and target unit types, as |
116 | | // the explicit template argument, so an example invocation is: |
117 | | // ViewAs<ScreenToLayerMatrix4x4>(otherTypedMatrix, justification) |
118 | | // The reason is that if it took the source and target unit types as two |
119 | | // template arguments, there may be some confusion as to which is the |
120 | | // source and which is the target. |
121 | | template <class TargetMatrix, class SourceMatrixSourceUnits, class SourceMatrixTargetUnits> |
122 | | TargetMatrix ViewAs( |
123 | | const gfx::Matrix4x4Typed<SourceMatrixSourceUnits, SourceMatrixTargetUnits>& aMatrix, |
124 | 0 | PixelCastJustification) { |
125 | 0 | return TargetMatrix::FromUnknownMatrix(aMatrix.ToUnknownMatrix()); |
126 | 0 | } Unexecuted instantiation: mozilla::gfx::Matrix4x4Typed<mozilla::CSSTransformedLayerPixel, mozilla::ParentLayerPixel> mozilla::ViewAs<mozilla::gfx::Matrix4x4Typed<mozilla::CSSTransformedLayerPixel, mozilla::ParentLayerPixel>, mozilla::ParentLayerPixel, mozilla::ParentLayerPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::ParentLayerPixel, mozilla::ParentLayerPixel> const&, mozilla::PixelCastJustification) Unexecuted instantiation: mozilla::gfx::Matrix4x4Typed<mozilla::ParentLayerPixel, mozilla::RenderTargetPixel> mozilla::ViewAs<mozilla::gfx::Matrix4x4Typed<mozilla::ParentLayerPixel, mozilla::RenderTargetPixel>, mozilla::gfx::UnknownUnits, mozilla::gfx::UnknownUnits>(mozilla::gfx::Matrix4x4Typed<mozilla::gfx::UnknownUnits, mozilla::gfx::UnknownUnits> const&, mozilla::PixelCastJustification) |
127 | | |
128 | | // Convenience functions for casting untyped entities to typed entities. |
129 | | // Using these functions does not require a justification, but once we convert |
130 | | // all code to use strongly typed units they should not be needed any longer. |
131 | | template <class TargetUnits> |
132 | | gfx::PointTyped<TargetUnits> ViewAs(const gfxPoint& aPoint) { |
133 | | return gfx::PointTyped<TargetUnits>(aPoint.x, aPoint.y); |
134 | | } |
135 | | template <class TargetUnits> |
136 | 0 | gfx::PointTyped<TargetUnits> ViewAs(const gfx::Point& aPoint) { |
137 | 0 | return gfx::PointTyped<TargetUnits>(aPoint.x, aPoint.y); |
138 | 0 | } |
139 | | template <class TargetUnits> |
140 | | gfx::RectTyped<TargetUnits> ViewAs(const gfx::Rect& aRect) { |
141 | | return gfx::RectTyped<TargetUnits>(aRect.x, aRect.y, aRect.Width(), aRect.Height()); |
142 | | } |
143 | | template <class TargetUnits> |
144 | 0 | gfx::IntSizeTyped<TargetUnits> ViewAs(const nsIntSize& aSize) { |
145 | 0 | return gfx::IntSizeTyped<TargetUnits>(aSize.width, aSize.height); |
146 | 0 | } |
147 | | template <class TargetUnits> |
148 | 0 | gfx::IntPointTyped<TargetUnits> ViewAs(const nsIntPoint& aPoint) { |
149 | 0 | return gfx::IntPointTyped<TargetUnits>(aPoint.x, aPoint.y); |
150 | 0 | } Unexecuted instantiation: mozilla::gfx::IntPointTyped<mozilla::LayerPixel> mozilla::ViewAs<mozilla::LayerPixel>(mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits> const&) Unexecuted instantiation: mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel> mozilla::ViewAs<mozilla::ParentLayerPixel>(mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits> const&) |
151 | | template <class TargetUnits> |
152 | 0 | gfx::IntRectTyped<TargetUnits> ViewAs(const nsIntRect& aRect) { |
153 | 0 | return gfx::IntRectTyped<TargetUnits>(aRect.x, aRect.y, aRect.Width(), aRect.Height()); |
154 | 0 | } Unexecuted instantiation: mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel> mozilla::ViewAs<mozilla::ParentLayerPixel>(mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits> const&) Unexecuted instantiation: mozilla::gfx::IntRectTyped<mozilla::RenderTargetPixel> mozilla::ViewAs<mozilla::RenderTargetPixel>(mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits> const&) Unexecuted instantiation: mozilla::gfx::IntRectTyped<mozilla::ImagePixel> mozilla::ViewAs<mozilla::ImagePixel>(mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits> const&) Unexecuted instantiation: mozilla::gfx::IntRectTyped<mozilla::LayerPixel> mozilla::ViewAs<mozilla::LayerPixel>(mozilla::gfx::IntRectTyped<mozilla::gfx::UnknownUnits> const&) |
155 | | template <class TargetUnits> |
156 | 0 | gfx::IntRegionTyped<TargetUnits> ViewAs(const nsIntRegion& aRegion) { |
157 | 0 | return gfx::IntRegionTyped<TargetUnits>::FromUnknownRegion(aRegion); |
158 | 0 | } Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::CSSTransformedLayerPixel> mozilla::ViewAs<mozilla::CSSTransformedLayerPixel>(mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&) Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> mozilla::ViewAs<mozilla::LayerPixel>(mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&) Unexecuted instantiation: mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel> mozilla::ViewAs<mozilla::ParentLayerPixel>(mozilla::gfx::IntRegionTyped<mozilla::gfx::UnknownUnits> const&) |
159 | | // Unlike the other functions in this category, this function takes the |
160 | | // target matrix type, rather than its source and target unit types, as |
161 | | // the template argument, so an example invocation is: |
162 | | // ViewAs<ScreenToLayerMatrix4x4>(untypedMatrix) |
163 | | // The reason is that if it took the source and target unit types as two |
164 | | // template arguments, there may be some confusion as to which is the |
165 | | // source and which is the target. |
166 | | template <class TypedMatrix> |
167 | 0 | TypedMatrix ViewAs(const gfx::Matrix4x4& aMatrix) { |
168 | 0 | return TypedMatrix::FromUnknownMatrix(aMatrix); |
169 | 0 | } Unexecuted instantiation: mozilla::gfx::Matrix4x4Typed<mozilla::LayerPixel, mozilla::CSSTransformedLayerPixel> mozilla::ViewAs<mozilla::gfx::Matrix4x4Typed<mozilla::LayerPixel, mozilla::CSSTransformedLayerPixel> >(mozilla::gfx::Matrix4x4Typed<mozilla::gfx::UnknownUnits, mozilla::gfx::UnknownUnits> const&) Unexecuted instantiation: mozilla::gfx::Matrix4x4Typed<mozilla::LayerPixel, mozilla::ParentLayerPixel> mozilla::ViewAs<mozilla::gfx::Matrix4x4Typed<mozilla::LayerPixel, mozilla::ParentLayerPixel> >(mozilla::gfx::Matrix4x4Typed<mozilla::gfx::UnknownUnits, mozilla::gfx::UnknownUnits> const&) Unexecuted instantiation: mozilla::gfx::Matrix4x4Typed<mozilla::ScreenPixel, mozilla::ParentLayerPixel> mozilla::ViewAs<mozilla::gfx::Matrix4x4Typed<mozilla::ScreenPixel, mozilla::ParentLayerPixel> >(mozilla::gfx::Matrix4x4Typed<mozilla::gfx::UnknownUnits, mozilla::gfx::UnknownUnits> const&) Unexecuted instantiation: mozilla::gfx::Matrix4x4Typed<mozilla::ParentLayerPixel, mozilla::ScreenPixel> mozilla::ViewAs<mozilla::gfx::Matrix4x4Typed<mozilla::ParentLayerPixel, mozilla::ScreenPixel> >(mozilla::gfx::Matrix4x4Typed<mozilla::gfx::UnknownUnits, mozilla::gfx::UnknownUnits> const&) Unexecuted instantiation: mozilla::gfx::Matrix4x4Typed<mozilla::ParentLayerPixel, mozilla::ParentLayerPixel> mozilla::ViewAs<mozilla::gfx::Matrix4x4Typed<mozilla::ParentLayerPixel, mozilla::ParentLayerPixel> >(mozilla::gfx::Matrix4x4Typed<mozilla::gfx::UnknownUnits, mozilla::gfx::UnknownUnits> const&) Unexecuted instantiation: mozilla::gfx::Matrix4x4Typed<mozilla::ParentLayerPixel, mozilla::LayerPixel> mozilla::ViewAs<mozilla::gfx::Matrix4x4Typed<mozilla::ParentLayerPixel, mozilla::LayerPixel> >(mozilla::gfx::Matrix4x4Typed<mozilla::gfx::UnknownUnits, mozilla::gfx::UnknownUnits> const&) Unexecuted instantiation: mozilla::gfx::Matrix4x4Typed<mozilla::LayoutDevicePixel, mozilla::LayoutDevicePixel> mozilla::ViewAs<mozilla::gfx::Matrix4x4Typed<mozilla::LayoutDevicePixel, mozilla::LayoutDevicePixel> >(mozilla::gfx::Matrix4x4Typed<mozilla::gfx::UnknownUnits, mozilla::gfx::UnknownUnits> const&) |
170 | | |
171 | | // Convenience functions for transforming an entity from one strongly-typed |
172 | | // coordinate system to another using the provided transformation matrix. |
173 | | template <typename TargetUnits, typename SourceUnits> |
174 | | static gfx::PointTyped<TargetUnits> |
175 | | TransformBy(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform, |
176 | | const gfx::PointTyped<SourceUnits>& aPoint) |
177 | 0 | { |
178 | 0 | return aTransform.TransformPoint(aPoint); |
179 | 0 | } Unexecuted instantiation: Unified_cpp_gfx_layers2.cpp:mozilla::gfx::PointTyped<mozilla::ScreenPixel, float> mozilla::TransformBy<mozilla::ScreenPixel, mozilla::ParentLayerPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::ParentLayerPixel, mozilla::ScreenPixel> const&, mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float> const&) Unexecuted instantiation: Unified_cpp_gfx_layers2.cpp:mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float> mozilla::TransformBy<mozilla::ParentLayerPixel, mozilla::ScreenPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::ScreenPixel, mozilla::ParentLayerPixel> const&, mozilla::gfx::PointTyped<mozilla::ScreenPixel, float> const&) |
180 | | template <typename TargetUnits, typename SourceUnits> |
181 | | static gfx::IntPointTyped<TargetUnits> |
182 | | TransformBy(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform, |
183 | | const gfx::IntPointTyped<SourceUnits>& aPoint) |
184 | | { |
185 | | return RoundedToInt(TransformBy(aTransform, gfx::PointTyped<SourceUnits>(aPoint))); |
186 | | } |
187 | | template <typename TargetUnits, typename SourceUnits> |
188 | | static gfx::RectTyped<TargetUnits> |
189 | | TransformBy(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform, |
190 | | const gfx::RectTyped<SourceUnits>& aRect) |
191 | 0 | { |
192 | 0 | return aTransform.TransformBounds(aRect); |
193 | 0 | } Unexecuted instantiation: Unified_cpp_gfx_layers6.cpp:mozilla::gfx::RectTyped<mozilla::ParentLayerPixel, float> mozilla::TransformBy<mozilla::ParentLayerPixel, mozilla::ParentLayerPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::ParentLayerPixel, mozilla::ParentLayerPixel> const&, mozilla::gfx::RectTyped<mozilla::ParentLayerPixel, float> const&) Unexecuted instantiation: Unified_cpp_gfx_layers7.cpp:mozilla::gfx::RectTyped<mozilla::RenderTargetPixel, float> mozilla::TransformBy<mozilla::RenderTargetPixel, mozilla::ParentLayerPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::ParentLayerPixel, mozilla::RenderTargetPixel> const&, mozilla::gfx::RectTyped<mozilla::ParentLayerPixel, float> const&) Unexecuted instantiation: Unified_cpp_gfx_layers9.cpp:mozilla::gfx::RectTyped<mozilla::RenderTargetPixel, float> mozilla::TransformBy<mozilla::RenderTargetPixel, mozilla::ParentLayerPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::ParentLayerPixel, mozilla::RenderTargetPixel> const&, mozilla::gfx::RectTyped<mozilla::ParentLayerPixel, float> const&) Unexecuted instantiation: Unified_cpp_layout_painting0.cpp:mozilla::gfx::RectTyped<mozilla::LayoutDevicePixel, float> mozilla::TransformBy<mozilla::LayoutDevicePixel, mozilla::LayoutDevicePixel>(mozilla::gfx::Matrix4x4Typed<mozilla::LayoutDevicePixel, mozilla::LayoutDevicePixel> const&, mozilla::gfx::RectTyped<mozilla::LayoutDevicePixel, float> const&) |
194 | | template <typename TargetUnits, typename SourceUnits> |
195 | | static gfx::IntRectTyped<TargetUnits> |
196 | | TransformBy(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform, |
197 | | const gfx::IntRectTyped<SourceUnits>& aRect) |
198 | 0 | { |
199 | 0 | return RoundedToInt(TransformBy(aTransform, gfx::RectTyped<SourceUnits>(aRect))); |
200 | 0 | } Unexecuted instantiation: Unified_cpp_gfx_layers6.cpp:mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel> mozilla::TransformBy<mozilla::ParentLayerPixel, mozilla::ParentLayerPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::ParentLayerPixel, mozilla::ParentLayerPixel> const&, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel> const&) Unexecuted instantiation: Unified_cpp_gfx_layers7.cpp:mozilla::gfx::IntRectTyped<mozilla::RenderTargetPixel> mozilla::TransformBy<mozilla::RenderTargetPixel, mozilla::ParentLayerPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::ParentLayerPixel, mozilla::RenderTargetPixel> const&, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel> const&) Unexecuted instantiation: Unified_cpp_gfx_layers9.cpp:mozilla::gfx::IntRectTyped<mozilla::RenderTargetPixel> mozilla::TransformBy<mozilla::RenderTargetPixel, mozilla::ParentLayerPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::ParentLayerPixel, mozilla::RenderTargetPixel> const&, mozilla::gfx::IntRectTyped<mozilla::ParentLayerPixel> const&) |
201 | | template <typename TargetUnits, typename SourceUnits> |
202 | | static gfx::IntRegionTyped<TargetUnits> |
203 | | TransformBy(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform, |
204 | | const gfx::IntRegionTyped<SourceUnits>& aRegion) |
205 | 0 | { |
206 | 0 | return ViewAs<TargetUnits>(aRegion.ToUnknownRegion().Transform( |
207 | 0 | aTransform.ToUnknownMatrix())); |
208 | 0 | } Unexecuted instantiation: Unified_cpp_gfx_layers1.cpp:mozilla::gfx::IntRegionTyped<mozilla::CSSTransformedLayerPixel> mozilla::TransformBy<mozilla::CSSTransformedLayerPixel, mozilla::LayerPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::LayerPixel, mozilla::CSSTransformedLayerPixel> const&, mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> const&) Unexecuted instantiation: Unified_cpp_gfx_layers2.cpp:mozilla::gfx::IntRegionTyped<mozilla::CSSTransformedLayerPixel> mozilla::TransformBy<mozilla::CSSTransformedLayerPixel, mozilla::LayerPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::LayerPixel, mozilla::CSSTransformedLayerPixel> const&, mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> const&) Unexecuted instantiation: Unified_cpp_gfx_layers5.cpp:mozilla::gfx::IntRegionTyped<mozilla::CSSTransformedLayerPixel> mozilla::TransformBy<mozilla::CSSTransformedLayerPixel, mozilla::LayerPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::LayerPixel, mozilla::CSSTransformedLayerPixel> const&, mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> const&) Unexecuted instantiation: Unified_cpp_gfx_layers6.cpp:mozilla::gfx::IntRegionTyped<mozilla::CSSTransformedLayerPixel> mozilla::TransformBy<mozilla::CSSTransformedLayerPixel, mozilla::LayerPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::LayerPixel, mozilla::CSSTransformedLayerPixel> const&, mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> const&) Unexecuted instantiation: Unified_cpp_gfx_layers7.cpp:mozilla::gfx::IntRegionTyped<mozilla::ParentLayerPixel> mozilla::TransformBy<mozilla::ParentLayerPixel, mozilla::LayerPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::LayerPixel, mozilla::ParentLayerPixel> const&, mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> const&) Unexecuted instantiation: Unified_cpp_gfx_layers7.cpp:mozilla::gfx::IntRegionTyped<mozilla::CSSTransformedLayerPixel> mozilla::TransformBy<mozilla::CSSTransformedLayerPixel, mozilla::LayerPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::LayerPixel, mozilla::CSSTransformedLayerPixel> const&, mozilla::gfx::IntRegionTyped<mozilla::LayerPixel> const&) |
209 | | |
210 | | // Transform |aVector|, which is anchored at |aAnchor|, by the given transform |
211 | | // matrix, yielding a point in |TargetUnits|. |
212 | | // The anchor is necessary because with 3D tranforms, the location of the |
213 | | // vector can affect the result of the transform. |
214 | | template <typename TargetUnits, typename SourceUnits> |
215 | | static gfx::PointTyped<TargetUnits> |
216 | | TransformVector(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform, |
217 | | const gfx::PointTyped<SourceUnits>& aVector, |
218 | | const gfx::PointTyped<SourceUnits>& aAnchor) |
219 | 0 | { |
220 | 0 | gfx::PointTyped<TargetUnits> transformedStart = TransformBy(aTransform, aAnchor); |
221 | 0 | gfx::PointTyped<TargetUnits> transformedEnd = TransformBy(aTransform, aAnchor + aVector); |
222 | 0 | return transformedEnd - transformedStart; |
223 | 0 | } Unexecuted instantiation: Unified_cpp_gfx_layers2.cpp:mozilla::gfx::PointTyped<mozilla::ScreenPixel, float> mozilla::TransformVector<mozilla::ScreenPixel, mozilla::ParentLayerPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::ParentLayerPixel, mozilla::ScreenPixel> const&, mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float> const&, mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float> const&) Unexecuted instantiation: Unified_cpp_gfx_layers2.cpp:mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float> mozilla::TransformVector<mozilla::ParentLayerPixel, mozilla::ScreenPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::ScreenPixel, mozilla::ParentLayerPixel> const&, mozilla::gfx::PointTyped<mozilla::ScreenPixel, float> const&, mozilla::gfx::PointTyped<mozilla::ScreenPixel, float> const&) |
224 | | |
225 | | // UntransformBy() and UntransformVector() are like TransformBy() and |
226 | | // TransformVector(), respectively, but are intended for cases where |
227 | | // the transformation matrix is the inverse of a 3D projection. When |
228 | | // using such transforms, the resulting Point4D is only meaningful |
229 | | // if it has a positive w-coordinate. To handle this, these functions |
230 | | // return a Maybe object which contains a value if and only if the |
231 | | // result is meaningful |
232 | | template <typename TargetUnits, typename SourceUnits> |
233 | | static Maybe<gfx::PointTyped<TargetUnits>> |
234 | | UntransformBy(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform, |
235 | | const gfx::PointTyped<SourceUnits>& aPoint) |
236 | 0 | { |
237 | 0 | gfx::Point4DTyped<TargetUnits> point = aTransform.ProjectPoint(aPoint); |
238 | 0 | if (!point.HasPositiveWCoord()) { |
239 | 0 | return Nothing(); |
240 | 0 | } |
241 | 0 | return Some(point.As2DPoint()); |
242 | 0 | } Unexecuted instantiation: Unified_cpp_gfx_layers2.cpp:mozilla::Maybe<mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float> > mozilla::UntransformBy<mozilla::ParentLayerPixel, mozilla::ScreenPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::ScreenPixel, mozilla::ParentLayerPixel> const&, mozilla::gfx::PointTyped<mozilla::ScreenPixel, float> const&) Unexecuted instantiation: Unified_cpp_gfx_layers2.cpp:mozilla::Maybe<mozilla::gfx::PointTyped<mozilla::ScreenPixel, float> > mozilla::UntransformBy<mozilla::ScreenPixel, mozilla::ScreenPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::ScreenPixel, mozilla::ScreenPixel> const&, mozilla::gfx::PointTyped<mozilla::ScreenPixel, float> const&) Unexecuted instantiation: Unified_cpp_gfx_layers3.cpp:mozilla::Maybe<mozilla::gfx::PointTyped<mozilla::LayerPixel, float> > mozilla::UntransformBy<mozilla::LayerPixel, mozilla::ParentLayerPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::ParentLayerPixel, mozilla::LayerPixel> const&, mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float> const&) Unexecuted instantiation: Unified_cpp_widget0.cpp:mozilla::Maybe<mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float> > mozilla::UntransformBy<mozilla::ParentLayerPixel, mozilla::ScreenPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::ScreenPixel, mozilla::ParentLayerPixel> const&, mozilla::gfx::PointTyped<mozilla::ScreenPixel, float> const&) |
243 | | template <typename TargetUnits, typename SourceUnits> |
244 | | static Maybe<gfx::IntPointTyped<TargetUnits>> |
245 | | UntransformBy(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform, |
246 | | const gfx::IntPointTyped<SourceUnits>& aPoint) |
247 | 0 | { |
248 | 0 | gfx::PointTyped<SourceUnits> p = aPoint; |
249 | 0 | gfx::Point4DTyped<TargetUnits> point = aTransform.ProjectPoint(p); |
250 | 0 | if (!point.HasPositiveWCoord()) { |
251 | 0 | return Nothing(); |
252 | 0 | } |
253 | 0 | return Some(RoundedToInt(point.As2DPoint())); |
254 | 0 | } Unexecuted instantiation: Unified_cpp_gfx_layers2.cpp:mozilla::Maybe<mozilla::gfx::IntPointTyped<mozilla::ScreenPixel> > mozilla::UntransformBy<mozilla::ScreenPixel, mozilla::ScreenPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::ScreenPixel, mozilla::ScreenPixel> const&, mozilla::gfx::IntPointTyped<mozilla::ScreenPixel> const&) Unexecuted instantiation: Unified_cpp_gfx_layers2.cpp:mozilla::Maybe<mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel> > mozilla::UntransformBy<mozilla::ParentLayerPixel, mozilla::ScreenPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::ScreenPixel, mozilla::ParentLayerPixel> const&, mozilla::gfx::IntPointTyped<mozilla::ScreenPixel> const&) Unexecuted instantiation: Unified_cpp_widget0.cpp:mozilla::Maybe<mozilla::gfx::IntPointTyped<mozilla::ParentLayerPixel> > mozilla::UntransformBy<mozilla::ParentLayerPixel, mozilla::ScreenPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::ScreenPixel, mozilla::ParentLayerPixel> const&, mozilla::gfx::IntPointTyped<mozilla::ScreenPixel> const&) |
255 | | |
256 | | // The versions of UntransformBy() that take a rectangle also take a clip, |
257 | | // which represents the bounds within which the target must fall. The |
258 | | // result of the transform is intersected with this clip, and is considered |
259 | | // meaningful if the intersection is not empty. |
260 | | template <typename TargetUnits, typename SourceUnits> |
261 | | static Maybe<gfx::RectTyped<TargetUnits>> |
262 | | UntransformBy(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform, |
263 | | const gfx::RectTyped<SourceUnits>& aRect, |
264 | | const gfx::RectTyped<TargetUnits>& aClip) |
265 | 0 | { |
266 | 0 | gfx::RectTyped<TargetUnits> rect = aTransform.ProjectRectBounds(aRect, aClip); |
267 | 0 | if (rect.IsEmpty()) { |
268 | 0 | return Nothing(); |
269 | 0 | } |
270 | 0 | return Some(rect); |
271 | 0 | } Unexecuted instantiation: Unified_cpp_gfx_layers5.cpp:mozilla::Maybe<mozilla::gfx::RectTyped<mozilla::LayerPixel, float> > mozilla::UntransformBy<mozilla::LayerPixel, mozilla::ParentLayerPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::ParentLayerPixel, mozilla::LayerPixel> const&, mozilla::gfx::RectTyped<mozilla::ParentLayerPixel, float> const&, mozilla::gfx::RectTyped<mozilla::LayerPixel, float> const&) Unexecuted instantiation: Unified_cpp_gfx_layers7.cpp:mozilla::Maybe<mozilla::gfx::RectTyped<mozilla::LayerPixel, float> > mozilla::UntransformBy<mozilla::LayerPixel, mozilla::ParentLayerPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::ParentLayerPixel, mozilla::LayerPixel> const&, mozilla::gfx::RectTyped<mozilla::ParentLayerPixel, float> const&, mozilla::gfx::RectTyped<mozilla::LayerPixel, float> const&) |
272 | | template <typename TargetUnits, typename SourceUnits> |
273 | | static Maybe<gfx::IntRectTyped<TargetUnits>> |
274 | | UntransformBy(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform, |
275 | | const gfx::IntRectTyped<SourceUnits>& aRect, |
276 | | const gfx::IntRectTyped<TargetUnits>& aClip) |
277 | | { |
278 | | gfx::RectTyped<TargetUnits> rect = aTransform.ProjectRectBounds(aRect, aClip); |
279 | | if (rect.IsEmpty()) { |
280 | | return Nothing(); |
281 | | } |
282 | | return Some(RoundedToInt(rect)); |
283 | | } |
284 | | |
285 | | template <typename TargetUnits, typename SourceUnits> |
286 | | static Maybe<gfx::PointTyped<TargetUnits>> |
287 | | UntransformVector(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform, |
288 | | const gfx::PointTyped<SourceUnits>& aVector, |
289 | | const gfx::PointTyped<SourceUnits>& aAnchor) |
290 | 0 | { |
291 | 0 | gfx::Point4DTyped<TargetUnits> projectedAnchor = aTransform.ProjectPoint(aAnchor); |
292 | 0 | gfx::Point4DTyped<TargetUnits> projectedTarget = aTransform.ProjectPoint(aAnchor + aVector); |
293 | 0 | if (!projectedAnchor.HasPositiveWCoord() || !projectedTarget.HasPositiveWCoord()){ |
294 | 0 | return Nothing(); |
295 | 0 | } |
296 | 0 | return Some(projectedTarget.As2DPoint() - projectedAnchor.As2DPoint()); |
297 | 0 | } Unexecuted instantiation: Unified_cpp_gfx_layers2.cpp:mozilla::Maybe<mozilla::gfx::PointTyped<mozilla::ScreenPixel, float> > mozilla::UntransformVector<mozilla::ScreenPixel, mozilla::ScreenPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::ScreenPixel, mozilla::ScreenPixel> const&, mozilla::gfx::PointTyped<mozilla::ScreenPixel, float> const&, mozilla::gfx::PointTyped<mozilla::ScreenPixel, float> const&) Unexecuted instantiation: Unified_cpp_widget0.cpp:mozilla::Maybe<mozilla::gfx::PointTyped<mozilla::ParentLayerPixel, float> > mozilla::UntransformVector<mozilla::ParentLayerPixel, mozilla::ScreenPixel>(mozilla::gfx::Matrix4x4Typed<mozilla::ScreenPixel, mozilla::ParentLayerPixel> const&, mozilla::gfx::PointTyped<mozilla::ScreenPixel, float> const&, mozilla::gfx::PointTyped<mozilla::ScreenPixel, float> const&) |
298 | | |
299 | | } // namespace mozilla |
300 | | |
301 | | #endif |