Merge remote-tracking branch 'origin/7.30'

This commit is contained in:
John Cupitt 2012-08-14 11:03:12 +01:00
commit 31f3f8681a
10 changed files with 103 additions and 189 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
vips-*.tar.gz
gtk-doc.make
libvips-scan
libvips-scan.c
Makefile.in

View File

@ -6,6 +6,9 @@
- so affinei and affinei_all appear in Python
- be more cautious enabling YCbCr mode in tiff write
- add "DEPRECATED" flag to arguments
- jpeg load/save note and use the preferred resolution unit
- better error msgs for enum args
- test for gtk-doc in bootstrap
20/7/12 started 7.30.0
- support "rs" mode in vips7

7
TODO
View File

@ -1,3 +1,10 @@
carrierwave-vips-benchmark seems to fail for 200x200 images with a non-seq
error
see also the gist comparing oil and vips
stop compile warnings for production build
blocking bugs
=============

View File

@ -28,7 +28,13 @@ cp $ACDIR/lcmessage.m4 m4
cp $ACDIR/progtest.m4 m4
cp $ACDIR/introspection.m4 m4
gtkdocize --copy --docdir doc/reference --flavour no-tmpl || exit 1
# some systems struggle to install gtk-doc ... test for it first
if gtkdocize --version >/dev/null 2>&1; then
echo setting up gtk-doc ...
gtkdocize --copy --docdir doc/reference --flavour no-tmpl
else
echo no gtk-doc found -- disabling
fi
# some systems need libtoolize, some glibtoolize ... how annoying
echo testing for glibtoolize ...

View File

