1 /*
2  * Copyright 2015 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #include "SkSVGCanvas.h"
9 #include "SkSVGDevice.h"
10 #include "SkMakeUnique.h"
11 #include "SkXMLWriter.h"
12 
13 std::unique_ptr<SkCanvas> SkSVGCanvas::Make(const SkRect& bounds, SkXMLWriter* writer) {
14     // TODO: pass full bounds to the device
15     SkISize size = bounds.roundOut().size();
16     sk_sp<SkBaseDevice> device(SkSVGDevice::Create(size, writer));
17 
18     return skstd::make_unique<SkCanvas>(device.get());
19 }
20 
21 std::unique_ptr<SkCanvas> SkSVGCanvas::Make(const SkRect& bounds, SkWStream* writer) {
22     SkXMLStreamWriter xmlWriter(writer);
23     return Make(bounds, &xmlWriter);
24 }
25