Skip to content

Commit c96573b

Browse files
sfreilichcopybara-github
authored andcommitted
JNI interface tweak to avoid an implicit circular dep
PiperOrigin-RevId: 854322831
1 parent 310243a commit c96573b

4 files changed

Lines changed: 19 additions & 18 deletions

File tree

ink/brush/internal/jni/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ cc_library(
2727
":brush_jni",
2828
":brush_paint_jni",
2929
":brush_tip_jni",
30+
":color_extensions_jni",
3031
":color_function_jni",
3132
":easing_function_jni",
3233
":stock_brushes_jni",

ink/brush/internal/jni/brush_jni_helper.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ jlong ComputeColorLong(JNIEnv* env, const Color& color) {
3434
: color.InColorSpace(ColorSpace::kDisplayP3))
3535
.AsFloat(Color::Format::kGammaEncoded);
3636
return env->CallStaticLongMethod(
37-
ClassBrushNative(env),
38-
MethodBrushNativeComposeColorLongFromComponents(env),
37+
ClassColorNative(env),
38+
MethodColorNativeComposeColorLongFromComponents(env),
3939
ColorSpaceToJInt(color_space_is_supported ? original_color_space
4040
: ColorSpace::kDisplayP3),
4141
rgba.r, rgba.g, rgba.b, rgba.a);

ink/jni/internal/jni_jvm_interface.cc

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ static jclass class_mutable_parallelogram = nullptr;
5656
static jmethodID method_mutable_parallelogram_set_center_dim_rot_shear =
5757
nullptr;
5858

59-
static jclass class_brush_native = nullptr;
60-
static jmethodID method_brush_native_compose_color_long_from_components =
59+
static jclass class_color_native = nullptr;
60+
static jmethodID method_color_native_compose_color_long_from_components =
6161
nullptr;
6262

6363
static jclass class_input_tool_type = nullptr;
@@ -134,8 +134,8 @@ void UnloadJvmInterface(JNIEnv* env) {
134134
DeleteCachedClass(env, class_mutable_parallelogram);
135135
method_mutable_parallelogram_set_center_dim_rot_shear = nullptr;
136136

137-
DeleteCachedClass(env, class_brush_native);
138-
method_brush_native_compose_color_long_from_components = nullptr;
137+
DeleteCachedClass(env, class_color_native);
138+
method_color_native_compose_color_long_from_components = nullptr;
139139

140140
DeleteCachedClass(env, class_input_tool_type);
141141
method_input_tool_type_from = nullptr;
@@ -342,21 +342,21 @@ jmethodID MethodMutableParallelogramSetCenterDimensionsRotationInDegreesAndSkew(
342342
return method_mutable_parallelogram_set_center_dim_rot_shear;
343343
}
344344

345-
jclass ClassBrushNative(JNIEnv* env) {
346-
if (class_brush_native == nullptr) {
347-
class_brush_native =
348-
FindAndCacheClass(env, INK_PACKAGE "/brush/BrushNative");
345+
jclass ClassColorNative(JNIEnv* env) {
346+
if (class_color_native == nullptr) {
347+
class_color_native =
348+
FindAndCacheClass(env, INK_PACKAGE "/brush/ColorNative");
349349
}
350-
return class_brush_native;
350+
return class_color_native;
351351
}
352352

353-
jmethodID MethodBrushNativeComposeColorLongFromComponents(JNIEnv* env) {
354-
if (method_brush_native_compose_color_long_from_components == nullptr) {
355-
method_brush_native_compose_color_long_from_components =
356-
GetStaticMethodId(env, ClassBrushNative(env),
353+
jmethodID MethodColorNativeComposeColorLongFromComponents(JNIEnv* env) {
354+
if (method_color_native_compose_color_long_from_components == nullptr) {
355+
method_color_native_compose_color_long_from_components =
356+
GetStaticMethodId(env, ClassColorNative(env),
357357
"composeColorLongFromComponents", "(IFFFF)J");
358358
}
359-
return method_brush_native_compose_color_long_from_components;
359+
return method_color_native_compose_color_long_from_components;
360360
}
361361

362362
jclass ClassInputToolType(JNIEnv* env) {

ink/jni/internal/jni_jvm_interface.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ jclass ClassMutableParallelogram(JNIEnv* env);
6969
jmethodID MethodMutableParallelogramSetCenterDimensionsRotationInDegreesAndSkew(
7070
JNIEnv* env);
7171

72-
jclass ClassBrushNative(JNIEnv* env);
73-
jmethodID MethodBrushNativeComposeColorLongFromComponents(JNIEnv* env);
72+
jclass ClassColorNative(JNIEnv* env);
73+
jmethodID MethodColorNativeComposeColorLongFromComponents(JNIEnv* env);
7474

7575
jclass ClassInputToolType(JNIEnv* env);
7676
jmethodID MethodInputToolTypeFromInt(JNIEnv* env);

0 commit comments

Comments
 (0)