2016-07-27 01:46:34 +00:00
|
|
|
/*
|
|
|
|
* 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 SkSVGSVG_DEFINED
|
|
|
|
#define SkSVGSVG_DEFINED
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "experimental/svg/model/SkSVGContainer.h"
|
|
|
|
#include "experimental/svg/model/SkSVGTypes.h"
|
|
|
|
#include "src/core/SkTLazy.h"
|
2016-07-27 01:46:34 +00:00
|
|
|
|
2016-09-14 19:04:30 +00:00
|
|
|
class SkSVGLengthContext;
|
|
|
|
|
2016-07-27 01:46:34 +00:00
|
|
|
class SkSVGSVG : public SkSVGContainer {
|
|
|
|
public:
|
2017-03-22 16:05:03 +00:00
|
|
|
~SkSVGSVG() override = default;
|
2016-07-27 01:46:34 +00:00
|
|
|
|
|
|
|
static sk_sp<SkSVGSVG> Make() { return sk_sp<SkSVGSVG>(new SkSVGSVG()); }
|
|
|
|
|
2016-08-03 17:21:11 +00:00
|
|
|
void setX(const SkSVGLength&);
|
|
|
|
void setY(const SkSVGLength&);
|
|
|
|
void setWidth(const SkSVGLength&);
|
|
|
|
void setHeight(const SkSVGLength&);
|
2016-08-08 18:38:55 +00:00
|
|
|
void setViewBox(const SkSVGViewBoxType&);
|
2016-08-03 17:21:11 +00:00
|
|
|
|
2016-09-14 19:04:30 +00:00
|
|
|
SkSize intrinsicSize(const SkSVGLengthContext&) const;
|
|
|
|
|
2016-08-03 17:21:11 +00:00
|
|
|
protected:
|
2016-08-08 18:38:55 +00:00
|
|
|
bool onPrepareToRender(SkSVGRenderContext*) const override;
|
|
|
|
|
2020-04-10 14:14:04 +00:00
|
|
|
void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override;
|
2016-08-03 17:21:11 +00:00
|
|
|
|
2016-07-27 01:46:34 +00:00
|
|
|
private:
|
|
|
|
SkSVGSVG();
|
|
|
|
|
2016-08-03 17:21:11 +00:00
|
|
|
SkSVGLength fX = SkSVGLength(0);
|
|
|
|
SkSVGLength fY = SkSVGLength(0);
|
|
|
|
SkSVGLength fWidth = SkSVGLength(100, SkSVGLength::Unit::kPercentage);
|
|
|
|
SkSVGLength fHeight = SkSVGLength(100, SkSVGLength::Unit::kPercentage);
|
|
|
|
|
2016-08-08 18:38:55 +00:00
|
|
|
SkTLazy<SkSVGViewBoxType> fViewBox;
|
|
|
|
|
2016-07-27 01:46:34 +00:00
|
|
|
typedef SkSVGContainer INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SkSVGSVG_DEFINED
|