View | Details | Raw Unified | Return to bug 196161 | Differences between
and this patch

Collapse All | Expand All

(-)Makefile (-6 / +10 lines)
Lines 3-9 Link Here
3
3
4
PORTNAME=	devil
4
PORTNAME=	devil
5
PORTVERSION=	1.7.8
5
PORTVERSION=	1.7.8
6
PORTREVISION=	20
6
PORTREVISION=	21
7
PORTEPOCH=	1
7
PORTEPOCH=	1
8
CATEGORIES=	graphics
8
CATEGORIES=	graphics
9
MASTER_SITES=	SF/openil/DevIL/${PORTVERSION}
9
MASTER_SITES=	SF/openil/DevIL/${PORTVERSION}
Lines 14-25 Link Here
14
14
15
USES=		alias autoreconf libtool pkgconfig
15
USES=		alias autoreconf libtool pkgconfig
16
GNU_CONFIGURE=	yes
16
GNU_CONFIGURE=	yes
17
CONFIGURE_ARGS=	--enable-ILU \
17
CONFIGURE_ARGS=	--enable-ILU --enable-ILUT \
18
		--disable-allegro --disable-directx8 --disable-directx9 \
18
		--disable-allegro --disable-directx8 --disable-directx9 \
19
		--without-libsquish
19
		--without-libsquish
20
INSTALL_TARGET=	install-strip
20
INSTALL_TARGET=	install-strip
21
USE_LDCONFIG=	yes
21
USE_LDCONFIG=	yes
22
USE_GCC=	any
23
22
24
WRKSRC=		${WRKDIR}/${DISTNAME:tl}
23
WRKSRC=		${WRKDIR}/${DISTNAME:tl}
25
24
Lines 73-83 Link Here
73
72
74
.if ${PORT_OPTIONS:MX11}
73
.if ${PORT_OPTIONS:MX11}
75
USE_GL=		glut
74
USE_GL=		glut
76
CONFIGURE_ARGS+=--enable-ILUT
77
PLIST_SUB+=	X11=""
78
.else
75
.else
79
CONFIGURE_ARGS+=--disable-opengl --disable-x11 --disable-xpm --disable-shm
76
CONFIGURE_ARGS+=--disable-opengl --disable-x11 --disable-xpm --disable-shm
80
PLIST_SUB+=	X11="@comment "
81
.endif
77
.endif
82
78
83
.if ${PORT_OPTIONS:MSDL}
79
.if ${PORT_OPTIONS:MSDL}
Lines 97-102 Link Here
97
	@${REINPLACE_CMD} -e 's|<malloc\.h>|<stdlib.h>|g' \
93
	@${REINPLACE_CMD} -e 's|<malloc\.h>|<stdlib.h>|g' \
98
		${WRKSRC}/src-ILU/ilur/ilur.c
94
		${WRKSRC}/src-ILU/ilur/ilur.c
99
95
96
post-configure:
97
	${REINPLACE_CMD} -e 's,-std=gnu99,,'	\
