[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 963ccc05acf: Respond to JNI errors around drawing operations
From: |
Po Lu |
Subject: |
master 963ccc05acf: Respond to JNI errors around drawing operations |
Date: |
Wed, 11 Oct 2023 20:44:11 -0400 (EDT) |
branch: master
commit 963ccc05acf2939c95524de9175a1fc3053b0f6f
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Respond to JNI errors around drawing operations
* src/android.c (android_fill_polygon, android_draw_rectangle)
(android_draw_point, android_draw_line, android_lock_bitmap):
Check or clear errors around potential JNI errors; the penalty
incurred to performance is not as significant as was expected.
---
src/android.c | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/src/android.c b/src/android.c
index d1182698669..98ace1156d7 100644
--- a/src/android.c
+++ b/src/android.c
@@ -4409,6 +4409,7 @@ android_fill_polygon (android_drawable drawable, struct
android_gc *gc,
service_class.fill_polygon,
drawable_object,
gcontext, array);
+ android_exception_check_1 (array);
ANDROID_DELETE_LOCAL_REF (array);
}
@@ -4431,6 +4432,10 @@ android_draw_rectangle (android_drawable handle, struct
android_gc *gc,
drawable, gcontext,
(jint) x, (jint) y,
(jint) width, (jint) height);
+
+ /* In lieu of android_exception_check, clear all exceptions after
+ calling this frequently called graphics operation. */
+ (*android_java_env)->ExceptionClear (android_java_env);
}
void
@@ -4451,6 +4456,10 @@ android_draw_point (android_drawable handle, struct
android_gc *gc,
service_class.draw_point,
drawable, gcontext,
(jint) x, (jint) y);
+
+ /* In lieu of android_exception_check, clear all exceptions after
+ calling this frequently called graphics operation. */
+ (*android_java_env)->ExceptionClear (android_java_env);
}
void
@@ -4472,6 +4481,10 @@ android_draw_line (android_drawable handle, struct
android_gc *gc,
drawable, gcontext,
(jint) x, (jint) y,
(jint) x2, (jint) y2);
+
+ /* In lieu of android_exception_check, clear all exceptions after
+ calling this frequently called graphics operation. */
+ (*android_java_env)->ExceptionClear (android_java_env);
}
android_pixmap
@@ -5279,7 +5292,7 @@ android_wc_lookup_string (android_key_pressed_event
*event,
The caller must take care to unlock the bitmap data afterwards. */
unsigned char *
-android_lock_bitmap (android_window drawable,
+android_lock_bitmap (android_drawable drawable,
AndroidBitmapInfo *bitmap_info,
jobject *bitmap_return)
{
@@ -5295,9 +5308,15 @@ android_lock_bitmap (android_window drawable,
object,
drawable_class.get_bitmap);
if (!bitmap)
- /* NULL is returned when the bitmap does not currently exist due
- to ongoing reconfiguration on the main thread. */
- return NULL;
+ {
+ /* Report any exception signaled. */
+ android_exception_check ();
+
+ /* If no exception was signaled, then NULL was returned as the
+ bitmap does not presently exist due to window reconfiguration
+ on the main thread. */
+ return NULL;
+ }
memset (bitmap_info, 0, sizeof *bitmap_info);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 963ccc05acf: Respond to JNI errors around drawing operations,
Po Lu <=