skia2/experimental/svg/model/SkSVGDOM.h
fmalita e1baa7c105 [SVGDom] Expose intrinsic size info
* expose intrinsic size info on <svg> nodes.

  * tweak the SkSVGDOM constructor to no longer take an container size
    param, but instead default to intrinsic size
  * update clients to call SkSVGDOM::setContainerSize() explicitly, when
    needed

R=robertphillips@google.com,stephana@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2345533002

Review-Url: https://codereview.chromium.org/2345533002
2016-09-14 12:04:30 -07:00

47 lines
911 B
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 SkSVGDOM_DEFINED
#define SkSVGDOM_DEFINED
#include "SkRefCnt.h"
#include "SkSize.h"
#include "SkSVGIDMapper.h"
#include "SkTemplates.h"
class SkCanvas;
class SkDOM;
class SkStream;
class SkSVGNode;
class SkSVGDOM : public SkRefCnt {
public:
SkSVGDOM();
~SkSVGDOM() = default;
static sk_sp<SkSVGDOM> MakeFromDOM(const SkDOM&);
static sk_sp<SkSVGDOM> MakeFromStream(SkStream&);
const SkSize& containerSize() const;
void setContainerSize(const SkSize&);
void setRoot(sk_sp<SkSVGNode>);
void render(SkCanvas*) const;
private:
SkSize intrinsicSize() const;
SkSize fContainerSize;
sk_sp<SkSVGNode> fRoot;
SkSVGIDMapper fIDMapper;
typedef SkRefCnt INHERITED;
};
#endif // SkSVGDOM_DEFINED