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.

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

mercurial