Skip to content

Commit 5461748

Browse files
Ink Open Sourcecopybara-github
authored andcommitted
Add Box computeCenter and computeCorners not using output parameters
PiperOrigin-RevId: 682435665
1 parent ddddbc1 commit 5461748

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

ink/geometry/internal/jni/rect_jni.cc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,17 @@ using ::ink::Rect;
2828

2929
extern "C" {
3030

31-
JNI_METHOD(geometry, BoxHelper, void, nativeCenter)
31+
JNI_METHOD(geometry, BoxHelper, jobject, nativeCreateCenter)
32+
(JNIEnv* env, jclass clazz, float rect_x_min, jfloat rect_y_min,
33+
jfloat rect_x_max, jfloat rect_y_max, jclass immutable_vec_class) {
34+
Rect rect =
35+
Rect::FromTwoPoints({rect_x_min, rect_y_min}, {rect_x_max, rect_y_max});
36+
Point point = rect.Center();
37+
38+
return ink::CreateJImmutableVecFromPoint(env, point, immutable_vec_class);
39+
}
40+
41+
JNI_METHOD(geometry, BoxHelper, void, nativePopulateCenter)
3242
(JNIEnv* env, jclass clazz, float rect_x_min, jfloat rect_y_min,
3343
jfloat rect_x_max, jfloat rect_y_max, jobject mutable_vec) {
3444
Rect rect =

0 commit comments

Comments
 (0)