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 SkSVGDOM_DEFINED
|
|
|
|
#define SkSVGDOM_DEFINED
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "experimental/svg/model/SkSVGIDMapper.h"
|
|
|
|
#include "include/core/SkRefCnt.h"
|
|
|
|
#include "include/core/SkSize.h"
|
|
|
|
#include "include/private/SkTemplates.h"
|
2016-07-27 01:46:34 +00:00
|
|
|
|
|
|
|
class SkCanvas;
|
|
|
|
class SkDOM;
|
|
|
|
class SkStream;
|
|
|
|
class SkSVGNode;
|
|
|
|
|
|
|
|
class SkSVGDOM : public SkRefCnt {
|
|
|
|
public:
|
2016-09-14 19:04:30 +00:00
|
|
|
SkSVGDOM();
|
2016-07-27 01:46:34 +00:00
|
|
|
|
2016-09-14 19:04:30 +00:00
|
|
|
static sk_sp<SkSVGDOM> MakeFromDOM(const SkDOM&);
|
|
|
|
static sk_sp<SkSVGDOM> MakeFromStream(SkStream&);
|
2016-07-27 01:46:34 +00:00
|
|
|
|
2016-09-14 19:04:30 +00:00
|
|
|
const SkSize& containerSize() const;
|
2016-07-27 01:46:34 +00:00
|
|
|
void setContainerSize(const SkSize&);
|
2016-09-14 19:04:30 +00:00
|
|
|
|
2016-08-12 20:17:11 +00:00
|
|
|
void setRoot(sk_sp<SkSVGNode>);
|
2016-07-27 01:46:34 +00:00
|
|
|
|
2020-05-08 20:23:10 +00:00
|
|
|
// Returns the node with the given id, or nullptr if not found.
|
|
|
|
sk_sp<SkSVGNode>* findNodeById(const char* id);
|
|
|
|
|
2016-07-27 01:46:34 +00:00
|
|
|
void render(SkCanvas*) const;
|
|
|
|
|
|
|
|
private:
|
2016-09-14 19:04:30 +00:00
|
|
|
SkSize intrinsicSize() const;
|
|
|
|
|
2016-07-27 01:46:34 +00:00
|
|
|
SkSize fContainerSize;
|
|
|
|
sk_sp<SkSVGNode> fRoot;
|
2016-09-13 00:06:47 +00:00
|
|
|
SkSVGIDMapper fIDMapper;
|
2016-07-27 01:46:34 +00:00
|
|
|
|
|
|
|
typedef SkRefCnt INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SkSVGDOM_DEFINED
|