aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-07-22 22:12:59 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-24 12:53:19 +0000
commit40e7e655341c5bf56e398cd2f5902dda79d702a0 (patch)
tree1f4e887f232d53e24a9cdf791eea8660c9dac70b
parent71f867c2294655ccf8981500ad5a3beefb71295e (diff)
remove (unused?) arcto patheffect
Bug: skia: Change-Id: I80943cc495eb1edce839387f4b9512a66a4e5c11 Reviewed-on: https://skia-review.googlesource.com/25981 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Mike Reed <reed@google.com>
-rw-r--r--fuzz/FilterFuzz.cpp18
-rw-r--r--fuzz/FuzzCanvas.cpp12
-rw-r--r--gn/effects.gni1
-rw-r--r--include/effects/SkArcToPathEffect.h40
-rw-r--r--samplecode/SampleFilterFuzz.cpp8
-rw-r--r--samplecode/SamplePath.cpp21
-rw-r--r--src/effects/SkArcToPathEffect.cpp78
-rw-r--r--src/ports/SkGlobalInitialization_default.cpp2
8 files changed, 16 insertions, 164 deletions
diff --git a/fuzz/FilterFuzz.cpp b/fuzz/FilterFuzz.cpp
index d15370707c..015a0a06aa 100644
--- a/fuzz/FilterFuzz.cpp
+++ b/fuzz/FilterFuzz.cpp
@@ -8,7 +8,6 @@
#include "Sk1DPathEffect.h"
#include "Sk2DPathEffect.h"
#include "SkAlphaThresholdFilter.h"
-#include "SkArcToPathEffect.h"
#include "SkBlurImageFilter.h"
#include "SkBlurMaskFilter.h"
#include "SkCanvas.h"
@@ -414,12 +413,14 @@ static sk_sp<SkPathEffect> make_path_effect(bool canBeNull = true) {
fuzz->nextRange(&s, 0, 2);
if (canBeNull && s == 0) { return pathEffect; }
- fuzz->nextRange(&s, 0, 8);
+ fuzz->nextRange(&s, 0, 7);
switch (s) {
case 0: {
- SkScalar a = make_number(true);
- pathEffect = SkArcToPathEffect::Make(a);
+ SkPath path = make_path();
+ SkMatrix m;
+ init_matrix(&m);
+ pathEffect = SkPath2DPathEffect::Make(m, path);
break;
}
case 1: {
@@ -463,14 +464,7 @@ static sk_sp<SkPathEffect> make_path_effect(bool canBeNull = true) {
pathEffect = SkLine2DPathEffect::Make(a, m);
break;
}
- case 7: {
- SkPath path = make_path();
- SkMatrix m;
- init_matrix(&m);
- pathEffect = SkPath2DPathEffect::Make(m, path);
- break;
- }
- case 8:
+ case 7:
default: {
sk_sp<SkPathEffect> a = make_path_effect(false);
sk_sp<SkPathEffect> b = make_path_effect(false);
diff --git a/fuzz/FuzzCanvas.cpp b/fuzz/FuzzCanvas.cpp
index 317578caca..bcd4619615 100644
--- a/fuzz/FuzzCanvas.cpp
+++ b/fuzz/FuzzCanvas.cpp
@@ -28,7 +28,6 @@
#include "Sk1DPathEffect.h"
#include "Sk2DPathEffect.h"
#include "SkAlphaThresholdFilter.h"
-#include "SkArcToPathEffect.h"
#include "SkArithmeticImageFilter.h"
#include "SkBlurImageFilter.h"
#include "SkBlurMaskFilter.h"
@@ -496,7 +495,7 @@ static sk_sp<SkPathEffect> make_fuzz_patheffect(Fuzz* fuzz, int depth) {
return nullptr;
}
uint8_t pathEffectType;
- fuzz->nextRange(&pathEffectType, 0, 9);
+ fuzz->nextRange(&pathEffectType, 0, 8);
switch (pathEffectType) {
case 0: {
return nullptr;
@@ -536,14 +535,9 @@ static sk_sp<SkPathEffect> make_fuzz_patheffect(Fuzz* fuzz, int depth) {
case 6: {
SkScalar radius;
fuzz->next(&radius);
- return SkArcToPathEffect::Make(radius);
- }
- case 7: {
- SkScalar radius;
- fuzz->next(&radius);
return SkCornerPathEffect::Make(radius);
}
- case 8: {
+ case 7: {
SkScalar phase;
fuzz->next(&phase);
SkScalar intervals[20];
@@ -552,7 +546,7 @@ static sk_sp<SkPathEffect> make_fuzz_patheffect(Fuzz* fuzz, int depth) {
fuzz->nextN(intervals, count);
return SkDashPathEffect::Make(intervals, count, phase);
}
- case 9: {
+ case 8: {
SkScalar segLength, dev;
uint32_t seed;
fuzz->next(&segLength, &dev, &seed);
diff --git a/gn/effects.gni b/gn/effects.gni
index 9418e12dd0..1e86d2fd9f 100644
--- a/gn/effects.gni
+++ b/gn/effects.gni
@@ -18,7 +18,6 @@ skia_effects_sources = [
"$_src/effects/Sk1DPathEffect.cpp",
"$_src/effects/Sk2DPathEffect.cpp",
"$_src/effects/SkAlphaThresholdFilter.cpp",
- "$_src/effects/SkArcToPathEffect.cpp",
"$_src/effects/SkArithmeticImageFilter.cpp",
"$_src/effects/SkBlurMask.cpp",
"$_src/effects/SkBlurMask.h",
diff --git a/include/effects/SkArcToPathEffect.h b/include/effects/SkArcToPathEffect.h
deleted file mode 100644
index fcf4a3a5dc..0000000000
--- a/include/effects/SkArcToPathEffect.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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 SkArcToPathEffect_DEFINED
-#define SkArcToPathEffect_DEFINED
-
-#include "SkPathEffect.h"
-
-class SK_API SkArcToPathEffect : public SkPathEffect {
-public:
- /** radius must be > 0 to have an effect. It specifies the distance from each corner
- that should be "rounded".
- */
- static sk_sp<SkPathEffect> Make(SkScalar radius) {
- if (radius <= 0) {
- return NULL;
- }
- return sk_sp<SkPathEffect>(new SkArcToPathEffect(radius));
- }
-
- bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override;
-
- SK_TO_STRING_OVERRIDE()
- SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkArcToPathEffect)
-
-protected:
- explicit SkArcToPathEffect(SkScalar radius);
- void flatten(SkWriteBuffer&) const override;
-
-private:
- SkScalar fRadius;
-
- typedef SkPathEffect INHERITED;
-};
-
-#endif
diff --git a/samplecode/SampleFilterFuzz.cpp b/samplecode/SampleFilterFuzz.cpp
index dcb740d4d8..ec9476fcfe 100644
--- a/samplecode/SampleFilterFuzz.cpp
+++ b/samplecode/SampleFilterFuzz.cpp
@@ -8,7 +8,6 @@
#include "Sk1DPathEffect.h"
#include "Sk2DPathEffect.h"
#include "SkAlphaThresholdFilter.h"
-#include "SkArcToPathEffect.h"
#include "SkBlurImageFilter.h"
#include "SkBlurMaskFilter.h"
#include "SkCanvas.h"
@@ -418,9 +417,9 @@ static sk_sp<SkPathEffect> make_path_effect(bool canBeNull = true) {
sk_sp<SkPathEffect> pathEffect;
if (canBeNull && (R(3) == 1)) { return pathEffect; }
- switch (R(9)) {
+ switch (R(8)) {
case 0:
- pathEffect = SkArcToPathEffect::Make(make_scalar(true));
+ pathEffect = SkPath2DPathEffect::Make(make_matrix(), make_path());
break;
case 1:
pathEffect = SkPathEffect::MakeCompose(make_path_effect(false),
@@ -449,9 +448,6 @@ static sk_sp<SkPathEffect> make_path_effect(bool canBeNull = true) {
pathEffect = SkLine2DPathEffect::Make(make_scalar(), make_matrix());
break;
case 7:
- pathEffect = SkPath2DPathEffect::Make(make_matrix(), make_path());
- break;
- case 8:
default:
pathEffect = SkPathEffect::MakeSum(make_path_effect(false),
make_path_effect(false));
diff --git a/samplecode/SamplePath.cpp b/samplecode/SamplePath.cpp
index 6438dcfb7d..0fb528774b 100644
--- a/samplecode/SamplePath.cpp
+++ b/samplecode/SamplePath.cpp
@@ -208,13 +208,12 @@ DEF_SAMPLE( return new PathView; )
//////////////////////////////////////////////////////////////////////////////
-#include "SkArcToPathEffect.h"
#include "SkCornerPathEffect.h"
#include "SkRandom.h"
class ArcToView : public SampleView {
- bool fDoFrame, fDoArcTo, fDoCorner, fDoConic;
- SkPaint fPtsPaint, fArcToPaint, fSkeletonPaint, fCornerPaint;
+ bool fDoFrame, fDoCorner, fDoConic;
+ SkPaint fPtsPaint, fSkeletonPaint, fCornerPaint;
public:
enum {
N = 4
@@ -222,7 +221,7 @@ public:
SkPoint fPts[N];
ArcToView()
- : fDoFrame(false), fDoArcTo(false), fDoCorner(false), fDoConic(false)
+ : fDoFrame(false), fDoCorner(false), fDoConic(false)
{
SkRandom rand;
for (int i = 0; i < N; ++i) {
@@ -236,12 +235,6 @@ public:
fPtsPaint.setStrokeWidth(15);
fPtsPaint.setStrokeCap(SkPaint::kRound_Cap);
- fArcToPaint.setAntiAlias(true);
- fArcToPaint.setStyle(SkPaint::kStroke_Style);
- fArcToPaint.setStrokeWidth(9);
- fArcToPaint.setColor(0x800000FF);
- fArcToPaint.setPathEffect(SkArcToPathEffect::Make(rad));
-
fCornerPaint.setAntiAlias(true);
fCornerPaint.setStyle(SkPaint::kStroke_Style);
fCornerPaint.setStrokeWidth(13);
@@ -269,9 +262,8 @@ protected:
if (SampleCode::CharQ(*evt, &uni)) {
switch (uni) {
case '1': this->toggle(fDoFrame); return true;
- case '2': this->toggle(fDoArcTo); return true;
- case '3': this->toggle(fDoCorner); return true;
- case '4': this->toggle(fDoConic); return true;
+ case '2': this->toggle(fDoCorner); return true;
+ case '3': this->toggle(fDoConic); return true;
default: break;
}
}
@@ -297,9 +289,6 @@ protected:
if (fDoCorner) {
canvas->drawPath(path, fCornerPaint);
}
- if (fDoArcTo) {
- canvas->drawPath(path, fArcToPaint);
- }
canvas->drawPath(path, fSkeletonPaint);
}
diff --git a/src/effects/SkArcToPathEffect.cpp b/src/effects/SkArcToPathEffect.cpp
deleted file mode 100644
index a6273db092..0000000000
--- a/src/effects/SkArcToPathEffect.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkArcToPathEffect.h"
-#include "SkPath.h"
-#include "SkPoint.h"
-#include "SkReadBuffer.h"
-#include "SkWriteBuffer.h"
-
-SkArcToPathEffect::SkArcToPathEffect(SkScalar radius) : fRadius(radius) {}
-
-bool SkArcToPathEffect::filterPath(SkPath* dst, const SkPath& src,
- SkStrokeRec*, const SkRect*) const {
- SkPath::Iter iter(src, false);
- SkPath::Verb verb;
- SkPoint pts[4];
-
- SkPoint lastCorner = { 0, 0 }; // avoid warning
- SkPath::Verb prevVerb = SkPath::kMove_Verb;
-
- for (;;) {
- switch (verb = iter.next(pts, false)) {
- case SkPath::kMove_Verb:
- if (SkPath::kLine_Verb == prevVerb) {
- dst->lineTo(lastCorner);
- }
- dst->moveTo(pts[0]);
- break;
- case SkPath::kLine_Verb:
- if (prevVerb == SkPath::kLine_Verb) {
- dst->arcTo(pts[0], pts[1], fRadius);
- }
- lastCorner = pts[1];
- break;
- case SkPath::kQuad_Verb:
- dst->quadTo(pts[1], pts[2]);
- lastCorner = pts[2];
- break;
- case SkPath::kConic_Verb:
- dst->conicTo(pts[1], pts[2], iter.conicWeight());
- lastCorner = pts[2];
- break;
- case SkPath::kCubic_Verb:
- dst->cubicTo(pts[1], pts[2], pts[3]);
- lastCorner = pts[3];
- break;
- case SkPath::kClose_Verb:
- dst->lineTo(lastCorner);
- break;
- case SkPath::kDone_Verb:
- dst->lineTo(lastCorner);
- goto DONE;
- }
- prevVerb = verb;
- }
-DONE:
- return true;
-}
-
-sk_sp<SkFlattenable> SkArcToPathEffect::CreateProc(SkReadBuffer& buffer) {
- return SkArcToPathEffect::Make(buffer.readScalar());
-}
-
-void SkArcToPathEffect::flatten(SkWriteBuffer& buffer) const {
- buffer.writeScalar(fRadius);
-}
-
-#ifndef SK_IGNORE_TO_STRING
-void SkArcToPathEffect::toString(SkString* str) const {
- str->appendf("SkArcToPathEffect: (");
- str->appendf("radius: %f", fRadius);
- str->appendf(")");
-}
-#endif
diff --git a/src/ports/SkGlobalInitialization_default.cpp b/src/ports/SkGlobalInitialization_default.cpp
index fd13e2c9bb..678e38a339 100644
--- a/src/ports/SkGlobalInitialization_default.cpp
+++ b/src/ports/SkGlobalInitialization_default.cpp
@@ -8,7 +8,6 @@
#include "Sk1DPathEffect.h"
#include "Sk2DPathEffect.h"
#include "SkAlphaThresholdFilter.h"
-#include "SkArcToPathEffect.h"
#include "SkBitmapSourceDeserializer.h"
#include "SkBlurImageFilter.h"
#include "SkBlurMaskFilter.h"
@@ -91,7 +90,6 @@ void SkFlattenable::PrivateInitializer::InitEffects() {
SkNormalSource::InitializeFlattenables();
// PathEffect
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArcToPathEffect)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkCornerPathEffect)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDashImpl)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiscretePathEffect)