LCOV - code coverage report
Current view: top level - gfx/2d - Triangle.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 12 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
       2             :  * This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : 
       6             : #ifndef MOZILLA_GFX_TRIANGLE_H
       7             : #define MOZILLA_GFX_TRIANGLE_H
       8             : 
       9             : #include <algorithm>
      10             : 
      11             : #include "mozilla/Move.h"
      12             : #include "Point.h"
      13             : #include "Rect.h"
      14             : 
      15             : namespace mozilla {
      16             : namespace gfx {
      17             : 
      18             : /**
      19             :  * A simple triangle data structure.
      20             :  */
      21             : template<class Units, class F = Float>
      22             : struct TriangleTyped
      23             : {
      24             :   PointTyped<Units, F> p1, p2, p3;
      25             : 
      26           0 :   TriangleTyped()
      27           0 :     : p1(), p2(), p3() {}
      28             : 
      29           0 :   TriangleTyped(PointTyped<Units, F> aP1,
      30             :                 PointTyped<Units, F> aP2,
      31             :                 PointTyped<Units, F> aP3)
      32           0 :     : p1(aP1), p2(aP2), p3(aP3) {}
      33             : 
      34           0 :   RectTyped<Units, F> BoundingBox() const
      35             :   {
      36           0 :     F minX = std::min(std::min(p1.x, p2.x), p3.x);
      37           0 :     F maxX = std::max(std::max(p1.x, p2.x), p3.x);
      38             : 
      39           0 :     F minY = std::min(std::min(p1.y, p2.y), p3.y);
      40           0 :     F maxY = std::max(std::max(p1.y, p2.y), p3.y);
      41             : 
      42           0 :     return RectTyped<Units, F>(minX, minY, maxX - minX, maxY - minY);
      43             :   }
      44             : };
      45             : 
      46             : typedef TriangleTyped<UnknownUnits, Float> Triangle;
      47             : 
      48             : template<class Units, class F = Float>
      49             : struct TexturedTriangleTyped : public TriangleTyped<Units, F>
      50             : {
      51           0 :   explicit TexturedTriangleTyped(const TriangleTyped<Units, F>& aTriangle)
      52           0 :     : TriangleTyped<Units, F>(aTriangle) {}
      53             : 
      54             :   explicit TexturedTriangleTyped(TriangleTyped<Units, F>&& aTriangle)
      55             :     : TriangleTyped<Units, F>(Move(aTriangle)) {}
      56             : 
      57             :   TriangleTyped<Units, F> textureCoords;
      58             : };
      59             : 
      60             : typedef TexturedTriangleTyped<UnknownUnits, Float> TexturedTriangle;
      61             : 
      62             : } // namespace gfx
      63             : } // namespace mozilla
      64             : 
      65             : #endif /* MOZILLA_GFX_TRIANGLE_H */

Generated by: LCOV version 1.13