Skip to content

Commit

Permalink
Add Box computeCenter and computeCorners not using output parameters
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 682435665
  • Loading branch information
Ink Open Source authored and copybara-github committed Oct 4, 2024
1 parent ddddbc1 commit 5461748
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ink/geometry/internal/jni/rect_jni.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,17 @@ using ::ink::Rect;

extern "C" {

JNI_METHOD(geometry, BoxHelper, void, nativeCenter)
JNI_METHOD(geometry, BoxHelper, jobject, nativeCreateCenter)
(JNIEnv* env, jclass clazz, float rect_x_min, jfloat rect_y_min,
jfloat rect_x_max, jfloat rect_y_max, jclass immutable_vec_class) {
Rect rect =
Rect::FromTwoPoints({rect_x_min, rect_y_min}, {rect_x_max, rect_y_max});
Point point = rect.Center();

return ink::CreateJImmutableVecFromPoint(env, point, immutable_vec_class);
}

JNI_METHOD(geometry, BoxHelper, void, nativePopulateCenter)
(JNIEnv* env, jclass clazz, float rect_x_min, jfloat rect_y_min,
jfloat rect_x_max, jfloat rect_y_max, jobject mutable_vec) {
Rect rect =
Expand Down

0 comments on commit 5461748

Please sign in to comment.