Commit 1883b720 authored by Matthias Clasen's avatar Matthias Clasen
Browse files

modules: implement is_option_supported() for builtin modules

Follow-up to previous commit; implement the new API in the modules we
ship that can save pixbufs.

https://bugzilla.gnome.org/show_bug.cgi?id=683371
parent 6385d35d
......@@ -99,6 +99,15 @@ gdk_pixbuf__gdip_image_save_JPEG (FILE *f,
return gdk_pixbuf__gdip_image_save_JPEG_to_callback (gdip_save_to_file_callback, f, pixbuf, keys, values, error);
}
static gboolean
gdk_pixbuf__gdip_is_save_option_supported_JPEG (const gchar *option_key)
{
if (g_strcmp0 (option_key, "quality") == 0)
return TRUE;
return FALSE;
}
#ifndef INCLUDE_gdiplus
#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
#else
......@@ -111,6 +120,7 @@ MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
module->save_to_callback = gdk_pixbuf__gdip_image_save_JPEG_to_callback;
module->save = gdk_pixbuf__gdip_image_save_JPEG; /* for gtk < 2.14, you need to implement both. otherwise gdk-pixbuf-queryloaders fails */
module->is_save_option_supported = gdk_pixbuf__gdip_is_save_option_supported_JPEG;
}
MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
......
......@@ -95,6 +95,16 @@ gdk_pixbuf__gdip_image_save_PNG (FILE *f,
return gdk_pixbuf__gdip_image_save_PNG_to_callback (gdip_save_to_file_callback, f, pixbuf, keys, values, error);
}
static gboolean
gdk_pixbuf__gdip_is_save_option_supported_PNG (const gchar *option_key)
{
if (g_strcmp0 (option_key, "compression") == 0 ||
strncmp (option_key, "tEXt::", 6) == 0)
return TRUE;
return FALSE;
}
#ifndef INCLUDE_gdip_png
#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
#else
......@@ -107,6 +117,7 @@ MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
module->save_to_callback = gdk_pixbuf__gdip_image_save_PNG_to_callback;
module->save = gdk_pixbuf__gdip_image_save_PNG; /* for gtk < 2.14, you need to implement both. otherwise gdk-pixbuf-queryloaders fails */
module->is_save_option_supported = gdk_pixbuf__gdip_is_save_option_supported_PNG;
}
MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
......
......@@ -1242,6 +1242,17 @@ gdk_pixbuf__ico_image_save (FILE *f,
return TRUE;
}
static gboolean
gdk_pixbuf__ico_is_save_option_supported (const gchar *option_key)
{
if (g_strcmp0 (option_key, "depth") == 0 ||
g_strcmp0 (option_key, "x_hot") == 0 ||
g_strcmp0 (option_key, "y_hot") == 0)
return TRUE;
return FALSE;
}
#ifndef INCLUDE_ico
#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
#else
......@@ -1254,6 +1265,7 @@ MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
module->stop_load = gdk_pixbuf__ico_image_stop_load;
module->load_increment = gdk_pixbuf__ico_image_load_increment;
module->save = gdk_pixbuf__ico_image_save;
module->is_save_option_supported = gdk_pixbuf__ico_is_save_option_supported;
}
MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
......
......@@ -1537,6 +1537,16 @@ gdk_pixbuf__jpeg_image_save_to_callback (GdkPixbufSaveFunc save_func,
TRUE, NULL, save_func, user_data);
}
static gboolean
gdk_pixbuf__jpeg_is_save_option_supported (const gchar *option_key)
{
if (g_strcmp0 (option_key, "quality") == 0 ||
g_strcmp0 (option_key, "icc-profile") == 0)
return TRUE;
return FALSE;
}
#ifndef INCLUDE_jpeg
#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
#else
......@@ -1551,6 +1561,7 @@ MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
module->load_increment = gdk_pixbuf__jpeg_image_load_increment;
module->save = gdk_pixbuf__jpeg_image_save;
module->save_to_callback = gdk_pixbuf__jpeg_image_save_to_callback;
module->is_save_option_supported = gdk_pixbuf__jpeg_is_save_option_supported;
}
MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
......
......@@ -1171,6 +1171,19 @@ gdk_pixbuf__png_image_save_to_callback (GdkPixbufSaveFunc save_func,
TRUE, NULL, save_func, user_data);
}
static gboolean
gdk_pixbuf__png_is_save_option_supported (const gchar *option_key)
{
if (g_strcmp0 (option_key, "compression") == 0 ||
g_strcmp0 (option_key, "icc-profile") == 0 ||
g_strcmp0 (option_key, "x-dpi") == 0 ||
g_strcmp0 (option_key, "y-dpi") == 0 ||
strncmp (option_key, "tEXt::", 6) == 0)
return TRUE;
return FALSE;
}
#ifndef INCLUDE_png
#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
#else
......@@ -1185,6 +1198,7 @@ MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
module->load_increment = gdk_pixbuf__png_image_load_increment;
module->save = gdk_pixbuf__png_image_save;
module->save_to_callback = gdk_pixbuf__png_image_save_to_callback;
module->is_save_option_supported = gdk_pixbuf__png_is_save_option_supported;
}
MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
......
......@@ -979,6 +979,19 @@ gdk_pixbuf__tiff_image_save (FILE *f,
values, error);
}
static gboolean
gdk_pixbuf__tiff_is_save_option_supported (const gchar *option_key)
{
if (g_strcmp0 (option_key, "bits-per-sample") == 0 ||
g_strcmp0 (option_key, "compression") == 0 ||
g_strcmp0 (option_key, "icc-profile") == 0 ||
g_strcmp0 (option_key, "x-dpi") == 0 ||
g_strcmp0 (option_key, "y-dpi") == 0)
return TRUE;
return FALSE;
}
#ifndef INCLUDE_tiff
#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
#else
......@@ -993,6 +1006,7 @@ MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
module->load_increment = gdk_pixbuf__tiff_image_load_increment;
module->save = gdk_pixbuf__tiff_image_save;
module->save_to_callback = gdk_pixbuf__tiff_image_save_to_callback;
module->is_save_option_supported = gdk_pixbuf__tiff_is_save_option_supported;
}
MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment