Update Android port

* INSTALL.android: Describe patches for BoringSSL on ARM.

* src/sfnt.c (sfnt_build_glyph_outline): Remove redundant
multiplication.
(sfnt_prepare_raster): Update offset calculation for changes.
(sfnt_step_edge, sfnt_step_edge_n): Handle bresenham terms.
(sfnt_build_outline_edges): Don't subtract floored xmin, just
xmin.
(sfnt_saturate_short): Make clang generate better code.
(sfnt_fill_span): Stop rounding coordinates.
(sfnt_poly_span): Poly consecutive on transitions all in one go.
(sfnt_lookup_glyph_metrics): Remove redundant multiplication.
(struct sfnt_interpreter): New hooks for debugging.
(sfnt_large_integer_add): New function.
(sfnt_mul_f26dot6_fixed): Round product.
(sfnt_make_interpreter): Remove redundant multiplication.

(CHECK_STACK_ELEMENTS, POP_UNCHECKED, PUSH_UNCHECKED): New
macros.
(MOVE, POP, SWAP, CINDEX, RS, RCVT, LT, LTEQ, GT, GTEQ, EQ, NEQ)
(EVEN, AND, OR, NOT, ADD, SUB, DIV, MUL, ABS, NEG, FLOOR, CEILING)
(GETINFO, ROLL, _MAX, _MIN, ROUND, NROUND, GC, MD): Don't check
SP redundantly, especially when pushing an element right after
popping one.
(sfnt_move_glyph_zone): Don't touch points by passing NULL as
flags.
(sfnt_direct_move_zp2): Touch P in the directions of the
movement.
(sfnt_interpret_scfs): Fix coding style.
(sfnt_interpret_simple_glyph): Don't round Y coordinates.
(sfnt_test_span, sfnt_test_edges, sfnt_debug_edges, sfnt_test_edge)
(sfnt_x_raster, sfnt_test_raster, rcvt_test_args)
(deltac1_test_args, deltac2_test_args, deltac3_test_args)
(roll_1_test_args, sfnt_run_hook, sfnt_identify_instruction)
(sfnt_verbose, main): Improve debug code and tests.

* src/sfnt.h (struct sfnt_edge): Add bresenham terms.
This commit is contained in:
Po Lu 2023-02-07 22:25:54 +08:00
parent 9b79f429ed
commit 795f5a16b5
3 changed files with 713 additions and 153 deletions

View file

@ -178,6 +178,8 @@ work, along with what has to be patched to make them work:
https://android.googlesource.com/platform/system/core/+/refs/heads/nougat-mr1-dev/libpackagelistparser/
libpcre - https://android.googlesource.com/platform/external/pcre
libcrypto - https://android.googlesource.com/platform/external/boringssl
(You must apply the patch at the end of this file when building for
ARM systems.)
Many of these dependencies have been migrated over to the
``Android.bp'' build system now used to build Android itself.
@ -650,6 +652,20 @@ index bf277d2..36734d9 100644
LOCAL_SDK_VERSION := 23
include $(BUILD_STATIC_LIBRARY)
diff --git a/dist/sqlite3.c b/dist/sqlite3.c
index b0536a4..8fa1ee9 100644
--- a/dist/sqlite3.c
+++ b/dist/sqlite3.c
@@ -26474,7 +26474,7 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
*/
#if !defined(HAVE_POSIX_FALLOCATE) \
&& (_XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L)
-# define HAVE_POSIX_FALLOCATE 1
+/* # define HAVE_POSIX_FALLOCATE 1 */
#endif
/*
PATCH FOR WEBP
diff --git a/Android.mk b/Android.mk
@ -733,3 +749,59 @@ index 5206a9f..b351ffc 100644
free(strp);
}
va_end(ap);
PATCH FOR BORINGSSL
diff --git a/Android.mk b/Android.mk
index 3e3ef2a..277d4a9 100644
--- a/Android.mk
+++ b/Android.mk
@@ -27,7 +27,9 @@ LOCAL_MODULE := libcrypto
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/src/include
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/crypto-sources.mk
LOCAL_CFLAGS += -fvisibility=hidden -DBORINGSSL_SHARED_LIBRARY -DBORINGSSL_IMPLEMENTATION -DOPENSSL_SMALL -Wno-unused-parameter
+LOCAL_CFLAGS_arm = -DOPENSSL_STATIC_ARMCAP -DOPENSSL_NO_ASM
LOCAL_SDK_VERSION := 9
+LOCAL_LDFLAGS = --no-undefined
# sha256-armv4.S does not compile with clang.
LOCAL_CLANG_ASFLAGS_arm += -no-integrated-as
LOCAL_CLANG_ASFLAGS_arm64 += -march=armv8-a+crypto
diff --git a/sources.mk b/sources.mk
index e82f3d5..be3a3c4 100644
--- a/sources.mk
+++ b/sources.mk
@@ -337,20 +337,20 @@ linux_aarch64_sources := \
linux-aarch64/crypto/sha/sha256-armv8.S\
linux-aarch64/crypto/sha/sha512-armv8.S\
-linux_arm_sources := \
- linux-arm/crypto/aes/aes-armv4.S\
- linux-arm/crypto/aes/aesv8-armx32.S\
- linux-arm/crypto/aes/bsaes-armv7.S\
- linux-arm/crypto/bn/armv4-mont.S\
- linux-arm/crypto/modes/ghash-armv4.S\
- linux-arm/crypto/modes/ghashv8-armx32.S\
- linux-arm/crypto/sha/sha1-armv4-large.S\
- linux-arm/crypto/sha/sha256-armv4.S\
- linux-arm/crypto/sha/sha512-armv4.S\
- src/crypto/chacha/chacha_vec_arm.S\
- src/crypto/cpu-arm-asm.S\
- src/crypto/curve25519/asm/x25519-asm-arm.S\
- src/crypto/poly1305/poly1305_arm_asm.S\
+# linux_arm_sources := \
+# linux-arm/crypto/aes/aes-armv4.S\
+# linux-arm/crypto/aes/aesv8-armx32.S\
+# linux-arm/crypto/aes/bsaes-armv7.S\
+# linux-arm/crypto/bn/armv4-mont.S\
+# linux-arm/crypto/modes/ghash-armv4.S\
+# linux-arm/crypto/modes/ghashv8-armx32.S\
+# linux-arm/crypto/sha/sha1-armv4-large.S\
+# linux-arm/crypto/sha/sha256-armv4.S\
+# linux-arm/crypto/sha/sha512-armv4.S\
+# src/crypto/chacha/chacha_vec_arm.S\
+# src/crypto/cpu-arm-asm.S\
+# src/crypto/curve25519/asm/x25519-asm-arm.S\
+# src/crypto/poly1305/poly1305_arm_asm.S\
linux_x86_sources := \
linux-x86/crypto/aes/aes-586.S\

File diff suppressed because it is too large Load diff

View file

@ -698,6 +698,13 @@ struct sfnt_raster
unsigned short refcount;
};
/* Bresenham's algorithm.
This rasterizer uses Bresenham's algorithm, with the minor
detail being that it does not use device pixels, but rather
pixels in a sample grid defined by SFNT_POLY_SHIFT, which is
normally set to 4x oversampling. See sfnt_poly_edges for
an explanation of how Bresenham's algorithm works. */
struct sfnt_edge
{
/* Next edge in this chain. */
@ -709,15 +716,14 @@ struct sfnt_edge
/* X position, top and bottom of edges. */
sfnt_fixed x, top, bottom;
/* step_x is how many pixels to move for each increase in Y by
SFNT_POLY_STEP. */
/* Slope error. */
sfnt_fixed step_x;
#ifdef TEST
/* Value of x before initial adjustment of bottom to match the
grid. */
sfnt_fixed source_x;
#endif
/* SFNT_POLY_STEP times the direction of movement. */
sfnt_fixed signed_step;
/* Slope error accumulator. */
sfnt_fixed error;
};
@ -731,7 +737,6 @@ enum
SFNT_POLY_MASK = (SFNT_POLY_SAMPLE - 1),
SFNT_POLY_STEP = (0x10000 >> SFNT_POLY_SHIFT),
SFNT_POLY_START = (SFNT_POLY_STEP >> 1),
SFNT_POLY_ROUND = ((1 << (16 - SFNT_POLY_SHIFT)) / 2) - 1,
};