fmalita | 2aafe6f | 2015-02-06 12:51:10 -0800 | [diff] [blame] | 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" |
Mike Reed | 5df4934 | 2016-11-12 08:06:55 -0600 | [diff] [blame] | 10 | #include "SkMakeUnique.h" |
Florin Malita | 99822ac | 2017-09-19 16:12:25 -0400 | [diff] [blame] | 11 | #include "SkXMLWriter.h" |
fmalita | 2aafe6f | 2015-02-06 12:51:10 -0800 | [diff] [blame] | 12 | |
Mike Reed | 5df4934 | 2016-11-12 08:06:55 -0600 | [diff] [blame] | 13 | std::unique_ptr<SkCanvas> SkSVGCanvas::Make(const SkRect& bounds, SkXMLWriter* writer) { |
fmalita | 2aafe6f | 2015-02-06 12:51:10 -0800 | [diff] [blame] | 14 | // TODO: pass full bounds to the device |
| 15 | SkISize size = bounds.roundOut().size(); |
Hal Canary | 67b39de | 2016-11-07 11:47:44 -0500 | [diff] [blame] | 16 | sk_sp<SkBaseDevice> device(SkSVGDevice::Create(size, writer)); |
fmalita | 2aafe6f | 2015-02-06 12:51:10 -0800 | [diff] [blame] | 17 | |
Herb Derby | efe39bc | 2018-05-01 17:06:20 -0400 | [diff] [blame] | 18 | return skstd::make_unique<SkCanvas>(device); |
fmalita | 2aafe6f | 2015-02-06 12:51:10 -0800 | [diff] [blame] | 19 | } |
Florin Malita | 99822ac | 2017-09-19 16:12:25 -0400 | [diff] [blame] | 20 | |
| 21 | std::unique_ptr<SkCanvas> SkSVGCanvas::Make(const SkRect& bounds, SkWStream* writer) { |
| 22 | SkXMLStreamWriter xmlWriter(writer); |
| 23 | return Make(bounds, &xmlWriter); |
| 24 | } |