gfx/skia/trunk/src/pathops/SkOpAngle.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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 SkOpAngle_DEFINED
     8 #define SkOpAngle_DEFINED
    10 #include "SkLineParameters.h"
    11 #include "SkPath.h"
    12 #include "SkPathOpsCubic.h"
    14 class SkOpSegment;
    15 struct SkOpSpan;
    17 // sorting angles
    18 // given angles of {dx dy ddx ddy dddx dddy} sort them
    19 class SkOpAngle {
    20 public:
    21     enum { kStackBasedCount = 8 }; // FIXME: determine what this should be
    22     enum IncludeType {
    23         kUnaryWinding,
    24         kUnaryXor,
    25         kBinarySingle,
    26         kBinaryOpp,
    27     };
    29     bool operator<(const SkOpAngle& rh) const;
    31     bool calcSlop(double x, double y, double rx, double ry, bool* result) const;
    33     double dx() const {
    34         return fTangentPart.dx();
    35     }
    37     double dy() const {
    38         return fTangentPart.dy();
    39     }
    41     int end() const {
    42         return fEnd;
    43     }
    45     bool isHorizontal() const;
    47     SkOpSpan* lastMarked() const {
    48         return fLastMarked;
    49     }
    51     void set(const SkOpSegment* segment, int start, int end);
    53     void setLastMarked(SkOpSpan* marked) {
    54         fLastMarked = marked;
    55     }
    57     SkOpSegment* segment() const {
    58         return const_cast<SkOpSegment*>(fSegment);
    59     }
    61     int sign() const {
    62         return SkSign32(fStart - fEnd);
    63     }
    65     int start() const {
    66         return fStart;
    67     }
    69     bool unorderable() const {
    70         return fUnorderable;
    71     }
    73     bool unsortable() const {
    74         return fUnsortable;
    75     }
    77 #ifdef SK_DEBUG
    78     void dump() const;
    79 #endif
    81 #if DEBUG_ANGLE
    82     void setID(int id) {
    83         fID = id;
    84     }
    85 #endif
    87 private:
    88     bool lengthen(const SkOpAngle& );
    89     void setSpans();
    91     SkDCubic fCurvePart; // the curve from start to end
    92     SkDCubic fCurveHalf; // the curve from start to 1 or 0
    93     double fSide;
    94     double fSide2;
    95     SkLineParameters fTangentPart;
    96     SkLineParameters fTangentHalf;
    97     const SkOpSegment* fSegment;
    98     SkOpSpan* fLastMarked;
    99     int fStart;
   100     int fEnd;
   101     bool fComputed; // tangent is computed, may contain some error
   102     // if subdividing a quad or cubic causes the tangent to go from the maximum angle to the
   103     // minimum, mark it unorderable. It still can be sorted, which is good enough for find-top
   104     // but can't be ordered, and therefore can't be used to compute winding
   105     bool fUnorderable;
   106     mutable bool fUnsortable;  // this alone is editable by the less than operator
   107 #if DEBUG_ANGLE
   108     int fID;
   109 #endif
   110 };
   112 #endif

mercurial