diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-09-05 01:27:19 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-09-05 01:27:19 +0200 |
commit | 1d56a11d38e7dec9653c366666f89beb09c740f9 (patch) | |
tree | 08b52e0f3a6d4012b5d9790d34d7efad56236e8f | |
parent | m + implement C code from GammaRamps (diff) | |
download | jlibgamma-1d56a11d38e7dec9653c366666f89beb09c740f9.tar.gz jlibgamma-1d56a11d38e7dec9653c366666f89beb09c740f9.tar.bz2 jlibgamma-1d56a11d38e7dec9653c366666f89beb09c740f9.tar.xz |
m + implement c code for ramp
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | src/libgamma_AdjustmentMethod.c | 9 | ||||
-rw-r--r-- | src/libgamma_CRTC.c | 9 | ||||
-rw-r--r-- | src/libgamma_GammaRamps.c | 21 | ||||
-rw-r--r-- | src/libgamma_LibgammaException.c | 9 | ||||
-rw-r--r-- | src/libgamma_Partition.c | 9 | ||||
-rw-r--r-- | src/libgamma_Ramp.c | 117 | ||||
-rw-r--r-- | src/libgamma_Site.c | 9 |
8 files changed, 117 insertions, 70 deletions
@@ -88,10 +88,10 @@ CC_JNI_FLAGS = -I$(JAVA_HOME)/include LD_JNI_FLAGS = # Flags to use when compiling C code -CC_FLAGS = -std=$(STD) $(C_OPTIMISE) $(CFLAGS) $(PIC) $(CPPFLAGS) $(WARN) +CC_FLAGS = -std=$(STD) $(C_OPTIMISE) $(CFLAGS) $(PIC) $(CPPFLAGS) $(C_WARN) # Flags to use when linking native objects -LD_FLAGS = -lgamma -std=$(STD) $(C_OPTIMISE) $(LDFLAGS) $(WARN) +LD_FLAGS = -lgamma -std=$(STD) $(C_OPTIMISE) $(LDFLAGS) $(C_WARN) # Flags to use when compiling Java code JAVAC_FLAGS = $(JAVACFLAGS) $(JAVA_OPTIMISE) $(JAVA_WARN) diff --git a/src/libgamma_AdjustmentMethod.c b/src/libgamma_AdjustmentMethod.c index a8cfcb7..2135238 100644 --- a/src/libgamma_AdjustmentMethod.c +++ b/src/libgamma_AdjustmentMethod.c @@ -20,14 +20,7 @@ #include <libgamma.h> -#ifndef __GCC__ -# ifndef __attribute__ -# define __attribute__(X) /* empty */ -# endif -#endif - - -#define J JNIEnv* env, jclass __attribute__((unused)) class +#define J JNIEnv* env, jclass class diff --git a/src/libgamma_CRTC.c b/src/libgamma_CRTC.c index b188b6d..947f5de 100644 --- a/src/libgamma_CRTC.c +++ b/src/libgamma_CRTC.c @@ -20,14 +20,7 @@ #include <libgamma.h> -#ifndef __GCC__ -# ifndef __attribute__ -# define __attribute__(X) /* empty */ -# endif -#endif - - -#define J JNIEnv* env, jclass __attribute__((unused)) class +#define J JNIEnv* env, jclass class diff --git a/src/libgamma_GammaRamps.c b/src/libgamma_GammaRamps.c index 169af46..aa91a0f 100644 --- a/src/libgamma_GammaRamps.c +++ b/src/libgamma_GammaRamps.c @@ -23,14 +23,7 @@ #include <libgamma.h> -#ifndef __GCC__ -# ifndef __attribute__ -# define __attribute__(X) /* empty */ -# endif -#endif - - -#define J JNIEnv* env, jclass __attribute__((unused)) class +#define J JNIEnv* env, jclass class @@ -108,6 +101,7 @@ jlongArray Java_libgamma_GammaRamps_libgamma_1gamma_1ramps8_1create(J, jint red_ if (r != 0) return fail(env, r); return ok(env, ramps, ramps->red, ramps->green, ramps->blue); + (void) class; } @@ -137,6 +131,7 @@ jlongArray Java_libgamma_GammaRamps_libgamma_1gamma_1ramps16_1create(J, jint red if (r != 0) return fail(env, r); return ok(env, ramps, ramps->red, ramps->green, ramps->blue); + (void) class; } @@ -166,6 +161,7 @@ jlongArray Java_libgamma_GammaRamps_libgamma_1gamma_1ramps32_1create(J, jint red if (r != 0) return fail(env, r); return ok(env, ramps, ramps->red, ramps->green, ramps->blue); + (void) class; } @@ -195,6 +191,7 @@ jlongArray Java_libgamma_GammaRamps_libgamma_1gamma_1ramps64_1create(J, jint red if (r != 0) return fail(env, r); return ok(env, ramps, ramps->red, ramps->green, ramps->blue); + (void) class; } @@ -224,6 +221,7 @@ jlongArray Java_libgamma_GammaRamps_libgamma_1gamma_1rampsf_1create(J, jint red_ if (r != 0) return fail(env, r); return ok(env, ramps, ramps->red, ramps->green, ramps->blue); + (void) class; } @@ -253,6 +251,7 @@ jlongArray Java_libgamma_GammaRamps_libgamma_1gamma_1rampsd_1create(J, jint red_ if (r != 0) return fail(env, r); return ok(env, ramps, ramps->red, ramps->green, ramps->blue); + (void) class; } @@ -270,6 +269,7 @@ void Java_libgamma_GammaRamps_libgamma_1gamma_1ramps8_1free(J, jlong address) void* this = (void*)(size_t)address; libgamma_gamma_ramps8_free(this); (void) env; + (void) class; } @@ -286,6 +286,7 @@ void Java_libgamma_GammaRamps_libgamma_1gamma_1ramps16_1free(J, jlong address) void* this = (void*)(size_t)address; libgamma_gamma_ramps16_free(this); (void) env; + (void) class; } @@ -302,6 +303,7 @@ void Java_libgamma_GammaRamps_libgamma_1gamma_1ramps32_1free(J, jlong address) void* this = (void*)(size_t)address; libgamma_gamma_ramps32_free(this); (void) env; + (void) class; } @@ -318,6 +320,7 @@ void Java_libgamma_GammaRamps_libgamma_1gamma_1ramps64_1free(J, jlong address) void* this = (void*)(size_t)address; libgamma_gamma_ramps64_free(this); (void) env; + (void) class; } @@ -334,6 +337,7 @@ void Java_libgamma_GammaRamps_libgamma_1gamma_1rampsf_1free(J, jlong address) void* this = (void*)(size_t)address; libgamma_gamma_rampsf_free(this); (void) env; + (void) class; } @@ -350,5 +354,6 @@ void Java_libgamma_GammaRamps_libgamma_1gamma_1rampsd_1free(J, jlong address) void* this = (void*)(size_t)address; libgamma_gamma_rampsd_free(this); (void) env; + (void) class; } diff --git a/src/libgamma_LibgammaException.c b/src/libgamma_LibgammaException.c index 7b1d3d7..ee94b98 100644 --- a/src/libgamma_LibgammaException.c +++ b/src/libgamma_LibgammaException.c @@ -20,14 +20,7 @@ #include <libgamma.h> -#ifndef __GCC__ -# ifndef __attribute__ -# define __attribute__(X) /* empty */ -# endif -#endif - - -#define J JNIEnv* env, jclass __attribute__((unused)) class +#define J JNIEnv* env, jclass class diff --git a/src/libgamma_Partition.c b/src/libgamma_Partition.c index 81f001b..4cb1cdc 100644 --- a/src/libgamma_Partition.c +++ b/src/libgamma_Partition.c @@ -20,14 +20,7 @@ #include <libgamma.h> -#ifndef __GCC__ -# ifndef __attribute__ -# define __attribute__(X) /* empty */ -# endif -#endif - - -#define J JNIEnv* env, jclass __attribute__((unused)) class +#define J JNIEnv* env, jclass class diff --git a/src/libgamma_Ramp.c b/src/libgamma_Ramp.c index c180f0b..cdbbc03 100644 --- a/src/libgamma_Ramp.c +++ b/src/libgamma_Ramp.c @@ -20,14 +20,7 @@ #include <libgamma.h> -#ifndef __GCC__ -# ifndef __attribute__ -# define __attribute__(X) /* empty */ -# endif -#endif - - -#define J JNIEnv* env, jclass __attribute__((unused)) class +#define J JNIEnv* env, jclass class @@ -38,7 +31,14 @@ * @param stop The index of the stop. * @return The value of the stop. */ -jshort Java_libgamma_Ramp_libgamma_1gamma_1ramps8_1get(J, jlong address, jint stop); +jshort Java_libgamma_Ramp_libgamma_1gamma_1ramps8_1get(J, jlong address, jint stop) +{ + void* this_voidp = (void*)(size_t)address; + uint8_t* this = this_voidp; + return (jshort)(this[stop]); + (void) env; + (void) class; +} /** @@ -48,7 +48,14 @@ jshort Java_libgamma_Ramp_libgamma_1gamma_1ramps8_1get(J, jlong address, jint st * @param stop The index of the stop. * @return The value of the stop. */ -jint Java_libgamma_Ramp_libgamma_1gamma_1ramps16_1get(J, jlong address, jint stop); +jint Java_libgamma_Ramp_libgamma_1gamma_1ramps16_1get(J, jlong address, jint stop) +{ + void* this_voidp = (void*)(size_t)address; + uint16_t* this = this_voidp; + return (jint)(this[stop]); + (void) env; + (void) class; +} /** @@ -58,7 +65,14 @@ jint Java_libgamma_Ramp_libgamma_1gamma_1ramps16_1get(J, jlong address, jint sto * @param stop The index of the stop. * @return The value of the stop. */ -jlong Java_libgamma_Ramp_libgamma_1gamma_1ramps32_1get(J, jlong address, jint stop); +jlong Java_libgamma_Ramp_libgamma_1gamma_1ramps32_1get(J, jlong address, jint stop) +{ + void* this_voidp = (void*)(size_t)address; + uint32_t* this = this_voidp; + return (jlong)(this[stop]); + (void) env; + (void) class; +} /** @@ -68,7 +82,14 @@ jlong Java_libgamma_Ramp_libgamma_1gamma_1ramps32_1get(J, jlong address, jint st * @param stop The index of the stop. * @return The value of the stop. */ -jlong Java_libgamma_Ramp_libgamma_1gamma_1ramps64_1get(J, jlong address, jint stop); +jlong Java_libgamma_Ramp_libgamma_1gamma_1ramps64_1get(J, jlong address, jint stop) +{ + void* this_voidp = (void*)(size_t)address; + uint64_t* this = this_voidp; + return (jlong)(this[stop]); + (void) env; + (void) class; +} /** @@ -78,7 +99,14 @@ jlong Java_libgamma_Ramp_libgamma_1gamma_1ramps64_1get(J, jlong address, jint st * @param stop The index of the stop. * @return The value of the stop. */ -jfloat Java_libgamma_Ramp_libgamma_1gamma_1rampsf_1get(J, jlong address, jint stop); +jfloat Java_libgamma_Ramp_libgamma_1gamma_1rampsf_1get(J, jlong address, jint stop) +{ + void* this_voidp = (void*)(size_t)address; + float* this = this_voidp; + return (jfloat)(this[stop]); + (void) env; + (void) class; +} /** @@ -88,7 +116,14 @@ jfloat Java_libgamma_Ramp_libgamma_1gamma_1rampsf_1get(J, jlong address, jint st * @param stop The index of the stop. * @return The value of the stop. */ -jdouble Java_libgamma_Ramp_libgamma_1gamma_1rampsd_1get(J, jlong address, jint stop); +jdouble Java_libgamma_Ramp_libgamma_1gamma_1rampsd_1get(J, jlong address, jint stop) +{ + void* this_voidp = (void*)(size_t)address; + double* this = this_voidp; + return (jdouble)(this[stop]); + (void) env; + (void) class; +} @@ -99,7 +134,14 @@ jdouble Java_libgamma_Ramp_libgamma_1gamma_1rampsd_1get(J, jlong address, jint s * @param stop The index of the stop. * @param value The value of the stop. */ -void Java_libgamma_Ramp_libgamma_1gamma_1ramps8_1set(J, jlong address, jint stop, jshort value); +void Java_libgamma_Ramp_libgamma_1gamma_1ramps8_1set(J, jlong address, jint stop, jshort value) +{ + void* this_voidp = (void*)(size_t)address; + uint8_t* this = this_voidp; + this[stop] = (uint8_t)value; + (void) env; + (void) class; +} /** @@ -109,7 +151,14 @@ void Java_libgamma_Ramp_libgamma_1gamma_1ramps8_1set(J, jlong address, jint stop * @param stop The index of the stop. * @param value The value of the stop. */ -void Java_libgamma_Ramp_libgamma_1gamma_1ramps16_1set(J, jlong address, jint stop, jint value); +void Java_libgamma_Ramp_libgamma_1gamma_1ramps16_1set(J, jlong address, jint stop, jint value) +{ + void* this_voidp = (void*)(size_t)address; + uint16_t* this = this_voidp; + this[stop] = (uint16_t)value; + (void) env; + (void) class; +} /** @@ -119,7 +168,14 @@ void Java_libgamma_Ramp_libgamma_1gamma_1ramps16_1set(J, jlong address, jint sto * @param stop The index of the stop. * @param value The value of the stop. */ -void Java_libgamma_Ramp_libgamma_1gamma_1ramps32_1set(J, jlong address, jint stop, jlong value); +void Java_libgamma_Ramp_libgamma_1gamma_1ramps32_1set(J, jlong address, jint stop, jlong value) +{ + void* this_voidp = (void*)(size_t)address; + uint32_t* this = this_voidp; + this[stop] = (uint32_t)value; + (void) env; + (void) class; +} /** @@ -129,7 +185,14 @@ void Java_libgamma_Ramp_libgamma_1gamma_1ramps32_1set(J, jlong address, jint sto * @param stop The index of the stop. * @param value The value of the stop. */ -void Java_libgamma_Ramp_libgamma_1gamma_1ramps64_1set(J, jlong address, jint stop, jlong value); +void Java_libgamma_Ramp_libgamma_1gamma_1ramps64_1set(J, jlong address, jint stop, jlong value) +{ + void* this_voidp = (void*)(size_t)address; + uint64_t* this = this_voidp; + this[stop] = (uint64_t)value; + (void) env; + (void) class; +} /** @@ -139,7 +202,14 @@ void Java_libgamma_Ramp_libgamma_1gamma_1ramps64_1set(J, jlong address, jint sto * @param stop The index of the stop. * @param value The value of the stop. */ -void Java_libgamma_Ramp_libgamma_1gamma_1rampsf_1set(J, jlong address, jint stop, jfloat value); +void Java_libgamma_Ramp_libgamma_1gamma_1rampsf_1set(J, jlong address, jint stop, jfloat value) +{ + void* this_voidp = (void*)(size_t)address; + float* this = this_voidp; + this[stop] = (float)value; + (void) env; + (void) class; +} /** @@ -149,5 +219,12 @@ void Java_libgamma_Ramp_libgamma_1gamma_1rampsf_1set(J, jlong address, jint stop * @param stop The index of the stop. * @param value The value of the stop. */ -void Java_libgamma_Ramp_libgamma_1gamma_1rampsd_1set(J, jlong address, jint stop, jdouble value); +void Java_libgamma_Ramp_libgamma_1gamma_1rampsd_1set(J, jlong address, jint stop, jdouble value) +{ + void* this_voidp = (void*)(size_t)address; + double* this = this_voidp; + this[stop] = (double)value; + (void) env; + (void) class; +} diff --git a/src/libgamma_Site.c b/src/libgamma_Site.c index 885e901..269b32c 100644 --- a/src/libgamma_Site.c +++ b/src/libgamma_Site.c @@ -20,14 +20,7 @@ #include <libgamma.h> -#ifndef __GCC__ -# ifndef __attribute__ -# define __attribute__(X) /* empty */ -# endif -#endif - - -#define J JNIEnv* env, jclass __attribute__((unused)) class +#define J JNIEnv* env, jclass class |