98
		${WRKSRC}/Makefile ${WRKSRC}/*/Makefile
99
100
post-install:
100
post-install:
101
	@${RMDIR} ${STAGEDIR}${DATADIR}/examples
101
	@${RMDIR} ${STAGEDIR}${DATADIR}/examples
102
	@${RMDIR} ${STAGEDIR}${DATADIR}
102
	@${RMDIR} ${STAGEDIR}${DATADIR}
Lines 105-108 Link Here
105
	${INSTALL_DATA} ${WRKSRC}/${file} ${STAGEDIR}${DOCSDIR}
105
	${INSTALL_DATA} ${WRKSRC}/${file} ${STAGEDIR}${DOCSDIR}
106
.endfor
106
.endfor
107
107
108
check test regression-test: build
109
	${MAKE} -C ${WRKSRC}/test testil
110
	cd ${WRKSRC}/test && ${SH} format_test/format_checks.sh
111
108
.include <bsd.port.mk>
112
.include <bsd.port.mk>
(-)files/patch-41 (+103 lines)
Line 0 Link Here
1
See https://sourceforge.net/p/openil/patches/41/
2
3
This patch improves alpha-compositing in DevIL.
4
5
--- src-IL/src/il_devil.c	(revision 1654)
6
+++ src-IL/src/il_devil.c	(working copy)
7
@@ -665,10 +665,10 @@
8
 	ILuint		c;
9
 	ILuint		StartX, StartY, StartZ;
10
 	ILboolean	DestFlipped = IL_FALSE;
11
+	ILboolean	DoAlphaBlend = IL_FALSE;
12
 	ILubyte 	*SrcTemp;
13
-	ILfloat		Back;
14
-
15
-	// Check if the desiination image really exists
16
+	ILfloat		ResultAlpha;
17
+	// Check if the destination image really exists
18
 	if (DestName == 0 || iCurImage == NULL) {
19
 		ilSetError(IL_ILLEGAL_OPERATION);
20
 		return IL_FALSE;
21
@@ -680,6 +680,9 @@
22
 		DestFlipped = IL_TRUE;
23
 		ilFlipImage();
24
 	}
25
+	//determining destination alpha support
26
+	DoAlphaBlend = ilIsEnabled(IL_BLIT_BLEND);
27
+
28
 	//DestOrigin = Dest->Origin;
29
 	ilBindImage(Source);
30
 	
31
@@ -688,7 +691,9 @@
32
 		ilSetError(IL_INVALID_PARAM);
33
 		return IL_FALSE;
34
 	}
35
-	
36
+	//determining source alpha support
37
+	DoAlphaBlend &= ilIsEnabled(IL_BLIT_BLEND);
38
+
39
 	Src = iCurImage;
40
 	
41
 	//@TODO test if coordinates are inside the images (hard limit for source)
42
@@ -737,38 +742,49 @@
43
 					const ILuint  SrcIndex  = (z+SrcZ)*ConvSizePlane + (y+SrcY)*ConvBps + (x+SrcX)*Dest->Bpp;
44
 					const ILuint  DestIndex = (z+DestZ)*Dest->SizeOfPlane + (y+DestY)*Dest->Bps + (x+DestX)*Dest->Bpp;
45
 					const ILuint  AlphaIdx = SrcIndex + bpp_without_alpha;
46
-					ILfloat Front = 0;
47
+					ILfloat FrontAlpha = 0; // foreground opacity
48
+					ILfloat BackAlpha = 0;	// background opacity
49
 					
50
 					switch (Dest->Type)
51
 					{
52
 						case IL_BYTE:
53
 						case IL_UNSIGNED_BYTE:
54
-							Front = Converted[AlphaIdx]/((float)IL_MAX_UNSIGNED_BYTE);
55
+							FrontAlpha = Converted[AlphaIdx]/((float)IL_MAX_UNSIGNED_BYTE);
56
+							BackAlpha = Dest->Data[AlphaIdx]/((float)IL_MAX_UNSIGNED_BYTE);
57
 							break;
58
 						case IL_SHORT:
59
 						case IL_UNSIGNED_SHORT:
60
-							Front = ((ILshort*)Converted)[AlphaIdx]/((float)IL_MAX_UNSIGNED_SHORT);
61
+							FrontAlpha = ((ILshort*)Converted)[AlphaIdx]/((float)IL_MAX_UNSIGNED_SHORT);
62
+							BackAlpha = ((ILshort*)Dest->Data)[AlphaIdx]/((float)IL_MAX_UNSIGNED_SHORT);
63
 							break;
64
 						case IL_INT:
65
 						case IL_UNSIGNED_INT:
66
-							Front = ((ILint*)Converted)[AlphaIdx]/((float)IL_MAX_UNSIGNED_INT);
67
+							FrontAlpha = ((ILint*)Converted)[AlphaIdx]/((float)IL_MAX_UNSIGNED_INT);
68
+							BackAlpha = ((ILint*)Dest->Data)[AlphaIdx]/((float)IL_MAX_UNSIGNED_INT);
69
 							break;
70
 						case IL_FLOAT:
71
-							Front = ((ILfloat*)Converted)[AlphaIdx];
72
+							FrontAlpha = ((ILfloat*)Converted)[AlphaIdx];
73
+							BackAlpha = ((ILfloat*)Dest->Data)[AlphaIdx];
74
 							break;
75
 						case IL_DOUBLE:
76
-							Front = (ILfloat)(((ILdouble*)Converted)[AlphaIdx]);
77
+							FrontAlpha = (ILfloat)(((ILdouble*)Converted)[AlphaIdx]);
78
+							BackAlpha = (ILfloat)(((ILdouble*)Dest->Data)[AlphaIdx]);
79
 							break;
80
 					}
81
-					Back = 1.0f - Front;
82
-					// In case of Alpha channel, the data is blended. Keeps the original alpha.
83
-					if (ilIsEnabled(IL_BLIT_BLEND)) {
84
+					
85
+					// In case of Alpha channel, the data is blended.
86
+					// Computes composite Alpha
87
+					if (DoAlphaBlend)
88
+					{
89
+						ResultAlpha = FrontAlpha + (1.0f - FrontAlpha) * BackAlpha;
90
 						for (c = 0; c < bpp_without_alpha; c++)
91
 						{
92
-							Dest->Data[DestIndex + c] = 
93
-								(ILubyte)(Converted[SrcIndex + c] * Front
94
-											+ Dest->Data[DestIndex + c] * Back);
95
+							Dest->Data[DestIndex + c] = (ILubyte)( 0.5f + 
96
+								(Converted[SrcIndex + c] * FrontAlpha + 
97
+								(1.0f - FrontAlpha) * Dest->Data[DestIndex + c] * BackAlpha) 
98
+								/ ResultAlpha);
99
 						}
100
+						Dest->Data[AlphaIdx] = (ILubyte)(0.5f + ResultAlpha * (float)IL_MAX_UNSIGNED_BYTE);
101
 					}
102
 					else {
103
 						for (c = 0; c < Dest->Bpp; c++)
(-)files/patch-42 (+46 lines)
Line 0 Link Here
1
See https://sourceforge.net/p/openil/patches/42/
2
3
This patch allows luminance BMPs to be saved as straight grayscale, saving
4
lots of space for colorless images.
5
--- src-IL/src/il_bmp.c	(revision 1662)
6
+++ src-IL/src/il_bmp.c	(working copy)
7
@@ -928,6 +928,28 @@
8
 		}
9
 	}
10
 
11
+	if((iCurImage->Format == IL_LUMINANCE) && (iCurImage->Pal.Palette == NULL))
12
+	{
13
+		// For luminance images it is necessary to generate a grayscale BGR32
14
+		//  color palette.  Could call iConvertImage(..., IL_COLOR_INDEX, ...)
15
+		//  to generate an RGB24 palette, followed by iConvertPal(..., IL_PAL_BGR32),
16
+		//  to convert the palette to BGR32, but it seemed faster to just
17
+		//  explicitely generate the correct palette.
18
+		
19
+		iCurImage->Pal.PalSize = 256*4;
20
+		iCurImage->Pal.PalType = IL_PAL_BGR32;
21
+		iCurImage->Pal.Palette = (ILubyte*)ialloc(iCurImage->Pal.PalSize);
22
+		
23
+		// Generate grayscale palette
24
+		for (i = 0; i < 256; i++)
25
+		{
26
+			iCurImage->Pal.Palette[i * 4] = i;
27
+			iCurImage->Pal.Palette[i * 4 + 1] = i;
28
+			iCurImage->Pal.Palette[i * 4 + 2] = i;
29
+			iCurImage->Pal.Palette[i * 4 + 3] = 0;
30
+		}
31
+	}
32
+	
33
 	// If the current image has a palette, take care of it
34
 	TempPal = &iCurImage->Pal;
35
 	if( iCurImage->Pal.PalSize && iCurImage->Pal.Palette && iCurImage->Pal.PalType != IL_PAL_NONE ) {
36
@@ -948,8 +970,8 @@
37
 	//BITMAPINFOHEADER, so that the written header refers to
38
 	//TempImage instead of the original image
39
 	
40
-	// @TODO LUMINANCE converted to BGR insteaf of beign saved to luminance
41
-	if (iCurImage->Format != IL_BGR && iCurImage->Format != IL_BGRA && iCurImage->Format != IL_COLOUR_INDEX) {
42
+	if ((iCurImage->Format != IL_BGR) && (iCurImage->Format != IL_BGRA) && 
43
+			(iCurImage->Format != IL_COLOUR_INDEX) && (iCurImage->Format != IL_LUMINANCE)) {
44
 		if (iCurImage->Format == IL_RGBA) {
45
 			TempImage = iConvertImage(iCurImage, IL_BGRA, IL_UNSIGNED_BYTE);
46
 		} else {
(-)files/patch-43 (+26 lines)
Line 0 Link Here
1
See https://sourceforge.net/p/openil/patches/43/
2
3
This patch will cause TIFFs with only a single color channel to be
4
saved as such, rather than as RGB.
5
6
--- src-IL/src/il_tiff.c	(revision 1663)
7
+++ src-IL/src/il_tiff.c	(working copy)
8
@@ -987,11 +987,15 @@
9
 	TIFFSetField(File, TIFFTAG_IMAGEWIDTH, TempImage->Width);
10
 	TIFFSetField(File, TIFFTAG_IMAGELENGTH, TempImage->Height);
11
 	TIFFSetField(File, TIFFTAG_COMPRESSION, Compression);
12
-	TIFFSetField(File, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
13
+	if((TempImage->Format == IL_LUMINANCE) || (TempImage->Format == IL_LUMINANCE_ALPHA))
14
+		TIFFSetField(File, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
15
+	else
16
+		TIFFSetField(File, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
17
 	TIFFSetField(File, TIFFTAG_BITSPERSAMPLE, TempImage->Bpc << 3);
18
 	TIFFSetField(File, TIFFTAG_SAMPLESPERPIXEL, TempImage->Bpp);
19
-	if (TempImage->Bpp == 4) //TODO: LUMINANCE, LUMINANCE_ALPHA
20
-		TIFFSetField(File, TIFFTAG_MATTEING, 1);
21
+	if ((TempImage->Bpp == ilGetBppFormat(IL_RGBA)) ||
22
+			(TempImage->Bpp == ilGetBppFormat(IL_LUMINANCE_ALPHA)))
23
+		TIFFSetField(File, TIFFTAG_EXTRASAMPLES, EXTRASAMPLE_ASSOCALPHA);
24
 	TIFFSetField(File, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
25
 	TIFFSetField(File, TIFFTAG_ROWSPERSTRIP, 1);
26
 	TIFFSetField(File, TIFFTAG_SOFTWARE, ilGetString(IL_VERSION_NUM));
(-)files/patch-46 (+81 lines)
Line 0 Link Here
1
See: https://sourceforge.net/p/openil/patches/46/
2
3
Add the ability to alter the PNG-compression.
4
5
--- include/IL/il.h	(revision 1677)
6
+++ include/IL/il.h	(working copy)
7
@@ -377,6 +377,7 @@
8
 #define IL_PNG_ALPHA_INDEX 0x0724 //XIX : ILint : the color in the palette at this index value (0-255) is considered transparent, -1 for no trasparent color
9
 #define IL_JPG_PROGRESSIVE         0x0725
10
 #define IL_VTF_COMP                0x0726
11
+#define IL_PNG_COMPRESSION         0x0727
12
 
13
 
14
 // DXTC definitions
15
--- src-IL/include/il_states.h	(revision 1677)
16
+++ src-IL/include/il_states.h	(working copy)
17
@@ -76,6 +76,7 @@
18
 	ILboolean	ilJpgProgressive;
19
 	ILenum		ilDxtcFormat;
20
 	ILenum		ilPcdPicNum;
21
+	ILuint		ilPngCompression;
22
 
23
 	ILint		ilPngAlphaIndex;	// this index should be treated as an alpha key (most formats use this rather than having alpha in the palette), -1 for none
24
 									// currently only used when writing out .png files and should obviously be set to -1 most of the time
25
--- src-IL/src/il_png.c	(revision 1677)
26
+++ src-IL/src/il_png.c	(working copy)
27
@@ -538,6 +538,8 @@
28
 //	png_init_io(png_ptr, PngFile);
29
 	png_set_write_fn(png_ptr, NULL, png_write, flush_data);
30
 
31
+	png_set_compression_level(png_ptr, iGetInt(IL_PNG_COMPRESSION));
32
+
33
 	switch (iCurImage->Type)
34
 	{
35
 		case IL_BYTE:
36
--- src-IL/src/il_states.c	(revision 1677)
37
+++ src-IL/src/il_states.c	(working copy)
38
@@ -70,6 +70,10 @@
39
 	ilStates[ilCurrentPos].ilPngAlphaIndex = -1;
40
 	ilStates[ilCurrentPos].ilVtfCompression = IL_DXT_NO_COMP;
41
 
42
+	// Default PNG compression setting as defined in libpng manual:
43
+	//  http://www.libpng.org/pub/png/libpng-1.2.5-manual.html#section-5.8
44
+	ilStates[ilCurrentPos].ilPngCompression = 6;
45
+
46
 	ilStates[ilCurrentPos].ilTgaId = NULL;
47
 	ilStates[ilCurrentPos].ilTgaAuthName = NULL;
48
 	ilStates[ilCurrentPos].ilTgaAuthComment = NULL;
49
@@ -500,6 +504,9 @@
50
 		case IL_VTF_COMP:
51
 			*Param = ilStates[ilCurrentPos].ilVtfCompression;
52
 			break;
53
+		case IL_PNG_COMPRESSION:
54
+			*Param = ilStates[ilCurrentPos].ilPngCompression;
55
+			break;
56
 
57
 		// Boolean values
58
 		case IL_CONV_PAL:
59
@@ -815,6 +822,7 @@
60
 		ilStates[ilCurrentPos].ilPcdPicNum = ilStates[ilCurrentPos-1].ilPcdPicNum;
61
 
62
 		ilStates[ilCurrentPos].ilPngAlphaIndex = ilStates[ilCurrentPos-1].ilPngAlphaIndex;
63
+		ilStates[ilCurrentPos].ilPngCompression = ilStates[ilCurrentPos-1].ilPngCompression;
64
 
65
 		// Strings
66
 		if (ilStates[ilCurrentPos].ilTgaId)
67
@@ -1159,6 +1167,14 @@
68
 				return;
69
 			}
70
 			break;
71
+		case IL_PNG_COMPRESSION:
72
+			// Valid PNG compression settings as defined in libpng manual:
73
+			//  http://www.libpng.org/pub/png/libpng-1.2.5-manual.html#section-5.8
74
+			if (Param >= 0 && Param <= 9) {
75
+				ilStates[ilCurrentPos].ilPngCompression = Param;
76
+				return;
77
+			}
78
+			break;
79
 
80
 		default:
81
 			ilSetError(IL_INVALID_ENUM);
(-)files/patch-47 (+44 lines)
Line 0 Link Here
1
See https://sourceforge.net/p/openil/patches/47/
2
3
From 5ab2eae2939463aba7fd7bf9a37cc43b9d8cdc43 Mon Sep 17 00:00:00 2001
4
From: Jeff Epler <jepler@unpythonic.net>
5
Date: Thu, 3 Jun 2010 16:38:46 -0500
6
Subject: [PATCH] PR20713: fix out of bounds access in iluGaussian
7
8
the 'rightmost pixel' case in iluBlurGaussian was the same as the
9
'leftmost pixel' case, which makes it refer to pixels that are off the
10
right-hand side of the image by 1 or 2 pixels.  In the final row they
11
are beyond the end of the image, and if the bytes just beyond the end of
12
the image are in an unmapped page, the program can segfault.
13
14
change the 'rightmost' case to use the pixels to the left of the pixel
15
being filtered instead.
16
17
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
18
19
--- src-ILU/src/ilu_filter.c
20
+++ src-ILU/src/ilu_filter.c
21
@@ -378,14 +378,14 @@ ILubyte *Filter(ILimage *Image, const ILint *matrix, ILint scale, ILint bias)
22
 			}
23
 			for (c = 0; c < Image->Bpp; c++) {
24
 				Num =   Image->Data[y - Image->Bps + c] * matrix[0] +
25
-						Image->Data[y - Image->Bps + Image->Bpp + c] * matrix[1]+
26
-						Image->Data[y - Image->Bps + 2 * Image->Bpp + c] * matrix[2]+
27
+						Image->Data[y - Image->Bps - Image->Bpp + c] * matrix[1]+
28
+						Image->Data[y - Image->Bps - 2 * Image->Bpp + c] * matrix[2]+
29
 						Image->Data[y + c] * matrix[3]+
30
-						Image->Data[y + Image->Bpp + c] * matrix[4]+
31
-						Image->Data[y + 2 * Image->Bpp + c] * matrix[5]+
32
+						Image->Data[y - Image->Bpp + c] * matrix[4]+
33
+						Image->Data[y - 2 * Image->Bpp + c] * matrix[5]+
34
 						Image->Data[y + Image->Bps + c] * matrix[6]+
35
-						Image->Data[y + Image->Bps + Image->Bpp + c] * matrix[7]+
36
-						Image->Data[y + Image->Bps + 2 * Image->Bpp + c] * matrix[8];
37
+						Image->Data[y + Image->Bps - Image->Bpp + c] * matrix[7]+
38
+						Image->Data[y + Image->Bps - 2 * Image->Bpp + c] * matrix[8];
39
 
40
 					Temp = (ILuint)fabs((Num / (ILdouble)scale) + bias);
41
 					if (Temp > 255)
42
-- 
43
1.7.1
44
(-)files/patch-49 (+14 lines)
Line 0 Link Here
1
See https://sourceforge.net/p/openil/patches/49/ -- this patch allows
2
DevIL to be configured with ILUT, but without X11:
3
4
--- m4/devil-api_checks.m4	2009-03-08 10:10:05.000000000 +0300
5
+++ m4/devil-api_checks.m4	2012-01-31 17:05:07.163553444 +0400
6
@@ -137,7 +137,7 @@
7
                               [main],
8
                               [dnl The use_x11 var is either "yes" already, or we don't want "no" to be overwritten
9
                                ILUT_LIBS="-lX11 $ILUT_LIBS"],
10
-                              [use_x11="no"]) ])
11
+                              [use_x11="no"]) ], [use_x11="no"])
12
           TEST_API([shm])
13
           AS_IF([test "x$enable_shm" = "xyes"],
14
                 [AC_CHECK_HEADER([X11/extensions/XShm.h],
(-)files/patch-50 (+14 lines)
Line 0 Link Here
1
See https://sourceforge.net/p/openil/patches/50/
2
3
--- src-IL/src/il_targa.c	(revision 1678)
4
+++ src-IL/src/il_targa.c	(working copy)
5
@@ -219,6 +219,9 @@
6
 			ilSetError(IL_ILLEGAL_FILE_VALUE);
7
 			return IL_FALSE;
8
 	}
9
+
10
+	if (bTarga==IL_FALSE)
11
+		return IL_FALSE;
12
 	
13
 	// @JASON Extra Code to manipulate the image depending on
14
 	// the Image Descriptor's origin bits.
(-)files/patch-51 (+52 lines)
Line 0 Link Here
1
See https://sourceforge.net/p/openil/patches/51/
2
3
*** src-ILU/src/ilu_scale2d.c	Wed Oct 28 16:51:50 2009
4
--- src-ILU/src/ilu_scale2d.c	Tue Dec 18 12:11:08 2012
5
***************
6
*** 204,209 ****
7
--- 204,217 ----
8
  	ILfloat	SrcX, SrcY;
9
  	ILuint	iSrcX, iSrcY, iSrcXPlus1, iSrcYPlus1, ulOff, llOff, urOff, lrOff;
10
  
11
+ 	// only downscale is allowed
12
+ 	assert(ScaleX>0 && ScaleX<=1.0f);
13
+ 	assert(ScaleY>0 && ScaleY<=1.0f);
14
+ 
15
+ 	// scale factors should match images size
16
+ 	assert( ((ILfloat)Width -0.5f) / ScaleX < Image->Width );
17
+ 	assert( ((ILfloat)Height-0.5f) / ScaleY < Image->Height );
18
+ 
19
  	ImgBps = Image->Bps / Image->Bpc;
20
  	SclBps = Scaled->Bps / Scaled->Bpc;
21
  
22
***************
23
*** 213,226 ****
24
  			for (y = 0; y < Height; y++) {
25
  				for (x = 0; x < Width; x++) {
26
  					// Calculate where we want to choose pixels from in our source image.
27
! 					SrcX = (ILfloat)x / (ILfloat)ScaleX;
28
! 					SrcY = (ILfloat)y / (ILfloat)ScaleY;
29
! 					// Integer part of SrcX and SrcY
30
! 					iSrcX = (ILuint)floor(SrcX);
31
! 					iSrcY = (ILuint)floor(SrcY);
32
! 					// Fractional part of SrcX and SrcY
33
! 					FracX = SrcX - (ILfloat)(iSrcX);
34
! 					FracY = SrcY - (ILfloat)(iSrcY);
35
  
36
  					// We do not want to go past the right edge of the image or past the last line in the image,
37
  					//  so this takes care of that.  Normally, iSrcXPlus1 is iSrcX + 1, but if this is past the
38
--- 221,234 ----
39
  			for (y = 0; y < Height; y++) {
40
  				for (x = 0; x < Width; x++) {
41
  					// Calculate where we want to choose pixels from in our source image.
42
! 					SrcX = (ILfloat)(x+0.5f) / (ILfloat)ScaleX;
43
! 					SrcY = (ILfloat)(y+0.5f) / (ILfloat)ScaleY;
44
! 					// indices of upper-left pixel
45
! 					iSrcX = (ILuint)(SrcX-0.5f);
46
! 					iSrcY = (ILuint)(SrcY-0.5f);
47
! 					// how far SrcX and SrcY are from upper-left pixel center
48
! 					FracX = SrcX - (ILfloat)(iSrcX) - 0.5f;
49
! 					FracY = SrcY - (ILfloat)(iSrcY) - 0.5f;
50
  
51
  					// We do not want to go past the right edge of the image or past the last line in the image,
52
  					//  so this takes care of that.  Normally, iSrcXPlus1 is iSrcX + 1, but if this is past the
(-)files/patch-52 (+47 lines)
Line 0 Link Here
1
See https://sourceforge.net/p/openil/patches/52/
2
3
--- src-IL/src/il_pcx.c	(revision 1678)
4
+++ src-IL/src/il_pcx.c	(working copy)
5
@@ -375,20 +375,26 @@
6
 	if (Header->NumPlanes == 1 && Header->Bpp == 1) {
7
 		for (j = 0; j < iCurImage->Height; j++) {
8
 			i = 0; //number of written pixels
9
-			while (i < iCurImage->Width) {
10
+			Bps = 0;
11
+			while (Bps<Header->Bps) {
12
 				if (iread(&HeadByte, 1, 1) != 1)
13
 					return IL_FALSE;
14
+				++Bps;
15
+				// Check if we got duplicates with RLE compression
16
 				if (HeadByte >= 192) {
17
 					HeadByte -= 192;
18
 					if (iread(&Data, 1, 1) != 1)
19
 						return IL_FALSE;
20
 
21
+					--Bps;
22
+					// duplicate next byte
23
 					for (c = 0; c < HeadByte; c++) {
24
 						k = 128;
25
 						for (d = 0; d < 8 && i < iCurImage->Width; d++) {
26
 							iCurImage->Data[j * iCurImage->Width + i++] = ((Data & k) != 0 ? 255 : 0);
27
 							k >>= 1;
28
 						}
29
+						++Bps;
30
 					}
31
 				}
32
 				else {
33
@@ -408,8 +414,12 @@
34
 			//If Width/8 is even no padding is needed,
35
 			//one pad byte has to be read otherwise.
36
 			//(let's hope the above is true ;-))
37
-			if(!((iCurImage->Width >> 3) & 0x1))
38
-				igetc();	// Skip pad byte
39
+
40
+			// changed 2012-05-06
41
+			// Not the good size - don't need it, padding inside data already !
42
+
43
+		//	if(!((iCurImage->Width >> 3) & 0x1))
44
+		//		igetc();	// Skip pad byte
45
 		}
46
 	}
47
 	else if (Header->NumPlanes == 4 && Header->Bpp == 1){   // 4-bit images
(-)files/patch-clang (+367 lines)
Line 0 Link Here
1
Submitted upstream as:
2
3
	https://sourceforge.net/p/openil/bugs/212/
4
5
--- src-IL/include/il_internal.h	2009-03-08 03:10:08.000000000 -0400
6
+++ src-IL/include/il_internal.h	2014-12-20 01:11:39.000000000 -0500
7
@@ -228,5 +228,5 @@
8
 ILboolean ilLoadBlpF(ILHANDLE File);
9
 ILboolean ilLoadBlpL(const void *Lump, ILuint Size);
10
-ILboolean ilIsValidBmp(ILconst_string CONST_RESTRICT FileName);
11
+ILboolean ilIsValidBmp(ILconst_string FileName);
12
 ILboolean ilIsValidBmpF(ILHANDLE File);
13
 ILboolean ilIsValidBmpL(const void *Lump, ILuint Size);
14
--- src-IL/src/il_exr.cpp	2009-03-08 03:10:09.000000000 -0400
15
+++ src-IL/src/il_exr.cpp	2014-12-20 01:15:55.000000000 -0500
16
@@ -11,5 +11,5 @@
17
 //-----------------------------------------------------------------------------
18
 
19
-
20
+#include <machine/endian.h>
21
 #include "il_internal.h"
22
 #ifndef IL_NO_EXR
23
@@ -246,5 +246,5 @@
24
 		in.readPixels (dataWindow.min.y, dataWindow.max.y);
25
     }
26
-    catch (const exception &e)
27
+    catch (const exception)
28
     {
29
 	// If some of the pixels in the file cannot be read,
30
@@ -252,5 +252,4 @@
31
 	// to the caller.
32
 		ilSetError(IL_LIB_EXR_ERROR);  // Could I use something a bit more descriptive based on e?
33
-		e;  // Prevent the compiler from yelling at us about this being unused.
34
 		return IL_FALSE;
35
     }
36
--- src-IL/include/il_endian.h	2009-03-08 03:10:08.000000000 -0400
37
+++ src-IL/include/il_endian.h	2014-12-20 01:28:47.000000000 -0500
38
@@ -15,14 +15,7 @@
39
 
40
 #include "il_internal.h"
41
+#include <machine/endian.h>
42
 
43
-#ifdef WORDS_BIGENDIAN  // This is defined by ./configure.
44
-	#ifndef __BIG_ENDIAN__
45
-	#define __BIG_ENDIAN__ 1
46
-	#endif
47
-#endif
48
-
49
-#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __BIG_ENDIAN__) \
50
-  || (defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__))
51
- 	#undef __LITTLE_ENDIAN__
52
+#if BYTE_ORDER == BIG_ENDIAN
53
 	#define Short(s) iSwapShort(s)
54
 	#define UShort(s) iSwapUShort(s)
55
@@ -39,7 +32,4 @@
56
 	#define BigDouble(d)  
57
 #else
58
-	#undef __BIG_ENDIAN__
59
-	#undef __LITTLE_ENDIAN__  // Not sure if it's defined by any compiler...
60
-	#define __LITTLE_ENDIAN__
61
 	#define Short(s)  
62
 	#define UShort(s)  
63
@@ -168,5 +158,5 @@
64
 	ILushort s;
65
 	iread(&s, sizeof(ILushort), 1);
66
-#ifdef __BIG_ENDIAN__
67
+#if BYTE_ORDER == BIG_ENDIAN
68
 	iSwapUShort(&s);
69
 #endif
70
@@ -177,5 +167,5 @@
71
 	ILshort s;
72
 	iread(&s, sizeof(ILshort), 1);
73
-#ifdef __BIG_ENDIAN__
74
+#if BYTE_ORDER == BIG_ENDIAN
75
 	iSwapShort(&s);
76
 #endif
77
@@ -186,5 +176,5 @@
78
 	ILuint i;
79
 	iread(&i, sizeof(ILuint), 1);
80
-#ifdef __BIG_ENDIAN__
81
+#if BYTE_ORDER == BIG_ENDIAN
82
 	iSwapUInt(&i);
83
 #endif
84
@@ -195,5 +185,5 @@
85
 	ILint i;
86
 	iread(&i, sizeof(ILint), 1);
87
-#ifdef __BIG_ENDIAN__
88
+#if BYTE_ORDER == BIG_ENDIAN
89
 	iSwapInt(&i);
90
 #endif
91
@@ -204,5 +194,5 @@
92
 	ILfloat f;
93
 	iread(&f, sizeof(ILfloat), 1);
94
-#ifdef __BIG_ENDIAN__
95
+#if BYTE_ORDER == BIG_ENDIAN
96
 	iSwapFloat(&f);
97
 #endif
98
@@ -213,5 +203,5 @@
99
 	ILdouble d;
100
 	iread(&d, sizeof(ILdouble), 1);
101
-#ifdef __BIG_ENDIAN__
102
+#if BYTE_ORDER == BIG_ENDIAN
103
 	iSwapDouble(&d);
104
 #endif
105
@@ -223,5 +213,5 @@
106
 	ILushort s;
107
 	iread(&s, sizeof(ILushort), 1);
108
-#ifdef __LITTLE_ENDIAN__
109
+#if BYTE_ORDER == LITTLE_ENDIAN
110
 	iSwapUShort(&s);
111
 #endif
112
@@ -233,5 +223,5 @@
113
 	ILshort s;
114
 	iread(&s, sizeof(ILshort), 1);
115
-#ifdef __LITTLE_ENDIAN__
116
+#if BYTE_ORDER == LITTLE_ENDIAN
117
 	iSwapShort(&s);
118
 #endif
119
@@ -243,5 +233,5 @@
120
 	ILuint i;
121
 	iread(&i, sizeof(ILuint), 1);
122
-#ifdef __LITTLE_ENDIAN__
123
+#if BYTE_ORDER == LITTLE_ENDIAN
124
 	iSwapUInt(&i);
125
 #endif
126
@@ -253,5 +243,5 @@
127
 	ILint i;
128
 	iread(&i, sizeof(ILint), 1);
129
-#ifdef __LITTLE_ENDIAN__
130
+#if BYTE_ORDER == LITTLE_ENDIAN
131
 	iSwapInt(&i);
132
 #endif
133
@@ -263,5 +253,5 @@
134
 	ILfloat f;
135
 	iread(&f, sizeof(ILfloat), 1);
136
-#ifdef __LITTLE_ENDIAN__
137
+#if BYTE_ORDER == LITTLE_ENDIAN
138
 	iSwapFloat(&f);
139
 #endif
140
@@ -273,5 +263,5 @@
141
 	ILdouble d;
142
 	iread(&d, sizeof(ILdouble), 1);
143
-#ifdef __LITTLE_ENDIAN__
144
+#if BYTE_ORDER == LITTLE_ENDIAN
145
 	iSwapDouble(&d);
146
 #endif
147
@@ -280,5 +270,5 @@
148
 
149
 INLINE ILubyte SaveLittleUShort(ILushort s) {
150
-#ifdef __BIG_ENDIAN__
151
+#if BYTE_ORDER == BIG_ENDIAN
152
 	iSwapUShort(&s);
153
 #endif
154
@@ -287,5 +277,5 @@
155
 
156
 INLINE ILubyte SaveLittleShort(ILshort s) {
157
-#ifdef __BIG_ENDIAN__
158
+#if BYTE_ORDER == BIG_ENDIAN
159
 	iSwapShort(&s);
160
 #endif
161
@@ -295,5 +285,5 @@
162
 
163
 INLINE ILubyte SaveLittleUInt(ILuint i) {
164
-#ifdef __BIG_ENDIAN__
165
+#if BYTE_ORDER == BIG_ENDIAN
166
 	iSwapUInt(&i);
167
 #endif
168
@@ -303,5 +293,5 @@
169
 
170
 INLINE ILubyte SaveLittleInt(ILint i) {
171
-#ifdef __BIG_ENDIAN__
172
+#if BYTE_ORDER == BIG_ENDIAN
173
 	iSwapInt(&i);
174
 #endif
175
@@ -310,5 +300,5 @@
176
 
177
 INLINE ILubyte SaveLittleFloat(ILfloat f) {
178
-#ifdef __BIG_ENDIAN__
179
+#if BYTE_ORDER == BIG_ENDIAN
180
 	iSwapFloat(&f);
181
 #endif
182
@@ -318,5 +308,5 @@
183
 
184
 INLINE ILubyte SaveLittleDouble(ILdouble d) {
185
-#ifdef __BIG_ENDIAN__
186
+#if BYTE_ORDER == BIG_ENDIAN
187
 	iSwapDouble(&d);
188
 #endif
189
@@ -326,5 +316,5 @@
190
 
191
 INLINE ILubyte SaveBigUShort(ILushort s) {
192
-#ifdef __LITTLE_ENDIAN__
193
+#if BYTE_ORDER == LITTLE_ENDIAN
194
 	iSwapUShort(&s);
195
 #endif
196
@@ -334,5 +324,5 @@
197
 
198
 INLINE ILubyte SaveBigShort(ILshort s) {
199
-#ifdef __LITTLE_ENDIAN__
200
+#if BYTE_ORDER == LITTLE_ENDIAN
201
 	iSwapShort(&s);
202
 #endif
203
@@ -342,5 +332,5 @@
204
 
205
 INLINE ILubyte SaveBigUInt(ILuint i) {
206
-#ifdef __LITTLE_ENDIAN__
207
+#if BYTE_ORDER == LITTLE_ENDIAN
208
 	iSwapUInt(&i);
209
 #endif
210
@@ -350,5 +340,5 @@
211
 
212
 INLINE ILubyte SaveBigInt(ILint i) {
213
-#ifdef __LITTLE_ENDIAN__
214
+#if BYTE_ORDER == LITTLE_ENDIAN
215
 	iSwapInt(&i);
216
 #endif
217
@@ -358,5 +348,5 @@
218
 
219
 INLINE ILubyte SaveBigFloat(ILfloat f) {
220
-#ifdef __LITTLE_ENDIAN__
221
+#if BYTE_ORDER == LITTLE_ENDIAN
222
 	iSwapFloat(&f);
223
 #endif
224
@@ -366,5 +356,5 @@
225
 
226
 INLINE ILubyte SaveBigDouble(ILdouble d) {
227
-#ifdef __LITTLE_ENDIAN__
228
+#if BYTE_ORDER == LITTLE_ENDIAN
229
 	iSwapDouble(&d);
230
 #endif
231
--- ./src-IL/src/il_convert.c	2009-03-08 03:10:09.000000000 -0400
232
+++ ./src-IL/src/il_convert.c	2014-12-20 01:36:37.000000000 -0500
233
@@ -1018,5 +1018,5 @@
234
 	}
235
 /*	Swap Colors on Big Endian !!!!!
236
-#ifdef __BIG_ENDIAN__
237
+#if BYTE_ORDER == BIG_ENDIAN
238
 	// Swap endian
239
 	EndianSwapData(iCurImage);
240
--- ./src-IL/src/il_dicom.c	2009-03-08 03:10:09.000000000 -0400
241
+++ ./src-IL/src/il_dicom.c	2014-12-20 01:36:37.000000000 -0500
242
@@ -536,5 +536,5 @@
243
 
244
 	// We may have to swap the order of the data.
245
-#ifdef __BIG_ENDIAN__
246
+#if BYTE_ORDER == BIG_ENDIAN
247
 			if (!Header.BigEndian) {
248
 				if (Header.Format == IL_RGB)
249
--- ./src-IL/src/il_icon.c	2014-12-20 01:00:18.000000000 -0500
250
+++ ./src-IL/src/il_icon.c	2014-12-20 01:36:37.000000000 -0500
251
@@ -555,5 +555,5 @@
252
 
253
 	//fix endianess
254
-#ifdef __LITTLE_ENDIAN__
255
+#if BYTE_ORDER == LITTLE_ENDIAN
256
 	if (bit_depth == 16)
257
 		png_set_swap(ico_png_ptr);
258
--- ./src-IL/src/il_png.c	2014-12-20 01:00:18.000000000 -0500
259
+++ ./src-IL/src/il_png.c	2014-12-20 01:36:37.000000000 -0500
260
@@ -308,5 +308,5 @@
261
 
262
 	//fix endianess
263
-#ifdef __LITTLE_ENDIAN__
264
+#if BYTE_ORDER == LITTLE_ENDIAN
265
 	if (bit_depth == 16)
266
 		png_set_swap(png_ptr);
267
--- ./src-IL/src/il_psd.c	2009-03-08 03:10:09.000000000 -0400
268
+++ ./src-IL/src/il_psd.c	2014-12-20 01:36:37.000000000 -0500
269
@@ -542,5 +542,5 @@
270
 		return NULL;
271
 	}
272
-#ifdef __LITTLE_ENDIAN__
273
+#if BYTE_ORDER == LITTLE_ENDIAN
274
 	for (i = 0; i < Head->Height * ChannelNum; i++) {
275
 		iSwapUShort(&RleTable[i]);
276
--- ./src-IL/src/il_tiff.c	2009-03-08 03:10:09.000000000 -0400
277
+++ ./src-IL/src/il_tiff.c	2014-12-20 01:36:37.000000000 -0500
278
@@ -611,5 +611,5 @@
279
 			Image->Origin = IL_ORIGIN_LOWER_LEFT;  // eiu...dunno if this is right
280
 
281
-#ifdef __BIG_ENDIAN__ //TIFFReadRGBAImage reads abgr on big endian, convert to rgba
282
+#if BYTE_ORDER == BIG_ENDIAN //TIFFReadRGBAImage reads abgr on big endian, convert to rgba
283
 			EndianSwapData(Image);
284
 #endif
285
@@ -636,5 +636,5 @@
286
 				case 3:
287
 					//TODO: why the ifdef??
288
-#ifdef __LITTLE_ENDIAN__
289
+#if BYTE_ORDER == LITTLE_ENDIAN
290
 					ilConvertImage(IL_RGB, IL_UNSIGNED_BYTE);
291
 #endif			
292
@@ -647,5 +647,5 @@
293
 					/*			
294
 					//invert alpha
295
-#ifdef __LITTLE_ENDIAN__
296
+#if BYTE_ORDER == LITTLE_ENDIAN
297
 					pImageData += 3;
298
 #endif			
299
--- ./src-ILUT/src/ilut_sdlsurface.c	2009-03-08 03:10:11.000000000 -0400
300
+++ ./src-ILUT/src/ilut_sdlsurface.c	2014-12-20 01:36:37.000000000 -0500
301
@@ -28,5 +28,5 @@
302
 {
303
 //#if SDL_BYTEORDER == SDL_BIG_ENDIAN
304
-#ifdef __BIG_ENDIAN__
305
+#if BYTE_ORDER == BIG_ENDIAN
306
 	isBigEndian = 1;
307
     rmask = 0xFF000000;
308
@@ -81,5 +81,5 @@
309
 	}
310
 	else if (Image->Format != IL_COLOR_INDEX) {  // We have to convert the image.
311
-		#ifdef __BIG_ENDIAN__
312
+		#if BYTE_ORDER == BIG_ENDIAN
313
 		Image = iConvertImage(Image, IL_RGBA, IL_UNSIGNED_BYTE);
314
 		#else
315
--- src-IL/src/il_ilbm.c	2009-03-08 04:30:11.000000000 -0400
316
+++ src-IL/src/il_ilbm.c	2014-12-20 01:38:51.000000000 -0500
317
@@ -620,5 +620,5 @@
318
                             finalcolor = pixelcolor;
319
                         }
320
-#if defined( __LITTLE_ENDIAN__ )
321
+#if BYTE_ORDER == LITTLE_ENDIAN
322
                         {
323
                             *ptr++ = (Uint8)(finalcolor>>16);
324
--- src-IL/src/il_sgi.c	2009-03-08 03:10:09.000000000 -0400
325
+++ src-IL/src/il_sgi.c	2014-12-20 01:40:37.000000000 -0500
326
@@ -213,5 +213,5 @@
327
 ILboolean iReadRleSgi(iSgiHeader *Head)
328
 {
329
-	#ifdef __LITTLE_ENDIAN__
330
+	#if BYTE_ORDER == LITTLE_ENDIAN
331
 	ILuint ixTable;
332
 	#endif
333
@@ -234,5 +234,5 @@
334
 		goto cleanup_error;
335
 
336
-#ifdef __LITTLE_ENDIAN__
337
+#if BYTE_ORDER == LITTLE_ENDIAN
338
 	// Fix the offset/len table (it's big endian format)
339
 	for (ixTable = 0; ixTable < TableSize; ixTable++) {
340
@@ -290,5 +290,5 @@
341
 	}
342
 
343
-	#ifdef __LITTLE_ENDIAN__
344
+	#if BYTE_ORDER == LITTLE_ENDIAN
345
 	if (Head->Bpc == 2)
346
 		sgiSwitchData(iCurImage->Data, iCurImage->SizeOfData);
347
@@ -331,5 +331,5 @@
348
 			return -1;
349
 		
350
-#ifndef __LITTLE_ENDIAN__
351
+#if BYTE_ORDER != LITTLE_ENDIAN
352
 		iSwapUShort(&Pixel);
353
 #endif
354
@@ -347,5 +347,5 @@
355
 			if (iread(&Pixel, Head->Bpc, 1) != 1)
356
 				return -1;
357
-#ifndef __LITTLE_ENDIAN__
358
+#if BYTE_ORDER != LITTLE_ENDIAN
359
 			iSwapUShort(&Pixel);
360
 #endif
361
@@ -742,5 +742,5 @@
362
 		StartTable[y] = DataOff;
363
 		DataOff += LenTable[y];
364
-#ifdef __LITTLE_ENDIAN__
365
+#if BYTE_ORDER == LITTLE_ENDIAN
366
 		iSwapUInt(&StartTable[y]);
367
  		iSwapUInt(&LenTable[y]);
(-)files/patch-testing (+28 lines)
Line 0 Link Here
1
Submitted upstream as https://sourceforge.net/p/openil/patches/53/
2
3
Fix to allow running with regular shell. Actually, even bash was erroring
4
out for some reason...
5
--- test/format_test/format_checks.sh.in	2009-03-08 03:10:07.000000000 -0400
6
+++ test/format_test/format_checks.sh.in	2016-01-10 23:37:45.922896000 -0500
7
@@ -27,8 +27,17 @@
8
 do
9
 	#echo expr match "' $CAN_SAVE '" '.*\s'$EXTENSION'\s.*'
10
-	if [ $(expr match "' $CAN_SAVE '" '.*\s'$EXTENSION'\s.*') -eq 0 -o $(expr match "' $PROBLEMATIC '" '.*\s'$EXTENSION'\s.*') -ne 0 ] 
11
-	then # This extension is not considered as supported...
12
-		continue;
13
-	fi
14
+	case $CAN_SAVE in
15
+	*$EXTENSION*)
16
+		;;
17
+	*)
18
+		# This extension is not considered as supported...
19
+		continue
20
+		;;
21
+	esac
22
+	case $PROBLEMATIC in
23
+	*$EXTENSION*)
24
+		continue
25
+		;;
26
+	esac	
27
 	test -n	"$VERBOSE" && echo $WINE ./testil@EXEEXT@ -e $EXTENSION
28
 	# EXEEXT comes in when one compiles on platforms that append extensions to executables (testil.exe)
(-)pkg-plist (-6 / +6 lines)
Lines 3-9 Link Here
3
include/IL/il.h
3
include/IL/il.h
4
include/IL/ilu.h
4
include/IL/ilu.h
5
include/IL/ilu_region.h
5
include/IL/ilu_region.h
6
%%X11%%include/IL/ilut.h
6
include/IL/ilut.h
7
lib/libIL.a
7
lib/libIL.a
8
lib/libIL.so
8
lib/libIL.so
9
lib/libIL.so.1
9
lib/libIL.so.1
Lines 12-21 Link Here
12
lib/libILU.so
12
lib/libILU.so
13
lib/libILU.so.1
13
lib/libILU.so.1
14
lib/libILU.so.1.1.0
14
lib/libILU.so.1.1.0
15
%%X11%%lib/libILUT.a
15
lib/libILUT.a
16
%%X11%%lib/libILUT.so
16
lib/libILUT.so
17
%%X11%%lib/libILUT.so.1
17
lib/libILUT.so.1
18
%%X11%%lib/libILUT.so.1.1.0
18
lib/libILUT.so.1.1.0
19
libdata/pkgconfig/IL.pc
19
libdata/pkgconfig/IL.pc
20
libdata/pkgconfig/ILU.pc
20
libdata/pkgconfig/ILU.pc
21
%%X11%%libdata/pkgconfig/ILUT.pc
21
libdata/pkgconfig/ILUT.pc

Return to bug 196161