gfx/skia/trunk/include/effects/Sk1DPathEffect.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 2006 The Android Open Source Project
     3  *
     4  * Use of this source code is governed by a BSD-style license that can be
     5  * found in the LICENSE file.
     6  */
     8 #ifndef Sk1DPathEffect_DEFINED
     9 #define Sk1DPathEffect_DEFINED
    11 #include "SkPathEffect.h"
    12 #include "SkPath.h"
    14 class SkPathMeasure;
    16 // This class is not exported to java.
    17 class SK_API Sk1DPathEffect : public SkPathEffect {
    18 public:
    19     virtual bool filterPath(SkPath* dst, const SkPath& src,
    20                             SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
    22 protected:
    23     /** Called at the start of each contour, returns the initial offset
    24         into that contour.
    25     */
    26     virtual SkScalar begin(SkScalar contourLength) const = 0;
    27     /** Called with the current distance along the path, with the current matrix
    28         for the point/tangent at the specified distance.
    29         Return the distance to travel for the next call. If return <= 0, then that
    30         contour is done.
    31     */
    32     virtual SkScalar next(SkPath* dst, SkScalar dist, SkPathMeasure&) const = 0;
    34 private:
    35     typedef SkPathEffect INHERITED;
    36 };
    38 class SK_API SkPath1DPathEffect : public Sk1DPathEffect {
    39 public:
    40     enum Style {
    41         kTranslate_Style,   // translate the shape to each position
    42         kRotate_Style,      // rotate the shape about its center
    43         kMorph_Style,       // transform each point, and turn lines into curves
    45         kStyleCount
    46     };
    48     /** Dash by replicating the specified path.
    49         @param path The path to replicate (dash)
    50         @param advance The space between instances of path
    51         @param phase distance (mod advance) along path for its initial position
    52         @param style how to transform path at each point (based on the current
    53                      position and tangent)
    54     */
    55     static SkPath1DPathEffect* Create(const SkPath& path, SkScalar advance, SkScalar phase,
    56                                       Style style) {
    57         return SkNEW_ARGS(SkPath1DPathEffect, (path, advance, phase, style));
    58     }
    60     virtual bool filterPath(SkPath*, const SkPath&,
    61                             SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
    63     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath1DPathEffect)
    65 protected:
    66     SkPath1DPathEffect(SkReadBuffer& buffer);
    67     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
    69     // overrides from Sk1DPathEffect
    70     virtual SkScalar begin(SkScalar contourLength) const SK_OVERRIDE;
    71     virtual SkScalar next(SkPath*, SkScalar, SkPathMeasure&) const SK_OVERRIDE;
    73 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
    74 public:
    75 #endif
    76     SkPath1DPathEffect(const SkPath& path, SkScalar advance, SkScalar phase, Style);
    78 private:
    79     SkPath      fPath;          // copied from constructor
    80     SkScalar    fAdvance;       // copied from constructor
    81     SkScalar    fInitialOffset; // computed from phase
    82     Style       fStyle;         // copied from constructor
    84     typedef Sk1DPathEffect INHERITED;
    85 };
    87 #endif

mercurial