aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils/SkDashPathPriv.h
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2014-06-11 06:51:51 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-06-11 06:51:51 -0700
commita22ea1882391cc5c84136060636d5c952c1f34b3 (patch)
tree54f2f7ec544da2cc9738780e441e7b7bd2ef20b3 /src/utils/SkDashPathPriv.h
parent35fcd15d0598bca6a265100ace5d10a0d992cf9c (diff)
Move Dashing filterPath to a dashing utils file
From inside GrContext, we have a need to create an SkPath an original path and some dashing info. We do not have access to the original path effect so we need a way to make the FilterPath function accessible outside of the effect. So I moved the core filterPath code (and all need helper functions) out of SkDashPathEffect and created a SkDashPath in utils to store these helper functions. BUG=skia: Committed: https://skia.googlesource.com/skia/+/576dcdc793a762ec63fbecdbfd5768066b548fe5 Author: egdaniel@google.com Review URL: https://codereview.chromium.org/314623004
Diffstat (limited to 'src/utils/SkDashPathPriv.h')
-rw-r--r--src/utils/SkDashPathPriv.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/utils/SkDashPathPriv.h b/src/utils/SkDashPathPriv.h
new file mode 100644
index 0000000000..94222a271a
--- /dev/null
+++ b/src/utils/SkDashPathPriv.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkDashPathPriv_DEFINED
+#define SkDashPathPriv_DEFINED
+
+#include "SkPathEffect.h"
+
+namespace SkDashPath {
+ /*
+ * Calculates the initialDashLength, initialDashIndex, and intervalLength based on the
+ * inputed phase and intervals. If adjustedPhase is passed in, then the phase will be
+ * adjusted to be between 0 and intervalLength. The result will be stored in adjustedPhase.
+ * If adjustedPhase is NULL then it is assumed phase is already between 0 and intervalLength
+ */
+ void CalcDashParameters(SkScalar phase, const SkScalar intervals[], int32_t count,
+ SkScalar* initialDashLength, int32_t* initialDashIndex,
+ SkScalar* intervalLength, SkScalar* adjustedPhase = NULL);
+
+ bool FilterDashPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*,
+ const SkScalar aIntervals[], int32_t count, SkScalar initialDashLength,
+ int32_t initialDashIndex, SkScalar intervalLength);
+
+ bool FilterDashPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*,
+ const SkPathEffect::DashInfo& info);
+}
+
+#endif