cvs: gd /libgd/src gd_tga.c gd_tga.h

[email protected] ("Mattias Bengtsson") Tue, 16 Oct 2007 21:51:42 -0000
Newsgroups php.gd.cvs
Message-ID <cvsmattias1192571502@cvsserver>
mattias		Tue Oct 16 21:51:42 2007 UTC

  Modified files:              
    /gd/libgd/src	gd_tga.c gd_tga.h 
  Log:
  - ws + comment
  
http://cvs.php.net/viewvc.cgi/gd/libgd/src/gd_tga.c?r1=1.4&r2=1.5&diff_format=u
Index: gd/libgd/src/gd_tga.c
diff -u gd/libgd/src/gd_tga.c:1.4 gd/libgd/src/gd_tga.c:1.5
--- gd/libgd/src/gd_tga.c:1.4	Tue Oct 16 21:36:49 2007
+++ gd/libgd/src/gd_tga.c	Tue Oct 16 21:51:42 2007
@@ -12,7 +12,7 @@
  *	\param infile Pointer to TGA binary file
  *	\return gdImagePtr	
  */
-BGD_DECLARE(gdImagePtr) gdImageCreateFromTga(FILE * fp)
+BGD_DECLARE(gdImagePtr) gdImageCreateFromTga(FILE *fp)
 {
 	gdImagePtr image;
 	gdIOCtx* in = gdNewFileCtx(fp);
@@ -38,12 +38,11 @@
  */
 BGD_DECLARE(gdImagePtr) gdImageCreateFromTgaCtx(gdIOCtx* ctx)
 {
-
 	int bitmap_caret = 0;
 	int i = 0;
 	oTga *tga = NULL;
-	int pixel_block_size = 0;
-	int image_block_size = 0;
+/*	int pixel_block_size = 0;
+	int image_block_size = 0; */
 	volatile gdImagePtr image = NULL;
 	int x = 0;
 	int y = 0;
@@ -62,8 +61,10 @@
 		return NULL;    
 	}
 
+/*TODO: Will this be used?
 	pixel_block_size = tga->bits / 8;
 	image_block_size = (tga->width * tga->height) * pixel_block_size;
+*/
 
 	if (read_image_tga(ctx, tga)) {
 		free_tga(tga);
http://cvs.php.net/viewvc.cgi/gd/libgd/src/gd_tga.h?r1=1.3&r2=1.4&diff_format=u
Index: gd/libgd/src/gd_tga.h
diff -u gd/libgd/src/gd_tga.h:1.3 gd/libgd/src/gd_tga.h:1.4
--- gd/libgd/src/gd_tga.h:1.3	Sat Oct 13 18:18:27 2007
+++ gd/libgd/src/gd_tga.h	Tue Oct 16 21:51:42 2007
@@ -18,7 +18,7 @@
  * 
  */
 
-#define TGA_LINE_LENGTH 1024
+#define TGA_LINE_LENGTH	1024
 
 #ifndef __TGA_H
 #define __TGA_H	1
@@ -29,59 +29,59 @@
 
 
 #ifndef O_BYTE
-#define O_BYTE    1
-    typedef int byte;
+#define O_BYTE	1
+	typedef int byte;
 #endif
 #ifndef O_SHORT_INT
-#define O_SHORT_INT     1
-    typedef int short_int;
+#define O_SHORT_INT	1
+	typedef int short_int;
 #endif
 
 typedef struct oTga_
 {
-    byte  identsize;			// size of ID field that follows 18 byte header (0 usually)
-    byte  colormaptype;		// type of colour map 0=none, 1=has palette					[IGNORED] Adrian requested no support
-    byte  imagetype;			// type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed
-
-    int colormapstart;		        // first colour map entry in palette						[IGNORED] Adrian requested no support
-    int colormaplength;		// number of colours in palette								[IGNORED] Adrian requested no support
-    byte  colormapbits;		// number of bits per palette entry 15,16,24,32				[IGNORED] Adrian requested no support
-
-    int xstart;				// image x origin
-    int ystart;				// image y origin
-    int width;				// image width in pixels
-    int height;				// image height in pixels
-    byte  bits;				// image bits per pixel 8,16,24,32
-		byte alphabits;   // alpha bits (low 4bits of header 17)
-		byte fliph;       // horizontal or vertical
-		byte flipv;       // flip
-    char *ident;			// identifcation tag string
-    int *bitmap;			// bitmap data
+	byte  identsize;	// size of ID field that follows 18 byte header (0 usually)
+	byte  colormaptype;	// type of colour map 0=none, 1=has palette					[IGNORED] Adrian requested no support
+	byte  imagetype;	// type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed
+
+	int colormapstart;	// first colour map entry in palette						[IGNORED] Adrian requested no support
+	int colormaplength;	// number of colours in palette								[IGNORED] Adrian requested no support
+	byte  colormapbits;	// number of bits per palette entry 15,16,24,32				[IGNORED] Adrian requested no support
+
+	int xstart;			// image x origin
+	int ystart;			// image y origin
+	int width;			// image width in pixels
+	int height;			// image height in pixels
+	byte  bits;			// image bits per pixel 8,16,24,32
+	byte alphabits;		// alpha bits (low 4bits of header 17)
+	byte fliph;			// horizontal or vertical
+	byte flipv;			// flip
+	char *ident;		// identifcation tag string
+	int *bitmap;		// bitmap data
     
 } oTga;
 
-#define TGA_TYPE_NO_IMAGE                       0
-#define TGA_TYPE_INDEXED                        1
-#define TGA_TYPE_RGB                            2
-#define TGA_TYPE_GREYSCALE                      3
-#define TGA_TYPE_INDEXED_RLE                    9
-#define TGA_TYPE_RGB_RLE                        10
-#define TGA_TYPE_GREYSCALE_RLE                  11
-#define TGA_TYPE_INDEXED_HUFFMAN_DELTA_RLE      32 
-#define TGA_TYPE_RGB_HUFFMAN_DELTA_QUADTREE_RLE 33
-
-#define TGA_BPP_8  8
-#define TGA_BPP_16 16
-#define TGA_BPP_24 24
-#define TGA_BPP_32 32
+#define TGA_TYPE_NO_IMAGE						0
+#define TGA_TYPE_INDEXED						1
+#define TGA_TYPE_RGB							2
+#define TGA_TYPE_GREYSCALE						3
+#define TGA_TYPE_INDEXED_RLE					9
+#define TGA_TYPE_RGB_RLE						10
+#define TGA_TYPE_GREYSCALE_RLE					11
+#define TGA_TYPE_INDEXED_HUFFMAN_DELTA_RLE		32 
+#define TGA_TYPE_RGB_HUFFMAN_DELTA_QUADTREE_RLE	33
+
+#define TGA_BPP_8	8
+#define TGA_BPP_16	16
+#define TGA_BPP_24	24
+#define TGA_BPP_32	32
 
-#define TGA_RLE_FLAG 128
+#define TGA_RLE_FLAG	128
 
-gdImagePtr gdImageCreateFromTGA( FILE * fp );
-gdImagePtr gdImageCreateFromTGACtx( gdIOCtx* ctx );
+gdImagePtr gdImageCreateFromTGA(FILE *fp);
+gdImagePtr gdImageCreateFromTGACtx(gdIOCtx *ctx);
 
 int read_header_tga(gdIOCtx *ctx, oTga *tga);
 int read_image_tga(gdIOCtx *ctx, oTga *tga);
-void free_tga(oTga * tga);
+void free_tga(oTga *tga);
 
 #endif //__TGA_H