swig/java: reduce wrapper function code duplication
define a macro to emit the wrapper code Change-Id: I672416016162d6d9ce6f455d224044e0837e3ace
This commit is contained in:
parent
ad4a367dba
commit
a5c297c842
@ -273,57 +273,35 @@ LOSSLESS_WRAPPER(WebPEncodeLosslessBGRA)
|
|||||||
%pragma(java) modulecode=%{
|
%pragma(java) modulecode=%{
|
||||||
private static final int UNUSED = 1;
|
private static final int UNUSED = 1;
|
||||||
private static int outputSize[] = { 0 };
|
private static int outputSize[] = { 0 };
|
||||||
|
%}
|
||||||
|
|
||||||
public static byte[] WebPEncodeRGB(byte[] rgb,
|
|
||||||
int width, int height, int stride,
|
%define CALL_ENCODE_LOSSY_WRAPPER(func)
|
||||||
float quality_factor) {
|
%pragma(java) modulecode=%{
|
||||||
return wrap_WebPEncodeRGB(
|
public static byte[] func(
|
||||||
|
byte[] rgb, int width, int height, int stride, float quality_factor) {
|
||||||
|
return wrap_##func(
|
||||||
rgb, UNUSED, UNUSED, outputSize, width, height, stride, quality_factor);
|
rgb, UNUSED, UNUSED, outputSize, width, height, stride, quality_factor);
|
||||||
}
|
}
|
||||||
|
%}
|
||||||
|
%enddef
|
||||||
|
|
||||||
public static byte[] WebPEncodeBGR(byte[] bgr,
|
%define CALL_ENCODE_LOSSLESS_WRAPPER(func)
|
||||||
int width, int height, int stride,
|
%pragma(java) modulecode=%{
|
||||||
float quality_factor) {
|
public static byte[] func(
|
||||||
return wrap_WebPEncodeBGR(
|
|
||||||
bgr, UNUSED, UNUSED, outputSize, width, height, stride, quality_factor);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] WebPEncodeRGBA(byte[] rgba,
|
|
||||||
int width, int height, int stride,
|
|
||||||
float quality_factor) {
|
|
||||||
return wrap_WebPEncodeRGBA(
|
|
||||||
rgba, UNUSED, UNUSED, outputSize, width, height, stride, quality_factor);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] WebPEncodeBGRA(byte[] bgra,
|
|
||||||
int width, int height, int stride,
|
|
||||||
float quality_factor) {
|
|
||||||
return wrap_WebPEncodeBGRA(
|
|
||||||
bgra, UNUSED, UNUSED, outputSize, width, height, stride, quality_factor);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] WebPEncodeLosslessRGB(
|
|
||||||
byte[] rgb, int width, int height, int stride) {
|
byte[] rgb, int width, int height, int stride) {
|
||||||
return wrap_WebPEncodeLosslessRGB(
|
return wrap_##func(
|
||||||
rgb, UNUSED, UNUSED, outputSize, width, height, stride);
|
rgb, UNUSED, UNUSED, outputSize, width, height, stride);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] WebPEncodeLosslessBGR(
|
|
||||||
byte[] bgr, int width, int height, int stride) {
|
|
||||||
return wrap_WebPEncodeLosslessBGR(
|
|
||||||
bgr, UNUSED, UNUSED, outputSize, width, height, stride);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] WebPEncodeLosslessRGBA(
|
|
||||||
byte[] rgba, int width, int height, int stride) {
|
|
||||||
return wrap_WebPEncodeLosslessRGBA(
|
|
||||||
rgba, UNUSED, UNUSED, outputSize, width, height, stride);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] WebPEncodeLosslessBGRA(
|
|
||||||
byte[] bgra, int width, int height, int stride) {
|
|
||||||
return wrap_WebPEncodeLosslessBGRA(
|
|
||||||
bgra, UNUSED, UNUSED, outputSize, width, height, stride);
|
|
||||||
}
|
|
||||||
%}
|
%}
|
||||||
|
%enddef
|
||||||
|
|
||||||
|
CALL_ENCODE_LOSSY_WRAPPER(WebPEncodeRGB)
|
||||||
|
CALL_ENCODE_LOSSY_WRAPPER(WebPEncodeRGBA)
|
||||||
|
CALL_ENCODE_LOSSY_WRAPPER(WebPEncodeBGR)
|
||||||
|
CALL_ENCODE_LOSSY_WRAPPER(WebPEncodeBGRA)
|
||||||
|
CALL_ENCODE_LOSSLESS_WRAPPER(WebPEncodeLosslessRGB)
|
||||||
|
CALL_ENCODE_LOSSLESS_WRAPPER(WebPEncodeLosslessRGBA)
|
||||||
|
CALL_ENCODE_LOSSLESS_WRAPPER(WebPEncodeLosslessBGR)
|
||||||
|
CALL_ENCODE_LOSSLESS_WRAPPER(WebPEncodeLosslessBGRA)
|
||||||
#endif /* SWIGJAVA */
|
#endif /* SWIGJAVA */
|
||||||
|
BIN
swig/libwebp.jar
BIN
swig/libwebp.jar
Binary file not shown.
Loading…
Reference in New Issue
Block a user