/src/mozilla-central/gfx/layers/mlgpu/ShaderDefinitionsMLGPU-inl.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 _include_gfx_layers_mlgpu_ShaderDefinitions_inl_h |
8 | | #define _include_gfx_layers_mlgpu_ShaderDefinitions_inl_h |
9 | | |
10 | | namespace mozilla { |
11 | | namespace layers { |
12 | | namespace mlg { |
13 | | |
14 | | inline const Maybe<gfx::Polygon>& |
15 | | SimpleTraits::geometry() const |
16 | 0 | { |
17 | 0 | return mItem.geometry; |
18 | 0 | } |
19 | | |
20 | | inline nsTArray<gfx::Triangle> |
21 | | SimpleTraits::GenerateTriangles(const gfx::Polygon& aPolygon) const |
22 | 0 | { |
23 | 0 | return aPolygon.ToTriangles(); |
24 | 0 | } |
25 | | |
26 | | inline SimpleTraits::TriangleVertices |
27 | | SimpleTraits::MakeVertex(const FirstTriangle& aIgnore) const |
28 | 0 | { |
29 | 0 | TriangleVertices v = { |
30 | 0 | mRect.BottomLeft(), mRect.TopLeft(), mRect.TopRight(), |
31 | 0 | mItem.layerIndex, mItem.sortOrder |
32 | 0 | }; |
33 | 0 | return v; |
34 | 0 | } |
35 | | |
36 | | inline SimpleTraits::TriangleVertices |
37 | | SimpleTraits::MakeVertex(const SecondTriangle& aIgnore) const |
38 | 0 | { |
39 | 0 | TriangleVertices v = { |
40 | 0 | mRect.TopRight(), mRect.BottomRight(), mRect.BottomLeft(), |
41 | 0 | mItem.layerIndex, mItem.sortOrder |
42 | 0 | }; |
43 | 0 | return v; |
44 | 0 | } |
45 | | |
46 | | inline SimpleTraits::TriangleVertices |
47 | | SimpleTraits::MakeVertex(const gfx::Triangle& aTriangle) const |
48 | 0 | { |
49 | 0 | TriangleVertices v = { |
50 | 0 | aTriangle.p1, aTriangle.p2, aTriangle.p3, |
51 | 0 | mItem.layerIndex, mItem.sortOrder |
52 | 0 | }; |
53 | 0 | return v; |
54 | 0 | } |
55 | | |
56 | | inline SimpleTraits::UnitQuadVertex |
57 | | SimpleTraits::MakeUnitQuadVertex() const |
58 | 0 | { |
59 | 0 | UnitQuadVertex v = { mRect, mItem.layerIndex, mItem.sortOrder }; |
60 | 0 | return v; |
61 | 0 | } |
62 | | |
63 | | inline nsTArray<gfx::TexturedTriangle> |
64 | | TexturedTraits::GenerateTriangles(const gfx::Polygon& aPolygon) const |
65 | 0 | { |
66 | 0 | return GenerateTexturedTriangles(aPolygon, mRect, mTexCoords); |
67 | 0 | } |
68 | | |
69 | | inline TexturedTraits::VertexData |
70 | | TexturedTraits::MakeVertexData(const FirstTriangle& aIgnore) const |
71 | 0 | { |
72 | 0 | VertexData v = { mTexCoords.BottomLeft(), mTexCoords.TopLeft(), mTexCoords.TopRight() }; |
73 | 0 | return v; |
74 | 0 | } |
75 | | |
76 | | inline TexturedTraits::VertexData |
77 | | TexturedTraits::MakeVertexData(const SecondTriangle& aIgnore) const |
78 | 0 | { |
79 | 0 | VertexData v = { mTexCoords.TopRight(), mTexCoords.BottomRight(), mTexCoords.BottomLeft() }; |
80 | 0 | return v; |
81 | 0 | } |
82 | | |
83 | | inline TexturedTraits::VertexData |
84 | | TexturedTraits::MakeVertexData(const gfx::TexturedTriangle& aTriangle) const |
85 | 0 | { |
86 | 0 | VertexData v = { aTriangle.textureCoords.p1, aTriangle.textureCoords.p2, aTriangle.textureCoords.p3 }; |
87 | 0 | return v; |
88 | 0 | } |
89 | | |
90 | | } // namespace mlg |
91 | | } // namespace layers |
92 | | } // namespace mozilla |
93 | | |
94 | | #endif // _include_gfx_layers_mlgpu_ShaderDefinitions_inl_h |