Implement face stipples on Android

* .gitignore:

* java/Makefile.in: Fix typos.

* java/org/gnu/emacs/EmacsFillRectangle.java (perform): Call
blitOpaqueStipple if filling an unobscured rectangle with an
opaque stipple.

* java/org/gnu/emacs/EmacsGC.java (EmacsGC) <tileObject>: New
field.
(markDirty): Synchronize the current stipple with tileObject.
(prepareStipple, blitOpaqueStipple): New functions.

* java/org/gnu/emacs/EmacsService.java (EmacsService)
<resources>: New static field.
(onCreate): Set it.

* src/android.c (android_create_bitmap_from_data): Correct order
of arguments to android_create_pixmap_from_bitmap_data.
(HAS_BUILTIN_TRAP): Delete macro.
(emacs_abort): Always induce backtraces by means of a NULL
pointer deference.

* src/dispextern.h (Emacs_GC, Emacs_Rectangle, GCForeground)
(GCBackground, GCFillStyle, GCStipple, FillOpaqueStipple)
[HAVE_ANDROID]: Define to their Android counterparts rather
than simulating their existence.

* src/epaths.in: Set bitmap path to /assets/bitmaps on Android.

* src/image.c (image_bitmap_pixmap): Also enable when
HAVE_ANDROID.

* src/sfntfont-android.c (sfntfont_android_put_glyphs): Assert
that this is never called to draw a stippled background.
* src/xfaces.c (x_create_gc) [HAVE_ANDROID]: Redefine as
wrapper around android_create_gc.
(prepare_face_for_display) [HAVE_ANDROID]: Enable stipples.
This commit is contained in:
Po Lu
2024-04-23 14:30:38 +08:00
parent 63765a74f1
commit b9c191d690
11 changed files with 139 additions and 61 deletions

View File

@@ -64,6 +64,7 @@ import android.content.pm.PackageManager;
import android.content.res.AssetManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.hardware.input.InputManager;
@@ -146,6 +147,9 @@ public final class EmacsService extends Service
thread. */
private Thread mainThread;
/* "Resources" object required by GContext bookkeeping. */
public static Resources resources;
static
{
servicingQuery = new AtomicInteger ();
@@ -238,10 +242,11 @@ public final class EmacsService extends Service
super.onCreate ();
SERVICE = this;
resources = getResources ();
handler = new Handler (Looper.getMainLooper ());
manager = getAssets ();
app_context = getApplicationContext ();
metrics = getResources ().getDisplayMetrics ();
metrics = resources.getDisplayMetrics ();
pixelDensityX = metrics.xdpi;
pixelDensityY = metrics.ydpi;
tempScaledDensity = ((getScaledDensity (metrics)