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 
Make(const SkRect & bounds,SkWStream * writer)13 std::unique_ptr<SkCanvas> SkSVGCanvas::Make(const SkRect& bounds, SkWStream* writer) {
14     // TODO: pass full bounds to the device
15     SkISize size = bounds.roundOut().size();
16 
17     auto svgDevice = SkSVGDevice::Make(size, skstd::make_unique<SkXMLStreamWriter>(writer));
18 
19     return svgDevice ? skstd::make_unique<SkCanvas>(svgDevice)
20                      : nullptr;
21 }
22