Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6495269

Browse files
sfreilichcopybara-github
authored andcommitted
Tweak to JNI for Mesh bounds
PiperOrigin-RevId: 781989455
1 parent7a215a3 commit6495269

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

‎ink/geometry/internal/jni/BUILD.bazel‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,15 @@ cc_library(
115115
":box_accumulator_jni_helper",
116116
":mesh_format_jni_helper",
117117
":mesh_jni_helper",
118+
":rect_jni_helper",
118119
":vec_jni_helper",
119120
"//ink/geometry:envelope",
120121
"//ink/geometry:mesh",
121122
"//ink/geometry:mesh_format",
122123
"//ink/geometry:mesh_packing_types",
123124
"//ink/geometry:point",
124125
"//ink/jni/internal:jni_defines",
126+
"@com_google_absl//absl/base:nullability",
125127
"@com_google_absl//absl/log:absl_check",
126128
"@com_google_absl//absl/types:span",
127129
]+select({

‎ink/geometry/internal/jni/mesh_jni.cc‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@
1616

1717
#include<cstddef>
1818

19+
#include"absl/base/nullability.h"
1920
#include"absl/log/absl_check.h"
2021
#include"absl/types/span.h"
21-
#include"ink/geometry/internal/jni/box_accumulator_jni_helper.h"
2222
#include"ink/geometry/internal/jni/mesh_format_jni_helper.h"
2323
#include"ink/geometry/internal/jni/mesh_jni_helper.h"
24+
#include"ink/geometry/internal/jni/rect_jni_helper.h"
2425
#include"ink/geometry/internal/jni/vec_jni_helper.h"
2526
#include"ink/geometry/mesh.h"
2627
#include"ink/geometry/mesh_packing_types.h"
27-
#include"ink/geometry/point.h"
2828
#include"ink/jni/internal/jni_defines.h"
2929

3030
namespace {
3131

3232
using ::ink::Mesh;
3333
using ::ink::jni::CastToMesh;
34+
using ::ink::jni::CreateJImmutableBoxFromRectOrThrow;
3435
using ::ink::jni::DeleteNativeMesh;
35-
using ::ink::jni::FillJBoxAccumulatorOrThrow;
3636
using ::ink::jni::FillJMutableVecFromPointOrThrow;
3737
using ::ink::jni::NewNativeMesh;
3838
using ::ink::jni::NewNativeMeshFormat;
@@ -118,10 +118,13 @@ JNI_METHOD(geometry, MeshNative, jint, getAttributeCount)
118118
returnCastToMesh(native_pointer).Format().Attributes().size();
119119
}
120120

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) {
123123
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());
125128
}
126129

127130
JNI_METHOD(geometry, MeshNative, jint, fillAttributeUnpackingParams)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp