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.

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

mercurial