Add SkSVGCanvas
Add a public SVG canvas factory + move the SVG files from
experimental -> src/svg/.
Update current clients to the new API.
R=reed@google.com, mtklein@google.com, halcanary@google.com
Review URL: https://codereview.chromium.org/902583006
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 8370573..b0df70b 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -6,8 +6,9 @@
#include "SkOSFile.h"
#include "SkPictureRecorder.h"
#include "SkRandom.h"
-#include "SkSVGDevice.h"
+#include "SkSVGCanvas.h"
#include "SkStream.h"
+#include "SkXMLWriter.h"
namespace DM {
@@ -237,9 +238,11 @@
SVGSink::SVGSink() {}
Error SVGSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const {
- SkAutoTUnref<SkBaseDevice> device(SkSVGDevice::Create(src.size(), dst));
- SkCanvas canvas(device);
- return src.draw(&canvas);
+ SkAutoTDelete<SkXMLWriter> xmlWriter(SkNEW_ARGS(SkXMLStreamWriter, (dst)));
+ SkAutoTUnref<SkCanvas> canvas(SkSVGCanvas::Create(
+ SkRect::MakeWH(SkIntToScalar(src.size().width()), SkIntToScalar(src.size().height())),
+ xmlWriter));
+ return src.draw(canvas);
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/