mirror of https://github.com/GNOME/gimp.git
removed the size parameter and do nothing but invalidating the preview.
2004-01-10 Sven Neumann <sven@gimp.org> * app/core/gimpimagefile.[ch] (gimp_imagefile_update): removed the size parameter and do nothing but invalidating the preview. * app/gui/file-open-dialog.c * app/widgets/gimpdocumentview.c: changed accordingly. * app/core/gimpdocumentlist.c (gimp_document_list_deserialize): no need for calling gimp_imagefile_update() from here. * tools/pdbgen/pdb/fileops.pdb * app/pdb/fileops_cmds.c (file_load_thumbnail): rewritten using the GimpThumbnail API. * app/core/gimp.c: cosmetics.
This commit is contained in:
parent
f0cf80cc86
commit
8c32fa9b6d
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
2004-01-10 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/core/gimpimagefile.[ch] (gimp_imagefile_update): removed the
|
||||
size parameter and do nothing but invalidating the preview.
|
||||
|
||||
* app/gui/file-open-dialog.c
|
||||
* app/widgets/gimpdocumentview.c: changed accordingly.
|
||||
|
||||
* app/core/gimpdocumentlist.c (gimp_document_list_deserialize):
|
||||
no need for calling gimp_imagefile_update() from here.
|
||||
|
||||
* tools/pdbgen/pdb/fileops.pdb
|
||||
* app/pdb/fileops_cmds.c (file_load_thumbnail): rewritten using the
|
||||
GimpThumbnail API.
|
||||
|
||||
* app/core/gimp.c: cosmetics.
|
||||
|
||||
2004-01-11 Simon Budig <simon@gimp.org>
|
||||
|
||||
* app/display/gimpdisplayshell-scale.c: calculate the
|
||||
|
|
|
@ -289,16 +289,16 @@ gimp_init (Gimp *gimp)
|
|||
|
||||
gimp->documents = gimp_document_list_new (gimp);
|
||||
|
||||
gimp->templates = gimp_list_new (GIMP_TYPE_TEMPLATE,
|
||||
GIMP_CONTAINER_POLICY_STRONG);
|
||||
gimp->templates = gimp_list_new (GIMP_TYPE_TEMPLATE,
|
||||
GIMP_CONTAINER_POLICY_STRONG);
|
||||
gimp->image_new_last_template = NULL;
|
||||
gimp->have_current_cut_buffer = FALSE;
|
||||
|
||||
gimp->context_list = NULL;
|
||||
gimp->standard_context = NULL;
|
||||
gimp->default_context = NULL;
|
||||
gimp->user_context = NULL;
|
||||
gimp->current_context = NULL;
|
||||
gimp->context_list = NULL;
|
||||
gimp->standard_context = NULL;
|
||||
gimp->default_context = NULL;
|
||||
gimp->user_context = NULL;
|
||||
gimp->current_context = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -160,9 +160,6 @@ gimp_document_list_deserialize (GimpConfig *config,
|
|||
|
||||
imagefile = gimp_imagefile_new (document_list->gimp, uri);
|
||||
|
||||
if (size > 0)
|
||||
gimp_imagefile_update (imagefile, size);
|
||||
|
||||
g_free (uri);
|
||||
|
||||
gimp_container_add (GIMP_CONTAINER (document_list),
|
||||
|
|
|
@ -203,19 +203,12 @@ gimp_imagefile_new (Gimp *gimp,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_imagefile_update (GimpImagefile *imagefile,
|
||||
gint size)
|
||||
gimp_imagefile_update (GimpImagefile *imagefile)
|
||||
{
|
||||
gchar *uri;
|
||||
|
||||
g_return_if_fail (GIMP_IS_IMAGEFILE (imagefile));
|
||||
|
||||
if (size < 1)
|
||||
return;
|
||||
|
||||
gimp_thumbnail_set_uri (imagefile->thumbnail,
|
||||
gimp_object_get_name (GIMP_OBJECT (imagefile)));
|
||||
|
||||
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (imagefile));
|
||||
|
||||
g_object_get (imagefile->thumbnail,
|
||||
|
@ -224,16 +217,12 @@ gimp_imagefile_update (GimpImagefile *imagefile,
|
|||
|
||||
if (uri)
|
||||
{
|
||||
GimpImagefile *documents_imagefile;
|
||||
|
||||
documents_imagefile = (GimpImagefile *)
|
||||
GimpImagefile *documents_imagefile = (GimpImagefile *)
|
||||
gimp_container_get_child_by_name (imagefile->gimp->documents, uri);
|
||||
|
||||
if (GIMP_IS_IMAGEFILE (documents_imagefile) &&
|
||||
(documents_imagefile != imagefile))
|
||||
{
|
||||
gimp_imagefile_update (documents_imagefile, size);
|
||||
}
|
||||
if (documents_imagefile != imagefile &&
|
||||
GIMP_IS_IMAGEFILE (documents_imagefile))
|
||||
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (documents_imagefile));
|
||||
|
||||
g_free (uri);
|
||||
}
|
||||
|
@ -674,7 +663,7 @@ gimp_imagefile_save_thumb (GimpImagefile *imagefile,
|
|||
g_object_unref (pixbuf);
|
||||
|
||||
if (success)
|
||||
gimp_imagefile_update (imagefile, size);
|
||||
gimp_imagefile_update (imagefile);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
|
|
@ -62,8 +62,7 @@ GType gimp_imagefile_get_type (void) G_GNUC_CONST;
|
|||
|
||||
GimpImagefile * gimp_imagefile_new (Gimp *gimp,
|
||||
const gchar *uri);
|
||||
void gimp_imagefile_update (GimpImagefile *imagefile,
|
||||
gint thumb_size);
|
||||
void gimp_imagefile_update (GimpImagefile *imagefile);
|
||||
void gimp_imagefile_create_thumbnail (GimpImagefile *imagefile,
|
||||
gint thumb_size);
|
||||
gboolean gimp_imagefile_save_thumbnail (GimpImagefile *imagefile,
|
||||
|
|
|
@ -413,7 +413,7 @@ file_open_selchanged_callback (GtkTreeSelection *sel,
|
|||
}
|
||||
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (open_options_frame), selected);
|
||||
gimp_imagefile_update (open_options_imagefile, gimp->config->thumbnail_size);
|
||||
gimp_imagefile_update (open_options_imagefile);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -438,10 +438,8 @@ file_open_create_thumbnail (Gimp *gimp,
|
|||
}
|
||||
else
|
||||
{
|
||||
gimp_imagefile_update (imagefile, size);
|
||||
gimp_viewable_get_preview (GIMP_VIEWABLE (imagefile), size, size);
|
||||
|
||||
if (imagefile->thumbnail->thumb_state < GIMP_THUMB_STATE_FAILED)
|
||||
if (gimp_thumbnail_peek_thumb (imagefile->thumbnail,
|
||||
size) < GIMP_THUMB_STATE_FAILED)
|
||||
gimp_imagefile_create_thumbnail (imagefile, size);
|
||||
}
|
||||
|
||||
|
@ -452,7 +450,7 @@ file_open_create_thumbnail (Gimp *gimp,
|
|||
g_free (basename);
|
||||
|
||||
gimp_object_set_name (GIMP_OBJECT (open_options_imagefile), uri);
|
||||
gimp_imagefile_update (open_options_imagefile, size);
|
||||
gimp_imagefile_update (open_options_imagefile);
|
||||
|
||||
g_free (uri);
|
||||
}
|
||||
|
|
|
@ -413,7 +413,7 @@ file_open_selchanged_callback (GtkTreeSelection *sel,
|
|||
}
|
||||
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (open_options_frame), selected);
|
||||
gimp_imagefile_update (open_options_imagefile, gimp->config->thumbnail_size);
|
||||
gimp_imagefile_update (open_options_imagefile);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -438,10 +438,8 @@ file_open_create_thumbnail (Gimp *gimp,
|
|||
}
|
||||
else
|
||||
{
|
||||
gimp_imagefile_update (imagefile, size);
|
||||
gimp_viewable_get_preview (GIMP_VIEWABLE (imagefile), size, size);
|
||||
|
||||
if (imagefile->thumbnail->thumb_state < GIMP_THUMB_STATE_FAILED)
|
||||
if (gimp_thumbnail_peek_thumb (imagefile->thumbnail,
|
||||
size) < GIMP_THUMB_STATE_FAILED)
|
||||
gimp_imagefile_create_thumbnail (imagefile, size);
|
||||
}
|
||||
|
||||
|
@ -452,7 +450,7 @@ file_open_create_thumbnail (Gimp *gimp,
|
|||
g_free (basename);
|
||||
|
||||
gimp_object_set_name (GIMP_OBJECT (open_options_imagefile), uri);
|
||||
gimp_imagefile_update (open_options_imagefile, size);
|
||||
gimp_imagefile_update (open_options_imagefile);
|
||||
|
||||
g_free (uri);
|
||||
}
|
||||
|
|
|
@ -272,12 +272,9 @@ file_load_thumbnail_invoker (Gimp *gimp,
|
|||
imagefile = gimp_imagefile_new (gimp, uri);
|
||||
|
||||
if (imagefile)
|
||||
{
|
||||
gimp_imagefile_update (imagefile, GIMP_THUMBNAIL_SIZE_NORMAL);
|
||||
temp_buf = gimp_viewable_get_preview (GIMP_VIEWABLE (imagefile),
|
||||
GIMP_THUMBNAIL_SIZE_NORMAL,
|
||||
GIMP_THUMBNAIL_SIZE_NORMAL);
|
||||
}
|
||||
temp_buf = gimp_viewable_get_preview (GIMP_VIEWABLE (imagefile),
|
||||
GIMP_THUMBNAIL_SIZE_NORMAL,
|
||||
GIMP_THUMBNAIL_SIZE_NORMAL);
|
||||
|
||||
if (temp_buf)
|
||||
{
|
||||
|
|
|
@ -374,22 +374,13 @@ static void
|
|||
gimp_document_view_delete_dangling_foreach (GimpImagefile *imagefile,
|
||||
GimpContainerView *container_view)
|
||||
{
|
||||
gimp_imagefile_update (imagefile, container_view->preview_size);
|
||||
|
||||
if (imagefile->thumbnail->image_state == GIMP_THUMB_STATE_NOT_FOUND)
|
||||
if (gimp_thumbnail_peek_image (imagefile->thumbnail) == GIMP_THUMB_STATE_NOT_FOUND)
|
||||
{
|
||||
gimp_container_remove (container_view->container,
|
||||
GIMP_OBJECT (imagefile));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_document_view_update_foreach (GimpImagefile *imagefile,
|
||||
GimpContainerView *container_view)
|
||||
{
|
||||
gimp_imagefile_update (imagefile, container_view->preview_size);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_document_view_refresh_extended_clicked (GtkWidget *widget,
|
||||
guint state,
|
||||
|
@ -408,7 +399,7 @@ gimp_document_view_refresh_extended_clicked (GtkWidget *widget,
|
|||
else if (state & GDK_SHIFT_MASK)
|
||||
{
|
||||
gimp_container_foreach (editor->view->container,
|
||||
(GFunc) gimp_document_view_update_foreach,
|
||||
(GFunc) gimp_imagefile_update,
|
||||
editor->view);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@
|
|||
(GimpTemplate "NTSC - 720x486"
|
||||
(stock-id "gimp-video")
|
||||
(width 720)
|
||||
(height 576)
|
||||
(height 486)
|
||||
(unit millimeters)
|
||||
(xresolution 72.000000)
|
||||
(yresolution 72.000000)
|
||||
|
|
|
@ -219,75 +219,46 @@ HELP
|
|||
|
||||
%invoke = (
|
||||
vars => [ 'gchar *uri',
|
||||
'GimpImagefile *imagefile = NULL',
|
||||
'GimpThumbnail *thumbnail = NULL',
|
||||
'GdkPixbuf *pixbuf = NULL',
|
||||
'TempBuf *temp_buf = NULL' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
uri = g_filename_to_uri (filename, NULL, NULL);
|
||||
|
||||
if (uri)
|
||||
imagefile = gimp_imagefile_new (gimp, uri);
|
||||
|
||||
if (imagefile)
|
||||
{
|
||||
gimp_imagefile_update (imagefile, GIMP_THUMBNAIL_SIZE_NORMAL);
|
||||
temp_buf = gimp_viewable_get_preview (GIMP_VIEWABLE (imagefile),
|
||||
GIMP_THUMBNAIL_SIZE_NORMAL,
|
||||
GIMP_THUMBNAIL_SIZE_NORMAL);
|
||||
thumbnail = gimp_thumbnail_new ();
|
||||
gimp_thumbnail_set_uri (thumbnail, uri);
|
||||
|
||||
pixbuf = gimp_thumbnail_load_thumb (thumbnail,
|
||||
GIMP_THUMBNAIL_SIZE_NORMAL);
|
||||
}
|
||||
|
||||
if (temp_buf)
|
||||
if (pixbuf)
|
||||
{
|
||||
TempBuf *checks = NULL;
|
||||
width = gdk_pixbuf_get_width (pixbuf);
|
||||
height = gdk_pixbuf_get_height (pixbuf);
|
||||
|
||||
width = temp_buf->width;
|
||||
height = temp_buf->height;
|
||||
|
||||
switch (temp_buf->bytes)
|
||||
if (gdk_pixbuf_get_channels (pixbuf) != 3)
|
||||
{
|
||||
case 3:
|
||||
break;
|
||||
GdkPixbuf *tmp = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
|
||||
width, height);
|
||||
|
||||
case 4:
|
||||
{
|
||||
guchar *src, *dest;
|
||||
gdk_pixbuf_composite_color (pixbuf, tmp,
|
||||
0, 0, width, height, 0, 0, 1.0, 1.0,
|
||||
GDK_INTERP_NEAREST, 255,
|
||||
0, 0, GIMP_SMALL_CHECKS,
|
||||
0x666666ff, 0x999999ff);
|
||||
|
||||
checks = temp_buf_new_check (width, height,
|
||||
GIMP_GRAY_CHECKS,
|
||||
GIMP_SMALL_CHECKS);
|
||||
|
||||
src = temp_buf_data (temp_buf);
|
||||
dest = temp_buf_data (checks);
|
||||
|
||||
#define INT_MULT(a,b,t) ((t) = (a) * (b) + 0x80, ((((t) >> 8) + (t)) >> 8))
|
||||
#define INT_BLEND(a,b,alpha,t) (INT_MULT((a)-(b), alpha, t) + (b))
|
||||
|
||||
num_bytes = width * height;
|
||||
while (num_bytes--)
|
||||
{
|
||||
register glong t;
|
||||
|
||||
dest[0] = INT_BLEND (src[0] , dest[0] , src[3], t);
|
||||
dest[1] = INT_BLEND (src[1] , dest[1] , src[3], t);
|
||||
dest[2] = INT_BLEND (src[2] , dest[2] , src[3], t);
|
||||
src += 4;
|
||||
dest += 3;
|
||||
}
|
||||
|
||||
temp_buf = checks;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
g_object_unref (pixbuf);
|
||||
pixbuf = tmp;
|
||||
}
|
||||
|
||||
num_bytes = 3 * width * height;
|
||||
thumb_data = g_memdup (temp_buf_data (temp_buf), num_bytes);
|
||||
thumb_data = g_memdup (gdk_pixbuf_data (pixbuf), num_bytes);
|
||||
|
||||
if (checks)
|
||||
temp_buf_free (checks);
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
success = TRUE;
|
||||
}
|
||||
|
@ -296,9 +267,6 @@ HELP
|
|||
success = FALSE;
|
||||
}
|
||||
|
||||
if (imagefile)
|
||||
g_object_unref (imagefile);
|
||||
|
||||
g_free (uri);
|
||||
}
|
||||
CODE
|
||||
|
|
Loading…
Reference in New Issue