gfx/skia/trunk/src/core/SkQuadClipper.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.

     2 /*
     3  * Copyright 2009 The Android Open Source Project
     4  *
     5  * Use of this source code is governed by a BSD-style license that can be
     6  * found in the LICENSE file.
     7  */
    10 #ifndef SkQuadClipper_DEFINED
    11 #define SkQuadClipper_DEFINED
    13 #include "SkPath.h"
    15 /** This class is initialized with a clip rectangle, and then can be fed quads,
    16     which must already be monotonic in Y.
    18     In the future, it might return a series of segments, allowing it to clip
    19     also in X, to ensure that all segments fit in a finite coordinate system.
    20  */
    21 class SkQuadClipper {
    22 public:
    23     SkQuadClipper();
    25     void setClip(const SkIRect& clip);
    27     bool clipQuad(const SkPoint src[3], SkPoint dst[3]);
    29 private:
    30     SkRect      fClip;
    31 };
    33 /** Iterator that returns the clipped segements of a quad clipped to a rect.
    34     The segments will be either lines or quads (based on SkPath::Verb), and
    35     will all be monotonic in Y
    36  */
    37 class SkQuadClipper2 {
    38 public:
    39     bool clipQuad(const SkPoint pts[3], const SkRect& clip);
    40     bool clipCubic(const SkPoint pts[4], const SkRect& clip);
    42     SkPath::Verb next(SkPoint pts[]);
    44 private:
    45     SkPoint*        fCurrPoint;
    46     SkPath::Verb*   fCurrVerb;
    48     enum {
    49         kMaxVerbs = 13,
    50         kMaxPoints = 32
    51     };
    52     SkPoint         fPoints[kMaxPoints];
    53     SkPath::Verb    fVerbs[kMaxVerbs];
    55     void clipMonoQuad(const SkPoint srcPts[3], const SkRect& clip);
    56     void clipMonoCubic(const SkPoint srcPts[4], const SkRect& clip);
    57     void appendVLine(SkScalar x, SkScalar y0, SkScalar y1, bool reverse);
    58     void appendQuad(const SkPoint pts[3], bool reverse);
    59     void appendCubic(const SkPoint pts[4], bool reverse);
    60 };
    62 #ifdef SK_DEBUG
    63     void sk_assert_monotonic_x(const SkPoint pts[], int count);
    64     void sk_assert_monotonic_y(const SkPoint pts[], int count);
    65 #else
    66     #define sk_assert_monotonic_x(pts, count)
    67     #define sk_assert_monotonic_y(pts, count)
    68 #endif
    70 #endif

mercurial