| Index: dm/DMSrcSink.cpp
|
| diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
|
| index b6f061677c04ea806d0bd9c33fa99f224640e4a8..26d88b3817391a341abee1df17a961a1ce8c6580 100644
|
| --- a/dm/DMSrcSink.cpp
|
| +++ b/dm/DMSrcSink.cpp
|
| @@ -34,6 +34,7 @@
|
| #include "SkSVGCanvas.h"
|
| #include "SkStream.h"
|
| #include "SkTLogic.h"
|
| +#include "SkSVGDOM.h"
|
| #include "SkSwizzler.h"
|
| #include <functional>
|
|
|
| @@ -1010,6 +1011,36 @@ SkISize SKPSrc::size() const {
|
| Name SKPSrc::name() const { return SkOSPath::Basename(fPath.c_str()); }
|
|
|
| /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
| +#if defined(SK_XML)
|
| +// Should we try to use the SVG intrinsic size instead?
|
| +static const SkSize kSVGSize = SkSize::Make(1000, 1000);
|
| +
|
| +SVGSrc::SVGSrc(Path path) : fPath(path) {}
|
| +
|
| +Error SVGSrc::draw(SkCanvas* canvas) const {
|
| + SkFILEStream stream(fPath.c_str());
|
| + if (!stream.isValid()) {
|
| + return SkStringPrintf("Unable to open file: %s", fPath.c_str());
|
| + }
|
| +
|
| + sk_sp<SkSVGDOM> dom = SkSVGDOM::MakeFromStream(stream, kSVGSize);
|
| + if (!dom) {
|
| + return SkStringPrintf("Unable to parse file: %s", fPath.c_str());
|
| + }
|
| +
|
| + dom->render(canvas);
|
| +
|
| + return "";
|
| +}
|
| +
|
| +SkISize SVGSrc::size() const {
|
| + return kSVGSize.toRound();
|
| +}
|
| +
|
| +Name SVGSrc::name() const { return SkOSPath::Basename(fPath.c_str()); }
|
| +
|
| +#endif // defined(SK_XML)
|
| +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
| MSKPSrc::MSKPSrc(Path path) : fPath(path) {
|
| std::unique_ptr<SkStreamAsset> stream(SkStream::NewFromFile(fPath.c_str()));
|
|
|