Merge pull request #190 from greut/typos

Fix typo and small cleanup.
master
Tomás Aparicio 8 years ago committed by GitHub
commit a150d0a7ee

@ -421,7 +421,7 @@ func vipsSave(image *C.VipsImage, o vipsSaveOptions) ([]byte, error) {
saveErr := C.int(0) saveErr := C.int(0)
interlace := C.int(boolToInt(o.Interlace)) interlace := C.int(boolToInt(o.Interlace))
quality := C.int(o.Quality) quality := C.int(o.Quality)
strip := C.int(boolToInt(o.Interlace)) strip := C.int(boolToInt(o.StripMetadata))
if o.Type != 0 && !IsTypeSupportedSave(o.Type) { if o.Type != 0 && !IsTypeSupportedSave(o.Type) {
return nil, fmt.Errorf("VIPS cannot save to %#v", ImageTypes[o.Type]) return nil, fmt.Errorf("VIPS cannot save to %#v", ImageTypes[o.Type])

@ -20,6 +20,9 @@
#define EXIF_IFD0_ORIENTATION "exif-ifd0-Orientation" #define EXIF_IFD0_ORIENTATION "exif-ifd0-Orientation"
#define INT_TO_GBOOLEAN(bool) (bool > 0 ? TRUE : FALSE)
enum types { enum types {
UNKNOWN = 0, UNKNOWN = 0,
JPEG, JPEG,
@ -62,11 +65,6 @@ remove_profile(VipsImage *image) {
vips_image_remove(image, VIPS_META_ICC_NAME); vips_image_remove(image, VIPS_META_ICC_NAME);
} }
static gboolean
with_interlace(int interlace) {
return interlace > 0 ? TRUE : FALSE;
}
static int static int
has_alpha_channel(VipsImage *image) { has_alpha_channel(VipsImage *image) {
return ( return (
@ -274,10 +272,10 @@ vips_icc_transform_bridge (VipsImage *in, VipsImage **out, const char *output_ic
int int
vips_jpegsave_bridge(VipsImage *in, void **buf, size_t *len, int strip, int quality, int interlace) { vips_jpegsave_bridge(VipsImage *in, void **buf, size_t *len, int strip, int quality, int interlace) {
return vips_jpegsave_buffer(in, buf, len, return vips_jpegsave_buffer(in, buf, len,
"strip", strip == 1 ? TRUE : FALSE, "strip", INT_TO_GBOOLEAN(strip),
"Q", quality, "Q", quality,
"optimize_coding", TRUE, "optimize_coding", TRUE,
"interlace", with_interlace(interlace), "interlace", INT_TO_GBOOLEAN(interlace),
NULL NULL
); );
} }
@ -286,17 +284,17 @@ int
vips_pngsave_bridge(VipsImage *in, void **buf, size_t *len, int strip, int compression, int quality, int interlace) { vips_pngsave_bridge(VipsImage *in, void **buf, size_t *len, int strip, int compression, int quality, int interlace) {
#if (VIPS_MAJOR_VERSION >= 8 || (VIPS_MAJOR_VERSION >= 7 && VIPS_MINOR_VERSION >= 42)) #if (VIPS_MAJOR_VERSION >= 8 || (VIPS_MAJOR_VERSION >= 7 && VIPS_MINOR_VERSION >= 42))
return vips_pngsave_buffer(in, buf, len, return vips_pngsave_buffer(in, buf, len,
"strip", strip == 1 ? TRUE : FALSE, "strip", INT_TO_GBOOLEAN(strip),
"compression", compression, "compression", compression,
"interlace", with_interlace(interlace), "interlace", INT_TO_GBOOLEAN(interlace),
"filter", VIPS_FOREIGN_PNG_FILTER_NONE, "filter", VIPS_FOREIGN_PNG_FILTER_NONE,
NULL NULL
); );
#else #else
return vips_pngsave_buffer(in, buf, len, return vips_pngsave_buffer(in, buf, len,
"strip", strip == 1 ? TRUE : FALSE, "strip", INT_TO_GBOOLEAN(strip),
"compression", compression, "compression", compression,
"interlace", with_interlace(interlace), "interlace", INT_TO_GBOOLEAN(interlace),
NULL NULL
); );
#endif #endif
@ -305,7 +303,7 @@ vips_pngsave_bridge(VipsImage *in, void **buf, size_t *len, int strip, int compr
int int
vips_webpsave_bridge(VipsImage *in, void **buf, size_t *len, int strip, int quality) { vips_webpsave_bridge(VipsImage *in, void **buf, size_t *len, int strip, int quality) {
return vips_webpsave_buffer(in, buf, len, return vips_webpsave_buffer(in, buf, len,
"strip", strip == 1 ? TRUE : FALSE, "strip", INT_TO_GBOOLEAN(strip),
"Q", quality, "Q", quality,
NULL NULL
); );

Loading…
Cancel
Save