toolchains: branch master updated. a0011f684de60a4af0bf300a782a5225edd39b79
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/toolchains.git/shortlog/a0011f684de60a4af0...
...commit http://git.netsurf-browser.org/toolchains.git/commit/a0011f684de60a4af0bf...
...tree http://git.netsurf-browser.org/toolchains.git/tree/a0011f684de60a4af0bf30...
The branch, master has been updated
via a0011f684de60a4af0bf300a782a5225edd39b79 (commit)
from 782b728a669ce2e375cfbc327f52f675d3fe2795 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/toolchains.git/commit/?id=a0011f684de60a4a...
commit a0011f684de60a4af0bf300a782a5225edd39b79
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
Backport change to avoid SWP from upstream
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/unixlib-ldrex-strex.p b/arm-unknown-riscos/recipes/patches/gcc4/unixlib-ldrex-strex.p
new file mode 100644
index 0000000..045a0b8
--- /dev/null
+++ b/arm-unknown-riscos/recipes/patches/gcc4/unixlib-ldrex-strex.p
@@ -0,0 +1,304 @@
+Backport r7043 from upstream: partially replaces use of SWP with LDREX/STREX
+on systems where SWP is no longer available. This fix is incomplete,
+but sufficient for our purposes.
+
+Fri Mar 11 14:51:54 GMT 2016 Lee Noar <leenoar(a)sky.com>
+
+ * sys/_cpucaps.s: New file. Provide functions to probe the
+ OS for details of the CPU (currently SWP, LDREX/STREX
+ availability).
+ * Makefile.am: Add above file.
+ * include/unixlib/local.h: Add declarations for user facing
+ functions provided above.
+ * incl-local/internal/asm_dec.s(__ul_global): Add entry to
+ record CPU flags.
+ * incl-local/internal/unix.h: Likewise.
+ * pthread/_ints.s(__pthread_disable_ints,__pthread_protect_unsafe):
+ Use CPU flags to determine whether to use the SWP instruction or
+ LRDEX/STREX.
+ * sys/_syslib.s(__main): Add call to __probe_cpu_caps.
+ (__unixlib_fatal): Use CPU flags to determine whether to use the
+ SWP instruction or LRDEX/STREX.
+
+
+Index: gcc4/recipe/files/gcc/libunixlib/pthread/_ints.s
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/pthread/_ints.s (revision 7042)
++++ gcc4/recipe/files/gcc/libunixlib/pthread/_ints.s (revision 7043)
+@@ -2,7 +2,7 @@
+ @ disable_ints can be called multiple times, provided enable_ints is
+ @ subsequently called an equal number of times
+ @ Written by Martin Piper and Alex Waugh
+-@ Copyright (c) 2002-2008 UnixLib Developers
++@ Copyright (c) 2002-2016 UnixLib Developers
+
+ #include "internal/asm_dec.s"
+
+@@ -20,15 +20,26 @@
+ PICEQ "LDR a2, [a2, #0]"
+ PICEQ "LDR a2, [a2, #__GOTT_INDEX__]" @ a2 = GOT ptr
+
+- LDR a1, .L0 @=__ul_global
++ LDR a1, .L0 @ =__ul_global
+ PICEQ "LDR a1, [a2, a1]"
++ LDR a4, [a1, #GBL_CPU_FLAGS]
+ ADD a1, a1, #GBL_PTH_WORKSEMAPHORE
++ TST a4, #__CPUCAP_HAVE_SWP
++ @ From this point onwards we will not be interrupted by the callback
++ BEQ 0f
++
+ MOV a3, #1
+ SWP a2, a3, [a1]
+- @ From this point onwards we will not be interrupted by the callback
+ ADD a2, a2, #1
+ STR a2, [a1]
+ MOV pc, lr
++0:
++ LDREX a2, [a1]
++ ADD a2, a2, #1
++ STREX a3, a2, [a1]
++ TEQ a3, #1
++ BEQ 0b
++ MOV pc, lr
+ .L0:
+ WORD __ul_global
+ DECLARE_FUNCTION __pthread_disable_ints
+@@ -78,18 +89,32 @@
+ PICEQ "LDR a1, [a1, #0]"
+ PICEQ "LDR a1, [a1, #__GOTT_INDEX__]" @ a1 = GOT ptr
+
+- LDR a4, .L2 @=__ul_global
++ LDR a4, .L2 @ =__ul_global
+ PICEQ "LDR a4, [a1, a4]"
++ LDR a2, [a4, #GBL_CPU_FLAGS]
+ ADD a1, a4, #GBL_PTH_WORKSEMAPHORE
++ TST a2, #__CPUCAP_HAVE_SWP
++ @ From this point onwards we cannot be interrupted by the callback
++ BEQ 0f
++
+ MOV a2, #1
+ SWP a3, a2, [a1]
+- @ From this point onwards we cannot be interrupted by the callback
+ CMP a3, #0
+- STRNE a3, [a1, #0] @ Restore original value
++ BEQ 1f
++ STR a3, [a1, #0] @ Restore original value
+ @ Return, as if ints are disabled on entry to the
+ @ calling function then they should not be reenabled
+ @ until the calling function has returned
++ MOV pc, lr
++0:
++ LDREX a3, [a1]
++ MOV ip, #1
++ STREX a2, ip, [a1]
++ TEQ a2, #1
++ BEQ 0b
++ TEQ a3, #0
+ MOVNE pc, lr
++1:
+
+ #if __UNIXLIB_PARANOID
+ LDR a3, [a4, #GBL_PTH_RETURN_ADDRESS]
+Index: gcc4/recipe/files/gcc/libunixlib/include/unixlib/local.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/unixlib/local.h (revision 7042)
++++ gcc4/recipe/files/gcc/libunixlib/include/unixlib/local.h (revision 7043)
+@@ -133,6 +133,16 @@
+ socket. Is -1 when socket handle is not valid. */
+ extern int __get_ro_socket (int __sockfd);
+
++/* Return 1 if the SWP instruction is available, otherwise 0. */
++extern unsigned int __cpucap_have_swp (void);
++
++/* Return 1 if the LDREX/STREX instructions are available, otherwise 0. */
++extern unsigned int __cpucap_have_rex (void);
++
++/* Return 1 if the LDREX/STREX instructions that operate on bytes, half-words
++ and double words are available, otherwise 0. */
++extern unsigned int __cpucap_have_rexbhd (void);
++
+ __END_DECLS
+
+ #endif
+ * incl-local/internal/asm_dec.s(XSOM_DeregisterClient): Add
+Index: gcc4/recipe/files/gcc/libunixlib/Makefile.am
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/Makefile.am (revision 7042)
++++ gcc4/recipe/files/gcc/libunixlib/Makefile.am (revision 7043)
+@@ -1027,6 +1027,7 @@
+ sys/sigsetjmp.c \
+ sys/stackalloc.c \
+ sys/vfork.c \
++ sys/_cpucaps.s \
+ sys/_getcpuarch.s \
+ sys/_jmp.s \
+ sys/_mman.s \
+Index: gcc4/recipe/files/gcc/libunixlib/incl-local/internal/asm_dec.s
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/incl-local/internal/asm_dec.s (revision 7042)
++++ gcc4/recipe/files/gcc/libunixlib/incl-local/internal/asm_dec.s (revision 7043)
+@@ -269,8 +269,10 @@
+ .set GBL_FLS_LBSTM_ON_RD, 108 @ = __ul_global.fls_lbstm_on_rd
+ .set GBL_PTH_CALLEVERY_RMA, 112 @ = __ul_global.pthread_callevery_rma
+
++.set GBL_CPU_FLAGS, 116 @ = __ul_global.cpu_flags
++
+ #if !defined(__SOFTFP__) && defined(__VFP_FP__)
+-.set GBL_VFP_REGCOUNT, 116 @ = __ul_global.vfp_regcount
++.set GBL_VFP_REGCOUNT, 120 @ = __ul_global.vfp_regcount
+ #endif
+
+ @ Entries in the __ul_memory table. Must be kept in sync with
+@@ -322,3 +324,7 @@
+ .set CRT1_LIB_FINI, 32 @ Ptr to function to finalise shared libraries
+ @ at program exit - can be NULL.
+ #endif
++
++#define __CPUCAP_HAVE_SWP 0x1
++#define __CPUCAP_HAVE_REX 0x2
++#define __CPUCAP_HAVE_REXBHD 0x4
+Index: gcc4/recipe/files/gcc/libunixlib/incl-local/internal/unix.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/incl-local/internal/unix.h (revision 7042)
++++ gcc4/recipe/files/gcc/libunixlib/incl-local/internal/unix.h (revision 7043)
+@@ -197,6 +197,8 @@
+ the life of the program. This block is passed to the call_every handler in
+ r12. */
+
++ unsigned int cpu_flags; /* Flags indicating the capabilities of the CPU. */
++
+ #if !defined(__SOFTFP__) && defined(__VFP_FP__)
+ int vfp_regcount; /* Number of doubleword registers we should request for
+ VFP contexts */
+Index: gcc4/recipe/files/gcc/libunixlib/sys/_cpucaps.s
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/sys/_cpucaps.s (revision 0)
++++ gcc4/recipe/files/gcc/libunixlib/sys/_cpucaps.s (revision 7043)
+@@ -0,0 +1,91 @@
++@ Determine the capabilities of the CPU and allow callers to enquire
++@ what they are.
++@ Copyright (c) 2016 UnixLib Developers.
++@ Written by Lee Noar.
++
++#include "internal/asm_dec.s"
++
++ .text
++
++@ Determine what the CPU capabilities are, and record them.
++@ Called early on during program initialisation in _syslib.s.
++ .global __probe_cpu_caps
++ NAME __probe_cpu_caps
++__probe_cpu_caps:
++ MOV r0, #0
++ SWI XOS_PlatformFeatures
++ MOVVS r0, #0
++
++ MOV r2, #0
++ @ The OS flag is set to 1 to indicate _no_ SWP instruction available (for
++ @ backwards compatibility). We reverse it here and set our flag to 1 to
++ @ indicate that SWP _is_ available.
++ TST r0, #1<<11 @ SWP{B} not available
++ ORREQ r2, r2, #__CPUCAP_HAVE_SWP
++ TST r0, #1<<12 @ LDREX/STREX available
++ ORRNE r2, r2, #__CPUCAP_HAVE_REX
++ TST r0, #1<<13 @ LDREX/STREX{B/H/D} available
++ ORRNE r2, r2, #__CPUCAP_HAVE_REXBHD
++
++ PICEQ "LDR r0, =__GOTT_BASE__"
++ PICEQ "LDR r0, [r0, #0]"
++ PICEQ "LDR r0, [r0, #__GOTT_INDEX__]" @ r0 = GOT ptr
++ LDR r1, .L0 @ =__ul_global
++ PICEQ "LDR r1, [r0, r1]"
++ STR r2, [r1, #GBL_CPU_FLAGS]
++
++ MOV pc, lr
++.L0:
++ WORD __ul_global
++ DECLARE_FUNCTION __probe_cpu_caps
++
++ .global __cpucap_have_swp
++ NAME __cpucap_have_swp
++__cpucap_have_swp:
++ PICEQ "LDR r0, =__GOTT_BASE__"
++ PICEQ "LDR r0, [r0, #0]"
++ PICEQ "LDR r0, [r0, #__GOTT_INDEX__]" @ r0 = GOT ptr
++ LDR r1, .L0 @ =__ul_global
++ PICEQ "LDR r1, [r0, r1]"
++ LDR r0, [r1, #GBL_CPU_FLAGS]
++ TST r0, #__CPUCAP_HAVE_SWP
++ MOVEQ r0, #0
++ MOVNE r0, #1
++
++ MOV pc, lr
++ DECLARE_FUNCTION __cpucap_have_swp
++
++@ Return 1 if LDREX/STREX instructions are available on the CPU, otherwise 0.
++ .global __cpucap_have_rex
++ NAME __cpucap_have_rex
++__cpucap_have_rex:
++ PICEQ "LDR r0, =__GOTT_BASE__"
++ PICEQ "LDR r0, [r0, #0]"
++ PICEQ "LDR r0, [r0, #__GOTT_INDEX__]" @ r0 = GOT ptr
++ LDR r1, .L0 @ =__ul_global
++ PICEQ "LDR r1, [r0, r1]"
++ LDR r0, [r1, #GBL_CPU_FLAGS]
++ TST r0, #__CPUCAP_HAVE_REX
++ MOVEQ r0, #0
++ MOVNE r0, #1
++
++ MOV pc, lr
++ DECLARE_FUNCTION __cpucap_have_rex
++
++@ Return 1 if LDREX/STREX instructions that work on non-32 bit data sizes
++@ are available on the CPU, otherwise 0.
++ .global __cpucap_have_rexbhd
++ NAME __cpucap_have_rexbhd
++__cpucap_have_rexbhd:
++ PICEQ "LDR r0, =__GOTT_BASE__"
++ PICEQ "LDR r0, [r0, #0]"
++ PICEQ "LDR r0, [r0, #__GOTT_INDEX__]" @ r0 = GOT ptr
++ LDR r1, .L0 @ =__ul_global
++ PICEQ "LDR r1, [r0, r1]"
++ LDR r0, [r1, #GBL_CPU_FLAGS]
++ TST r0, #__CPUCAP_HAVE_REXBHD
++ MOVEQ r0, #0
++ MOVNE r0, #1
++
++ MOV pc, lr
++ DECLARE_FUNCTION __cpucap_have_rexbhd
+Index: gcc4/recipe/files/gcc/libunixlib/sys/_syslib.s
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/sys/_syslib.s (revision 7042)
++++ gcc4/recipe/files/gcc/libunixlib/sys/_syslib.s (revision 7043)
+@@ -255,6 +255,8 @@
+ BCC __exit_with_error_num
+ unknown_cpu_arch:
+
++ BL __probe_cpu_caps
++
+ @ Use of DAs explicitly overridden if __dynamic_no_da is declared
+ MOV lr, #-1
+ STR lr, [ip, #GBL_DYNAMIC_NUM]
+@@ -1286,9 +1288,21 @@
+ @ error handling. As last resort to avoid an infinite loop
+ @ we go for a straight OS_Exit scenario. Anything better we
+ @ can do ?
++ ADD a3, a4, #GBL_PANIC_MODE
++ LDR a2, [a4, #GBL_CPU_FLAGS]
++ TST a2, #__CPUCAP_HAVE_SWP
++ BEQ 0f
++
+ MOV a2, #1
+- ADD a3, a4, #GBL_PANIC_MODE
+ SWP a2, a2, [a3]
++ B 1f
++0:
++ LDREX a2, [a3]
++ MOV ip, #1
++ STREX lr, ip, [a3]
++ TEQ lr, #1
++ BEQ 0b
++1:
+ TEQ a2, #0
+ BEQ __unixlib_fatal_cont1
+
-----------------------------------------------------------------------
Summary of changes:
.../recipes/patches/gcc4/unixlib-ldrex-strex.p | 304 ++++++++++++++++++++
1 file changed, 304 insertions(+)
create mode 100644 arm-unknown-riscos/recipes/patches/gcc4/unixlib-ldrex-strex.p
diff --git a/arm-unknown-riscos/recipes/patches/gcc4/unixlib-ldrex-strex.p b/arm-unknown-riscos/recipes/patches/gcc4/unixlib-ldrex-strex.p
new file mode 100644
index 0000000..045a0b8
--- /dev/null
+++ b/arm-unknown-riscos/recipes/patches/gcc4/unixlib-ldrex-strex.p
@@ -0,0 +1,304 @@
+Backport r7043 from upstream: partially replaces use of SWP with LDREX/STREX
+on systems where SWP is no longer available. This fix is incomplete,
+but sufficient for our purposes.
+
+Fri Mar 11 14:51:54 GMT 2016 Lee Noar <leenoar(a)sky.com>
+
+ * sys/_cpucaps.s: New file. Provide functions to probe the
+ OS for details of the CPU (currently SWP, LDREX/STREX
+ availability).
+ * Makefile.am: Add above file.
+ * include/unixlib/local.h: Add declarations for user facing
+ functions provided above.
+ * incl-local/internal/asm_dec.s(__ul_global): Add entry to
+ record CPU flags.
+ * incl-local/internal/unix.h: Likewise.
+ * pthread/_ints.s(__pthread_disable_ints,__pthread_protect_unsafe):
+ Use CPU flags to determine whether to use the SWP instruction or
+ LRDEX/STREX.
+ * sys/_syslib.s(__main): Add call to __probe_cpu_caps.
+ (__unixlib_fatal): Use CPU flags to determine whether to use the
+ SWP instruction or LRDEX/STREX.
+
+
+Index: gcc4/recipe/files/gcc/libunixlib/pthread/_ints.s
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/pthread/_ints.s (revision 7042)
++++ gcc4/recipe/files/gcc/libunixlib/pthread/_ints.s (revision 7043)
+@@ -2,7 +2,7 @@
+ @ disable_ints can be called multiple times, provided enable_ints is
+ @ subsequently called an equal number of times
+ @ Written by Martin Piper and Alex Waugh
+-@ Copyright (c) 2002-2008 UnixLib Developers
++@ Copyright (c) 2002-2016 UnixLib Developers
+
+ #include "internal/asm_dec.s"
+
+@@ -20,15 +20,26 @@
+ PICEQ "LDR a2, [a2, #0]"
+ PICEQ "LDR a2, [a2, #__GOTT_INDEX__]" @ a2 = GOT ptr
+
+- LDR a1, .L0 @=__ul_global
++ LDR a1, .L0 @ =__ul_global
+ PICEQ "LDR a1, [a2, a1]"
++ LDR a4, [a1, #GBL_CPU_FLAGS]
+ ADD a1, a1, #GBL_PTH_WORKSEMAPHORE
++ TST a4, #__CPUCAP_HAVE_SWP
++ @ From this point onwards we will not be interrupted by the callback
++ BEQ 0f
++
+ MOV a3, #1
+ SWP a2, a3, [a1]
+- @ From this point onwards we will not be interrupted by the callback
+ ADD a2, a2, #1
+ STR a2, [a1]
+ MOV pc, lr
++0:
++ LDREX a2, [a1]
++ ADD a2, a2, #1
++ STREX a3, a2, [a1]
++ TEQ a3, #1
++ BEQ 0b
++ MOV pc, lr
+ .L0:
+ WORD __ul_global
+ DECLARE_FUNCTION __pthread_disable_ints
+@@ -78,18 +89,32 @@
+ PICEQ "LDR a1, [a1, #0]"
+ PICEQ "LDR a1, [a1, #__GOTT_INDEX__]" @ a1 = GOT ptr
+
+- LDR a4, .L2 @=__ul_global
++ LDR a4, .L2 @ =__ul_global
+ PICEQ "LDR a4, [a1, a4]"
++ LDR a2, [a4, #GBL_CPU_FLAGS]
+ ADD a1, a4, #GBL_PTH_WORKSEMAPHORE
++ TST a2, #__CPUCAP_HAVE_SWP
++ @ From this point onwards we cannot be interrupted by the callback
++ BEQ 0f
++
+ MOV a2, #1
+ SWP a3, a2, [a1]
+- @ From this point onwards we cannot be interrupted by the callback
+ CMP a3, #0
+- STRNE a3, [a1, #0] @ Restore original value
++ BEQ 1f
++ STR a3, [a1, #0] @ Restore original value
+ @ Return, as if ints are disabled on entry to the
+ @ calling function then they should not be reenabled
+ @ until the calling function has returned
++ MOV pc, lr
++0:
++ LDREX a3, [a1]
++ MOV ip, #1
++ STREX a2, ip, [a1]
++ TEQ a2, #1
++ BEQ 0b
++ TEQ a3, #0
+ MOVNE pc, lr
++1:
+
+ #if __UNIXLIB_PARANOID
+ LDR a3, [a4, #GBL_PTH_RETURN_ADDRESS]
+Index: gcc4/recipe/files/gcc/libunixlib/include/unixlib/local.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/include/unixlib/local.h (revision 7042)
++++ gcc4/recipe/files/gcc/libunixlib/include/unixlib/local.h (revision 7043)
+@@ -133,6 +133,16 @@
+ socket. Is -1 when socket handle is not valid. */
+ extern int __get_ro_socket (int __sockfd);
+
++/* Return 1 if the SWP instruction is available, otherwise 0. */
++extern unsigned int __cpucap_have_swp (void);
++
++/* Return 1 if the LDREX/STREX instructions are available, otherwise 0. */
++extern unsigned int __cpucap_have_rex (void);
++
++/* Return 1 if the LDREX/STREX instructions that operate on bytes, half-words
++ and double words are available, otherwise 0. */
++extern unsigned int __cpucap_have_rexbhd (void);
++
+ __END_DECLS
+
+ #endif
+ * incl-local/internal/asm_dec.s(XSOM_DeregisterClient): Add
+Index: gcc4/recipe/files/gcc/libunixlib/Makefile.am
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/Makefile.am (revision 7042)
++++ gcc4/recipe/files/gcc/libunixlib/Makefile.am (revision 7043)
+@@ -1027,6 +1027,7 @@
+ sys/sigsetjmp.c \
+ sys/stackalloc.c \
+ sys/vfork.c \
++ sys/_cpucaps.s \
+ sys/_getcpuarch.s \
+ sys/_jmp.s \
+ sys/_mman.s \
+Index: gcc4/recipe/files/gcc/libunixlib/incl-local/internal/asm_dec.s
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/incl-local/internal/asm_dec.s (revision 7042)
++++ gcc4/recipe/files/gcc/libunixlib/incl-local/internal/asm_dec.s (revision 7043)
+@@ -269,8 +269,10 @@
+ .set GBL_FLS_LBSTM_ON_RD, 108 @ = __ul_global.fls_lbstm_on_rd
+ .set GBL_PTH_CALLEVERY_RMA, 112 @ = __ul_global.pthread_callevery_rma
+
++.set GBL_CPU_FLAGS, 116 @ = __ul_global.cpu_flags
++
+ #if !defined(__SOFTFP__) && defined(__VFP_FP__)
+-.set GBL_VFP_REGCOUNT, 116 @ = __ul_global.vfp_regcount
++.set GBL_VFP_REGCOUNT, 120 @ = __ul_global.vfp_regcount
+ #endif
+
+ @ Entries in the __ul_memory table. Must be kept in sync with
+@@ -322,3 +324,7 @@
+ .set CRT1_LIB_FINI, 32 @ Ptr to function to finalise shared libraries
+ @ at program exit - can be NULL.
+ #endif
++
++#define __CPUCAP_HAVE_SWP 0x1
++#define __CPUCAP_HAVE_REX 0x2
++#define __CPUCAP_HAVE_REXBHD 0x4
+Index: gcc4/recipe/files/gcc/libunixlib/incl-local/internal/unix.h
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/incl-local/internal/unix.h (revision 7042)
++++ gcc4/recipe/files/gcc/libunixlib/incl-local/internal/unix.h (revision 7043)
+@@ -197,6 +197,8 @@
+ the life of the program. This block is passed to the call_every handler in
+ r12. */
+
++ unsigned int cpu_flags; /* Flags indicating the capabilities of the CPU. */
++
+ #if !defined(__SOFTFP__) && defined(__VFP_FP__)
+ int vfp_regcount; /* Number of doubleword registers we should request for
+ VFP contexts */
+Index: gcc4/recipe/files/gcc/libunixlib/sys/_cpucaps.s
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/sys/_cpucaps.s (revision 0)
++++ gcc4/recipe/files/gcc/libunixlib/sys/_cpucaps.s (revision 7043)
+@@ -0,0 +1,91 @@
++@ Determine the capabilities of the CPU and allow callers to enquire
++@ what they are.
++@ Copyright (c) 2016 UnixLib Developers.
++@ Written by Lee Noar.
++
++#include "internal/asm_dec.s"
++
++ .text
++
++@ Determine what the CPU capabilities are, and record them.
++@ Called early on during program initialisation in _syslib.s.
++ .global __probe_cpu_caps
++ NAME __probe_cpu_caps
++__probe_cpu_caps:
++ MOV r0, #0
++ SWI XOS_PlatformFeatures
++ MOVVS r0, #0
++
++ MOV r2, #0
++ @ The OS flag is set to 1 to indicate _no_ SWP instruction available (for
++ @ backwards compatibility). We reverse it here and set our flag to 1 to
++ @ indicate that SWP _is_ available.
++ TST r0, #1<<11 @ SWP{B} not available
++ ORREQ r2, r2, #__CPUCAP_HAVE_SWP
++ TST r0, #1<<12 @ LDREX/STREX available
++ ORRNE r2, r2, #__CPUCAP_HAVE_REX
++ TST r0, #1<<13 @ LDREX/STREX{B/H/D} available
++ ORRNE r2, r2, #__CPUCAP_HAVE_REXBHD
++
++ PICEQ "LDR r0, =__GOTT_BASE__"
++ PICEQ "LDR r0, [r0, #0]"
++ PICEQ "LDR r0, [r0, #__GOTT_INDEX__]" @ r0 = GOT ptr
++ LDR r1, .L0 @ =__ul_global
++ PICEQ "LDR r1, [r0, r1]"
++ STR r2, [r1, #GBL_CPU_FLAGS]
++
++ MOV pc, lr
++.L0:
++ WORD __ul_global
++ DECLARE_FUNCTION __probe_cpu_caps
++
++ .global __cpucap_have_swp
++ NAME __cpucap_have_swp
++__cpucap_have_swp:
++ PICEQ "LDR r0, =__GOTT_BASE__"
++ PICEQ "LDR r0, [r0, #0]"
++ PICEQ "LDR r0, [r0, #__GOTT_INDEX__]" @ r0 = GOT ptr
++ LDR r1, .L0 @ =__ul_global
++ PICEQ "LDR r1, [r0, r1]"
++ LDR r0, [r1, #GBL_CPU_FLAGS]
++ TST r0, #__CPUCAP_HAVE_SWP
++ MOVEQ r0, #0
++ MOVNE r0, #1
++
++ MOV pc, lr
++ DECLARE_FUNCTION __cpucap_have_swp
++
++@ Return 1 if LDREX/STREX instructions are available on the CPU, otherwise 0.
++ .global __cpucap_have_rex
++ NAME __cpucap_have_rex
++__cpucap_have_rex:
++ PICEQ "LDR r0, =__GOTT_BASE__"
++ PICEQ "LDR r0, [r0, #0]"
++ PICEQ "LDR r0, [r0, #__GOTT_INDEX__]" @ r0 = GOT ptr
++ LDR r1, .L0 @ =__ul_global
++ PICEQ "LDR r1, [r0, r1]"
++ LDR r0, [r1, #GBL_CPU_FLAGS]
++ TST r0, #__CPUCAP_HAVE_REX
++ MOVEQ r0, #0
++ MOVNE r0, #1
++
++ MOV pc, lr
++ DECLARE_FUNCTION __cpucap_have_rex
++
++@ Return 1 if LDREX/STREX instructions that work on non-32 bit data sizes
++@ are available on the CPU, otherwise 0.
++ .global __cpucap_have_rexbhd
++ NAME __cpucap_have_rexbhd
++__cpucap_have_rexbhd:
++ PICEQ "LDR r0, =__GOTT_BASE__"
++ PICEQ "LDR r0, [r0, #0]"
++ PICEQ "LDR r0, [r0, #__GOTT_INDEX__]" @ r0 = GOT ptr
++ LDR r1, .L0 @ =__ul_global
++ PICEQ "LDR r1, [r0, r1]"
++ LDR r0, [r1, #GBL_CPU_FLAGS]
++ TST r0, #__CPUCAP_HAVE_REXBHD
++ MOVEQ r0, #0
++ MOVNE r0, #1
++
++ MOV pc, lr
++ DECLARE_FUNCTION __cpucap_have_rexbhd
+Index: gcc4/recipe/files/gcc/libunixlib/sys/_syslib.s
+===================================================================
+--- gcc4/recipe/files/gcc/libunixlib/sys/_syslib.s (revision 7042)
++++ gcc4/recipe/files/gcc/libunixlib/sys/_syslib.s (revision 7043)
+@@ -255,6 +255,8 @@
+ BCC __exit_with_error_num
+ unknown_cpu_arch:
+
++ BL __probe_cpu_caps
++
+ @ Use of DAs explicitly overridden if __dynamic_no_da is declared
+ MOV lr, #-1
+ STR lr, [ip, #GBL_DYNAMIC_NUM]
+@@ -1286,9 +1288,21 @@
+ @ error handling. As last resort to avoid an infinite loop
+ @ we go for a straight OS_Exit scenario. Anything better we
+ @ can do ?
++ ADD a3, a4, #GBL_PANIC_MODE
++ LDR a2, [a4, #GBL_CPU_FLAGS]
++ TST a2, #__CPUCAP_HAVE_SWP
++ BEQ 0f
++
+ MOV a2, #1
+- ADD a3, a4, #GBL_PANIC_MODE
+ SWP a2, a2, [a3]
++ B 1f
++0:
++ LDREX a2, [a3]
++ MOV ip, #1
++ STREX lr, ip, [a3]
++ TEQ lr, #1
++ BEQ 0b
++1:
+ TEQ a2, #0
+ BEQ __unixlib_fatal_cont1
+
--
Cross-compilation toolchains and environments
7 years, 6 months
netsurf: branch master updated. release/3.4-56-g281fe76
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/281fe7674c04cc9b5216a...
...commit http://git.netsurf-browser.org/netsurf.git/commit/281fe7674c04cc9b5216a40...
...tree http://git.netsurf-browser.org/netsurf.git/tree/281fe7674c04cc9b5216a405a...
The branch, master has been updated
via 281fe7674c04cc9b5216a405a104abb14c9d1778 (commit)
from 0368935cd31fd08b6383f3941c1f64ecb4c9ef90 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=281fe7674c04cc9b521...
commit 281fe7674c04cc9b5216a405a104abb14c9d1778
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Skip setting the pen in the RastPort if it is already set to that pen
This captures the scenario when the RGBA value has changed but graphics.library has picked the same pen.
diff --git a/amiga/plotters.c b/amiga/plotters.c
index 8d59f81..9c4f8b0 100644
--- a/amiga/plotters.c
+++ b/amiga/plotters.c
@@ -190,6 +190,8 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool for
gg->apen = 0x00000000;
gg->open = 0x00000000;
+ gg->apen_num = -1;
+ gg->open_num = -1;
init_layers_count++;
LOG("Layer initialised (total: %d)", init_layers_count);
@@ -275,6 +277,8 @@ void ami_plot_release_pens(struct MinList *shared_pens)
glob->apen = 0x00000000;
glob->open = 0x00000000;
+ glob->apen_num = -1;
+ glob->open_num = -1;
}
static void ami_plot_setapen(struct RastPort *rp, ULONG colr)
@@ -290,7 +294,7 @@ static void ami_plot_setapen(struct RastPort *rp, ULONG colr)
#endif
{
LONG pen = ami_plot_obtain_pen(glob->shared_pens, colr);
- if(pen != -1) SetAPen(rp, pen);
+ if((pen != -1) && (pen != glob->apen_num)) SetAPen(rp, pen);
}
glob->apen = colr;
@@ -309,7 +313,7 @@ static void ami_plot_setopen(struct RastPort *rp, ULONG colr)
#endif
{
LONG pen = ami_plot_obtain_pen(glob->shared_pens, colr);
- if(pen != -1) SetOPen(rp, pen);
+ if((pen != -1) && (pen != glob->open_num)) SetOPen(rp, pen);
}
glob->open = colr;
diff --git a/amiga/plotters.h b/amiga/plotters.h
index c674474..7baa21f 100644
--- a/amiga/plotters.h
+++ b/amiga/plotters.h
@@ -36,6 +36,8 @@ struct gui_globals
bool palette_mapped;
ULONG apen;
ULONG open;
+ LONG apen_num;
+ LONG open_num;
int width; /* size of bm and */
int height; /* associated memory */
};
-----------------------------------------------------------------------
Summary of changes:
amiga/plotters.c | 8 ++++++--
amiga/plotters.h | 2 ++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/amiga/plotters.c b/amiga/plotters.c
index 8d59f81..9c4f8b0 100644
--- a/amiga/plotters.c
+++ b/amiga/plotters.c
@@ -190,6 +190,8 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool for
gg->apen = 0x00000000;
gg->open = 0x00000000;
+ gg->apen_num = -1;
+ gg->open_num = -1;
init_layers_count++;
LOG("Layer initialised (total: %d)", init_layers_count);
@@ -275,6 +277,8 @@ void ami_plot_release_pens(struct MinList *shared_pens)
glob->apen = 0x00000000;
glob->open = 0x00000000;
+ glob->apen_num = -1;
+ glob->open_num = -1;
}
static void ami_plot_setapen(struct RastPort *rp, ULONG colr)
@@ -290,7 +294,7 @@ static void ami_plot_setapen(struct RastPort *rp, ULONG colr)
#endif
{
LONG pen = ami_plot_obtain_pen(glob->shared_pens, colr);
- if(pen != -1) SetAPen(rp, pen);
+ if((pen != -1) && (pen != glob->apen_num)) SetAPen(rp, pen);
}
glob->apen = colr;
@@ -309,7 +313,7 @@ static void ami_plot_setopen(struct RastPort *rp, ULONG colr)
#endif
{
LONG pen = ami_plot_obtain_pen(glob->shared_pens, colr);
- if(pen != -1) SetOPen(rp, pen);
+ if((pen != -1) && (pen != glob->open_num)) SetOPen(rp, pen);
}
glob->open = colr;
diff --git a/amiga/plotters.h b/amiga/plotters.h
index c674474..7baa21f 100644
--- a/amiga/plotters.h
+++ b/amiga/plotters.h
@@ -36,6 +36,8 @@ struct gui_globals
bool palette_mapped;
ULONG apen;
ULONG open;
+ LONG apen_num;
+ LONG open_num;
int width; /* size of bm and */
int height; /* associated memory */
};
--
NetSurf Browser
7 years, 6 months
libutf8proc: annotated tag release/1.3.1-2 created. release/1.3.1-2
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libutf8proc.git/shortlog/2f22454378152ff91...
...commit http://git.netsurf-browser.org/libutf8proc.git/commit/2f22454378152ff91d8...
...tree http://git.netsurf-browser.org/libutf8proc.git/tree/2f22454378152ff91d8bd...
The annotated tag, release/1.3.1-2 has been created
at 2f22454378152ff91d8bd94e3ad43b7e204e6ead (tag)
tagging 81ce69227bae528ac5f4ec78f3e78f511bf6cb69 (commit)
replaces release/1.3.1-1
tagged by Vincent Sanders
on Wed Mar 23 09:56:25 2016 +0000
- Log -----------------------------------------------------------------
Official Release
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQIVAwUAVvJoSXmwx6LL2TueAQIE3g//RJaMB6FjGjaLKP4AJlClgs0SsyIfKNdO
luDEZHIqziwBLRs2nn7VBt9k+5FM6emV+xv5kezOpdDL/P3jX+MA+i7vFdxn5P2u
L8uz4wNHk+ODVqizo/7sd8X7657XwGXp8x9z/lvOG7mcyRtK7Oc+SnO2DzflaXU/
gzcHKUfFT1K5XZS+G4+YFZnLdx5PZD2wKfmuKOS8BJhkgy9Jpbi6RmfVK7sxT8cH
UFH6423ICau2Zq2qmphT9UBUVr3HlgGE1jW+lLxdG73ivHPe81VUN5SArtFsAMkj
7j35zPjrDQabuj15VZ/zA2wJWoUXsjOLpoB50eLyyZD813sYE+Qo4pPsOv2kjkEY
1CH5GJqDrnFKcbM3wsJEXQ8pKyAYU/KSW2UgMrw68bSjWFxFJzeLz5cMwkIDTTi3
SeYAFR4gWKBF8E+mg3RNDnhtSRatXI/OZV9wLxaYcYOx5fTKiw3P3CJJ0rUvVkfM
U4+ICcsv7crEaLnpnEQjPmhTyZievzG8B+dQTShfCN8cTXd4t48SBZqpvxEJekBL
dJENWFCdbOgo/o5k/w4MGPP0GWdGSU7cB/UcHCnE6viU2bZkWoxxTmkoAHKG9B3P
qBg2ZXDfvFur+t96cU5JtK5XbtGjfVdfEiaq0uHUY+m+9dSLgxxYeFwdKMvBDeFl
1AKgGwvIZ9Y=
=pikC
-----END PGP SIGNATURE-----
Vincent Sanders (1):
Update component version for release
-----------------------------------------------------------------------
--
UTF8 Processing library (import)
7 years, 6 months
netsurf: branch master updated. release/3.4-55-g0368935
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/0368935cd31fd08b6383f...
...commit http://git.netsurf-browser.org/netsurf.git/commit/0368935cd31fd08b6383f39...
...tree http://git.netsurf-browser.org/netsurf.git/tree/0368935cd31fd08b6383f3941...
The branch, master has been updated
via 0368935cd31fd08b6383f3941c1f64ecb4c9ef90 (commit)
from 7a7d99e004a79f88b439a1eca0dca16308b04895 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=0368935cd31fd08b638...
commit 0368935cd31fd08b6383f3941c1f64ecb4c9ef90
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Avoid nsurl NULL access
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index a481cb4..3d5f47f 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -338,7 +338,7 @@ Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap)
}
SetDTAttrs(dto,NULL,NULL,
- DTA_ObjName,nsurl_access(bitmap->url),
+ DTA_ObjName, bitmap->url ? nsurl_access(bitmap->url) : "",
DTA_ObjAnnotation,bitmap->title,
DTA_ObjAuthor,messages_get("NetSurf"),
DTA_NominalHoriz,bitmap_get_width(bitmap),
-----------------------------------------------------------------------
Summary of changes:
amiga/bitmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index a481cb4..3d5f47f 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -338,7 +338,7 @@ Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap)
}
SetDTAttrs(dto,NULL,NULL,
- DTA_ObjName,nsurl_access(bitmap->url),
+ DTA_ObjName, bitmap->url ? nsurl_access(bitmap->url) : "",
DTA_ObjAnnotation,bitmap->title,
DTA_ObjAuthor,messages_get("NetSurf"),
DTA_NominalHoriz,bitmap_get_width(bitmap),
--
NetSurf Browser
7 years, 6 months
netsurf: branch chris/extmem created. release/3.4-55-g5d705f5
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/5d705f521dd09415de4fe...
...commit http://git.netsurf-browser.org/netsurf.git/commit/5d705f521dd09415de4fe29...
...tree http://git.netsurf-browser.org/netsurf.git/tree/5d705f521dd09415de4fe29d1...
The branch, chris/extmem has been created
at 5d705f521dd09415de4fe29d1695a6924971b8ce (commit)
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=5d705f521dd09415de4...
commit 5d705f521dd09415de4fe29d1695a6924971b8ce
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Allocate uncompressed bitmap data in extended memory.
This currently isn't working correctly - it simply freezes at some point after loading the page.
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index a481cb4..cbe1643 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -30,6 +30,7 @@
#include <proto/intuition.h>
#include <proto/utility.h>
#ifdef __amigaos4__
+#include <exec/extmem.h>
#include <sys/param.h>
#endif
#include "assert.h"
@@ -51,6 +52,8 @@ struct bitmap {
int width;
int height;
UBYTE *pixdata;
+ struct ExtMemIFace *iextmem;
+ uint32 size;
bool opaque;
int native;
struct BitMap *nativebm;
@@ -81,7 +84,25 @@ void *amiga_bitmap_create(int width, int height, unsigned int state)
bitmap = ami_misc_itempool_alloc(pool_bitmap, sizeof(struct bitmap));
if(bitmap == NULL) return NULL;
- bitmap->pixdata = ami_misc_allocvec_clear(width*height*4, 0xff);
+ bitmap->size = width * height * 4;
+
+#ifdef __amigaos4__
+ if(nsoption_bool(use_extmem) == true) {
+ uint64 size64 = bitmap->size;
+ bitmap->iextmem = AllocSysObjectTags(ASOT_EXTMEM,
+ ASOEXTMEM_Size, &size64,
+ ASOEXTMEM_AllocationPolicy, EXTMEMPOLICY_IMMEDIATE,
+ TAG_END);
+
+ bitmap->pixdata = NULL;
+ UBYTE *pixdata = amiga_bitmap_get_buffer(bitmap);
+ memset(pixdata, 0xff, bitmap->size);
+ } else
+#endif
+ {
+ bitmap->pixdata = ami_misc_allocvec_clear(bitmap->size, 0xff);
+ }
+
bitmap->width = width;
bitmap->height = height;
@@ -101,11 +122,27 @@ void *amiga_bitmap_create(int width, int height, unsigned int state)
return bitmap;
}
+static inline void amiga_bitmap_unmap_buffer(struct bitmap *bm)
+{
+#ifdef __amigaos4__
+ if((nsoption_bool(use_extmem) == true) && (bm->pixdata != NULL)) {
+ bm->iextmem->Unmap(bm->pixdata, bm->size);
+ bm->pixdata = NULL;
+ }
+#endif
+}
/* exported function documented in amiga/bitmap.h */
unsigned char *amiga_bitmap_get_buffer(void *bitmap)
{
struct bitmap *bm = bitmap;
+
+#ifdef __amigaos4__
+ if((nsoption_bool(use_extmem) == true) && (bm->pixdata == NULL)) {
+ bm->pixdata = bm->iextmem->Map(NULL, bm->size, 0LL, 0);
+ }
+#endif
+
return bm->pixdata;
}
@@ -142,7 +179,16 @@ void amiga_bitmap_destroy(void *bitmap)
}
if(bm->native_mask) FreeRaster(bm->native_mask, bm->width, bm->height);
- FreeVec(bm->pixdata);
+
+#ifdef __amigaos4__
+ if(nsoption_bool(use_extmem) == true) {
+ amiga_bitmap_unmap_buffer(bm);
+ FreeSysObject(ASOT_EXTMEM, bm->iextmem);
+ } else
+#endif
+ {
+ FreeVec(bm->pixdata);
+ }
if(bm->url) nsurl_unref(bm->url);
if(bm->title) free(bm->title);
@@ -190,6 +236,10 @@ void amiga_bitmap_modified(void *bitmap)
{
struct bitmap *bm = bitmap;
+#ifdef __amigaos4__
+ amiga_bitmap_unmap_buffer(bm);
+#endif
+
if((bm->nativebm) && (bm->native == AMI_NSBM_TRUECOLOUR))
ami_rtg_freebitmap(bm->nativebm);
@@ -351,6 +401,10 @@ Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap)
bitmap_get_width(bitmap), bitmap_get_height(bitmap));
}
+#ifdef __amigaos4__
+ amiga_bitmap_unmap_buffer(bitmap);
+#endif
+
return dto;
}
@@ -380,6 +434,10 @@ struct bitmap *ami_bitmap_from_datatype(char *filename)
DisposeDTObject(dto);
}
+#ifdef __amigaos4__
+ amiga_bitmap_unmap_buffer(bm);
+#endif
+
return bm;
}
@@ -489,6 +547,10 @@ static inline struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int
}
}
+#ifdef __amigaos4__
+ amiga_bitmap_unmap_buffer(bitmap);
+#endif
+
return tbm;
}
@@ -637,6 +699,10 @@ static nserror bitmap_render(struct bitmap *bitmap, hlcache_handle *content)
ami_free_layers(&bm_globals);
amiga_bitmap_set_opaque(bitmap, true);
+#ifdef __amigaos4__
+ amiga_bitmap_unmap_buffer(bitmap);
+#endif
+
/* Restore previous render area. This is set when plotting starts,
* but if bitmap_render is called *during* a browser render then
* having an invalid pointer here causes NetSurf to crash.
diff --git a/amiga/options.h b/amiga/options.h
index 0c4db5c..84e3f78 100644
--- a/amiga/options.h
+++ b/amiga/options.h
@@ -87,8 +87,11 @@ NSOPTION_INTEGER(redraw_tile_size_y, 0)
NSOPTION_INTEGER(monitor_aspect_x, 0)
NSOPTION_INTEGER(monitor_aspect_y, 0)
NSOPTION_BOOL(accept_lang_locale, true)
+#ifdef __amigaos4__
+/* Options relevant for OS4 only */
+NSOPTION_BOOL(use_extmem, true)
+#else
/* Options relevant for OS3 only */
-#ifndef __amigaos4__
NSOPTION_BOOL(friend_bitmap, false)
NSOPTION_STRING(local_charset, "ISO-8859-1")
#endif
-----------------------------------------------------------------------
--
NetSurf Browser
7 years, 6 months
netsurf: branch master updated. release/3.4-54-g7a7d99e
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/7a7d99e004a79f88b439a...
...commit http://git.netsurf-browser.org/netsurf.git/commit/7a7d99e004a79f88b439a1e...
...tree http://git.netsurf-browser.org/netsurf.git/tree/7a7d99e004a79f88b439a1eca...
The branch, master has been updated
via 7a7d99e004a79f88b439a1eca0dca16308b04895 (commit)
from 8a7d030af7a41589a2948d029658778b79c2a27b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=7a7d99e004a79f88b43...
commit 7a7d99e004a79f88b439a1eca0dca16308b04895
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Ensure we are only accessing pixel data using amiga_bitmap_get_buffer()
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index 0437102..a481cb4 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -217,7 +217,7 @@ bool amiga_bitmap_test_opaque(void *bitmap)
struct bitmap *bm = bitmap;
uint32 p = bm->width * bm->height;
uint32 a = 0;
- uint32 *bmi = (uint32 *) bm->pixdata;
+ uint32 *bmi = (uint32 *)amiga_bitmap_get_buffer(bm);
assert(bitmap);
@@ -302,7 +302,7 @@ static void ami_bitmap_argb_to_rgba(struct bitmap *bm)
void bitmap_dump(struct bitmap *bitmap)
{
int x,y;
- ULONG *bm = (ULONG *)bitmap->pixdata;
+ ULONG *bm = (ULONG *)amiga_bitmap_get_buffer(bitmap);
printf("Width=%ld, Height=%ld, Opaque=%s\nnativebm=%lx, width=%ld, height=%ld\n",
bitmap->width, bitmap->height, bitmap->opaque ? "true" : "false",
@@ -415,8 +415,9 @@ static inline struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int
{
if((tbm = ami_rtg_allocbitmap(bitmap->width, bitmap->height, 32, 0,
friendbm, AMI_BITMAP_FORMAT))) {
- ami_rtg_writepixelarray(bitmap->pixdata, tbm, bitmap->width, bitmap->height,
- bitmap->width * 4, AMI_BITMAP_FORMAT);
+ ami_rtg_writepixelarray(amiga_bitmap_get_buffer(bitmap),
+ tbm, bitmap->width, bitmap->height,
+ bitmap->width * 4, AMI_BITMAP_FORMAT);
}
if(nsoption_int(cache_bitmaps) == 2)
@@ -494,7 +495,7 @@ static inline struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int
PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width,
int height, struct BitMap *n_bm)
{
- uint32 *bmi = (uint32 *) bitmap->pixdata;
+ uint32 *bmi = (uint32 *) amiga_bitmap_get_buffer(bitmap);
UBYTE maskbit = 0;
ULONG bm_width;
int y, x, bpr;
@@ -621,7 +622,7 @@ static nserror bitmap_render(struct bitmap *bitmap, hlcache_handle *content)
BLITA_Height, bitmap->height,
BLITA_Source, bm_globals.bm,
BLITA_SrcType, BLITT_BITMAP,
- BLITA_Dest, bitmap->pixdata,
+ BLITA_Dest, amiga_bitmap_get_buffer(bitmap),
BLITA_DestType, BLITT_ARGB32,
BLITA_DestBytesPerRow, 4 * bitmap->width,
BLITA_DestX, 0,
-----------------------------------------------------------------------
Summary of changes:
amiga/bitmap.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index 0437102..a481cb4 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -217,7 +217,7 @@ bool amiga_bitmap_test_opaque(void *bitmap)
struct bitmap *bm = bitmap;
uint32 p = bm->width * bm->height;
uint32 a = 0;
- uint32 *bmi = (uint32 *) bm->pixdata;
+ uint32 *bmi = (uint32 *)amiga_bitmap_get_buffer(bm);
assert(bitmap);
@@ -302,7 +302,7 @@ static void ami_bitmap_argb_to_rgba(struct bitmap *bm)
void bitmap_dump(struct bitmap *bitmap)
{
int x,y;
- ULONG *bm = (ULONG *)bitmap->pixdata;
+ ULONG *bm = (ULONG *)amiga_bitmap_get_buffer(bitmap);
printf("Width=%ld, Height=%ld, Opaque=%s\nnativebm=%lx, width=%ld, height=%ld\n",
bitmap->width, bitmap->height, bitmap->opaque ? "true" : "false",
@@ -415,8 +415,9 @@ static inline struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int
{
if((tbm = ami_rtg_allocbitmap(bitmap->width, bitmap->height, 32, 0,
friendbm, AMI_BITMAP_FORMAT))) {
- ami_rtg_writepixelarray(bitmap->pixdata, tbm, bitmap->width, bitmap->height,
- bitmap->width * 4, AMI_BITMAP_FORMAT);
+ ami_rtg_writepixelarray(amiga_bitmap_get_buffer(bitmap),
+ tbm, bitmap->width, bitmap->height,
+ bitmap->width * 4, AMI_BITMAP_FORMAT);
}
if(nsoption_int(cache_bitmaps) == 2)
@@ -494,7 +495,7 @@ static inline struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int
PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width,
int height, struct BitMap *n_bm)
{
- uint32 *bmi = (uint32 *) bitmap->pixdata;
+ uint32 *bmi = (uint32 *) amiga_bitmap_get_buffer(bitmap);
UBYTE maskbit = 0;
ULONG bm_width;
int y, x, bpr;
@@ -621,7 +622,7 @@ static nserror bitmap_render(struct bitmap *bitmap, hlcache_handle *content)
BLITA_Height, bitmap->height,
BLITA_Source, bm_globals.bm,
BLITA_SrcType, BLITT_BITMAP,
- BLITA_Dest, bitmap->pixdata,
+ BLITA_Dest, amiga_bitmap_get_buffer(bitmap),
BLITA_DestType, BLITT_ARGB32,
BLITA_DestBytesPerRow, 4 * bitmap->width,
BLITA_DestX, 0,
--
NetSurf Browser
7 years, 6 months
netsurf: branch master updated. release/3.4-53-g8a7d030
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/8a7d030af7a41589a2948...
...commit http://git.netsurf-browser.org/netsurf.git/commit/8a7d030af7a41589a2948d0...
...tree http://git.netsurf-browser.org/netsurf.git/tree/8a7d030af7a41589a2948d029...
The branch, master has been updated
via 8a7d030af7a41589a2948d029658778b79c2a27b (commit)
via 215d1bec589de6085acf55e79bfc1295b26abf16 (commit)
via 4b2ac84233dc464567d1c0b1a500f7ce38a8b3cd (commit)
from bd663be92766de17e5dbef62ae98ca0cbb26cc7c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=8a7d030af7a41589a29...
commit 8a7d030af7a41589a2948d029658778b79c2a27b
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Ensure we don't access invalid pointers
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index cb30354..0437102 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -59,7 +59,7 @@ struct bitmap {
PLANEPTR native_mask;
Object *dto;
struct nsurl *url; /* temporary storage space */
- const char *title; /* temporary storage space */
+ char *title; /* temporary storage space */
ULONG *icondata; /* for appicons */
};
@@ -143,10 +143,16 @@ void amiga_bitmap_destroy(void *bitmap)
if(bm->native_mask) FreeRaster(bm->native_mask, bm->width, bm->height);
FreeVec(bm->pixdata);
+
+ if(bm->url) nsurl_unref(bm->url);
+ if(bm->title) free(bm->title);
+
bm->pixdata = NULL;
bm->nativebm = NULL;
bm->native_mask = NULL;
bm->dto = NULL;
+ bm->url = NULL;
+ bm->title = NULL;
ami_misc_itempool_free(pool_bitmap, bm, sizeof(struct bitmap));
bm = NULL;
@@ -644,12 +650,14 @@ static nserror bitmap_render(struct bitmap *bitmap, hlcache_handle *content)
void ami_bitmap_set_url(struct bitmap *bm, struct nsurl *url)
{
- bm->url = url;
+ if(bm->url != NULL) return;
+ bm->url = nsurl_ref(url);
}
void ami_bitmap_set_title(struct bitmap *bm, const char *title)
{
- bm->title = title;
+ if(bm->title != NULL) return;
+ bm->title = strdup(title);
}
ULONG *ami_bitmap_get_icondata(struct bitmap *bm)
diff --git a/amiga/bitmap.h b/amiga/bitmap.h
index a1893b3..743cd8f 100755
--- a/amiga/bitmap.h
+++ b/amiga/bitmap.h
@@ -46,7 +46,8 @@ struct bitmap *ami_bitmap_from_datatype(char *filename);
* \param bm a bitmap, as returned by bitmap_create()
* \param title a pointer to a title string
*
- * It is assumed that this is freed elsewhere after the bitmap is destroyed.
+ * A reference will be kept by the bitmap object.
+ * The URL can only ever be set once for a bitmap.
*/
void ami_bitmap_set_url(struct bitmap *bm, struct nsurl *url);
@@ -56,7 +57,8 @@ void ami_bitmap_set_url(struct bitmap *bm, struct nsurl *url);
* \param bm a bitmap, as returned by bitmap_create()
* \param title a pointer to a title string
*
- * It is assumed that this is freed elsewhere after the bitmap is destroyed.
+ * This is copied by the bitmap object.
+ * The title can only ever be set once for a bitmap.
*/
void ami_bitmap_set_title(struct bitmap *bm, const char *title);
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=215d1bec589de6085ac...
commit 215d1bec589de6085acf55e79bfc1295b26abf16
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Document new bitmap functions
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index ba72b11..cb30354 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -657,6 +657,11 @@ ULONG *ami_bitmap_get_icondata(struct bitmap *bm)
return bm->icondata;
}
+void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata)
+{
+ bm->icondata = icondata;
+}
+
bool ami_bitmap_has_dto(struct bitmap *bm)
{
if(bm->dto) return true;
diff --git a/amiga/bitmap.h b/amiga/bitmap.h
index cb7f968..a1893b3 100755
--- a/amiga/bitmap.h
+++ b/amiga/bitmap.h
@@ -40,14 +40,64 @@ PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width,
Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap);
struct bitmap *ami_bitmap_from_datatype(char *filename);
+/**
+ * Set bitmap URL
+ *
+ * \param bm a bitmap, as returned by bitmap_create()
+ * \param title a pointer to a title string
+ *
+ * It is assumed that this is freed elsewhere after the bitmap is destroyed.
+ */
void ami_bitmap_set_url(struct bitmap *bm, struct nsurl *url);
+
+/**
+ * Set bitmap title
+ *
+ * \param bm a bitmap, as returned by bitmap_create()
+ * \param title a pointer to a title string
+ *
+ * It is assumed that this is freed elsewhere after the bitmap is destroyed.
+ */
void ami_bitmap_set_title(struct bitmap *bm, const char *title);
+
+/**
+ * Get an icondata pointer
+ *
+ * \param bm a bitmap, as returned by bitmap_create()
+ * \return pointer to the icondata area
+ *
+ * This function probably shouldn't be here!
+ */
ULONG *ami_bitmap_get_icondata(struct bitmap *bm);
+
+/**
+ * Set an icondata pointer
+ *
+ * \param bm a bitmap, as returned by bitmap_create()
+ * \param icondata a pointer to memory
+ *
+ * This function probably shouldn't be here!
+ */
+void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata);
+
+/**
+ * Test if a bitmap has an associated DataTypes object.
+ *
+ * \param bm a bitmap, as returned by bitmap_create()
+ * \return true if the BitMap has a DataTypes object
+ *
+ * This function probably shouldn't be used!
+ */
bool ami_bitmap_has_dto(struct bitmap *bm);
-bool ami_bitmap_is_nativebm(struct bitmap *bm, struct BitMap *nbm);
-int bitmap_get_width(void *bitmap);
-int bitmap_get_height(void *bitmap);
+/**
+ * Test if a BitMap is owned by a bitmap.
+ *
+ * \param bm a bitmap, as returned by bitmap_create()
+ * \param nbm a BitMap, as created by AllocBitMap()
+ * \return true if the BitMap is owned by the bitmap
+ */
+bool ami_bitmap_is_nativebm(struct bitmap *bm, struct BitMap *nbm);
/**
* Cleanup bitmap allocations
@@ -84,6 +134,22 @@ unsigned char *amiga_bitmap_get_buffer(void *bitmap);
size_t amiga_bitmap_get_rowstride(void *bitmap);
/**
+ * Return the width of a bitmap.
+ *
+ * \param bitmap a bitmap, as returned by bitmap_create()
+ * \return width in pixels
+ */
+int bitmap_get_width(void *bitmap);
+
+/**
+ * Return the height of a bitmap.
+ *
+ * \param bitmap a bitmap, as returned by bitmap_create()
+ * \return height in pixels
+ */
+int bitmap_get_height(void *bitmap);
+
+/**
* Free a bitmap.
*
* \param bitmap a bitmap, as returned by bitmap_create()
diff --git a/amiga/icon.c b/amiga/icon.c
index 0ef3dbb..1370c3c 100644
--- a/amiga/icon.c
+++ b/amiga/icon.c
@@ -498,11 +498,10 @@ struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm)
#ifdef __amigaos4__
if(bm)
{
- icondata = ami_bitmap_get_icondata(bm);
-
bitmap = ami_bitmap_get_native(bm, THUMBNAIL_WIDTH,
THUMBNAIL_HEIGHT, NULL);
icondata = AllocVecTagList(THUMBNAIL_WIDTH * 4 * THUMBNAIL_HEIGHT, NULL);
+ ami_bitmap_set_icondata(bm, icondata);
BltBitMapTags(BLITA_Width, THUMBNAIL_WIDTH,
BLITA_Height, THUMBNAIL_HEIGHT,
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=4b2ac84233dc464567d...
commit 4b2ac84233dc464567d1c0b1a500f7ce38a8b3cd
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Make struct bitmap private to bitmap.c
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index bc85afb..ba72b11 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -35,6 +35,7 @@
#include "assert.h"
#include "utils/nsoption.h"
+#include "utils/nsurl.h"
#include "utils/messages.h"
#include "desktop/mouse.h"
#include "desktop/gui_window.h"
@@ -46,6 +47,22 @@
#include "amiga/misc.h"
#include "amiga/rtg.h"
+struct bitmap {
+ int width;
+ int height;
+ UBYTE *pixdata;
+ bool opaque;
+ int native;
+ struct BitMap *nativebm;
+ int nativebmwidth;
+ int nativebmheight;
+ PLANEPTR native_mask;
+ Object *dto;
+ struct nsurl *url; /* temporary storage space */
+ const char *title; /* temporary storage space */
+ ULONG *icondata; /* for appicons */
+};
+
enum {
AMI_NSBM_NONE = 0,
AMI_NSBM_TRUECOLOUR,
@@ -218,7 +235,7 @@ bool amiga_bitmap_get_opaque(void *bitmap)
/**
* get width of a bitmap.
*/
-static int bitmap_get_width(void *bitmap)
+int bitmap_get_width(void *bitmap)
{
struct bitmap *bm = bitmap;
@@ -235,7 +252,7 @@ static int bitmap_get_width(void *bitmap)
/**
* get height of a bitmap.
*/
-static int bitmap_get_height(void *bitmap)
+int bitmap_get_height(void *bitmap)
{
struct bitmap *bm = bitmap;
@@ -315,7 +332,7 @@ Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap)
}
SetDTAttrs(dto,NULL,NULL,
- DTA_ObjName,bitmap->url,
+ DTA_ObjName,nsurl_access(bitmap->url),
DTA_ObjAnnotation,bitmap->title,
DTA_ObjAuthor,messages_get("NetSurf"),
DTA_NominalHoriz,bitmap_get_width(bitmap),
@@ -625,6 +642,34 @@ static nserror bitmap_render(struct bitmap *bitmap, hlcache_handle *content)
return NSERROR_OK;
}
+void ami_bitmap_set_url(struct bitmap *bm, struct nsurl *url)
+{
+ bm->url = url;
+}
+
+void ami_bitmap_set_title(struct bitmap *bm, const char *title)
+{
+ bm->title = title;
+}
+
+ULONG *ami_bitmap_get_icondata(struct bitmap *bm)
+{
+ return bm->icondata;
+}
+
+bool ami_bitmap_has_dto(struct bitmap *bm)
+{
+ if(bm->dto) return true;
+ else return false;
+}
+
+bool ami_bitmap_is_nativebm(struct bitmap *bm, struct BitMap *nbm)
+{
+ if(bm->nativebm == nbm) return true;
+ else return false;
+}
+
+
static struct gui_bitmap_table bitmap_table = {
.create = amiga_bitmap_create,
.destroy = amiga_bitmap_destroy,
diff --git a/amiga/bitmap.h b/amiga/bitmap.h
index 78d6c0d..cb7f968 100755
--- a/amiga/bitmap.h
+++ b/amiga/bitmap.h
@@ -29,22 +29,8 @@
#define AMI_BITMAP_SCALE_ICON 0xFF
struct gui_bitmap_table *amiga_bitmap_table;
-
-struct bitmap {
- int width;
- int height;
- UBYTE *pixdata;
- bool opaque;
- int native;
- struct BitMap *nativebm;
- int nativebmwidth;
- int nativebmheight;
- PLANEPTR native_mask;
- Object *dto;
- char *url; /* temporary storage space */
- char *title; /* temporary storage space */
- ULONG *icondata; /* for appicons */
-};
+struct bitmap;
+struct nsurl;
struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
int width, int height, struct BitMap *friendbm);
@@ -54,6 +40,15 @@ PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width,
Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap);
struct bitmap *ami_bitmap_from_datatype(char *filename);
+void ami_bitmap_set_url(struct bitmap *bm, struct nsurl *url);
+void ami_bitmap_set_title(struct bitmap *bm, const char *title);
+ULONG *ami_bitmap_get_icondata(struct bitmap *bm);
+bool ami_bitmap_has_dto(struct bitmap *bm);
+bool ami_bitmap_is_nativebm(struct bitmap *bm, struct BitMap *nbm);
+
+int bitmap_get_width(void *bitmap);
+int bitmap_get_height(void *bitmap);
+
/**
* Cleanup bitmap allocations
*/
diff --git a/amiga/ctxmenu.c b/amiga/ctxmenu.c
index 8d49d4f..b49ba80 100644
--- a/amiga/ctxmenu.c
+++ b/amiga/ctxmenu.c
@@ -212,8 +212,8 @@ HOOKF(void, ami_ctxmenu_item_objcopy, APTR, window, struct IntuiMessage *)
struct hlcache_handle *object = (struct hlcache_handle *)hook->h_Data;
if((bm = content_get_bitmap(object)))
{
- bm->url = (char *)nsurl_access(hlcache_handle_get_url(object));
- bm->title = (char *)content_get_title(object);
+ ami_bitmap_set_url(bm, hlcache_handle_get_url(object));
+ ami_bitmap_set_title(bm, content_get_title(object));
ami_easy_clipboard_bitmap(bm);
}
#ifdef WITH_NS_SVG
diff --git a/amiga/file.c b/amiga/file.c
index 8e81b9c..d26b4be 100644
--- a/amiga/file.c
+++ b/amiga/file.c
@@ -182,8 +182,8 @@ void ami_file_save(int type, char *fname, struct Window *win,
case AMINS_SAVE_IFF:
if((bm = content_get_bitmap(object))) {
- bm->url = (char *)nsurl_access(hlcache_handle_get_url(object));
- bm->title = (char *)content_get_title(object);
+ ami_bitmap_set_url(bm, hlcache_handle_get_url(object));
+ ami_bitmap_set_title(bm, content_get_title(object));
amiga_bitmap_save(bm, fname, 0);
}
#ifdef WITH_NS_SVG
diff --git a/amiga/gui.c b/amiga/gui.c
index 2b8e38a..ec76735 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -1772,7 +1772,7 @@ static void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
if(ami_plot_screen_is_palettemapped() == false) {
tag = BLITA_UseSrcAlpha;
- tag_data = !icon_bitmap->opaque;
+ tag_data = !amiga_bitmap_get_opaque(icon_bitmap);
minterm = 0xc0;
} else {
tag = BLITA_MaskPlane;
diff --git a/amiga/icon.c b/amiga/icon.c
index f77f2eb..0ef3dbb 100644
--- a/amiga/icon.c
+++ b/amiga/icon.c
@@ -493,12 +493,16 @@ struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm)
{
struct DiskObject *dobj;
struct BitMap *bitmap;
+ ULONG *icondata;
+
#ifdef __amigaos4__
if(bm)
{
+ icondata = ami_bitmap_get_icondata(bm);
+
bitmap = ami_bitmap_get_native(bm, THUMBNAIL_WIDTH,
THUMBNAIL_HEIGHT, NULL);
- bm->icondata = AllocVecTagList(THUMBNAIL_WIDTH * 4 * THUMBNAIL_HEIGHT, NULL);
+ icondata = AllocVecTagList(THUMBNAIL_WIDTH * 4 * THUMBNAIL_HEIGHT, NULL);
BltBitMapTags(BLITA_Width, THUMBNAIL_WIDTH,
BLITA_Height, THUMBNAIL_HEIGHT,
@@ -506,7 +510,7 @@ struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm)
BLITA_Source, bitmap,
BLITA_DestType, BLITT_ARGB32,
BLITA_DestBytesPerRow, THUMBNAIL_WIDTH * 4,
- BLITA_Dest, bm->icondata,
+ BLITA_Dest, icondata,
TAG_DONE);
}
#endif
@@ -520,7 +524,7 @@ struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm)
ICONCTRLA_SetImageDataFormat, IDFMT_DIRECTMAPPED,
ICONCTRLA_SetWidth, THUMBNAIL_WIDTH,
ICONCTRLA_SetHeight, THUMBNAIL_HEIGHT,
- ICONCTRLA_SetImageData1, bm->icondata,
+ ICONCTRLA_SetImageData1, icondata,
ICONCTRLA_SetImageData2, NULL,
TAG_DONE);
}
@@ -537,5 +541,6 @@ void amiga_icon_free(struct DiskObject *dobj)
struct bitmap *bm = dobj->do_Gadget.UserData;
FreeDiskObject(dobj);
- if(bm) FreeVec(bm->icondata);
+ if(bm) FreeVec(ami_bitmap_get_icondata(bm));
}
+
diff --git a/amiga/menu.c b/amiga/menu.c
index 646039a..f851e44 100644
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -260,8 +260,8 @@ HOOKF(void, ami_menu_item_edit_copy, APTR, window, struct IntuiMessage *)
* the objects containing the values returned (and the
* constness cast away) is safe.
*/
- bm->url = (char *)nsurl_access(browser_window_get_url(gwin->gw->bw));
- bm->title = (char *)browser_window_get_title(gwin->gw->bw);
+ ami_bitmap_set_url(bm, browser_window_get_url(gwin->gw->bw));
+ ami_bitmap_set_title(bm, browser_window_get_title(gwin->gw->bw));
ami_easy_clipboard_bitmap(bm);
}
#ifdef WITH_NS_SVG
diff --git a/amiga/plotters.c b/amiga/plotters.c
index e929308..8d59f81 100644
--- a/amiga/plotters.c
+++ b/amiga/plotters.c
@@ -581,7 +581,7 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma
if(glob->palette_mapped == false) {
tag = BLITA_UseSrcAlpha;
- tag_data = !bitmap->opaque;
+ tag_data = !amiga_bitmap_get_opaque(bitmap);
minterm = 0xc0;
} else {
tag = BLITA_MaskPlane;
@@ -609,7 +609,8 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma
#endif
}
- if((bitmap->dto == NULL) && (tbm != bitmap->nativebm)) {
+ if((ami_bitmap_has_dto(bitmap) == false) && (ami_bitmap_is_nativebm(bitmap, tbm) == false)) {
+ /**\todo is this logic logical? */
ami_rtg_freebitmap(tbm);
}
@@ -637,7 +638,8 @@ static bool ami_bitmap_tile(int x, int y, int width, int height,
return ami_bitmap(x, y, width, height, bitmap);
/* If it is a one pixel transparent image, we are wasting our time */
- if((bitmap->opaque == false) && (bitmap->width == 1) && (bitmap->height == 1))
+ if((amiga_bitmap_get_opaque(bitmap) == false) &&
+ (bitmap_get_width(bitmap) == 1) && (bitmap_get_height(bitmap) == 1))
return true;
tbm = ami_bitmap_get_native(bitmap,width,height,glob->rp->BitMap);
@@ -679,7 +681,7 @@ static bool ami_bitmap_tile(int x, int y, int width, int height,
ym = y;
}
#ifdef __amigaos4__
- if(bitmap->opaque)
+ if(amiga_bitmap_get_opaque(bitmap))
{
bfh = CreateBackFillHook(BFHA_BitMap,tbm,
BFHA_Width,width,
@@ -708,12 +710,13 @@ static bool ami_bitmap_tile(int x, int y, int width, int height,
InstallLayerHook(glob->rp->Layer,LAYERS_NOBACKFILL);
#ifdef __amigaos4__
- if(bitmap->opaque) DeleteBackFillHook(bfh);
+ if(amiga_bitmap_get_opaque(bitmap)) DeleteBackFillHook(bfh);
else
#endif
FreeVec(bfh);
- if((bitmap->dto == NULL) && (tbm != bitmap->nativebm)) {
+ if((ami_bitmap_has_dto(bitmap) == false) && (ami_bitmap_is_nativebm(bitmap, tbm) == false)) {
+ /**\todo is this logic logical? */
ami_rtg_freebitmap(tbm);
}
diff --git a/amiga/theme.c b/amiga/theme.c
index 6a0d5da..97b6bab 100644
--- a/amiga/theme.c
+++ b/amiga/theme.c
@@ -167,10 +167,10 @@ void ami_theme_throbber_setup(void)
if(throbber_update_interval == 0) throbber_update_interval = 250;
bm = ami_bitmap_from_datatype(throbberfile);
- throbber = ami_bitmap_get_native(bm, bm->width, bm->height, NULL);
+ throbber = ami_bitmap_get_native(bm, bitmap_get_width(bm), bitmap_get_height(bm), NULL);
- throbber_width = bm->width / throbber_frames;
- throbber_height = bm->height;
+ throbber_width = bitmap_get_width(bm) / throbber_frames;
+ throbber_height = bitmap_get_height(bm);
throbber_nsbm = bm;
}
-----------------------------------------------------------------------
Summary of changes:
amiga/bitmap.c | 64 ++++++++++++++++++++++++++++++++++--
amiga/bitmap.h | 95 +++++++++++++++++++++++++++++++++++++++++++++---------
amiga/ctxmenu.c | 4 +--
amiga/file.c | 4 +--
amiga/gui.c | 2 +-
amiga/icon.c | 12 ++++---
amiga/menu.c | 4 +--
amiga/plotters.c | 15 +++++----
amiga/theme.c | 6 ++--
9 files changed, 167 insertions(+), 39 deletions(-)
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index bc85afb..0437102 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -35,6 +35,7 @@
#include "assert.h"
#include "utils/nsoption.h"
+#include "utils/nsurl.h"
#include "utils/messages.h"
#include "desktop/mouse.h"
#include "desktop/gui_window.h"
@@ -46,6 +47,22 @@
#include "amiga/misc.h"
#include "amiga/rtg.h"
+struct bitmap {
+ int width;
+ int height;
+ UBYTE *pixdata;
+ bool opaque;
+ int native;
+ struct BitMap *nativebm;
+ int nativebmwidth;
+ int nativebmheight;
+ PLANEPTR native_mask;
+ Object *dto;
+ struct nsurl *url; /* temporary storage space */
+ char *title; /* temporary storage space */
+ ULONG *icondata; /* for appicons */
+};
+
enum {
AMI_NSBM_NONE = 0,
AMI_NSBM_TRUECOLOUR,
@@ -126,10 +143,16 @@ void amiga_bitmap_destroy(void *bitmap)
if(bm->native_mask) FreeRaster(bm->native_mask, bm->width, bm->height);
FreeVec(bm->pixdata);
+
+ if(bm->url) nsurl_unref(bm->url);
+ if(bm->title) free(bm->title);
+
bm->pixdata = NULL;
bm->nativebm = NULL;
bm->native_mask = NULL;
bm->dto = NULL;
+ bm->url = NULL;
+ bm->title = NULL;
ami_misc_itempool_free(pool_bitmap, bm, sizeof(struct bitmap));
bm = NULL;
@@ -218,7 +241,7 @@ bool amiga_bitmap_get_opaque(void *bitmap)
/**
* get width of a bitmap.
*/
-static int bitmap_get_width(void *bitmap)
+int bitmap_get_width(void *bitmap)
{
struct bitmap *bm = bitmap;
@@ -235,7 +258,7 @@ static int bitmap_get_width(void *bitmap)
/**
* get height of a bitmap.
*/
-static int bitmap_get_height(void *bitmap)
+int bitmap_get_height(void *bitmap)
{
struct bitmap *bm = bitmap;
@@ -315,7 +338,7 @@ Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap)
}
SetDTAttrs(dto,NULL,NULL,
- DTA_ObjName,bitmap->url,
+ DTA_ObjName,nsurl_access(bitmap->url),
DTA_ObjAnnotation,bitmap->title,
DTA_ObjAuthor,messages_get("NetSurf"),
DTA_NominalHoriz,bitmap_get_width(bitmap),
@@ -625,6 +648,41 @@ static nserror bitmap_render(struct bitmap *bitmap, hlcache_handle *content)
return NSERROR_OK;
}
+void ami_bitmap_set_url(struct bitmap *bm, struct nsurl *url)
+{
+ if(bm->url != NULL) return;
+ bm->url = nsurl_ref(url);
+}
+
+void ami_bitmap_set_title(struct bitmap *bm, const char *title)
+{
+ if(bm->title != NULL) return;
+ bm->title = strdup(title);
+}
+
+ULONG *ami_bitmap_get_icondata(struct bitmap *bm)
+{
+ return bm->icondata;
+}
+
+void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata)
+{
+ bm->icondata = icondata;
+}
+
+bool ami_bitmap_has_dto(struct bitmap *bm)
+{
+ if(bm->dto) return true;
+ else return false;
+}
+
+bool ami_bitmap_is_nativebm(struct bitmap *bm, struct BitMap *nbm)
+{
+ if(bm->nativebm == nbm) return true;
+ else return false;
+}
+
+
static struct gui_bitmap_table bitmap_table = {
.create = amiga_bitmap_create,
.destroy = amiga_bitmap_destroy,
diff --git a/amiga/bitmap.h b/amiga/bitmap.h
index 78d6c0d..743cd8f 100755
--- a/amiga/bitmap.h
+++ b/amiga/bitmap.h
@@ -29,22 +29,8 @@
#define AMI_BITMAP_SCALE_ICON 0xFF
struct gui_bitmap_table *amiga_bitmap_table;
-
-struct bitmap {
- int width;
- int height;
- UBYTE *pixdata;
- bool opaque;
- int native;
- struct BitMap *nativebm;
- int nativebmwidth;
- int nativebmheight;
- PLANEPTR native_mask;
- Object *dto;
- char *url; /* temporary storage space */
- char *title; /* temporary storage space */
- ULONG *icondata; /* for appicons */
-};
+struct bitmap;
+struct nsurl;
struct BitMap *ami_bitmap_get_native(struct bitmap *bitmap,
int width, int height, struct BitMap *friendbm);
@@ -55,6 +41,67 @@ Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap);
struct bitmap *ami_bitmap_from_datatype(char *filename);
/**
+ * Set bitmap URL
+ *
+ * \param bm a bitmap, as returned by bitmap_create()
+ * \param title a pointer to a title string
+ *
+ * A reference will be kept by the bitmap object.
+ * The URL can only ever be set once for a bitmap.
+ */
+void ami_bitmap_set_url(struct bitmap *bm, struct nsurl *url);
+
+/**
+ * Set bitmap title
+ *
+ * \param bm a bitmap, as returned by bitmap_create()
+ * \param title a pointer to a title string
+ *
+ * This is copied by the bitmap object.
+ * The title can only ever be set once for a bitmap.
+ */
+void ami_bitmap_set_title(struct bitmap *bm, const char *title);
+
+/**
+ * Get an icondata pointer
+ *
+ * \param bm a bitmap, as returned by bitmap_create()
+ * \return pointer to the icondata area
+ *
+ * This function probably shouldn't be here!
+ */
+ULONG *ami_bitmap_get_icondata(struct bitmap *bm);
+
+/**
+ * Set an icondata pointer
+ *
+ * \param bm a bitmap, as returned by bitmap_create()
+ * \param icondata a pointer to memory
+ *
+ * This function probably shouldn't be here!
+ */
+void ami_bitmap_set_icondata(struct bitmap *bm, ULONG *icondata);
+
+/**
+ * Test if a bitmap has an associated DataTypes object.
+ *
+ * \param bm a bitmap, as returned by bitmap_create()
+ * \return true if the BitMap has a DataTypes object
+ *
+ * This function probably shouldn't be used!
+ */
+bool ami_bitmap_has_dto(struct bitmap *bm);
+
+/**
+ * Test if a BitMap is owned by a bitmap.
+ *
+ * \param bm a bitmap, as returned by bitmap_create()
+ * \param nbm a BitMap, as created by AllocBitMap()
+ * \return true if the BitMap is owned by the bitmap
+ */
+bool ami_bitmap_is_nativebm(struct bitmap *bm, struct BitMap *nbm);
+
+/**
* Cleanup bitmap allocations
*/
void ami_bitmap_fini(void);
@@ -89,6 +136,22 @@ unsigned char *amiga_bitmap_get_buffer(void *bitmap);
size_t amiga_bitmap_get_rowstride(void *bitmap);
/**
+ * Return the width of a bitmap.
+ *
+ * \param bitmap a bitmap, as returned by bitmap_create()
+ * \return width in pixels
+ */
+int bitmap_get_width(void *bitmap);
+
+/**
+ * Return the height of a bitmap.
+ *
+ * \param bitmap a bitmap, as returned by bitmap_create()
+ * \return height in pixels
+ */
+int bitmap_get_height(void *bitmap);
+
+/**
* Free a bitmap.
*
* \param bitmap a bitmap, as returned by bitmap_create()
diff --git a/amiga/ctxmenu.c b/amiga/ctxmenu.c
index 8d49d4f..b49ba80 100644
--- a/amiga/ctxmenu.c
+++ b/amiga/ctxmenu.c
@@ -212,8 +212,8 @@ HOOKF(void, ami_ctxmenu_item_objcopy, APTR, window, struct IntuiMessage *)
struct hlcache_handle *object = (struct hlcache_handle *)hook->h_Data;
if((bm = content_get_bitmap(object)))
{
- bm->url = (char *)nsurl_access(hlcache_handle_get_url(object));
- bm->title = (char *)content_get_title(object);
+ ami_bitmap_set_url(bm, hlcache_handle_get_url(object));
+ ami_bitmap_set_title(bm, content_get_title(object));
ami_easy_clipboard_bitmap(bm);
}
#ifdef WITH_NS_SVG
diff --git a/amiga/file.c b/amiga/file.c
index 8e81b9c..d26b4be 100644
--- a/amiga/file.c
+++ b/amiga/file.c
@@ -182,8 +182,8 @@ void ami_file_save(int type, char *fname, struct Window *win,
case AMINS_SAVE_IFF:
if((bm = content_get_bitmap(object))) {
- bm->url = (char *)nsurl_access(hlcache_handle_get_url(object));
- bm->title = (char *)content_get_title(object);
+ ami_bitmap_set_url(bm, hlcache_handle_get_url(object));
+ ami_bitmap_set_title(bm, content_get_title(object));
amiga_bitmap_save(bm, fname, 0);
}
#ifdef WITH_NS_SVG
diff --git a/amiga/gui.c b/amiga/gui.c
index 2b8e38a..ec76735 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -1772,7 +1772,7 @@ static void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
if(ami_plot_screen_is_palettemapped() == false) {
tag = BLITA_UseSrcAlpha;
- tag_data = !icon_bitmap->opaque;
+ tag_data = !amiga_bitmap_get_opaque(icon_bitmap);
minterm = 0xc0;
} else {
tag = BLITA_MaskPlane;
diff --git a/amiga/icon.c b/amiga/icon.c
index f77f2eb..1370c3c 100644
--- a/amiga/icon.c
+++ b/amiga/icon.c
@@ -493,12 +493,15 @@ struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm)
{
struct DiskObject *dobj;
struct BitMap *bitmap;
+ ULONG *icondata;
+
#ifdef __amigaos4__
if(bm)
{
bitmap = ami_bitmap_get_native(bm, THUMBNAIL_WIDTH,
THUMBNAIL_HEIGHT, NULL);
- bm->icondata = AllocVecTagList(THUMBNAIL_WIDTH * 4 * THUMBNAIL_HEIGHT, NULL);
+ icondata = AllocVecTagList(THUMBNAIL_WIDTH * 4 * THUMBNAIL_HEIGHT, NULL);
+ ami_bitmap_set_icondata(bm, icondata);
BltBitMapTags(BLITA_Width, THUMBNAIL_WIDTH,
BLITA_Height, THUMBNAIL_HEIGHT,
@@ -506,7 +509,7 @@ struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm)
BLITA_Source, bitmap,
BLITA_DestType, BLITT_ARGB32,
BLITA_DestBytesPerRow, THUMBNAIL_WIDTH * 4,
- BLITA_Dest, bm->icondata,
+ BLITA_Dest, icondata,
TAG_DONE);
}
#endif
@@ -520,7 +523,7 @@ struct DiskObject *amiga_icon_from_bitmap(struct bitmap *bm)
ICONCTRLA_SetImageDataFormat, IDFMT_DIRECTMAPPED,
ICONCTRLA_SetWidth, THUMBNAIL_WIDTH,
ICONCTRLA_SetHeight, THUMBNAIL_HEIGHT,
- ICONCTRLA_SetImageData1, bm->icondata,
+ ICONCTRLA_SetImageData1, icondata,
ICONCTRLA_SetImageData2, NULL,
TAG_DONE);
}
@@ -537,5 +540,6 @@ void amiga_icon_free(struct DiskObject *dobj)
struct bitmap *bm = dobj->do_Gadget.UserData;
FreeDiskObject(dobj);
- if(bm) FreeVec(bm->icondata);
+ if(bm) FreeVec(ami_bitmap_get_icondata(bm));
}
+
diff --git a/amiga/menu.c b/amiga/menu.c
index 646039a..f851e44 100644
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -260,8 +260,8 @@ HOOKF(void, ami_menu_item_edit_copy, APTR, window, struct IntuiMessage *)
* the objects containing the values returned (and the
* constness cast away) is safe.
*/
- bm->url = (char *)nsurl_access(browser_window_get_url(gwin->gw->bw));
- bm->title = (char *)browser_window_get_title(gwin->gw->bw);
+ ami_bitmap_set_url(bm, browser_window_get_url(gwin->gw->bw));
+ ami_bitmap_set_title(bm, browser_window_get_title(gwin->gw->bw));
ami_easy_clipboard_bitmap(bm);
}
#ifdef WITH_NS_SVG
diff --git a/amiga/plotters.c b/amiga/plotters.c
index e929308..8d59f81 100644
--- a/amiga/plotters.c
+++ b/amiga/plotters.c
@@ -581,7 +581,7 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma
if(glob->palette_mapped == false) {
tag = BLITA_UseSrcAlpha;
- tag_data = !bitmap->opaque;
+ tag_data = !amiga_bitmap_get_opaque(bitmap);
minterm = 0xc0;
} else {
tag = BLITA_MaskPlane;
@@ -609,7 +609,8 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma
#endif
}
- if((bitmap->dto == NULL) && (tbm != bitmap->nativebm)) {
+ if((ami_bitmap_has_dto(bitmap) == false) && (ami_bitmap_is_nativebm(bitmap, tbm) == false)) {
+ /**\todo is this logic logical? */
ami_rtg_freebitmap(tbm);
}
@@ -637,7 +638,8 @@ static bool ami_bitmap_tile(int x, int y, int width, int height,
return ami_bitmap(x, y, width, height, bitmap);
/* If it is a one pixel transparent image, we are wasting our time */
- if((bitmap->opaque == false) && (bitmap->width == 1) && (bitmap->height == 1))
+ if((amiga_bitmap_get_opaque(bitmap) == false) &&
+ (bitmap_get_width(bitmap) == 1) && (bitmap_get_height(bitmap) == 1))
return true;
tbm = ami_bitmap_get_native(bitmap,width,height,glob->rp->BitMap);
@@ -679,7 +681,7 @@ static bool ami_bitmap_tile(int x, int y, int width, int height,
ym = y;
}
#ifdef __amigaos4__
- if(bitmap->opaque)
+ if(amiga_bitmap_get_opaque(bitmap))
{
bfh = CreateBackFillHook(BFHA_BitMap,tbm,
BFHA_Width,width,
@@ -708,12 +710,13 @@ static bool ami_bitmap_tile(int x, int y, int width, int height,
InstallLayerHook(glob->rp->Layer,LAYERS_NOBACKFILL);
#ifdef __amigaos4__
- if(bitmap->opaque) DeleteBackFillHook(bfh);
+ if(amiga_bitmap_get_opaque(bitmap)) DeleteBackFillHook(bfh);
else
#endif
FreeVec(bfh);
- if((bitmap->dto == NULL) && (tbm != bitmap->nativebm)) {
+ if((ami_bitmap_has_dto(bitmap) == false) && (ami_bitmap_is_nativebm(bitmap, tbm) == false)) {
+ /**\todo is this logic logical? */
ami_rtg_freebitmap(tbm);
}
diff --git a/amiga/theme.c b/amiga/theme.c
index 6a0d5da..97b6bab 100644
--- a/amiga/theme.c
+++ b/amiga/theme.c
@@ -167,10 +167,10 @@ void ami_theme_throbber_setup(void)
if(throbber_update_interval == 0) throbber_update_interval = 250;
bm = ami_bitmap_from_datatype(throbberfile);
- throbber = ami_bitmap_get_native(bm, bm->width, bm->height, NULL);
+ throbber = ami_bitmap_get_native(bm, bitmap_get_width(bm), bitmap_get_height(bm), NULL);
- throbber_width = bm->width / throbber_frames;
- throbber_height = bm->height;
+ throbber_width = bitmap_get_width(bm) / throbber_frames;
+ throbber_height = bitmap_get_height(bm);
throbber_nsbm = bm;
}
--
NetSurf Browser
7 years, 6 months
netsurf: branch master updated. release/3.4-50-gbd663be
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/bd663be92766de17e5dbe...
...commit http://git.netsurf-browser.org/netsurf.git/commit/bd663be92766de17e5dbef6...
...tree http://git.netsurf-browser.org/netsurf.git/tree/bd663be92766de17e5dbef62a...
The branch, master has been updated
via bd663be92766de17e5dbef62ae98ca0cbb26cc7c (commit)
from 9faef114ec589182d941c1b563887c4950e22730 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=bd663be92766de17e5d...
commit bd663be92766de17e5dbef62ae98ca0cbb26cc7c
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Apparently setting pens is a strangely complex process, so avoid it.
diff --git a/amiga/plotters.c b/amiga/plotters.c
index 0a0057c..e929308 100644
--- a/amiga/plotters.c
+++ b/amiga/plotters.c
@@ -188,6 +188,9 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool for
pool_pens = ami_misc_itempool_create(sizeof(struct ami_plot_pen));
}
+ gg->apen = 0x00000000;
+ gg->open = 0x00000000;
+
init_layers_count++;
LOG("Layer initialised (total: %d)", init_layers_count);
}
@@ -269,10 +272,15 @@ void ami_plot_release_pens(struct MinList *shared_pens)
Remove((struct Node *)node);
ami_misc_itempool_free(pool_pens, node, sizeof(struct ami_plot_pen));
} while((node = nnode));
+
+ glob->apen = 0x00000000;
+ glob->open = 0x00000000;
}
static void ami_plot_setapen(struct RastPort *rp, ULONG colr)
{
+ if(glob->apen == colr) return;
+
#ifdef __amigaos4__
if(glob->palette_mapped == false) {
SetRPAttrs(rp, RPTAG_APenColor,
@@ -284,10 +292,14 @@ static void ami_plot_setapen(struct RastPort *rp, ULONG colr)
LONG pen = ami_plot_obtain_pen(glob->shared_pens, colr);
if(pen != -1) SetAPen(rp, pen);
}
+
+ glob->apen = colr;
}
static void ami_plot_setopen(struct RastPort *rp, ULONG colr)
{
+ if(glob->open == colr) return;
+
#ifdef __amigaos4__
if(glob->palette_mapped == false) {
SetRPAttrs(rp, RPTAG_OPenColor,
@@ -299,6 +311,8 @@ static void ami_plot_setopen(struct RastPort *rp, ULONG colr)
LONG pen = ami_plot_obtain_pen(glob->shared_pens, colr);
if(pen != -1) SetOPen(rp, pen);
}
+
+ glob->open = colr;
}
void ami_plot_clear_bbox(struct RastPort *rp, struct IBox *bbox)
diff --git a/amiga/plotters.h b/amiga/plotters.h
index 841700e..c674474 100644
--- a/amiga/plotters.h
+++ b/amiga/plotters.h
@@ -34,6 +34,8 @@ struct gui_globals
struct Rectangle rect;
struct MinList *shared_pens;
bool palette_mapped;
+ ULONG apen;
+ ULONG open;
int width; /* size of bm and */
int height; /* associated memory */
};
-----------------------------------------------------------------------
Summary of changes:
amiga/plotters.c | 14 ++++++++++++++
amiga/plotters.h | 2 ++
2 files changed, 16 insertions(+)
diff --git a/amiga/plotters.c b/amiga/plotters.c
index 0a0057c..e929308 100644
--- a/amiga/plotters.c
+++ b/amiga/plotters.c
@@ -188,6 +188,9 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height, bool for
pool_pens = ami_misc_itempool_create(sizeof(struct ami_plot_pen));
}
+ gg->apen = 0x00000000;
+ gg->open = 0x00000000;
+
init_layers_count++;
LOG("Layer initialised (total: %d)", init_layers_count);
}
@@ -269,10 +272,15 @@ void ami_plot_release_pens(struct MinList *shared_pens)
Remove((struct Node *)node);
ami_misc_itempool_free(pool_pens, node, sizeof(struct ami_plot_pen));
} while((node = nnode));
+
+ glob->apen = 0x00000000;
+ glob->open = 0x00000000;
}
static void ami_plot_setapen(struct RastPort *rp, ULONG colr)
{
+ if(glob->apen == colr) return;
+
#ifdef __amigaos4__
if(glob->palette_mapped == false) {
SetRPAttrs(rp, RPTAG_APenColor,
@@ -284,10 +292,14 @@ static void ami_plot_setapen(struct RastPort *rp, ULONG colr)
LONG pen = ami_plot_obtain_pen(glob->shared_pens, colr);
if(pen != -1) SetAPen(rp, pen);
}
+
+ glob->apen = colr;
}
static void ami_plot_setopen(struct RastPort *rp, ULONG colr)
{
+ if(glob->open == colr) return;
+
#ifdef __amigaos4__
if(glob->palette_mapped == false) {
SetRPAttrs(rp, RPTAG_OPenColor,
@@ -299,6 +311,8 @@ static void ami_plot_setopen(struct RastPort *rp, ULONG colr)
LONG pen = ami_plot_obtain_pen(glob->shared_pens, colr);
if(pen != -1) SetOPen(rp, pen);
}
+
+ glob->open = colr;
}
void ami_plot_clear_bbox(struct RastPort *rp, struct IBox *bbox)
diff --git a/amiga/plotters.h b/amiga/plotters.h
index 841700e..c674474 100644
--- a/amiga/plotters.h
+++ b/amiga/plotters.h
@@ -34,6 +34,8 @@ struct gui_globals
struct Rectangle rect;
struct MinList *shared_pens;
bool palette_mapped;
+ ULONG apen;
+ ULONG open;
int width; /* size of bm and */
int height; /* associated memory */
};
--
NetSurf Browser
7 years, 6 months
netsurf: branch master updated. release/3.4-49-g9faef11
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/9faef114ec589182d941c...
...commit http://git.netsurf-browser.org/netsurf.git/commit/9faef114ec589182d941c1b...
...tree http://git.netsurf-browser.org/netsurf.git/tree/9faef114ec589182d941c1b56...
The branch, master has been updated
via 9faef114ec589182d941c1b563887c4950e22730 (commit)
via afc1d2c3c7631ea50cf94791e9cb20b8ea1f2051 (commit)
from 719dc37b22bd36f45a30516e17f21ce46305db84 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=9faef114ec589182d94...
commit 9faef114ec589182d941c1b563887c4950e22730
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
Update font interface documentation to include parameter direction
diff --git a/desktop/browser.c b/desktop/browser.c
index 938ef51..04e8efb 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -1301,7 +1301,7 @@ static void browser_window_convert_to_download(struct browser_window *bw,
/**
- * Callback handler for content event messages.
+ * Browser window content event callback handler.
*/
static nserror browser_window_callback(hlcache_handle *c,
const hlcache_event *event, void *pw)
diff --git a/desktop/font.h b/desktop/font.h
index 4ebd75d..c883f8a 100644
--- a/desktop/font.h
+++ b/desktop/font.h
@@ -42,11 +42,11 @@ struct font_functions
/**
* Measure the width of a string.
*
- * \param fstyle plot style for this text
- * \param string UTF-8 string to measure
- * \param length length of string, in bytes
- * \param width updated to width of string[0..length)
- * \return true on success, false on error and error reported
+ * \param[in] fstyle plot style for this text
+ * \param[in] string UTF-8 string to measure
+ * \param[in] length length of string, in bytes
+ * \param[out] width updated to width of string[0..length)
+ * \return true on success and width updated else false.
*/
bool (*font_width)(const plot_font_style_t *fstyle,
const char *string, size_t length,
@@ -54,12 +54,12 @@ struct font_functions
/**
* Find the position in a string where an x coordinate falls.
*
- * \param fstyle style for this text
- * \param string UTF-8 string to measure
- * \param length length of string, in bytes
- * \param x x coordinate to search for
- * \param char_offset updated to offset in string of actual_x, [0..length]
- * \param actual_x updated to x coordinate of character closest to x
+ * \param[in] fstyle style for this text
+ * \param[in] string UTF-8 string to measure
+ * \param[in] length length of string, in bytes
+ * \param[in] x coordinate to search for
+ * \param[out] char_offset updated to offset in string of actual_x, [0..length]
+ * \param[out] actual_x updated to x coordinate of character closest to x
* \return true on success, false on error and error reported
*/
bool (*font_position_in_string)(const plot_font_style_t *fstyle,
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=afc1d2c3c7631ea50cf...
commit afc1d2c3c7631ea50cf94791e9cb20b8ea1f2051
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
fix broken windows frontend font handling
diff --git a/windows/font.c b/windows/font.c
index 427bcb1..9358d1a 100644
--- a/windows/font.c
+++ b/windows/font.c
@@ -38,14 +38,14 @@
HWND font_hwnd;
nserror utf8_to_font_encoding(const struct font_desc* font,
- const char *string,
+ const char *string,
size_t len,
char **result)
{
return utf8_to_enc(string, font->encoding, len, result);
}
-static nserror utf8_to_local_encoding(const char *string,
+static nserror utf8_to_local_encoding(const char *string,
size_t len,
char **result)
{
@@ -131,31 +131,48 @@ HFONT get_font(const plot_font_style_t *style)
return font;
}
-static bool nsfont_width(const plot_font_style_t *style,
- const char *string, size_t length,
- int *width)
+/**
+ * Measure the width of a string.
+ *
+ * \param[in] style plot style for this text
+ * \param[in] string UTF-8 string to measure
+ * \param[in] length length of string, in bytes
+ * \param[out] width updated to width of string[0..length)
+ * \return true on success and width updated else false
+ */
+static bool
+nsfont_width(const plot_font_style_t *style,
+ const char *string,
+ size_t length,
+ int *width)
{
- HDC hdc = GetDC(NULL);
- HFONT font = get_font(style);
- HFONT fontbak = SelectObject(hdc, font);
+ HDC hdc;
+ HFONT font;
+ HFONT fontbak;
SIZE s;
- if (length < 8192) { /* win 95/98/ME */
+ bool ret = true;
+
+ if (length == 0) {
+ *width = 0;
+ } else {
+ hdc = GetDC(NULL);
+ font = get_font(style);
+ fontbak = SelectObject(hdc, font);
+
/* may well need to convert utf-8 to lpctstr */
- GetTextExtentPoint32(hdc, string,
- utf8_bounded_length(string, length), &s);
- *width = s.cx;
+ if (GetTextExtentPoint32A(hdc, string, length, &s) != 0) {
+ *width = s.cx;
+ } else {
+ ret = false;
+ }
font = SelectObject(hdc, fontbak);
DeleteObject(font);
ReleaseDC(NULL, hdc);
- return true;
}
- LOG("nsfont_width failed");
- font = SelectObject(hdc, fontbak);
- DeleteObject(font);
- ReleaseDC(NULL, hdc);
- return false;
+ return ret;
}
+
/**
* Find the position in a string where an x coordinate falls.
*
@@ -168,25 +185,42 @@ static bool nsfont_width(const plot_font_style_t *style,
* \param actual_x updated to x coordinate of character closest to x
* \return true on success, false on error and error reported
*/
-
-static bool nsfont_position_in_string(const plot_font_style_t *style,
- const char *string, size_t length,
- int x, size_t *char_offset, int *actual_x)
+static bool
+nsfont_position_in_string(const plot_font_style_t *style,
+ const char *string,
+ size_t length,
+ int x,
+ size_t *char_offset,
+ int *actual_x)
{
- HDC hdc = GetDC(NULL);
- HFONT font = get_font(style);
- HFONT fontbak = SelectObject(hdc, font);
+ HDC hdc;
+ HFONT font;
+ HFONT fontbak;
SIZE s;
int offset;
- GetTextExtentExPoint(hdc, string, length, x, &offset, NULL, &s);
- *char_offset = (size_t)offset;
- nsfont_width(style, string, *char_offset, actual_x);
-
- font = SelectObject(hdc, fontbak);
- DeleteObject(font);
- ReleaseDC(NULL, hdc);
-
- return true;
+ bool ret = true;
+
+ if ((length == 0) || (x < 1)) {
+ *char_offset = 0;
+ *actual_x = 0;
+ } else {
+ hdc = GetDC(NULL);
+ font = get_font(style);
+ fontbak = SelectObject(hdc, font);
+
+ if ((GetTextExtentExPointA(hdc, string, length, x, &offset, NULL,&s) != 0) &&
+ (GetTextExtentPoint32A(hdc, string, offset, &s) != 0)) {
+ *char_offset = (size_t)offset;
+ *actual_x = s.cx;
+ } else {
+ ret = false;
+ }
+ font = SelectObject(hdc, fontbak);
+ DeleteObject(font);
+ ReleaseDC(NULL, hdc);
+ }
+
+ return ret;
}
@@ -206,28 +240,52 @@ static bool nsfont_position_in_string(const plot_font_style_t *style,
* string[char_offset] == ' ' ||
* char_offset == length]
*/
-
-static bool nsfont_split(const plot_font_style_t *style,
- const char *string, size_t length,
- int x, size_t *char_offset, int *actual_x)
+static bool
+nsfont_split(const plot_font_style_t *style,
+ const char *string,
+ size_t length,
+ int x,
+ size_t *char_offset,
+ int *actual_x)
{
int c_off;
- nsfont_position_in_string(style, string, length, x, char_offset,
- actual_x);
- c_off = *char_offset;
- if (*char_offset == length) {
- return true;
- }
- while ((string[*char_offset] != ' ') && (*char_offset > 0))
- (*char_offset)--;
- if (*char_offset == 0) {
- *char_offset = c_off;
- while (*char_offset < length && string[*char_offset] != ' ') {
- (*char_offset)++;
+ bool ret = false;
+
+ if (nsfont_position_in_string(style,
+ string,
+ length,
+ x,
+ char_offset,
+ actual_x)) {
+ c_off = *char_offset;
+ if (*char_offset == length) {
+ ret = true;
+ } else {
+ while ((string[*char_offset] != ' ') &&
+ (*char_offset > 0)) {
+ (*char_offset)--;
+ }
+
+ if (*char_offset == 0) {
+ *char_offset = c_off;
+ while ((*char_offset < length) &&
+ (string[*char_offset] != ' ')) {
+ (*char_offset)++;
+ }
+ }
+
+ ret = nsfont_width(style,
+ string,
+ *char_offset,
+ actual_x);
}
}
- return nsfont_width(style, string, *char_offset, actual_x);
+/*
+ LOG("ret %d Split %u chars at %ipx: Split at char %i (%ipx) - %.*s",
+ ret, length, x, *char_offset, *actual_x, *char_offset, string);
+*/
+ return ret;
}
const struct font_functions nsfont = {
-----------------------------------------------------------------------
Summary of changes:
desktop/browser.c | 2 +-
desktop/font.h | 22 ++++----
windows/font.c | 160 ++++++++++++++++++++++++++++++++++++-----------------
3 files changed, 121 insertions(+), 63 deletions(-)
diff --git a/desktop/browser.c b/desktop/browser.c
index 938ef51..04e8efb 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -1301,7 +1301,7 @@ static void browser_window_convert_to_download(struct browser_window *bw,
/**
- * Callback handler for content event messages.
+ * Browser window content event callback handler.
*/
static nserror browser_window_callback(hlcache_handle *c,
const hlcache_event *event, void *pw)
diff --git a/desktop/font.h b/desktop/font.h
index 4ebd75d..c883f8a 100644
--- a/desktop/font.h
+++ b/desktop/font.h
@@ -42,11 +42,11 @@ struct font_functions
/**
* Measure the width of a string.
*
- * \param fstyle plot style for this text
- * \param string UTF-8 string to measure
- * \param length length of string, in bytes
- * \param width updated to width of string[0..length)
- * \return true on success, false on error and error reported
+ * \param[in] fstyle plot style for this text
+ * \param[in] string UTF-8 string to measure
+ * \param[in] length length of string, in bytes
+ * \param[out] width updated to width of string[0..length)
+ * \return true on success and width updated else false.
*/
bool (*font_width)(const plot_font_style_t *fstyle,
const char *string, size_t length,
@@ -54,12 +54,12 @@ struct font_functions
/**
* Find the position in a string where an x coordinate falls.
*
- * \param fstyle style for this text
- * \param string UTF-8 string to measure
- * \param length length of string, in bytes
- * \param x x coordinate to search for
- * \param char_offset updated to offset in string of actual_x, [0..length]
- * \param actual_x updated to x coordinate of character closest to x
+ * \param[in] fstyle style for this text
+ * \param[in] string UTF-8 string to measure
+ * \param[in] length length of string, in bytes
+ * \param[in] x coordinate to search for
+ * \param[out] char_offset updated to offset in string of actual_x, [0..length]
+ * \param[out] actual_x updated to x coordinate of character closest to x
* \return true on success, false on error and error reported
*/
bool (*font_position_in_string)(const plot_font_style_t *fstyle,
diff --git a/windows/font.c b/windows/font.c
index 427bcb1..9358d1a 100644
--- a/windows/font.c
+++ b/windows/font.c
@@ -38,14 +38,14 @@
HWND font_hwnd;
nserror utf8_to_font_encoding(const struct font_desc* font,
- const char *string,
+ const char *string,
size_t len,
char **result)
{
return utf8_to_enc(string, font->encoding, len, result);
}
-static nserror utf8_to_local_encoding(const char *string,
+static nserror utf8_to_local_encoding(const char *string,
size_t len,
char **result)
{
@@ -131,31 +131,48 @@ HFONT get_font(const plot_font_style_t *style)
return font;
}
-static bool nsfont_width(const plot_font_style_t *style,
- const char *string, size_t length,
- int *width)
+/**
+ * Measure the width of a string.
+ *
+ * \param[in] style plot style for this text
+ * \param[in] string UTF-8 string to measure
+ * \param[in] length length of string, in bytes
+ * \param[out] width updated to width of string[0..length)
+ * \return true on success and width updated else false
+ */
+static bool
+nsfont_width(const plot_font_style_t *style,
+ const char *string,
+ size_t length,
+ int *width)
{
- HDC hdc = GetDC(NULL);
- HFONT font = get_font(style);
- HFONT fontbak = SelectObject(hdc, font);
+ HDC hdc;
+ HFONT font;
+ HFONT fontbak;
SIZE s;
- if (length < 8192) { /* win 95/98/ME */
+ bool ret = true;
+
+ if (length == 0) {
+ *width = 0;
+ } else {
+ hdc = GetDC(NULL);
+ font = get_font(style);
+ fontbak = SelectObject(hdc, font);
+
/* may well need to convert utf-8 to lpctstr */
- GetTextExtentPoint32(hdc, string,
- utf8_bounded_length(string, length), &s);
- *width = s.cx;
+ if (GetTextExtentPoint32A(hdc, string, length, &s) != 0) {
+ *width = s.cx;
+ } else {
+ ret = false;
+ }
font = SelectObject(hdc, fontbak);
DeleteObject(font);
ReleaseDC(NULL, hdc);
- return true;
}
- LOG("nsfont_width failed");
- font = SelectObject(hdc, fontbak);
- DeleteObject(font);
- ReleaseDC(NULL, hdc);
- return false;
+ return ret;
}
+
/**
* Find the position in a string where an x coordinate falls.
*
@@ -168,25 +185,42 @@ static bool nsfont_width(const plot_font_style_t *style,
* \param actual_x updated to x coordinate of character closest to x
* \return true on success, false on error and error reported
*/
-
-static bool nsfont_position_in_string(const plot_font_style_t *style,
- const char *string, size_t length,
- int x, size_t *char_offset, int *actual_x)
+static bool
+nsfont_position_in_string(const plot_font_style_t *style,
+ const char *string,
+ size_t length,
+ int x,
+ size_t *char_offset,
+ int *actual_x)
{
- HDC hdc = GetDC(NULL);
- HFONT font = get_font(style);
- HFONT fontbak = SelectObject(hdc, font);
+ HDC hdc;
+ HFONT font;
+ HFONT fontbak;
SIZE s;
int offset;
- GetTextExtentExPoint(hdc, string, length, x, &offset, NULL, &s);
- *char_offset = (size_t)offset;
- nsfont_width(style, string, *char_offset, actual_x);
-
- font = SelectObject(hdc, fontbak);
- DeleteObject(font);
- ReleaseDC(NULL, hdc);
-
- return true;
+ bool ret = true;
+
+ if ((length == 0) || (x < 1)) {
+ *char_offset = 0;
+ *actual_x = 0;
+ } else {
+ hdc = GetDC(NULL);
+ font = get_font(style);
+ fontbak = SelectObject(hdc, font);
+
+ if ((GetTextExtentExPointA(hdc, string, length, x, &offset, NULL,&s) != 0) &&
+ (GetTextExtentPoint32A(hdc, string, offset, &s) != 0)) {
+ *char_offset = (size_t)offset;
+ *actual_x = s.cx;
+ } else {
+ ret = false;
+ }
+ font = SelectObject(hdc, fontbak);
+ DeleteObject(font);
+ ReleaseDC(NULL, hdc);
+ }
+
+ return ret;
}
@@ -206,28 +240,52 @@ static bool nsfont_position_in_string(const plot_font_style_t *style,
* string[char_offset] == ' ' ||
* char_offset == length]
*/
-
-static bool nsfont_split(const plot_font_style_t *style,
- const char *string, size_t length,
- int x, size_t *char_offset, int *actual_x)
+static bool
+nsfont_split(const plot_font_style_t *style,
+ const char *string,
+ size_t length,
+ int x,
+ size_t *char_offset,
+ int *actual_x)
{
int c_off;
- nsfont_position_in_string(style, string, length, x, char_offset,
- actual_x);
- c_off = *char_offset;
- if (*char_offset == length) {
- return true;
- }
- while ((string[*char_offset] != ' ') && (*char_offset > 0))
- (*char_offset)--;
- if (*char_offset == 0) {
- *char_offset = c_off;
- while (*char_offset < length && string[*char_offset] != ' ') {
- (*char_offset)++;
+ bool ret = false;
+
+ if (nsfont_position_in_string(style,
+ string,
+ length,
+ x,
+ char_offset,
+ actual_x)) {
+ c_off = *char_offset;
+ if (*char_offset == length) {
+ ret = true;
+ } else {
+ while ((string[*char_offset] != ' ') &&
+ (*char_offset > 0)) {
+ (*char_offset)--;
+ }
+
+ if (*char_offset == 0) {
+ *char_offset = c_off;
+ while ((*char_offset < length) &&
+ (string[*char_offset] != ' ')) {
+ (*char_offset)++;
+ }
+ }
+
+ ret = nsfont_width(style,
+ string,
+ *char_offset,
+ actual_x);
}
}
- return nsfont_width(style, string, *char_offset, actual_x);
+/*
+ LOG("ret %d Split %u chars at %ipx: Split at char %i (%ipx) - %.*s",
+ ret, length, x, *char_offset, *actual_x, *char_offset, string);
+*/
+ return ret;
}
const struct font_functions nsfont = {
--
NetSurf Browser
7 years, 6 months