From e6b3ae67baf236970dddb3242799f77884271859 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Thu, 11 May 2017 05:09:40 +0200 Subject: [PATCH] Added the C API for SkPath::computeTightBounds() --- include/c/sk_path.h | 2 ++ src/c/sk_path.cpp | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/include/c/sk_path.h b/include/c/sk_path.h index 5e0aa73..c38e9ba 100644 --- a/include/c/sk_path.h +++ b/include/c/sk_path.h @@ -99,6 +99,8 @@ SK_C_API void sk_path_add_circle(sk_path_t*, float x, float y, float radius, sk_ */ SK_C_API bool sk_path_get_bounds(const sk_path_t*, sk_rect_t*); +SK_C_API void sk_path_compute_tight_bounds(const sk_path_t*, sk_rect_t*); + /** Set the beginning of the next contour relative to the last point on the previous contour. If there is no previous contour, this is treated the same as sk_path_move_to. diff --git a/src/c/sk_path.cpp b/src/c/sk_path.cpp index 2188121..5c37bf4 100644 --- a/src/c/sk_path.cpp +++ b/src/c/sk_path.cpp @@ -235,6 +235,13 @@ bool sk_path_get_bounds(const sk_path_t* cpath, sk_rect_t* crect) { return true; } +void sk_path_compute_tight_bounds(const sk_path_t* cpath, sk_rect_t* crect) { + if (crect) { + const SkPath& path = AsPath(*cpath); + *crect = ToRect(path.computeTightBounds()); + } +} + int sk_path_count_points(const sk_path_t* cpath) { const SkPath& path = AsPath(*cpath); return path.countPoints(); -- 2.7.4