Skip to content

Commit

Permalink
possible fix for #389
Browse files Browse the repository at this point in the history
  • Loading branch information
koral-- committed Mar 3, 2017
1 parent 01f6438 commit 3d089e0
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 26 deletions.
11 changes: 5 additions & 6 deletions android-gif-drawable/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,18 @@ android {
externalNativeBuild {
cmake {
arguments "-DANDROID_PLATFORM=android-$versions.minSdk"
cFlags '-std=c11'
if (isDebugBuild()) {
cFlags '-Wall', '-Weverything', '-std=c11', '-DDEBUG'
arguments 'NDK_DEBUG=1'
cFlags '-DDEBUG', '-Weverything', '-Wall'
} else {
cFlags '-std=c11', '-DNDEBUG', '-Os', '-g0', '-fvisibility=hidden'
arguments 'NDK_DEBUG=0'
cFlags '-DNDEBUG', '-Os', '-g0', '-fvisibility=hidden'
}
}
}
}
externalNativeBuild {
ndkBuild {
path 'src/main/c/Android.mk'
cmake {
path 'src/main/c/CMakeLists.txt'
}
}
testBuildType 'release'
Expand Down
21 changes: 14 additions & 7 deletions android-gif-drawable/src/main/c/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
cmake_minimum_required(VERSION 3.4.1)
enable_language(ASM)

add_library(pl_droidsonroids_gif SHARED
set(SOURCES)
list(APPEND SOURCES
drawing.c
gif.c
metadata.c
memset32_neon.S
bitmap.c
decoding.c
exception.c
time.c
control.c
memset.arm.S
surface.c
opengl.c
jni.c
Expand All @@ -20,7 +20,14 @@ add_library(pl_droidsonroids_gif SHARED
giflib/gifalloc.c
giflib/openbsd-reallocarray.c)

target_link_libraries(pl_droidsonroids_gif
jnigraphics
android
GLESv2)

add_library(pl_droidsonroids_gif SHARED ${SOURCES})

set(LIBS)
list(APPEND LIBS
jnigraphics
android
GLESv2
)

target_link_libraries(pl_droidsonroids_gif ${LIBS})
16 changes: 8 additions & 8 deletions android-gif-drawable/src/main/c/drawing.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include "gif.h"

#if defined (__arm__)
extern void arm_memset32(uint32_t* dst, uint32_t value, int count);
#define MEMSET_ARGB(dst, value, count) arm_memset32(dst, value, (int) count)
#elif defined (__ARM_ARCH_7A__)
extern void memset32_neon(uint32_t* dst, uint32_t value, int count);
#define MEMSET_ARGB(dst, value, count) memset32_neon(dst, value, (int) count)
#else
//#if defined (__arm__)
//extern void arm_memset32(uint32_t* dst, uint32_t value, int count);
//#define MEMSET_ARGB(dst, value, count) arm_memset32(dst, value, (int) count)
//#elif defined (__ARM_ARCH_7A__)
//extern void memset32_neon(uint32_t* dst, uint32_t value, int count);
//#define MEMSET_ARGB(dst, value, count) memset32_neon(dst, value, (int) count)
//#else
#define MEMSET_ARGB(dst, value, count) memset(dst, value, count * sizeof(argb))
#endif
//#endif

static inline void blitNormal(argb *bm, GifInfo *info, SavedImage *frame, ColorMapObject *cmap) {
unsigned char *src = info->rasterBits;
Expand Down
4 changes: 1 addition & 3 deletions android-gif-drawable/src/main/c/memset.arm.S
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
* code which was specified as a count of bytes. More verbose comments
* to aid future maintenance.
*/
#ifdef __arm__
.text
.align 4
.syntax unified
Expand Down Expand Up @@ -87,5 +86,4 @@ arm_memset32:

.Lfinish:
pop {pc}
.fnend
#endif
.fnend
3 changes: 1 addition & 2 deletions android-gif-drawable/src/main/c/memset32_neon.S
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
***************************************************************************/
#ifdef __ARM_ARCH_7A__

.syntax unified
.code 32
.fpu neon
Expand Down Expand Up @@ -111,4 +111,3 @@ str r1, [r0, #0]
bx lr

.end
#endif

0 comments on commit 3d089e0

Please sign in to comment.