LCOV - code coverage report
Current view: top level - gfx/skia/skia/src/pathops - SkIntersectionHelper.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 42 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 16 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright 2012 Google Inc.
       3             :  *
       4             :  * Use of this source code is governed by a BSD-style license that can be
       5             :  * found in the LICENSE file.
       6             :  */
       7             : #ifndef SkIntersectionHelper_DEFINED
       8             : #define SkIntersectionHelper_DEFINED
       9             : 
      10             : #include "SkOpContour.h"
      11             : #include "SkOpSegment.h"
      12             : #include "SkPath.h"
      13             : 
      14             : #ifdef SK_DEBUG
      15             : #include "SkPathOpsPoint.h"
      16             : #endif
      17             : 
      18             : class SkIntersectionHelper {
      19             : public:
      20             :     enum SegmentType {
      21             :         kHorizontalLine_Segment = -1,
      22             :         kVerticalLine_Segment = 0,
      23             :         kLine_Segment = SkPath::kLine_Verb,
      24             :         kQuad_Segment = SkPath::kQuad_Verb,
      25             :         kConic_Segment = SkPath::kConic_Verb,
      26             :         kCubic_Segment = SkPath::kCubic_Verb,
      27             :     };
      28             : 
      29           0 :     bool advance() {
      30           0 :         fSegment = fSegment->next();
      31           0 :         return fSegment != nullptr;
      32             :     }
      33             : 
      34           0 :     SkScalar bottom() const {
      35           0 :         return bounds().fBottom;
      36             :     }
      37             : 
      38           0 :     const SkPathOpsBounds& bounds() const {
      39           0 :         return fSegment->bounds();
      40             :     }
      41             : 
      42             :     SkOpContour* contour() const {
      43             :         return fSegment->contour();
      44             :     }
      45             : 
      46           0 :     void init(SkOpContour* contour) {
      47           0 :         fSegment = contour->first();
      48           0 :     }
      49             : 
      50           0 :     SkScalar left() const {
      51           0 :         return bounds().fLeft;
      52             :     }
      53             : 
      54           0 :     const SkPoint* pts() const {
      55           0 :         return fSegment->pts();
      56             :     }
      57             : 
      58           0 :     SkScalar right() const {
      59           0 :         return bounds().fRight;
      60             :     }
      61             : 
      62           0 :     SkOpSegment* segment() const {
      63           0 :         return fSegment;
      64             :     }
      65             : 
      66           0 :     SegmentType segmentType() const {
      67           0 :         SegmentType type = (SegmentType) fSegment->verb();
      68           0 :         if (type != kLine_Segment) {
      69           0 :             return type;
      70             :         }
      71           0 :         if (fSegment->isHorizontal()) {
      72           0 :             return kHorizontalLine_Segment;
      73             :         }
      74           0 :         if (fSegment->isVertical()) {
      75           0 :             return kVerticalLine_Segment;
      76             :         }
      77           0 :         return kLine_Segment;
      78             :     }
      79             : 
      80           0 :     bool startAfter(const SkIntersectionHelper& after) {
      81           0 :         fSegment = after.fSegment->next();
      82           0 :         return fSegment != nullptr;
      83             :     }
      84             : 
      85           0 :     SkScalar top() const {
      86           0 :         return bounds().fTop;
      87             :     }
      88             : 
      89           0 :     SkScalar weight() const {
      90           0 :         return fSegment->weight();
      91             :     }
      92             : 
      93           0 :     SkScalar x() const {
      94           0 :         return bounds().fLeft;
      95             :     }
      96             : 
      97           0 :     bool xFlipped() const {
      98           0 :         return x() != pts()[0].fX;
      99             :     }
     100             : 
     101           0 :     SkScalar y() const {
     102           0 :         return bounds().fTop;
     103             :     }
     104             : 
     105           0 :     bool yFlipped() const {
     106           0 :         return y() != pts()[0].fY;
     107             :     }
     108             : 
     109             : private:
     110             :     SkOpSegment* fSegment;
     111             : };
     112             : 
     113             : #endif

Generated by: LCOV version 1.13