skia2/experimental/svg/model/SkSVGPoly.h
Mike Reed 7d34dc7747 Revert "Revert "switch to new filltype for SkPath""
This reverts commit 3e7af41224.

Change-Id: Id4f66b3956f4bdbe690db20fc478b7365ee89717
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256676
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-11-26 17:43:14 +00:00

46 lines
1.1 KiB
C++

/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkSVGPoly_DEFINED
#define SkSVGPoly_DEFINED
#include "experimental/svg/model/SkSVGShape.h"
#include "include/core/SkPath.h"
// Handles <polygon> and <polyline> elements.
class SkSVGPoly final : public SkSVGShape {
public:
~SkSVGPoly() override = default;
static sk_sp<SkSVGPoly> MakePolygon() {
return sk_sp<SkSVGPoly>(new SkSVGPoly(SkSVGTag::kPolygon));
}
static sk_sp<SkSVGPoly> MakePolyline() {
return sk_sp<SkSVGPoly>(new SkSVGPoly(SkSVGTag::kPolyline));
}
void setPoints(const SkSVGPointsType&);
protected:
void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override;
void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&,
SkPathFillType) const override;
SkPath onAsPath(const SkSVGRenderContext&) const override;
private:
SkSVGPoly(SkSVGTag);
mutable SkPath fPath; // mutated in onDraw(), to apply inherited fill types.
typedef SkSVGShape INHERITED;
};
#endif // SkSVGPoly_DEFINED