gfx/skia/trunk/include/effects/SkDashPathEffect.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 SkDashPathEffect_DEFINED
     9 #define SkDashPathEffect_DEFINED
    11 #include "SkPathEffect.h"
    13 /** \class SkDashPathEffect
    15     SkDashPathEffect is a subclass of SkPathEffect that implements dashing
    16 */
    17 class SK_API SkDashPathEffect : public SkPathEffect {
    18 public:
    19     /** intervals: array containing an even number of entries (>=2), with
    20          the even indices specifying the length of "on" intervals, and the odd
    21          indices specifying the length of "off" intervals.
    22         count: number of elements in the intervals array
    23         phase: offset into the intervals array (mod the sum of all of the
    24          intervals).
    26         For example: if intervals[] = {10, 20}, count = 2, and phase = 25,
    27          this will set up a dashed path like so:
    28          5 pixels off
    29          10 pixels on
    30          20 pixels off
    31          10 pixels on
    32          20 pixels off
    33          ...
    34         A phase of -5, 25, 55, 85, etc. would all result in the same path,
    35          because the sum of all the intervals is 30.
    37         Note: only affects stroked paths.
    38     */
    39     static SkDashPathEffect* Create(const SkScalar intervals[], int count,
    40                                     SkScalar phase, bool scaleToFit = false) {
    41         return SkNEW_ARGS(SkDashPathEffect, (intervals, count, phase, scaleToFit));
    42     }
    43     virtual ~SkDashPathEffect();
    45     virtual bool filterPath(SkPath* dst, const SkPath& src,
    46                             SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
    48     virtual bool asPoints(PointData* results, const SkPath& src,
    49                           const SkStrokeRec&, const SkMatrix&,
    50                           const SkRect*) const SK_OVERRIDE;
    52     virtual Factory getFactory() const SK_OVERRIDE;
    54     static SkFlattenable* CreateProc(SkReadBuffer&);
    56 protected:
    57     SkDashPathEffect(SkReadBuffer&);
    58     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
    60 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
    61 public:
    62 #endif
    63     SkDashPathEffect(const SkScalar intervals[], int count, SkScalar phase,
    64                      bool scaleToFit = false);
    66 private:
    67     SkScalar*   fIntervals;
    68     int32_t     fCount;
    69     // computed from phase
    70     SkScalar    fInitialDashLength;
    71     int32_t     fInitialDashIndex;
    72     SkScalar    fIntervalLength;
    73     bool        fScaleToFit;
    75     typedef SkPathEffect INHERITED;
    76 };
    78 #endif

mercurial