Unverified Commit 171578f6 authored by Ivan Matkov's avatar Ivan Matkov Committed by GitHub

Restore `Path.updateBoundsCache` native bridge and add regression test (#1197)

[CMP-10199](https://youtrack.jetbrains.com/issue/CMP-10199) [iOS]
Undefined symbol '_org_jetbrains_skia_Path__1nUpdateBoundsCache

It was removed in #1187 by accident, and there was no test to catch it
parent 87982c0c
......@@ -111,6 +111,14 @@ class PathTest {
assertCloseEnough(bounds, path.computeTightBounds())
}
@Test
fun updateBoundsCacheTest() {
val path = PathBuilder().lineTo(40f, 40f).lineTo(40f, 0f).lineTo(0f, 40f).lineTo(0f, 0f).closePath().detach()
val bounds = Rect(0.0f, 0.0f, 40.0f, 40.0f)
assertTrue(path.updateBoundsCache() === path)
assertCloseEnough(bounds, path.bounds)
}
@Test
fun rawTest() {
val pts = arrayOf(Point(0f, 0f), Point(10f, 10f), Point(20f, 0f))
......@@ -210,4 +218,4 @@ class PathTest {
val result = triangle1.intersect(triangle2)
assertTrue(result.isNotEmpty())
}
}
\ No newline at end of file
}
......@@ -195,6 +195,11 @@ extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nGetBounds(JN
skija::Rect::copyToInterop(env, instance->getBounds(), resultArray);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nUpdateBoundsCache(JNIEnv* env, jclass jclass, jlong ptr) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
instance->updateBoundsCache();
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nComputeTightBounds(JNIEnv* env, jclass jclass, jlong ptr, jfloatArray resultArray) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
skija::Rect::copyToInterop(env, instance->computeTightBounds(), resultArray);
......
......@@ -187,6 +187,11 @@ SKIKO_EXPORT void org_jetbrains_skia_Path__1nGetBounds(KNativePointer ptr, KInte
skija::Rect::copyToInterop(bounds, resultArray);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nUpdateBoundsCache(KNativePointer ptr) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
instance->updateBoundsCache();
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nComputeTightBounds(KNativePointer ptr, KInteropPointer resultArray) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
SkRect bounds = instance->computeTightBounds();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment