remove older code for new macos 10.10 base requirement
This commit is contained in:
136
build/osx/arm_init.c
Normal file
136
build/osx/arm_init.c
Normal file
@@ -0,0 +1,136 @@
|
||||
|
||||
/* arm_init.c - NEON optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2014,2016 Glenn Randers-Pehrson
|
||||
* Written by Mans Rullgard, 2011.
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*/
|
||||
|
||||
/* Below, after checking __linux__, various non-C90 POSIX 1003.1 functions are
|
||||
* called.
|
||||
*/
|
||||
#define _POSIX_SOURCE 1
|
||||
|
||||
#include "../pngpriv.h"
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
|
||||
#if PNG_ARM_NEON_OPT > 0
|
||||
#ifdef PNG_ARM_NEON_CHECK_SUPPORTED /* Do run-time checks */
|
||||
/* WARNING: it is strongly recommended that you do not build libpng with
|
||||
* run-time checks for CPU features if at all possible. In the case of the ARM
|
||||
* NEON instructions there is no processor-specific way of detecting the
|
||||
* presence of the required support, therefore run-time detection is extremely
|
||||
* OS specific.
|
||||
*
|
||||
* You may set the macro PNG_ARM_NEON_FILE to the file name of file containing
|
||||
* a fragment of C source code which defines the png_have_neon function. There
|
||||
* are a number of implementations in contrib/arm-neon, but the only one that
|
||||
* has partial support is contrib/arm-neon/linux.c - a generic Linux
|
||||
* implementation which reads /proc/cpufino.
|
||||
*/
|
||||
#ifndef PNG_ARM_NEON_FILE
|
||||
# ifdef __linux__
|
||||
# define PNG_ARM_NEON_FILE "contrib/arm-neon/linux.c"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef PNG_ARM_NEON_FILE
|
||||
|
||||
#include <signal.h> /* for sig_atomic_t */
|
||||
static int png_have_neon(png_structp png_ptr);
|
||||
#include PNG_ARM_NEON_FILE
|
||||
|
||||
#else /* PNG_ARM_NEON_FILE */
|
||||
# error "PNG_ARM_NEON_FILE undefined: no support for run-time ARM NEON checks"
|
||||
#endif /* PNG_ARM_NEON_FILE */
|
||||
#endif /* PNG_ARM_NEON_CHECK_SUPPORTED */
|
||||
|
||||
#ifndef PNG_ALIGNED_MEMORY_SUPPORTED
|
||||
# error "ALIGNED_MEMORY is required; set: -DPNG_ALIGNED_MEMORY_SUPPORTED"
|
||||
#endif
|
||||
|
||||
void
|
||||
png_init_filter_functions_neon(png_structp pp, unsigned int bpp)
|
||||
{
|
||||
/* The switch statement is compiled in for ARM_NEON_API, the call to
|
||||
* png_have_neon is compiled in for ARM_NEON_CHECK. If both are defined
|
||||
* the check is only performed if the API has not set the NEON option on
|
||||
* or off explicitly. In this case the check controls what happens.
|
||||
*
|
||||
* If the CHECK is not compiled in and the option is UNSET the behavior prior
|
||||
* to 1.6.7 was to use the NEON code - this was a bug caused by having the
|
||||
* wrong order of the 'ON' and 'default' cases. UNSET now defaults to OFF,
|
||||
* as documented in png.h
|
||||
*/
|
||||
png_debug(1, "in png_init_filter_functions_neon");
|
||||
#ifdef PNG_ARM_NEON_API_SUPPORTED
|
||||
switch ((pp->options >> PNG_ARM_NEON) & 3)
|
||||
{
|
||||
case PNG_OPTION_UNSET:
|
||||
/* Allow the run-time check to execute if it has been enabled -
|
||||
* thus both API and CHECK can be turned on. If it isn't supported
|
||||
* this case will fall through to the 'default' below, which just
|
||||
* returns.
|
||||
*/
|
||||
#endif /* PNG_ARM_NEON_API_SUPPORTED */
|
||||
#ifdef PNG_ARM_NEON_CHECK_SUPPORTED
|
||||
{
|
||||
static volatile sig_atomic_t no_neon = -1; /* not checked */
|
||||
|
||||
if (no_neon < 0)
|
||||
no_neon = !png_have_neon(pp);
|
||||
|
||||
if (no_neon)
|
||||
return;
|
||||
}
|
||||
#ifdef PNG_ARM_NEON_API_SUPPORTED
|
||||
break;
|
||||
#endif
|
||||
#endif /* PNG_ARM_NEON_CHECK_SUPPORTED */
|
||||
|
||||
#ifdef PNG_ARM_NEON_API_SUPPORTED
|
||||
default: /* OFF or INVALID */
|
||||
return;
|
||||
|
||||
case PNG_OPTION_ON:
|
||||
/* Option turned on */
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* IMPORTANT: any new external functions used here must be declared using
|
||||
* PNG_INTERNAL_FUNCTION in ../pngpriv.h. This is required so that the
|
||||
* 'prefix' option to configure works:
|
||||
*
|
||||
* ./configure --with-libpng-prefix=foobar_
|
||||
*
|
||||
* Verify you have got this right by running the above command, doing a build
|
||||
* and examining pngprefix.h; it must contain a #define for every external
|
||||
* function you add. (Notice that this happens automatically for the
|
||||
* initialization function.)
|
||||
*/
|
||||
pp->read_filter[PNG_FILTER_VALUE_UP-1] = png_read_filter_row_up_neon;
|
||||
|
||||
if (bpp == 3)
|
||||
{
|
||||
pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub3_neon;
|
||||
pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_neon;
|
||||
pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
|
||||
png_read_filter_row_paeth3_neon;
|
||||
}
|
||||
|
||||
else if (bpp == 4)
|
||||
{
|
||||
pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub4_neon;
|
||||
pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg4_neon;
|
||||
pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
|
||||
png_read_filter_row_paeth4_neon;
|
||||
}
|
||||
}
|
||||
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||
#endif /* READ */
|
253
build/osx/filter_neon.S
Normal file
253
build/osx/filter_neon.S
Normal file
@@ -0,0 +1,253 @@
|
||||
|
||||
/* filter_neon.S - NEON optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2014,2017 Glenn Randers-Pehrson
|
||||
* Written by Mans Rullgard, 2011.
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*/
|
||||
|
||||
/* This is required to get the symbol renames, which are #defines, and the
|
||||
* definitions (or not) of PNG_ARM_NEON_OPT and PNG_ARM_NEON_IMPLEMENTATION.
|
||||
*/
|
||||
#define PNG_VERSION_INFO_ONLY
|
||||
#include "../pngpriv.h"
|
||||
|
||||
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(__ELF__)
|
||||
.section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
|
||||
/* Assembler NEON support - only works for 32-bit ARM (i.e. it does not work for
|
||||
* ARM64). The code in arm/filter_neon_intrinsics.c supports ARM64, however it
|
||||
* only works if -mfpu=neon is specified on the GCC command line. See pngpriv.h
|
||||
* for the logic which sets PNG_USE_ARM_NEON_ASM:
|
||||
*/
|
||||
#if PNG_ARM_NEON_IMPLEMENTATION == 2 /* hand-coded assembler */
|
||||
|
||||
#if PNG_ARM_NEON_OPT > 0
|
||||
|
||||
#ifdef __ELF__
|
||||
# define ELF
|
||||
#else
|
||||
# define ELF @
|
||||
#endif
|
||||
|
||||
.arch armv7-a
|
||||
.fpu neon
|
||||
|
||||
.macro func name, export=0
|
||||
.macro endfunc
|
||||
ELF .size \name, . - \name
|
||||
.endfunc
|
||||
.purgem endfunc
|
||||
.endm
|
||||
.text
|
||||
|
||||
/* Explicitly specifying alignment here because some versions of
|
||||
* GAS don't align code correctly. This is harmless in correctly
|
||||
* written versions of GAS.
|
||||
*/
|
||||
.align 2
|
||||
|
||||
.if \export
|
||||
.global \name
|
||||
.endif
|
||||
ELF .type \name, STT_FUNC
|
||||
.func \name
|
||||
\name:
|
||||
.endm
|
||||
|
||||
func png_read_filter_row_sub4_neon, export=1
|
||||
ldr r3, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
1:
|
||||
vld4.32 {d4[],d5[],d6[],d7[]}, [r1,:128]
|
||||
vadd.u8 d0, d3, d4
|
||||
vadd.u8 d1, d0, d5
|
||||
vadd.u8 d2, d1, d6
|
||||
vadd.u8 d3, d2, d7
|
||||
vst4.32 {d0[0],d1[0],d2[0],d3[0]},[r1,:128]!
|
||||
subs r3, r3, #16
|
||||
bgt 1b
|
||||
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
func png_read_filter_row_sub3_neon, export=1
|
||||
ldr r3, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
mov r0, r1
|
||||
mov r2, #3
|
||||
mov r12, #12
|
||||
vld1.8 {q11}, [r0], r12
|
||||
1:
|
||||
vext.8 d5, d22, d23, #3
|
||||
vadd.u8 d0, d3, d22
|
||||
vext.8 d6, d22, d23, #6
|
||||
vadd.u8 d1, d0, d5
|
||||
vext.8 d7, d23, d23, #1
|
||||
vld1.8 {q11}, [r0], r12
|
||||
vst1.32 {d0[0]}, [r1,:32], r2
|
||||
vadd.u8 d2, d1, d6
|
||||
vst1.32 {d1[0]}, [r1], r2
|
||||
vadd.u8 d3, d2, d7
|
||||
vst1.32 {d2[0]}, [r1], r2
|
||||
vst1.32 {d3[0]}, [r1], r2
|
||||
subs r3, r3, #12
|
||||
bgt 1b
|
||||
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
func png_read_filter_row_up_neon, export=1
|
||||
ldr r3, [r0, #4] @ rowbytes
|
||||
1:
|
||||
vld1.8 {q0}, [r1,:128]
|
||||
vld1.8 {q1}, [r2,:128]!
|
||||
vadd.u8 q0, q0, q1
|
||||
vst1.8 {q0}, [r1,:128]!
|
||||
subs r3, r3, #16
|
||||
bgt 1b
|
||||
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
func png_read_filter_row_avg4_neon, export=1
|
||||
ldr r12, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
1:
|
||||
vld4.32 {d4[],d5[],d6[],d7[]}, [r1,:128]
|
||||
vld4.32 {d16[],d17[],d18[],d19[]},[r2,:128]!
|
||||
vhadd.u8 d0, d3, d16
|
||||
vadd.u8 d0, d0, d4
|
||||
vhadd.u8 d1, d0, d17
|
||||
vadd.u8 d1, d1, d5
|
||||
vhadd.u8 d2, d1, d18
|
||||
vadd.u8 d2, d2, d6
|
||||
vhadd.u8 d3, d2, d19
|
||||
vadd.u8 d3, d3, d7
|
||||
vst4.32 {d0[0],d1[0],d2[0],d3[0]},[r1,:128]!
|
||||
subs r12, r12, #16
|
||||
bgt 1b
|
||||
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
func png_read_filter_row_avg3_neon, export=1
|
||||
push {r4,lr}
|
||||
ldr r12, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
mov r0, r1
|
||||
mov r4, #3
|
||||
mov lr, #12
|
||||
vld1.8 {q11}, [r0], lr
|
||||
1:
|
||||
vld1.8 {q10}, [r2], lr
|
||||
vext.8 d5, d22, d23, #3
|
||||
vhadd.u8 d0, d3, d20
|
||||
vext.8 d17, d20, d21, #3
|
||||
vadd.u8 d0, d0, d22
|
||||
vext.8 d6, d22, d23, #6
|
||||
vhadd.u8 d1, d0, d17
|
||||
vext.8 d18, d20, d21, #6
|
||||
vadd.u8 d1, d1, d5
|
||||
vext.8 d7, d23, d23, #1
|
||||
vld1.8 {q11}, [r0], lr
|
||||
vst1.32 {d0[0]}, [r1,:32], r4
|
||||
vhadd.u8 d2, d1, d18
|
||||
vst1.32 {d1[0]}, [r1], r4
|
||||
vext.8 d19, d21, d21, #1
|
||||
vadd.u8 d2, d2, d6
|
||||
vhadd.u8 d3, d2, d19
|
||||
vst1.32 {d2[0]}, [r1], r4
|
||||
vadd.u8 d3, d3, d7
|
||||
vst1.32 {d3[0]}, [r1], r4
|
||||
subs r12, r12, #12
|
||||
bgt 1b
|
||||
|
||||
pop {r4,pc}
|
||||
endfunc
|
||||
|
||||
.macro paeth rx, ra, rb, rc
|
||||
vaddl.u8 q12, \ra, \rb @ a + b
|
||||
vaddl.u8 q15, \rc, \rc @ 2*c
|
||||
vabdl.u8 q13, \rb, \rc @ pa
|
||||
vabdl.u8 q14, \ra, \rc @ pb
|
||||
vabd.u16 q15, q12, q15 @ pc
|
||||
vcle.u16 q12, q13, q14 @ pa <= pb
|
||||
vcle.u16 q13, q13, q15 @ pa <= pc
|
||||
vcle.u16 q14, q14, q15 @ pb <= pc
|
||||
vand q12, q12, q13 @ pa <= pb && pa <= pc
|
||||
vmovn.u16 d28, q14
|
||||
vmovn.u16 \rx, q12
|
||||
vbsl d28, \rb, \rc
|
||||
vbsl \rx, \ra, d28
|
||||
.endm
|
||||
|
||||
func png_read_filter_row_paeth4_neon, export=1
|
||||
ldr r12, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
vmov.i8 d20, #0
|
||||
1:
|
||||
vld4.32 {d4[],d5[],d6[],d7[]}, [r1,:128]
|
||||
vld4.32 {d16[],d17[],d18[],d19[]},[r2,:128]!
|
||||
paeth d0, d3, d16, d20
|
||||
vadd.u8 d0, d0, d4
|
||||
paeth d1, d0, d17, d16
|
||||
vadd.u8 d1, d1, d5
|
||||
paeth d2, d1, d18, d17
|
||||
vadd.u8 d2, d2, d6
|
||||
paeth d3, d2, d19, d18
|
||||
vmov d20, d19
|
||||
vadd.u8 d3, d3, d7
|
||||
vst4.32 {d0[0],d1[0],d2[0],d3[0]},[r1,:128]!
|
||||
subs r12, r12, #16
|
||||
bgt 1b
|
||||
|
||||
bx lr
|
||||
endfunc
|
||||
|
||||
func png_read_filter_row_paeth3_neon, export=1
|
||||
push {r4,lr}
|
||||
ldr r12, [r0, #4] @ rowbytes
|
||||
vmov.i8 d3, #0
|
||||
vmov.i8 d4, #0
|
||||
mov r0, r1
|
||||
mov r4, #3
|
||||
mov lr, #12
|
||||
vld1.8 {q11}, [r0], lr
|
||||
1:
|
||||
vld1.8 {q10}, [r2], lr
|
||||
paeth d0, d3, d20, d4
|
||||
vext.8 d5, d22, d23, #3
|
||||
vadd.u8 d0, d0, d22
|
||||
vext.8 d17, d20, d21, #3
|
||||
paeth d1, d0, d17, d20
|
||||
vst1.32 {d0[0]}, [r1,:32], r4
|
||||
vext.8 d6, d22, d23, #6
|
||||
vadd.u8 d1, d1, d5
|
||||
vext.8 d18, d20, d21, #6
|
||||
paeth d2, d1, d18, d17
|
||||
vext.8 d7, d23, d23, #1
|
||||
vld1.8 {q11}, [r0], lr
|
||||
vst1.32 {d1[0]}, [r1], r4
|
||||
vadd.u8 d2, d2, d6
|
||||
vext.8 d19, d21, d21, #1
|
||||
paeth d3, d2, d19, d18
|
||||
vst1.32 {d2[0]}, [r1], r4
|
||||
vmov d4, d19
|
||||
vadd.u8 d3, d3, d7
|
||||
vst1.32 {d3[0]}, [r1], r4
|
||||
subs r12, r12, #12
|
||||
bgt 1b
|
||||
|
||||
pop {r4,pc}
|
||||
endfunc
|
||||
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||
#endif /* PNG_ARM_NEON_IMPLEMENTATION == 2 (assembler) */
|
||||
#endif /* READ */
|
402
build/osx/filter_neon_intrinsics.c
Normal file
402
build/osx/filter_neon_intrinsics.c
Normal file
@@ -0,0 +1,402 @@
|
||||
|
||||
/* filter_neon_intrinsics.c - NEON optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2014,2016 Glenn Randers-Pehrson
|
||||
* Written by James Yu <james.yu at linaro.org>, October 2013.
|
||||
* Based on filter_neon.S, written by Mans Rullgard, 2011.
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*/
|
||||
|
||||
#include "../pngpriv.h"
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
|
||||
/* This code requires -mfpu=neon on the command line: */
|
||||
#if PNG_ARM_NEON_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */
|
||||
|
||||
#if defined(_MSC_VER) && defined(_M_ARM64)
|
||||
# include <arm64_neon.h>
|
||||
#else
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
/* libpng row pointers are not necessarily aligned to any particular boundary,
|
||||
* however this code will only work with appropriate alignment. arm/arm_init.c
|
||||
* checks for this (and will not compile unless it is done). This code uses
|
||||
* variants of png_aligncast to avoid compiler warnings.
|
||||
*/
|
||||
#define png_ptr(type,pointer) png_aligncast(type *,pointer)
|
||||
#define png_ptrc(type,pointer) png_aligncastconst(const type *,pointer)
|
||||
|
||||
/* The following relies on a variable 'temp_pointer' being declared with type
|
||||
* 'type'. This is written this way just to hide the GCC strict aliasing
|
||||
* warning; note that the code is safe because there never is an alias between
|
||||
* the input and output pointers.
|
||||
*
|
||||
* When compiling with MSVC ARM64, the png_ldr macro can't be passed directly
|
||||
* to vst4_lane_u32, because of an internal compiler error inside MSVC.
|
||||
* To avoid this compiler bug, we use a temporary variable (vdest_val) to store
|
||||
* the result of png_ldr.
|
||||
*/
|
||||
#define png_ldr(type,pointer)\
|
||||
(temp_pointer = png_ptr(type,pointer), *temp_pointer)
|
||||
|
||||
#if PNG_ARM_NEON_OPT > 0
|
||||
|
||||
void
|
||||
png_read_filter_row_up_neon(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_bytep rp = row;
|
||||
png_bytep rp_stop = row + row_info->rowbytes;
|
||||
png_const_bytep pp = prev_row;
|
||||
|
||||
png_debug(1, "in png_read_filter_row_up_neon");
|
||||
|
||||
for (; rp < rp_stop; rp += 16, pp += 16)
|
||||
{
|
||||
uint8x16_t qrp, qpp;
|
||||
|
||||
qrp = vld1q_u8(rp);
|
||||
qpp = vld1q_u8(pp);
|
||||
qrp = vaddq_u8(qrp, qpp);
|
||||
vst1q_u8(rp, qrp);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
png_read_filter_row_sub3_neon(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_bytep rp = row;
|
||||
png_bytep rp_stop = row + row_info->rowbytes;
|
||||
|
||||
uint8x16_t vtmp = vld1q_u8(rp);
|
||||
uint8x8x2_t *vrpt = png_ptr(uint8x8x2_t, &vtmp);
|
||||
uint8x8x2_t vrp = *vrpt;
|
||||
|
||||
uint8x8x4_t vdest;
|
||||
vdest.val[3] = vdup_n_u8(0);
|
||||
|
||||
png_debug(1, "in png_read_filter_row_sub3_neon");
|
||||
|
||||
for (; rp < rp_stop;)
|
||||
{
|
||||
uint8x8_t vtmp1, vtmp2;
|
||||
uint32x2_t *temp_pointer;
|
||||
|
||||
vtmp1 = vext_u8(vrp.val[0], vrp.val[1], 3);
|
||||
vdest.val[0] = vadd_u8(vdest.val[3], vrp.val[0]);
|
||||
vtmp2 = vext_u8(vrp.val[0], vrp.val[1], 6);
|
||||
vdest.val[1] = vadd_u8(vdest.val[0], vtmp1);
|
||||
|
||||
vtmp1 = vext_u8(vrp.val[1], vrp.val[1], 1);
|
||||
vdest.val[2] = vadd_u8(vdest.val[1], vtmp2);
|
||||
vdest.val[3] = vadd_u8(vdest.val[2], vtmp1);
|
||||
|
||||
vtmp = vld1q_u8(rp + 12);
|
||||
vrpt = png_ptr(uint8x8x2_t, &vtmp);
|
||||
vrp = *vrpt;
|
||||
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[0]), 0);
|
||||
rp += 3;
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[1]), 0);
|
||||
rp += 3;
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[2]), 0);
|
||||
rp += 3;
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[3]), 0);
|
||||
rp += 3;
|
||||
}
|
||||
|
||||
PNG_UNUSED(prev_row)
|
||||
}
|
||||
|
||||
void
|
||||
png_read_filter_row_sub4_neon(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_bytep rp = row;
|
||||
png_bytep rp_stop = row + row_info->rowbytes;
|
||||
|
||||
uint8x8x4_t vdest;
|
||||
vdest.val[3] = vdup_n_u8(0);
|
||||
|
||||
png_debug(1, "in png_read_filter_row_sub4_neon");
|
||||
|
||||
for (; rp < rp_stop; rp += 16)
|
||||
{
|
||||
uint32x2x4_t vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
||||
uint8x8x4_t *vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
||||
uint8x8x4_t vrp = *vrpt;
|
||||
uint32x2x4_t *temp_pointer;
|
||||
uint32x2x4_t vdest_val;
|
||||
|
||||
vdest.val[0] = vadd_u8(vdest.val[3], vrp.val[0]);
|
||||
vdest.val[1] = vadd_u8(vdest.val[0], vrp.val[1]);
|
||||
vdest.val[2] = vadd_u8(vdest.val[1], vrp.val[2]);
|
||||
vdest.val[3] = vadd_u8(vdest.val[2], vrp.val[3]);
|
||||
|
||||
vdest_val = png_ldr(uint32x2x4_t, &vdest);
|
||||
vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0);
|
||||
}
|
||||
|
||||
PNG_UNUSED(prev_row)
|
||||
}
|
||||
|
||||
void
|
||||
png_read_filter_row_avg3_neon(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_bytep rp = row;
|
||||
png_const_bytep pp = prev_row;
|
||||
png_bytep rp_stop = row + row_info->rowbytes;
|
||||
|
||||
uint8x16_t vtmp;
|
||||
uint8x8x2_t *vrpt;
|
||||
uint8x8x2_t vrp;
|
||||
uint8x8x4_t vdest;
|
||||
vdest.val[3] = vdup_n_u8(0);
|
||||
|
||||
vtmp = vld1q_u8(rp);
|
||||
vrpt = png_ptr(uint8x8x2_t,&vtmp);
|
||||
vrp = *vrpt;
|
||||
|
||||
png_debug(1, "in png_read_filter_row_avg3_neon");
|
||||
|
||||
for (; rp < rp_stop; pp += 12)
|
||||
{
|
||||
uint8x8_t vtmp1, vtmp2, vtmp3;
|
||||
|
||||
uint8x8x2_t *vppt;
|
||||
uint8x8x2_t vpp;
|
||||
|
||||
uint32x2_t *temp_pointer;
|
||||
|
||||
vtmp = vld1q_u8(pp);
|
||||
vppt = png_ptr(uint8x8x2_t,&vtmp);
|
||||
vpp = *vppt;
|
||||
|
||||
vtmp1 = vext_u8(vrp.val[0], vrp.val[1], 3);
|
||||
vdest.val[0] = vhadd_u8(vdest.val[3], vpp.val[0]);
|
||||
vdest.val[0] = vadd_u8(vdest.val[0], vrp.val[0]);
|
||||
|
||||
vtmp2 = vext_u8(vpp.val[0], vpp.val[1], 3);
|
||||
vtmp3 = vext_u8(vrp.val[0], vrp.val[1], 6);
|
||||
vdest.val[1] = vhadd_u8(vdest.val[0], vtmp2);
|
||||
vdest.val[1] = vadd_u8(vdest.val[1], vtmp1);
|
||||
|
||||
vtmp2 = vext_u8(vpp.val[0], vpp.val[1], 6);
|
||||
vtmp1 = vext_u8(vrp.val[1], vrp.val[1], 1);
|
||||
|
||||
vtmp = vld1q_u8(rp + 12);
|
||||
vrpt = png_ptr(uint8x8x2_t,&vtmp);
|
||||
vrp = *vrpt;
|
||||
|
||||
vdest.val[2] = vhadd_u8(vdest.val[1], vtmp2);
|
||||
vdest.val[2] = vadd_u8(vdest.val[2], vtmp3);
|
||||
|
||||
vtmp2 = vext_u8(vpp.val[1], vpp.val[1], 1);
|
||||
|
||||
vdest.val[3] = vhadd_u8(vdest.val[2], vtmp2);
|
||||
vdest.val[3] = vadd_u8(vdest.val[3], vtmp1);
|
||||
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[0]), 0);
|
||||
rp += 3;
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[1]), 0);
|
||||
rp += 3;
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[2]), 0);
|
||||
rp += 3;
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[3]), 0);
|
||||
rp += 3;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
png_read_filter_row_avg4_neon(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_bytep rp = row;
|
||||
png_bytep rp_stop = row + row_info->rowbytes;
|
||||
png_const_bytep pp = prev_row;
|
||||
|
||||
uint8x8x4_t vdest;
|
||||
vdest.val[3] = vdup_n_u8(0);
|
||||
|
||||
png_debug(1, "in png_read_filter_row_avg4_neon");
|
||||
|
||||
for (; rp < rp_stop; rp += 16, pp += 16)
|
||||
{
|
||||
uint32x2x4_t vtmp;
|
||||
uint8x8x4_t *vrpt, *vppt;
|
||||
uint8x8x4_t vrp, vpp;
|
||||
uint32x2x4_t *temp_pointer;
|
||||
uint32x2x4_t vdest_val;
|
||||
|
||||
vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
||||
vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
||||
vrp = *vrpt;
|
||||
vtmp = vld4_u32(png_ptrc(uint32_t,pp));
|
||||
vppt = png_ptr(uint8x8x4_t,&vtmp);
|
||||
vpp = *vppt;
|
||||
|
||||
vdest.val[0] = vhadd_u8(vdest.val[3], vpp.val[0]);
|
||||
vdest.val[0] = vadd_u8(vdest.val[0], vrp.val[0]);
|
||||
vdest.val[1] = vhadd_u8(vdest.val[0], vpp.val[1]);
|
||||
vdest.val[1] = vadd_u8(vdest.val[1], vrp.val[1]);
|
||||
vdest.val[2] = vhadd_u8(vdest.val[1], vpp.val[2]);
|
||||
vdest.val[2] = vadd_u8(vdest.val[2], vrp.val[2]);
|
||||
vdest.val[3] = vhadd_u8(vdest.val[2], vpp.val[3]);
|
||||
vdest.val[3] = vadd_u8(vdest.val[3], vrp.val[3]);
|
||||
|
||||
vdest_val = png_ldr(uint32x2x4_t, &vdest);
|
||||
vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static uint8x8_t
|
||||
paeth(uint8x8_t a, uint8x8_t b, uint8x8_t c)
|
||||
{
|
||||
uint8x8_t d, e;
|
||||
uint16x8_t p1, pa, pb, pc;
|
||||
|
||||
p1 = vaddl_u8(a, b); /* a + b */
|
||||
pc = vaddl_u8(c, c); /* c * 2 */
|
||||
pa = vabdl_u8(b, c); /* pa */
|
||||
pb = vabdl_u8(a, c); /* pb */
|
||||
pc = vabdq_u16(p1, pc); /* pc */
|
||||
|
||||
p1 = vcleq_u16(pa, pb); /* pa <= pb */
|
||||
pa = vcleq_u16(pa, pc); /* pa <= pc */
|
||||
pb = vcleq_u16(pb, pc); /* pb <= pc */
|
||||
|
||||
p1 = vandq_u16(p1, pa); /* pa <= pb && pa <= pc */
|
||||
|
||||
d = vmovn_u16(pb);
|
||||
e = vmovn_u16(p1);
|
||||
|
||||
d = vbsl_u8(d, b, c);
|
||||
e = vbsl_u8(e, a, d);
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
void
|
||||
png_read_filter_row_paeth3_neon(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_bytep rp = row;
|
||||
png_const_bytep pp = prev_row;
|
||||
png_bytep rp_stop = row + row_info->rowbytes;
|
||||
|
||||
uint8x16_t vtmp;
|
||||
uint8x8x2_t *vrpt;
|
||||
uint8x8x2_t vrp;
|
||||
uint8x8_t vlast = vdup_n_u8(0);
|
||||
uint8x8x4_t vdest;
|
||||
vdest.val[3] = vdup_n_u8(0);
|
||||
|
||||
vtmp = vld1q_u8(rp);
|
||||
vrpt = png_ptr(uint8x8x2_t,&vtmp);
|
||||
vrp = *vrpt;
|
||||
|
||||
png_debug(1, "in png_read_filter_row_paeth3_neon");
|
||||
|
||||
for (; rp < rp_stop; pp += 12)
|
||||
{
|
||||
uint8x8x2_t *vppt;
|
||||
uint8x8x2_t vpp;
|
||||
uint8x8_t vtmp1, vtmp2, vtmp3;
|
||||
uint32x2_t *temp_pointer;
|
||||
|
||||
vtmp = vld1q_u8(pp);
|
||||
vppt = png_ptr(uint8x8x2_t,&vtmp);
|
||||
vpp = *vppt;
|
||||
|
||||
vdest.val[0] = paeth(vdest.val[3], vpp.val[0], vlast);
|
||||
vdest.val[0] = vadd_u8(vdest.val[0], vrp.val[0]);
|
||||
|
||||
vtmp1 = vext_u8(vrp.val[0], vrp.val[1], 3);
|
||||
vtmp2 = vext_u8(vpp.val[0], vpp.val[1], 3);
|
||||
vdest.val[1] = paeth(vdest.val[0], vtmp2, vpp.val[0]);
|
||||
vdest.val[1] = vadd_u8(vdest.val[1], vtmp1);
|
||||
|
||||
vtmp1 = vext_u8(vrp.val[0], vrp.val[1], 6);
|
||||
vtmp3 = vext_u8(vpp.val[0], vpp.val[1], 6);
|
||||
vdest.val[2] = paeth(vdest.val[1], vtmp3, vtmp2);
|
||||
vdest.val[2] = vadd_u8(vdest.val[2], vtmp1);
|
||||
|
||||
vtmp1 = vext_u8(vrp.val[1], vrp.val[1], 1);
|
||||
vtmp2 = vext_u8(vpp.val[1], vpp.val[1], 1);
|
||||
|
||||
vtmp = vld1q_u8(rp + 12);
|
||||
vrpt = png_ptr(uint8x8x2_t,&vtmp);
|
||||
vrp = *vrpt;
|
||||
|
||||
vdest.val[3] = paeth(vdest.val[2], vtmp2, vtmp3);
|
||||
vdest.val[3] = vadd_u8(vdest.val[3], vtmp1);
|
||||
|
||||
vlast = vtmp2;
|
||||
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[0]), 0);
|
||||
rp += 3;
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[1]), 0);
|
||||
rp += 3;
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[2]), 0);
|
||||
rp += 3;
|
||||
vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[3]), 0);
|
||||
rp += 3;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
png_read_filter_row_paeth4_neon(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_bytep rp = row;
|
||||
png_bytep rp_stop = row + row_info->rowbytes;
|
||||
png_const_bytep pp = prev_row;
|
||||
|
||||
uint8x8_t vlast = vdup_n_u8(0);
|
||||
uint8x8x4_t vdest;
|
||||
vdest.val[3] = vdup_n_u8(0);
|
||||
|
||||
png_debug(1, "in png_read_filter_row_paeth4_neon");
|
||||
|
||||
for (; rp < rp_stop; rp += 16, pp += 16)
|
||||
{
|
||||
uint32x2x4_t vtmp;
|
||||
uint8x8x4_t *vrpt, *vppt;
|
||||
uint8x8x4_t vrp, vpp;
|
||||
uint32x2x4_t *temp_pointer;
|
||||
uint32x2x4_t vdest_val;
|
||||
|
||||
vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
||||
vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
||||
vrp = *vrpt;
|
||||
vtmp = vld4_u32(png_ptrc(uint32_t,pp));
|
||||
vppt = png_ptr(uint8x8x4_t,&vtmp);
|
||||
vpp = *vppt;
|
||||
|
||||
vdest.val[0] = paeth(vdest.val[3], vpp.val[0], vlast);
|
||||
vdest.val[0] = vadd_u8(vdest.val[0], vrp.val[0]);
|
||||
vdest.val[1] = paeth(vdest.val[0], vpp.val[1], vpp.val[0]);
|
||||
vdest.val[1] = vadd_u8(vdest.val[1], vrp.val[1]);
|
||||
vdest.val[2] = paeth(vdest.val[1], vpp.val[2], vpp.val[1]);
|
||||
vdest.val[2] = vadd_u8(vdest.val[2], vrp.val[2]);
|
||||
vdest.val[3] = paeth(vdest.val[2], vpp.val[3], vpp.val[2]);
|
||||
vdest.val[3] = vadd_u8(vdest.val[3], vrp.val[3]);
|
||||
|
||||
vlast = vpp.val[3];
|
||||
|
||||
vdest_val = png_ldr(uint32x2x4_t, &vdest);
|
||||
vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||
#endif /* PNG_ARM_NEON_IMPLEMENTATION == 1 (intrinsics) */
|
||||
#endif /* READ */
|
@@ -76,61 +76,45 @@ bool wxStatusBarMac::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
void wxStatusBarMac::InitColours()
|
||||
{
|
||||
if ( WX_IS_MACOS_AVAILABLE(10, 10) )
|
||||
if ( WX_IS_MACOS_AVAILABLE(10, 14) )
|
||||
{
|
||||
if ( WX_IS_MACOS_AVAILABLE(10, 14) )
|
||||
{
|
||||
// FIXME: None of this is correct and is only very loose
|
||||
// approximation. 10.14's dark mode uses dynamic colors that
|
||||
// use desktop tinting. The only correct way to render the
|
||||
// statusbar is to use windowBackgroundColor in a NSBox.
|
||||
wxColour bg = wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE);
|
||||
m_textActive = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT);
|
||||
m_textInactive = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT);
|
||||
// FIXME: None of this is correct and is only very loose
|
||||
// approximation. 10.14's dark mode uses dynamic colors that
|
||||
// use desktop tinting. The only correct way to render the
|
||||
// statusbar is to use windowBackgroundColor in a NSBox.
|
||||
wxColour bg = wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE);
|
||||
m_textActive = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT);
|
||||
m_textInactive = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT);
|
||||
|
||||
if ( wxSystemSettings::GetAppearance().IsDark() )
|
||||
{
|
||||
// dark mode appearance
|
||||
m_textActive = wxColour(0xB0, 0xB0, 0xB0);
|
||||
m_bgActiveFrom = wxColour(0x32, 0x32, 0x34);
|
||||
m_bgActiveTo = wxColour(0x29, 0x29, 0x2A);
|
||||
m_borderActive = wxColour(0x00, 0x00, 0x00);
|
||||
m_borderInactive = wxColour(0x00, 0x00, 0x00);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bgActiveFrom = wxColour(0xE9, 0xE7, 0xEA);
|
||||
m_bgActiveTo = wxColour(0xCD, 0xCB, 0xCE);
|
||||
m_borderActive = wxColour(0xBA, 0xB8, 0xBB);
|
||||
m_borderInactive = wxColour(0xC3, 0xC3, 0xC3);
|
||||
}
|
||||
SetBackgroundColour(bg); // inactive bg
|
||||
if ( wxSystemSettings::GetAppearance().IsDark() )
|
||||
{
|
||||
// dark mode appearance
|
||||
m_textActive = wxColour(0xB0, 0xB0, 0xB0);
|
||||
m_bgActiveFrom = wxColour(0x32, 0x32, 0x34);
|
||||
m_bgActiveTo = wxColour(0x29, 0x29, 0x2A);
|
||||
m_borderActive = wxColour(0x00, 0x00, 0x00);
|
||||
m_borderInactive = wxColour(0x00, 0x00, 0x00);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 10.10 Yosemite to 10.13 :
|
||||
m_textActive = wxColour(0x40, 0x40, 0x40);
|
||||
m_textInactive = wxColour(0x4B, 0x4B, 0x4B);
|
||||
m_bgActiveFrom = wxColour(0xE9, 0xE7, 0xEA);
|
||||
m_bgActiveTo = wxColour(0xCD, 0xCB, 0xCE);
|
||||
m_borderActive = wxColour(0xBA, 0xB8, 0xBB);
|
||||
m_borderInactive = wxColour(0xC3, 0xC3, 0xC3);
|
||||
SetBackgroundColour(wxColour(0xF4, 0xF4, 0xF4)); // inactive bg
|
||||
}
|
||||
SetBackgroundColour(bg); // inactive bg
|
||||
}
|
||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED < 101000
|
||||
else
|
||||
{
|
||||
// 10.9 Mavericks and older:
|
||||
m_textActive = wxColour(0x2F, 0x2F, 0x2F);
|
||||
m_textInactive = wxColour(0x4D, 0x4D, 0x4D);
|
||||
m_bgActiveFrom = wxColour(0xDA, 0xDA, 0xDA);
|
||||
m_bgActiveTo = wxColour(0xA0, 0xA0, 0xA0);
|
||||
m_borderActive = wxColour(0x6E, 0x6E, 0x6E);
|
||||
m_borderInactive = wxColour(0xA3, 0xA3, 0xA3);
|
||||
SetBackgroundColour(wxColour(0xE1, 0xE1, 0xE1)); // inactive bg
|
||||
// 10.10 Yosemite to 10.13 :
|
||||
m_textActive = wxColour(0x40, 0x40, 0x40);
|
||||
m_textInactive = wxColour(0x4B, 0x4B, 0x4B);
|
||||
m_bgActiveFrom = wxColour(0xE9, 0xE7, 0xEA);
|
||||
m_bgActiveTo = wxColour(0xCD, 0xCB, 0xCE);
|
||||
m_borderActive = wxColour(0xBA, 0xB8, 0xBB);
|
||||
m_borderInactive = wxColour(0xC3, 0xC3, 0xC3);
|
||||
SetBackgroundColour(wxColour(0xF4, 0xF4, 0xF4)); // inactive bg
|
||||
}
|
||||
#endif // __MAC_OS_X_VERSION_MIN_REQUIRED < 101000
|
||||
}
|
||||
|
||||
void wxStatusBarMac::DrawFieldText(wxDC& dc, const wxRect& rect, int i, int textHeight)
|
||||
|
@@ -105,86 +105,8 @@ bool wxNSColorRefData::IsSolid() const
|
||||
|
||||
CGColorRef wxNSColorRefData::GetCGColor() const
|
||||
{
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
|
||||
if ( WX_IS_MACOS_AVAILABLE(10, 8) ) {
|
||||
wxOSXEffectiveAppearanceSetter helper;
|
||||
return [m_nsColour CGColor];
|
||||
}
|
||||
#endif
|
||||
CGColorRef cgcolor = NULL;
|
||||
|
||||
// Simplest case is when we can directly get the RGBA components:
|
||||
if (NSColor* colRGBA = [m_nsColour colorUsingColorSpaceName:NSCalibratedRGBColorSpace])
|
||||
{
|
||||
CGFloat components[4];
|
||||
[colRGBA getRed:&components[0] green:&components[1] blue:&components[2] alpha:&components[3]];
|
||||
|
||||
cgcolor = CGColorCreate(wxMacGetGenericRGBColorSpace(), components);
|
||||
}
|
||||
// Some colours use patterns, we can handle them with the help of CGColorRef
|
||||
else if (NSColor* colPat = [m_nsColour colorUsingColorSpaceName:NSPatternColorSpace])
|
||||
{
|
||||
NSImage* const nsimage = [colPat patternImage];
|
||||
if (nsimage)
|
||||
{
|
||||
NSSize size = [nsimage size];
|
||||
NSRect r = NSMakeRect(0, 0, size.width, size.height);
|
||||
CGImageRef cgimage = [nsimage CGImageForProposedRect:&r context:nil hints:nil];
|
||||
if (cgimage)
|
||||
{
|
||||
// Callbacks for CGPatternCreate()
|
||||
struct PatternCreateCallbacks
|
||||
{
|
||||
static void Draw(void* info, CGContextRef ctx)
|
||||
{
|
||||
CGImageRef image = (CGImageRef)info;
|
||||
CGContextDrawImage(
|
||||
ctx,
|
||||
CGRectMake(0, 0, CGImageGetWidth(image), CGImageGetHeight(image)),
|
||||
image);
|
||||
}
|
||||
|
||||
static void Release(void* WXUNUSED(info))
|
||||
{
|
||||
// Do not release the image here, we don't own it as it
|
||||
// comes from NSImage.
|
||||
}
|
||||
};
|
||||
|
||||
const CGPatternCallbacks callbacks = {
|
||||
/* version: */ 0,
|
||||
&PatternCreateCallbacks::Draw,
|
||||
&PatternCreateCallbacks::Release
|
||||
};
|
||||
|
||||
CGPatternRef pattern = CGPatternCreate(
|
||||
cgimage,
|
||||
CGRectMake(0, 0, size.width, size.height),
|
||||
CGAffineTransformMake(1, 0, 0, 1, 0, 0),
|
||||
size.width,
|
||||
size.height,
|
||||
kCGPatternTilingConstantSpacing,
|
||||
/* isColored: */ true,
|
||||
&callbacks
|
||||
);
|
||||
CGColorSpaceRef space = CGColorSpaceCreatePattern(NULL);
|
||||
CGFloat components[1] = { 1.0 };
|
||||
cgcolor = CGColorCreateWithPattern(space, pattern, components);
|
||||
CGColorSpaceRelease(space);
|
||||
CGPatternRelease(pattern);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cgcolor == NULL)
|
||||
{
|
||||
// Don't assert here, this will more likely than not result in a crash as
|
||||
// colours are often created in drawing code which will be called again
|
||||
// when the assert dialog is shown, resulting in a recursive assertion
|
||||
// failure and, hence, a crash.
|
||||
NSLog(@"Failed to convert NSColor \"%@\" to CGColorRef.", m_nsColour);
|
||||
}
|
||||
return cgcolor;
|
||||
wxOSXEffectiveAppearanceSetter helper;
|
||||
return [m_nsColour CGColor];
|
||||
}
|
||||
|
||||
WX_NSImage wxNSColorRefData::GetNSPatternImage() const
|
||||
|
@@ -3042,12 +3042,7 @@ bool wxDataViewTextRenderer::MacRender()
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10
|
||||
if ( WX_IS_MACOS_AVAILABLE(10, 10) )
|
||||
{
|
||||
[par setTighteningFactorForTruncation:0.0];
|
||||
}
|
||||
#endif
|
||||
[par setTighteningFactorForTruncation:0.0];
|
||||
|
||||
[str addAttribute:NSParagraphStyleAttributeName
|
||||
value:par
|
||||
|
@@ -33,7 +33,7 @@
|
||||
#include "wx/osx/private.h"
|
||||
#include "wx/osx/private/available.h"
|
||||
|
||||
#if wxOSX_USE_COCOA && __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 && defined(__LP64__)
|
||||
#if wxOSX_USE_COCOA && defined(__LP64__)
|
||||
#define wxOSX_USE_AVKIT 1
|
||||
#else
|
||||
#define wxOSX_USE_AVKIT 0
|
||||
@@ -277,7 +277,6 @@ private:
|
||||
|
||||
#if wxOSX_USE_AVKIT
|
||||
|
||||
WX_API_AVAILABLE_MACOS(10, 10)
|
||||
@interface wxAVPlayerView : AVPlayerView
|
||||
{
|
||||
}
|
||||
@@ -397,18 +396,12 @@ bool wxAVMediaBackend::CreateControl(wxControl* inctrl, wxWindow* parent,
|
||||
|
||||
WXWidget view = NULL;
|
||||
#if wxOSX_USE_AVKIT
|
||||
if ( WX_IS_MACOS_AVAILABLE(10, 10) )
|
||||
{
|
||||
view = [[wxAVPlayerView alloc] initWithFrame: r player:m_player];
|
||||
[(wxAVPlayerView*) view setControlsStyle:AVPlayerViewControlsStyleNone];
|
||||
}
|
||||
view = [[wxAVPlayerView alloc] initWithFrame: r player:m_player];
|
||||
[(wxAVPlayerView*) view setControlsStyle:AVPlayerViewControlsStyleNone];
|
||||
#else
|
||||
view = [[wxAVView alloc] initWithFrame: r player:m_player];
|
||||
#endif
|
||||
|
||||
if ( view == NULL )
|
||||
{
|
||||
view = [[wxAVView alloc] initWithFrame: r player:m_player];
|
||||
}
|
||||
|
||||
#if wxOSX_USE_IPHONE
|
||||
wxWidgetIPhoneImpl* impl = new wxWidgetIPhoneImpl(mediactrl,view);
|
||||
#else
|
||||
@@ -565,17 +558,14 @@ bool wxAVMediaBackend::ShowPlayerControls(wxMediaCtrlPlayerControls flags)
|
||||
void wxAVMediaBackend::DoShowPlayerControls(wxMediaCtrlPlayerControls flags)
|
||||
{
|
||||
#if wxOSX_USE_AVKIT
|
||||
if ( WX_IS_MACOS_AVAILABLE(10, 10) )
|
||||
NSView* view = m_ctrl->GetHandle();
|
||||
if ( [view isKindOfClass:[wxAVPlayerView class]] )
|
||||
{
|
||||
NSView* view = m_ctrl->GetHandle();
|
||||
if ( [view isKindOfClass:[wxAVPlayerView class]] )
|
||||
{
|
||||
wxAVPlayerView* playerView = (wxAVPlayerView*) view;
|
||||
if (flags == wxMEDIACTRLPLAYERCONTROLS_NONE )
|
||||
playerView.controlsStyle = AVPlayerViewControlsStyleNone;
|
||||
else
|
||||
playerView.controlsStyle = AVPlayerViewControlsStyleDefault;
|
||||
}
|
||||
wxAVPlayerView* playerView = (wxAVPlayerView*) view;
|
||||
if (flags == wxMEDIACTRLPLAYERCONTROLS_NONE )
|
||||
playerView.controlsStyle = AVPlayerViewControlsStyleNone;
|
||||
else
|
||||
playerView.controlsStyle = AVPlayerViewControlsStyleDefault;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@@ -32,9 +32,7 @@
|
||||
|
||||
#include "wx/osx/private.h"
|
||||
#include "wx/osx/private/available.h"
|
||||
#include "wx/generic/notifmsg.h"
|
||||
#include "wx/private/notifmsg.h"
|
||||
#include "wx/generic/private/notifmsg.h"
|
||||
#include "wx/timer.h"
|
||||
#include "wx/platinfo.h"
|
||||
#include "wx/artprov.h"
|
||||
@@ -44,7 +42,6 @@
|
||||
#include "wx/utils.h"
|
||||
#include <map>
|
||||
|
||||
WX_API_AVAILABLE_MACOS(10, 8)
|
||||
@interface wxUserNotificationHandler : NSObject <NSUserNotificationCenterDelegate>
|
||||
|
||||
@end
|
||||
@@ -53,7 +50,7 @@ WX_API_AVAILABLE_MACOS(10, 8)
|
||||
// wxUserNotificationMsgImpl
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WX_API_AVAILABLE_MACOS(10, 8) wxUserNotificationMsgImpl : public wxNotificationMessageImpl
|
||||
class wxUserNotificationMsgImpl : public wxNotificationMessageImpl
|
||||
{
|
||||
public:
|
||||
wxUserNotificationMsgImpl(wxNotificationMessageBase* notification) :
|
||||
@@ -121,11 +118,7 @@ public:
|
||||
|
||||
virtual void SetIcon(const wxIcon& icon) wxOVERRIDE
|
||||
{
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9
|
||||
// Additional icon in the notification is only supported on OS X 10.9+
|
||||
if ( WX_IS_MACOS_AVAILABLE(10, 9) )
|
||||
m_notif.contentImage = icon.GetNSImage();
|
||||
#endif
|
||||
m_notif.contentImage = icon.GetNSImage();
|
||||
}
|
||||
|
||||
virtual bool AddAction(wxWindowID actionid, const wxString &label) wxOVERRIDE
|
||||
@@ -247,12 +240,7 @@ int wxUserNotificationMsgImpl::ms_notifIdBase = 1000;
|
||||
|
||||
void wxNotificationMessage::Init()
|
||||
{
|
||||
// Native notifications are not available prior to 10.8, fallback
|
||||
// to generic ones on 10.7
|
||||
if ( WX_IS_MACOS_AVAILABLE(10, 8) )
|
||||
m_impl = new wxUserNotificationMsgImpl(this);
|
||||
else
|
||||
m_impl = new wxGenericNotificationMessageImpl(this);
|
||||
m_impl = new wxUserNotificationMsgImpl(this);
|
||||
}
|
||||
|
||||
#endif // wxUSE_NOTIFICATION_MESSAGE && defined(wxHAS_NATIVE_NOTIFICATION_MESSAGE)
|
||||
|
@@ -37,73 +37,31 @@ bool UpdatePowerResourceUsage(wxPowerResourceKind kind, const wxString& reason)
|
||||
if( reason.IsEmpty())
|
||||
cfreason = wxString("User Activity");
|
||||
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9
|
||||
if ( WX_IS_MACOS_AVAILABLE(10, 9) )
|
||||
if ( !g_processInfoActivity )
|
||||
{
|
||||
// Use NSProcessInfo for 10.9 and newer
|
||||
if ( !g_processInfoActivity )
|
||||
{
|
||||
NSActivityOptions
|
||||
options = NSActivityUserInitiated |
|
||||
NSActivityIdleSystemSleepDisabled;
|
||||
NSActivityOptions
|
||||
options = NSActivityUserInitiated |
|
||||
NSActivityIdleSystemSleepDisabled;
|
||||
|
||||
if ( kind == wxPOWER_RESOURCE_SCREEN )
|
||||
options |= NSActivityIdleDisplaySleepDisabled;
|
||||
|
||||
g_processInfoActivity = [[NSProcessInfo processInfo]
|
||||
beginActivityWithOptions:options
|
||||
reason:cfreason.AsNSString()];
|
||||
[g_processInfoActivity retain];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if ( !g_pmAssertionID )
|
||||
{
|
||||
CFStringRef assertType;
|
||||
if ( kind == wxPOWER_RESOURCE_SCREEN )
|
||||
assertType = kIOPMAssertionTypeNoDisplaySleep;
|
||||
else
|
||||
assertType = kIOPMAssertionTypeNoIdleSleep;
|
||||
options |= NSActivityIdleDisplaySleepDisabled;
|
||||
|
||||
// Use power manager API for < 10.9 systems
|
||||
IOReturn success = IOPMAssertionCreateWithName
|
||||
(
|
||||
assertType,
|
||||
kIOPMAssertionLevelOn,
|
||||
cfreason,
|
||||
&g_pmAssertionID
|
||||
);
|
||||
if ( success == kIOReturnSuccess )
|
||||
return true;
|
||||
g_processInfoActivity = [[NSProcessInfo processInfo]
|
||||
beginActivityWithOptions:options
|
||||
reason:cfreason.AsNSString()];
|
||||
[g_processInfoActivity retain];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if ( g_powerResourceSystemRefCount == 0 )
|
||||
{
|
||||
// Release power assertion
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9
|
||||
if ( WX_IS_MACOS_AVAILABLE(10, 9) )
|
||||
if ( g_processInfoActivity )
|
||||
{
|
||||
// Use NSProcessInfo for 10.9 and newer
|
||||
if ( g_processInfoActivity )
|
||||
{
|
||||
[[NSProcessInfo processInfo]
|
||||
endActivity:(id)g_processInfoActivity];
|
||||
g_processInfoActivity = nil;
|
||||
[[NSProcessInfo processInfo]
|
||||
endActivity:(id)g_processInfoActivity];
|
||||
g_processInfoActivity = nil;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if ( g_pmAssertionID )
|
||||
{
|
||||
// Use power manager API for < 10.9 systems
|
||||
IOReturn success = IOPMAssertionRelease(g_pmAssertionID);
|
||||
g_pmAssertionID = 0;
|
||||
if (success == kIOReturnSuccess)
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -350,16 +350,8 @@ void wxBell()
|
||||
ProcessSerialNumber psn = { 0, kCurrentProcess };
|
||||
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
|
||||
|
||||
if ( WX_IS_MACOS_AVAILABLE(10, 9) )
|
||||
{
|
||||
[[NSRunningApplication currentApplication] activateWithOptions:
|
||||
(NSApplicationActivateAllWindows | NSApplicationActivateIgnoringOtherApps)];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self deactivate];
|
||||
[self activateIgnoringOtherApps:YES];
|
||||
}
|
||||
[[NSRunningApplication currentApplication] activateWithOptions:
|
||||
(NSApplicationActivateAllWindows | NSApplicationActivateIgnoringOtherApps)];
|
||||
}
|
||||
|
||||
|
||||
|
@@ -24,11 +24,6 @@
|
||||
#include "wx/osx/private.h"
|
||||
#include "wx/osx/private/available.h"
|
||||
|
||||
#if (defined(__WXOSX_COCOA__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10) \
|
||||
|| (defined(__WXOSX_IPHONE__) && defined(__IPHONE_8_0))
|
||||
#define wxHAS_NSPROCESSINFO 1
|
||||
#endif
|
||||
|
||||
#if wxUSE_SOCKETS
|
||||
// global pointer which lives in the base library, set from the net one (see
|
||||
// sockosx.cpp) and used from the GUI code (see utilsexc_cf.cpp) -- ugly but
|
||||
@@ -41,90 +36,28 @@ wxSocketManager *wxOSXSocketManagerCF = NULL;
|
||||
// our OS version is the same in non GUI and GUI cases
|
||||
wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin, int *verMicro)
|
||||
{
|
||||
#ifdef wxHAS_NSPROCESSINFO
|
||||
// Note: we don't use WX_IS_MACOS_AVAILABLE() here because these properties
|
||||
// are only officially supported since 10.10, but are actually available
|
||||
// under 10.9 too, so we prefer to check for them explicitly and suppress
|
||||
// the warnings that using without a __builtin_available() check around
|
||||
// them generates.
|
||||
wxCLANG_WARNING_SUPPRESS(unguarded-availability)
|
||||
NSOperatingSystemVersion osVer = [NSProcessInfo processInfo].operatingSystemVersion;
|
||||
|
||||
if ([NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)])
|
||||
{
|
||||
NSOperatingSystemVersion osVer = [NSProcessInfo processInfo].operatingSystemVersion;
|
||||
if ( verMaj != NULL )
|
||||
*verMaj = osVer.majorVersion;
|
||||
|
||||
if ( verMaj != NULL )
|
||||
*verMaj = osVer.majorVersion;
|
||||
if ( verMin != NULL )
|
||||
*verMin = osVer.minorVersion;
|
||||
|
||||
if ( verMin != NULL )
|
||||
*verMin = osVer.minorVersion;
|
||||
|
||||
if ( verMicro != NULL )
|
||||
*verMicro = osVer.patchVersion;
|
||||
}
|
||||
|
||||
wxCLANG_WARNING_RESTORE(unguarded-availability)
|
||||
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// On OS X versions prior to 10.10 NSProcessInfo does not provide the OS version
|
||||
// Deprecated Gestalt calls are required instead
|
||||
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
|
||||
SInt32 maj, min, micro;
|
||||
#ifdef __WXOSX_IPHONE__
|
||||
maj = 7;
|
||||
min = 0;
|
||||
micro = 0;
|
||||
#else
|
||||
Gestalt(gestaltSystemVersionMajor, &maj);
|
||||
Gestalt(gestaltSystemVersionMinor, &min);
|
||||
Gestalt(gestaltSystemVersionBugFix, µ);
|
||||
#endif
|
||||
wxGCC_WARNING_RESTORE()
|
||||
|
||||
if ( verMaj != NULL )
|
||||
*verMaj = maj;
|
||||
|
||||
if ( verMin != NULL )
|
||||
*verMin = min;
|
||||
|
||||
if ( verMicro != NULL )
|
||||
*verMicro = micro;
|
||||
}
|
||||
if ( verMicro != NULL )
|
||||
*verMicro = osVer.patchVersion;
|
||||
|
||||
return wxOS_MAC_OSX_DARWIN;
|
||||
}
|
||||
|
||||
bool wxCheckOsVersion(int majorVsn, int minorVsn, int microVsn)
|
||||
{
|
||||
#ifdef wxHAS_NSPROCESSINFO
|
||||
// As above, this API is effectively available earlier than its
|
||||
// availability attribute indicates, so check for it manually.
|
||||
wxCLANG_WARNING_SUPPRESS(unguarded-availability)
|
||||
NSOperatingSystemVersion osVer;
|
||||
osVer.majorVersion = majorVsn;
|
||||
osVer.minorVersion = minorVsn;
|
||||
osVer.patchVersion = microVsn;
|
||||
|
||||
if ([NSProcessInfo instancesRespondToSelector:@selector(isOperatingSystemAtLeastVersion:)])
|
||||
{
|
||||
NSOperatingSystemVersion osVer;
|
||||
osVer.majorVersion = majorVsn;
|
||||
osVer.minorVersion = minorVsn;
|
||||
osVer.patchVersion = microVsn;
|
||||
|
||||
return [[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:osVer] != NO;
|
||||
}
|
||||
|
||||
wxCLANG_WARNING_RESTORE(unguarded-availability)
|
||||
|
||||
else
|
||||
#endif
|
||||
{
|
||||
int majorCur, minorCur, microCur;
|
||||
wxGetOsVersion(&majorCur, &minorCur, µCur);
|
||||
|
||||
return majorCur > majorVsn
|
||||
|| (majorCur == majorVsn && minorCur >= minorVsn)
|
||||
|| (majorCur == majorVsn && minorCur == minorVsn && microCur >= microVsn);
|
||||
}
|
||||
return [[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:osVer] != NO;
|
||||
}
|
||||
|
||||
wxString wxGetOsDescription()
|
||||
@@ -238,67 +171,59 @@ bool wxCocoaLaunch(const char* const* argv, pid_t &pid)
|
||||
}
|
||||
|
||||
NSMutableArray *params = [[NSMutableArray alloc] init];
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10
|
||||
if ( WX_IS_MACOS_AVAILABLE(10, 10) )
|
||||
|
||||
// Loop through command line arguments to the bundle,
|
||||
// turn them into CFURLs and then put them in cfaFiles
|
||||
// For use to launch services call
|
||||
for( ; *argv != NULL; ++argv )
|
||||
{
|
||||
// Loop through command line arguments to the bundle,
|
||||
// turn them into CFURLs and then put them in cfaFiles
|
||||
// For use to launch services call
|
||||
for( ; *argv != NULL; ++argv )
|
||||
NSURL *cfurlCurrentFile;
|
||||
wxString dir( *argv );
|
||||
if( wxFileName::DirExists(dir) )
|
||||
{
|
||||
NSURL *cfurlCurrentFile;
|
||||
wxString dir( *argv );
|
||||
if( wxFileName::DirExists(dir) )
|
||||
{
|
||||
// First, try creating as a directory
|
||||
cfurlCurrentFile = [NSURL fileURLWithPath:wxCFStringRef(dir).AsNSString() isDirectory:YES];
|
||||
}
|
||||
else if( wxFileName::FileExists(dir) )
|
||||
{
|
||||
// And if it isn't a directory try creating it
|
||||
// as a regular file
|
||||
cfurlCurrentFile = [NSURL fileURLWithPath:wxCFStringRef(dir).AsNSString() isDirectory:NO];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Argument did not refer to
|
||||
// an entry in the local filesystem,
|
||||
// so try creating it through CFURLCreateWithString
|
||||
cfurlCurrentFile = [NSURL URLWithString:wxCFStringRef(dir).AsNSString()];
|
||||
}
|
||||
|
||||
// Continue in the loop if the CFURL could not be created
|
||||
if(cfurlCurrentFile == nil)
|
||||
{
|
||||
wxLogDebug(
|
||||
wxT("wxCocoaLaunch Could not create NSURL for argument:%s"),
|
||||
*argv);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add the valid CFURL to the argument array and then
|
||||
// release it as the CFArray adds a ref count to it
|
||||
[params addObject:cfurlCurrentFile];
|
||||
// First, try creating as a directory
|
||||
cfurlCurrentFile = [NSURL fileURLWithPath:wxCFStringRef(dir).AsNSString() isDirectory:YES];
|
||||
}
|
||||
else if( wxFileName::FileExists(dir) )
|
||||
{
|
||||
// And if it isn't a directory try creating it
|
||||
// as a regular file
|
||||
cfurlCurrentFile = [NSURL fileURLWithPath:wxCFStringRef(dir).AsNSString() isDirectory:NO];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Argument did not refer to
|
||||
// an entry in the local filesystem,
|
||||
// so try creating it through CFURLCreateWithString
|
||||
cfurlCurrentFile = [NSURL URLWithString:wxCFStringRef(dir).AsNSString()];
|
||||
}
|
||||
|
||||
// Continue in the loop if the CFURL could not be created
|
||||
if(cfurlCurrentFile == nil)
|
||||
{
|
||||
wxLogDebug(
|
||||
wxT("wxCocoaLaunch Could not create NSURL for argument:%s"),
|
||||
*argv);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add the valid CFURL to the argument array and then
|
||||
// release it as the CFArray adds a ref count to it
|
||||
[params addObject:cfurlCurrentFile];
|
||||
}
|
||||
#endif
|
||||
|
||||
NSWorkspace *ws = [NSWorkspace sharedWorkspace];
|
||||
|
||||
|
||||
NSRunningApplication *app = nil;
|
||||
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10
|
||||
if ( WX_IS_MACOS_AVAILABLE(10, 10) )
|
||||
{
|
||||
if ( [params count] > 0 )
|
||||
app = [ws openURLs:params withApplicationAtURL:url
|
||||
options:NSWorkspaceLaunchAsync
|
||||
configuration:[NSDictionary dictionary]
|
||||
error:&error];
|
||||
}
|
||||
if ( [params count] > 0 )
|
||||
app = [ws openURLs:params withApplicationAtURL:url
|
||||
options:NSWorkspaceLaunchAsync
|
||||
configuration:[NSDictionary dictionary]
|
||||
error:&error];
|
||||
|
||||
if ( app == nil )
|
||||
#endif
|
||||
{
|
||||
app = [ws launchApplicationAtURL:url
|
||||
options:NSWorkspaceLaunchAsync
|
||||
|
@@ -1128,8 +1128,6 @@ void wxOSX_insertText(NSView* self, SEL _cmd, NSString* text)
|
||||
impl->insertText(text, self, _cmd);
|
||||
}
|
||||
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10
|
||||
WX_API_AVAILABLE_MACOS(10, 10)
|
||||
void wxOSX_panGestureEvent(NSView* self, SEL _cmd, NSPanGestureRecognizer* panGestureRecognizer)
|
||||
{
|
||||
wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
|
||||
@@ -1139,7 +1137,6 @@ void wxOSX_panGestureEvent(NSView* self, SEL _cmd, NSPanGestureRecognizer* panGe
|
||||
impl->PanGestureEvent(panGestureRecognizer);
|
||||
}
|
||||
|
||||
WX_API_AVAILABLE_MACOS(10, 10)
|
||||
void wxOSX_zoomGestureEvent(NSView* self, SEL _cmd, NSMagnificationGestureRecognizer* magnificationGestureRecognizer)
|
||||
{
|
||||
wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
|
||||
@@ -1149,7 +1146,6 @@ void wxOSX_zoomGestureEvent(NSView* self, SEL _cmd, NSMagnificationGestureRecogn
|
||||
impl->ZoomGestureEvent(magnificationGestureRecognizer);
|
||||
}
|
||||
|
||||
WX_API_AVAILABLE_MACOS(10, 10)
|
||||
void wxOSX_rotateGestureEvent(NSView* self, SEL _cmd, NSRotationGestureRecognizer* rotationGestureRecognizer)
|
||||
{
|
||||
wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
|
||||
@@ -1159,7 +1155,6 @@ void wxOSX_rotateGestureEvent(NSView* self, SEL _cmd, NSRotationGestureRecognize
|
||||
impl->RotateGestureEvent(rotationGestureRecognizer);
|
||||
}
|
||||
|
||||
WX_API_AVAILABLE_MACOS(10, 10)
|
||||
void wxOSX_longPressEvent(NSView* self, SEL _cmd, NSPressGestureRecognizer* pressGestureRecognizer)
|
||||
{
|
||||
wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
|
||||
@@ -1169,7 +1164,6 @@ void wxOSX_longPressEvent(NSView* self, SEL _cmd, NSPressGestureRecognizer* pres
|
||||
impl->LongPressEvent(pressGestureRecognizer);
|
||||
}
|
||||
|
||||
WX_API_AVAILABLE_MACOS(10, 10)
|
||||
void wxOSX_touchesBegan(NSView* self, SEL _cmd, NSEvent *event)
|
||||
{
|
||||
wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
|
||||
@@ -1179,7 +1173,6 @@ void wxOSX_touchesBegan(NSView* self, SEL _cmd, NSEvent *event)
|
||||
impl->TouchesBegan(event);
|
||||
}
|
||||
|
||||
WX_API_AVAILABLE_MACOS(10, 10)
|
||||
void wxOSX_touchesMoved(NSView* self, SEL _cmd, NSEvent *event)
|
||||
{
|
||||
wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
|
||||
@@ -1189,7 +1182,6 @@ void wxOSX_touchesMoved(NSView* self, SEL _cmd, NSEvent *event)
|
||||
impl->TouchesMoved(event);
|
||||
}
|
||||
|
||||
WX_API_AVAILABLE_MACOS(10, 10)
|
||||
void wxOSX_touchesEnded(NSView* self, SEL _cmd, NSEvent *event)
|
||||
{
|
||||
wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
|
||||
@@ -1198,7 +1190,6 @@ void wxOSX_touchesEnded(NSView* self, SEL _cmd, NSEvent *event)
|
||||
|
||||
impl->TouchesEnded(event);
|
||||
}
|
||||
#endif // __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10
|
||||
|
||||
BOOL wxOSX_acceptsFirstResponder(NSView* self, SEL _cmd)
|
||||
{
|
||||
@@ -1577,10 +1568,8 @@ void wxWidgetCocoaImpl::keyEvent(WX_NSEvent event, WXWidget slf, void *_cmd)
|
||||
m_lastKeyDownEvent = NULL;
|
||||
}
|
||||
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10
|
||||
|
||||
// Class containing data used for gestures support.
|
||||
class WX_API_AVAILABLE_MACOS(10, 10) wxCocoaGesturesImpl
|
||||
class wxCocoaGesturesImpl
|
||||
{
|
||||
public:
|
||||
wxCocoaGesturesImpl(wxWidgetCocoaImpl* impl, NSView* view, int eventsMask)
|
||||
@@ -2140,7 +2129,6 @@ void wxCocoaGesturesImpl::TouchesEnded(NSEvent* event)
|
||||
m_activeGestures &= ~press_and_tap;
|
||||
}
|
||||
}
|
||||
#endif // __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10
|
||||
|
||||
void wxWidgetCocoaImpl::insertText(NSString* text, WXWidget slf, void *_cmd)
|
||||
{
|
||||
@@ -2577,9 +2565,7 @@ wxWidgetCocoaImpl::~wxWidgetCocoaImpl()
|
||||
if ( m_osxView )
|
||||
CFRelease(m_osxView);
|
||||
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10
|
||||
wxCocoaGestures::EraseForObject(this);
|
||||
#endif // __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10
|
||||
}
|
||||
|
||||
bool wxWidgetCocoaImpl::IsVisible() const
|
||||
@@ -3598,37 +3584,32 @@ void wxWidgetCocoaImpl::InstallEventHandler( WXWidget control )
|
||||
|
||||
bool wxWidgetCocoaImpl::EnableTouchEvents(int eventsMask)
|
||||
{
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10
|
||||
if ( WX_IS_MACOS_AVAILABLE(10, 10) )
|
||||
if ( HasUserMouseHandling() )
|
||||
{
|
||||
if ( HasUserMouseHandling() )
|
||||
if ( eventsMask == wxTOUCH_NONE )
|
||||
{
|
||||
if ( eventsMask == wxTOUCH_NONE )
|
||||
if ( wxCocoaGestures::EraseForObject(this) )
|
||||
{
|
||||
if ( wxCocoaGestures::EraseForObject(this) )
|
||||
{
|
||||
[m_osxView setAcceptsTouchEvents:NO];
|
||||
}
|
||||
//else: we didn't have any gesture data anyhow
|
||||
[m_osxView setAcceptsTouchEvents:NO];
|
||||
}
|
||||
else // We do want to have gesture events.
|
||||
{
|
||||
// clang does not see that the owning object always destroys its extra field
|
||||
//else: we didn't have any gesture data anyhow
|
||||
}
|
||||
else // We do want to have gesture events.
|
||||
{
|
||||
// clang does not see that the owning object always destroys its extra field
|
||||
#ifndef __clang_analyzer__
|
||||
wxCocoaGestures::StoreForObject
|
||||
(
|
||||
this,
|
||||
new wxCocoaGesturesImpl(this, m_osxView, eventsMask)
|
||||
);
|
||||
wxCocoaGestures::StoreForObject
|
||||
(
|
||||
this,
|
||||
new wxCocoaGesturesImpl(this, m_osxView, eventsMask)
|
||||
);
|
||||
#endif
|
||||
|
||||
[m_osxView setAcceptsTouchEvents:YES];
|
||||
}
|
||||
|
||||
return true;
|
||||
[m_osxView setAcceptsTouchEvents:YES];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif // __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10
|
||||
|
||||
wxUnusedVar(eventsMask);
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user