summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenton Woods <denton.woods@gmail.com>2017-01-01 02:12:23 -0600
committerDenton Woods <denton.woods@gmail.com>2017-01-01 02:12:23 -0600
commit1e02ea233463d447f56a31982e132a76c1141651 (patch)
tree26251eae3a89a895a1350751db649eb6af57a1b8
parentf9d385e4cabe77764149f229c7fa68f6831121ad (diff)
downloaddevil-1e02ea233463d447f56a31982e132a76c1141651.tar.gz
- Added ilTexImageSurface from https://github.com/gscept/DevIL/commit/122565d1434a95c92c3a5c60679e231e0a0c9a91
-rw-r--r--DevIL/TODO14
-rw-r--r--DevIL/include/IL/devil_internal_exports.h1
-rw-r--r--DevIL/src-IL/msvc/il.def1
-rw-r--r--DevIL/src-IL/src/il_dds.cpp10
-rw-r--r--DevIL/src-IL/src/il_devil.cpp75
-rw-r--r--DevIL/src-IL/src/il_hdr.cpp4
6 files changed, 91 insertions, 14 deletions
diff --git a/DevIL/TODO b/DevIL/TODO
index 476ce5ec..f830e6c6 100644
--- a/DevIL/TODO
+++ b/DevIL/TODO
@@ -11,6 +11,7 @@ Bugs:
By next release:
+- https://www.cvedetails.com/vulnerability-list/vendor_id-8981/product_id-15876/version_id-67926/Devil-Developers-Image-Library-1.7.4.html
- NVTT.dll as a delay-loaded DLL.
- Update docs with next DXT code, new mipmap/cubemap access, new SaveL code.
- Update DevIL website with file formats (psd-saving, etc.).
@@ -167,6 +168,8 @@ More involved:
Lots of work:
+- Go through forks on GitHub to see what needs to be included in the main release
+- Thread safe version: look at https://github.com/gscept/DevIL/commit/a8bbbb934344237c362a15164b536f97f54d2cd8
- Linux Unicode support is partially broken.
- Write own .exr routines.
- Native WDP support
@@ -175,7 +178,6 @@ Lots of work:
- Give estimates for buffer sizes for ilSaveL.
- MNG saving
- Metadata
-- Thread safe version
- Add flag for determining whether DDS data is outdated.
- TIFF saving to file streams and lumps
- Use fseek/ftell 64-bit?
@@ -183,7 +185,7 @@ Lots of work:
- Possibly make palettes always 768 (or 1024) bytes so that it is not possible to access outside by bad data?
- Add padding options, so that each line could be DWORD-padded, for instance.
- Add dithering.
-- Work on making DevIL more stable. There's probably a few places where I don't check the return value of ilNewImage, for instance.
+- Work on making DevIL more stable. There's probably a few places where I don't check the return value of ilNewImage, for instance.
- Add support for callbacks so that users can create progress meters for loading and saving in their applications. We could extend this idea further and allow cancellation of loading/saving images.
- global use of restricted pointers where available (for now only il_bmp.{c,h} uses it)
- iluScaleColours is BUGGED, doesn't handle the image with the correct type! more Bpc (except luminance and paletted one)
@@ -197,9 +199,9 @@ Lots of work:
- Finish support for regions in ILU.
- Add support for regions in IL. This could be used to save only a specific portion of an image.
- Add support for user-defined filters (possibly of a user-defined size).
-- Add more filters. Some sites to look at are http://www.jasonwaltman.com/thesis/introduction.html http://www.dai.ed.ac.uk/CVonline/transf.htm http://www.fortunecity.com/lavendar/kane/39/ffpg.htm and http://www.opengl.org/developers/documentation/Version1.2/1.2specs/convolution_border_modes.txt . The last link describes ways to handle borders for the convolution filters. It might be worthwhile to allow these kinds of options.
+- Add more filters. Some sites to look at are http://www.jasonwaltman.com/thesis/introduction.html http://www.dai.ed.ac.uk/CVonline/transf.htm http://www.fortunecity.com/lavendar/kane/39/ffpg.htm and http://www.opengl.org/developers/documentation/Version1.2/1.2specs/convolution_border_modes.txt . The last link describes ways to handle borders for the convolution filters. It might be worthwhile to allow these kinds of options.
- Possibly add support for other colour spaces besides RGB (CMYK, YUV, etc.)
-- Implement a scripting "language" with LUA for ILU. This way, people can generate scripts to run a certain set of filters on all images.
+- Implement a scripting "language" with LUA for ILU. This way, people can generate scripts to run a certain set of filters on all images.
- Look at other rescaling algorithms:
http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0guide/Geom-image-manip.doc.html
http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0guide/Geom-image-manip.doc.html#55431
@@ -207,7 +209,7 @@ http://www.npac.syr.edu/projects/nasa/MILOJE/final/node36.html
http://www.ultranet.com/~aramini/design.html
- ilKeyColor ilAddKey...
- Find a way to make the filters (especially the convolution filters) work in three dimensions.
-- Make better versions of the DevIL ports of the NeHe tutorials. Several of the tutorials don't call ilInit, for instance.
+- Make better versions of the DevIL ports of the NeHe tutorials. Several of the tutorials don't call ilInit, for instance.
- Change parameters of iread to use ILsizei.
- Make sure all bugs in bug tracker are squashed.
@@ -217,7 +219,7 @@ Questions:
- Possibly readd VC6 projects?
- Add BeOS support back in?
- Create Dev-C++/MingW/Cygwin .a files for releases?
-- Does ilIsValidTga generate an unncessary IL_INVALID_EXTENSION error?
+- Does ilIsValidTga generate an unnecessary IL_INVALID_EXTENSION error?
- Why is IL_HALF even used in ilut_directx9.c?
- Fix problems loading .dds files on Big Endian machines (still a problem or not?)
- Should we be calculating DXT endpoints before converting data to 565 format?
diff --git a/DevIL/include/IL/devil_internal_exports.h b/DevIL/include/IL/devil_internal_exports.h
index 655082df..fd07d062 100644
--- a/DevIL/include/IL/devil_internal_exports.h
+++ b/DevIL/include/IL/devil_internal_exports.h
@@ -136,6 +136,7 @@ ILAPI ILimage* ILAPIENTRY ilNewImageFull (ILuint Width, ILuint Height, ILuint
ILAPI ILboolean ILAPIENTRY ilInitImage (ILimage *Image, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, void *Data);
ILAPI ILboolean ILAPIENTRY ilResizeImage (ILimage *Image, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILubyte Bpc);
ILAPI ILboolean ILAPIENTRY ilTexImage_ (ILimage *Image, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, void *Data);
+ILAPI ILboolean ILAPIENTRY ilTexImageSurface_(ILimage *Image, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, void *Data);
ILAPI ILboolean ILAPIENTRY ilTexSubImage_ (ILimage *Image, void *Data);
ILAPI void* ILAPIENTRY ilConvertBuffer (ILuint SizeOfData, ILenum SrcFormat, ILenum DestFormat, ILenum SrcType, ILenum DestType, ILpal *SrcPal, void *Buffer);
ILAPI ILimage* ILAPIENTRY iConvertImage (ILimage *Image, ILenum DestFormat, ILenum DestType);
diff --git a/DevIL/src-IL/msvc/il.def b/DevIL/src-IL/msvc/il.def
index c9391184..50b3350a 100644
--- a/DevIL/src-IL/msvc/il.def
+++ b/DevIL/src-IL/msvc/il.def
@@ -112,6 +112,7 @@ ilShutDown
ilSurfaceToDxtcData
ilTexImage
ilTexImageDxtc
+ilTexImageSurface
ilTypeFromExt
ilTypeFunc
ilLoadData
diff --git a/DevIL/src-IL/src/il_dds.cpp b/DevIL/src-IL/src/il_dds.cpp
index 4ffe8517..580faed1 100644
--- a/DevIL/src-IL/src/il_dds.cpp
+++ b/DevIL/src-IL/src/il_dds.cpp
@@ -2028,7 +2028,7 @@ ILAPI ILboolean ILAPIENTRY ilDxtcDataToImage()
ILAPI ILboolean ILAPIENTRY ilSurfaceToDxtcData(ILenum Format)
{
ILuint Size;
- void* Data;
+ ILubyte* Data;
ilFreeSurfaceDxtcData();
Size = ilGetDXTCData(NULL, 0, Format);
@@ -2036,15 +2036,15 @@ ILAPI ILboolean ILAPIENTRY ilSurfaceToDxtcData(ILenum Format)
return IL_FALSE;
}
- Data = ialloc(Size);
+ Data = (ILubyte*)ialloc(Size);
if (Data == NULL)
return IL_FALSE;
- ilGetDXTCData(Data, Size, Format);
+ ilGetDXTCData((void*)Data, Size, Format);
//These have to be after the call to ilGetDXTCData()
- iCurImage->DxtcData = (ILubyte*)Data;
+ iCurImage->DxtcData = Data;
iCurImage->DxtcFormat = Format;
iCurImage->DxtcSize = Size;
@@ -2139,7 +2139,7 @@ ILAPI ILboolean ILAPIENTRY ilTexImageDxtc(ILint w, ILint h, ILint d, ILenum DxtF
DataSize = yBlocks * LineSize * d;
Image->DxtcFormat = DxtFormat;
- Image->DxtcSize = DataSize;
+ Image->DxtcSize = DataSize;
Image->DxtcData = (ILubyte*)ialloc(DataSize);
if (Image->DxtcData == NULL) {
diff --git a/DevIL/src-IL/src/il_devil.cpp b/DevIL/src-IL/src/il_devil.cpp
index bfd6be00..c9eeb5d5 100644
--- a/DevIL/src-IL/src/il_devil.cpp
+++ b/DevIL/src-IL/src/il_devil.cpp
@@ -166,6 +166,81 @@ ILAPI ILboolean ILAPIENTRY ilTexImage_(ILimage *Image, ILuint Width, ILuint Heig
}
+//! Changes the current bound image to use these new dimensions (current data is destroyed, but mips, faces, layers and arrays are retained).
+/*! \param Width Specifies the new image width. This cannot be 0.
+\param Height Specifies the new image height. This cannot be 0.
+\param Depth Specifies the new image depth. This cannot be 0.
+\param NumChannels Number of channels (ex. 3 for RGB)
+\param Format Enum of the desired format. Any format values are accepted.
+\param Type Enum of the desired type. Any type values are accepted.
+\param Data Specifies data that should be copied to the new image. If this parameter is NULL, no data is copied, and the new image data consists of undefined values.
+\exception IL_ILLEGAL_OPERATION No currently bound image.
+\exception IL_INVALID_PARAM One of the parameters is incorrect, such as one of the dimensions being 0.
+\exception IL_OUT_OF_MEMORY Could not allocate enough memory.
+\return Boolean value of failure or success*/
+ILboolean ILAPIENTRY ilTexImageSurface(ILuint Width, ILuint Height, ILuint Depth, ILubyte NumChannels, ILenum Format, ILenum Type, void *Data)
+{
+ return ilTexImageSurface_(iCurImage, Width, Height, Depth, NumChannels, Format, Type, Data);
+}
+
+
+// Internal version of ilTexImageSurface.
+ILboolean ILAPIENTRY ilTexImageSurface_(ILimage *Image, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, void *Data)
+{
+ ILimage* mips;
+ ILimage* next;
+ ILimage* faces;
+ ILimage* layers;
+ ILenum flags;
+ ILenum origin;
+ ILboolean retval;
+
+ if (Image == NULL) {
+ ilSetError(IL_ILLEGAL_OPERATION);
+ return IL_FALSE;
+ }
+
+ ////
+
+ // Not sure if we should be getting rid of the palette...
+ if (Image->Pal.Palette && Image->Pal.PalSize && Image->Pal.PalType != IL_PAL_NONE) {
+ ifree(Image->Pal.Palette);
+ }
+
+ if (Image->AnimList) ifree(Image->AnimList);
+ if (Image->Profile) ifree(Image->Profile);
+ if (Image->DxtcData) ifree(Image->DxtcData);
+ if (Image->Data) ifree(Image->Data);
+
+ ////
+
+ //@TODO: Also check against format?
+ /*if (Width == 0 || Height == 0 || Depth == 0 || Bpp == 0) {
+ ilSetError(IL_INVALID_PARAM);
+ return IL_FALSE;
+ }*/
+
+ mips = Image->Mipmaps;
+ next = Image->Next;
+ faces = Image->Faces;
+ layers = Image->Layers;
+ flags = Image->CubeFlags;
+ origin = Image->Origin;
+
+ retval = ilInitImage(Image, Width, Height, Depth, Bpp, Format, Type, Data);
+
+ // reset our chains
+ Image->Mipmaps = mips;
+ Image->Next = next;
+ Image->Faces = faces;
+ Image->Layers = layers;
+ Image->CubeFlags = flags;
+ Image->Origin = origin;
+
+ return retval;
+}
+
+
//! Uploads Data of the same size to replace the current image's data.
/*! \param Data New image data to update the currently bound image
\exception IL_ILLEGAL_OPERATION No currently bound image
diff --git a/DevIL/src-IL/src/il_hdr.cpp b/DevIL/src-IL/src/il_hdr.cpp
index fd2400fb..e5b47a26 100644
--- a/DevIL/src-IL/src/il_hdr.cpp
+++ b/DevIL/src-IL/src/il_hdr.cpp
@@ -98,10 +98,8 @@ ILboolean iGetHdrHead(HDRHEADER *Header)
if (iread(&a, 1, 1) != 1)
return IL_FALSE;
while (a != '\n') {
- if (count >= 80) { // Line shouldn't be this long at all.
- ilSetError(IL_INVALID_FILE_HEADER);
+ if (count >= 80) // Line shouldn't be this long at all.
return IL_FALSE;
- }
buff[count] = a;
if (iread(&a, 1, 1) != 1)
return IL_FALSE;