devel-docs/gbr.txt applied a patch from Guillermo S. Romero that fixes

2003-09-03  Sven Neumann  <sven@gimp.org>

	* devel-docs/gbr.txt
	* plug-ins/common/gbr.c: applied a patch from Guillermo S. Romero
	that fixes loading of v1 brushes and documents the difference
	to version 2 of the brush file format (bug #121304).
This commit is contained in:
Sven Neumann 2003-09-03 16:59:22 +00:00 committed by Sven Neumann
parent 157dc58571
commit 4a3740e8ed
3 changed files with 97 additions and 80 deletions

View File

@ -1,3 +1,10 @@
2003-09-03 Sven Neumann <sven@gimp.org>
* devel-docs/gbr.txt
* plug-ins/common/gbr.c: applied a patch from Guillermo S. Romero
that fixes loading of v1 brushes and documents the difference
to version 2 of the brush file format (bug #121304).
2003-09-03 Sven Neumann <sven@gimp.org>
* app/tools/gimpclonetool.c: Ctrl only sets the clone source when

View File

@ -47,3 +47,17 @@ BODY
Type: uchar *
Value: Pixel values (row-first) for brush
The GIMP Paintbrush File Format Version 1 (.gbr)
------------------------------------------------
Based on examples and code, it seems that v1 is like v2, but it is
lacking bytes 20 - 27 (no magic or spacing info), and thus having
as last header field:
Bytes 20 - (header_size - 20):
Type: char *
Value: undefined encoding string - name of brush
GBR v1 is deprecated and should never be used to save new brushes.

View File

@ -287,7 +287,6 @@ load_image (const gchar *filename)
gint32 layer_ID;
GimpDrawable *drawable;
GimpPixelRgn pixel_rgn;
gint version_extra;
gint bn_size;
GimpImageBaseType base_type;
GimpImageType image_type;
@ -320,16 +319,13 @@ load_image (const gchar *filename)
bh.magic_number = g_ntohl (bh.magic_number);
bh.spacing = g_ntohl (bh.spacing);
/* How much extra to add to the header seek - 1 needs a bit more */
version_extra = 0;
if (bh.version == 1)
{
/* Version 1 didn't know about spacing */
bh.spacing = 25;
/* And we need to rewind the handle a bit too */
/* And we need to rewind the handle, 4 due spacing and 4 due magic */
lseek (fd, -8, SEEK_CUR);
version_extra = 8;
bh.header_size += 8;
}
/* Version 1 didn't know about magic either */
if ((bh.version != 1 &&