@ -1,177 +0,0 @@
# -*- mode: makefile -*-
####################################
# Everything below here is generic #
####################################
if GTK_DOC_USE_LIBTOOL
GTKDOC_CC = $(LIBTOOL) --mode=compile $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
GTKDOC_LD = $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
GTKDOC_RUN = $(LIBTOOL) --mode=execute
else
GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
GTKDOC_RUN = sh -c
endif
# We set GPATH here; this gives us semantics for GNU make
# which are more like other make's VPATH, when it comes to
# whether a source that is a target of one rule is then
# searched for in VPATH/GPATH.
#
GPATH = $(srcdir)
TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
EXTRA_DIST = \
$(content_files) \
$(HTML_IMAGES) \
$(DOC_MAIN_SGML_FILE) \
$(DOC_MODULE)-sections.txt \
$(DOC_MODULE)-overrides.txt
DOC_STAMPS=scan-build.stamp sgml-build.stamp html-build.stamp \
$(srcdir)/sgml.stamp $(srcdir)/html.stamp
SCANOBJ_FILES = \
$(DOC_MODULE).args \
$(DOC_MODULE).hierarchy \
$(DOC_MODULE).interfaces \
$(DOC_MODULE).prerequisites \
$(DOC_MODULE).signals
REPORT_FILES = \
$(DOC_MODULE)-undocumented.txt \
$(DOC_MODULE)-undeclared.txt \
$(DOC_MODULE)-unused.txt
CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS)
if ENABLE_GTK_DOC
all-local: html-build.stamp
else
all-local:
endif
docs: html-build.stamp
$(REPORT_FILES): sgml-build.stamp
#### scan ####
scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
@echo 'gtk-doc: Scanning header files'
@-chmod -R u+w $(srcdir)
cd $(srcdir) && \
gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES)
if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \
CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \
else \
cd $(srcdir) ; \
for i in $(SCANOBJ_FILES) ; do \
test -f $$i || touch $$i ; \
done \
fi
touch scan-build.stamp
$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
@true
#### xml ####
sgml-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files)
@echo 'gtk-doc: Building XML'
@-chmod -R u+w $(srcdir)
cd $(srcdir) && \
gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $(MKDB_OPTIONS)
touch sgml-build.stamp
sgml.stamp: sgml-build.stamp
@true
#### html ####
html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
@echo 'gtk-doc: Building HTML'
@-chmod -R u+w $(srcdir)
rm -rf $(srcdir)/html
mkdir $(srcdir)/html
mkhtml_options=""; \
gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \
if test "$(?)" = "0"; then \
mkhtml_options=--path="$(srcdir)"; \
fi
cd $(srcdir)/html && gtkdoc-mkhtml $(mkhtml_options) $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html )
@echo 'gtk-doc: Fixing cross-references'
cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
touch html-build.stamp
##############
clean-local:
rm -f *~ *.bak
rm -rf .libs
distclean-local:
cd $(srcdir) && \
rm -rf xml $(REPORT_FILES) \
$(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
maintainer-clean-local: clean
cd $(srcdir) && rm -rf html
install-data-local:
installfiles=`echo $(srcdir)/html/*`; \
if test "$$installfiles" = '$(srcdir)/html/*'; \
then echo '-- Nothing to install' ; \
else \
if test -n "$(DOC_MODULE_VERSION)"; then \
installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
else \
installdir="$(DESTDIR)$(TARGET_DIR)"; \
fi; \
$(mkinstalldirs) $${installdir} ; \
for i in $$installfiles; do \
echo '-- Installing '$$i ; \
$(INSTALL_DATA) $$i $${installdir}; \
done; \
if test -n "$(DOC_MODULE_VERSION)"; then \
mv -f $${installdir}/$(DOC_MODULE).devhelp2 \
$${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \
mv -f $${installdir}/$(DOC_MODULE).devhelp \
$${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp; \
fi; \
! which gtkdoc-rebase >/dev/null 2>&1 || \
gtkdoc-rebase --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir} ; \
fi
uninstall-local:
if test -n "$(DOC_MODULE_VERSION)"; then \
installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
else \
installdir="$(DESTDIR)$(TARGET_DIR)"; \
fi; \
rm -rf $${installdir}
#
# Require gtk-doc when making dist
#
if ENABLE_GTK_DOC
dist-check-gtkdoc:
else
dist-check-gtkdoc:
@echo "*** gtk-doc must be installed and enabled in order to make dist"
@false
endif
dist-hook: dist-check-gtkdoc dist-hook-local
mkdir $(distdir)/html
cp $(srcdir)/html/* $(distdir)/html
-cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
-cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
cd $(distdir) && rm -f $(DISTCLEANFILES)
! which gtkdoc-rebase >/dev/null 2>&1 || \
gtkdoc-rebase --online --relative --html-dir=$(distdir)/html
.PHONY : dist-hook-local docs

View File

@ -7,6 +7,8 @@
* - from VipsForeignLoad
* 14/7/12
* - support skip forwards as well, so we can do extract/insert
* 10/8/12
* - add @trace option
*/
/*
@ -60,6 +62,7 @@ typedef struct _VipsSequential {
VipsImage *in;
int y_pos;
gboolean trace;
} VipsSequential;
typedef VipsConversionClass VipsSequentialClass;
@ -74,14 +77,15 @@ vips_sequential_generate( VipsRegion *or,
VipsRect *r = &or->valid;
VipsRegion *ir = (VipsRegion *) seq;
VIPS_DEBUG_MSG( "vips_sequential_generate %d\n", r->top );
if( sequential->trace )
vips_diag( "VipsSequential",
"%d lines, starting at line %d", r->height, r->top );
/* We can't go backwards, but we can skip forwards.
*/
if( r->top < sequential->y_pos ) {
vips_error( "VipsSequential",
_( "non-sequential read --- "
"at position %d in file, but position %d requested" ),
_( "at line %d in file, but line %d requested" ),
sequential->y_pos, r->top );
return( -1 );
}
@ -107,6 +111,10 @@ vips_sequential_generate( VipsRegion *or,
return( -1 );
sequential->y_pos += rect.height;
if( sequential->trace )
vips_diag( "VipsSequential",
"skipping %d lines", rect.height );
}
g_assert( sequential->y_pos == r->top );
@ -169,11 +177,19 @@ vips_sequential_class_init( VipsSequentialClass *class )
_( "Input image" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsSequential, in ) );
VIPS_ARG_BOOL( class, "trace", 2,
_( "trace" ),
_( "trace pixel requests" ),
VIPS_ARGUMENT_OPTIONAL_INPUT,
G_STRUCT_OFFSET( VipsSequential, trace ),
TRUE );
}
static void
vips_sequential_init( VipsSequential *sequential )
{
sequential->trace = FALSE;
}
/**
@ -182,6 +198,10 @@ vips_sequential_init( VipsSequential *sequential )
* @out: output image
* @...: %NULL-terminated list of optional named arguments
*
* Optional arguments:
*
* @trace: trace requests
*
* This operation behaves rather like vips_copy() between images
* @in and @out, except that it checks that pixels are only requested
* top-to-bottom. If an out of order request is made, it throws an exception.
@ -189,6 +209,10 @@ vips_sequential_init( VipsSequential *sequential )
* This operation is handy with tilecache for loading file formats which are
* strictly top-to-bottom, like PNG.
*
* If @trace is true, the operation will print diagnostic messages for each
* block of pixels which are processed. This can help find the cause of
* non-sequential accesses.
*
* See also: vips_image_cache().
*
* Returns: 0 on success, -1 on error.

View File

@ -45,6 +45,8 @@
* - read jfif resolution as well as exif
* 19/2/12
* - switch to lazy reading
* 7/8/12
* - note EXIF resolution unit in VIPS_META_RESOLUTION_UNIT
*/
/*
@ -493,6 +495,8 @@ set_vips_resolution( VipsImage *im, ExifData *ed )
*/
xres /= 25.4;
yres /= 25.4;
vips_image_set_string( im,
VIPS_META_RESOLUTION_UNIT, "in" );
break;
case 3:
@ -500,6 +504,8 @@ set_vips_resolution( VipsImage *im, ExifData *ed )
*/
xres /= 10.0;
yres /= 10.0;
vips_image_set_string( im,
VIPS_META_RESOLUTION_UNIT, "cm" );
break;
default:

