skia2/modules/svg/include/SkSVGLine.h
Tyler Denniston b2d1a3bdd7 [svg] Minor cleanups
- Consolidate SVGColor resolution into one method in render context, now
  that it's a shared type.
- Remove all instances of `~TypeName() override = default;`. The only
  thing this provides is slight/unreliable protection against someone
  inadvertently removing 'virtual' from the base class destructor. In
  our case that is SkRefCnt, which I'm assuming has very low risk of
  that happening.
- Clean up some .h copy/paste issues of the form
  `#endif  // Typename_DEFINED`

Change-Id: I67fb40b2828b010fb7fdd83046bc1eae1a476267
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343421
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2020-12-11 16:25:20 +00:00

48 lines
1.2 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()); }
void setX1(const SkSVGLength&);
void setY1(const SkSVGLength&);
void setX2(const SkSVGLength&);
void setY2(const SkSVGLength&);
protected:
void onSetAttribute(SkSVGAttribute, const SkSVGValue&) 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;
SkSVGLength fX1 = SkSVGLength(0);
SkSVGLength fY1 = SkSVGLength(0);
SkSVGLength fX2 = SkSVGLength(0);
SkSVGLength fY2 = SkSVGLength(0);
using INHERITED = SkSVGShape;
};
#endif // SkSVGLine_DEFINED