Merge from google/chrome/m55
[platform/upstream/libSkiaSharp.git] / src / c / sk_picture.cpp
1 /*
2  * Copyright 2016 Xamarin 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 "SkPicture.h"
9
10 #include "sk_picture.h"
11
12 #include "sk_types_priv.h"
13
14 sk_picture_recorder_t* sk_picture_recorder_new() {
15     return ToPictureRecorder(new SkPictureRecorder);
16 }
17
18 void sk_picture_recorder_delete(sk_picture_recorder_t* crec) {
19     delete AsPictureRecorder(crec);
20 }
21
22 sk_canvas_t* sk_picture_recorder_begin_recording(sk_picture_recorder_t* crec,
23                                                  const sk_rect_t* cbounds) {
24     return ToCanvas(AsPictureRecorder(crec)->beginRecording(AsRect(*cbounds)));
25 }
26
27 sk_picture_t* sk_picture_recorder_end_recording(sk_picture_recorder_t* crec) {
28     return ToPicture(AsPictureRecorder(crec)->finishRecordingAsPicture().release());
29 }
30
31 void sk_picture_ref(sk_picture_t* cpic) {
32     SkSafeRef(AsPicture(cpic));
33 }
34
35 void sk_picture_unref(sk_picture_t* cpic) {
36     SkSafeUnref(AsPicture(cpic));
37 }
38
39 uint32_t sk_picture_get_unique_id(sk_picture_t* cpic) {
40     return AsPicture(cpic)->uniqueID();
41 }
42
43 sk_rect_t sk_picture_get_bounds(sk_picture_t* cpic) {
44     return ToRect(AsPicture(cpic)->cullRect());
45 }