b2d1a3bdd7
- 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>
47 lines
1.3 KiB
C++
47 lines
1.3 KiB
C++
/*
|
|
* Copyright 2017 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef SkSVGUse_DEFINED
|
|
#define SkSVGUse_DEFINED
|
|
|
|
#include "modules/svg/include/SkSVGTransformableNode.h"
|
|
#include "modules/svg/include/SkSVGTypes.h"
|
|
|
|
/**
|
|
* Implements support for <use> (reference) elements.
|
|
* (https://www.w3.org/TR/SVG11/struct.html#UseElement)
|
|
*/
|
|
class SkSVGUse final : public SkSVGTransformableNode {
|
|
public:
|
|
static sk_sp<SkSVGUse> Make() { return sk_sp<SkSVGUse>(new SkSVGUse()); }
|
|
|
|
void appendChild(sk_sp<SkSVGNode>) override;
|
|
|
|
void setHref(const SkSVGStringType&);
|
|
void setX(const SkSVGLength&);
|
|
void setY(const SkSVGLength&);
|
|
|
|
protected:
|
|
void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override;
|
|
|
|
bool onPrepareToRender(SkSVGRenderContext*) const override;
|
|
void onRender(const SkSVGRenderContext&) const override;
|
|
SkPath onAsPath(const SkSVGRenderContext&) const override;
|
|
SkRect onObjectBoundingBox(const SkSVGRenderContext&) const override;
|
|
|
|
private:
|
|
SkSVGUse();
|
|
|
|
SkSVGStringType fHref;
|
|
SkSVGLength fX = SkSVGLength(0);
|
|
SkSVGLength fY = SkSVGLength(0);
|
|
|
|
using INHERITED = SkSVGTransformableNode;
|
|
};
|
|
|
|
#endif // SkSVGUse_DEFINED
|