aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/svg/SkSVGCanvas.cpp
blob: 3d1ff0e74a885d19903d7d0929e5a5cf54bfc44a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
 * Copyright 2015 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "SkSVGCanvas.h"
#include "SkSVGDevice.h"
#include "SkMakeUnique.h"
#include "SkXMLWriter.h"

std::unique_ptr<SkCanvas> SkSVGCanvas::Make(const SkRect& bounds, SkXMLWriter* writer) {
    // TODO: pass full bounds to the device
    SkISize size = bounds.roundOut().size();
    sk_sp<SkBaseDevice> device(SkSVGDevice::Create(size, writer));

    return skstd::make_unique<SkCanvas>(device);
}

std::unique_ptr<SkCanvas> SkSVGCanvas::Make(const SkRect& bounds, SkWStream* writer) {
    SkXMLStreamWriter xmlWriter(writer);
    return Make(bounds, &xmlWriter);
}