gfx/skia/trunk/include/effects/Sk2DPathEffect.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 Sk2DPathEffect_DEFINED
     9 #define Sk2DPathEffect_DEFINED
    11 #include "SkPath.h"
    12 #include "SkPathEffect.h"
    13 #include "SkMatrix.h"
    15 class SK_API Sk2DPathEffect : public SkPathEffect {
    16 public:
    17     static Sk2DPathEffect* Create(const SkMatrix& mat) {
    18         return SkNEW_ARGS(Sk2DPathEffect, (mat));
    19     }
    21     virtual bool filterPath(SkPath*, const SkPath&,
    22                             SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
    24     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Sk2DPathEffect)
    26 protected:
    27     /** New virtual, to be overridden by subclasses.
    28         This is called once from filterPath, and provides the
    29         uv parameter bounds for the path. Subsequent calls to
    30         next() will receive u and v values within these bounds,
    31         and then a call to end() will signal the end of processing.
    32     */
    33     virtual void begin(const SkIRect& uvBounds, SkPath* dst) const;
    34     virtual void next(const SkPoint& loc, int u, int v, SkPath* dst) const;
    35     virtual void end(SkPath* dst) const;
    37     /** Low-level virtual called per span of locations in the u-direction.
    38         The default implementation calls next() repeatedly with each
    39         location.
    40     */
    41     virtual void nextSpan(int u, int v, int ucount, SkPath* dst) const;
    43     const SkMatrix& getMatrix() const { return fMatrix; }
    45     // protected so that subclasses can call this during unflattening
    46     Sk2DPathEffect(SkReadBuffer&);
    47     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
    49 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
    50 public:
    51 #endif
    52     Sk2DPathEffect(const SkMatrix& mat);
    54 private:
    55     SkMatrix    fMatrix, fInverse;
    56     bool        fMatrixIsInvertible;
    58     // illegal
    59     Sk2DPathEffect(const Sk2DPathEffect&);
    60     Sk2DPathEffect& operator=(const Sk2DPathEffect&);
    62     friend class Sk2DPathEffectBlitter;
    63     typedef SkPathEffect INHERITED;
    64 };
    66 class SK_API SkLine2DPathEffect : public Sk2DPathEffect {
    67 public:
    68     static SkLine2DPathEffect* Create(SkScalar width, const SkMatrix& matrix) {
    69         return SkNEW_ARGS(SkLine2DPathEffect, (width, matrix));
    70     }
    72     virtual bool filterPath(SkPath* dst, const SkPath& src,
    73                             SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
    75     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLine2DPathEffect)
    77 protected:
    78     virtual void nextSpan(int u, int v, int ucount, SkPath*) const SK_OVERRIDE;
    80     SkLine2DPathEffect(SkReadBuffer&);
    82     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
    84 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
    85 public:
    86 #endif
    87     SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix)
    88     : Sk2DPathEffect(matrix), fWidth(width) {}
    90 private:
    91     SkScalar fWidth;
    93     typedef Sk2DPathEffect INHERITED;
    94 };
    96 class SK_API SkPath2DPathEffect : public Sk2DPathEffect {
    97 public:
    98     /**
    99      *  Stamp the specified path to fill the shape, using the matrix to define
   100      *  the latice.
   101      */
   102     static SkPath2DPathEffect* Create(const SkMatrix& matrix, const SkPath& path) {
   103         return SkNEW_ARGS(SkPath2DPathEffect, (matrix, path));
   104     }
   106     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath2DPathEffect)
   108 protected:
   109     SkPath2DPathEffect(SkReadBuffer& buffer);
   110     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
   112     virtual void next(const SkPoint&, int u, int v, SkPath*) const SK_OVERRIDE;
   114 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
   115 public:
   116 #endif
   117     SkPath2DPathEffect(const SkMatrix&, const SkPath&);
   119 private:
   120     SkPath  fPath;
   122     typedef Sk2DPathEffect INHERITED;
   123 };
   125 #endif

mercurial