• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "include/svg/SkSVGCanvas.h"
9 #include "src/core/SkMakeUnique.h"
10 #include "src/svg/SkSVGDevice.h"
11 #include "src/xml/SkXMLWriter.h"
12 
Make(const SkRect & bounds,SkWStream * writer,uint32_t flags)13 std::unique_ptr<SkCanvas> SkSVGCanvas::Make(const SkRect& bounds, SkWStream* writer,
14                                             uint32_t flags) {
15     // TODO: pass full bounds to the device
16     SkISize size = bounds.roundOut().size();
17 
18     auto svgDevice = SkSVGDevice::Make(size, skstd::make_unique<SkXMLStreamWriter>(writer), flags);
19 
20     return svgDevice ? skstd::make_unique<SkCanvas>(svgDevice)
21                      : nullptr;
22 }
23