From b84fa71f8985284560bacda7d407e3559583844f Mon Sep 17 00:00:00 2001 From: Po Lu Date: Thu, 2 May 2024 11:31:37 +0800 Subject: Port visible bell to Android * java/org/gnu/emacs/EmacsDrawRectangle.java (perform): Ignore GC_INVERT. * java/org/gnu/emacs/EmacsFillRectangle.java (EmacsFillRectangle) : New variable. (perform): If the transfer mode is invert, copy the source to itself with invertFilter as the color filter. * java/org/gnu/emacs/EmacsGC.java (EmacsGC) : Delete now-redundant ALUs. (markDirty): Cease updating the paint's transfermode. * java/org/gnu/emacs/EmacsSafThread.java (openDocument1): Fix typo in documentation. * src/android.c (android_blit_xor): Delete unused function. (android_copy_area): Remove calls to unused blit functions. * src/androidgui.h (enum android_gc_function): Rename XOR to INVERT. * src/androidterm.c (android_flash): Replace with GXinvert. --- java/org/gnu/emacs/EmacsDrawRectangle.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'java/org/gnu/emacs/EmacsDrawRectangle.java') diff --git a/java/org/gnu/emacs/EmacsDrawRectangle.java b/java/org/gnu/emacs/EmacsDrawRectangle.java index e40a7c16068..ea0f1c28106 100644 --- a/java/org/gnu/emacs/EmacsDrawRectangle.java +++ b/java/org/gnu/emacs/EmacsDrawRectangle.java @@ -22,13 +22,23 @@ package org.gnu.emacs; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Paint; +import android.graphics.PorterDuff.Mode; +import android.graphics.PorterDuffXfermode; import android.graphics.Rect; import android.graphics.RectF; +import android.graphics.Xfermode; import android.util.Log; public final class EmacsDrawRectangle { + private static final Xfermode srcInAlu; + + static + { + srcInAlu = new PorterDuffXfermode (Mode.SRC_IN); + }; + public static void perform (EmacsDrawable drawable, EmacsGC gc, int x, int y, int width, int height) @@ -40,8 +50,10 @@ public final class EmacsDrawRectangle Canvas canvas; Bitmap clipBitmap; - /* TODO implement stippling. */ - if (gc.fill_style == EmacsGC.GC_FILL_OPAQUE_STIPPLED) + /* TODO implement stippling for this request. */ + if (gc.fill_style == EmacsGC.GC_FILL_OPAQUE_STIPPLED + /* And GC_INVERT also. */ + || gc.fill_style == EmacsGC.GC_INVERT) return; canvas = drawable.lockCanvas (gc); @@ -103,7 +115,7 @@ public final class EmacsDrawRectangle /* Set the transfer mode to SRC_IN to preserve only the parts of the source that overlap with the mask. */ maskPaint = new Paint (); - maskPaint.setXfermode (EmacsGC.srcInAlu); + maskPaint.setXfermode (srcInAlu); maskPaint.setStyle (Paint.Style.STROKE); /* Draw the source. */ -- cgit v1.3