52d9475b05
Refactored nodes are <circle>, <ellipse>, <rect>, <line>. Change-Id: I955c6a01d6533e61a0c12f56f97040ae0b5ed879 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366721 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Tyler Denniston <tdenniston@google.com>
43 lines
1.1 KiB
C++
43 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 SkSVGLine_DEFINED
|
|
#define SkSVGLine_DEFINED
|
|
|
|
#include "modules/svg/include/SkSVGShape.h"
|
|
#include "modules/svg/include/SkSVGTypes.h"
|
|
|
|
struct SkPoint;
|
|
|
|
class SkSVGLine final : public SkSVGShape {
|
|
public:
|
|
static sk_sp<SkSVGLine> Make() { return sk_sp<SkSVGLine>(new SkSVGLine()); }
|
|
|
|
SVG_ATTR(X1, SkSVGLength, SkSVGLength(0))
|
|
SVG_ATTR(Y1, SkSVGLength, SkSVGLength(0))
|
|
SVG_ATTR(X2, SkSVGLength, SkSVGLength(0))
|
|
SVG_ATTR(Y2, SkSVGLength, SkSVGLength(0))
|
|
|
|
protected:
|
|
bool parseAndSetAttribute(const char*, const char*) override;
|
|
|
|
void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&,
|
|
SkPathFillType) const override;
|
|
|
|
SkPath onAsPath(const SkSVGRenderContext&) const override;
|
|
|
|
private:
|
|
SkSVGLine();
|
|
|
|
// resolve and return the two endpoints
|
|
std::tuple<SkPoint, SkPoint> resolve(const SkSVGLengthContext&) const;
|
|
|
|
using INHERITED = SkSVGShape;
|
|
};
|
|
|
|
#endif // SkSVGLine_DEFINED
|