blob: 3d1ff0e74a885d19903d7d0929e5a5cf54bfc44a [file] [log] [blame]
fmalita2aafe6f2015-02-06 12:51:10 -08001/*
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 Reed5df49342016-11-12 08:06:55 -060010#include "SkMakeUnique.h"
Florin Malita99822ac2017-09-19 16:12:25 -040011#include "SkXMLWriter.h"
fmalita2aafe6f2015-02-06 12:51:10 -080012
Mike Reed5df49342016-11-12 08:06:55 -060013std::unique_ptr<SkCanvas> SkSVGCanvas::Make(const SkRect& bounds, SkXMLWriter* writer) {
fmalita2aafe6f2015-02-06 12:51:10 -080014 // TODO: pass full bounds to the device
15 SkISize size = bounds.roundOut().size();
Hal Canary67b39de2016-11-07 11:47:44 -050016 sk_sp<SkBaseDevice> device(SkSVGDevice::Create(size, writer));
fmalita2aafe6f2015-02-06 12:51:10 -080017
Herb Derbyefe39bc2018-05-01 17:06:20 -040018 return skstd::make_unique<SkCanvas>(device);
fmalita2aafe6f2015-02-06 12:51:10 -080019}
Florin Malita99822ac2017-09-19 16:12:25 -040020
21std::unique_ptr<SkCanvas> SkSVGCanvas::Make(const SkRect& bounds, SkWStream* writer) {
22 SkXMLStreamWriter xmlWriter(writer);
23 return Make(bounds, &xmlWriter);
24}