gtk/gdk-pixbuf/io-png.c

1051 lines
37 KiB
C
Raw Normal View History

/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/* GdkPixbuf library - PNG image loader
*
* Copyright (C) 1999 Mark Crichton
* Copyright (C) 1999 The Free Software Foundation
*
* Authors: Mark Crichton <crichton@gimp.org>
* Federico Mena-Quintero <federico@gimp.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdio.h>
Most of this patch is based on a patch by Havoc Pennington (hp@redhat.com) 2000-04-11 Federico Mena Quintero <federico@helixcode.com> Most of this patch is based on a patch by Havoc Pennington (hp@redhat.com) to make GdkPixbuf's structures opaque and to remove the libart dependency. * gdk-pixbuf/gdk-pixbuf.h: Removed the public structures. (GdkColorspace): New enum that for now only contains GDK_COLORSPACE_RGB. (GdkPixbufDestroyNotify): New type for the pixbuf's pixels destroy notification function. (GdkInterpType): New num with interpolation types. * *.[ch]: Replace the libart stuff with our own stuff. * pixops/*.[ch]: Likewise. * gdk-pixbuf/gdk-pixbuf-private.h: New file with the private declarations of the GdkPixbuf structures. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_new_from_art_pixbuf): Removed function. (gdk_pixbuf_get_format): Constify. (gdk_pixbuf_get_n_channels): Constify. (gdk_pixbuf_get_has_alpha): Constify. (gdk_pixbuf_get_bits_per_sample): Constify. (gdk_pixbuf_get_pixels): Constify. (gdk_pixbuf_get_width): Constify. (gdk_pixbuf_get_height): Constify. (gdk_pixbuf_get_rowstride): Constify. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_copy): New function to copy a pixbuf. * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Added a bits_per_sample argument; currently only 8 bits per sample are supported. * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_pixbuf): New accessor. (gdk_pixbuf_frame_get_x_offset): New accessor. (gdk_pixbuf_frame_get_y_offset): New accessor. (gdk_pixbuf_frame_get_delay_time): New accessor. (gdk_pixbuf_frame_get_action): New accessor. * gdk-pixbuf/gdk-pixbuf-render.c (gdk_pixbuf_render_pixmap_and_mask): Instead of returning a solid mask rectangle for pixbufs without an alpha channel, set the *mask_return to NULL. * gdk-pixbuf/gdk-pixbuf-util.c (gdk_pixbuf_add_alpha): Constify. * gdk-pixbuf/gdk-pixbuf-scale.c: Fix includes. * gdk-pixbuf/gdk-pixbuf-scale.c (gdk_pixbuf_scale): Added some preconditions. Maybe we should also check for the colorspace, bits per pixel, and such. (gdk_pixbuf_composite): Likewise. (gdk_pixbuf_composite_color): Likewise. (gdk_pixbuf_scale_simple): Likewise, and fail gracefully if we cannot allocate the new pixbuf. (gdk_pixbuf_composite_color_simple): Likewise. * gdk-pixbuf/gnome-canvas-pixbuf.c (gnome_canvas_pixbuf_render): Use art_rgb_rgba_affine() or art_rgb_affine() since we no longer have an ArtPixBuf. * gdk-pixbuf/io-bmp.c: Fix includes. * gdk-pixbuf/pixops/pixops.c (pixops_scale_nearest): Fixed cast in an lvalue. * TODO: Populated. * configure.in: Removed checks for libart. * gdk-pixbuf/Makefile.am: Removed references to libart. (noinst_HEADERS): Added gdk-pixbuf-private.h. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_LDFLAGS): Incremented the version number of the libtool library to indicate that this definitely is not compatible with the old usage. I know you love me. I know you do. * configure.in: Bumped version number to 0.7.0. * README: Updated. * gdk-pixbuf-config.in (--libs): We no longer require libart. * DEPENDS.libgdk_pixbuf: We no longer depend on libart. * gdk-pixbuf.spec.in: Updated, but I don't guarantee anything.
2000-04-11 07:03:25 +00:00
#include <stdlib.h>
#include <png.h>
Most of this patch is based on a patch by Havoc Pennington (hp@redhat.com) 2000-04-11 Federico Mena Quintero <federico@helixcode.com> Most of this patch is based on a patch by Havoc Pennington (hp@redhat.com) to make GdkPixbuf's structures opaque and to remove the libart dependency. * gdk-pixbuf/gdk-pixbuf.h: Removed the public structures. (GdkColorspace): New enum that for now only contains GDK_COLORSPACE_RGB. (GdkPixbufDestroyNotify): New type for the pixbuf's pixels destroy notification function. (GdkInterpType): New num with interpolation types. * *.[ch]: Replace the libart stuff with our own stuff. * pixops/*.[ch]: Likewise. * gdk-pixbuf/gdk-pixbuf-private.h: New file with the private declarations of the GdkPixbuf structures. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_new_from_art_pixbuf): Removed function. (gdk_pixbuf_get_format): Constify. (gdk_pixbuf_get_n_channels): Constify. (gdk_pixbuf_get_has_alpha): Constify. (gdk_pixbuf_get_bits_per_sample): Constify. (gdk_pixbuf_get_pixels): Constify. (gdk_pixbuf_get_width): Constify. (gdk_pixbuf_get_height): Constify. (gdk_pixbuf_get_rowstride): Constify. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_copy): New function to copy a pixbuf. * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Added a bits_per_sample argument; currently only 8 bits per sample are supported. * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_pixbuf): New accessor. (gdk_pixbuf_frame_get_x_offset): New accessor. (gdk_pixbuf_frame_get_y_offset): New accessor. (gdk_pixbuf_frame_get_delay_time): New accessor. (gdk_pixbuf_frame_get_action): New accessor. * gdk-pixbuf/gdk-pixbuf-render.c (gdk_pixbuf_render_pixmap_and_mask): Instead of returning a solid mask rectangle for pixbufs without an alpha channel, set the *mask_return to NULL. * gdk-pixbuf/gdk-pixbuf-util.c (gdk_pixbuf_add_alpha): Constify. * gdk-pixbuf/gdk-pixbuf-scale.c: Fix includes. * gdk-pixbuf/gdk-pixbuf-scale.c (gdk_pixbuf_scale): Added some preconditions. Maybe we should also check for the colorspace, bits per pixel, and such. (gdk_pixbuf_composite): Likewise. (gdk_pixbuf_composite_color): Likewise. (gdk_pixbuf_scale_simple): Likewise, and fail gracefully if we cannot allocate the new pixbuf. (gdk_pixbuf_composite_color_simple): Likewise. * gdk-pixbuf/gnome-canvas-pixbuf.c (gnome_canvas_pixbuf_render): Use art_rgb_rgba_affine() or art_rgb_affine() since we no longer have an ArtPixBuf. * gdk-pixbuf/io-bmp.c: Fix includes. * gdk-pixbuf/pixops/pixops.c (pixops_scale_nearest): Fixed cast in an lvalue. * TODO: Populated. * configure.in: Removed checks for libart. * gdk-pixbuf/Makefile.am: Removed references to libart. (noinst_HEADERS): Added gdk-pixbuf-private.h. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_LDFLAGS): Incremented the version number of the libtool library to indicate that this definitely is not compatible with the old usage. I know you love me. I know you do. * configure.in: Bumped version number to 0.7.0. * README: Updated. * gdk-pixbuf-config.in (--libs): We no longer require libart. * DEPENDS.libgdk_pixbuf: We no longer depend on libart. * gdk-pixbuf.spec.in: Updated, but I don't guarantee anything.
2000-04-11 07:03:25 +00:00
#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-io.h"
static gboolean
setup_png_transformations(png_structp png_read_ptr, png_infop png_info_ptr,
GError **error,
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 */
/* 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) {
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Bits per channel of PNG image is invalid."));
return FALSE;
}
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 */
if (width == 0 || height == 0) {
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Transformed PNG has zero width or height."));
return FALSE;
}
if (bit_depth != 8) {
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Bits per channel of transformed PNG is not 8."));
return FALSE;
}
if ( ! (color_type == PNG_COLOR_TYPE_RGB ||
color_type == PNG_COLOR_TYPE_RGB_ALPHA) ) {
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Transformed PNG not RGB or RGBA."));
return FALSE;
}
channels = png_get_channels(png_read_ptr, png_info_ptr);
if ( ! (channels == 3 || channels == 4) ) {
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."));
return FALSE;
}
return TRUE;
}
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
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,
_("Fatal error in PNG image file: %s"),
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
error_msg);
}
longjmp (png_save_ptr->jmpbuf, 1);
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
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.
*/
}
static gboolean
png_text_to_pixbuf_option (png_text text_ptr,
gchar **key,
gchar **value)
{
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) {
*value = g_strdup (text_ptr.text);
} else {
*value = g_convert (text_ptr.text, -1,
"UTF-8", "ISO-8859-1",
NULL, NULL, NULL);
}
if (*value) {
*key = g_strconcat ("tEXt::", text_ptr.key, NULL);
return TRUE;
} else {
g_warning ("Couldn't convert text chunk value to UTF-8.");
*key = NULL;
return FALSE;
}
}
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);
}
/* 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 *
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
gdk_pixbuf__png_image_load (FILE *f, GError **error)
{
GdkPixbuf * volatile pixbuf = NULL;
png_structp png_ptr;
png_infop info_ptr;
png_textp text_ptr;
gint i, ctype;
png_uint_32 w, h;
png_bytepp volatile rows = NULL;
gint num_texts;
gchar *key;
gchar *value;
#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
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
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);
#endif
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)) {
g_free (rows);
if (pixbuf)
g_object_unref (pixbuf);
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
return NULL;
}
png_init_io (png_ptr, f);
png_read_info (png_ptr, info_ptr);
if (!setup_png_transformations(png_ptr, info_ptr, error, &w, &h, &ctype)) {
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
return NULL;
}
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, ctype & PNG_COLOR_MASK_ALPHA, 8, w, h);
if (!pixbuf) {
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
if (error && *error == NULL) {
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to load PNG file"));
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
}
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
return NULL;
}
rows = g_new (png_bytep, h);
for (i = 0; i < h; i++)
rows[i] = pixbuf->pixels + i * pixbuf->rowstride;
png_read_image (png_ptr, rows);
png_read_end (png_ptr, info_ptr);
if (png_get_text (png_ptr, info_ptr, &text_ptr, &num_texts)) {
for (i = 0; i < num_texts; i++) {
png_text_to_pixbuf_option (text_ptr[i], &key, &value);
gdk_pixbuf_set_option (pixbuf, key, value);
g_free (key);
g_free (value);
}
}
g_free (rows);
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
return pixbuf;
}
/* I wish these avoided the setjmp()/longjmp() crap in libpng instead
just allow you to change the error reporting. */
static void png_error_callback (png_structp png_read_ptr,
png_const_charp error_msg);
static void png_warning_callback (png_structp png_read_ptr,
png_const_charp warning_msg);
/* 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;
GdkPixbufModuleSizeFunc size_func;
GdkPixbufModulePreparedFunc prepare_func;
GdkPixbufModuleUpdatedFunc update_func;
gpointer notify_user_data;
GdkPixbuf* pixbuf;
/* 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;
guint fatal_error_occurred : 1;
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
GError **error;
};
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
gdk_pixbuf__png_image_begin_load (GdkPixbufModuleSizeFunc size_func,
GdkPixbufModulePreparedFunc prepare_func,
GdkPixbufModuleUpdatedFunc update_func,
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
gpointer user_data,
GError **error)
{
LoadContext* lc;
lc = g_new0(LoadContext, 1);
lc->fatal_error_occurred = FALSE;
lc->size_func = size_func;
lc->prepare_func = prepare_func;
lc->update_func = update_func;
lc->notify_user_data = user_data;
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;
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
lc->error = error;
/* Create the main PNG context struct */
#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
lc->png_read_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
lc, /* error/warning callback data */
png_error_callback,
png_warning_callback);
#endif
if (lc->png_read_ptr == NULL) {
g_free(lc);
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
/* error callback should have set the error */
return NULL;
}
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +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);
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
/* error callback should have set the error */
return NULL;
}
/* Create the auxiliary context struct */
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);
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
/* error callback should have set the error */
return NULL;
}
png_set_progressive_read_fn(lc->png_read_ptr,
lc, /* callback data */
png_info_callback,
png_row_callback,
png_end_callback);
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
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;
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)
{
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);
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
*/
if (lc->pixbuf)
g_object_unref (lc->pixbuf);
png_destroy_read_struct(&lc->png_read_ptr, &lc->png_info_ptr, NULL);
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;
}
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,
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
GError **error)
{
LoadContext* lc = context;
g_return_val_if_fail(lc != NULL, FALSE);
/* 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;
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
lc->error = error;
/* Invokes our callbacks as needed */
if (setjmp (lc->png_read_ptr->jmpbuf)) {
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
lc->error = NULL;
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);
}
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
if (lc->fatal_error_occurred) {
lc->error = NULL;
return FALSE;
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
} else {
if (lc->first_row_seen_in_chunk >= 0 && lc->update_func) {
/* 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 */
(lc->update_func)(lc->pixbuf, 0,
lc->first_row_seen_in_chunk,
Most of this patch is based on a patch by Havoc Pennington (hp@redhat.com) 2000-04-11 Federico Mena Quintero <federico@helixcode.com> Most of this patch is based on a patch by Havoc Pennington (hp@redhat.com) to make GdkPixbuf's structures opaque and to remove the libart dependency. * gdk-pixbuf/gdk-pixbuf.h: Removed the public structures. (GdkColorspace): New enum that for now only contains GDK_COLORSPACE_RGB. (GdkPixbufDestroyNotify): New type for the pixbuf's pixels destroy notification function. (GdkInterpType): New num with interpolation types. * *.[ch]: Replace the libart stuff with our own stuff. * pixops/*.[ch]: Likewise. * gdk-pixbuf/gdk-pixbuf-private.h: New file with the private declarations of the GdkPixbuf structures. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_new_from_art_pixbuf): Removed function. (gdk_pixbuf_get_format): Constify. (gdk_pixbuf_get_n_channels): Constify. (gdk_pixbuf_get_has_alpha): Constify. (gdk_pixbuf_get_bits_per_sample): Constify. (gdk_pixbuf_get_pixels): Constify. (gdk_pixbuf_get_width): Constify. (gdk_pixbuf_get_height): Constify. (gdk_pixbuf_get_rowstride): Constify. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_copy): New function to copy a pixbuf. * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Added a bits_per_sample argument; currently only 8 bits per sample are supported. * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_pixbuf): New accessor. (gdk_pixbuf_frame_get_x_offset): New accessor. (gdk_pixbuf_frame_get_y_offset): New accessor. (gdk_pixbuf_frame_get_delay_time): New accessor. (gdk_pixbuf_frame_get_action): New accessor. * gdk-pixbuf/gdk-pixbuf-render.c (gdk_pixbuf_render_pixmap_and_mask): Instead of returning a solid mask rectangle for pixbufs without an alpha channel, set the *mask_return to NULL. * gdk-pixbuf/gdk-pixbuf-util.c (gdk_pixbuf_add_alpha): Constify. * gdk-pixbuf/gdk-pixbuf-scale.c: Fix includes. * gdk-pixbuf/gdk-pixbuf-scale.c (gdk_pixbuf_scale): Added some preconditions. Maybe we should also check for the colorspace, bits per pixel, and such. (gdk_pixbuf_composite): Likewise. (gdk_pixbuf_composite_color): Likewise. (gdk_pixbuf_scale_simple): Likewise, and fail gracefully if we cannot allocate the new pixbuf. (gdk_pixbuf_composite_color_simple): Likewise. * gdk-pixbuf/gnome-canvas-pixbuf.c (gnome_canvas_pixbuf_render): Use art_rgb_rgba_affine() or art_rgb_affine() since we no longer have an ArtPixBuf. * gdk-pixbuf/io-bmp.c: Fix includes. * gdk-pixbuf/pixops/pixops.c (pixops_scale_nearest): Fixed cast in an lvalue. * TODO: Populated. * configure.in: Removed checks for libart. * gdk-pixbuf/Makefile.am: Removed references to libart. (noinst_HEADERS): Added gdk-pixbuf-private.h. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_LDFLAGS): Incremented the version number of the libtool library to indicate that this definitely is not compatible with the old usage. I know you love me. I know you do. * configure.in: Bumped version number to 0.7.0. * README: Updated. * gdk-pixbuf-config.in (--libs): We no longer require libart. * DEPENDS.libgdk_pixbuf: We no longer depend on libart. * gdk-pixbuf.spec.in: Updated, but I don't guarantee anything.
2000-04-11 07:03:25 +00:00
lc->pixbuf->width,
(lc->last_row_seen_in_chunk -
lc->first_row_seen_in_chunk) + 1,
lc->notify_user_data);
} 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 */
(lc->update_func)(lc->pixbuf, 0,
lc->first_row_seen_in_chunk,
Most of this patch is based on a patch by Havoc Pennington (hp@redhat.com) 2000-04-11 Federico Mena Quintero <federico@helixcode.com> Most of this patch is based on a patch by Havoc Pennington (hp@redhat.com) to make GdkPixbuf's structures opaque and to remove the libart dependency. * gdk-pixbuf/gdk-pixbuf.h: Removed the public structures. (GdkColorspace): New enum that for now only contains GDK_COLORSPACE_RGB. (GdkPixbufDestroyNotify): New type for the pixbuf's pixels destroy notification function. (GdkInterpType): New num with interpolation types. * *.[ch]: Replace the libart stuff with our own stuff. * pixops/*.[ch]: Likewise. * gdk-pixbuf/gdk-pixbuf-private.h: New file with the private declarations of the GdkPixbuf structures. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_new_from_art_pixbuf): Removed function. (gdk_pixbuf_get_format): Constify. (gdk_pixbuf_get_n_channels): Constify. (gdk_pixbuf_get_has_alpha): Constify. (gdk_pixbuf_get_bits_per_sample): Constify. (gdk_pixbuf_get_pixels): Constify. (gdk_pixbuf_get_width): Constify. (gdk_pixbuf_get_height): Constify. (gdk_pixbuf_get_rowstride): Constify. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_copy): New function to copy a pixbuf. * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Added a bits_per_sample argument; currently only 8 bits per sample are supported. * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_pixbuf): New accessor. (gdk_pixbuf_frame_get_x_offset): New accessor. (gdk_pixbuf_frame_get_y_offset): New accessor. (gdk_pixbuf_frame_get_delay_time): New accessor. (gdk_pixbuf_frame_get_action): New accessor. * gdk-pixbuf/gdk-pixbuf-render.c (gdk_pixbuf_render_pixmap_and_mask): Instead of returning a solid mask rectangle for pixbufs without an alpha channel, set the *mask_return to NULL. * gdk-pixbuf/gdk-pixbuf-util.c (gdk_pixbuf_add_alpha): Constify. * gdk-pixbuf/gdk-pixbuf-scale.c: Fix includes. * gdk-pixbuf/gdk-pixbuf-scale.c (gdk_pixbuf_scale): Added some preconditions. Maybe we should also check for the colorspace, bits per pixel, and such. (gdk_pixbuf_composite): Likewise. (gdk_pixbuf_composite_color): Likewise. (gdk_pixbuf_scale_simple): Likewise, and fail gracefully if we cannot allocate the new pixbuf. (gdk_pixbuf_composite_color_simple): Likewise. * gdk-pixbuf/gnome-canvas-pixbuf.c (gnome_canvas_pixbuf_render): Use art_rgb_rgba_affine() or art_rgb_affine() since we no longer have an ArtPixBuf. * gdk-pixbuf/io-bmp.c: Fix includes. * gdk-pixbuf/pixops/pixops.c (pixops_scale_nearest): Fixed cast in an lvalue. * TODO: Populated. * configure.in: Removed checks for libart. * gdk-pixbuf/Makefile.am: Removed references to libart. (noinst_HEADERS): Added gdk-pixbuf-private.h. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_LDFLAGS): Incremented the version number of the libtool library to indicate that this definitely is not compatible with the old usage. I know you love me. I know you do. * configure.in: Bumped version number to 0.7.0. * README: Updated. * gdk-pixbuf-config.in (--libs): We no longer require libart. * DEPENDS.libgdk_pixbuf: We no longer depend on libart. * gdk-pixbuf.spec.in: Updated, but I don't guarantee anything.
2000-04-11 07:03:25 +00:00
lc->pixbuf->width,
(lc->max_row_seen_in_chunk -
lc->first_row_seen_in_chunk) + 1,
lc->notify_user_data);
/* top to last row */
(lc->update_func)(lc->pixbuf,
0, 0,
Most of this patch is based on a patch by Havoc Pennington (hp@redhat.com) 2000-04-11 Federico Mena Quintero <federico@helixcode.com> Most of this patch is based on a patch by Havoc Pennington (hp@redhat.com) to make GdkPixbuf's structures opaque and to remove the libart dependency. * gdk-pixbuf/gdk-pixbuf.h: Removed the public structures. (GdkColorspace): New enum that for now only contains GDK_COLORSPACE_RGB. (GdkPixbufDestroyNotify): New type for the pixbuf's pixels destroy notification function. (GdkInterpType): New num with interpolation types. * *.[ch]: Replace the libart stuff with our own stuff. * pixops/*.[ch]: Likewise. * gdk-pixbuf/gdk-pixbuf-private.h: New file with the private declarations of the GdkPixbuf structures. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_new_from_art_pixbuf): Removed function. (gdk_pixbuf_get_format): Constify. (gdk_pixbuf_get_n_channels): Constify. (gdk_pixbuf_get_has_alpha): Constify. (gdk_pixbuf_get_bits_per_sample): Constify. (gdk_pixbuf_get_pixels): Constify. (gdk_pixbuf_get_width): Constify. (gdk_pixbuf_get_height): Constify. (gdk_pixbuf_get_rowstride): Constify. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_copy): New function to copy a pixbuf. * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Added a bits_per_sample argument; currently only 8 bits per sample are supported. * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_pixbuf): New accessor. (gdk_pixbuf_frame_get_x_offset): New accessor. (gdk_pixbuf_frame_get_y_offset): New accessor. (gdk_pixbuf_frame_get_delay_time): New accessor. (gdk_pixbuf_frame_get_action): New accessor. * gdk-pixbuf/gdk-pixbuf-render.c (gdk_pixbuf_render_pixmap_and_mask): Instead of returning a solid mask rectangle for pixbufs without an alpha channel, set the *mask_return to NULL. * gdk-pixbuf/gdk-pixbuf-util.c (gdk_pixbuf_add_alpha): Constify. * gdk-pixbuf/gdk-pixbuf-scale.c: Fix includes. * gdk-pixbuf/gdk-pixbuf-scale.c (gdk_pixbuf_scale): Added some preconditions. Maybe we should also check for the colorspace, bits per pixel, and such. (gdk_pixbuf_composite): Likewise. (gdk_pixbuf_composite_color): Likewise. (gdk_pixbuf_scale_simple): Likewise, and fail gracefully if we cannot allocate the new pixbuf. (gdk_pixbuf_composite_color_simple): Likewise. * gdk-pixbuf/gnome-canvas-pixbuf.c (gnome_canvas_pixbuf_render): Use art_rgb_rgba_affine() or art_rgb_affine() since we no longer have an ArtPixBuf. * gdk-pixbuf/io-bmp.c: Fix includes. * gdk-pixbuf/pixops/pixops.c (pixops_scale_nearest): Fixed cast in an lvalue. * TODO: Populated. * configure.in: Removed checks for libart. * gdk-pixbuf/Makefile.am: Removed references to libart. (noinst_HEADERS): Added gdk-pixbuf-private.h. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_LDFLAGS): Incremented the version number of the libtool library to indicate that this definitely is not compatible with the old usage. I know you love me. I know you do. * configure.in: Bumped version number to 0.7.0. * README: Updated. * gdk-pixbuf-config.in (--libs): We no longer require libart. * DEPENDS.libgdk_pixbuf: We no longer depend on libart. * gdk-pixbuf.spec.in: Updated, but I don't guarantee anything.
2000-04-11 07:03:25 +00:00
lc->pixbuf->width,
lc->last_row_seen_in_chunk + 1,
lc->notify_user_data);
} else {
/* We made at least one entire pass, so update the
whole image */
(lc->update_func)(lc->pixbuf,
0, 0,
Most of this patch is based on a patch by Havoc Pennington (hp@redhat.com) 2000-04-11 Federico Mena Quintero <federico@helixcode.com> Most of this patch is based on a patch by Havoc Pennington (hp@redhat.com) to make GdkPixbuf's structures opaque and to remove the libart dependency. * gdk-pixbuf/gdk-pixbuf.h: Removed the public structures. (GdkColorspace): New enum that for now only contains GDK_COLORSPACE_RGB. (GdkPixbufDestroyNotify): New type for the pixbuf's pixels destroy notification function. (GdkInterpType): New num with interpolation types. * *.[ch]: Replace the libart stuff with our own stuff. * pixops/*.[ch]: Likewise. * gdk-pixbuf/gdk-pixbuf-private.h: New file with the private declarations of the GdkPixbuf structures. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_new_from_art_pixbuf): Removed function. (gdk_pixbuf_get_format): Constify. (gdk_pixbuf_get_n_channels): Constify. (gdk_pixbuf_get_has_alpha): Constify. (gdk_pixbuf_get_bits_per_sample): Constify. (gdk_pixbuf_get_pixels): Constify. (gdk_pixbuf_get_width): Constify. (gdk_pixbuf_get_height): Constify. (gdk_pixbuf_get_rowstride): Constify. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_copy): New function to copy a pixbuf. * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Added a bits_per_sample argument; currently only 8 bits per sample are supported. * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_pixbuf): New accessor. (gdk_pixbuf_frame_get_x_offset): New accessor. (gdk_pixbuf_frame_get_y_offset): New accessor. (gdk_pixbuf_frame_get_delay_time): New accessor. (gdk_pixbuf_frame_get_action): New accessor. * gdk-pixbuf/gdk-pixbuf-render.c (gdk_pixbuf_render_pixmap_and_mask): Instead of returning a solid mask rectangle for pixbufs without an alpha channel, set the *mask_return to NULL. * gdk-pixbuf/gdk-pixbuf-util.c (gdk_pixbuf_add_alpha): Constify. * gdk-pixbuf/gdk-pixbuf-scale.c: Fix includes. * gdk-pixbuf/gdk-pixbuf-scale.c (gdk_pixbuf_scale): Added some preconditions. Maybe we should also check for the colorspace, bits per pixel, and such. (gdk_pixbuf_composite): Likewise. (gdk_pixbuf_composite_color): Likewise. (gdk_pixbuf_scale_simple): Likewise, and fail gracefully if we cannot allocate the new pixbuf. (gdk_pixbuf_composite_color_simple): Likewise. * gdk-pixbuf/gnome-canvas-pixbuf.c (gnome_canvas_pixbuf_render): Use art_rgb_rgba_affine() or art_rgb_affine() since we no longer have an ArtPixBuf. * gdk-pixbuf/io-bmp.c: Fix includes. * gdk-pixbuf/pixops/pixops.c (pixops_scale_nearest): Fixed cast in an lvalue. * TODO: Populated. * configure.in: Removed checks for libart. * gdk-pixbuf/Makefile.am: Removed references to libart. (noinst_HEADERS): Added gdk-pixbuf-private.h. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_LDFLAGS): Incremented the version number of the libtool library to indicate that this definitely is not compatible with the old usage. I know you love me. I know you do. * configure.in: Bumped version number to 0.7.0. * README: Updated. * gdk-pixbuf-config.in (--libs): We no longer require libart. * DEPENDS.libgdk_pixbuf: We no longer depend on libart. * gdk-pixbuf.spec.in: Updated, but I don't guarantee anything.
2000-04-11 07:03:25 +00:00
lc->pixbuf->width,
lc->max_row_seen_in_chunk + 1,
lc->notify_user_data);
}
}
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
lc->error = NULL;
return TRUE;
}
}
/* 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;
png_textp png_text_ptr;
int i, num_texts;
int color_type;
gboolean have_alpha = FALSE;
lc = png_get_progressive_ptr(png_read_ptr);
if (lc->fatal_error_occurred)
return;
if (!setup_png_transformations(lc->png_read_ptr,
lc->png_info_ptr,
lc->error,
&width, &height, &color_type)) {
lc->fatal_error_occurred = TRUE;
return;
}
/* If we have alpha, set a flag */
if (color_type & PNG_COLOR_MASK_ALPHA)
have_alpha = TRUE;
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;
if (lc->error && *lc->error == NULL) {
g_set_error_literal (lc->error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_FAILED,
_("Transformed PNG has zero width or height."));
}
return;
}
}
lc->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, have_alpha, 8, width, height);
if (lc->pixbuf == NULL) {
/* Failed to allocate memory */
lc->fatal_error_occurred = TRUE;
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
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);
}
return;
}
/* Extract text chunks and attach them as pixbuf options */
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)) {
gdk_pixbuf_set_option (lc->pixbuf, key, value);
g_free (key);
g_free (value);
}
}
}
/* Notify the client that we are ready to go */
if (lc->prepare_func)
fix some shell typos 2001-05-04 Havoc Pennington <hp@redhat.com> * configure.in: fix some shell typos * gtk/gtkcolorsel.c (gtk_color_selection_destroy): warning fix * gtk/gtkimage.c: handle animations * gtk/gtkcheckbutton.c (gtk_check_button_size_request): request border_width * 2, not just border_width * gtk/gtkscale.c: add "format_value" signal to allow people to override the way values are drawn. (gtk_scale_get_value_size): fix width/height mistake, and compute size from actual displayed text, not from made-up text. * gtk/gtktexttag.c (gtk_text_tag_class_init): fix return type in signal registration * tests/testtext.c: Add "Remove all tags" menu item for testing * gtk/gtktextbuffer.c (gtk_text_buffer_remove_all_tags): implement * demos/gtk-demo/main.c (main): add hack so we can find modules without installing gtk * demos/gtk-demo/textview.c (insert_text): demo font scaling * gtk/gtkcellrenderertext.c: Add "scale" property (font scaling factor) (gtk_cell_renderer_text_set_property): remove some bogus g_object_notify * gtk/gtktexttag.c: add "scale" property which is a font scaling factor * gtk/gtktextlayout.c (add_text_attrs): add font scale attribute to layout * gtk/gtktextiter.c (gtk_text_iter_is_start): rename from gtk_text_iter_is_first 2001-05-04 Havoc Pennington <hp@redhat.com> * pixops/pixops.c (pixops_process): merge fix from stable: Patch from hoshem@mel.comcen.com.au to fix nonzero X offsets. Fixes bug #50371. * gdk-pixbuf/pixops/pixops.c (pixops_composite_nearest): merge from stable: Patch from OKADA Mitsuru <m-okada@fjb.co.jp> to fix confusion of using "src" instead of "p". (pixops_composite_color_nearest): Use a more accurate (and correct, to begin with) compositing method. This cures checks showing through on images with no alpha. * gdk-pixbuf.c (gdk_pixbuf_fill): fix bug that left some trailing bytes unfilled. * gdk-pixbuf-io.h: fix UpdatedNotifyFunc to use signed ints * gdk-pixbuf-loader.h (struct _GdkPixbufLoaderClass): Change area_updated signal to use signed ints. Removed animation-related signals. * io-gif.c, io-gif-animation.h, io-gif-animation.c: Massive rewrite action * gdk-pixbuf-animation.c: Add GdkPixbufAnimationIter to abstract all the pesky details. Remove old frame-based API. Make GdkPixbufAnimation an abstract base class, derived by the loaders.
2001-05-07 15:58:47 +00:00
(* lc->prepare_func) (lc->pixbuf, NULL, lc->notify_user_data);
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;
lc = png_get_progressive_ptr(png_read_ptr);
if (lc->fatal_error_occurred)
return;
2006-10-08 05:32:07 +00:00
if (row_num >= lc->pixbuf->height) {
lc->fatal_error_occurred = TRUE;
if (lc->error && *lc->error == NULL) {
g_set_error_literal (lc->error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Fatal error reading PNG image file"));
}
return;
}
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;
Most of this patch is based on a patch by Havoc Pennington (hp@redhat.com) 2000-04-11 Federico Mena Quintero <federico@helixcode.com> Most of this patch is based on a patch by Havoc Pennington (hp@redhat.com) to make GdkPixbuf's structures opaque and to remove the libart dependency. * gdk-pixbuf/gdk-pixbuf.h: Removed the public structures. (GdkColorspace): New enum that for now only contains GDK_COLORSPACE_RGB. (GdkPixbufDestroyNotify): New type for the pixbuf's pixels destroy notification function. (GdkInterpType): New num with interpolation types. * *.[ch]: Replace the libart stuff with our own stuff. * pixops/*.[ch]: Likewise. * gdk-pixbuf/gdk-pixbuf-private.h: New file with the private declarations of the GdkPixbuf structures. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_new_from_art_pixbuf): Removed function. (gdk_pixbuf_get_format): Constify. (gdk_pixbuf_get_n_channels): Constify. (gdk_pixbuf_get_has_alpha): Constify. (gdk_pixbuf_get_bits_per_sample): Constify. (gdk_pixbuf_get_pixels): Constify. (gdk_pixbuf_get_width): Constify. (gdk_pixbuf_get_height): Constify. (gdk_pixbuf_get_rowstride): Constify. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_copy): New function to copy a pixbuf. * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Added a bits_per_sample argument; currently only 8 bits per sample are supported. * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_pixbuf): New accessor. (gdk_pixbuf_frame_get_x_offset): New accessor. (gdk_pixbuf_frame_get_y_offset): New accessor. (gdk_pixbuf_frame_get_delay_time): New accessor. (gdk_pixbuf_frame_get_action): New accessor. * gdk-pixbuf/gdk-pixbuf-render.c (gdk_pixbuf_render_pixmap_and_mask): Instead of returning a solid mask rectangle for pixbufs without an alpha channel, set the *mask_return to NULL. * gdk-pixbuf/gdk-pixbuf-util.c (gdk_pixbuf_add_alpha): Constify. * gdk-pixbuf/gdk-pixbuf-scale.c: Fix includes. * gdk-pixbuf/gdk-pixbuf-scale.c (gdk_pixbuf_scale): Added some preconditions. Maybe we should also check for the colorspace, bits per pixel, and such. (gdk_pixbuf_composite): Likewise. (gdk_pixbuf_composite_color): Likewise. (gdk_pixbuf_scale_simple): Likewise, and fail gracefully if we cannot allocate the new pixbuf. (gdk_pixbuf_composite_color_simple): Likewise. * gdk-pixbuf/gnome-canvas-pixbuf.c (gnome_canvas_pixbuf_render): Use art_rgb_rgba_affine() or art_rgb_affine() since we no longer have an ArtPixBuf. * gdk-pixbuf/io-bmp.c: Fix includes. * gdk-pixbuf/pixops/pixops.c (pixops_scale_nearest): Fixed cast in an lvalue. * TODO: Populated. * configure.in: Removed checks for libart. * gdk-pixbuf/Makefile.am: Removed references to libart. (noinst_HEADERS): Added gdk-pixbuf-private.h. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_LDFLAGS): Incremented the version number of the libtool library to indicate that this definitely is not compatible with the old usage. I know you love me. I know you do. * configure.in: Bumped version number to 0.7.0. * README: Updated. * gdk-pixbuf-config.in (--libs): We no longer require libart. * DEPENDS.libgdk_pixbuf: We no longer depend on libart. * gdk-pixbuf.spec.in: Updated, but I don't guarantee anything.
2000-04-11 07:03:25 +00:00
old_row = lc->pixbuf->pixels + (row_num * lc->pixbuf->rowstride);
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)
{
LoadContext* lc;
lc = png_get_progressive_ptr(png_read_ptr);
if (lc->fatal_error_occurred)
return;
}
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;
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
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);
}
longjmp (png_read_ptr->jmpbuf, 1);
}
static void
png_warning_callback (png_structp png_read_ptr,
png_const_charp warning_msg)
{
LoadContext* lc;
lc = png_get_error_ptr(png_read_ptr);
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
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.
*/
}
/* Save */
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +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);
if (!ioptr->save_func ((gchar *)data, length, ioptr->error, ioptr->user_data)) {
/* 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)
{
png_structp png_ptr;
png_infop info_ptr;
png_textp text_ptr = NULL;
guchar *ptr;
guchar *pixels;
int y;
int i;
png_bytep row_ptr;
png_color_8 sig_bit;
int w, h, rowstride;
int has_alpha;
int bpc;
int num_keys;
int compression = -1;
gboolean success = TRUE;
SaveToFunctionIoPtr to_callback_ioptr;
num_keys = 0;
if (keys && *keys) {
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) {
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."));
return FALSE;
}
for (i = 0; i < len; i++) {
if ((guchar) key[i] > 127) {
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_BAD_OPTION,
_("Keys for PNG text chunks must be ASCII characters."));
return FALSE;
}
}
num_keys++;
} else if (strcmp (*kiter, "compression") == 0) {
char *endptr = NULL;
compression = strtol (*viter, &endptr, 10);
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.
*/
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_BAD_OPTION,
_("PNG compression level must be a value between 0 and 9; value '%d' is not allowed."),
compression);
return FALSE;
}
} else {
g_warning ("Unrecognized parameter (%s) passed to PNG saver.", *kiter);
}
++kiter;
++viter;
}
}
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);
#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
if (!text_ptr[i].text) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_BAD_OPTION,
_("Value for PNG text chunk %s cannot be converted to ISO-8859-1 encoding."), keys[i] + 6);
num_keys = i;
for (i = 0; i < num_keys; i++)
g_free (text_ptr[i].text);
g_free (text_ptr);
return FALSE;
}
}
}
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,
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
error,
png_simple_error_callback,
png_simple_warning_callback);
if (png_ptr == NULL) {
success = FALSE;
goto cleanup;
}
info_ptr = png_create_info_struct (png_ptr);
if (info_ptr == NULL) {
success = FALSE;
goto cleanup;
}
if (setjmp (png_ptr->jmpbuf)) {
success = FALSE;
goto cleanup;
}
if (num_keys > 0) {
png_set_text (png_ptr, info_ptr, text_ptr, num_keys);
}
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);
}
if (compression >= 0)
png_set_compression_level (png_ptr, compression);
if (has_alpha) {
png_set_IHDR (png_ptr, info_ptr, w, h, bpc,
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
} else {
png_set_IHDR (png_ptr, info_ptr, w, h, bpc,
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
}
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++) {
row_ptr = (png_bytep)ptr;
png_write_rows (png_ptr, &row_ptr, 1);
ptr += rowstride;
}
png_write_end (png_ptr, info_ptr);
cleanup:
png_destroy_write_struct (&png_ptr, &info_ptr);
if (num_keys > 0) {
for (i = 0; i < num_keys; i++)
g_free (text_ptr[i].text);
g_free (text_ptr);
}
return success;
}
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);
}
#ifndef INCLUDE_png
#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
#else
#define MODULE_ENTRY(function) void _gdk_pixbuf__png_ ## function
#endif
MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
{
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;
module->save_to_callback = gdk_pixbuf__png_image_save_to_callback;
}
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
{
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;
info->flags = GDK_PIXBUF_FORMAT_WRITABLE | GDK_PIXBUF_FORMAT_THREADSAFE;
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
}