View File

@ -48,6 +48,8 @@
* - rebuild exif tags from coded metadata values
* 24/11/11
* - turn into a set of write fns ready to be called from a class
* 7/8/12
* - use VIPS_META_RESOLUTION_UNIT to select resoltuion unit
*/
/*
@ -345,13 +347,33 @@ static int
set_exif_resolution( ExifData *ed, VipsImage *im )
{
double xres, yres;
char *p;
int unit;
/* Always save as inches - more progs support it for read.
/* Default to inches, more progs support it.
*/
xres = im->Xres * 25.4;
yres = im->Yres * 25.4;
unit = 2;
if( vips_image_get_typeof( im, VIPS_META_RESOLUTION_UNIT ) &&
!vips_image_get_string( im, VIPS_META_RESOLUTION_UNIT, &p ) &&
vips_isprefix( "cm", p ) )
unit = 3;
switch( unit ) {
case 2:
xres = im->Xres * 25.4;
yres = im->Yres * 25.4;
break;
case 3:
xres = im->Xres * 10.0;
yres = im->Yres * 10.0;
break;
default:
vips_warn( "VipsJpeg",
"%s", _( "unknown EXIF resolution unit" ) );
return;
}
if( write_tag( ed, EXIF_TAG_X_RESOLUTION, EXIF_FORMAT_RATIONAL,
vips_exif_set_double, (void *) &xres ) ||

View File

@ -556,8 +556,9 @@ vips_image_posteval_cb( VipsImage *image, VipsProgress *progress )
{
/* Spaces at end help to erase the %complete message we overwrite.
*/
printf( _( "%s %s: done in %ds \n" ),
g_get_prgname(), image->filename, progress->run );
printf( _( "%s %s: done in %.3gs \n" ),
g_get_prgname(), image->filename,
g_timer_elapsed( progress->start, NULL ) );
return( 0 );
}

View File

@ -1438,6 +1438,29 @@ vips_object_class_install_argument( VipsObjectClass *object_class,
#endif /*DEBUG*/
}
/* Make a bad-enum error. A common and fiddly case.
*/
static void
vips_enum_error( VipsObjectClass *class, GType otype, const char *value )
{
GEnumClass *genum = G_ENUM_CLASS( g_type_class_ref( otype ) );
int i;
char str[1000];
VipsBuf buf = VIPS_BUF_STATIC( str );
/* -1 since we always have a "last" member.
*/
for( i = 0; i < genum->n_values - 1; i++ ) {
if( i > 0 )
vips_buf_appends( &buf, ", " );
vips_buf_appends( &buf, genum->values[i].value_nick );
}
vips_error( class->nickname, _( "enum '%s' has no member '%s', "
"should be one of: %s" ),
g_type_name( otype ), value, vips_buf_all( &buf ) );
}
/* Set a named arg from a string.
*/
int
@ -1578,9 +1601,7 @@ vips_object_set_argument_from_string( VipsObject *object,
g_type_class_ref( otype ), value )) ) {
if( !(enum_value = g_enum_get_value_by_nick(
g_type_class_ref( otype ), value )) ) {
vips_error( class->nickname,
_( "enum '%s' has no member '%s'" ),
g_type_name( otype ), value );
vips_enum_error( class, otype, value );
return( -1 );
}
}