Commit Graph

431 Commits

Author SHA1 Message Date
Matthias Clasen
8abdfd3dcc Don't leak memory if g_try_realloc fails.
* io-tga.c (io_buffer_append):
	* io-ico.c (DecodeHeader):
	* io-bmp.c (grow_buffer): Don't leak memory if g_try_realloc fails.

	* gdk-pixbuf-io.c (pixbuf_check_ico): Fix loading of .CUR files.
	(#91826)
2002-09-03 23:43:21 +00:00
Tor Lillqvist
c23090c6f1 Add gtk_win32res_lo. (#87101, J. Ali Harlow)
2002-08-25  Tor Lillqvist  <tml@iki.fi>

	* gtk/Makefile.am (libgtk_win32_2_0_la_DEPENDENCIES): Add
	gtk_win32res_lo. (#87101, J. Ali Harlow)

	* gdk-pixbuf/Makefile.am (libgdk_pixbuf_2_0_la_DEPENDENCIES): Add
	gdk_pixbuf_win32res_lo. (#87101, J. Ali Harlow)
2002-08-24 22:54:07 +00:00
Matthias Clasen
c22b614565 gdk-pixbuf-io.c (_gdk_pixbuf_generic_image_load): No longer static, thus
* gdk-pixbuf-io.h:
	gdk-pixbuf-io.c (_gdk_pixbuf_generic_image_load): No longer
	static, thus _gdk_pixbuf-prefixed.

	* gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file):
	Keep this logic in sync with gdk_pixbuf_new_from_file().  (Based
	on a patch by Anders Carlsson)

	* io-png.c (gdk_pixbuf__png_image_save): Plug a memory
	leak.  (#91422, Sven Neumann)
2002-08-22 21:32:06 +00:00
Sven Neumann
0a786328d2 free the result of gdk_pixdata_serialize() (bug #89411).
2002-07-31  Sven Neumann  <sven@gimp.org>

	* gdk-pixdata.c (gdk_pixdata_to_csource): free the result of
	gdk_pixdata_serialize() (bug #89411).
2002-07-31 08:17:43 +00:00
Owen Taylor
96dd6780d4 Fix some warnings by adding casts to PixopsInterpType. (#85839, David L.
Mon Jul 29 23:06:10 2002  Owen Taylor  <otaylor@redhat.com>

        * gdk-pixbuf-scale.c: Fix some warnings by adding
        casts to PixopsInterpType. (#85839, David L. Cooper, II.)
2002-07-30 03:09:39 +00:00
Matthias Clasen
0082e2e838 Avoid unnecessary casting.
* io-ras.c (DoCompressed): Avoid unnecessary casting.
2002-07-16 17:32:08 +00:00
Matthias Clasen
94218b8cfe New function for loading an image from a file either via module->load or
* gdk-pixbuf-io.c (generic_image_load): New function for loading
	an image from a file either via module->load or incrementally.
	(prepared_notify): ModulePreparedNotifyFunc for generic_image_load.
	(gdk_pixbuf_new_from_file): Use generic_image_load.
	* io-bmp.c, io-ico.c, io-ras.c, io-wbmp.c: Remove trivial
	implementations of module->load.  (#71266)
2002-07-07 20:29:48 +00:00
Matthias Clasen
724059ccdf Correct computation of image height. (OneLine): Correct update
* io-ico.c (DecodeHeader): Correct computation of image height.
	(OneLine): Correct update notification.
2002-07-06 23:54:50 +00:00
Matthias Clasen
e4ab381018 Load-at-size functionality for gdk-pixbuf. 2002-07-06 23:10:46 +00:00
Matthias Clasen
09487ff9f5 Handle global_error == NULL better. (tiff_image_parse): Don't trust
* io-tiff.c (tiff_set_error): Handle global_error == NULL
	better.
	(tiff_image_parse): Don't trust TIFFRGBAImageBegin to set
	the "put" routine.  (Fixes #87384)
	(gdk_pixbuf__tiff_image_stop_load): Don't call TIFFClose too
	early.
2002-07-06 08:55:51 +00:00
Matthias Clasen
096e8ea297 Miscellaneous bmp loader fixes (#85448, #86286, #86287):
* io-bmp.c (grow_buffer): New function to avoid crashes
	on unchecked reallocs.
	(DecodeHeader, DecodeColormap, decode_bitmasks,
	DoCompressed): Use grow_buffer instead of g_realloc
	throughout. Change signatures where necessary to pass the
	errors up.
	(OneLine16): Fix loading of 16bpp BI_RGB bmps.
	(DoCompressed): Rewritten to properly support BI_RLE4 and
	skips and jumps.
2002-07-02 17:54:06 +00:00
Matthias Clasen
c43a93f984 Support for compressed ras images (#84994):
* io-ras.c (RAS2State): Error on unsupported ras variations.
	(OneLine8): Fix colormap indexing.
	(OneLine): Call updated_func with proper region.
	(DoCompressed): New function, handles compressed ras data.
	(gdk_pixbuf__ras_image_load_increment): Handle compressed ras
	images.
2002-07-01 22:30:51 +00:00
Matthias Clasen
155aa55bed Better colorspace support for the jpeg loader (#61211):
* io-jpeg.c (convert_cmyk_to_rgb): New function.
	(gdk_pixbuf__jpeg_image_load,
	gdk_pixbuf__jpeg_image_load_increment): Allocate a pixbuf with
	alpha for 4-channel jpegs and call convert_cmyk_to_rgb for these.
2002-07-01 22:20:20 +00:00
Sven Neumann
0c9e03ce2e converted a Tab to spaces.
2002-06-28  Sven Neumann  <sven@gimp.org>

	* gdk-pixbuf-csource.c (print_blurb): converted a Tab to spaces.
2002-06-28 14:14:42 +00:00
Owen Taylor
f009b9ff6a Fix problem where when no alpha was involved, we scaled rather than
Thu Jun 13 18:11:11 2002  Owen Taylor  <otaylor@redhat.com>

        * pixops/pixops.c: Fix problem where when no alpha was
        involved, we scaled rather than composited, but then
        went ahead and composited anyways. (#76958, Patch
        from Matthias Clasen). Needs to be merged to GNOME
        1.4 gdk-pixbuf.
2002-06-13 22:11:53 +00:00
Matthias Clasen
ba2bd5533e Use libjpeg in buffered-image mode in order to incrementally display
* io-jpeg.c: Use libjpeg in buffered-image mode in order to
incrementally display incrementally loaded progressive jpegs.
2002-06-13 20:22:59 +00:00
Federico Mena Quintero
ebeb676cf1 New functions to fetch 32 or 16-bit little-endian values starting at a
2002-06-07  Federico Mena Quintero  <federico@ximian.com>

	* io-bmp.c (lsb_32):
	(lsb_16): New functions to fetch 32 or 16-bit little-endian values
	starting at a specific memory location.  We do this instead of
	GINT32_FROM_LE() as the latter is simply dereferences a cast,
	which doesn't work on platforms with alignment requirements.
	Fixes #84083.
2002-06-10 16:50:10 +00:00
Matthias Clasen
61857770ce Accept xbms starting with a C comment - those seem to be not uncommon,
* gdk-pixbuf-io.c (pixbuf_check_xbm): Accept xbms starting
	with a C comment - those seem to be not uncommon, e.g. the Gimp
	produces them.  (#82706)

	* io-xbm.c (read_bitmap_file_data): Don't leak memory on certain
	invalid inputs.
	(gdk_pixbuf__xbm_image_load_real): Don't leak memory on valid inputs.
2002-05-31 23:42:33 +00:00
Tor Lillqvist
7952906cd0 Use GTK_BINARY_VERSION (and not GTK_VERSION) in the path to the loaders on
2002-05-22  Tor Lillqvist  <tml@iki.fi>

	* gdk-pixbuf-io.c (get_libdir): Use GTK_BINARY_VERSION (and not
	GTK_VERSION) in the path to the loaders on Win32, too.

	* Makefile.am: Pass GTK_BINARY_VERSION.
2002-05-22 19:37:30 +00:00
Federico Mena Quintero
1528b0ad85 Ahem, take the rowstride into account!!! Fixes #82515.
2002-05-22  Federico Mena Quintero  <federico@ximian.com>

	* io-xpm.c (pixbuf_create_from_xpm): Ahem, take the rowstride into
	account!!!  Fixes #82515.

	[This bug is not present in the GNOME 1.4 branch as its XPM loader
	does not use gdk_pixbuf_new(); rather it malloc()s a buffer with
	no row padding and then uses gdk_pixbuf_new_from_data() on it.]

	[IMPORTANT: The comment above is to make my life easier when
	merging stuff across branches.  If you make changes to gdk-pixbuf
	in either branch, please include a comment in the ChangeLog that
	indicates whether this should be merged into the other branch.
	Thanks!]
2002-05-22 18:13:44 +00:00
Matthias Clasen
d2686aa951 Check for endianness.
* configure.in: Check for endianness.

	* io-tiff.c (tiff_image_parse): fix packing order on bigendian
	systems.  (#81702)
2002-05-18 14:56:20 +00:00
Owen Taylor
c7efe6f36c Patch from Matthias Clasen to fix some typos (#77246)
Thu May 16 15:17:30 2002  Owen Taylor  <otaylor@redhat.com>

        * pixops/pixops.c: Patch from Matthias Clasen to fix some typos
        (#77246)
2002-05-16 19:18:01 +00:00
Owen Taylor
85a8bdb1fc Fixes for #78258
Thu May 16 14:51:14 2002  Owen Taylor  <otaylor@redhat.com>

        Fixes for #78258

        * gtk/gtkrbtree.c demos/gtk-demo/editable-cells.c:
        Fix some 64-bit warning problems. (Patch from Matthias
        Clasen.)

        * gtk/gtkrbtree.c (_gtk_rbtree_debug_spew_helper): Surround
        a bunch of debug code with G_ENABLE_DEBUG.

        * configure.in demos/gtk-demo/main.c: Replace
        #ifndef G_OS_WIN32 with proper #ifdef HAVE_FLOCKFILE.
2002-05-16 19:11:43 +00:00
Michael Natterer
6c29754a73 build the static pixbuf loaders conditionally like the dynamic ones so
2002-05-07  Michael Natterer  <mitch@gimp.org>

	* gdk-pixbuf/Makefile.am: build the static pixbuf loaders
	conditionally like the dynamic ones so --without-lib<foo> is
	honored when building with --disable-modules. (#66867)
2002-05-07 12:59:18 +00:00
Soeren Sandmann
d269c210c5 image files for testing pixbuf loaders the old test-loaders.c split into
Sun May  5 02:22:59 2002  Soeren Sandmann  <sandmann@daimi.au.dk>

	* tests/test-images/*: image files for testing pixbuf loaders
	* tests/pixbuf-*.c: the old test-loaders.c split into four
	different programs
	* tests/Makefile.am: add new pixbuf tests

Sun May  5 02:27:01 2002  Soeren Sandmann  <sandmann@daimi.au.dk>

	* Makefile.am (noinst_PROGRAMS): remove test-loaders (moved to
	gtk+/tests/)
	* test-loaders.c, test-images.h: remove
2002-05-05 00:59:42 +00:00
Matthias Clasen
999748e922 Remove the ISO8859-1 restriction from the description of png tEXt
* gdk-pixbuf-io.c (gdk_pixbuf_save): Remove the ISO8859-1
	restriction from the description of png tEXt parameters.

	* io-png.c (png_text_to_pixbuf_option):
	(gdk_pixbuf__png_image_save): If libpng supports it,
	store and retrieve non-ISO8859-1 text as UTF-8.  (#76172)
2002-04-24 00:09:29 +00:00
Matthias Clasen
6939510851 More fixes for #77807:
* io-tga.c (get_contiguous_pixbuf): Helper function to create
	a pixbuf with a contiguous pixel array while being careful about
	overflow.

	* io-tga.c (fill_in_context, get_image_pseudocolor,
	get_image_truecolor, get_image_grayscale): Use
	get_contiguous_pixbuf instead of manually allocating image
	storage.

	* io-xpm.c (pixbuf_create_from_xpm):
	* io-pnm.c (gdk_pixbuf__pnm_image_load):
	* io-jpeg.c (gdk_pixbuf__jpeg_image_load): Use gdk_pixbuf_new
	instead of manually allocating image storage.
2002-04-11 21:18:40 +00:00
Matthias Clasen
3bd5fc010a Use priv->image_module->module_name instead of image_type which may be
* gdk-pixbuf-loader.c (gdk_pixbuf_loader_load_module): Use
	priv->image_module->module_name instead of image_type which may
	be NULL.
2002-04-09 00:38:38 +00:00
Matthias Clasen
71e0ad8d9e Restructured to use gdk_pixbuf_new instead of manually allocating image
* io-png.c (gdk_pixbuf__png_image_load): Restructured to use
	gdk_pixbuf_new instead of manually allocating image storage. This
	gives us a good rowstride and overflow checks.  (#77807)
2002-04-06 18:51:40 +00:00
Matthias Clasen
41446c99be Avoid allocating an extra copy of the image by using a
* io-tiff.c (tiff_image_parse): Avoid allocating an extra copy of
	the image by using a TIFFRGBAImage{Begin,Get,End} with suitable
	put functions instead of TIFFRGBAImage. And check image dimensions
	for overflow.
2002-04-05 21:02:07 +00:00
Matthias Clasen
b7333010d0 Fix a doc typo.
* gdk-pixbuf-loader.c (gdk_pixbuf_loader_get_type): Fix a doc typo.
2002-04-03 18:17:14 +00:00
Matthias Clasen
5c16742258 libpng error handlers must not return to their callers, thus longjmp out.
* io-png.c (png_simple_error_callback): libpng error handlers must
	not return to their callers, thus longjmp out. This prevents
	annoying stderr output from the default error handler.
2002-03-29 21:40:01 +00:00
Matthias Clasen
ec35e8112a Don't leak info_ptr.
* io-png.c (gdk_pixbuf__png_image_stop_load): Don't leak info_ptr.

	* io-png.c (gdk_pixbuf__png_image_load): Get rid of unused
	end_info. Also call png_read_end to check proper ending of the png
	file and catch text chunks after the image data.
2002-03-27 22:12:05 +00:00
Matthias Clasen
266c62df8f Make libpng use g_malloc instead of system malloc.
* io-png.c (gdk_pixbuf__png_image_load,
	gdk_pixbuf__png_image_begin_load): Make libpng use g_malloc
	instead of system malloc.
2002-03-26 23:17:31 +00:00
Matthias Clasen
de19229a33 Don't leak pixbuf on error.
* io-tiff.c (tiff_image_parse): Don't leak pixbuf on error.

	* io-gif.c (gdk_pixbuf__gif_image_load_increment): Don't leak
	context->buf on error.

	* gdk-pixbuf-loader.c (gdk_pixbuf_loader_close): Make sure to call
	stop_load even for short images to prevent memleaks.
2002-03-25 23:22:01 +00:00
Matthias Clasen
2a8fc72b0d Changed signature to return success and set a GError parameter, adjusted
* io-png.c (setup_png_transformations): Changed signature to
	return success and set a GError parameter, adjusted all callers.
	Also work around a possible FPE in libpng and always check that
	the new info is sane.
2002-03-25 00:15:00 +00:00
Matthias Clasen
8bad932211 context->updated_func is NULL during a nonincremental load.
* io-wbmp.c (gdk_pixbuf__wbmp_image_load_increment):
	context->updated_func is NULL during a nonincremental load.
	(gdk_pixbuf__wbmp_image_load): Stop reading after the first error.
2002-03-23 21:17:17 +00:00
Matthias Clasen
ac7e3c9584 Fix assumptions on rowstride by manually allocating a contiguous pixel
* io-tga.c: Fix assumptions on rowstride by manually allocating a
	contiguous pixel buffer. Catch buffer overruns in RLE-modi.
	Support grayscale + alpha (which can be written, but not read (!)
	by the Gimp).
2002-03-18 22:19:24 +00:00
Matthias Clasen
006a84274f Catch invalid frame dimensions.
* io-gif.c (gif_get_frame_info): Catch invalid frame dimensions.
2002-03-15 23:27:55 +00:00
Matthias Clasen
5ebe8faab2 Add valid_ras_test and invalid_bmp_1.
* test-images.h: Add valid_ras_test and invalid_bmp_1.

	* test-loaders.c (main): Add random tests for ras and pnm and an
	invalid bmp which was a crasher until my 2002-03-12 commit.

	* io-pnm.c (gdk_pixbuf__pnm_image_load_increment): Don't unref the
	pixbuf on errors.

	* io-ras.c: Handle some errors.
2002-03-13 18:11:15 +00:00
Sven Neumann
c51692d673 use sequential writes instead of calling memcpy(). Simpler and potentially
2002-03-12  Sven Neumann  <sven@gimp.org>

	* gdk-pixbuf.c (gdk_pixbuf_fill): use sequential writes instead of
	calling memcpy(). Simpler and potentially faster. (#70332)
2002-03-12 20:38:49 +00:00
Matthias Clasen
7c59491ce4 Replace a g_assert_not_reached () which could actually be reached by a
* io-bmp.c (DecodeHeader): Replace a g_assert_not_reached ()
	which could actually be reached by a proper error status return.
2002-03-12 19:49:03 +00:00
Matthias Clasen
981574a9be Fix docs.
* gtk/gtktreemodel.c (gtk_tree_row_reference_deleted): Fix docs.

	* gtk/gtkwindow.c (gtk_window_remove_mnemonic):
	(gtk_window_add_mnemonic):
	(gtk_window_mnemonic_activate): Add docs.

	* gtk/gtktreeview.c (gtk_tree_view_get_search_equal_func): Fix
	typo in docs.

	* test-loaders.c, test-images.h: More random tests.

	* io-bmp.c (DecodeHeader): Fail gracefully on OOM here.

	* gtk/gtk-sections.txt: Remove gtk_win32_get_installation_directory.
2002-03-05 22:44:27 +00:00
Owen Taylor
ef6685731c ue Mar 5 10:39:03 2002 Owen Taylor <otaylor@redhat.com>
* Makefile.am (loaderdir): Put the modules into the
        GTK_BINARY_VERSION directory for consistency with
        immodules and theme engines.
2002-03-05 15:40:48 +00:00
Owen Taylor
b3c0813b93 If we can't load the module using the g_module_build_path() filename, try
Sat Mar  2 22:11:10 2002  Owen Taylor  <otaylor@redhat.com>

        * gdk-pixbuf-io.c (_gdk_pixbuf_load_module): If we
        can't load the module using the g_module_build_path()
        filename, try loading it as a .la file.

        * test-loaders.c: Look for modules in current directory
        rather than .libs, so we find the right .la files.

        * test-loaders.c: Back out some accidental commits.
2002-03-03 03:17:22 +00:00
Owen Taylor
ed5fc07f4e Bullet-proof against integer overflow.
Sat Mar  2 21:28:03 2002  Owen Taylor  <otaylor@redhat.com>

        * gdk-pixbuf.c (gdk_pixbuf_new): Bullet-proof against integer
        overflow.
2002-03-03 02:35:25 +00:00
Tor Lillqvist
5d5f53d95d Remove.
2002-03-03  Tor Lillqvist  <tml@iki.fi>

	* gtk-pixbuf.rc.in: Remove.

	* gdk_pixbuf.rc.in: Name like this instead (wrong name used by
	mistake by Hans).

	* makefile.msc: Corresponding changes.

	* Makefile.am: Use gdk_pixbuf.rc on Win32. Distribute it.
2002-03-02 23:19:59 +00:00
Matthias Clasen
3a4906e82d Move the call to correct_total() to the right spot. (#72732)
* pixops/pixops.c (tile_make_weights): Move the call to
	correct_total() to the right spot. (#72732)
2002-02-28 18:47:38 +00:00
Owen Taylor
80bf58e01d Use {} not () to group around string assigned to char[]. (#72767, Tomas
Wed Feb 27 18:33:04 2002  Owen Taylor  <otaylor@redhat.com>

	* gdk-pixdata.c (gdk_pixdata_to_csource): Use {} not
	() to group around string assigned to char[]. (#72767,
	Tomas Ögren)
2002-02-27 23:45:05 +00:00
Havoc Pennington
96387b40ea remove C++-commented debug spew, reported by David L. Cooper
2002-02-21  Havoc Pennington  <hp@pobox.com>

	* gdk-pixbuf-loader.c (gdk_pixbuf_loader_load_module): remove
	C++-commented debug spew, reported by David L. Cooper
2002-02-22 02:00:57 +00:00