|
16 | 16 |
|
17 | 17 | #include<cstddef> |
18 | 18 |
|
| 19 | +#include"absl/base/nullability.h" |
19 | 20 | #include"absl/log/absl_check.h" |
20 | 21 | #include"absl/types/span.h" |
21 | | -#include"ink/geometry/internal/jni/box_accumulator_jni_helper.h" |
22 | 22 | #include"ink/geometry/internal/jni/mesh_format_jni_helper.h" |
23 | 23 | #include"ink/geometry/internal/jni/mesh_jni_helper.h" |
| 24 | +#include"ink/geometry/internal/jni/rect_jni_helper.h" |
24 | 25 | #include"ink/geometry/internal/jni/vec_jni_helper.h" |
25 | 26 | #include"ink/geometry/mesh.h" |
26 | 27 | #include"ink/geometry/mesh_packing_types.h" |
27 | | -#include"ink/geometry/point.h" |
28 | 28 | #include"ink/jni/internal/jni_defines.h" |
29 | 29 |
|
30 | 30 | namespace { |
31 | 31 |
|
32 | 32 | using ::ink::Mesh; |
33 | 33 | using ::ink::jni::CastToMesh; |
| 34 | +using ::ink::jni::CreateJImmutableBoxFromRectOrThrow; |
34 | 35 | using ::ink::jni::DeleteNativeMesh; |
35 | | -using ::ink::jni::FillJBoxAccumulatorOrThrow; |
36 | 36 | using ::ink::jni::FillJMutableVecFromPointOrThrow; |
37 | 37 | using ::ink::jni::NewNativeMesh; |
38 | 38 | using ::ink::jni::NewNativeMeshFormat; |
@@ -118,10 +118,13 @@ JNI_METHOD(geometry, MeshNative, jint, getAttributeCount) |
118 | 118 | returnCastToMesh(native_pointer).Format().Attributes().size(); |
119 | 119 | } |
120 | 120 |
|
121 | | -JNI_METHOD(geometry, MeshNative,void, fillBounds) |
122 | | -(JNIEnv* env, jobject object, jlong native_pointer, jobject box_accumulator) { |
| 121 | +JNI_METHOD(geometry, MeshNative,absl_nullable jobject, computeBounds) |
| 122 | +(JNIEnv* env, jobject object, jlong native_pointer) { |
123 | 123 | const Mesh& mesh =CastToMesh(native_pointer); |
124 | | -FillJBoxAccumulatorOrThrow(env, mesh.Bounds(), box_accumulator); |
| 124 | +if (mesh.Bounds().IsEmpty()) { |
| 125 | +returnnullptr; |
| 126 | + } |
| 127 | +returnCreateJImmutableBoxFromRectOrThrow(env, *mesh.Bounds().AsRect()); |
125 | 128 | } |
126 | 129 |
|
127 | 130 | JNI_METHOD(geometry, MeshNative, jint, fillAttributeUnpackingParams) |
|