radsave_base should be abstract

now we can set suffs on it, but pick the actual saver from the subclass
This commit is contained in:
John Cupitt 2016-05-24 11:19:02 +01:00
parent 50468a07a2
commit 5f75e5363b
3 changed files with 9 additions and 8 deletions

3
TODO
View File

@ -1,6 +1,3 @@
- setting suffs on the base rad class made hdr save fail silently, why was
there no message?
- add more webp tests to py suite
- try moving some more of the CLI tests to py

View File

@ -1496,7 +1496,11 @@ vips_foreign_find_save_sub( VipsForeignSaveClass *save_class,
{
VipsForeignClass *class = VIPS_FOREIGN_CLASS( save_class );
if( class->suffs &&
/* The suffs might be defined on an abstract base class, make sure we
* don't pick that.
*/
if( !G_TYPE_IS_ABSTRACT( G_TYPE_FROM_CLASS( class ) ) &&
class->suffs &&
vips_filename_suffix_match( filename, class->suffs ) )
return( save_class );

View File

@ -61,7 +61,7 @@ typedef struct _VipsForeignSaveRad {
typedef VipsForeignSaveClass VipsForeignSaveRadClass;
G_DEFINE_TYPE( VipsForeignSaveRad, vips_foreign_save_rad,
G_DEFINE_ABSTRACT_TYPE( VipsForeignSaveRad, vips_foreign_save_rad,
VIPS_TYPE_FOREIGN_SAVE );
/* Save a bit of typing.
@ -87,6 +87,7 @@ vips_foreign_save_rad_class_init( VipsForeignSaveRadClass *class )
{
GObjectClass *gobject_class = G_OBJECT_CLASS( class );
VipsObjectClass *object_class = (VipsObjectClass *) class;
VipsForeignClass *foreign_class = (VipsForeignClass *) class;
VipsForeignSaveClass *save_class = (VipsForeignSaveClass *) class;
gobject_class->set_property = vips_object_set_property;
@ -95,6 +96,8 @@ vips_foreign_save_rad_class_init( VipsForeignSaveRadClass *class )
object_class->nickname = "radsave_base";
object_class->description = _( "save Radiance" );
foreign_class->suffs = vips__rad_suffs;
save_class->saveable = VIPS_SAVEABLE_RGB;
save_class->format_table = vips_foreign_save_rad_format_table;
save_class->coding[VIPS_CODING_NONE] = FALSE;
@ -139,13 +142,10 @@ vips_foreign_save_rad_file_class_init( VipsForeignSaveRadFileClass *class )
{
GObjectClass *gobject_class = G_OBJECT_CLASS( class );
VipsObjectClass *object_class = (VipsObjectClass *) class;
VipsForeignClass *foreign_class = (VipsForeignClass *) class;
gobject_class->set_property = vips_object_set_property;
gobject_class->get_property = vips_object_get_property;
foreign_class->suffs = vips__rad_suffs;
object_class->nickname = "radsave";
object_class->description = _( "save image to Radiance file" );
object_class->build = vips_foreign_save_rad_file_build;