2001-06-01 23:05:46 +00:00
|
|
|
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
|
2000-10-05 21:40:37 +00:00
|
|
|
|
/* GdkPixbuf library - PNG image loader
|
1999-10-20 21:20:49 +00:00
|
|
|
|
*
|
1999-06-30 15:28:43 +00:00
|
|
|
|
* Copyright (C) 1999 Mark Crichton
|
1999-10-20 21:20:49 +00:00
|
|
|
|
* Copyright (C) 1999 The Free Software Foundation
|
|
|
|
|
*
|
|
|
|
|
* Authors: Mark Crichton <crichton@gimp.org>
|
|
|
|
|
* Federico Mena-Quintero <federico@gimp.org>
|
1999-01-05 04:31:03 +00:00
|
|
|
|
*
|
1999-06-30 15:28:43 +00:00
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1999-06-30 15:28:43 +00:00
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* Lesser General Public License for more details.
|
1999-06-30 15:28:43 +00:00
|
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
1999-10-20 21:20:49 +00:00
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
|
* Boston, MA 02111-1307, USA.
|
1999-01-05 04:31:03 +00:00
|
|
|
|
*/
|
1999-10-20 21:20:49 +00:00
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
|
#include "config.h"
|
1999-01-05 04:31:03 +00:00
|
|
|
|
#include <stdio.h>
|
2000-04-11 07:03:25 +00:00
|
|
|
|
#include <stdlib.h>
|
1999-01-05 04:31:03 +00:00
|
|
|
|
#include <png.h>
|
2000-04-11 07:03:25 +00:00
|
|
|
|
#include "gdk-pixbuf-private.h"
|
1999-12-02 20:44:43 +00:00
|
|
|
|
#include "gdk-pixbuf-io.h"
|
1999-10-20 21:20:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-03-25 00:15:00 +00:00
|
|
|
|
static gboolean
|
1999-10-27 19:42:34 +00:00
|
|
|
|
setup_png_transformations(png_structp png_read_ptr, png_infop png_info_ptr,
|
2002-03-25 00:15:00 +00:00
|
|
|
|
GError **error,
|
1999-10-27 19:42:34 +00:00
|
|
|
|
png_uint_32* width_p, png_uint_32* height_p,
|
|
|
|
|
int* color_type_p)
|
|
|
|
|
{
|
|
|
|
|
png_uint_32 width, height;
|
|
|
|
|
int bit_depth, color_type, interlace_type, compression_type, filter_type;
|
|
|
|
|
int channels;
|
|
|
|
|
|
|
|
|
|
/* Get the image info */
|
|
|
|
|
|
2002-03-25 00:15:00 +00:00
|
|
|
|
/* Must check bit depth, since png_get_IHDR generates an
|
|
|
|
|
FPE on bit_depth 0.
|
|
|
|
|
*/
|
|
|
|
|
bit_depth = png_get_bit_depth (png_read_ptr, png_info_ptr);
|
|
|
|
|
if (bit_depth < 1 || bit_depth > 16) {
|
2008-06-19 12:47:48 +00:00
|
|
|
|
g_set_error_literal (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
|
|
|
|
|
_("Bits per channel of PNG image is invalid."));
|
2002-03-25 00:15:00 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
1999-10-27 19:42:34 +00:00
|
|
|
|
png_get_IHDR (png_read_ptr, png_info_ptr,
|
|
|
|
|
&width, &height,
|
|
|
|
|
&bit_depth,
|
|
|
|
|
&color_type,
|
|
|
|
|
&interlace_type,
|
|
|
|
|
&compression_type,
|
|
|
|
|
&filter_type);
|
|
|
|
|
|
|
|
|
|
/* set_expand() basically needs to be called unless
|
|
|
|
|
we are already in RGB/RGBA mode
|
|
|
|
|
*/
|
|
|
|
|
if (color_type == PNG_COLOR_TYPE_PALETTE &&
|
|
|
|
|
bit_depth <= 8) {
|
|
|
|
|
|
|
|
|
|
/* Convert indexed images to RGB */
|
|
|
|
|
png_set_expand (png_read_ptr);
|
|
|
|
|
|
|
|
|
|
} else if (color_type == PNG_COLOR_TYPE_GRAY &&
|
|
|
|
|
bit_depth < 8) {
|
|
|
|
|
|
|
|
|
|
/* Convert grayscale to RGB */
|
|
|
|
|
png_set_expand (png_read_ptr);
|
|
|
|
|
|
|
|
|
|
} else if (png_get_valid (png_read_ptr,
|
|
|
|
|
png_info_ptr, PNG_INFO_tRNS)) {
|
|
|
|
|
|
|
|
|
|
/* If we have transparency header, convert it to alpha
|
|
|
|
|
channel */
|
|
|
|
|
png_set_expand(png_read_ptr);
|
|
|
|
|
|
|
|
|
|
} else if (bit_depth < 8) {
|
|
|
|
|
|
|
|
|
|
/* If we have < 8 scale it up to 8 */
|
|
|
|
|
png_set_expand(png_read_ptr);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Conceivably, png_set_packing() is a better idea;
|
|
|
|
|
* God only knows how libpng works
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If we are 16-bit, convert to 8-bit */
|
|
|
|
|
if (bit_depth == 16) {
|
|
|
|
|
png_set_strip_16(png_read_ptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If gray scale, convert to RGB */
|
|
|
|
|
if (color_type == PNG_COLOR_TYPE_GRAY ||
|
|
|
|
|
color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
|
|
|
|
|
png_set_gray_to_rgb(png_read_ptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If interlaced, handle that */
|
|
|
|
|
if (interlace_type != PNG_INTERLACE_NONE) {
|
|
|
|
|
png_set_interlace_handling(png_read_ptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Update the info the reflect our transformations */
|
|
|
|
|
png_read_update_info(png_read_ptr, png_info_ptr);
|
|
|
|
|
|
|
|
|
|
png_get_IHDR (png_read_ptr, png_info_ptr,
|
|
|
|
|
&width, &height,
|
|
|
|
|
&bit_depth,
|
|
|
|
|
&color_type,
|
|
|
|
|
&interlace_type,
|
|
|
|
|
&compression_type,
|
|
|
|
|
&filter_type);
|
|
|
|
|
|
|
|
|
|
*width_p = width;
|
|
|
|
|
*height_p = height;
|
|
|
|
|
*color_type_p = color_type;
|
|
|
|
|
|
|
|
|
|
/* Check that the new info is what we want */
|
|
|
|
|
|
2002-03-25 00:15:00 +00:00
|
|
|
|
if (width == 0 || height == 0) {
|
2008-06-19 12:47:48 +00:00
|
|
|
|
g_set_error_literal (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
|
|
|
|
|
_("Transformed PNG has zero width or height."));
|
2002-03-25 00:15:00 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
1999-10-27 19:42:34 +00:00
|
|
|
|
if (bit_depth != 8) {
|
2008-06-19 12:47:48 +00:00
|
|
|
|
g_set_error_literal (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
|
|
|
|
|
_("Bits per channel of transformed PNG is not 8."));
|
2002-03-25 00:15:00 +00:00
|
|
|
|
return FALSE;
|
1999-10-27 19:42:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( ! (color_type == PNG_COLOR_TYPE_RGB ||
|
|
|
|
|
color_type == PNG_COLOR_TYPE_RGB_ALPHA) ) {
|
2008-06-19 12:47:48 +00:00
|
|
|
|
g_set_error_literal (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
|
|
|
|
|
_("Transformed PNG not RGB or RGBA."));
|
2002-03-25 00:15:00 +00:00
|
|
|
|
return FALSE;
|
1999-10-27 19:42:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
channels = png_get_channels(png_read_ptr, png_info_ptr);
|
|
|
|
|
if ( ! (channels == 3 || channels == 4) ) {
|
2008-06-19 12:47:48 +00:00
|
|
|
|
g_set_error_literal (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
|
|
|
|
|
_("Transformed PNG has unsupported number of channels, must be 3 or 4."));
|
2002-03-25 00:15:00 +00:00
|
|
|
|
return FALSE;
|
1999-10-27 19:42:34 +00:00
|
|
|
|
}
|
2002-03-25 00:15:00 +00:00
|
|
|
|
return TRUE;
|
1999-10-27 19:42:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-18 18:42:54 +00:00
|
|
|
|
static void
|
|
|
|
|
png_simple_error_callback(png_structp png_save_ptr,
|
|
|
|
|
png_const_charp error_msg)
|
|
|
|
|
{
|
|
|
|
|
GError **error;
|
|
|
|
|
|
|
|
|
|
error = png_get_error_ptr(png_save_ptr);
|
|
|
|
|
|
|
|
|
|
/* I don't trust libpng to call the error callback only once,
|
|
|
|
|
* so check for already-set error
|
|
|
|
|
*/
|
|
|
|
|
if (error && *error == NULL) {
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_FAILED,
|
2000-11-14 01:08:28 +00:00
|
|
|
|
_("Fatal error in PNG image file: %s"),
|
2000-10-18 18:42:54 +00:00
|
|
|
|
error_msg);
|
|
|
|
|
}
|
2002-03-29 21:40:01 +00:00
|
|
|
|
|
|
|
|
|
longjmp (png_save_ptr->jmpbuf, 1);
|
2000-10-18 18:42:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
png_simple_warning_callback(png_structp png_save_ptr,
|
|
|
|
|
png_const_charp warning_msg)
|
|
|
|
|
{
|
|
|
|
|
/* Don't print anything; we should not be dumping junk to
|
|
|
|
|
* stderr, since that may be bad for some apps. If it's
|
|
|
|
|
* important enough to display, we need to add a GError
|
|
|
|
|
* **warning return location wherever we have an error return
|
|
|
|
|
* location.
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
2001-10-05 18:51:47 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
png_text_to_pixbuf_option (png_text text_ptr,
|
|
|
|
|
gchar **key,
|
|
|
|
|
gchar **value)
|
|
|
|
|
{
|
2007-01-17 14:07:01 +00:00
|
|
|
|
gboolean is_ascii = TRUE;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
/* Avoid loading iconv if the text is plain ASCII */
|
|
|
|
|
for (i = 0; i < text_ptr.text_length; i++)
|
|
|
|
|
if (text_ptr.text[i] & 0x80) {
|
|
|
|
|
is_ascii = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (is_ascii) {
|
2002-04-24 00:09:29 +00:00
|
|
|
|
*value = g_strdup (text_ptr.text);
|
2007-01-17 14:07:01 +00:00
|
|
|
|
} else {
|
|
|
|
|
*value = g_convert (text_ptr.text, -1,
|
|
|
|
|
"UTF-8", "ISO-8859-1",
|
|
|
|
|
NULL, NULL, NULL);
|
2002-04-24 00:09:29 +00:00
|
|
|
|
}
|
2007-01-17 14:07:01 +00:00
|
|
|
|
|
2001-10-05 18:51:47 +00:00
|
|
|
|
if (*value) {
|
|
|
|
|
*key = g_strconcat ("tEXt::", text_ptr.key, NULL);
|
|
|
|
|
return TRUE;
|
|
|
|
|
} else {
|
2002-04-24 00:09:29 +00:00
|
|
|
|
g_warning ("Couldn't convert text chunk value to UTF-8.");
|
2001-10-05 18:51:47 +00:00
|
|
|
|
*key = NULL;
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-26 23:17:31 +00:00
|
|
|
|
static png_voidp
|
|
|
|
|
png_malloc_callback (png_structp o, png_size_t size)
|
|
|
|
|
{
|
|
|
|
|
return g_try_malloc (size);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
png_free_callback (png_structp o, png_voidp x)
|
|
|
|
|
{
|
|
|
|
|
g_free (x);
|
|
|
|
|
}
|
|
|
|
|
|
1999-01-05 04:31:03 +00:00
|
|
|
|
/* Shared library entry point */
|
Add built marshaller files to support GdkPixbufLoader signals
2001-01-22 Havoc Pennington <hp@redhat.com>
* Makefile.am: Add built marshaller files to support
GdkPixbufLoader signals
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): have
GDK_PIXBUF_MODULEDIR unconditionally replace the compiled-in
module location, rather than acting as a fallback, because we are
using GDK_PIXBUF_MODULEDIR to use gdk-pixbuf before installing it.
* gdk-pixbuf.h: include gdk-pixbuf-loader.h
* gdk-pixbuf-loader.h, gdk-pixbuf-loader.c: Move back over here
from gtk, and add error to close(), because stop_load may do
parsing of the image.
* pixops/have_mmx.S (_pixops_have_mmx): add newline at end of file
* io-*.c: make individual operations static, and add fill_vtable
functions which are exported. Fix the collection of type warnings
that surfaced, including a number of functions that didn't
properly take a GError and some that weren't
const-correct. Involved adding error handling for a few loaders.
* gdk-pixbuf-io.h: Add error reporting to stop_load function
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): change to just look up
a function that fills in the GdkPixbufModule vtable, instead of
looking up all the image functions individually; this means we
can get type safety within modules for the loader functions.
Also it means you don't have to keep the statically compiled and
GModule versions in sync.
* test-gdk-pixbuf.c (main): remove gdk_pixbuf_init()
* make-inline-pixbuf.c (main): remove call to gdk_pixbuf_init()
* gdk-pixbuf.h: nuke gdk_pixbuf_init()
* gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_type): g_type_init
() here
* gdk-pixbuf.c (gdk_pixbuf_get_type): g_type_init () here
* gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_type):
g_type_init() here
2001-01-22 Havoc Pennington <hp@redhat.com>
* demos/testanimation.c: fix to reflect gdk-pixbuf changes
* demos/testpixbuf.c: fix to reflect gdk-pixbuf changes
* gtk/gdk-pixbuf-loader.c, gtk/gdk-pixbuf-loader.h:
Remove, move back to gdk-pixbuf
* gtk/gtktextiter.c, gtk/gtktextiter.h: add sentence equivalents
to all the word functions
* gtk/gtktextview.c (gtk_text_view_start_cursor_blink): return
before doing anything on NULL layout or if we don't have the focus
* gtk/testtext.c (fill_example_buffer): "justification"
* gtk/gtktexttag.h, gtk/gtktexttag.c: change the tag attribute
to be called "justification" not "justify"
* demos/gtk-demo/textview.c (create_tags): "justification"
* gtk/gtktextlayout.c (set_para_values): Handle char-wise wrapping
2001-01-22 23:09:48 +00:00
|
|
|
|
static GdkPixbuf *
|
2000-10-18 18:42:54 +00:00
|
|
|
|
gdk_pixbuf__png_image_load (FILE *f, GError **error)
|
1999-01-05 04:31:03 +00:00
|
|
|
|
{
|
2002-04-06 18:51:40 +00:00
|
|
|
|
GdkPixbuf * volatile pixbuf = NULL;
|
1999-10-18 19:29:45 +00:00
|
|
|
|
png_structp png_ptr;
|
2002-03-27 22:12:05 +00:00
|
|
|
|
png_infop info_ptr;
|
2001-10-05 18:51:47 +00:00
|
|
|
|
png_textp text_ptr;
|
2002-04-06 18:51:40 +00:00
|
|
|
|
gint i, ctype;
|
1999-10-22 15:18:03 +00:00
|
|
|
|
png_uint_32 w, h;
|
2002-01-20 04:52:47 +00:00
|
|
|
|
png_bytepp volatile rows = NULL;
|
2001-10-05 18:51:47 +00:00
|
|
|
|
gint num_texts;
|
2002-04-06 18:51:40 +00:00
|
|
|
|
gchar *key;
|
|
|
|
|
gchar *value;
|
1999-10-18 19:29:45 +00:00
|
|
|
|
|
2002-03-26 23:17:31 +00:00
|
|
|
|
#ifdef PNG_USER_MEM_SUPPORTED
|
|
|
|
|
png_ptr = png_create_read_struct_2 (PNG_LIBPNG_VER_STRING,
|
|
|
|
|
error,
|
|
|
|
|
png_simple_error_callback,
|
|
|
|
|
png_simple_warning_callback,
|
|
|
|
|
NULL,
|
|
|
|
|
png_malloc_callback,
|
|
|
|
|
png_free_callback);
|
|
|
|
|
#else
|
2000-10-18 18:42:54 +00:00
|
|
|
|
png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING,
|
|
|
|
|
error,
|
|
|
|
|
png_simple_error_callback,
|
|
|
|
|
png_simple_warning_callback);
|
2002-03-26 23:17:31 +00:00
|
|
|
|
#endif
|
1999-10-18 19:29:45 +00:00
|
|
|
|
if (!png_ptr)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
info_ptr = png_create_info_struct (png_ptr);
|
|
|
|
|
if (!info_ptr) {
|
|
|
|
|
png_destroy_read_struct (&png_ptr, NULL, NULL);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (setjmp (png_ptr->jmpbuf)) {
|
2007-03-09 21:57:37 +00:00
|
|
|
|
g_free (rows);
|
2002-01-20 04:52:47 +00:00
|
|
|
|
|
2002-04-06 18:51:40 +00:00
|
|
|
|
if (pixbuf)
|
|
|
|
|
g_object_unref (pixbuf);
|
2002-01-20 04:52:47 +00:00
|
|
|
|
|
2002-03-27 22:12:05 +00:00
|
|
|
|
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
1999-10-18 19:29:45 +00:00
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
1999-10-20 21:20:49 +00:00
|
|
|
|
png_init_io (png_ptr, f);
|
1999-10-18 19:29:45 +00:00
|
|
|
|
png_read_info (png_ptr, info_ptr);
|
1999-06-29 02:54:16 +00:00
|
|
|
|
|
2002-03-25 00:15:00 +00:00
|
|
|
|
if (!setup_png_transformations(png_ptr, info_ptr, error, &w, &h, &ctype)) {
|
2002-03-27 22:12:05 +00:00
|
|
|
|
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
1999-10-27 19:42:34 +00:00
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-06 18:51:40 +00:00
|
|
|
|
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, ctype & PNG_COLOR_MASK_ALPHA, 8, w, h);
|
|
|
|
|
|
|
|
|
|
if (!pixbuf) {
|
2000-10-18 18:42:54 +00:00
|
|
|
|
if (error && *error == NULL) {
|
2008-06-19 12:47:48 +00:00
|
|
|
|
g_set_error_literal (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
|
|
|
|
|
_("Insufficient memory to load PNG file"));
|
2000-10-18 18:42:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-04-06 18:51:40 +00:00
|
|
|
|
|
2002-03-27 22:12:05 +00:00
|
|
|
|
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
1999-10-18 19:29:45 +00:00
|
|
|
|
return NULL;
|
|
|
|
|
}
|
1999-10-20 21:20:49 +00:00
|
|
|
|
|
1999-10-22 15:18:03 +00:00
|
|
|
|
rows = g_new (png_bytep, h);
|
1999-10-20 21:20:49 +00:00
|
|
|
|
|
1999-10-22 15:18:03 +00:00
|
|
|
|
for (i = 0; i < h; i++)
|
2002-04-06 18:51:40 +00:00
|
|
|
|
rows[i] = pixbuf->pixels + i * pixbuf->rowstride;
|
1999-10-20 21:20:49 +00:00
|
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
|
png_read_image (png_ptr, rows);
|
2002-03-27 22:12:05 +00:00
|
|
|
|
png_read_end (png_ptr, info_ptr);
|
2001-10-05 18:51:47 +00:00
|
|
|
|
|
|
|
|
|
if (png_get_text (png_ptr, info_ptr, &text_ptr, &num_texts)) {
|
|
|
|
|
for (i = 0; i < num_texts; i++) {
|
2002-04-06 18:51:40 +00:00
|
|
|
|
png_text_to_pixbuf_option (text_ptr[i], &key, &value);
|
2002-09-19 21:00:52 +00:00
|
|
|
|
gdk_pixbuf_set_option (pixbuf, key, value);
|
2002-04-06 18:51:40 +00:00
|
|
|
|
g_free (key);
|
|
|
|
|
g_free (value);
|
2001-10-05 18:51:47 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-06 18:51:40 +00:00
|
|
|
|
g_free (rows);
|
|
|
|
|
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
2001-10-05 18:51:47 +00:00
|
|
|
|
|
|
|
|
|
return pixbuf;
|
1999-07-30 15:34:18 +00:00
|
|
|
|
}
|
1999-10-26 16:26:00 +00:00
|
|
|
|
|
2000-06-09 19:41:29 +00:00
|
|
|
|
/* I wish these avoided the setjmp()/longjmp() crap in libpng instead
|
|
|
|
|
just allow you to change the error reporting. */
|
1999-10-27 18:55:00 +00:00
|
|
|
|
static void png_error_callback (png_structp png_read_ptr,
|
|
|
|
|
png_const_charp error_msg);
|
|
|
|
|
|
2007-04-28 14:48:22 +00:00
|
|
|
|
static void png_warning_callback (png_structp png_read_ptr,
|
|
|
|
|
png_const_charp warning_msg);
|
1999-10-27 18:55:00 +00:00
|
|
|
|
|
|
|
|
|
/* Called at the start of the progressive load */
|
|
|
|
|
static void png_info_callback (png_structp png_read_ptr,
|
|
|
|
|
png_infop png_info_ptr);
|
|
|
|
|
|
|
|
|
|
/* Called for each row; note that you will get duplicate row numbers
|
|
|
|
|
for interlaced PNGs */
|
|
|
|
|
static void png_row_callback (png_structp png_read_ptr,
|
|
|
|
|
png_bytep new_row,
|
|
|
|
|
png_uint_32 row_num,
|
|
|
|
|
int pass_num);
|
|
|
|
|
|
|
|
|
|
/* Called after reading the entire image */
|
|
|
|
|
static void png_end_callback (png_structp png_read_ptr,
|
|
|
|
|
png_infop png_info_ptr);
|
|
|
|
|
|
|
|
|
|
typedef struct _LoadContext LoadContext;
|
|
|
|
|
|
|
|
|
|
struct _LoadContext {
|
|
|
|
|
png_structp png_read_ptr;
|
|
|
|
|
png_infop png_info_ptr;
|
|
|
|
|
|
2004-01-07 00:26:58 +00:00
|
|
|
|
GdkPixbufModuleSizeFunc size_func;
|
2002-10-03 22:39:51 +00:00
|
|
|
|
GdkPixbufModulePreparedFunc prepare_func;
|
|
|
|
|
GdkPixbufModuleUpdatedFunc update_func;
|
1999-10-27 18:55:00 +00:00
|
|
|
|
gpointer notify_user_data;
|
|
|
|
|
|
|
|
|
|
GdkPixbuf* pixbuf;
|
1999-11-22 23:04:52 +00:00
|
|
|
|
|
|
|
|
|
/* row number of first row seen, or -1 if none yet seen */
|
|
|
|
|
|
|
|
|
|
gint first_row_seen_in_chunk;
|
|
|
|
|
|
|
|
|
|
/* pass number for the first row seen */
|
|
|
|
|
|
|
|
|
|
gint first_pass_seen_in_chunk;
|
|
|
|
|
|
|
|
|
|
/* row number of last row seen */
|
|
|
|
|
gint last_row_seen_in_chunk;
|
|
|
|
|
|
|
|
|
|
gint last_pass_seen_in_chunk;
|
|
|
|
|
|
|
|
|
|
/* highest row number seen */
|
|
|
|
|
gint max_row_seen_in_chunk;
|
1999-10-27 18:55:00 +00:00
|
|
|
|
|
|
|
|
|
guint fatal_error_occurred : 1;
|
|
|
|
|
|
2000-10-18 18:42:54 +00:00
|
|
|
|
GError **error;
|
1999-10-27 18:55:00 +00:00
|
|
|
|
};
|
|
|
|
|
|
Add built marshaller files to support GdkPixbufLoader signals
2001-01-22 Havoc Pennington <hp@redhat.com>
* Makefile.am: Add built marshaller files to support
GdkPixbufLoader signals
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): have
GDK_PIXBUF_MODULEDIR unconditionally replace the compiled-in
module location, rather than acting as a fallback, because we are
using GDK_PIXBUF_MODULEDIR to use gdk-pixbuf before installing it.
* gdk-pixbuf.h: include gdk-pixbuf-loader.h
* gdk-pixbuf-loader.h, gdk-pixbuf-loader.c: Move back over here
from gtk, and add error to close(), because stop_load may do
parsing of the image.
* pixops/have_mmx.S (_pixops_have_mmx): add newline at end of file
* io-*.c: make individual operations static, and add fill_vtable
functions which are exported. Fix the collection of type warnings
that surfaced, including a number of functions that didn't
properly take a GError and some that weren't
const-correct. Involved adding error handling for a few loaders.
* gdk-pixbuf-io.h: Add error reporting to stop_load function
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): change to just look up
a function that fills in the GdkPixbufModule vtable, instead of
looking up all the image functions individually; this means we
can get type safety within modules for the loader functions.
Also it means you don't have to keep the statically compiled and
GModule versions in sync.
* test-gdk-pixbuf.c (main): remove gdk_pixbuf_init()
* make-inline-pixbuf.c (main): remove call to gdk_pixbuf_init()
* gdk-pixbuf.h: nuke gdk_pixbuf_init()
* gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_type): g_type_init
() here
* gdk-pixbuf.c (gdk_pixbuf_get_type): g_type_init () here
* gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_type):
g_type_init() here
2001-01-22 Havoc Pennington <hp@redhat.com>
* demos/testanimation.c: fix to reflect gdk-pixbuf changes
* demos/testpixbuf.c: fix to reflect gdk-pixbuf changes
* gtk/gdk-pixbuf-loader.c, gtk/gdk-pixbuf-loader.h:
Remove, move back to gdk-pixbuf
* gtk/gtktextiter.c, gtk/gtktextiter.h: add sentence equivalents
to all the word functions
* gtk/gtktextview.c (gtk_text_view_start_cursor_blink): return
before doing anything on NULL layout or if we don't have the focus
* gtk/testtext.c (fill_example_buffer): "justification"
* gtk/gtktexttag.h, gtk/gtktexttag.c: change the tag attribute
to be called "justification" not "justify"
* demos/gtk-demo/textview.c (create_tags): "justification"
* gtk/gtktextlayout.c (set_para_values): Handle char-wise wrapping
2001-01-22 23:09:48 +00:00
|
|
|
|
static gpointer
|
2002-10-03 22:39:51 +00:00
|
|
|
|
gdk_pixbuf__png_image_begin_load (GdkPixbufModuleSizeFunc size_func,
|
|
|
|
|
GdkPixbufModulePreparedFunc prepare_func,
|
|
|
|
|
GdkPixbufModuleUpdatedFunc update_func,
|
2000-10-18 18:42:54 +00:00
|
|
|
|
gpointer user_data,
|
|
|
|
|
GError **error)
|
1999-10-27 18:55:00 +00:00
|
|
|
|
{
|
|
|
|
|
LoadContext* lc;
|
|
|
|
|
|
|
|
|
|
lc = g_new0(LoadContext, 1);
|
|
|
|
|
|
|
|
|
|
lc->fatal_error_occurred = FALSE;
|
|
|
|
|
|
2004-01-07 00:26:58 +00:00
|
|
|
|
lc->size_func = size_func;
|
1999-11-22 23:04:52 +00:00
|
|
|
|
lc->prepare_func = prepare_func;
|
|
|
|
|
lc->update_func = update_func;
|
1999-10-27 18:55:00 +00:00
|
|
|
|
lc->notify_user_data = user_data;
|
|
|
|
|
|
1999-11-22 23:04:52 +00:00
|
|
|
|
lc->first_row_seen_in_chunk = -1;
|
|
|
|
|
lc->last_row_seen_in_chunk = -1;
|
|
|
|
|
lc->first_pass_seen_in_chunk = -1;
|
|
|
|
|
lc->last_pass_seen_in_chunk = -1;
|
|
|
|
|
lc->max_row_seen_in_chunk = -1;
|
2000-10-18 18:42:54 +00:00
|
|
|
|
lc->error = error;
|
1999-11-22 23:04:52 +00:00
|
|
|
|
|
1999-10-27 18:55:00 +00:00
|
|
|
|
/* Create the main PNG context struct */
|
|
|
|
|
|
2002-03-26 23:17:31 +00:00
|
|
|
|
#ifdef PNG_USER_MEM_SUPPORTED
|
|
|
|
|
lc->png_read_ptr = png_create_read_struct_2 (PNG_LIBPNG_VER_STRING,
|
|
|
|
|
lc, /* error/warning callback data */
|
|
|
|
|
png_error_callback,
|
|
|
|
|
png_warning_callback,
|
|
|
|
|
NULL,
|
|
|
|
|
png_malloc_callback,
|
|
|
|
|
png_free_callback);
|
|
|
|
|
#else
|
1999-10-27 18:55:00 +00:00
|
|
|
|
lc->png_read_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
|
|
|
|
|
lc, /* error/warning callback data */
|
|
|
|
|
png_error_callback,
|
|
|
|
|
png_warning_callback);
|
2002-03-26 23:17:31 +00:00
|
|
|
|
#endif
|
1999-10-27 18:55:00 +00:00
|
|
|
|
if (lc->png_read_ptr == NULL) {
|
|
|
|
|
g_free(lc);
|
2000-10-18 18:42:54 +00:00
|
|
|
|
/* error callback should have set the error */
|
1999-10-27 18:55:00 +00:00
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2000-10-18 18:42:54 +00:00
|
|
|
|
|
2000-06-09 19:41:29 +00:00
|
|
|
|
if (setjmp (lc->png_read_ptr->jmpbuf)) {
|
|
|
|
|
if (lc->png_info_ptr)
|
|
|
|
|
png_destroy_read_struct(&lc->png_read_ptr, NULL, NULL);
|
|
|
|
|
g_free(lc);
|
2000-10-18 18:42:54 +00:00
|
|
|
|
/* error callback should have set the error */
|
2000-06-09 19:41:29 +00:00
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
1999-10-27 19:42:34 +00:00
|
|
|
|
/* Create the auxiliary context struct */
|
1999-10-27 18:55:00 +00:00
|
|
|
|
|
|
|
|
|
lc->png_info_ptr = png_create_info_struct(lc->png_read_ptr);
|
|
|
|
|
|
|
|
|
|
if (lc->png_info_ptr == NULL) {
|
|
|
|
|
png_destroy_read_struct(&lc->png_read_ptr, NULL, NULL);
|
|
|
|
|
g_free(lc);
|
2000-10-18 18:42:54 +00:00
|
|
|
|
/* error callback should have set the error */
|
1999-10-27 18:55:00 +00:00
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
png_set_progressive_read_fn(lc->png_read_ptr,
|
|
|
|
|
lc, /* callback data */
|
|
|
|
|
png_info_callback,
|
|
|
|
|
png_row_callback,
|
|
|
|
|
png_end_callback);
|
|
|
|
|
|
|
|
|
|
|
2000-10-18 18:42:54 +00:00
|
|
|
|
/* We don't want to keep modifying error after returning here,
|
|
|
|
|
* it may no longer be valid.
|
|
|
|
|
*/
|
|
|
|
|
lc->error = NULL;
|
|
|
|
|
|
1999-10-27 18:55:00 +00:00
|
|
|
|
return lc;
|
|
|
|
|
}
|
|
|
|
|
|
Add built marshaller files to support GdkPixbufLoader signals
2001-01-22 Havoc Pennington <hp@redhat.com>
* Makefile.am: Add built marshaller files to support
GdkPixbufLoader signals
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): have
GDK_PIXBUF_MODULEDIR unconditionally replace the compiled-in
module location, rather than acting as a fallback, because we are
using GDK_PIXBUF_MODULEDIR to use gdk-pixbuf before installing it.
* gdk-pixbuf.h: include gdk-pixbuf-loader.h
* gdk-pixbuf-loader.h, gdk-pixbuf-loader.c: Move back over here
from gtk, and add error to close(), because stop_load may do
parsing of the image.
* pixops/have_mmx.S (_pixops_have_mmx): add newline at end of file
* io-*.c: make individual operations static, and add fill_vtable
functions which are exported. Fix the collection of type warnings
that surfaced, including a number of functions that didn't
properly take a GError and some that weren't
const-correct. Involved adding error handling for a few loaders.
* gdk-pixbuf-io.h: Add error reporting to stop_load function
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): change to just look up
a function that fills in the GdkPixbufModule vtable, instead of
looking up all the image functions individually; this means we
can get type safety within modules for the loader functions.
Also it means you don't have to keep the statically compiled and
GModule versions in sync.
* test-gdk-pixbuf.c (main): remove gdk_pixbuf_init()
* make-inline-pixbuf.c (main): remove call to gdk_pixbuf_init()
* gdk-pixbuf.h: nuke gdk_pixbuf_init()
* gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_type): g_type_init
() here
* gdk-pixbuf.c (gdk_pixbuf_get_type): g_type_init () here
* gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_type):
g_type_init() here
2001-01-22 Havoc Pennington <hp@redhat.com>
* demos/testanimation.c: fix to reflect gdk-pixbuf changes
* demos/testpixbuf.c: fix to reflect gdk-pixbuf changes
* gtk/gdk-pixbuf-loader.c, gtk/gdk-pixbuf-loader.h:
Remove, move back to gdk-pixbuf
* gtk/gtktextiter.c, gtk/gtktextiter.h: add sentence equivalents
to all the word functions
* gtk/gtktextview.c (gtk_text_view_start_cursor_blink): return
before doing anything on NULL layout or if we don't have the focus
* gtk/testtext.c (fill_example_buffer): "justification"
* gtk/gtktexttag.h, gtk/gtktexttag.c: change the tag attribute
to be called "justification" not "justify"
* demos/gtk-demo/textview.c (create_tags): "justification"
* gtk/gtktextlayout.c (set_para_values): Handle char-wise wrapping
2001-01-22 23:09:48 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gdk_pixbuf__png_image_stop_load (gpointer context, GError **error)
|
1999-10-27 18:55:00 +00:00
|
|
|
|
{
|
|
|
|
|
LoadContext* lc = context;
|
|
|
|
|
|
Add built marshaller files to support GdkPixbufLoader signals
2001-01-22 Havoc Pennington <hp@redhat.com>
* Makefile.am: Add built marshaller files to support
GdkPixbufLoader signals
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): have
GDK_PIXBUF_MODULEDIR unconditionally replace the compiled-in
module location, rather than acting as a fallback, because we are
using GDK_PIXBUF_MODULEDIR to use gdk-pixbuf before installing it.
* gdk-pixbuf.h: include gdk-pixbuf-loader.h
* gdk-pixbuf-loader.h, gdk-pixbuf-loader.c: Move back over here
from gtk, and add error to close(), because stop_load may do
parsing of the image.
* pixops/have_mmx.S (_pixops_have_mmx): add newline at end of file
* io-*.c: make individual operations static, and add fill_vtable
functions which are exported. Fix the collection of type warnings
that surfaced, including a number of functions that didn't
properly take a GError and some that weren't
const-correct. Involved adding error handling for a few loaders.
* gdk-pixbuf-io.h: Add error reporting to stop_load function
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): change to just look up
a function that fills in the GdkPixbufModule vtable, instead of
looking up all the image functions individually; this means we
can get type safety within modules for the loader functions.
Also it means you don't have to keep the statically compiled and
GModule versions in sync.
* test-gdk-pixbuf.c (main): remove gdk_pixbuf_init()
* make-inline-pixbuf.c (main): remove call to gdk_pixbuf_init()
* gdk-pixbuf.h: nuke gdk_pixbuf_init()
* gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_type): g_type_init
() here
* gdk-pixbuf.c (gdk_pixbuf_get_type): g_type_init () here
* gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_type):
g_type_init() here
2001-01-22 Havoc Pennington <hp@redhat.com>
* demos/testanimation.c: fix to reflect gdk-pixbuf changes
* demos/testpixbuf.c: fix to reflect gdk-pixbuf changes
* gtk/gdk-pixbuf-loader.c, gtk/gdk-pixbuf-loader.h:
Remove, move back to gdk-pixbuf
* gtk/gtktextiter.c, gtk/gtktextiter.h: add sentence equivalents
to all the word functions
* gtk/gtktextview.c (gtk_text_view_start_cursor_blink): return
before doing anything on NULL layout or if we don't have the focus
* gtk/testtext.c (fill_example_buffer): "justification"
* gtk/gtktexttag.h, gtk/gtktexttag.c: change the tag attribute
to be called "justification" not "justify"
* demos/gtk-demo/textview.c (create_tags): "justification"
* gtk/gtktextlayout.c (set_para_values): Handle char-wise wrapping
2001-01-22 23:09:48 +00:00
|
|
|
|
g_return_val_if_fail(lc != NULL, TRUE);
|
1999-10-27 18:55:00 +00:00
|
|
|
|
|
Add built marshaller files to support GdkPixbufLoader signals
2001-01-22 Havoc Pennington <hp@redhat.com>
* Makefile.am: Add built marshaller files to support
GdkPixbufLoader signals
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): have
GDK_PIXBUF_MODULEDIR unconditionally replace the compiled-in
module location, rather than acting as a fallback, because we are
using GDK_PIXBUF_MODULEDIR to use gdk-pixbuf before installing it.
* gdk-pixbuf.h: include gdk-pixbuf-loader.h
* gdk-pixbuf-loader.h, gdk-pixbuf-loader.c: Move back over here
from gtk, and add error to close(), because stop_load may do
parsing of the image.
* pixops/have_mmx.S (_pixops_have_mmx): add newline at end of file
* io-*.c: make individual operations static, and add fill_vtable
functions which are exported. Fix the collection of type warnings
that surfaced, including a number of functions that didn't
properly take a GError and some that weren't
const-correct. Involved adding error handling for a few loaders.
* gdk-pixbuf-io.h: Add error reporting to stop_load function
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): change to just look up
a function that fills in the GdkPixbufModule vtable, instead of
looking up all the image functions individually; this means we
can get type safety within modules for the loader functions.
Also it means you don't have to keep the statically compiled and
GModule versions in sync.
* test-gdk-pixbuf.c (main): remove gdk_pixbuf_init()
* make-inline-pixbuf.c (main): remove call to gdk_pixbuf_init()
* gdk-pixbuf.h: nuke gdk_pixbuf_init()
* gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_type): g_type_init
() here
* gdk-pixbuf.c (gdk_pixbuf_get_type): g_type_init () here
* gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_type):
g_type_init() here
2001-01-22 Havoc Pennington <hp@redhat.com>
* demos/testanimation.c: fix to reflect gdk-pixbuf changes
* demos/testpixbuf.c: fix to reflect gdk-pixbuf changes
* gtk/gdk-pixbuf-loader.c, gtk/gdk-pixbuf-loader.h:
Remove, move back to gdk-pixbuf
* gtk/gtktextiter.c, gtk/gtktextiter.h: add sentence equivalents
to all the word functions
* gtk/gtktextview.c (gtk_text_view_start_cursor_blink): return
before doing anything on NULL layout or if we don't have the focus
* gtk/testtext.c (fill_example_buffer): "justification"
* gtk/gtktexttag.h, gtk/gtktexttag.c: change the tag attribute
to be called "justification" not "justify"
* demos/gtk-demo/textview.c (create_tags): "justification"
* gtk/gtktextlayout.c (set_para_values): Handle char-wise wrapping
2001-01-22 23:09:48 +00:00
|
|
|
|
/* FIXME this thing needs to report errors if
|
|
|
|
|
* we have unused image data
|
|
|
|
|
*/
|
|
|
|
|
|
2001-06-01 23:05:46 +00:00
|
|
|
|
if (lc->pixbuf)
|
Remove assorted G_OBJECT casts where unnecessary.
2001-12-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk-pixbuf-animation.c, gdk-pixbuf-loader.c, gdk-pixpuf.c,
io-gif-animation.c, io-gif.c, io-tiff.c, test-loaders.c: Remove
assorted G_OBJECT casts where unnecessary.
* gdk-pixbuf-loader.c: Call g_object_ref and g_object_unref
instead of gdk_pixbuf_animation_ref and gdk_pixbuf_animation_unref
resp.
* gdk-pixbuf-csource.c, io-bmp.c, io-gif-animation.c, io-ico.c,
io-jpeg.c, io-png.c, io-pnm.c, io-ras.c, io-tga.c, io-wbmp.c,
io-xbm.c, io-xpm.c, test-gdk-pixbuf.c: Dito for gdk_pixbuf_ref and
gdk_pixbuf_unref.
* Makefile.am, pixops/Makefile.am: Compile everything with
-DG_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED
* gdk-pixdata.c: Use g_ascii_strup() instead of g_strup().
* io-xpm.c: Use g_ascii_strcasecmp() instead of g_strcasecmp().
* demos/testpixbuf-drawable.c, demos/testpixbuf-save.c,
demos/testpixbuf-scale.c, demos/testpixbuf.c: Call g_object_ref
and g_object_unref instead of gdk_pixbuf_ref and gdk_pixbuf_unref
resp.
2001-12-13 21:22:12 +00:00
|
|
|
|
g_object_unref (lc->pixbuf);
|
1999-10-27 18:55:00 +00:00
|
|
|
|
|
2002-03-27 22:12:05 +00:00
|
|
|
|
png_destroy_read_struct(&lc->png_read_ptr, &lc->png_info_ptr, NULL);
|
1999-10-27 18:55:00 +00:00
|
|
|
|
g_free(lc);
|
Add built marshaller files to support GdkPixbufLoader signals
2001-01-22 Havoc Pennington <hp@redhat.com>
* Makefile.am: Add built marshaller files to support
GdkPixbufLoader signals
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): have
GDK_PIXBUF_MODULEDIR unconditionally replace the compiled-in
module location, rather than acting as a fallback, because we are
using GDK_PIXBUF_MODULEDIR to use gdk-pixbuf before installing it.
* gdk-pixbuf.h: include gdk-pixbuf-loader.h
* gdk-pixbuf-loader.h, gdk-pixbuf-loader.c: Move back over here
from gtk, and add error to close(), because stop_load may do
parsing of the image.
* pixops/have_mmx.S (_pixops_have_mmx): add newline at end of file
* io-*.c: make individual operations static, and add fill_vtable
functions which are exported. Fix the collection of type warnings
that surfaced, including a number of functions that didn't
properly take a GError and some that weren't
const-correct. Involved adding error handling for a few loaders.
* gdk-pixbuf-io.h: Add error reporting to stop_load function
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): change to just look up
a function that fills in the GdkPixbufModule vtable, instead of
looking up all the image functions individually; this means we
can get type safety within modules for the loader functions.
Also it means you don't have to keep the statically compiled and
GModule versions in sync.
* test-gdk-pixbuf.c (main): remove gdk_pixbuf_init()
* make-inline-pixbuf.c (main): remove call to gdk_pixbuf_init()
* gdk-pixbuf.h: nuke gdk_pixbuf_init()
* gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_type): g_type_init
() here
* gdk-pixbuf.c (gdk_pixbuf_get_type): g_type_init () here
* gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_type):
g_type_init() here
2001-01-22 Havoc Pennington <hp@redhat.com>
* demos/testanimation.c: fix to reflect gdk-pixbuf changes
* demos/testpixbuf.c: fix to reflect gdk-pixbuf changes
* gtk/gdk-pixbuf-loader.c, gtk/gdk-pixbuf-loader.h:
Remove, move back to gdk-pixbuf
* gtk/gtktextiter.c, gtk/gtktextiter.h: add sentence equivalents
to all the word functions
* gtk/gtktextview.c (gtk_text_view_start_cursor_blink): return
before doing anything on NULL layout or if we don't have the focus
* gtk/testtext.c (fill_example_buffer): "justification"
* gtk/gtktexttag.h, gtk/gtktexttag.c: change the tag attribute
to be called "justification" not "justify"
* demos/gtk-demo/textview.c (create_tags): "justification"
* gtk/gtktextlayout.c (set_para_values): Handle char-wise wrapping
2001-01-22 23:09:48 +00:00
|
|
|
|
|
|
|
|
|
return TRUE;
|
1999-10-27 18:55:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
Add built marshaller files to support GdkPixbufLoader signals
2001-01-22 Havoc Pennington <hp@redhat.com>
* Makefile.am: Add built marshaller files to support
GdkPixbufLoader signals
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): have
GDK_PIXBUF_MODULEDIR unconditionally replace the compiled-in
module location, rather than acting as a fallback, because we are
using GDK_PIXBUF_MODULEDIR to use gdk-pixbuf before installing it.
* gdk-pixbuf.h: include gdk-pixbuf-loader.h
* gdk-pixbuf-loader.h, gdk-pixbuf-loader.c: Move back over here
from gtk, and add error to close(), because stop_load may do
parsing of the image.
* pixops/have_mmx.S (_pixops_have_mmx): add newline at end of file
* io-*.c: make individual operations static, and add fill_vtable
functions which are exported. Fix the collection of type warnings
that surfaced, including a number of functions that didn't
properly take a GError and some that weren't
const-correct. Involved adding error handling for a few loaders.
* gdk-pixbuf-io.h: Add error reporting to stop_load function
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): change to just look up
a function that fills in the GdkPixbufModule vtable, instead of
looking up all the image functions individually; this means we
can get type safety within modules for the loader functions.
Also it means you don't have to keep the statically compiled and
GModule versions in sync.
* test-gdk-pixbuf.c (main): remove gdk_pixbuf_init()
* make-inline-pixbuf.c (main): remove call to gdk_pixbuf_init()
* gdk-pixbuf.h: nuke gdk_pixbuf_init()
* gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_type): g_type_init
() here
* gdk-pixbuf.c (gdk_pixbuf_get_type): g_type_init () here
* gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_type):
g_type_init() here
2001-01-22 Havoc Pennington <hp@redhat.com>
* demos/testanimation.c: fix to reflect gdk-pixbuf changes
* demos/testpixbuf.c: fix to reflect gdk-pixbuf changes
* gtk/gdk-pixbuf-loader.c, gtk/gdk-pixbuf-loader.h:
Remove, move back to gdk-pixbuf
* gtk/gtktextiter.c, gtk/gtktextiter.h: add sentence equivalents
to all the word functions
* gtk/gtktextview.c (gtk_text_view_start_cursor_blink): return
before doing anything on NULL layout or if we don't have the focus
* gtk/testtext.c (fill_example_buffer): "justification"
* gtk/gtktexttag.h, gtk/gtktexttag.c: change the tag attribute
to be called "justification" not "justify"
* demos/gtk-demo/textview.c (create_tags): "justification"
* gtk/gtktextlayout.c (set_para_values): Handle char-wise wrapping
2001-01-22 23:09:48 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gdk_pixbuf__png_image_load_increment(gpointer context,
|
|
|
|
|
const guchar *buf, guint size,
|
2000-10-18 18:42:54 +00:00
|
|
|
|
GError **error)
|
1999-10-27 18:55:00 +00:00
|
|
|
|
{
|
|
|
|
|
LoadContext* lc = context;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail(lc != NULL, FALSE);
|
|
|
|
|
|
1999-11-22 23:04:52 +00:00
|
|
|
|
/* reset */
|
|
|
|
|
lc->first_row_seen_in_chunk = -1;
|
|
|
|
|
lc->last_row_seen_in_chunk = -1;
|
|
|
|
|
lc->first_pass_seen_in_chunk = -1;
|
|
|
|
|
lc->last_pass_seen_in_chunk = -1;
|
|
|
|
|
lc->max_row_seen_in_chunk = -1;
|
2000-10-18 18:42:54 +00:00
|
|
|
|
lc->error = error;
|
1999-11-22 23:04:52 +00:00
|
|
|
|
|
1999-10-27 18:55:00 +00:00
|
|
|
|
/* Invokes our callbacks as needed */
|
2000-06-09 19:41:29 +00:00
|
|
|
|
if (setjmp (lc->png_read_ptr->jmpbuf)) {
|
2000-10-18 18:42:54 +00:00
|
|
|
|
lc->error = NULL;
|
2000-06-09 19:41:29 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
} else {
|
Add built marshaller files to support GdkPixbufLoader signals
2001-01-22 Havoc Pennington <hp@redhat.com>
* Makefile.am: Add built marshaller files to support
GdkPixbufLoader signals
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): have
GDK_PIXBUF_MODULEDIR unconditionally replace the compiled-in
module location, rather than acting as a fallback, because we are
using GDK_PIXBUF_MODULEDIR to use gdk-pixbuf before installing it.
* gdk-pixbuf.h: include gdk-pixbuf-loader.h
* gdk-pixbuf-loader.h, gdk-pixbuf-loader.c: Move back over here
from gtk, and add error to close(), because stop_load may do
parsing of the image.
* pixops/have_mmx.S (_pixops_have_mmx): add newline at end of file
* io-*.c: make individual operations static, and add fill_vtable
functions which are exported. Fix the collection of type warnings
that surfaced, including a number of functions that didn't
properly take a GError and some that weren't
const-correct. Involved adding error handling for a few loaders.
* gdk-pixbuf-io.h: Add error reporting to stop_load function
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): change to just look up
a function that fills in the GdkPixbufModule vtable, instead of
looking up all the image functions individually; this means we
can get type safety within modules for the loader functions.
Also it means you don't have to keep the statically compiled and
GModule versions in sync.
* test-gdk-pixbuf.c (main): remove gdk_pixbuf_init()
* make-inline-pixbuf.c (main): remove call to gdk_pixbuf_init()
* gdk-pixbuf.h: nuke gdk_pixbuf_init()
* gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_type): g_type_init
() here
* gdk-pixbuf.c (gdk_pixbuf_get_type): g_type_init () here
* gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_type):
g_type_init() here
2001-01-22 Havoc Pennington <hp@redhat.com>
* demos/testanimation.c: fix to reflect gdk-pixbuf changes
* demos/testpixbuf.c: fix to reflect gdk-pixbuf changes
* gtk/gdk-pixbuf-loader.c, gtk/gdk-pixbuf-loader.h:
Remove, move back to gdk-pixbuf
* gtk/gtktextiter.c, gtk/gtktextiter.h: add sentence equivalents
to all the word functions
* gtk/gtktextview.c (gtk_text_view_start_cursor_blink): return
before doing anything on NULL layout or if we don't have the focus
* gtk/testtext.c (fill_example_buffer): "justification"
* gtk/gtktexttag.h, gtk/gtktexttag.c: change the tag attribute
to be called "justification" not "justify"
* demos/gtk-demo/textview.c (create_tags): "justification"
* gtk/gtktextlayout.c (set_para_values): Handle char-wise wrapping
2001-01-22 23:09:48 +00:00
|
|
|
|
png_process_data(lc->png_read_ptr, lc->png_info_ptr,
|
|
|
|
|
(guchar*) buf, size);
|
2000-06-09 19:41:29 +00:00
|
|
|
|
}
|
1999-10-27 18:55:00 +00:00
|
|
|
|
|
2000-10-18 18:42:54 +00:00
|
|
|
|
if (lc->fatal_error_occurred) {
|
|
|
|
|
lc->error = NULL;
|
1999-10-27 18:55:00 +00:00
|
|
|
|
return FALSE;
|
2000-10-18 18:42:54 +00:00
|
|
|
|
} else {
|
2006-02-10 19:02:38 +00:00
|
|
|
|
if (lc->first_row_seen_in_chunk >= 0 && lc->update_func) {
|
1999-11-22 23:04:52 +00:00
|
|
|
|
/* We saw at least one row */
|
|
|
|
|
gint pass_diff = lc->last_pass_seen_in_chunk - lc->first_pass_seen_in_chunk;
|
|
|
|
|
|
|
|
|
|
g_assert(pass_diff >= 0);
|
|
|
|
|
|
|
|
|
|
if (pass_diff == 0) {
|
|
|
|
|
/* start and end row were in the same pass */
|
2000-01-05 23:06:13 +00:00
|
|
|
|
(lc->update_func)(lc->pixbuf, 0,
|
1999-11-22 23:04:52 +00:00
|
|
|
|
lc->first_row_seen_in_chunk,
|
2000-04-11 07:03:25 +00:00
|
|
|
|
lc->pixbuf->width,
|
1999-11-22 23:04:52 +00:00
|
|
|
|
(lc->last_row_seen_in_chunk -
|
2000-01-05 23:06:13 +00:00
|
|
|
|
lc->first_row_seen_in_chunk) + 1,
|
|
|
|
|
lc->notify_user_data);
|
1999-11-22 23:04:52 +00:00
|
|
|
|
} else if (pass_diff == 1) {
|
|
|
|
|
/* We have from the first row seen to
|
|
|
|
|
the end of the image (max row
|
|
|
|
|
seen), then from the top of the
|
|
|
|
|
image to the last row seen */
|
|
|
|
|
/* first row to end */
|
2000-01-05 23:06:13 +00:00
|
|
|
|
(lc->update_func)(lc->pixbuf, 0,
|
1999-11-22 23:04:52 +00:00
|
|
|
|
lc->first_row_seen_in_chunk,
|
2000-04-11 07:03:25 +00:00
|
|
|
|
lc->pixbuf->width,
|
1999-11-22 23:04:52 +00:00
|
|
|
|
(lc->max_row_seen_in_chunk -
|
2000-01-05 23:06:13 +00:00
|
|
|
|
lc->first_row_seen_in_chunk) + 1,
|
|
|
|
|
lc->notify_user_data);
|
1999-11-22 23:04:52 +00:00
|
|
|
|
/* top to last row */
|
2000-01-05 23:06:13 +00:00
|
|
|
|
(lc->update_func)(lc->pixbuf,
|
1999-11-22 23:04:52 +00:00
|
|
|
|
0, 0,
|
2000-04-11 07:03:25 +00:00
|
|
|
|
lc->pixbuf->width,
|
2000-01-05 23:06:13 +00:00
|
|
|
|
lc->last_row_seen_in_chunk + 1,
|
|
|
|
|
lc->notify_user_data);
|
1999-11-22 23:04:52 +00:00
|
|
|
|
} else {
|
|
|
|
|
/* We made at least one entire pass, so update the
|
|
|
|
|
whole image */
|
2000-01-05 23:06:13 +00:00
|
|
|
|
(lc->update_func)(lc->pixbuf,
|
1999-11-22 23:04:52 +00:00
|
|
|
|
0, 0,
|
2000-04-11 07:03:25 +00:00
|
|
|
|
lc->pixbuf->width,
|
2000-01-05 23:06:13 +00:00
|
|
|
|
lc->max_row_seen_in_chunk + 1,
|
|
|
|
|
lc->notify_user_data);
|
1999-11-22 23:04:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2000-10-18 18:42:54 +00:00
|
|
|
|
|
|
|
|
|
lc->error = NULL;
|
1999-11-22 23:04:52 +00:00
|
|
|
|
|
1999-10-27 18:55:00 +00:00
|
|
|
|
return TRUE;
|
1999-11-22 23:04:52 +00:00
|
|
|
|
}
|
1999-10-27 18:55:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Called at the start of the progressive load, once we have image info */
|
|
|
|
|
static void
|
|
|
|
|
png_info_callback (png_structp png_read_ptr,
|
|
|
|
|
png_infop png_info_ptr)
|
|
|
|
|
{
|
|
|
|
|
LoadContext* lc;
|
|
|
|
|
png_uint_32 width, height;
|
2001-10-05 18:51:47 +00:00
|
|
|
|
png_textp png_text_ptr;
|
|
|
|
|
int i, num_texts;
|
1999-10-27 19:42:34 +00:00
|
|
|
|
int color_type;
|
1999-10-27 18:55:00 +00:00
|
|
|
|
gboolean have_alpha = FALSE;
|
|
|
|
|
|
|
|
|
|
lc = png_get_progressive_ptr(png_read_ptr);
|
|
|
|
|
|
|
|
|
|
if (lc->fatal_error_occurred)
|
|
|
|
|
return;
|
|
|
|
|
|
2002-03-25 00:15:00 +00:00
|
|
|
|
if (!setup_png_transformations(lc->png_read_ptr,
|
|
|
|
|
lc->png_info_ptr,
|
|
|
|
|
lc->error,
|
|
|
|
|
&width, &height, &color_type)) {
|
1999-10-27 19:42:34 +00:00
|
|
|
|
lc->fatal_error_occurred = TRUE;
|
|
|
|
|
return;
|
1999-10-27 18:55:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If we have alpha, set a flag */
|
|
|
|
|
if (color_type & PNG_COLOR_MASK_ALPHA)
|
1999-10-27 19:42:34 +00:00
|
|
|
|
have_alpha = TRUE;
|
1999-10-27 18:55:00 +00:00
|
|
|
|
|
2004-01-07 00:26:58 +00:00
|
|
|
|
if (lc->size_func) {
|
|
|
|
|
gint w = width;
|
|
|
|
|
gint h = height;
|
|
|
|
|
(* lc->size_func) (&w, &h, lc->notify_user_data);
|
|
|
|
|
|
|
|
|
|
if (w == 0 || h == 0) {
|
|
|
|
|
lc->fatal_error_occurred = TRUE;
|
2007-01-17 14:07:01 +00:00
|
|
|
|
if (lc->error && *lc->error == NULL) {
|
2008-06-19 12:47:48 +00:00
|
|
|
|
g_set_error_literal (lc->error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_FAILED,
|
|
|
|
|
_("Transformed PNG has zero width or height."));
|
2007-01-17 14:07:01 +00:00
|
|
|
|
}
|
2004-01-07 00:26:58 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lc->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, have_alpha, 8, width, height);
|
1999-10-27 18:55:00 +00:00
|
|
|
|
|
|
|
|
|
if (lc->pixbuf == NULL) {
|
|
|
|
|
/* Failed to allocate memory */
|
|
|
|
|
lc->fatal_error_occurred = TRUE;
|
2000-10-18 18:42:54 +00:00
|
|
|
|
if (lc->error && *lc->error == NULL) {
|
|
|
|
|
g_set_error (lc->error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
|
|
|
|
|
_("Insufficient memory to store a %ld by %ld image; try exiting some applications to reduce memory usage"),
|
|
|
|
|
width, height);
|
|
|
|
|
}
|
1999-10-27 18:55:00 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2001-10-05 18:51:47 +00:00
|
|
|
|
|
2002-04-24 00:09:29 +00:00
|
|
|
|
/* Extract text chunks and attach them as pixbuf options */
|
1999-10-27 18:55:00 +00:00
|
|
|
|
|
2001-10-05 18:51:47 +00:00
|
|
|
|
if (png_get_text (png_read_ptr, png_info_ptr, &png_text_ptr, &num_texts)) {
|
|
|
|
|
for (i = 0; i < num_texts; i++) {
|
|
|
|
|
gchar *key, *value;
|
|
|
|
|
|
|
|
|
|
if (png_text_to_pixbuf_option (png_text_ptr[i],
|
|
|
|
|
&key, &value)) {
|
2002-09-19 21:00:52 +00:00
|
|
|
|
gdk_pixbuf_set_option (lc->pixbuf, key, value);
|
2001-10-05 18:51:47 +00:00
|
|
|
|
g_free (key);
|
|
|
|
|
g_free (value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-10-27 18:55:00 +00:00
|
|
|
|
/* Notify the client that we are ready to go */
|
|
|
|
|
|
1999-11-22 23:04:52 +00:00
|
|
|
|
if (lc->prepare_func)
|
2001-05-07 15:58:47 +00:00
|
|
|
|
(* lc->prepare_func) (lc->pixbuf, NULL, lc->notify_user_data);
|
1999-10-27 18:55:00 +00:00
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Called for each row; note that you will get duplicate row numbers
|
|
|
|
|
for interlaced PNGs */
|
|
|
|
|
static void
|
|
|
|
|
png_row_callback (png_structp png_read_ptr,
|
|
|
|
|
png_bytep new_row,
|
|
|
|
|
png_uint_32 row_num,
|
|
|
|
|
int pass_num)
|
|
|
|
|
{
|
|
|
|
|
LoadContext* lc;
|
|
|
|
|
guchar* old_row = NULL;
|
1999-11-22 23:04:52 +00:00
|
|
|
|
|
1999-10-27 18:55:00 +00:00
|
|
|
|
lc = png_get_progressive_ptr(png_read_ptr);
|
|
|
|
|
|
|
|
|
|
if (lc->fatal_error_occurred)
|
|
|
|
|
return;
|
1999-11-22 23:04:52 +00:00
|
|
|
|
|
2006-10-08 05:32:07 +00:00
|
|
|
|
if (row_num >= lc->pixbuf->height) {
|
2001-08-30 07:21:13 +00:00
|
|
|
|
lc->fatal_error_occurred = TRUE;
|
|
|
|
|
if (lc->error && *lc->error == NULL) {
|
2008-06-19 12:47:48 +00:00
|
|
|
|
g_set_error_literal (lc->error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
|
|
|
|
|
_("Fatal error reading PNG image file"));
|
2001-08-30 07:21:13 +00:00
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
1999-11-22 23:04:52 +00:00
|
|
|
|
if (lc->first_row_seen_in_chunk < 0) {
|
|
|
|
|
lc->first_row_seen_in_chunk = row_num;
|
|
|
|
|
lc->first_pass_seen_in_chunk = pass_num;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lc->max_row_seen_in_chunk = MAX(lc->max_row_seen_in_chunk, ((gint)row_num));
|
|
|
|
|
lc->last_row_seen_in_chunk = row_num;
|
|
|
|
|
lc->last_pass_seen_in_chunk = pass_num;
|
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
old_row = lc->pixbuf->pixels + (row_num * lc->pixbuf->rowstride);
|
1999-10-27 19:42:34 +00:00
|
|
|
|
|
1999-10-27 18:55:00 +00:00
|
|
|
|
png_progressive_combine_row(lc->png_read_ptr, old_row, new_row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Called after reading the entire image */
|
|
|
|
|
static void
|
|
|
|
|
png_end_callback (png_structp png_read_ptr,
|
|
|
|
|
png_infop png_info_ptr)
|
1999-10-26 16:26:00 +00:00
|
|
|
|
{
|
1999-10-27 18:55:00 +00:00
|
|
|
|
LoadContext* lc;
|
|
|
|
|
|
|
|
|
|
lc = png_get_progressive_ptr(png_read_ptr);
|
|
|
|
|
|
|
|
|
|
if (lc->fatal_error_occurred)
|
|
|
|
|
return;
|
1999-10-26 16:26:00 +00:00
|
|
|
|
}
|
1999-10-27 18:55:00 +00:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
png_error_callback(png_structp png_read_ptr,
|
|
|
|
|
png_const_charp error_msg)
|
|
|
|
|
{
|
|
|
|
|
LoadContext* lc;
|
|
|
|
|
|
|
|
|
|
lc = png_get_error_ptr(png_read_ptr);
|
|
|
|
|
|
|
|
|
|
lc->fatal_error_occurred = TRUE;
|
2000-10-18 18:42:54 +00:00
|
|
|
|
|
|
|
|
|
/* I don't trust libpng to call the error callback only once,
|
|
|
|
|
* so check for already-set error
|
|
|
|
|
*/
|
|
|
|
|
if (lc->error && *lc->error == NULL) {
|
|
|
|
|
g_set_error (lc->error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
|
|
|
|
|
_("Fatal error reading PNG image file: %s"),
|
|
|
|
|
error_msg);
|
|
|
|
|
}
|
2001-06-01 23:05:46 +00:00
|
|
|
|
|
|
|
|
|
longjmp (png_read_ptr->jmpbuf, 1);
|
1999-10-27 18:55:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2007-04-28 14:48:22 +00:00
|
|
|
|
png_warning_callback (png_structp png_read_ptr,
|
|
|
|
|
png_const_charp warning_msg)
|
1999-10-27 18:55:00 +00:00
|
|
|
|
{
|
|
|
|
|
LoadContext* lc;
|
|
|
|
|
|
|
|
|
|
lc = png_get_error_ptr(png_read_ptr);
|
2000-10-18 18:42:54 +00:00
|
|
|
|
|
|
|
|
|
/* Don't print anything; we should not be dumping junk to
|
|
|
|
|
* stderr, since that may be bad for some apps. If it's
|
|
|
|
|
* important enough to display, we need to add a GError
|
|
|
|
|
* **warning return location wherever we have an error return
|
|
|
|
|
* location.
|
|
|
|
|
*/
|
1999-10-27 18:55:00 +00:00
|
|
|
|
}
|
2000-06-09 19:41:29 +00:00
|
|
|
|
|
|
|
|
|
|
2000-10-06 18:19:18 +00:00
|
|
|
|
/* Save */
|
2000-10-18 18:42:54 +00:00
|
|
|
|
|
2004-01-07 01:57:42 +00:00
|
|
|
|
typedef struct {
|
|
|
|
|
GdkPixbufSaveFunc save_func;
|
|
|
|
|
gpointer user_data;
|
|
|
|
|
GError **error;
|
|
|
|
|
} SaveToFunctionIoPtr;
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
png_save_to_callback_write_func (png_structp png_ptr,
|
|
|
|
|
png_bytep data,
|
|
|
|
|
png_size_t length)
|
|
|
|
|
{
|
|
|
|
|
SaveToFunctionIoPtr *ioptr = png_get_io_ptr (png_ptr);
|
|
|
|
|
|
2005-08-30 15:07:12 +00:00
|
|
|
|
if (!ioptr->save_func ((gchar *)data, length, ioptr->error, ioptr->user_data)) {
|
2004-01-07 01:57:42 +00:00
|
|
|
|
/* If save_func has already set an error, which it
|
|
|
|
|
should have done, this won't overwrite it. */
|
|
|
|
|
png_error (png_ptr, "write function failed");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
png_save_to_callback_flush_func (png_structp png_ptr)
|
|
|
|
|
{
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean real_save_png (GdkPixbuf *pixbuf,
|
|
|
|
|
gchar **keys,
|
|
|
|
|
gchar **values,
|
|
|
|
|
GError **error,
|
|
|
|
|
gboolean to_callback,
|
|
|
|
|
FILE *f,
|
|
|
|
|
GdkPixbufSaveFunc save_func,
|
|
|
|
|
gpointer user_data)
|
2000-10-06 18:19:18 +00:00
|
|
|
|
{
|
|
|
|
|
png_structp png_ptr;
|
|
|
|
|
png_infop info_ptr;
|
2001-10-05 18:51:47 +00:00
|
|
|
|
png_textp text_ptr = NULL;
|
2000-10-06 18:19:18 +00:00
|
|
|
|
guchar *ptr;
|
|
|
|
|
guchar *pixels;
|
2001-12-11 17:30:53 +00:00
|
|
|
|
int y;
|
|
|
|
|
int i;
|
2001-06-01 23:05:46 +00:00
|
|
|
|
png_bytep row_ptr;
|
2000-10-06 18:19:18 +00:00
|
|
|
|
png_color_8 sig_bit;
|
|
|
|
|
int w, h, rowstride;
|
|
|
|
|
int has_alpha;
|
|
|
|
|
int bpc;
|
2001-10-05 18:51:47 +00:00
|
|
|
|
int num_keys;
|
2005-05-24 17:09:56 +00:00
|
|
|
|
int compression = -1;
|
2002-01-20 04:52:47 +00:00
|
|
|
|
gboolean success = TRUE;
|
2004-01-07 01:57:42 +00:00
|
|
|
|
SaveToFunctionIoPtr to_callback_ioptr;
|
2001-10-05 18:51:47 +00:00
|
|
|
|
|
|
|
|
|
num_keys = 0;
|
2000-10-06 18:19:18 +00:00
|
|
|
|
|
|
|
|
|
if (keys && *keys) {
|
2005-05-24 17:09:56 +00:00
|
|
|
|
gchar **kiter = keys;
|
|
|
|
|
gchar **viter = values;
|
|
|
|
|
|
|
|
|
|
while (*kiter) {
|
|
|
|
|
if (strncmp (*kiter, "tEXt::", 6) == 0) {
|
|
|
|
|
gchar *key = *kiter + 6;
|
|
|
|
|
int len = strlen (key);
|
|
|
|
|
if (len <= 1 || len > 79) {
|
2008-06-19 12:47:48 +00:00
|
|
|
|
g_set_error_literal (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_BAD_OPTION,
|
|
|
|
|
_("Keys for PNG text chunks must have at least 1 and at most 79 characters."));
|
2005-05-24 17:09:56 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
for (i = 0; i < len; i++) {
|
|
|
|
|
if ((guchar) key[i] > 127) {
|
2008-06-19 12:47:48 +00:00
|
|
|
|
g_set_error_literal (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_BAD_OPTION,
|
|
|
|
|
_("Keys for PNG text chunks must be ASCII characters."));
|
2005-05-24 17:09:56 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
num_keys++;
|
|
|
|
|
} else if (strcmp (*kiter, "compression") == 0) {
|
|
|
|
|
char *endptr = NULL;
|
|
|
|
|
compression = strtol (*viter, &endptr, 10);
|
2001-10-05 18:51:47 +00:00
|
|
|
|
|
2005-05-24 17:09:56 +00:00
|
|
|
|
if (endptr == *viter) {
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_BAD_OPTION,
|
|
|
|
|
_("PNG compression level must be a value between 0 and 9; value '%s' could not be parsed."),
|
|
|
|
|
*viter);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
if (compression < 0 || compression > 9) {
|
|
|
|
|
/* This is a user-visible error;
|
|
|
|
|
* lets people skip the range-checking
|
|
|
|
|
* in their app.
|
|
|
|
|
*/
|
2001-10-05 18:51:47 +00:00
|
|
|
|
g_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_BAD_OPTION,
|
2005-05-24 17:09:56 +00:00
|
|
|
|
_("PNG compression level must be a value between 0 and 9; value '%d' is not allowed."),
|
|
|
|
|
compression);
|
2001-10-05 18:51:47 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2005-05-24 17:09:56 +00:00
|
|
|
|
} else {
|
2007-04-28 14:48:22 +00:00
|
|
|
|
g_warning ("Unrecognized parameter (%s) passed to PNG saver.", *kiter);
|
2001-10-05 18:51:47 +00:00
|
|
|
|
}
|
2005-05-24 17:09:56 +00:00
|
|
|
|
|
|
|
|
|
++kiter;
|
|
|
|
|
++viter;
|
2001-10-05 18:51:47 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (num_keys > 0) {
|
|
|
|
|
text_ptr = g_new0 (png_text, num_keys);
|
|
|
|
|
for (i = 0; i < num_keys; i++) {
|
|
|
|
|
text_ptr[i].compression = PNG_TEXT_COMPRESSION_NONE;
|
|
|
|
|
text_ptr[i].key = keys[i] + 6;
|
|
|
|
|
text_ptr[i].text = g_convert (values[i], -1,
|
|
|
|
|
"ISO-8859-1", "UTF-8",
|
|
|
|
|
NULL, &text_ptr[i].text_length,
|
|
|
|
|
NULL);
|
2002-04-24 00:09:29 +00:00
|
|
|
|
|
|
|
|
|
#ifdef PNG_iTXt_SUPPORTED
|
|
|
|
|
if (!text_ptr[i].text) {
|
|
|
|
|
text_ptr[i].compression = PNG_ITXT_COMPRESSION_NONE;
|
|
|
|
|
text_ptr[i].text = g_strdup (values[i]);
|
|
|
|
|
text_ptr[i].text_length = 0;
|
|
|
|
|
text_ptr[i].itxt_length = strlen (text_ptr[i].text);
|
|
|
|
|
text_ptr[i].lang = NULL;
|
|
|
|
|
text_ptr[i].lang_key = NULL;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2001-10-05 18:51:47 +00:00
|
|
|
|
if (!text_ptr[i].text) {
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_BAD_OPTION,
|
2004-07-15 23:24:51 +00:00
|
|
|
|
_("Value for PNG text chunk %s cannot be converted to ISO-8859-1 encoding."), keys[i] + 6);
|
2001-10-05 18:51:47 +00:00
|
|
|
|
num_keys = i;
|
|
|
|
|
for (i = 0; i < num_keys; i++)
|
|
|
|
|
g_free (text_ptr[i].text);
|
|
|
|
|
g_free (text_ptr);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2000-10-06 18:19:18 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2001-10-05 18:51:47 +00:00
|
|
|
|
|
2000-10-06 18:19:18 +00:00
|
|
|
|
bpc = gdk_pixbuf_get_bits_per_sample (pixbuf);
|
|
|
|
|
w = gdk_pixbuf_get_width (pixbuf);
|
|
|
|
|
h = gdk_pixbuf_get_height (pixbuf);
|
|
|
|
|
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
|
|
|
|
has_alpha = gdk_pixbuf_get_has_alpha (pixbuf);
|
|
|
|
|
pixels = gdk_pixbuf_get_pixels (pixbuf);
|
|
|
|
|
|
|
|
|
|
png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING,
|
2000-10-18 18:42:54 +00:00
|
|
|
|
error,
|
|
|
|
|
png_simple_error_callback,
|
|
|
|
|
png_simple_warning_callback);
|
2007-02-16 05:32:59 +00:00
|
|
|
|
if (png_ptr == NULL) {
|
|
|
|
|
success = FALSE;
|
|
|
|
|
goto cleanup;
|
|
|
|
|
}
|
2000-10-06 18:19:18 +00:00
|
|
|
|
|
|
|
|
|
info_ptr = png_create_info_struct (png_ptr);
|
|
|
|
|
if (info_ptr == NULL) {
|
2002-01-20 04:52:47 +00:00
|
|
|
|
success = FALSE;
|
|
|
|
|
goto cleanup;
|
2000-10-06 18:19:18 +00:00
|
|
|
|
}
|
|
|
|
|
if (setjmp (png_ptr->jmpbuf)) {
|
2002-01-20 04:52:47 +00:00
|
|
|
|
success = FALSE;
|
|
|
|
|
goto cleanup;
|
2000-10-06 18:19:18 +00:00
|
|
|
|
}
|
2001-10-05 18:51:47 +00:00
|
|
|
|
|
|
|
|
|
if (num_keys > 0) {
|
|
|
|
|
png_set_text (png_ptr, info_ptr, text_ptr, num_keys);
|
|
|
|
|
}
|
|
|
|
|
|
2004-01-07 01:57:42 +00:00
|
|
|
|
if (to_callback) {
|
|
|
|
|
to_callback_ioptr.save_func = save_func;
|
|
|
|
|
to_callback_ioptr.user_data = user_data;
|
|
|
|
|
to_callback_ioptr.error = error;
|
|
|
|
|
png_set_write_fn (png_ptr, &to_callback_ioptr,
|
|
|
|
|
png_save_to_callback_write_func,
|
|
|
|
|
png_save_to_callback_flush_func);
|
|
|
|
|
} else {
|
|
|
|
|
png_init_io (png_ptr, f);
|
|
|
|
|
}
|
2001-10-05 18:51:47 +00:00
|
|
|
|
|
2005-05-24 17:09:56 +00:00
|
|
|
|
if (compression >= 0)
|
|
|
|
|
png_set_compression_level (png_ptr, compression);
|
|
|
|
|
|
2000-10-06 18:19:18 +00:00
|
|
|
|
if (has_alpha) {
|
|
|
|
|
png_set_IHDR (png_ptr, info_ptr, w, h, bpc,
|
2000-10-18 18:42:54 +00:00
|
|
|
|
PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE,
|
|
|
|
|
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
2000-10-06 18:19:18 +00:00
|
|
|
|
} else {
|
|
|
|
|
png_set_IHDR (png_ptr, info_ptr, w, h, bpc,
|
2000-10-18 18:42:54 +00:00
|
|
|
|
PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
|
|
|
|
|
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
2000-10-06 18:19:18 +00:00
|
|
|
|
}
|
|
|
|
|
sig_bit.red = bpc;
|
|
|
|
|
sig_bit.green = bpc;
|
|
|
|
|
sig_bit.blue = bpc;
|
|
|
|
|
sig_bit.alpha = bpc;
|
|
|
|
|
png_set_sBIT (png_ptr, info_ptr, &sig_bit);
|
|
|
|
|
png_write_info (png_ptr, info_ptr);
|
|
|
|
|
png_set_shift (png_ptr, &sig_bit);
|
|
|
|
|
png_set_packing (png_ptr);
|
|
|
|
|
|
|
|
|
|
ptr = pixels;
|
|
|
|
|
for (y = 0; y < h; y++) {
|
2001-12-11 17:30:53 +00:00
|
|
|
|
row_ptr = (png_bytep)ptr;
|
2000-10-06 18:19:18 +00:00
|
|
|
|
png_write_rows (png_ptr, &row_ptr, 1);
|
|
|
|
|
ptr += rowstride;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
png_write_end (png_ptr, info_ptr);
|
2002-01-20 04:52:47 +00:00
|
|
|
|
|
|
|
|
|
cleanup:
|
2002-08-22 21:32:06 +00:00
|
|
|
|
png_destroy_write_struct (&png_ptr, &info_ptr);
|
2000-10-06 18:19:18 +00:00
|
|
|
|
|
2001-10-05 18:51:47 +00:00
|
|
|
|
if (num_keys > 0) {
|
|
|
|
|
for (i = 0; i < num_keys; i++)
|
|
|
|
|
g_free (text_ptr[i].text);
|
|
|
|
|
g_free (text_ptr);
|
|
|
|
|
}
|
|
|
|
|
|
2002-01-20 04:52:47 +00:00
|
|
|
|
return success;
|
2000-10-06 18:19:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-01-07 01:57:42 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gdk_pixbuf__png_image_save (FILE *f,
|
|
|
|
|
GdkPixbuf *pixbuf,
|
|
|
|
|
gchar **keys,
|
|
|
|
|
gchar **values,
|
|
|
|
|
GError **error)
|
|
|
|
|
{
|
|
|
|
|
return real_save_png (pixbuf, keys, values, error,
|
|
|
|
|
FALSE, f, NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
gdk_pixbuf__png_image_save_to_callback (GdkPixbufSaveFunc save_func,
|
|
|
|
|
gpointer user_data,
|
|
|
|
|
GdkPixbuf *pixbuf,
|
|
|
|
|
gchar **keys,
|
|
|
|
|
gchar **values,
|
|
|
|
|
GError **error)
|
|
|
|
|
{
|
|
|
|
|
return real_save_png (pixbuf, keys, values, error,
|
|
|
|
|
TRUE, NULL, save_func, user_data);
|
|
|
|
|
}
|
|
|
|
|
|
2006-10-11 12:41:14 +00:00
|
|
|
|
#ifndef INCLUDE_png
|
2008-05-27 16:51:33 +00:00
|
|
|
|
#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
|
2006-10-11 12:41:14 +00:00
|
|
|
|
#else
|
2008-05-27 16:51:33 +00:00
|
|
|
|
#define MODULE_ENTRY(function) void _gdk_pixbuf__png_ ## function
|
2006-10-11 12:41:14 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
2008-05-27 16:51:33 +00:00
|
|
|
|
MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
|
2002-10-03 22:39:51 +00:00
|
|
|
|
{
|
|
|
|
|
module->load = gdk_pixbuf__png_image_load;
|
|
|
|
|
module->begin_load = gdk_pixbuf__png_image_begin_load;
|
|
|
|
|
module->stop_load = gdk_pixbuf__png_image_stop_load;
|
|
|
|
|
module->load_increment = gdk_pixbuf__png_image_load_increment;
|
|
|
|
|
module->save = gdk_pixbuf__png_image_save;
|
2004-01-07 01:57:42 +00:00
|
|
|
|
module->save_to_callback = gdk_pixbuf__png_image_save_to_callback;
|
2002-10-03 22:39:51 +00:00
|
|
|
|
}
|
2000-06-09 19:41:29 +00:00
|
|
|
|
|
2008-05-27 16:51:33 +00:00
|
|
|
|
MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
|
Add built marshaller files to support GdkPixbufLoader signals
2001-01-22 Havoc Pennington <hp@redhat.com>
* Makefile.am: Add built marshaller files to support
GdkPixbufLoader signals
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): have
GDK_PIXBUF_MODULEDIR unconditionally replace the compiled-in
module location, rather than acting as a fallback, because we are
using GDK_PIXBUF_MODULEDIR to use gdk-pixbuf before installing it.
* gdk-pixbuf.h: include gdk-pixbuf-loader.h
* gdk-pixbuf-loader.h, gdk-pixbuf-loader.c: Move back over here
from gtk, and add error to close(), because stop_load may do
parsing of the image.
* pixops/have_mmx.S (_pixops_have_mmx): add newline at end of file
* io-*.c: make individual operations static, and add fill_vtable
functions which are exported. Fix the collection of type warnings
that surfaced, including a number of functions that didn't
properly take a GError and some that weren't
const-correct. Involved adding error handling for a few loaders.
* gdk-pixbuf-io.h: Add error reporting to stop_load function
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): change to just look up
a function that fills in the GdkPixbufModule vtable, instead of
looking up all the image functions individually; this means we
can get type safety within modules for the loader functions.
Also it means you don't have to keep the statically compiled and
GModule versions in sync.
* test-gdk-pixbuf.c (main): remove gdk_pixbuf_init()
* make-inline-pixbuf.c (main): remove call to gdk_pixbuf_init()
* gdk-pixbuf.h: nuke gdk_pixbuf_init()
* gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_type): g_type_init
() here
* gdk-pixbuf.c (gdk_pixbuf_get_type): g_type_init () here
* gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_type):
g_type_init() here
2001-01-22 Havoc Pennington <hp@redhat.com>
* demos/testanimation.c: fix to reflect gdk-pixbuf changes
* demos/testpixbuf.c: fix to reflect gdk-pixbuf changes
* gtk/gdk-pixbuf-loader.c, gtk/gdk-pixbuf-loader.h:
Remove, move back to gdk-pixbuf
* gtk/gtktextiter.c, gtk/gtktextiter.h: add sentence equivalents
to all the word functions
* gtk/gtktextview.c (gtk_text_view_start_cursor_blink): return
before doing anything on NULL layout or if we don't have the focus
* gtk/testtext.c (fill_example_buffer): "justification"
* gtk/gtktexttag.h, gtk/gtktexttag.c: change the tag attribute
to be called "justification" not "justify"
* demos/gtk-demo/textview.c (create_tags): "justification"
* gtk/gtktextlayout.c (set_para_values): Handle char-wise wrapping
2001-01-22 23:09:48 +00:00
|
|
|
|
{
|
2002-10-03 22:39:51 +00:00
|
|
|
|
static GdkPixbufModulePattern signature[] = {
|
|
|
|
|
{ "\x89PNG\r\n\x1a\x0a", NULL, 100 },
|
|
|
|
|
{ NULL, NULL, 0 }
|
|
|
|
|
};
|
|
|
|
|
static gchar * mime_types[] = {
|
|
|
|
|
"image/png",
|
|
|
|
|
NULL
|
|
|
|
|
};
|
|
|
|
|
static gchar * extensions[] = {
|
|
|
|
|
"png",
|
|
|
|
|
NULL
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
info->name = "png";
|
|
|
|
|
info->signature = signature;
|
|
|
|
|
info->description = N_("The PNG image format");
|
|
|
|
|
info->mime_types = mime_types;
|
|
|
|
|
info->extensions = extensions;
|
Changes to make gdk-pixbuf threadsafe (#157310, #157306, Colin Walters):
2004-11-12 Matthias Clasen <mclasen@redhat.com>
Changes to make gdk-pixbuf threadsafe (#157310, #157306,
Colin Walters):
* gdk-pixbuf-io.h (enum GdkPixbufFormatFlags): Add
GDK_PIXBUF_FORMAT_THREADSAFE to indicate that an image loader
is threadsafe.
* gdk-pixbuf-io.c (get_file_formats, _gdk_pixbuf_load_module):
Use a lock to make initialization of global data structures
threadsafe.
* gdk-pixbuf-private.h:
* gdk-pixbuf-io.c (_gdk_pixbuf_lock, _gdk_pixbuf_unlock):
Auxiliary functions which use another lock to protect
threadunsafe image loaders.
* gdk-pixbuf-io.c (gdk_pixbuf_real_save):
(save_to_callback_with_tmp_file):
(gdk_pixbuf_real_save_to_callback):
(gdk_pixbuf_new_from_xpm_data):
(_gdk_pixbuf_generic_image_load):
* gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file):
* gdk-pixbuf-loader.c (gdk_pixbuf_loader_load_module):
(gdk_pixbuf_loader_close):
(gdk_pixbuf_loader_finalize):
Use _gdk_pixbuf_lock() and _gdk_pixbuf_unlock().
* io-ani.c, io-bmp.c, io-gif.c, io-ico.c:
* io-jpeg.c, io-pcx.c, io-png.c, io-pnm.c:
* io-ras.c, io-tga.c, io-wbmp.c, io-xbm.c:
* io-xpm.c: Mark as threadsafe.
* io-tiff.c: Remove pointless locking, mark as
threadunsafe.
2004-11-12 05:34:31 +00:00
|
|
|
|
info->flags = GDK_PIXBUF_FORMAT_WRITABLE | GDK_PIXBUF_FORMAT_THREADSAFE;
|
2004-07-08 03:56:36 +00:00
|
|
|
|
info->license = "LGPL";
|
Add built marshaller files to support GdkPixbufLoader signals
2001-01-22 Havoc Pennington <hp@redhat.com>
* Makefile.am: Add built marshaller files to support
GdkPixbufLoader signals
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): have
GDK_PIXBUF_MODULEDIR unconditionally replace the compiled-in
module location, rather than acting as a fallback, because we are
using GDK_PIXBUF_MODULEDIR to use gdk-pixbuf before installing it.
* gdk-pixbuf.h: include gdk-pixbuf-loader.h
* gdk-pixbuf-loader.h, gdk-pixbuf-loader.c: Move back over here
from gtk, and add error to close(), because stop_load may do
parsing of the image.
* pixops/have_mmx.S (_pixops_have_mmx): add newline at end of file
* io-*.c: make individual operations static, and add fill_vtable
functions which are exported. Fix the collection of type warnings
that surfaced, including a number of functions that didn't
properly take a GError and some that weren't
const-correct. Involved adding error handling for a few loaders.
* gdk-pixbuf-io.h: Add error reporting to stop_load function
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): change to just look up
a function that fills in the GdkPixbufModule vtable, instead of
looking up all the image functions individually; this means we
can get type safety within modules for the loader functions.
Also it means you don't have to keep the statically compiled and
GModule versions in sync.
* test-gdk-pixbuf.c (main): remove gdk_pixbuf_init()
* make-inline-pixbuf.c (main): remove call to gdk_pixbuf_init()
* gdk-pixbuf.h: nuke gdk_pixbuf_init()
* gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_type): g_type_init
() here
* gdk-pixbuf.c (gdk_pixbuf_get_type): g_type_init () here
* gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_type):
g_type_init() here
2001-01-22 Havoc Pennington <hp@redhat.com>
* demos/testanimation.c: fix to reflect gdk-pixbuf changes
* demos/testpixbuf.c: fix to reflect gdk-pixbuf changes
* gtk/gdk-pixbuf-loader.c, gtk/gdk-pixbuf-loader.h:
Remove, move back to gdk-pixbuf
* gtk/gtktextiter.c, gtk/gtktextiter.h: add sentence equivalents
to all the word functions
* gtk/gtktextview.c (gtk_text_view_start_cursor_blink): return
before doing anything on NULL layout or if we don't have the focus
* gtk/testtext.c (fill_example_buffer): "justification"
* gtk/gtktexttag.h, gtk/gtktexttag.c: change the tag attribute
to be called "justification" not "justify"
* demos/gtk-demo/textview.c (create_tags): "justification"
* gtk/gtktextlayout.c (set_para_values): Handle char-wise wrapping
2001-01-22 23:09:48 +00:00
|
|
|
|
}
|