diff --git a/doc/gtk-doc.make b/doc/gtk-doc.make index e7916563..9ccd0b04 100644 --- a/doc/gtk-doc.make +++ b/doc/gtk-doc.make @@ -25,6 +25,7 @@ TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE) SETUP_FILES = \ $(content_files) \ + $(expand_content_files) \ $(DOC_MAIN_SGML_FILE) \ $(DOC_MODULE)-sections.txt \ $(DOC_MODULE)-overrides.txt @@ -86,7 +87,7 @@ GTK_DOC_V_SETUP_0=@echo " DOC Preparing build"; setup-build.stamp: -$(GTK_DOC_V_SETUP)if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ - files=`echo $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types`; \ + files=`echo $(SETUP_FILES) $(DOC_MODULE).types`; \ if test "x$$files" != "x" ; then \ for file in $$files ; do \ destdir=`dirname $(abs_builddir)/$$file`; \ @@ -118,7 +119,7 @@ scan-build.stamp: setup-build.stamp $(HFILE_GLOB) $(CFILE_GLOB) $(GTK_DOC_V_INTROSPECT)if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \ scanobj_options=""; \ gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\-\-verbose"; \ - if test "$(?)" = "0"; then \ + if test "$$?" = "0"; then \ if test "x$(V)" = "x1"; then \ scanobj_options="--verbose"; \ fi; \ @@ -162,17 +163,17 @@ GTK_DOC_V_XREF=$(GTK_DOC_V_XREF_$(V)) GTK_DOC_V_XREF_=$(GTK_DOC_V_XREF_$(AM_DEFAULT_VERBOSITY)) GTK_DOC_V_XREF_0=@echo " DOC Fixing cross-references"; -html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) +html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_content_files) $(GTK_DOC_V_HTML)rm -rf html && mkdir html && \ mkhtml_options=""; \ gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-verbose"; \ - if test "$(?)" = "0"; then \ + if test "$$?" = "0"; then \ if test "x$(V)" = "x1"; then \ mkhtml_options="$$mkhtml_options --verbose"; \ fi; \ fi; \ gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \ - if test "$(?)" = "0"; then \ + if test "$$?" = "0"; then \ mkhtml_options="$$mkhtml_options --path=\"$(abs_srcdir)\""; \ fi; \ cd html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) @@ -194,11 +195,11 @@ GTK_DOC_V_PDF=$(GTK_DOC_V_PDF_$(V)) GTK_DOC_V_PDF_=$(GTK_DOC_V_PDF_$(AM_DEFAULT_VERBOSITY)) GTK_DOC_V_PDF_0=@echo " DOC Building PDF"; -pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) +pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_content_files) $(GTK_DOC_V_PDF)rm -f $(DOC_MODULE).pdf && \ mkpdf_options=""; \ gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\-\-verbose"; \ - if test "$(?)" = "0"; then \ + if test "$$?" = "0"; then \ if test "x$(V)" = "x1"; then \ mkpdf_options="$$mkpdf_options --verbose"; \ fi; \ @@ -223,12 +224,15 @@ clean-local: @if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-types" ; then \ rm -f $(DOC_MODULE).types; \ fi + @if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-sections" ; then \ + rm -f $(DOC_MODULE)-sections.txt; \ + fi distclean-local: @rm -rf xml html $(REPORT_FILES) $(DOC_MODULE).pdf \ $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ - rm -f $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types; \ + rm -f $(SETUP_FILES) $(DOC_MODULE).types; \ fi maintainer-clean-local: diff --git a/libvips/foreign/dzsave.c b/libvips/foreign/dzsave.c index cee9bda7..aabde107 100644 --- a/libvips/foreign/dzsave.c +++ b/libvips/foreign/dzsave.c @@ -454,6 +454,12 @@ struct _VipsForeignSaveDz { * Track bytes written here and try to guess when we'll go over. */ size_t bytes_written; + + /* save->background turned into a pixel that matches the image we are + * saving .. used to test for blank tiles. + */ + VipsPel *ink; + }; typedef VipsForeignSaveClass VipsForeignSaveDzClass; @@ -1074,6 +1080,47 @@ tile_name( Layer *layer, int x, int y ) return( out ); } +static gboolean +tile_equal( VipsImage *image, VipsPel * restrict ink ) +{ + const int bytes = VIPS_IMAGE_SIZEOF_PEL( image ); + + VipsRect rect; + VipsRegion *region; + int x, y, b; + + region = vips_region_new( image ); + + /* We know @image is part of a memory buffer, so this will be quick. + */ + rect.left = 0; + rect.top = 0; + rect.width = image->Xsize; + rect.height = image->Ysize; + if( vips_region_prepare( region, &rect ) ) { + g_object_unref( region ); + return( FALSE ); + } + + for( y = 0; y < image->Ysize; y++ ) { + VipsPel * restrict p = VIPS_REGION_ADDR( region, 0, y ); + + for( x = 0; x < image->Xsize; x++ ) { + for( b = 0; b < bytes; b++ ) + if( p[b] != ink[b] ) { + g_object_unref( region ); + return( FALSE ); + } + + p += bytes; + } + } + + g_object_unref( region ); + + return( TRUE ); +} + static int strip_work( VipsThreadState *state, void *a ) { @@ -1094,7 +1141,7 @@ strip_work( VipsThreadState *state, void *a ) printf( "strip_work\n" ); #endif /*DEBUG_VERBOSE*/ - /* If we are centring we may be outside the real pixels. Skip in + /* If we are centering we may be outside the real pixels. Skip in * this case, and the viewer will display blank.png for us. */ if( dz->centre ) { @@ -1127,6 +1174,20 @@ strip_work( VipsThreadState *state, void *a ) state->pos.width, state->pos.height, NULL ) ) return( -1 ); + /* If we are writing a google map pyramid and the tile is equal to the + * background, don't save. The viewer will display blank.png for us. + */ + if( dz->layout == VIPS_FOREIGN_DZ_LAYOUT_GOOGLE && + tile_equal( x, dz->ink ) ) { +#ifdef DEBUG_VERBOSE + printf( "strip_work: skipping blank tile %d x %d\n", + state->x / dz->tile_size, + state->y / dz->tile_size ); +#endif /*DEBUG_VERBOSE*/ + + return( 0 ); + } + /* Google tiles need to be padded up to tilesize. */ if( dz->layout == VIPS_FOREIGN_DZ_LAYOUT_GOOGLE ) { @@ -1528,6 +1589,16 @@ vips_foreign_save_dz_build( VipsObject *object ) vips_area_unref( VIPS_AREA( background ) ); } + /* We use ink in google mode to check for blank tiles. + */ + if( dz->layout == VIPS_FOREIGN_DZ_LAYOUT_GOOGLE ) { + if( !(dz->ink = vips__vector_to_ink( + class->nickname, save->ready, + VIPS_AREA( save->background )->data, NULL, + VIPS_AREA( save->background )->n )) ) + return( -1 ); + } + if( dz->overlap >= dz->tile_size ) { vips_error( "dzsave", "%s", _( "overlap must be less than tile "