diff --git a/include/c/sk_drawable.h b/include/c/sk_drawable.h index 711738d00854..069d6f099914 100644 --- a/include/c/sk_drawable.h +++ b/include/c/sk_drawable.h @@ -21,6 +21,7 @@ SK_C_API void sk_drawable_get_bounds (sk_drawable_t*, sk_rect_t*); SK_C_API void sk_drawable_draw (sk_drawable_t*, sk_canvas_t*, const sk_matrix_t*); SK_C_API sk_picture_t* sk_drawable_new_picture_snapshot(sk_drawable_t*); SK_C_API void sk_drawable_notify_drawing_changed (sk_drawable_t*); +SK_C_API size_t sk_drawable_approximate_bytes_used(sk_drawable_t*); SK_C_PLUS_PLUS_END_GUARD diff --git a/include/c/sk_picture.h b/include/c/sk_picture.h index b632cf871925..ff0ced229bdb 100644 --- a/include/c/sk_picture.h +++ b/include/c/sk_picture.h @@ -31,6 +31,9 @@ SK_C_API void sk_picture_serialize_to_stream(const sk_picture_t* picture, sk_wst SK_C_API sk_picture_t* sk_picture_deserialize_from_stream(sk_stream_t* stream); SK_C_API sk_picture_t* sk_picture_deserialize_from_data(sk_data_t* data); SK_C_API sk_picture_t* sk_picture_deserialize_from_memory(void* buffer, size_t length); +SK_C_API void sk_picture_playback(const sk_picture_t* picture, sk_canvas_t* canvas); +SK_C_API int sk_picture_approximate_op_count(const sk_picture_t* picture, bool nested); +SK_C_API size_t sk_picture_approximate_bytes_used(const sk_picture_t* picture); SK_C_PLUS_PLUS_END_GUARD diff --git a/src/c/sk_drawable.cpp b/src/c/sk_drawable.cpp index a43c66ad024c..d1c7060b7e80 100644 --- a/src/c/sk_drawable.cpp +++ b/src/c/sk_drawable.cpp @@ -47,3 +47,7 @@ void sk_drawable_notify_drawing_changed(sk_drawable_t* d) { AsDrawable(d)->notifyDrawingChanged(); } + +size_t sk_drawable_approximate_bytes_used(sk_drawable_t* d) { + return AsDrawable(d)->approximateBytesUsed(); +} diff --git a/src/c/sk_picture.cpp b/src/c/sk_picture.cpp index 621cdf3ffda6..f993e4aac8dd 100644 --- a/src/c/sk_picture.cpp +++ b/src/c/sk_picture.cpp @@ -83,3 +83,15 @@ sk_picture_t* sk_picture_deserialize_from_data(sk_data_t* data) { sk_picture_t* sk_picture_deserialize_from_memory(void* buffer, size_t length) { return ToPicture(SkPicture::MakeFromData(buffer, length).release()); } + +void sk_picture_playback(const sk_picture_t* picture, sk_canvas_t* canvas) { + AsPicture(picture)->playback(AsCanvas(canvas)); +} + +int sk_picture_approximate_op_count(const sk_picture_t* picture, bool nested) { + return AsPicture(picture)->approximateOpCount(nested); +} + +size_t sk_picture_approximate_bytes_used(const sk_picture_t* picture) { + return AsPicture(picture)->approximateBytesUsed(); +}