mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 04:18:26 +01:00
Merge "swig: cosmetics"
This commit is contained in:
commit
eeeea8b530
@ -76,9 +76,9 @@ int WebPGetEncoderVersion(void);
|
||||
#ifdef SWIGJAVA
|
||||
%{
|
||||
#define FillMeInAsSizeCannotBeDeterminedAutomatically \
|
||||
(result ? returned_buffer_size(__FUNCTION__, arg3, arg4) : 0)
|
||||
(result ? ReturnedBufferSize(__FUNCTION__, arg3, arg4) : 0)
|
||||
|
||||
static jint returned_buffer_size(
|
||||
static jint ReturnedBufferSize(
|
||||
const char* function, int* width, int* height) {
|
||||
static const struct sizemap {
|
||||
const char* function;
|
||||
@ -123,7 +123,7 @@ typedef size_t (*WebPEncodeLosslessFunction)(const uint8_t* rgb,
|
||||
int width, int height, int stride,
|
||||
uint8_t** output);
|
||||
|
||||
static uint8_t* encode(const uint8_t* rgb,
|
||||
static uint8_t* EncodeLossy(const uint8_t* rgb,
|
||||
int width, int height, int stride,
|
||||
float quality_factor,
|
||||
WebPEncodeFunction encfn,
|
||||
@ -131,21 +131,21 @@ static uint8_t* encode(const uint8_t* rgb,
|
||||
uint8_t* output = NULL;
|
||||
const size_t image_size =
|
||||
encfn(rgb, width, height, stride, quality_factor, &output);
|
||||
// the values of following two will be interpreted by returned_buffer_size()
|
||||
// the values of following two will be interpreted by ReturnedBufferSize()
|
||||
// as 'width' and 'height' in the size calculation.
|
||||
*output_size = image_size;
|
||||
*unused = 1;
|
||||
return image_size ? output : NULL;
|
||||
}
|
||||
|
||||
static uint8_t* encode_lossless(const uint8_t* rgb,
|
||||
static uint8_t* EncodeLossless(const uint8_t* rgb,
|
||||
int width, int height, int stride,
|
||||
WebPEncodeLosslessFunction encfn,
|
||||
int* output_size, int* unused) {
|
||||
uint8_t* output = NULL;
|
||||
const size_t image_size = encfn(rgb, width, height, stride, &output);
|
||||
// the values of following two will be interpreted by returned_buffer_size()
|
||||
// as 'width' and 'height' in the size calculation.
|
||||
// the values of the following two will be interpreted by
|
||||
// ReturnedBufferSize() as 'width' and 'height' in the size calculation.
|
||||
*output_size = image_size;
|
||||
*unused = 1;
|
||||
return image_size ? output : NULL;
|
||||
@ -185,13 +185,13 @@ static uint8_t* encode_lossless(const uint8_t* rgb,
|
||||
// Changes the return type of WebPEncode* to more closely match Decode*.
|
||||
// This also makes it easier to wrap the output buffer in a native type rather
|
||||
// than dealing with the return pointer.
|
||||
// The additional parameters are to allow reuse of returned_buffer_size(),
|
||||
// The additional parameters are to allow reuse of ReturnedBufferSize(),
|
||||
// unused2 and output_size will be used in this case.
|
||||
#define LOSSY_WRAPPER(FUNC) \
|
||||
static uint8_t* wrap_##FUNC( \
|
||||
const uint8_t* rgb, int* unused1, int* unused2, int* output_size, \
|
||||
int width, int height, int stride, float quality_factor) { \
|
||||
return encode(rgb, width, height, stride, quality_factor, \
|
||||
return EncodeLossy(rgb, width, height, stride, quality_factor, \
|
||||
FUNC, output_size, unused2); \
|
||||
} \
|
||||
|
||||
@ -206,7 +206,7 @@ LOSSY_WRAPPER(WebPEncodeBGRA)
|
||||
static uint8_t* wrap_##FUNC( \
|
||||
const uint8_t* rgb, int* unused1, int* unused2, int* output_size, \
|
||||
int width, int height, int stride) { \
|
||||
return encode_lossless(rgb, width, height, stride, \
|
||||
return EncodeLossless(rgb, width, height, stride, \
|
||||
FUNC, output_size, unused2); \
|
||||
} \
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* This file was automatically generated by SWIG (http://www.swig.org).
|
||||
* Version 1.3.40
|
||||
* Version 2.0.4
|
||||
*
|
||||
* This file is not intended to be easily readable and contains a number of
|
||||
* coding conventions designed to improve portability and efficiency. Do not make
|
||||
@ -811,10 +811,11 @@ jdoubleArray SWIG_JavaArrayOutDouble (JNIEnv *jenv, double *result, jsize sz) {
|
||||
#include "webp/decode.h"
|
||||
#include "webp/encode.h"
|
||||
|
||||
#define FillMeInAsSizeCannotBeDeterminedAutomatically \
|
||||
(result ? returned_buffer_size(__FUNCTION__, arg3, arg4) : 0)
|
||||
|
||||
static jint returned_buffer_size(
|
||||
#define FillMeInAsSizeCannotBeDeterminedAutomatically \
|
||||
(result ? ReturnedBufferSize(__FUNCTION__, arg3, arg4) : 0)
|
||||
|
||||
static jint ReturnedBufferSize(
|
||||
const char* function, int* width, int* height) {
|
||||
static const struct sizemap {
|
||||
const char* function;
|
||||
@ -848,6 +849,8 @@ static jint returned_buffer_size(
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
|
||||
typedef size_t (*WebPEncodeFunction)(const uint8_t* rgb,
|
||||
int width, int height, int stride,
|
||||
float quality_factor, uint8_t** output);
|
||||
@ -855,7 +858,7 @@ typedef size_t (*WebPEncodeLosslessFunction)(const uint8_t* rgb,
|
||||
int width, int height, int stride,
|
||||
uint8_t** output);
|
||||
|
||||
static uint8_t* encode(const uint8_t* rgb,
|
||||
static uint8_t* EncodeLossy(const uint8_t* rgb,
|
||||
int width, int height, int stride,
|
||||
float quality_factor,
|
||||
WebPEncodeFunction encfn,
|
||||
@ -863,21 +866,21 @@ static uint8_t* encode(const uint8_t* rgb,
|
||||
uint8_t* output = NULL;
|
||||
const size_t image_size =
|
||||
encfn(rgb, width, height, stride, quality_factor, &output);
|
||||
// the values of following two will be interpreted by returned_buffer_size()
|
||||
// the values of following two will be interpreted by ReturnedBufferSize()
|
||||
// as 'width' and 'height' in the size calculation.
|
||||
*output_size = image_size;
|
||||
*unused = 1;
|
||||
return image_size ? output : NULL;
|
||||
}
|
||||
|
||||
static uint8_t* encode_lossless(const uint8_t* rgb,
|
||||
static uint8_t* EncodeLossless(const uint8_t* rgb,
|
||||
int width, int height, int stride,
|
||||
WebPEncodeLosslessFunction encfn,
|
||||
int* output_size, int* unused) {
|
||||
uint8_t* output = NULL;
|
||||
const size_t image_size = encfn(rgb, width, height, stride, &output);
|
||||
// the values of following two will be interpreted by returned_buffer_size()
|
||||
// as 'width' and 'height' in the size calculation.
|
||||
// the values of the following two will be interpreted by
|
||||
// ReturnedBufferSize() as 'width' and 'height' in the size calculation.
|
||||
*output_size = image_size;
|
||||
*unused = 1;
|
||||
return image_size ? output : NULL;
|
||||
@ -887,13 +890,13 @@ static uint8_t* encode_lossless(const uint8_t* rgb,
|
||||
// Changes the return type of WebPEncode* to more closely match Decode*.
|
||||
// This also makes it easier to wrap the output buffer in a native type rather
|
||||
// than dealing with the return pointer.
|
||||
// The additional parameters are to allow reuse of returned_buffer_size(),
|
||||
// The additional parameters are to allow reuse of ReturnedBufferSize(),
|
||||
// unused2 and output_size will be used in this case.
|
||||
#define LOSSY_WRAPPER(FUNC) \
|
||||
static uint8_t* wrap_##FUNC( \
|
||||
const uint8_t* rgb, int* unused1, int* unused2, int* output_size, \
|
||||
int width, int height, int stride, float quality_factor) { \
|
||||
return encode(rgb, width, height, stride, quality_factor, \
|
||||
return EncodeLossy(rgb, width, height, stride, quality_factor, \
|
||||
FUNC, output_size, unused2); \
|
||||
} \
|
||||
|
||||
@ -908,7 +911,7 @@ LOSSY_WRAPPER(WebPEncodeBGRA)
|
||||
static uint8_t* wrap_##FUNC( \
|
||||
const uint8_t* rgb, int* unused1, int* unused2, int* output_size, \
|
||||
int width, int height, int stride) { \
|
||||
return encode_lossless(rgb, width, height, stride, \
|
||||
return EncodeLossless(rgb, width, height, stride, \
|
||||
FUNC, output_size, unused2); \
|
||||
} \
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user