/src/mozilla-central/gfx/layers/LayersHelpers.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_layers_LayersHelpers_h |
8 | | #define mozilla_gfx_layers_LayersHelpers_h |
9 | | |
10 | | #include "mozilla/Maybe.h" |
11 | | #include "mozilla/gfx/Rect.h" |
12 | | #include "mozilla/gfx/Matrix.h" |
13 | | #include "mozilla/gfx/Polygon.h" |
14 | | #include "nsRegion.h" |
15 | | #include "nsTArray.h" |
16 | | |
17 | | namespace mozilla { |
18 | | namespace layers { |
19 | | |
20 | | class Layer; |
21 | | |
22 | | // Compute compositor information for copying the backdrop for a mix-blend |
23 | | // operation. |
24 | | gfx::IntRect |
25 | | ComputeBackdropCopyRect(const gfx::Rect& aRect, |
26 | | const gfx::IntRect& aClipRect, |
27 | | const gfx::Matrix4x4& aTransform, |
28 | | const gfx::IntRect& aRenderTargetRect, |
29 | | gfx::Matrix4x4* aOutTransform, |
30 | | gfx::Rect* aOutLayerQuad = nullptr); |
31 | | |
32 | | // Compute uv-coordinates for a rect inside a texture. |
33 | | template <typename T> |
34 | | static inline gfx::Rect |
35 | | TextureRectToCoords(const T& aRect, const gfx::IntSize& aSize) |
36 | 0 | { |
37 | 0 | return gfx::Rect( |
38 | 0 | float(aRect.X()) / aSize.width, |
39 | 0 | float(aRect.Y()) / aSize.height, |
40 | 0 | float(aRect.Width()) / aSize.width, |
41 | 0 | float(aRect.Height()) / aSize.height); |
42 | 0 | } |
43 | | |
44 | | // This is defined in Compositor.cpp. |
45 | | nsTArray<gfx::TexturedTriangle> |
46 | | GenerateTexturedTriangles(const gfx::Polygon& aPolygon, |
47 | | const gfx::Rect& aRect, |
48 | | const gfx::Rect& aTexRect); |
49 | | |
50 | | // This is defined in ContainerLayerComposite.cpp. |
51 | | void TransformLayerGeometry(Layer* aLayer, Maybe<gfx::Polygon>& aGeometry); |
52 | | |
53 | | } // namespace layers |
54 | | } // namespace mozilla |
55 | | |
56 | | #endif // mozilla_gfx_layers_LayersHelpers_h |