diff --git a/src/dep/include/irrlicht/CDynamicMeshBuffer.h b/src/dep/include/irrlicht/CDynamicMeshBuffer.h new file mode 100644 index 0000000..587a164 --- /dev/null +++ b/src/dep/include/irrlicht/CDynamicMeshBuffer.h @@ -0,0 +1,116 @@ +// Copyright (C) 2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#ifndef __C_DYNAMIC_MESHBUFFER_H_INCLUDED__ +#define __C_DYNAMIC_MESHBUFFER_H_INCLUDED__ + +#include "IDynamicMeshBuffer.h" + +#include "CVertexBuffer.h" +#include "CIndexBuffer.h" + +namespace irr +{ +namespace scene +{ + + class CDynamicMeshBuffer: public IDynamicMeshBuffer + { + public: + //! constructor + CDynamicMeshBuffer(video::E_VERTEX_TYPE vertexType, video::E_INDEX_TYPE indexType) + { + VertexBuffer=new CVertexBuffer(vertexType); + IndexBuffer=new CIndexBuffer(indexType); + } + + //! destructor + virtual ~CDynamicMeshBuffer() + { + if (VertexBuffer) + VertexBuffer->drop(); + if (IndexBuffer) + IndexBuffer->drop(); + } + + virtual IVertexBuffer& getVertexBuffer() const + { + return *VertexBuffer; + } + + virtual IIndexBuffer& getIndexBuffer() const + { + return *IndexBuffer; + } + + virtual void setVertexBuffer(IVertexBuffer *newVertexBuffer) + { + if (newVertexBuffer) + newVertexBuffer->grab(); + if (VertexBuffer) + VertexBuffer->drop(); + + VertexBuffer=newVertexBuffer; + } + + virtual void setIndexBuffer(IIndexBuffer *newIndexBuffer) + { + if (newIndexBuffer) + newIndexBuffer->grab(); + if (IndexBuffer) + IndexBuffer->drop(); + + IndexBuffer=newIndexBuffer; + } + + //! Get Material of this buffer. + virtual const video::SMaterial& getMaterial() const + { + return Material; + } + + //! Get Material of this buffer. + virtual video::SMaterial& getMaterial() + { + return Material; + } + + //! Get bounding box + virtual const core::aabbox3d& getBoundingBox() const + { + return BoundingBox; + } + + //! Set bounding box + virtual void setBoundingBox( const core::aabbox3df& box) + { + BoundingBox = box; + } + + //! Recalculate bounding box + virtual void recalculateBoundingBox() + { + if (!getVertexBuffer().size()) + BoundingBox.reset(0,0,0); + else + { + BoundingBox.reset(getVertexBuffer()[0].Pos); + for (u32 i=1; i BoundingBox; + private: + IVertexBuffer *VertexBuffer; + IIndexBuffer *IndexBuffer; + }; + + +} // end namespace scene +} // end namespace irr + +#endif + diff --git a/src/dep/include/irrlicht/CIndexBuffer.h b/src/dep/include/irrlicht/CIndexBuffer.h new file mode 100644 index 0000000..61002f4 --- /dev/null +++ b/src/dep/include/irrlicht/CIndexBuffer.h @@ -0,0 +1,225 @@ +// Copyright (C) 2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#ifndef __C_INDEX_BUFFER_H_INCLUDED__ +#define __C_INDEX_BUFFER_H_INCLUDED__ + +#include "IIndexBuffer.h" + +namespace irr +{ +namespace scene +{ + + class CIndexBuffer : public IIndexBuffer + { + + class IIndexList + { + public: + virtual ~IIndexList(){}; + + virtual u32 stride() const =0; + virtual u32 size() const =0; + virtual void push_back(const u32 &element) =0; + virtual u32 operator [](u32 index) const =0; + virtual u32 getLast() =0; + virtual void setValue(u32 index, u32 value) =0; + virtual void set_used(u32 usedNow) =0; + virtual void reallocate(u32 new_size) =0; + virtual u32 allocated_size() const =0; + virtual void* pointer() =0; + virtual video::E_INDEX_TYPE getType() const =0; + }; + + template + class CSpecificIndexList : public IIndexList + { + public: + core::array Indices; + + virtual u32 stride() const {return sizeof(T);} + + virtual u32 size() const {return Indices.size();} + + virtual void push_back(const u32 &element) + { + Indices.push_back((T&)element); + } + + virtual u32 operator [](u32 index) const + { + return (u32)(Indices[index]); + } + + virtual u32 getLast() {return (u32)Indices.getLast();} + + virtual void setValue(u32 index, u32 value) + { + Indices[index]=(T)value; + } + + virtual void set_used(u32 usedNow) + { + Indices.set_used(usedNow); + } + + virtual void reallocate(u32 new_size) + { + Indices.reallocate(new_size); + } + + virtual u32 allocated_size() const + { + return Indices.allocated_size(); + } + + virtual void* pointer() {return Indices.pointer();} + + virtual video::E_INDEX_TYPE getType() const + { + if (sizeof(T)==sizeof(u16)) + return video::EIT_16BIT; + else + return video::EIT_32BIT; + } + }; + + public: + IIndexList *Indices; + + CIndexBuffer(video::E_INDEX_TYPE IndexType) :Indices(0), MappingHint(EHM_NEVER), ChangedID(1) + { + setType(IndexType); + } + + CIndexBuffer(const IIndexBuffer &IndexBufferCopy) :Indices(0), MappingHint(EHM_NEVER), ChangedID(1) + { + setType(IndexBufferCopy.getType()); + reallocate(IndexBufferCopy.size()); + + for (u32 n=0;n; + break; + } + case video::EIT_32BIT: + { + NewIndices=new CSpecificIndexList; + break; + } + } + + if (Indices) + { + NewIndices->reallocate( Indices->size() ); + + for(u32 n=0;nsize();++n) + NewIndices->push_back((*Indices)[n]); + + delete Indices; + } + + Indices=NewIndices; + } + + virtual void* getData() {return Indices->pointer();} + + virtual video::E_INDEX_TYPE getType() const {return Indices->getType();} + + virtual u32 stride() const {return Indices->stride();} + + virtual u32 size() const + { + return Indices->size(); + } + + virtual void push_back(const u32 &element) + { + Indices->push_back(element); + } + + virtual u32 operator [](u32 index) const + { + return (*Indices)[index]; + } + + virtual u32 getLast() + { + return Indices->getLast(); + } + + virtual void setValue(u32 index, u32 value) + { + Indices->setValue(index, value); + } + + virtual void set_used(u32 usedNow) + { + Indices->set_used(usedNow); + } + + virtual void reallocate(u32 new_size) + { + Indices->reallocate(new_size); + } + + virtual u32 allocated_size() const + { + return Indices->allocated_size(); + } + + virtual void* pointer() + { + return Indices->pointer(); + } + + //! get the current hardware mapping hint + virtual E_HARDWARE_MAPPING getHardwareMappingHint() const + { + return MappingHint; + } + + //! set the hardware mapping hint, for driver + virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint ) + { + MappingHint=NewMappingHint; + } + + //! flags the mesh as changed, reloads hardware buffers + virtual void setDirty() + { + ++ChangedID; + } + + //! Get the currently used ID for identification of changes. + /** This shouldn't be used for anything outside the VideoDriver. */ + virtual u32 getChangedID() const {return ChangedID;} + + E_HARDWARE_MAPPING MappingHint; + u32 ChangedID; + }; + + +} // end namespace scene +} // end namespace irr + +#endif + diff --git a/src/dep/include/irrlicht/CMeshBuffer.h b/src/dep/include/irrlicht/CMeshBuffer.h index e2b2a50..52f9d4e 100644 --- a/src/dep/include/irrlicht/CMeshBuffer.h +++ b/src/dep/include/irrlicht/CMeshBuffer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/CVertexBuffer.h b/src/dep/include/irrlicht/CVertexBuffer.h new file mode 100644 index 0000000..2bcab45 --- /dev/null +++ b/src/dep/include/irrlicht/CVertexBuffer.h @@ -0,0 +1,210 @@ +// Copyright (C) 2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#ifndef __C_VERTEX_BUFFER_H_INCLUDED__ +#define __C_VERTEX_BUFFER_H_INCLUDED__ + +#include "IVertexBuffer.h" + + +namespace irr +{ +namespace scene +{ + + class CVertexBuffer : public IVertexBuffer + { + class IVertexList + { + public: + virtual ~IVertexList(){}; + + virtual u32 stride() const =0; + + virtual u32 size() const =0; + + virtual void push_back (const video::S3DVertex &element) =0; + virtual video::S3DVertex& operator [](const u32 index) const =0; + virtual video::S3DVertex& getLast() =0; + virtual void set_used(u32 usedNow) =0; + virtual void reallocate(u32 new_size) =0; + virtual u32 allocated_size() const =0; + virtual video::S3DVertex* pointer() =0; + virtual video::E_VERTEX_TYPE getType() const =0; + }; + + template + class CSpecificVertexList : public IVertexList + { + public: + core::array Vertices; + + virtual u32 stride() const {return sizeof(T);} + + virtual u32 size() const {return Vertices.size();} + + virtual void push_back (const video::S3DVertex &element) + {Vertices.push_back((T&)element);} + + virtual video::S3DVertex& operator [](const u32 index) const + {return (video::S3DVertex&)Vertices[index];} + + virtual video::S3DVertex& getLast() + {return (video::S3DVertex&)Vertices.getLast();} + + virtual void set_used(u32 usedNow) + {Vertices.set_used(usedNow);} + + virtual void reallocate(u32 new_size) + {Vertices.reallocate(new_size);} + + virtual u32 allocated_size() const + { + return Vertices.allocated_size(); + } + + virtual video::S3DVertex* pointer() {return Vertices.pointer();} + + virtual video::E_VERTEX_TYPE getType() const {return T().getType();} + }; + + public: + IVertexList *Vertices; + + CVertexBuffer(video::E_VERTEX_TYPE vertexType) : Vertices(0), + MappingHint(EHM_NEVER), ChangedID(1) + { + setType(vertexType); + } + + CVertexBuffer(const IVertexBuffer &VertexBufferCopy) : + Vertices(0), MappingHint(EHM_NEVER), + ChangedID(1) + { + setType(VertexBufferCopy.getType()); + reallocate(VertexBufferCopy.size()); + + for (u32 n=0;n; + break; + } + case video::EVT_2TCOORDS: + { + NewVertices=new CSpecificVertexList; + break; + } + case video::EVT_TANGENTS: + { + NewVertices=new CSpecificVertexList; + break; + } + } + if (Vertices) + { + NewVertices->reallocate( Vertices->size() ); + + for(u32 n=0;nsize();++n) + NewVertices->push_back((*Vertices)[n]); + + delete Vertices; + } + + Vertices=NewVertices; + } + + virtual void* getData() {return Vertices->pointer();} + + virtual video::E_VERTEX_TYPE getType() const {return Vertices->getType();} + + virtual u32 stride() const {return Vertices->stride();} + + virtual u32 size() const + { + return Vertices->size(); + } + + virtual void push_back (const video::S3DVertex &element) + { + Vertices->push_back(element); + } + + virtual video::S3DVertex& operator [](const u32 index) const + { + return (*Vertices)[index]; + } + + virtual video::S3DVertex& getLast() + { + return Vertices->getLast(); + } + + virtual void set_used(u32 usedNow) + { + Vertices->set_used(usedNow); + } + + virtual void reallocate(u32 new_size) + { + Vertices->reallocate(new_size); + } + + virtual u32 allocated_size() const + { + return Vertices->allocated_size(); + } + + virtual video::S3DVertex* pointer() + { + return Vertices->pointer(); + } + + //! get the current hardware mapping hint + virtual E_HARDWARE_MAPPING getHardwareMappingHint() const + { + return MappingHint; + } + + //! set the hardware mapping hint, for driver + virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint ) + { + MappingHint=NewMappingHint; + } + + //! flags the mesh as changed, reloads hardware buffers + virtual void setDirty() + { + ++ChangedID; + } + + //! Get the currently used ID for identification of changes. + /** This shouldn't be used for anything outside the VideoDriver. */ + virtual u32 getChangedID() const {return ChangedID;} + + E_HARDWARE_MAPPING MappingHint; + u32 ChangedID; + }; + + +} // end namespace scene +} // end namespace irr + +#endif + diff --git a/src/dep/include/irrlicht/ECullingTypes.h b/src/dep/include/irrlicht/ECullingTypes.h index 95c865a..61ae0ee 100644 --- a/src/dep/include/irrlicht/ECullingTypes.h +++ b/src/dep/include/irrlicht/ECullingTypes.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/EDebugSceneTypes.h b/src/dep/include/irrlicht/EDebugSceneTypes.h index 025d22b..f4fe2ce 100644 --- a/src/dep/include/irrlicht/EDebugSceneTypes.h +++ b/src/dep/include/irrlicht/EDebugSceneTypes.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/EDriverFeatures.h b/src/dep/include/irrlicht/EDriverFeatures.h index e4c8935..20498d3 100644 --- a/src/dep/include/irrlicht/EDriverFeatures.h +++ b/src/dep/include/irrlicht/EDriverFeatures.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/EDriverTypes.h b/src/dep/include/irrlicht/EDriverTypes.h index b59b6b2..322c6a9 100644 --- a/src/dep/include/irrlicht/EDriverTypes.h +++ b/src/dep/include/irrlicht/EDriverTypes.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -13,43 +13,44 @@ namespace video //! An enum for all types of drivers the Irrlicht Engine supports. enum E_DRIVER_TYPE { - //! Null driver, useful for applications to run the engine without visualisation. - /** The null device is able to load textures, but does not - render and display any graphics. */ + //! Null driver, useful for applications to run the engine + //! without visualisation. The null device is able to load + //! textures, but does not render and display any graphics. EDT_NULL, - //! The Irrlicht Engine Software renderer. - /** Runs on all platforms, with every hardware. It should only be used for - 2d graphics, but it can also perform some primitive 3d - functions. These 3d drawing functions are quite fast, but - very inaccurate, and don't even support clipping in 3D mode. */ + //! The Irrlicht Engine Software renderer, runs on all + //! platforms, with every hardware. It should only be used for + //! 2d graphics, but it can also perform some primitive 3d + //! functions. These 3d drawing functions are quite fast, but + //! very inaccurate, and don't even support clipping in 3D mode. EDT_SOFTWARE, - //! The Burning's Software Renderer, an alternative software renderer - /** Basically it can be described as the Irrlicht Software - renderer on steroids. It rasterizes 3D geometry perfectly: It - is able to perform correct 3d clipping, perspective correct - texture mapping, perspective correct color mapping, and renders - sub pixel correct, sub texel correct primitives. In addition, - it does bilinear texel filtering and supports more materials - than the EDT_SOFTWARE driver. This renderer has been written - entirely by Thomas Alten, thanks a lot for this huge - contribution. */ + //! The Burning's Software Renderer, an alternative software + //! renderer for Irrlicht. Basically it can be described as the + //! Irrlicht Software renderer on steroids. It rasterizes 3D + //! geometry perfectly: It is able to perform correct 3d + //! clipping, perspective correct texture mapping, perspective + //! correct color mapping, and renders sub pixel correct, sub + //! texel correct primitives. In addition, it does bilinear + //! texel filtering and supports more materials than the + //! EDT_SOFTWARE driver. This renderer has been written + //! entirely by Thomas Alten, thanks a lot for this huge + //! contribution. EDT_BURNINGSVIDEO, //! Direct3D8 device, only available on Win32 platforms. - /** Performs hardware accelerated rendering of 3D and 2D - primitives. */ + //! Performs hardware accelerated rendering of 3D and 2D + //! primitives. EDT_DIRECT3D8, //! Direct3D 9 device, only available on Win32 platforms. - /** Performs hardware accelerated rendering of 3D and 2D - primitives. */ + //! Performs hardware accelerated rendering of 3D and 2D + //! primitives. EDT_DIRECT3D9, //! OpenGL device, available on most platforms. - /** Performs hardware accelerated rendering of 3D and 2D - primitives. */ + //! Performs hardware accelerated rendering of 3D and 2D + //! primitives. EDT_OPENGL }; diff --git a/src/dep/include/irrlicht/EGUIAlignment.h b/src/dep/include/irrlicht/EGUIAlignment.h new file mode 100644 index 0000000..837043a --- /dev/null +++ b/src/dep/include/irrlicht/EGUIAlignment.h @@ -0,0 +1,37 @@ +// Copyright (C) 2002-2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#ifndef __E_GUI_ALIGNMENT_H_INCLUDED__ +#define __E_GUI_ALIGNMENT_H_INCLUDED__ + +namespace irr +{ +namespace gui +{ +enum EGUI_ALIGNMENT +{ + //! Aligned to parent's top or left side (default) + EGUIA_UPPERLEFT=0, + //! Aligned to parent's bottom or right side + EGUIA_LOWERRIGHT, + //! Aligned to the center of parent + EGUIA_CENTER, + //! Stretched to fit parent + EGUIA_SCALE +}; + +//! Names for alignments +const c8* const GUIAlignmentNames[] = +{ + "upperLeft", + "lowerRight", + "center", + "scale", + 0 +}; + +} // namespace gui +} // namespace irr + +#endif // __E_GUI_ALIGNMENT_H_INCLUDED__ diff --git a/src/dep/include/irrlicht/EGUIElementTypes.h b/src/dep/include/irrlicht/EGUIElementTypes.h index 30306d4..660fb8c 100644 --- a/src/dep/include/irrlicht/EGUIElementTypes.h +++ b/src/dep/include/irrlicht/EGUIElementTypes.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -88,7 +88,8 @@ enum EGUI_ELEMENT_TYPE //! Unknown type. EGUIET_ELEMENT, - //! This enum is never used, it only forces the compiler to compile this enumeration to 32 bit. + //! This enum is never used, it only forces the compiler to + //! compile these enumeration values to 32 bit. EGUIET_FORCE_32_BIT = 0x7fffffff }; diff --git a/src/dep/include/irrlicht/EHardwareBufferFlags.h b/src/dep/include/irrlicht/EHardwareBufferFlags.h new file mode 100644 index 0000000..c665008 --- /dev/null +++ b/src/dep/include/irrlicht/EHardwareBufferFlags.h @@ -0,0 +1,40 @@ +// Copyright (C) 2002-2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#ifndef __E_HARDWARE_BUFFER_FLAGS_INCLUDED__ +#define __E_HARDWARE_BUFFER_FLAGS_INCLUDED__ + +namespace irr +{ +namespace scene +{ + + enum E_HARDWARE_MAPPING + { + //! Don't load in hardware + EHM_NEVER=0, + + //! Rarely changed + EHM_STATIC, + + //! Sometimes changed + EHM_DYNAMIC, + + //! Always changed + EHM_STREAM + }; + + enum E_BUFFER_TYPE + { + EBT_NONE=0, + EBT_VERTEX, + EBT_INDEX, + EBT_VERTEX_AND_INDEX + }; + +} // end namespace scene +} // end namespace irr + +#endif + diff --git a/src/dep/include/irrlicht/EMaterialFlags.h b/src/dep/include/irrlicht/EMaterialFlags.h index 9411f81..eec4aee 100644 --- a/src/dep/include/irrlicht/EMaterialFlags.h +++ b/src/dep/include/irrlicht/EMaterialFlags.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/EMaterialTypes.h b/src/dep/include/irrlicht/EMaterialTypes.h index 69f92cd..e496c54 100644 --- a/src/dep/include/irrlicht/EMaterialTypes.h +++ b/src/dep/include/irrlicht/EMaterialTypes.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -13,39 +13,37 @@ namespace video //! Abstracted and easy to use fixed function/programmable pipeline material modes. enum E_MATERIAL_TYPE { - //! Standard solid material. - /** Only first texture is used, which is supposed to be the - diffuse material. */ + //! Standard solid material. Only first texture is used, which + //! is supposed to be the diffuse material. EMT_SOLID = 0, - //! Solid material with 2 texture layers. - /** The second is blended onto the first using the alpha value - of the vertex colors. This material is currently not implemented in OpenGL. - */ + //! Solid material with 2 texture layers. The second is blended + //! onto the first using the alpha value of the vertex colors. + //! This material is currently not implemented in OpenGL. EMT_SOLID_2_LAYER, - //! Material type with standard lightmap technique - /** There should be 2 textures: The first texture layer is a - diffuse map, the second is a light map. Dynamic light is - ignored. */ + //! Material type with standard lightmap technique: + //! There should be 2 textures: The first texture layer is a + //! diffuse map, the second is a light map. Dynamic light is + //! ignored. EMT_LIGHTMAP, - //! Material type with lightmap technique like EMT_LIGHTMAP. - /** But lightmap and diffuse texture are added instead of modulated. */ + //! Material type with lightmap technique like EMT_LIGHTMAP. But + //! lightmap and diffuse texture are added instead of modulated. EMT_LIGHTMAP_ADD, - //! Material type with standard lightmap technique - /** There should be 2 textures: The first texture layer is a - diffuse map, the second is a light map. Dynamic light is - ignored. The texture colors are effectively multiplied by 2 - for brightening. Like known in DirectX as D3DTOP_MODULATE2X. */ + //! Material type with standard lightmap technique: + //! There should be 2 textures: The first texture layer is a + //! diffuse map, the second is a light map. Dynamic light is + //! ignored. The texture colors are effectively multiplied by 2 + //! for brightening. Like known in DirectX as D3DTOP_MODULATE2X. EMT_LIGHTMAP_M2, - //! Material type with standard lightmap technique - /** There should be 2 textures: The first texture layer is a - diffuse map, the second is a light map. Dynamic light is - ignored. The texture colors are effectively multiplyied by 4 - for brightening. Like known in DirectX as D3DTOP_MODULATE4X. */ + //! Material type with standard lightmap technique: + //! There should be 2 textures: The first texture layer is a + //! diffuse map, the second is a light map. Dynamic light is + //! ignored. The texture colors are effectively multiplyied by 4 + //! for brightening. Like known in DirectX as D3DTOP_MODULATE4X. EMT_LIGHTMAP_M4, //! Like EMT_LIGHTMAP, but also supports dynamic lighting. @@ -57,142 +55,153 @@ namespace video //! Like EMT_LIGHTMAP_4, but also supports dynamic lighting. EMT_LIGHTMAP_LIGHTING_M4, - //! Detail mapped material. - /** The first texture is diffuse color map, the second is added - to this and usually displayed with a bigger scale value so that - it adds more detail. The detail map is added to the diffuse map - using ADD_SIGNED, so that it is possible to add and substract - color from the diffuse map. For example a value of - (127,127,127) will not change the appearance of the diffuse map - at all. Often used for terrain rendering. */ + //! Detail mapped material. The first texture is diffuse color + //! map, the second is added to this and usually displayed with + //! a bigger scale value so that it adds more detail. The + //! detail map is added to the diffuse map using ADD_SIGNED, so + //! that it is possible to add and substract color from the + //! diffuse map. For example a value of (127,127,127) will not + //! change the appearance of the diffuse map at all. Often used + //! for terrain rendering. EMT_DETAIL_MAP, - //! Look like a reflection of the environment around it. - /** To make this possible, a texture called 'sphere map' is - used, which must be set as the first texture. */ + //! Makes the material look like it was reflection the + //! environment around it. To make this possible, a texture + //! called 'sphere map' is used, which must be set as the first + //! texture. EMT_SPHERE_MAP, - //! A reflecting material with an optional non reflecting texture layer. - /** The reflection map should be set as first texture. */ + //! A reflecting material with an optional additional non + //! reflecting texture layer. The reflection map should be set + //! as first texture. EMT_REFLECTION_2_LAYER, - //! A transparent material. - /** Only the first texture is used. The new color is calculated - by simply adding the source color and the dest color. This - means if for example a billboard using a texture with black - background and a red circle on it is drawn with this material, - the result is that only the red circle will be drawn a little - bit transparent, and everything which was black is 100% - transparent and not visible. This material type is useful for - particle effects. */ + //! A transparent material. Only the first texture is used. + //! The new color is calculated by simply adding the source + //! color and the dest color. This means if for example a + //! billboard using a texture with black background and a red + //! circle on it is drawn with this material, the result is + //! that only the red circle will be drawn a little bit + //! transparent, and everything which was black is 100% + //! transparent and not visible. This material type is useful + //! for particle effects. EMT_TRANSPARENT_ADD_COLOR, - //! Makes the material transparent based on the texture alpha channel. - /** The final color is blended together from the destination - color and the texture color, using the alpha channel value as - blend factor. Only first texture is used. If you are using - this material with small textures, it is a good idea to load - the texture in 32 bit mode - (video::IVideoDriver::setTextureCreationFlag()). Also, an alpha - ref is used, which can be manipulated using - SMaterial::MaterialTypeParam. This value controls how sharp the - edges become when going from a transparent to a solid spot on - the texture. */ + //! Makes the material transparent based on the texture alpha + //! channel. The final color is blended together from the + //! destination color and the texture color, using the alpha + //! channel value as blend factor. Only first texture is used. + //! If you are using this material with small textures, it is a + //! good idea to load the texture in 32 bit mode + //! (video::IVideoDriver::setTextureCreationFlag()). Also, an + //! alpha ref is used, which can be manipulated using + //! SMaterial::MaterialTypeParam. If set to 0, the alpha ref + //! gets its default value which is 0.5f and means that + //! pixels with an alpha value >127 will be written, others not. + //! In other, simple words: this value controls how sharp the + //! edges become when going from a transparent to a solid spot + //! on the texture. EMT_TRANSPARENT_ALPHA_CHANNEL, - //! Makes the material transparent based on the texture alpha channel. - /** If the alpha channel value is greater than 127, a - pixel is written to the target, otherwise not. This - material does not use alpha blending and is a lot faster - than EMT_TRANSPARENT_ALPHA_CHANNEL. It is ideal for drawing - stuff like leafes of plants, because the borders are not - blurry but sharp. Only first texture is used. If you are - using this material with small textures and 3d object, it - is a good idea to load the texture in 32 bit mode - (video::IVideoDriver::setTextureCreationFlag()). */ + //! Makes the material transparent based on the texture alpha + //! channel. If the alpha channel value is greater than 127, a + //! pixel is written to the target, otherwise not. This + //! material does not use alpha blending and is a lot faster + //! than EMT_TRANSPARENT_ALPHA_CHANNEL. It is ideal for drawing + //! stuff like leafes of plants, because the borders are not + //! blurry but sharp. Only first texture is used. If you are + //! using this material with small textures and 3d object, it + //! is a good idea to load the texture in 32 bit mode + //! (video::IVideoDriver::setTextureCreationFlag()). EMT_TRANSPARENT_ALPHA_CHANNEL_REF, - //! Makes the material transparent based on the vertex alpha value. + //! Makes the material transparent based on the vertex alpha + //! value. EMT_TRANSPARENT_VERTEX_ALPHA, - //! A transparent reflecting material with an optional additional non reflecting texture layer. - /** The reflection map should be set as first texture. The - transparency depends on the alpha value in the vertex colors. A - texture which will not reflect can be set as second texture. - Please note that this material type is currently not 100% - implemented in OpenGL. */ + //! A transparent reflecting material with an optional + //! additional non reflecting texture layer. The reflection map + //! should be set as first texture. The transparency depends on + //! the alpha value in the vertex colors. A texture which will + //! not reflect can be set as second texture. Please note that + //! this material type is currently not 100% implemented in + //! OpenGL. EMT_TRANSPARENT_REFLECTION_2_LAYER, - //! A solid normal map renderer. - /** First texture is the color map, the second should be the - normal map. Note that you should use this material only when - drawing geometry consisting of vertices of type - S3DVertexTangents (EVT_TANGENTS). You can convert any mesh into - this format using IMeshManipulator::createMeshWithTangents() - (See SpecialFX2 Tutorial). This shader runs on vertex shader - 1.1 and pixel shader 1.1 capable hardware and falls back to a - fixed function lighted material if this hardware is not - available. Only two lights are supported by this shader, if - there are more, the nearest two are chosen. */ + //! A solid normal map renderer. First texture is the color + //! map, the second should be the normal map. Note that you + //! should use this material only when drawing geometry + //! consisting of vertices of type S3DVertexTangents + //! (EVT_TANGENTS). You can convert any mesh into this format + //! using IMeshManipulator::createMeshWithTangents() (See + //! SpecialFX2 Tutorial). This shader runs on vertex shader + //! 1.1 and pixel shader 1.1 capable hardware and falls back to + //! a fixed function lighted material if this hardware is not + //! available. Only two lights are supported by this shader, + //! if there are more, the nearest two are chosen. EMT_NORMAL_MAP_SOLID, - //! A transparent normal map renderer. - /** First texture is the color map, the second should be the - normal map. Note that you should use this material only when - drawing geometry consisting of vertices of type - S3DVertexTangents (EVT_TANGENTS). You can convert any mesh into - this format using IMeshManipulator::createMeshWithTangents() - (See SpecialFX2 Tutorial). This shader runs on vertex shader - 1.1 and pixel shader 1.1 capable hardware and falls back to a - fixed function lighted material if this hardware is not - available. Only two lights are supported by this shader, if - there are more, the nearest two are chosen. */ + //! A transparent normal map renderer. First texture is the + //! color map, the second should be the normal map. Note that + //! you should use this material only when drawing geometry + //! consisting of vertices of type S3DVertexTangents + //! (EVT_TANGENTS). You can convert any mesh into this format + //! using IMeshManipulator::createMeshWithTangents() (See + //! SpecialFX2 Tutorial). This shader runs on vertex shader + //! 1.1 and pixel shader 1.1 capable hardware and falls back to + //! a fixed function lighted material if this hardware is not + //! available. Only two lights are supported by this shader, + //! if there are more, the nearest two are chosen. EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR, - //! A transparent (based on the vertex alpha value) normal map renderer. - /** First texture is the color map, the second should be the - normal map. Note that you should use this material only when - drawing geometry consisting of vertices of type - S3DVertexTangents (EVT_TANGENTS). You can convert any mesh into - this format using IMeshManipulator::createMeshWithTangents() - (See SpecialFX2 Tutorial). This shader runs on vertex shader - 1.1 and pixel shader 1.1 capable hardware and falls back to a - fixed function lighted material if this hardware is not - available. Only two lights are supported by this shader, if - there are more, the nearest two are chosen. */ + //! A transparent (based on the vertex alpha value) normal map + //! renderer. First texture is the color map, the second + //! should be the normal map. Note that you should use this + //! material only when drawing geometry consisting of vertices + //! of type S3DVertexTangents (EVT_TANGENTS). You can convert + //! any mesh into this format using + //! IMeshManipulator::createMeshWithTangents() (See SpecialFX2 + //! Tutorial). This shader runs on vertex shader 1.1 and pixel + //! shader 1.1 capable hardware and falls back to a fixed + //! function lighted material if this hardware is not available. + //! Only two lights are supported by this shader, if there are + //! more, the nearest two are chosen. EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA, - //! Just like EMT_NORMAL_MAP_SOLID, but uses parallax mapping. - /** Looks a lot more realistic. This only works when the - hardware supports at least vertex shader 1.1 and pixel shader - 1.4. First texture is the color map, the second should be the - normal map. The normal map texture should contain the height - value in the alpha component. The - IVideoDriver::makeNormalMapTexture() method writes this value - automatically when creating normal maps from a heightmap when - using a 32 bit texture. The height scale of the material - (affecting the bumpiness) is being controlled by the - SMaterial::MaterialTypeParam member. If set to zero, the - default value (0.02f) will be applied. Otherwise the value set - in SMaterial::MaterialTypeParam is taken. This value depends on - with which scale the texture is mapped on the material. Too - high or low values of MaterialTypeParam can result in strange - artifacts. */ + //! Just like EMT_NORMAL_MAP_SOLID, but uses parallax mapping + //! too, which looks a lot more realistic. This only works when + //! the hardware supports at least vertex shader 1.1 and pixel + //! shader 1.4. First texture is the color map, the second + //! should be the normal map. The normal map texture should + //! contain the height value in the alpha component. The + //! IVideoDriver::makeNormalMapTexture() method writes this + //! value automatically when creating normal maps from a + //! heightmap when using a 32 bit texture. The height scale of + //! the material (affecting the bumpiness) is being controlled + //! by the SMaterial::MaterialTypeParam member. If set to + //! zero, the default value (0.02f) will be applied. Otherwise + //! the value set in SMaterial::MaterialTypeParam is taken. This + //! value depends on with which scale the texture is mapped on + //! the material. Too high or low values of MaterialTypeParam + //! can result in strange artifacts. EMT_PARALLAX_MAP_SOLID, - //! A material like EMT_PARALLAX_MAP_SOLID, but transparent. - /** Using EMT_TRANSPARENT_ADD_COLOR as base material. */ + //! A material just like EMT_PARALLAX_MAP_SOLID, but it is + //! transparent, using EMT_TRANSPARENT_ADD_COLOR as base + //! material. EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR, - //! A material like EMT_PARALLAX_MAP_SOLID, but transparent. - /** Using EMT_TRANSPARENT_VERTEX_ALPHA as base material. */ + //! A material just like EMT_PARALLAX_MAP_SOLID, but it is + //! transparent, using EMT_TRANSPARENT_VERTEX_ALPHA as base + //! material. EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA, //! BlendFunc = source * sourceFactor + dest * destFactor ( E_BLEND_FUNC ) - /** Using only first texture. Generic blending method. */ + //! Using only first texture. Generic blending method. EMT_ONETEXTURE_BLEND, - //! This value is not used. It only forces this enumeration to compile to 32 bit. + //! This value is not used. It only forces this enumeration to + //! compile in 32 bit. EMT_FORCE_32BIT = 0x7fffffff }; diff --git a/src/dep/include/irrlicht/EMeshWriterEnums.h b/src/dep/include/irrlicht/EMeshWriterEnums.h index 8acc285..bc0f1d3 100644 --- a/src/dep/include/irrlicht/EMeshWriterEnums.h +++ b/src/dep/include/irrlicht/EMeshWriterEnums.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/EMessageBoxFlags.h b/src/dep/include/irrlicht/EMessageBoxFlags.h index 8e8ead8..e4d7dc6 100644 --- a/src/dep/include/irrlicht/EMessageBoxFlags.h +++ b/src/dep/include/irrlicht/EMessageBoxFlags.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -33,4 +33,3 @@ enum EMESSAGE_BOX_FLAG } // namespace irr #endif - diff --git a/src/dep/include/irrlicht/ESceneNodeAnimatorTypes.h b/src/dep/include/irrlicht/ESceneNodeAnimatorTypes.h index 63a78f7..99a4234 100644 --- a/src/dep/include/irrlicht/ESceneNodeAnimatorTypes.h +++ b/src/dep/include/irrlicht/ESceneNodeAnimatorTypes.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -46,7 +46,8 @@ namespace scene //! Unknown scene node animator ESNAT_UNKNOWN, - //! This enum is never used, it only forces the compiler to compile this enumeration to 32 bit. + //! This enum is never used, it only forces the compiler to + //! compile these enumeration values to 32 bit. ESNAT_FORCE_32_BIT = 0x7fffffff }; diff --git a/src/dep/include/irrlicht/ESceneNodeTypes.h b/src/dep/include/irrlicht/ESceneNodeTypes.h index a7148cd..833608a 100644 --- a/src/dep/include/irrlicht/ESceneNodeTypes.h +++ b/src/dep/include/irrlicht/ESceneNodeTypes.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -70,11 +70,11 @@ namespace scene ESNT_MD3_SCENE_NODE = MAKE_IRR_ID('m','d','3','_'), //! Maya Camera Scene Node - /** Legacy, for loading version <= 1.4.x .irr files */ + //! Legacy, for loading version <= 1.4.x .irr files ESNT_CAMERA_MAYA = MAKE_IRR_ID('c','a','m','M'), //! First Person Shooter Camera - /** Legacy, for loading version <= 1.4.x .irr files */ + //! Legacy, for loading version <= 1.4.x .irr files ESNT_CAMERA_FPS = MAKE_IRR_ID('c','a','m','F'), //! Unknown scene node diff --git a/src/dep/include/irrlicht/ETerrainElements.h b/src/dep/include/irrlicht/ETerrainElements.h index dd08ef7..a9b65ee 100644 --- a/src/dep/include/irrlicht/ETerrainElements.h +++ b/src/dep/include/irrlicht/ETerrainElements.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IAnimatedMesh.h b/src/dep/include/irrlicht/IAnimatedMesh.h index dc60700..2befba1 100644 --- a/src/dep/include/irrlicht/IAnimatedMesh.h +++ b/src/dep/include/irrlicht/IAnimatedMesh.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IAnimatedMeshMD2.h b/src/dep/include/irrlicht/IAnimatedMeshMD2.h index 692a8c5..43852a9 100644 --- a/src/dep/include/irrlicht/IAnimatedMeshMD2.h +++ b/src/dep/include/irrlicht/IAnimatedMeshMD2.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IAnimatedMeshMD3.h b/src/dep/include/irrlicht/IAnimatedMeshMD3.h index a260e10..53cb218 100644 --- a/src/dep/include/irrlicht/IAnimatedMeshMD3.h +++ b/src/dep/include/irrlicht/IAnimatedMeshMD3.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2007-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IAnimatedMeshSceneNode.h b/src/dep/include/irrlicht/IAnimatedMeshSceneNode.h index 2d0cba1..ca1a2b4 100644 --- a/src/dep/include/irrlicht/IAnimatedMeshSceneNode.h +++ b/src/dep/include/irrlicht/IAnimatedMeshSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IAttributeExchangingObject.h b/src/dep/include/irrlicht/IAttributeExchangingObject.h index 0f90e9f..c430a7a 100644 --- a/src/dep/include/irrlicht/IAttributeExchangingObject.h +++ b/src/dep/include/irrlicht/IAttributeExchangingObject.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IAttributes.h b/src/dep/include/irrlicht/IAttributes.h index b0a616f..389357f 100644 --- a/src/dep/include/irrlicht/IAttributes.h +++ b/src/dep/include/irrlicht/IAttributes.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IBillboardSceneNode.h b/src/dep/include/irrlicht/IBillboardSceneNode.h index 1948fe7..9930dca 100644 --- a/src/dep/include/irrlicht/IBillboardSceneNode.h +++ b/src/dep/include/irrlicht/IBillboardSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IBillboardTextSceneNode.h b/src/dep/include/irrlicht/IBillboardTextSceneNode.h new file mode 100644 index 0000000..09c7166 --- /dev/null +++ b/src/dep/include/irrlicht/IBillboardTextSceneNode.h @@ -0,0 +1,62 @@ +// Copyright (C) 2002-2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#ifndef __I_BILLBOARD_TEXT_SCENE_NODE_H_INCLUDED__ +#define __I_BILLBOARD_TEXT_SCENE_NODE_H_INCLUDED__ + +#include "IBillboardSceneNode.h" + +namespace irr +{ +namespace scene +{ + +//! A billboard text scene node. +/** Acts like a billboard which displays the currently set text. + Due to the exclusion of RTTI in Irrlicht we have to avoid multiple + inheritance. Hence, changes to the ITextSceneNode interface have + to be copied here manually. +*/ +class IBillboardTextSceneNode : public IBillboardSceneNode +{ +public: + + //! Constructor + IBillboardTextSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id, + const core::vector3df& position = core::vector3df(0,0,0)) + : IBillboardSceneNode(parent, mgr, id, position) {} + + //! Sets the size of the billboard. + virtual void setSize(const core::dimension2d& size) = 0; + + //! Returns the size of the billboard. + virtual const core::dimension2d& getSize() const = 0; + + //! Set the color of all vertices of the billboard + /** \param overallColor: the color to set */ + virtual void setColor(const video::SColor & overallColor) = 0; + + //! Set the color of the top and bottom vertices of the billboard + /** \param topColor: the color to set the top vertices + \param bottomColor: the color to set the bottom vertices */ + virtual void setColor(const video::SColor & topColor, const video::SColor & bottomColor) = 0; + + //! Gets the color of the top and bottom vertices of the billboard + /** \param topColor: stores the color of the top vertices + \param bottomColor: stores the color of the bottom vertices */ + virtual void getColor(video::SColor & topColor, video::SColor & bottomColor) const = 0; + + //! sets the text string + virtual void setText(const wchar_t* text) = 0; + + //! sets the color of the text + virtual void setTextColor(video::SColor color) = 0; +}; + +} // end namespace scene +} // end namespace irr + + +#endif + diff --git a/src/dep/include/irrlicht/IBoneSceneNode.h b/src/dep/include/irrlicht/IBoneSceneNode.h index 2fa0b50..97498a0 100644 --- a/src/dep/include/irrlicht/IBoneSceneNode.h +++ b/src/dep/include/irrlicht/IBoneSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/ICameraSceneNode.h b/src/dep/include/irrlicht/ICameraSceneNode.h index c2f151c..2bd21ac 100644 --- a/src/dep/include/irrlicht/ICameraSceneNode.h +++ b/src/dep/include/irrlicht/ICameraSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -146,7 +146,7 @@ namespace scene setTarget() will update its rotation so that its +Z axis will point at the target point. FPS camera use this binding by default; other cameras do not. - \param bound True to bind the camera's scene node rotation + \param binding true to bind the camera's scene node rotation and targetting, false to unbind them. @see getTargetAndRotationBinding() */ virtual void bindTargetAndRotation(bool bound) = 0; diff --git a/src/dep/include/irrlicht/ICursorControl.h b/src/dep/include/irrlicht/ICursorControl.h index 5e2b0d1..915c89e 100644 --- a/src/dep/include/irrlicht/ICursorControl.h +++ b/src/dep/include/irrlicht/ICursorControl.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IDummyTransformationSceneNode.h b/src/dep/include/irrlicht/IDummyTransformationSceneNode.h index ce42da8..0e4634a 100644 --- a/src/dep/include/irrlicht/IDummyTransformationSceneNode.h +++ b/src/dep/include/irrlicht/IDummyTransformationSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IDynamicMeshBuffer.h b/src/dep/include/irrlicht/IDynamicMeshBuffer.h new file mode 100644 index 0000000..1b6f62f --- /dev/null +++ b/src/dep/include/irrlicht/IDynamicMeshBuffer.h @@ -0,0 +1,211 @@ +// Copyright (C) 2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#ifndef __I_DYNAMIC_MESH_BUFFER_H_INCLUDED__ +#define __I_DYNAMIC_MESH_BUFFER_H_INCLUDED__ + +#include "IMeshBuffer.h" +#include "IVertexBuffer.h" +#include "IIndexBuffer.h" + +namespace irr +{ +namespace scene +{ + + /** a dynamic meshBuffer */ + class IDynamicMeshBuffer : public IMeshBuffer + { + public: + virtual IVertexBuffer &getVertexBuffer() const =0; + virtual IIndexBuffer &getIndexBuffer() const =0; + + virtual void setVertexBuffer(IVertexBuffer *vertexBuffer) =0; + virtual void setIndexBuffer(IIndexBuffer *indexBuffer) =0; + + //! Get the material of this meshbuffer + /** \return Material of this buffer. */ + virtual video::SMaterial& getMaterial() =0; + + //! Get the material of this meshbuffer + /** \return Material of this buffer. */ + virtual const video::SMaterial& getMaterial() const =0; + + //! Get the axis aligned bounding box of this meshbuffer. + /** \return Axis aligned bounding box of this buffer. */ + virtual const core::aabbox3df& getBoundingBox() const =0; + + //! Set axis aligned bounding box + /** \param box User defined axis aligned bounding box to use + for this buffer. */ + virtual void setBoundingBox(const core::aabbox3df& box) =0; + + //! Recalculates the bounding box. Should be called if the mesh changed. + virtual void recalculateBoundingBox() =0; + + //! Append the vertices and indices to the current buffer + /** Only works for compatible vertex types. + \param vertices Pointer to a vertex array. + \param numVertices Number of vertices in the array. + \param indices Pointer to index array. + \param numIndices Number of indices in array. */ + virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) + { + + } + + //! Append the meshbuffer to the current buffer + /** Only works for compatible vertex types + \param other Buffer to append to this one. */ + virtual void append(const IMeshBuffer* const other) + { + + } + + // ------------------- To be removed? ------------------- // + + //! get the current hardware mapping hint + virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const + { + return getVertexBuffer().getHardwareMappingHint(); + } + + //! get the current hardware mapping hint + virtual E_HARDWARE_MAPPING getHardwareMappingHint_Index() const + { + return getIndexBuffer().getHardwareMappingHint(); + } + + //! set the hardware mapping hint, for driver + virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint, E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX ) + { + if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_VERTEX) + getVertexBuffer().setHardwareMappingHint(NewMappingHint); + if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_INDEX) + getIndexBuffer().setHardwareMappingHint(NewMappingHint); + } + + //! flags the mesh as changed, reloads hardware buffers + virtual void setDirty(E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX) + { + if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_VERTEX) + getVertexBuffer().setDirty(); + if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_INDEX) + getIndexBuffer().setDirty(); + } + + virtual u32 getChangedID_Vertex() const + { + return getVertexBuffer().getChangedID(); + } + + virtual u32 getChangedID_Index() const + { + return getIndexBuffer().getChangedID(); + } + + // ------------------- Old interface ------------------- // + + //! Get type of vertex data which is stored in this meshbuffer. + /** \return Vertex type of this buffer. */ + virtual video::E_VERTEX_TYPE getVertexType() const + { + return getVertexBuffer().getType(); + } + + //! Get access to vertex data. The data is an array of vertices. + /** Which vertex type is used can be determined by getVertexType(). + \return Pointer to array of vertices. */ + virtual const void* getVertices() const + { + return getVertexBuffer().getData(); + } + + //! Get access to vertex data. The data is an array of vertices. + /** Which vertex type is used can be determined by getVertexType(). + \return Pointer to array of vertices. */ + virtual void* getVertices() + { + return getVertexBuffer().getData(); + } + + //! Get amount of vertices in meshbuffer. + /** \return Number of vertices in this buffer. */ + virtual u32 getVertexCount() const + { + return getVertexBuffer().size(); + } + + //! Get type of index data which is stored in this meshbuffer. + /** \return Index type of this buffer. */ + virtual video::E_INDEX_TYPE getIndexType() const + { + return getIndexBuffer().getType(); + } + + //! Get access to Indices. + /** \return Pointer to indices array. */ + virtual const u16* getIndices() const + { + return (u16*)getIndexBuffer().getData(); + } + + //! Get access to Indices. + /** \return Pointer to indices array. */ + virtual u16* getIndices() + { + return (u16*)getIndexBuffer().getData(); + } + + //! Get amount of indices in this meshbuffer. + /** \return Number of indices in this buffer. */ + virtual u32 getIndexCount() const + { + return getIndexBuffer().size(); + } + + //! returns position of vertex i + virtual const core::vector3df& getPosition(u32 i) const + { + return getVertexBuffer()[i].Pos; + } + + //! returns position of vertex i + virtual core::vector3df& getPosition(u32 i) + { + return getVertexBuffer()[i].Pos; + } + + //! returns texture coords of vertex i + virtual const core::vector2df& getTCoords(u32 i) const + { + return getVertexBuffer()[i].TCoords; + } + + //! returns texture coords of vertex i + virtual core::vector2df& getTCoords(u32 i) + { + return getVertexBuffer()[i].TCoords; + } + + //! returns normal of vertex i + virtual const core::vector3df& getNormal(u32 i) const + { + return getVertexBuffer()[i].Normal; + } + + //! returns normal of vertex i + virtual core::vector3df& getNormal(u32 i) + { + return getVertexBuffer()[i].Normal; + } + }; + + +} // end namespace scene +} // end namespace irr + +#endif + + diff --git a/src/dep/include/irrlicht/IEventReceiver.h b/src/dep/include/irrlicht/IEventReceiver.h index 3eb1547..33e5380 100644 --- a/src/dep/include/irrlicht/IEventReceiver.h +++ b/src/dep/include/irrlicht/IEventReceiver.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -358,7 +358,7 @@ struct SJoystickInfo //! The ID of the joystick /** This is an internal Irrlicht index; it does not map directly * to any particular hardware joystick. It corresponds to the - * irr::SJoystickEvent Joystick ID. */ + * @ref SJoystickEvent Joystick ID. */ u8 Joystick; //! The name that the joystick uses to identify itself. diff --git a/src/dep/include/irrlicht/IFileList.h b/src/dep/include/irrlicht/IFileList.h index 8a06f81..dcdd85f 100644 --- a/src/dep/include/irrlicht/IFileList.h +++ b/src/dep/include/irrlicht/IFileList.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IFileSystem.h b/src/dep/include/irrlicht/IFileSystem.h index 3eecb21..ae200ee 100644 --- a/src/dep/include/irrlicht/IFileSystem.h +++ b/src/dep/include/irrlicht/IFileSystem.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -119,9 +119,7 @@ public: //! Returns the base part of a filename, i.e. the name without the directory //! part. If no directory is prefixed, the full name is returned. - /** \param filename: The file to get the basename from - \param keepExtension True if filename with extension is returned otherwise everything - after the final '.' is removed as well. */ + /** \param filename: The file to get the basename from */ virtual core::stringc getFileBasename(const core::stringc& filename, bool keepExtension=true) const = 0; //! Creates a list of files and directories in the current working directory and returns it. diff --git a/src/dep/include/irrlicht/IGPUProgrammingServices.h b/src/dep/include/irrlicht/IGPUProgrammingServices.h index da86633..1ae0a74 100644 --- a/src/dep/include/irrlicht/IGPUProgrammingServices.h +++ b/src/dep/include/irrlicht/IGPUProgrammingServices.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IGUIButton.h b/src/dep/include/irrlicht/IGUIButton.h index 41127eb..498f289 100644 --- a/src/dep/include/irrlicht/IGUIButton.h +++ b/src/dep/include/irrlicht/IGUIButton.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IGUICheckBox.h b/src/dep/include/irrlicht/IGUICheckBox.h index d398ad6..a5fc6cc 100644 --- a/src/dep/include/irrlicht/IGUICheckBox.h +++ b/src/dep/include/irrlicht/IGUICheckBox.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IGUIColorSelectDialog.h b/src/dep/include/irrlicht/IGUIColorSelectDialog.h index 342e584..662e340 100644 --- a/src/dep/include/irrlicht/IGUIColorSelectDialog.h +++ b/src/dep/include/irrlicht/IGUIColorSelectDialog.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IGUIComboBox.h b/src/dep/include/irrlicht/IGUIComboBox.h index 1eba975..fabcfa1 100644 --- a/src/dep/include/irrlicht/IGUIComboBox.h +++ b/src/dep/include/irrlicht/IGUIComboBox.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -44,10 +44,10 @@ namespace gui virtual void setSelected(s32 idx) = 0; //! Sets text justification of the text area - /** \param horizontal: EGUIA_UPPERLEFT for left justified (default), - EGUIA_LOWEERRIGHT for right justified, or EGUIA_CENTER for centered text. - \param vertical: EGUIA_UPPERLEFT to align with top edge, - EGUIA_LOWEERRIGHT for bottom edge, or EGUIA_CENTER for centered text (default). */ + /** \param horizontal: EGUIA_UPPERLEFT for left justified (default), + EGUIA_LOWEERRIGHT for right justified, or EGUIA_CENTER for centered text. + \param vertical: EGUIA_UPPERLEFT to align with top edge, + EGUIA_LOWEERRIGHT for bottom edge, or EGUIA_CENTER for centered text (default). */ virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) = 0; }; diff --git a/src/dep/include/irrlicht/IGUIContextMenu.h b/src/dep/include/irrlicht/IGUIContextMenu.h index 5d8cb3c..1b714ba 100644 --- a/src/dep/include/irrlicht/IGUIContextMenu.h +++ b/src/dep/include/irrlicht/IGUIContextMenu.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -36,7 +36,9 @@ namespace gui \param checked: Specifies if the menu item should be initially checked. \return Returns the index of the new item */ virtual u32 addItem(const wchar_t* text, s32 commandId=-1, bool enabled=true, - bool hasSubMenu=false, bool checked=false) = 0; + bool hasSubMenu=false, + bool checked=false + ) = 0; //! Adds a separator item to the menu virtual void addSeparator() = 0; diff --git a/src/dep/include/irrlicht/IGUIEditBox.h b/src/dep/include/irrlicht/IGUIEditBox.h index 34a2acb..37df5b5 100644 --- a/src/dep/include/irrlicht/IGUIEditBox.h +++ b/src/dep/include/irrlicht/IGUIEditBox.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -61,7 +61,7 @@ namespace gui virtual void setWordWrap(bool enable) = 0; //! Checks if word wrap is enabled - /** \return true if word wrap is enabled, false otherwise */ + //! \return true if word wrap is enabled, false otherwise virtual bool isWordWrapEnabled() const = 0; //! Enables or disables newlines. @@ -70,15 +70,15 @@ namespace gui virtual void setMultiLine(bool enable) = 0; //! Checks if multi line editing is enabled - /** \return true if mult-line is enabled, false otherwise */ + //! \return true if mult-line is enabled, false otherwise virtual bool isMultiLineEnabled() const = 0; //! Enables or disables automatic scrolling with cursor position - /** \param enable: If set to true, the text will move around with the cursor position */ + //! \param enable: If set to true, the text will move around with the cursor position virtual void setAutoScroll(bool enable) = 0; //! Checks to see if automatic scrolling is enabled - /** \return true if automatic scrolling is enabled, false if not */ + //! \return true if automatic scrolling is enabled, false if not virtual bool isAutoScrollEnabled() const = 0; //! Sets whether the edit box is a password box. Setting this to true will @@ -91,7 +91,7 @@ namespace gui virtual bool isPasswordBox() const = 0; //! Gets the size area of the text in the edit box - /** \return The size in pixels of the text */ + //! \return Returns the size in pixels of the text virtual core::dimension2di getTextDimension() = 0; //! Sets the maximum amount of characters which may be entered in the box. diff --git a/src/dep/include/irrlicht/IGUIElement.h b/src/dep/include/irrlicht/IGUIElement.h index 7c77add..c896106 100644 --- a/src/dep/include/irrlicht/IGUIElement.h +++ b/src/dep/include/irrlicht/IGUIElement.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -83,7 +83,7 @@ public: //! Sets the relative rectangle of this element. - /** \param r The absolute position to set */ + /** \param r The absolute position to set */ void setRelativePosition(const core::rect& r) { if (Parent) @@ -107,22 +107,22 @@ public: } //! Sets the relative rectangle of this element, maintaining its current width and height - /** \param position The new relative position to set. Width and height will not be changed. */ + /** \param position The new relative position to set. Width and height will not be changed. */ void setRelativePosition(const core::position2di & position) { const core::dimension2di mySize = RelativeRect.getSize(); - const core::rect rectangle(position.X, position.Y, - position.X + mySize.Width, position.Y + mySize.Height); + const core::rect rectangle(position.X, position.Y, + position.X + mySize.Width, position.Y + mySize.Height); setRelativePosition(rectangle); } //! Sets the relative rectangle of this element as a proportion of its parent's area. /** \note This method used to be 'void setRelativePosition(const core::rect& r)' - \param r The rectangle to set, interpreted as a proportion of the parent's area. + \param r The rectangle to set, interpreted as a proportion of the parent's area. Meaningful values are in the range [0...1], unless you intend this element to spill outside its parent. */ - void setRelativePositionProportional(const core::rect& r) + void setRelativePositionProportional(const core::rect& r) { if (!Parent) return; @@ -156,7 +156,7 @@ public: //! Sets whether the element will ignore its parent's clipping rectangle - /** \param noClip If true, the element will not be clipped by its parent's clipping rectangle. */ + /** \param noClip If true, the element will not be clipped by its parent's clipping rectangle. */ void setNotClipped(bool noClip) { NoClip = noClip; @@ -222,6 +222,7 @@ public: { core::rect parentAbsolute(0,0,0,0); core::rect parentAbsoluteClip; + s32 diffx, diffy; f32 fw=0.f, fh=0.f; if (Parent) @@ -239,8 +240,8 @@ public: parentAbsoluteClip = Parent->AbsoluteClippingRect; } - const s32 diffx = parentAbsolute.getWidth() - LastParentRect.getWidth(); - const s32 diffy = parentAbsolute.getHeight() - LastParentRect.getHeight(); + diffx = parentAbsolute.getWidth() - LastParentRect.getWidth(); + diffy = parentAbsolute.getHeight() - LastParentRect.getHeight(); if (AlignLeft == EGUIA_SCALE || AlignRight == EGUIA_SCALE) fw = (f32)parentAbsolute.getWidth(); @@ -344,18 +345,7 @@ public: } - //! Returns the topmost GUI element at the specific position. - /** - This will check this GUI element and all of its descendants, so it - may return this GUI element. To check all GUI elements, call this - function on device->getGUIEnvironment()->getRootGUIElement(). Note - that the root element is the size of the screen, so doing so (with - an on-screen point) will always return the root element if no other - element is above it at that point. - \param point: The point at which to find a GUI element. - \return The topmost GUI element at that point, or 0 if there are - no candidate elements at this point. - */ + //! Returns the child element, which is at the position of the point. IGUIElement* getElementFromPoint(const core::position2d& point) { IGUIElement* target = 0; @@ -366,7 +356,6 @@ public: core::list::Iterator it = Children.getLast(); if (IsVisible) - { while(it != Children.end()) { target = (*it)->getElementFromPoint(point); @@ -375,7 +364,6 @@ public: --it; } - } if (IsVisible && isPointInside(point)) target = this; @@ -385,13 +373,12 @@ public: //! Returns true if a point is within this element. - /** Elements with a shape other than a rectangle should override this method */ + //! Elements with a shape other than a rectangle will override this method virtual bool isPointInside(const core::position2d& point) const { return AbsoluteClippingRect.isPointInside(point); } - //! Adds a GUI element as new child of this element. virtual void addChild(IGUIElement* child) { @@ -483,18 +470,19 @@ public: } - //! Sets whether this control was created as part of its parent. - /** For example, it is true when a scrollbar is part of a listbox. - SubElements are not saved to disk when calling guiEnvironment->saveGUI() */ + //! Sets whether this control was created as part of its parent, + //! for example when a scrollbar is part of a listbox. + //! SubElements are not saved to disk when calling guiEnvironment->saveGUI() virtual void setSubElement(bool subElement) { IsSubElement = subElement; } - //! If set to true, the focus will visit this element when using the tab key to cycle through elements. - /** If this element is a tab group (see isTabGroup/setTabGroup) then - ctrl+tab will be used instead. */ + //! If set to true, the focus will visit this element when using + //! the tab key to cycle through elements. + //! If this element is a tab group (see isTabGroup/setTabGroup) then + //! ctrl+tab will be used instead. void setTabStop(bool enable) { IsTabStop = enable; @@ -509,9 +497,9 @@ public: } - //! Sets the priority of focus when using the tab key to navigate between a group of elements. - /** See setTabGroup, isTabGroup and getTabGroup for information on tab groups. - Elements with a lower number are focused first */ + //! Sets the priority of focus when using the tab key to navigate between a group + //! of elements. See setTabGroup, isTabGroup and getTabGroup for information on tab groups. + //! Elements with a lower number are focused first void setTabOrder(s32 index) { // negative = autonumber @@ -546,9 +534,9 @@ public: } - //! Sets whether this element is a container for a group of elements which can be navigated using the tab key. - /** For example, windows are tab groups. - Groups can be navigated using ctrl+tab, providing isTabStop is true. */ + //! Sets whether this element is a container for a group of elements which + //! can be navigated using the tab key. For example, windows are tab groups. + //! Groups can be navigated using ctrl+tab, providing isTabStop is true. void setTabGroup(bool isGroup) { IsTabGroup = isGroup; @@ -563,7 +551,8 @@ public: } - //! Returns the container element which holds all elements in this element's tab group. + //! Returns the container element which holds all elements in this element's + //! tab group. IGUIElement* getTabGroup() { IGUIElement *ret=this; @@ -640,7 +629,7 @@ public: //! Brings a child to front - /** \return True if successful, false if not. */ + /** \return Returns true if successful, false if not. */ virtual bool bringToFront(IGUIElement* element) { core::list::Iterator it = Children.begin(); @@ -713,13 +702,13 @@ public: //! searches elements to find the closest next element to tab to - /** \param startOrder: The TabOrder of the current element, -1 if none - \param reverse: true if searching for a lower number - \param group: true if searching for a higher one - \param first: element with the highest/lowest known tab order depending on search direction - \param closest: the closest match, depending on tab order and direction - \param includeInvisible: includes invisible elements in the search (default=false) - \return true if successfully found an element, false to continue searching/fail */ + //! \param startOrder: The TabOrder of the current element, -1 if none + //! \param reverse: true if searching for a lower number + //! \param group: true if searching for a higher one + //! \param first: element with the highest/lowest known tab order depending on search direction + //! \param closest: the closest match, depending on tab order and direction + //! \param includeInvisible: includes invisible elements in the search (default=false) + //! \return true if successfully found an element, false to continue searching/fail bool getNextElement(s32 startOrder, bool reverse, bool group, IGUIElement*& first, IGUIElement*& closest, bool includeInvisible=false) const { @@ -816,8 +805,8 @@ public: //! Writes attributes of the scene node. - /** Implement this to expose the attributes of your scene node for - scripting languages, editors, debuggers or xml serialization purposes. */ + //! Implement this to expose the attributes of your scene node for + //! scripting languages, editors, debuggers or xml serialization purposes. virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const { out->addInt("Id", ID ); @@ -839,8 +828,8 @@ public: //! Reads attributes of the scene node. - /** Implement this to set the attributes of your scene node for - scripting languages, editors, debuggers or xml deserialization purposes. */ + //! Implement this to set the attributes of your scene node for + //! scripting languages, editors, debuggers or xml deserialization purposes. virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) { setID(in->getAttributeAsInt("Id")); diff --git a/src/dep/include/irrlicht/IGUIElementFactory.h b/src/dep/include/irrlicht/IGUIElementFactory.h index 1a3a733..d4d7811 100644 --- a/src/dep/include/irrlicht/IGUIElementFactory.h +++ b/src/dep/include/irrlicht/IGUIElementFactory.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IGUIEnvironment.h b/src/dep/include/irrlicht/IGUIEnvironment.h index 5258ab6..2c082f9 100644 --- a/src/dep/include/irrlicht/IGUIEnvironment.h +++ b/src/dep/include/irrlicht/IGUIEnvironment.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -62,7 +62,8 @@ class IGUIEnvironment : public virtual IReferenceCounted { public: - //! Draws all gui elements by traversing the GUI environment starting at the root node. + //! Draws all gui elements by traversing the GUI environment starting + //! at the root node. virtual void drawAll() = 0; //! Sets the focus to an element. @@ -74,7 +75,7 @@ public: virtual bool setFocus(IGUIElement* element) = 0; //! Returns the element which holds the focus. - /** \return Pointer to the element with focus. */ + //! \return Pointer to the element with focus. virtual IGUIElement* getFocus() const = 0; //! Removes the focus from an element. @@ -90,15 +91,15 @@ public: virtual bool hasFocus(IGUIElement* element) const = 0; //! Returns the current video driver. - /** \return Pointer to the video driver. */ + //! \return Pointer to the video driver. virtual video::IVideoDriver* getVideoDriver() const = 0; //! Returns the file system. - /** \return Pointer to the file system. */ + //! \return Pointer to the file system. virtual io::IFileSystem* getFileSystem() const = 0; //! returns a pointer to the OS operator - /** \return Pointer to the OS operator. */ + //! \return Pointer to the OS operator. virtual IOSOperator* getOSOperator() const = 0; //! Removes all elements from the environment. @@ -118,7 +119,7 @@ public: virtual void setUserEventReceiver(IEventReceiver* evr) = 0; //! Returns pointer to the current gui skin. - /** \return Pointer to the GUI skin. */ + //! \return Pointer to the GUI skin. virtual IGUISkin* getSkin() const = 0; //! Sets a new GUI Skin @@ -172,17 +173,17 @@ public: virtual IGUISpriteBank* addEmptySpriteBank(const c8 *name) = 0; //! Returns the root gui element. - /** This is the first gui element, the (direct or indirect) parent of all - other gui elements. It is a valid IGUIElement, with dimensions the same - size as the screen. You should not need to use this method directly, unless - you wish to reparent GUI elements to the top level. + /** This is the first gui element, parent of all other + gui elements. You'll never need to use this method, unless you are + creating your own gui elements, trying to add them to the gui elements + without a parent. \return Pointer to the root element of the GUI. The returned pointer should not be dropped. See IReferenceCounted::drop() for more information. */ virtual IGUIElement* getRootGUIElement() = 0; //! Adds a button element. - /** \param rectangle Rectangle specifying the borders of the button. + /** \param rectangle Position and dimension of the button. \param parent Parent gui element of the button. \param id Id with which the gui element can be identified. \param text Text displayed on the button. @@ -194,7 +195,7 @@ public: IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0, const wchar_t* tooltiptext = 0) = 0; //! Adds an empty window element. - /** \param rectangle Rectangle specifying the borders of the window. + /** \param rectangle Position and dimension of the window. \param modal Defines if the dialog is modal. This means, that all other gui elements which were created before the window cannot be used until it is removed. @@ -207,10 +208,10 @@ public: virtual IGUIWindow* addWindow(const core::rect& rectangle, bool modal = false, const wchar_t* text=0, IGUIElement* parent=0, s32 id=-1) = 0; - //! Adds a modal screen. - /** This control stops its parent's members from being able to receive - input until its last child is removed, it then deletes itself. - \param parent Parent gui element of the modal. + //! Adds a modal screen. This control stops its parent's members from + //! being able to recieve input until its last child is removed, it + //! then deletes itself. + /** \param parent Parent gui element of the modal. \return Pointer to the created modal. Returns 0 if an error occured. This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ @@ -236,7 +237,7 @@ public: //! Adds a scrollbar. /** \param horizontal Specifies if the scroll bar is drawn horizontal or vertical. - \param rectangle Rectangle specifying the borders of the scrollbar. + \param rectangle Position and dimension of the scroll bar. \param parent Parent gui element of the scroll bar. \param id Id to identify the gui element. \return Pointer to the created scrollbar. Returns 0 if an error @@ -262,7 +263,7 @@ public: //! Adds an image element. /** Use IGUIImage::setImage later to set the image to be displayed. - \param rectangle Rectangle specifying the borders of the image. + \param rectangle Position and dimension of the image. \param parent Parent gui element of the image. \param id Id to identify the gui element. \param text Title text of the image. @@ -274,7 +275,7 @@ public: //! Adds a checkbox element. /** \param checked Define the initial state of the check box. - \param rectangle Rectangle specifying the borders of the check box. + \param rectangle Position and dimension of check box. \param parent Parent gui element of the check box. \param id Id to identify the gui element. \param text Title text of the check box. @@ -285,7 +286,7 @@ public: IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0) = 0; //! Adds a list box element. - /** \param rectangle Rectangle specifying the borders of the list box. + /** \param rectangle Position and dimension of list box. \param parent Parent gui element of the list box. \param id Id to identify the gui element. \param drawBackground Flag whether the background should be drawn. @@ -296,7 +297,7 @@ public: IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) = 0; //! Adds a mesh viewer. Not 100% implemented yet. - /** \param rectangle Rectangle specifying the borders of the mesh viewer. + /** \param rectangle Position and dimension of mesh viewer. \param parent Parent gui element of the mesh viewer. \param id Id to identify the gui element. \param text Title text of the mesh viewer. @@ -334,7 +335,7 @@ public: //! Adds a static text. /** \param text Text to be displayed. Can be altered after creation by SetText(). - \param rectangle Rectangle specifying the borders of the static text + \param rectangle Position and dimension of the static text. \param border Set to true if the static text should have a 3d border. \param wordWrap Enable if the text should wrap into multiple lines. \param parent Parent item of the element, e.g. a window. @@ -355,7 +356,7 @@ public: ctrl+X, ctrl+V, ctrl+C, shift+Left, shift+Right, Home, End, and so on. \param text Text to be displayed. Can be altered after creation by setText(). - \param rectangle Rectangle specifying the borders of the edit box. + \param rectangle Position and dimension of the edit box. \param border Set to true if the edit box should have a 3d border. \param parent Parent item of the element, e.g. a window. Set it to 0 to place the edit box directly in the environment. @@ -369,7 +370,7 @@ public: //! Adds a spin box. /** An edit box with up and down buttons \param text Text to be displayed. Can be altered after creation by setText(). - \param rectangle Rectangle specifying the borders of the spin box. + \param rectangle Position and dimension of the spin box. \param parent Parent item of the element, e.g. a window. Set it to 0 to place the spin box directly in the environment. \param id The ID of the element. @@ -380,7 +381,7 @@ public: IGUIElement* parent=0, s32 id=-1) = 0; //! Adds an element for fading in or out. - /** \param rectangle Rectangle specifying the borders of the fader. + /* \param rectangle Rectangle specifying the borders of the element. If the pointer is NULL, the whole screen is used. \param parent Parent item of the element, e.g. a window. \param id An identifier for the fader. @@ -390,7 +391,7 @@ public: virtual IGUIInOutFader* addInOutFader(const core::rect* rectangle=0, IGUIElement* parent=0, s32 id=-1) = 0; //! Adds a tab control to the environment. - /** \param rectangle Rectangle specifying the borders of the tab control. + /** \param rectangle Position and dimension of the tab control. \param parent Parent item of the element, e.g. a window. Set it to 0 to place the tab control directly in the environment. \param fillbackground Specifies if the background of the tab control @@ -410,7 +411,7 @@ public: /** You can use this element to group other elements. This is not used for creating tabs on tab controls, please use IGUITabControl::addTab() for this instead. - \param rectangle Rectangle specifying the borders of the tab. + \param rectangle Position and dimension of the tab. \param parent Parent item of the element, e.g. a window. Set it to 0 to place the tab directly in the environment. \param id An identifier for the tab. @@ -421,8 +422,8 @@ public: IGUIElement* parent=0, s32 id=-1) = 0; //! Adds a context menu to the environment. - /** \param rectangle Rectangle specifying the borders of the menu. - Note that the menu is resizing itself based on what items you add. + /** \param rectangle Position and dimension of the menu. Note that the + menu is resizing itself based on what items you add. \param parent Parent item of the element, e.g. a window. Set it to 0 to place the menu directly in the environment. \param id An identifier for the menu. @@ -455,7 +456,7 @@ public: virtual IGUIToolBar* addToolBar(IGUIElement* parent=0, s32 id=-1) = 0; //! Adds a combo box to the environment. - /** \param rectangle Rectangle specifying the borders of the combo box. + /** \param rectangle Position and dimension of the combo box. \param parent Parent item of the element, e.g. a window. Set it to 0 to place the combo box directly in the environment. \param id An identifier for the combo box. @@ -466,18 +467,10 @@ public: IGUIElement* parent=0, s32 id=-1) = 0; //! Adds a table to the environment - /** \param rectangle Rectangle specifying the borders of the table. - \param parent Parent item of the element, e.g. a window. - Set it to 0 to place the table directly in the environment. - \param id An identifier for the combo box. - \param drawBackground Sets whether to draw the background filled. - \return Pointer to the created table. Returns 0 if an error occured. - This pointer should not be dropped. See IReferenceCounted::drop() for - more information. */ - virtual IGUITable* addTable(const core::rect& rectangle, - IGUIElement* parent=0, s32 id=-1, bool drawBackground=false) =0; + virtual IGUITable* addTable(const core::rect& rectangle, + IGUIElement* parent=0, s32 id=-1, bool drawBackground = false) = 0; - //! Get the default element factory which can create all built-in elements + //! Returns the default element factory which can create all built in elements /** \return Pointer to the factory. This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ @@ -490,45 +483,34 @@ public: \param factoryToAdd Pointer to new factory. */ virtual void registerGUIElementFactory(IGUIElementFactory* factoryToAdd) = 0; - //! Get amount of registered gui element factories. - /** \return Amount of registered gui element factories. */ + //! Returns amount of registered gui element factories. + //! \return Amount of registered gui element factories. virtual u32 getRegisteredGUIElementFactoryCount() const = 0; - //! Get a gui element factory by index - /** \param index Index of the factory. - \return Factory at given index, or 0 if no such factory exists. */ + //! Returns a gui element factory by index virtual IGUIElementFactory* getGUIElementFactory(u32 index) const = 0; - //! Adds a GUI element by its name - /** Each factory is checked if it can create an element of the given - name. The first match will be created. - \param elementName Name of the element to be created. - \param parent Parent of the new element, if not 0. - \return New GUI element, or 0 if no such element exists. */ + //! Adds a GUI Element by its name virtual IGUIElement* addGUIElement(const c8* elementName, IGUIElement* parent=0) = 0; //! Saves the current gui into a file. - /** \param filename Name of the file. - \param start The GUIElement to start with. Root if 0. - \return True if saving succeeded, else false. */ + //! \param filename Name of the file. + //! \param start The GUIElement to start with. Root if 0. virtual bool saveGUI(const c8* filename, IGUIElement* start=0) = 0; //! Saves the current gui into a file. - /** \param file The file to write to. - \param start The GUIElement to start with. Root if 0. - \return True if saving succeeded, else false. */ + //! \param file The file to write to. + //! \param start The GUIElement to start with. Root if 0. virtual bool saveGUI(io::IWriteFile* file, IGUIElement* start=0) = 0; //! Loads the gui. Note that the current gui is not cleared before. - /** \param filename Name of the file . - \param parent Parent for the loaded GUI, root if 0. - \return True if loading succeeded, else false. */ + //! \param filename Name of the file . + //! \param parent Parent for the loaded GUI, root if 0. virtual bool loadGUI(const c8* filename, IGUIElement* parent=0) = 0; //! Loads the gui. Note that the current gui is not cleared before. - /** \param file The file to load from. - \param parent Parent for the loaded GUI, root if 0. - \return True if loading succeeded, else false. */ + //! \param file The file to load from. + //! \param parent Parent for the loaded GUI, root if 0. virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0) = 0; //! Writes attributes of the gui environment diff --git a/src/dep/include/irrlicht/IGUIFileOpenDialog.h b/src/dep/include/irrlicht/IGUIFileOpenDialog.h index 5b7270b..11e3025 100644 --- a/src/dep/include/irrlicht/IGUIFileOpenDialog.h +++ b/src/dep/include/irrlicht/IGUIFileOpenDialog.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IGUIFont.h b/src/dep/include/irrlicht/IGUIFont.h index a3bb59a..25cf18b 100644 --- a/src/dep/include/irrlicht/IGUIFont.h +++ b/src/dep/include/irrlicht/IGUIFont.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -21,13 +21,13 @@ enum EGUI_FONT_TYPE EGFT_BITMAP = 0, //! Scalable vector fonts loaded from an XML file. - /** These fonts reside in system memory and use no video memory - until they are displayed. These are slower than bitmap fonts - but can be easily scaled and rotated. */ + //! These fonts reside in system memory and use no video memory + //! until they are displayed. These are slower than bitmap fonts + //! but can be easily scaled and rotated. EGFT_VECTOR, //! A font which uses a the native API provided by the operating system. - /** Currently not used. */ + //! Currently not used. EGFT_OS, //! An external font type provided by the user. @@ -66,10 +66,8 @@ public: //! Returns the type of this font virtual EGUI_FONT_TYPE getType() const { return EGFT_CUSTOM; } - //! Sets global kerning width for the font. + //! Sets global kerning for the font. virtual void setKerningWidth (s32 kerning) = 0; - - //! Sets global kerning height for the font. virtual void setKerningHeight (s32 kerning) = 0; //! Gets kerning values (distance between letters) for the font. If no parameters are provided, diff --git a/src/dep/include/irrlicht/IGUIFontBitmap.h b/src/dep/include/irrlicht/IGUIFontBitmap.h index 152ca10..b348788 100644 --- a/src/dep/include/irrlicht/IGUIFontBitmap.h +++ b/src/dep/include/irrlicht/IGUIFontBitmap.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IGUIImage.h b/src/dep/include/irrlicht/IGUIImage.h index 55e6247..566719e 100644 --- a/src/dep/include/irrlicht/IGUIImage.h +++ b/src/dep/include/irrlicht/IGUIImage.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IGUIInOutFader.h b/src/dep/include/irrlicht/IGUIInOutFader.h index 3732418..18357c1 100644 --- a/src/dep/include/irrlicht/IGUIInOutFader.h +++ b/src/dep/include/irrlicht/IGUIInOutFader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -36,23 +36,22 @@ namespace gui virtual video::SColor getColor() const = 0; //! Sets the color to fade out to or to fade in from. - /** \param color: Color to where it is faded out od from it is faded in. */ + //! \param color: Color to where it is faded out od from it is faded in. virtual void setColor(video::SColor color) = 0; virtual void setColor(video::SColor source, video::SColor dest) = 0; - //! Starts the fade in process. - /** In the beginning the whole rect is drawn by the set color - (black by default) and at the end of the overgiven time the - color has faded out. - \param time: Time specifing how long it should need to fade in, - in milliseconds. */ + //! Starts the fade in process. In the beginning the whole rect is drawn by + //! the set color (black by default) and at the end of the overgiven + //! time the color has faded out. + //! \param time: Time specifing how long it should need to fade in, + //! in milliseconds. virtual void fadeIn(u32 time) = 0; - //! Starts the fade out process. - /** In the beginning everything is visible, and at the end of - the time only the set color (black by the fault) will be drawn. - \param time: Time specifing how long it should need to fade out, - in milliseconds. */ + //! Starts the fade out process. In the beginning everything is visible, + //! and at the end of the time only the set color (black by the fault) + //! will be drawn. + //! \param time: Time specifing how long it should need to fade out, + //! in milliseconds. virtual void fadeOut(u32 time) = 0; //! Returns if the fade in or out process is done. diff --git a/src/dep/include/irrlicht/IGUIListBox.h b/src/dep/include/irrlicht/IGUIListBox.h index 26fa089..40adcc9 100644 --- a/src/dep/include/irrlicht/IGUIListBox.h +++ b/src/dep/include/irrlicht/IGUIListBox.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -12,6 +12,7 @@ namespace irr { namespace gui { + class IGUIFont; class IGUISpriteBank; //! Enumeration for listbox colors @@ -48,9 +49,10 @@ namespace gui virtual u32 addItem(const wchar_t* text) = 0; //! adds an list item with an icon - /** \param text Text of list entry - \param icon Sprite index of the Icon within the current sprite bank. Set it to -1 if you want no icon - \return The id of the new created item */ + //! \param text Text of list entry + //! \param icon Sprite index of the Icon within the current sprite bank. Set it to -1 if you want no icon + //! \return + //! returns the id of the new created item virtual u32 addItem(const wchar_t* text, s32 icon) = 0; //! Removes an item from the list @@ -59,11 +61,10 @@ namespace gui //! Returns the icon of an item virtual s32 getIcon(u32 index) const = 0; - //! Sets the sprite bank which should be used to draw list icons. - /** This font is set to the sprite bank of the built-in-font by - default. A sprite can be displayed in front of every list item. - An icon is an index within the icon sprite bank. Several - default icons are available in the skin through getIcon. */ + //! Sets the sprite bank which should be used to draw list icons. This font is set to the sprite bank of + //! the built-in-font by default. A sprite can be displayed in front of every list item. + //! An icon is an index within the icon sprite bank. Several default icons are available in the + //! skin through getIcon virtual void setSpriteBank(IGUISpriteBank* bank) = 0; //! clears the list, deletes all items in the listbox @@ -75,7 +76,8 @@ namespace gui //! sets the selected item. Set this to -1 if no item should be selected virtual void setSelected(s32 index) = 0; - //! set whether the listbox should scroll to new or newly selected items + //! set whether the listbox should scroll to show a newly selected item + //! or a new item as it is added to the list. virtual void setAutoScrollEnabled(bool scroll) = 0; //! returns true if automatic scrolling is enabled, false if not. @@ -106,7 +108,7 @@ namespace gui virtual void setItem(u32 index, const wchar_t* text, s32 icon) = 0; //! Insert the item at the given index - /** \return The index on success or -1 on failure. */ + //! Return the index on success or -1 on failure. virtual s32 insertItem(u32 index, const wchar_t* text, s32 icon) = 0; //! Swap the items at the given indices diff --git a/src/dep/include/irrlicht/IGUIMeshViewer.h b/src/dep/include/irrlicht/IGUIMeshViewer.h index 5bc499f..a1dd39b 100644 --- a/src/dep/include/irrlicht/IGUIMeshViewer.h +++ b/src/dep/include/irrlicht/IGUIMeshViewer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IGUIScrollBar.h b/src/dep/include/irrlicht/IGUIScrollBar.h index 9b60e1f..cbcb35c 100644 --- a/src/dep/include/irrlicht/IGUIScrollBar.h +++ b/src/dep/include/irrlicht/IGUIScrollBar.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -30,17 +30,15 @@ namespace gui //! gets the small step value virtual s32 getSmallStep() const = 0; - //! Sets the small step - /** That is the amount that the value changes by when clicking - on the buttons or using the cursor keys. */ + //! Sets the small step, the amount that the value changes by when clicking + //! on the buttons or using the cursor keys. virtual void setSmallStep(s32 step) = 0; //! gets the large step value virtual s32 getLargeStep() const = 0; - //! Sets the large step - /** That is the amount that the value changes by when clicking - in the tray, or using the page up and page down keys. */ + //! Sets the large step, the amount that the value changes by when clicking + //! in the tray, or using the page up and page down keys. virtual void setLargeStep(s32 step) = 0; //! gets the current position of the scrollbar diff --git a/src/dep/include/irrlicht/IGUISkin.h b/src/dep/include/irrlicht/IGUISkin.h index e79df2b..3b86b4d 100644 --- a/src/dep/include/irrlicht/IGUISkin.h +++ b/src/dep/include/irrlicht/IGUISkin.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -460,8 +460,7 @@ namespace gui implementations to find out how to draw the part exactly. \param active: Specifies if the tab is currently active. \param rect: Defining area where to draw. - \param clip: Clip area. - \param alignment Alignment of GUI element. */ + \param clip: Clip area. */ virtual void draw3DTabButton(IGUIElement* element, bool active, const core::rect& rect, const core::rect* clip=0, gui::EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT) = 0; @@ -472,9 +471,7 @@ namespace gui \param border: Specifies if the border should be drawn. \param background: Specifies if the background should be drawn. \param rect: Defining area where to draw. - \param clip: Clip area. - \param tabHeight Height of tab. - \param alignment Alignment of GUI element. */ + \param clip: Clip area. */ virtual void draw3DTabBody(IGUIElement* element, bool border, bool background, const core::rect& rect, const core::rect* clip=0, s32 tabHeight=-1, gui::EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT ) = 0; @@ -514,3 +511,6 @@ namespace gui #endif + + + diff --git a/src/dep/include/irrlicht/IGUISpinBox.h b/src/dep/include/irrlicht/IGUISpinBox.h index 36c67ab..f8dafbe 100644 --- a/src/dep/include/irrlicht/IGUISpinBox.h +++ b/src/dep/include/irrlicht/IGUISpinBox.h @@ -1,4 +1,4 @@ -// Copyright (C) 2006-2009 Michael Zeilfelder +// Copyright (C) 2006-2008 Michael Zeilfelder // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IGUISpriteBank.h b/src/dep/include/irrlicht/IGUISpriteBank.h index 0a4032d..df46002 100644 --- a/src/dep/include/irrlicht/IGUISpriteBank.h +++ b/src/dep/include/irrlicht/IGUISpriteBank.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IGUIStaticText.h b/src/dep/include/irrlicht/IGUIStaticText.h index 18cc244..b207b0f 100644 --- a/src/dep/include/irrlicht/IGUIStaticText.h +++ b/src/dep/include/irrlicht/IGUIStaticText.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -29,7 +29,7 @@ namespace gui virtual void setOverrideFont(IGUIFont* font=0) = 0; //! Gets the override font (if any) - /** \return The override font (may be 0) */ + //! \return The override font (may be 0) virtual IGUIFont* getOverrideFont(void) const = 0; //! Sets another color for the text. @@ -43,7 +43,7 @@ namespace gui virtual void setOverrideColor(video::SColor color) = 0; //! Gets the override color - /** \return: The override color */ + //! \return: The override color virtual video::SColor const& getOverrideColor(void) const = 0; //! Sets if the static text should use the overide color or the color in the gui skin. @@ -53,7 +53,7 @@ namespace gui virtual void enableOverrideColor(bool enable) = 0; //! Checks if an override color is enabled - /** \return true if the override color is enabled, false otherwise */ + //! \return true if the override color is enabled, false otherwise virtual bool isOverrideColorEnabled(void) const = 0; //! Sets another color for the background. @@ -78,7 +78,7 @@ namespace gui virtual void setWordWrap(bool enable) = 0; //! Checks if word wrap is enabled - /** \return true if word wrap is enabled, false otherwise */ + //! \return true if word wrap is enabled, false otherwise virtual bool isWordWrapEnabled(void) const = 0; //! Returns the height of the text in pixels when it is drawn. diff --git a/src/dep/include/irrlicht/IGUITabControl.h b/src/dep/include/irrlicht/IGUITabControl.h index b106d6d..3725172 100644 --- a/src/dep/include/irrlicht/IGUITabControl.h +++ b/src/dep/include/irrlicht/IGUITabControl.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -87,7 +87,7 @@ namespace gui virtual s32 getTabHeight() const = 0; //! Set the alignment of the tabs - /** Use EGUIA_UPPERLEFT or EGUIA_LOWERRIGHT */ + //! Use EGUIA_UPPERLEFT or EGUIA_LOWERRIGHT virtual void setTabVerticalAlignment( gui::EGUI_ALIGNMENT alignment ) = 0; //! Get the alignment of the tabs @@ -108,3 +108,7 @@ namespace gui #endif + + + + diff --git a/src/dep/include/irrlicht/IGUITable.h b/src/dep/include/irrlicht/IGUITable.h new file mode 100644 index 0000000..86f6f70 --- /dev/null +++ b/src/dep/include/irrlicht/IGUITable.h @@ -0,0 +1,192 @@ +// Copyright (C) 2003-2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#ifndef __I_GUI_TABLE_H_INCLUDED__ +#define __I_GUI_TABLE_H_INCLUDED__ + +#include "IGUIElement.h" +#include "irrTypes.h" +#include "SColor.h" +#include "IGUISkin.h" + +namespace irr +{ +namespace gui +{ + + //! modes for ordering used when a column header is clicked + enum EGUI_COLUMN_ORDERING + { + //! Do not use ordering + EGCO_NONE, + + //! Send a EGET_TABLE_HEADER_CHANGED message when a column header is clicked. + EGCO_CUSTOM, + + //! Sort it ascending by it's ascii value like: a,b,c,... + EGCO_ASCENDING, + + //! Sort it descending by it's ascii value like: z,x,y,... + EGCO_DESCENDING, + + //! Sort it ascending on first click, descending on next, etc + EGCO_FLIP_ASCENDING_DESCENDING, + + //! Not used as mode, only to get maximum value for this enum + EGCO_COUNT + }; + + //! Names for EGUI_COLUMN_ORDERING types + const c8* const GUIColumnOrderingNames[] = + { + "none", + "custom", + "ascend", + "descend", + "ascend_descend", + 0, + }; + + enum EGUI_ORDERING_MODE + { + //! No element ordering + EGOM_NONE, + + //! Elements are ordered from the smallest to the largest. + EGOM_ASCENDING, + + //! Elements are ordered from the largest to the smallest. + EGOM_DESCENDING, + + //! this value is not used, it only specifies the amount of default ordering types + //! available. + EGOM_COUNT + }; + + const c8* const GUIOrderingModeNames[] = + { + "ascending", + "descending", + 0 + }; + + enum EGUI_TABLE_DRAW_FLAGS + { + EGTDF_ROWS = 1, + EGTDF_COLUMNS = 2, + EGTDF_ACTIVE_ROW = 4, + EGTDF_COUNT + }; + + class IGUIFont; + + //! Default list box GUI element. + class IGUITable : public IGUIElement + { + public: + //! constructor + IGUITable(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect rectangle) + : IGUIElement(EGUIET_TABLE, environment, parent, id, rectangle) {} + + //! Adds a column + //! If columnIndex is outside the current range, do push new colum at the end + virtual void addColumn(const wchar_t* caption, s32 columnIndex=-1) = 0; + + //! remove a column from the table + virtual void removeColumn(u32 columnIndex) = 0; + + //! Returns the number of columns in the table control + virtual s32 getColumnCount() const = 0; + + //! Makes a column active. This will trigger an ordering process. + /** \param idx: The id of the column to make active. + //! \param doOrder: Do also the ordering which depending on mode for active column + \return Returns true if successful. */ + virtual bool setActiveColumn(s32 idx, bool doOrder=false) = 0; + + //! Returns which header is currently active + virtual s32 getActiveColumn() const = 0; + + //! Returns the ordering used by the currently active column + virtual EGUI_ORDERING_MODE getActiveColumnOrdering() const = 0; + + //! Set the width of a column + virtual void setColumnWidth(u32 columnIndex, u32 width) = 0; + + //! columns can be resized by drag 'n drop + virtual void setResizableColumns(bool resizable) = 0; + + //! can columns be resized by dran 'n drop? + virtual bool hasResizableColumns() const = 0; + + //! This tells the table control which ordering mode should be used when + //! a column header is clicked. + /** \param columnIndex: The index of the column header. + \param state: If true, a EGET_TABLE_HEADER_CHANGED message will be sent and you can order the table data as you whish.*/ + //! \param mode: One of the modes defined in EGUI_COLUMN_ORDERING + virtual void setColumnOrdering(u32 columnIndex, EGUI_COLUMN_ORDERING mode) = 0; + + //! Returns which row is currently selected + virtual s32 getSelected() const = 0; + + //! Returns amount of rows in the tabcontrol + virtual s32 getRowCount() const = 0; + + //! adds a row to the table + /** \param rowIndex: zero based index of rows. The row will be inserted at this + position, if a row already exist there, it will be placed after it. If the row + is larger than the actual number of row by more than one, it won't be created. + Note that if you create a row that's not at the end, there might be performance issues*/ + virtual void addRow(u32 rowIndex) = 0; + + //! Remove a row from the table + virtual void removeRow(u32 rowIndex) = 0; + + //! clears the table rows, but keeps the columns intact + virtual void clearRows() = 0; + + //! Swap two row positions. This is useful for a custom ordering algo. + virtual void swapRows(u32 rowIndexA, u32 rowIndexB) = 0; + + //! This tells the table to start ordering all the rows. You need to explicitly + //! tell the table to re order the rows when a new row is added or the cells data is + //! changed. This makes the system more flexible and doesn't make you pay the cost of + //! ordering when adding a lot of rows. + //! \param columnIndex: When set to -1 the active column is used. + virtual void orderRows(s32 columnIndex=-1, EGUI_ORDERING_MODE mode=EGOM_NONE) = 0; + + //! Set the text of a cell + virtual void setCellText(u32 rowIndex, u32 columnIndex, const wchar_t* text) = 0; + + //! Set the text of a cell, and set a color of this cell. + virtual void setCellText(u32 rowIndex, u32 columnIndex, const wchar_t* text, video::SColor color) = 0; + + //! Set the data of a cell + virtual void setCellData(u32 rowIndex, u32 columnIndex, void *data) = 0; + + //! Set the color of a cell text + virtual void setCellColor(u32 rowIndex, u32 columnIndex, video::SColor color) = 0; + + //! Get the text of a cell + virtual const wchar_t* getCellText(u32 rowIndex, u32 columnIndex ) const = 0; + + //! Get the data of a cell + virtual void* getCellData(u32 rowIndex, u32 columnIndex ) const = 0; + + //! clears the table, deletes all items in the table + virtual void clear() = 0; + + //! Set flags, as defined in EGUI_TABLE_DRAW_FLAGS, which influence the layout + virtual void setDrawFlags(s32 flags) = 0; + + //! Get the flags, as defined in EGUI_TABLE_DRAW_FLAGS, which influence the layout + virtual s32 getDrawFlags() const = 0; + }; + + +} // end namespace gui +} // end namespace irr + +#endif + diff --git a/src/dep/include/irrlicht/IGUIToolbar.h b/src/dep/include/irrlicht/IGUIToolbar.h index 962d624..f70fb28 100644 --- a/src/dep/include/irrlicht/IGUIToolbar.h +++ b/src/dep/include/irrlicht/IGUIToolbar.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IGUIWindow.h b/src/dep/include/irrlicht/IGUIWindow.h index b23aca0..761cbef 100644 --- a/src/dep/include/irrlicht/IGUIWindow.h +++ b/src/dep/include/irrlicht/IGUIWindow.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IImage.h b/src/dep/include/irrlicht/IImage.h index 5432511..6bb2e21 100644 --- a/src/dep/include/irrlicht/IImage.h +++ b/src/dep/include/irrlicht/IImage.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IImageLoader.h b/src/dep/include/irrlicht/IImageLoader.h index f252776..f4f81b8 100644 --- a/src/dep/include/irrlicht/IImageLoader.h +++ b/src/dep/include/irrlicht/IImageLoader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IImageWriter.h b/src/dep/include/irrlicht/IImageWriter.h index bf62201..17759e8 100644 --- a/src/dep/include/irrlicht/IImageWriter.h +++ b/src/dep/include/irrlicht/IImageWriter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IIndexBuffer.h b/src/dep/include/irrlicht/IIndexBuffer.h new file mode 100644 index 0000000..a2fe01d --- /dev/null +++ b/src/dep/include/irrlicht/IIndexBuffer.h @@ -0,0 +1,65 @@ +// Copyright (C) 2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#ifndef __I_INDEX_BUFFER_H_INCLUDED__ +#define __I_INDEX_BUFFER_H_INCLUDED__ + +#include "IReferenceCounted.h" +#include "irrArray.h" + +#include "SVertexIndex.h" + +namespace irr +{ + +namespace video +{ + +} + +namespace scene +{ + + class IIndexBuffer : public virtual IReferenceCounted + { + public: + + virtual void* getData() =0; + + virtual video::E_INDEX_TYPE getType() const =0; + virtual void setType(video::E_INDEX_TYPE IndexType) =0; + + virtual u32 stride() const =0; + + virtual u32 size() const =0; + virtual void push_back (const u32 &element) =0; + virtual u32 operator [](u32 index) const =0; + virtual u32 getLast() =0; + virtual void setValue(u32 index, u32 value) =0; + virtual void set_used(u32 usedNow) =0; + virtual void reallocate(u32 new_size) =0; + virtual u32 allocated_size() const=0; + + virtual void* pointer() =0; + + //! get the current hardware mapping hint + virtual E_HARDWARE_MAPPING getHardwareMappingHint() const =0; + + //! set the hardware mapping hint, for driver + virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint ) =0; + + //! flags the meshbuffer as changed, reloads hardware buffers + virtual void setDirty() = 0; + + //! Get the currently used ID for identification of changes. + /** This shouldn't be used for anything outside the VideoDriver. */ + virtual u32 getChangedID() const = 0; + }; + + +} // end namespace scene +} // end namespace irr + +#endif + diff --git a/src/dep/include/irrlicht/ILightSceneNode.h b/src/dep/include/irrlicht/ILightSceneNode.h index 0c0f553..3bc89c0 100644 --- a/src/dep/include/irrlicht/ILightSceneNode.h +++ b/src/dep/include/irrlicht/ILightSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/ILogger.h b/src/dep/include/irrlicht/ILogger.h index bedfa8a..4377b1b 100644 --- a/src/dep/include/irrlicht/ILogger.h +++ b/src/dep/include/irrlicht/ILogger.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IMaterialRenderer.h b/src/dep/include/irrlicht/IMaterialRenderer.h index b9396d5..1adc8b5 100644 --- a/src/dep/include/irrlicht/IMaterialRenderer.h +++ b/src/dep/include/irrlicht/IMaterialRenderer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IMaterialRendererServices.h b/src/dep/include/irrlicht/IMaterialRendererServices.h index fc72648..0670e69 100644 --- a/src/dep/include/irrlicht/IMaterialRendererServices.h +++ b/src/dep/include/irrlicht/IMaterialRendererServices.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IMesh.h b/src/dep/include/irrlicht/IMesh.h index 17109bf..44820da 100644 --- a/src/dep/include/irrlicht/IMesh.h +++ b/src/dep/include/irrlicht/IMesh.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -15,37 +15,36 @@ namespace scene { class IMeshBuffer; - //! Class which holds the geometry of an object. + //! Class for accessing a mesh with multiple mesh buffers. /** An IMesh is nothing more than a collection of some mesh buffers (IMeshBuffer). SMesh is a simple implementation of an IMesh. - A mesh is usually added to an IMeshSceneNode in order to be rendered. */ class IMesh : public virtual IReferenceCounted { public: - //! Get the amount of mesh buffers. - /** \return Amount of mesh buffers (IMeshBuffer) in this mesh. */ + //! Returns the amount of mesh buffers. + /** \return Returns the amount of mesh buffers (IMeshBuffer) in this mesh. */ virtual u32 getMeshBufferCount() const = 0; - //! Get pointer to a mesh buffer. + //! Returns pointer to a mesh buffer. /** \param nr: Zero based index of the mesh buffer. The maximum value is getMeshBufferCount() - 1; - \return Pointer to the mesh buffer or 0 if there is no such - mesh buffer. */ + \return Returns the pointer to the mesh buffer or + NULL if there is no such mesh buffer. */ virtual IMeshBuffer* getMeshBuffer(u32 nr) const = 0; - //! Get pointer to a mesh buffer which fits a material + //! Returns pointer to a mesh buffer which fits a material /** \param material: material to search for - \return Pointer to the mesh buffer or 0 if there is no such - mesh buffer. */ + \return Returns the pointer to the mesh buffer or + NULL if there is no such mesh buffer. */ virtual IMeshBuffer* getMeshBuffer( const video::SMaterial &material) const = 0; - //! Get an axis aligned bounding box of the mesh. - /** \return Bounding box of this mesh. */ + //! Returns an axis aligned bounding box of the mesh. + /** \return A bounding box of this mesh is returned. */ virtual const core::aabbox3d& getBoundingBox() const = 0; - //! Set user-defined axis aligned bounding box + //! set user axis aligned bounding box /** \param box New bounding box to use for the mesh. */ virtual void setBoundingBox( const core::aabbox3df& box) = 0; @@ -54,17 +53,10 @@ namespace scene \param newvalue: New value to set in all materials. */ virtual void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue) = 0; - //! Set the hardware mapping hint - /** This methods allows to define optimization hints for the - hardware. This enables, e.g., the use of hardware buffers on - pltforms that support this feature. This can lead to noticeable - performance gains. */ - virtual void setHardwareMappingHint(E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX) = 0; + //! set the hardware mapping hint, for driver + virtual void setHardwareMappingHint( E_HARDWARE_MAPPING newMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX ) = 0; - //! Flag the meshbuffer as changed, reloads hardware buffers - /** This method has to be called every time the vertices or - indices have changed. Otherwise, changes won't be updated - on the GPU in the next render cycle. */ + //! flags the meshbuffer as changed, reloads hardware buffers virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX) = 0; }; diff --git a/src/dep/include/irrlicht/IMeshBuffer.h b/src/dep/include/irrlicht/IMeshBuffer.h index 51947cf..3fee873 100644 --- a/src/dep/include/irrlicht/IMeshBuffer.h +++ b/src/dep/include/irrlicht/IMeshBuffer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -56,23 +56,13 @@ namespace scene EPT_POINT_SPRITES }; - //! Struct for holding a mesh with a single material. - /** A part of an IMesh which has the same material on each face of that - group. Logical groups of an IMesh need not be put into separate mesh - buffers, but can be. Separately animated parts of the mesh must be put - into separate mesh buffers. - Some mesh buffer implementations have limitations on the number of - vertices the buffer can hold. In that case, logical grouping can help. - Moreover, the number of vertices should be optimized for the GPU upload, - which often depends on the type of gfx card. Typial figures are - 1000-10000 vertices per buffer. - SMeshBuffer is a simple implementation of a MeshBuffer, which supports - up to 65535 vertices. + //! Struct for holding a mesh with a single material + /** SMeshBuffer is a simple implementation of a MeshBuffer. Since meshbuffers are used for drawing, and hence will be exposed to the driver, chances are high that they are grab()'ed from somewhere. It's therefore required to dynamically allocate meshbuffers which are - passed to a video driver and only drop the buffer once it's not used in + passed to a video driver and only drop hte buffer once it's not used in the current code block anymore. */ class IMeshBuffer : public virtual IReferenceCounted diff --git a/src/dep/include/irrlicht/IMeshCache.h b/src/dep/include/irrlicht/IMeshCache.h index 4c6837b..b2f293a 100644 --- a/src/dep/include/irrlicht/IMeshCache.h +++ b/src/dep/include/irrlicht/IMeshCache.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IMeshLoader.h b/src/dep/include/irrlicht/IMeshLoader.h index 5b26358..9d30ac8 100644 --- a/src/dep/include/irrlicht/IMeshLoader.h +++ b/src/dep/include/irrlicht/IMeshLoader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IMeshManipulator.h b/src/dep/include/irrlicht/IMeshManipulator.h index a667384..512e33e 100644 --- a/src/dep/include/irrlicht/IMeshManipulator.h +++ b/src/dep/include/irrlicht/IMeshManipulator.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -79,10 +79,10 @@ namespace scene /** \param mesh Mesh on which the operation is performed. \param factor Vector which defines the scale for each axis. \param level Number of texture coord, starting from 1. Support for level 2 exists for LightMap buffers. */ - virtual void scaleTCoords(scene::IMesh* mesh, const core::vector2df& factor, u32 level=1) const =0; + virtual void scaleTCoords(scene::IMesh* mesh, const core::vector2df& factor, u32 layer=1) const =0; //! Scale the texture coords of a meshbuffer. - /** \param buffer Meshbuffer on which the operation is performed. + /** \param mesh Mesh on which the operation is performed. \param factor Vector which defines the scale for each axis. \param level Number of texture coord, starting from 1. Support for level 2 exists for LightMap buffers. */ virtual void scaleTCoords(scene::IMeshBuffer* buffer, const core::vector2df& factor, u32 level=1) const =0; @@ -106,8 +106,8 @@ namespace scene //! Clones a static IMesh into a modifiable SMesh. /** All meshbuffers in the returned SMesh are of type SMeshBuffer or SMeshBufferLightMap. - \param mesh Mesh to copy. - \return Cloned mesh. If you no longer need the + \param mesh: Mesh to copy. + \return Returns the cloned mesh. If you no longer need the cloned mesh, you should call SMesh::drop(). See IReferenceCounted::drop() for more information. */ virtual SMesh* createMeshCopy(IMesh* mesh) const = 0; diff --git a/src/dep/include/irrlicht/IMeshSceneNode.h b/src/dep/include/irrlicht/IMeshSceneNode.h index 77fc9ba..c6df634 100644 --- a/src/dep/include/irrlicht/IMeshSceneNode.h +++ b/src/dep/include/irrlicht/IMeshSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IMeshWriter.h b/src/dep/include/irrlicht/IMeshWriter.h index 9b8f095..79e7dde 100644 --- a/src/dep/include/irrlicht/IMeshWriter.h +++ b/src/dep/include/irrlicht/IMeshWriter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IMetaTriangleSelector.h b/src/dep/include/irrlicht/IMetaTriangleSelector.h index a4e07a4..ba7dee7 100644 --- a/src/dep/include/irrlicht/IMetaTriangleSelector.h +++ b/src/dep/include/irrlicht/IMetaTriangleSelector.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IOSOperator.h b/src/dep/include/irrlicht/IOSOperator.h index 3bc1737..bf5f0bc 100644 --- a/src/dep/include/irrlicht/IOSOperator.h +++ b/src/dep/include/irrlicht/IOSOperator.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IParticleAffector.h b/src/dep/include/irrlicht/IParticleAffector.h index 7843c91..3af8452 100644 --- a/src/dep/include/irrlicht/IParticleAffector.h +++ b/src/dep/include/irrlicht/IParticleAffector.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IParticleAnimatedMeshSceneNodeEmitter.h b/src/dep/include/irrlicht/IParticleAnimatedMeshSceneNodeEmitter.h index f29b26a..608af5c 100644 --- a/src/dep/include/irrlicht/IParticleAnimatedMeshSceneNodeEmitter.h +++ b/src/dep/include/irrlicht/IParticleAnimatedMeshSceneNodeEmitter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IParticleAttractionAffector.h b/src/dep/include/irrlicht/IParticleAttractionAffector.h index 3ac8149..3a8d5eb 100644 --- a/src/dep/include/irrlicht/IParticleAttractionAffector.h +++ b/src/dep/include/irrlicht/IParticleAttractionAffector.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IParticleBoxEmitter.h b/src/dep/include/irrlicht/IParticleBoxEmitter.h index 5dd1e8a..350253a 100644 --- a/src/dep/include/irrlicht/IParticleBoxEmitter.h +++ b/src/dep/include/irrlicht/IParticleBoxEmitter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IParticleCylinderEmitter.h b/src/dep/include/irrlicht/IParticleCylinderEmitter.h index ed66448..1f88cd8 100644 --- a/src/dep/include/irrlicht/IParticleCylinderEmitter.h +++ b/src/dep/include/irrlicht/IParticleCylinderEmitter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IParticleEmitter.h b/src/dep/include/irrlicht/IParticleEmitter.h index 02c8698..5c2173b 100644 --- a/src/dep/include/irrlicht/IParticleEmitter.h +++ b/src/dep/include/irrlicht/IParticleEmitter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IParticleFadeOutAffector.h b/src/dep/include/irrlicht/IParticleFadeOutAffector.h index 54f14da..09a5f4c 100644 --- a/src/dep/include/irrlicht/IParticleFadeOutAffector.h +++ b/src/dep/include/irrlicht/IParticleFadeOutAffector.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IParticleGravityAffector.h b/src/dep/include/irrlicht/IParticleGravityAffector.h index 45b6da3..5fd4984 100644 --- a/src/dep/include/irrlicht/IParticleGravityAffector.h +++ b/src/dep/include/irrlicht/IParticleGravityAffector.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IParticleMeshEmitter.h b/src/dep/include/irrlicht/IParticleMeshEmitter.h index 69761fa..30034cf 100644 --- a/src/dep/include/irrlicht/IParticleMeshEmitter.h +++ b/src/dep/include/irrlicht/IParticleMeshEmitter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IParticleRingEmitter.h b/src/dep/include/irrlicht/IParticleRingEmitter.h index 9c3c6b5..37078f4 100644 --- a/src/dep/include/irrlicht/IParticleRingEmitter.h +++ b/src/dep/include/irrlicht/IParticleRingEmitter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IParticleRotationAffector.h b/src/dep/include/irrlicht/IParticleRotationAffector.h index 58c743f..738316d 100644 --- a/src/dep/include/irrlicht/IParticleRotationAffector.h +++ b/src/dep/include/irrlicht/IParticleRotationAffector.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IParticleSphereEmitter.h b/src/dep/include/irrlicht/IParticleSphereEmitter.h index bc1b6ee..c008e8e 100644 --- a/src/dep/include/irrlicht/IParticleSphereEmitter.h +++ b/src/dep/include/irrlicht/IParticleSphereEmitter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IParticleSystemSceneNode.h b/src/dep/include/irrlicht/IParticleSystemSceneNode.h index 5835ca0..80268e5 100644 --- a/src/dep/include/irrlicht/IParticleSystemSceneNode.h +++ b/src/dep/include/irrlicht/IParticleSystemSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IQ3LevelMesh.h b/src/dep/include/irrlicht/IQ3LevelMesh.h index 2f5948c..19041e8 100644 --- a/src/dep/include/irrlicht/IQ3LevelMesh.h +++ b/src/dep/include/irrlicht/IQ3LevelMesh.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IQ3Shader.h b/src/dep/include/irrlicht/IQ3Shader.h index 4b921ed..4c0dcf3 100644 --- a/src/dep/include/irrlicht/IQ3Shader.h +++ b/src/dep/include/irrlicht/IQ3Shader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2006-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2006-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IReadFile.h b/src/dep/include/irrlicht/IReadFile.h index 78d7670..0abbf13 100644 --- a/src/dep/include/irrlicht/IReadFile.h +++ b/src/dep/include/irrlicht/IReadFile.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IReferenceCounted.h b/src/dep/include/irrlicht/IReferenceCounted.h index c4c9eec..74397a7 100644 --- a/src/dep/include/irrlicht/IReferenceCounted.h +++ b/src/dep/include/irrlicht/IReferenceCounted.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/ISceneCollisionManager.h b/src/dep/include/irrlicht/ISceneCollisionManager.h index 8b3027d..8d2b822 100644 --- a/src/dep/include/irrlicht/ISceneCollisionManager.h +++ b/src/dep/include/irrlicht/ISceneCollisionManager.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/ISceneManager.h b/src/dep/include/irrlicht/ISceneManager.h index 39d4e34..c0b3c36 100644 --- a/src/dep/include/irrlicht/ISceneManager.h +++ b/src/dep/include/irrlicht/ISceneManager.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -144,7 +144,7 @@ namespace scene //! Destructor virtual ~ISceneManager() {} - //! Get pointer to an animateable mesh. Loads the file if not loaded already. + //! Returns pointer to an animateable mesh. Loads the file if not loaded already. /** * If you want to remove a loaded mesh from the cache again, use removeMesh(). * Currently there are the following mesh formats supported: @@ -329,12 +329,13 @@ namespace scene * If you would like to implement and add your own file format loader to Irrlicht, * see addExternalMeshLoader(). * \param filename: Filename of the mesh to load. - * \return Null if failed, otherwise pointer to the mesh. + * \return Returns NULL if failed and the pointer to the mesh if + * successful. * This pointer should not be dropped. See IReferenceCounted::drop() for more information. **/ virtual IAnimatedMesh* getMesh(const c8* filename) = 0; - //! Get pointer to an animateable mesh. Loads the file if not loaded already. + //! Returns pointer to an animateable mesh. Loads the file if not loaded already. /** Works just as getMesh(const char* filename). If you want to remove a loaded mesh from the cache again, use removeMesh(). \param file File handle of the mesh to load. @@ -343,23 +344,24 @@ namespace scene IReferenceCounted::drop() for more information. */ virtual IAnimatedMesh* getMesh(io::IReadFile* file) = 0; - //! Get interface to the mesh cache which is shared beween all existing scene managers. + //! Returns an interface to the mesh cache which is shared beween all existing scene managers. /** With this interface, it is possible to manually add new loaded meshes (if ISceneManager::getMesh() is not sufficient), to remove them and to iterate through already loaded meshes. */ virtual IMeshCache* getMeshCache() = 0; - //! Get the video driver. - /** \return Pointer to the video Driver. + //! Returns the video driver. + /** \return Returns pointer to the video Driver. This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ virtual video::IVideoDriver* getVideoDriver() = 0; - //! Get the active GUIEnvironment - /** \return Pointer to the GUIEnvironment + //! Returns the active GUIEnvironment + /** \return Returns pointer to the GUIEnvironment This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ virtual gui::IGUIEnvironment* getGUIEnvironment() = 0; //! adds Volume Lighting Scene Node. + //! the returned pointer must not be dropped. /** Example Usage: scene::IVolumeLightSceneNode * n = smgr->addVolumeLightSceneNode(NULL, -1, 32, 32, //Subdivide U/V @@ -371,8 +373,7 @@ namespace scene n->setScale(core::vector3df(46.0f, 45.0f, 46.0f)); n->getMaterial(0).setTexture(0, smgr->getVideoDriver()->getTexture("lightFalloff.png")); } - \return Pointer to the volumeLight if successful, otherwise NULL. - This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ + **/ virtual IVolumeLightSceneNode* addVolumeLightSceneNode(ISceneNode* parent=0, s32 id=-1, const u32 subdivU = 32, const u32 subdivV = 32, const video::SColor foot = video::SColor(51, 0, 230, 180), @@ -391,7 +392,7 @@ namespace scene scene node will be placed. \param rotation: Initital rotation of the scene node. \param scale: Initial scale of the scene node. - \return Pointer to the created test scene node. This + \return Returns pointer to the created test scene node. This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ virtual IMeshSceneNode* addCubeSceneNode(f32 size=10.0f, ISceneNode* parent=0, s32 id=-1, @@ -409,7 +410,7 @@ namespace scene scene node will be placed. \param rotation: Initital rotation of the scene node. \param scale: Initial scale of the scene node. - \return Pointer to the created test scene node. This + \return Returns pointer to the created test scene node. This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ virtual IMeshSceneNode* addSphereSceneNode(f32 radius=5.0f, s32 polyCount=16, @@ -427,7 +428,7 @@ namespace scene \param rotation: Initital rotation of the scene node. \param scale: Initial scale of the scene node. \param alsoAddIfMeshPointerZero: Add the scene node even if a 0 pointer is passed. - \return Pointer to the created scene node. + \return Returns pointer to the created scene node. This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ virtual IAnimatedMeshSceneNode* addAnimatedMeshSceneNode(IAnimatedMesh* mesh, ISceneNode* parent=0, s32 id=-1, @@ -445,7 +446,7 @@ namespace scene \param rotation: Initital rotation of the scene node. \param scale: Initial scale of the scene node. \param alsoAddIfMeshPointerZero: Add the scene node even if a 0 pointer is passed. - \return Pointer to the created scene node. + \return Returns pointer to the created scene node. This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ virtual IMeshSceneNode* addMeshSceneNode(IMesh* mesh, ISceneNode* parent=0, s32 id=-1, const core::vector3df& position = core::vector3df(0,0,0), @@ -512,16 +513,12 @@ namespace scene /** This camera does not react on user input like for example the one created with addCameraSceneNodeFPS(). If you want to move or animate it, use animators or the ISceneNode::setPosition(), ICameraSceneNode::setTarget() etc methods. - By default, a camera's look at position (set with setTarget()) and its scene node - rotation (set with setRotation()) are independent. If you want to be able to - control the direction that the camera looks by using setRotation() then call - ICameraSceneNode::bindTargetAndRotation(true) on it. \param position: Position of the space relative to its parent where the camera will be placed. \param lookat: Position where the camera will look at. Also known as target. \param parent: Parent scene node of the camera. Can be null. If the parent moves, the camera will move too. \param id: id of the camera. This id can be used to identify the camera. - \return Pointer to interface to camera if successful, otherwise 0. + \return Returns pointer to interface to camera if successful, otherwise 0. This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ virtual ICameraSceneNode* addCameraSceneNode(ISceneNode* parent = 0, const core::vector3df& position = core::vector3df(0,0,0), @@ -613,7 +610,7 @@ namespace scene the ILightSceneNode::getLightData() method. \param radius: Radius of the light. \param id: id of the node. This id can be used to identify the node. - \return Pointer to the interface of the light if successful, otherwise NULL. + \return Returns pointer to the interface of the light if successful, otherwise NULL. This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ virtual ILightSceneNode* addLightSceneNode(ISceneNode* parent = 0, const core::vector3df& position = core::vector3df(0,0,0), @@ -633,7 +630,7 @@ namespace scene \param id: An id of the node. This id can be used to identify the node. \param colorTop: The color of the vertices at the top of the billboard (default: white). \param colorBottom: The color of the vertices at the bottom of the billboard (default: white). - \return Pointer to the billboard if successful, otherwise NULL. + \return Returns pointer to the billboard if successful, otherwise NULL. This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ virtual IBillboardSceneNode* addBillboardSceneNode(ISceneNode* parent = 0, const core::dimension2d& size = core::dimension2d(10.0f, 10.0f), @@ -653,7 +650,7 @@ namespace scene so this should be null. Note: If a parent is set to the skybox, the box will not change how it is drawn. \param id: An id of the node. This id can be used to identify the node. - \return Pointer to the sky box if successful, otherwise NULL. + \return Returns a pointer to the sky box if successful, otherwise NULL. This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ virtual ISceneNode* addSkyBoxSceneNode(video::ITexture* top, video::ITexture* bottom, video::ITexture* left, video::ITexture* right, video::ITexture* front, @@ -674,7 +671,7 @@ namespace scene so this should be null. Note: If a parent is set, the dome will not change how it is drawn. \param id: An id of the node. This id can be used to identify the node. - \return Pointer to the sky dome if successful, otherwise NULL. + \return Returns a pointer to the sky dome if successful, otherwise NULL. This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ virtual ISceneNode* addSkyDomeSceneNode(video::ITexture* texture, u32 horiRes=16, u32 vertRes=8, @@ -692,7 +689,7 @@ namespace scene scene node will be placed. \param rotation: Initital rotation of the scene node. \param scale: Initial scale of the scene node. - \return Pointer to the created scene node. + \return Returns pointer to the created scene node. This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ virtual IParticleSystemSceneNode* addParticleSystemSceneNode( bool withDefaultEmitter=true, ISceneNode* parent=0, s32 id=-1, @@ -751,7 +748,7 @@ namespace scene know what you are doing, this might lead to strange behaviour. \param smoothFactor: The number of times the vertices are smoothed. \param addAlsoIfHeightmapEmpty: Add terrain node even with empty heightmap. - \return Pointer to the created scene node. Can be null + \return Returns pointer to the created scene node. Can be null if the terrain could not be created, for example because the heightmap could not be loaded. The returned pointer should not be dropped. See IReferenceCounted::drop() for more @@ -789,7 +786,7 @@ namespace scene know what you are doing, this might lead to strange behaviour. \param smoothFactor: The number of times the vertices are smoothed. \param addAlsoIfHeightmapEmpty: Add terrain node even with empty heightmap. - \return Pointer to the created scene node. Can be null + \return Returns pointer to the created scene node. Can be null if the terrain could not be created, for example because the heightmap could not be loaded. The returned pointer should not be dropped. See IReferenceCounted::drop() for more @@ -806,7 +803,7 @@ namespace scene //! Adds a quake3 scene node to the scene graph. /** A Quake3 Scene renders multiple meshes for a specific HighLanguage Shader (Quake3 Style ) - \return Pointer to the quake3 scene node if successful, otherwise NULL. + \return Returns a pointer to the quake3 scene node if successful, otherwise NULL. This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ virtual ISceneNode* addQuake3SceneNode(IMeshBuffer* meshBuffer, const quake3::SShader * shader, ISceneNode* parent=0, s32 id=-1 @@ -816,7 +813,7 @@ namespace scene //! Adds an empty scene node to the scene graph. /** Can be used for doing advanced transformations or structuring the scene graph. - \return Pointer to the created scene node. + \return Returns pointer to the created scene node. This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ virtual ISceneNode* addEmptySceneNode(ISceneNode* parent=0, s32 id=-1) = 0; @@ -825,7 +822,7 @@ namespace scene set/getRotation and set/getScale. Its just a simple scene node that takes a matrix as relative transformation, making it possible to insert any transformation anywhere into the scene graph. - \return Pointer to the created scene node. + \return Returns pointer to the created scene node. This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ virtual IDummyTransformationSceneNode* addDummyTransformationSceneNode( ISceneNode* parent=0, s32 id=-1) = 0; @@ -843,10 +840,9 @@ namespace scene \param parent The billboard's parent. Pass 0 to use the root scene node. \param size The billboard's width and height. \param position The billboards position relative to its parent. - \param id: An id of the node. This id can be used to identify the node. \param colorTop: The color of the vertices at the top of the billboard (default: white). \param colorBottom: The color of the vertices at the bottom of the billboard (default: white). - \return Pointer to the billboard if successful, otherwise NULL. + \return Returns pointer to the billboard if successful, otherwise NULL. This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ virtual IBillboardTextSceneNode* addBillboardTextSceneNode( gui::IGUIFont* font, const wchar_t* text, ISceneNode* parent = 0, @@ -877,7 +873,7 @@ namespace scene will be countHills.X * countHills.Y hills. \param textureRepeatCount: Defines how often the texture will be repeated in x and y direction. - \return Null if the creation failed. The reason could be that you + \return Returns null if the creation failed. The reason could be that you specified some invalid parameters or that a mesh with that name already exists. If successful, a pointer to the mesh is returned. This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ @@ -906,7 +902,7 @@ namespace scene \param stretchSize: Parameter defining how big a is pixel on the heightmap. \param maxHeight: Defines how high a white pixel on the heighmap is. \param defaultVertexBlockSize: Defines the initial dimension between vertices. - \return Null if the creation failed. The reason could be that you + \return Returns null if the creation failed. The reason could be that you specified some invalid parameters, that a mesh with that name already exists, or that a texture could not be found. If successful, a pointer to the mesh is returned. This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ @@ -925,9 +921,7 @@ namespace scene \param height Total height of the arrow \param cylinderHeight Total height of the cylinder, should be lesser than total height \param width0 Diameter of the cylinder - \param width1 Diameter of the cone's base, should be not smaller than the cylinder's diameter - \return Pointer to the arrow mesh if successful, otherwise 0. - This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ + \param width1 Diameter of the cone's base, should be not smaller than the cylinder's diameter */ virtual IAnimatedMesh* addArrowMesh(const c8* name, video::SColor vtxColor0=0xFFFFFFFF, video::SColor vtxColor1=0xFFFFFFFF, @@ -939,50 +933,44 @@ namespace scene /** \param name Name of the mesh \param radius Radius of the sphere \param polyCountX Number of quads used for the horizontal tiling - \param polyCountY Number of quads used for the vertical tiling - \return Pointer to the sphere mesh if successful, otherwise 0. - This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ + \param polyCountY Number of quads used for the vertical tiling */ virtual IAnimatedMesh* addSphereMesh(const c8* name, f32 radius=5.f, u32 polyCountX = 16, u32 polyCountY = 16) = 0; - //! Gets the root scene node. + //! Returns the root scene node. /** This is the scene node which is parent - of all scene nodes. The root scene node is a special scene node which - only exists to manage all scene nodes. It will not be rendered and cannot - be removed from the scene. - \return Pointer to the root scene node. - This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ + of all scene nodes. The root scene node is a special scene node which + only exists to manage all scene nodes. It will not be rendered and cannot + be removed from the scene. + \return Returns a pointer to the root scene node. */ virtual ISceneNode* getRootSceneNode() = 0; - //! Get the first scene node with the specified id. + //! Returns the first scene node with the specified id. /** \param id: The id to search for - \param start: Scene node to start from. All children of this scene - node are searched. If null is specified, the root scene node is - taken. - \return Pointer to the first scene node with this id, - and null if no scene node could be found. - This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ + \param start: Scene node to start from. All children of this scene + node are searched. If null is specified, the root scene node is + taken. + \return Returns pointer to the first scene node with this id, + and null if no scene node could be found. */ virtual ISceneNode* getSceneNodeFromId(s32 id, ISceneNode* start=0) = 0; - //! Get the first scene node with the specified name. + //! Returns the first scene node with the specified name. /** \param name: The name to search for - \param start: Scene node to start from. All children of this scene - node are searched. If null is specified, the root scene node is - taken. - \return Pointer to the first scene node with this id, - and null if no scene node could be found. - This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ + \param start: Scene node to start from. All children of this scene + node are searched. If null is specified, the root scene node is + taken. + \return Returns pointer to the first scene node with this id, + and null if no scene node could be found. */ virtual ISceneNode* getSceneNodeFromName(const c8* name, ISceneNode* start=0) = 0; - //! Get the first scene node with the specified type. + //! Returns the first scene node with the specified type. /** \param type: The type to search for - \param start: Scene node to start from. All children of this scene - node are searched. If null is specified, the root scene node is - taken. - \return Pointer to the first scene node with this type, - and null if no scene node could be found. - This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ + \param start: Scene node to start from. All children of this scene + node are searched. If null is specified, the root scene node is + taken. + \return Returns pointer to the first scene node with this type, + and null if no scene node could be found. */ virtual ISceneNode* getSceneNodeFromType(scene::ESCENE_NODE_TYPE type, ISceneNode* start=0) = 0; //! Get scene nodes by type. @@ -996,20 +984,19 @@ namespace scene ISceneNode* start=0) = 0; //! Get the current active camera. - /** \return The active camera is returned. Note that this can - be NULL, if there was no camera created yet. - This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ + /** \return The active camera is returned. Note that this can be NULL, if there + was no camera created yet. */ virtual ICameraSceneNode* getActiveCamera() = 0; //! Sets the currently active camera. /** The previous active camera will be deactivated. - \param camera: The new camera which should be active. */ + \param camera: The new camera which should be active. */ virtual void setActiveCamera(ICameraSceneNode* camera) = 0; //! Sets the color of stencil buffers shadows drawn by the scene manager. virtual void setShadowColor(video::SColor color = video::SColor(150,0,0,0)) = 0; - //! Get the current color of shadows. + //! Returns the current color of shadows. virtual video::SColor getShadowColor() const = 0; //! Registers a node for rendering it at a specific time. @@ -1042,7 +1029,7 @@ namespace scene //! Creates a fly circle animator, which lets the attached scene node fly around a center. /** \param center: Center of the circle. \param radius: Radius of the circle. - \param speed: The orbital speed, in radians per millisecond. + \param speed: Specifies the speed of the flight. \param direction: Specifies the upvector used for alignment of the mesh. \return The animator. Attach it to a scene node with ISceneNode::addAnimator() and the animator will animate it. @@ -1060,7 +1047,7 @@ namespace scene move from the start point to the end point. \param loop: If set to false, the node stops when the end point is reached. If loop is true, the node begins again at the start. - \return The animator. Attach it to a scene node with ISceneNode::addAnimator() + \return Returns the animator. Attach it to a scene node with ISceneNode::addAnimator() and the animator will animate it. If you no longer need the animator, you should call ISceneNodeAnimator::drop(). See IReferenceCounted::drop() for more information. */ @@ -1073,7 +1060,7 @@ namespace scene should be visible. \param loop: If set to to false, the last texture remains set, and the animation stops. If set to true, the animation restarts with the first texture. - \return The animator. Attach it to a scene node with ISceneNode::addAnimator() + \return Returns the animator. Attach it to a scene node with ISceneNode::addAnimator() and the animator will animate it. If you no longer need the animator, you should call ISceneNodeAnimator::drop(). See IReferenceCounted::drop() for more information. */ @@ -1082,7 +1069,7 @@ namespace scene //! Creates a scene node animator, which deletes the scene node after some time automatically. /** \param timeMs: Time in milliseconds, after when the node will be deleted. - \return The animator. Attach it to a scene node with ISceneNode::addAnimator() + \return Returns the animator. Attach it to a scene node with ISceneNode::addAnimator() and the animator will animate it. If you no longer need the animator, you should call ISceneNodeAnimator::drop(). See IReferenceCounted::drop() for more information. */ @@ -1113,7 +1100,7 @@ namespace scene it completely. If this is not what you want, you may specify a translation for the ellipsoid. \param slidingValue: DOCUMENTATION NEEDED. - \return The animator. Attach it to a scene node with ISceneNode::addAnimator() + \return Returns the animator. Attach it to a scene node with ISceneNode::addAnimator() and the animator will cause it to do collision detection and response. If you no longer need the animator, you should call ISceneNodeAnimator::drop(). See IReferenceCounted::drop() for more information. */ @@ -1126,13 +1113,11 @@ namespace scene //! Creates a follow spline animator. /** The animator modifies the position of - the attached scene node to make it follow a hermite spline. - It uses a subset of hermite splines: either cardinal splines - (tightness != 0.5) or catmull-rom-splines (tightness == 0.5). - The animator moves from one control point to the next in - 1/speed seconds. This code was sent in by Matthias Gall. - If you no longer need the animator, you should call ISceneNodeAnimator::drop(). - See IReferenceCounted::drop() for more information. */ + the attached scene node to make it follow a hermite spline. + It uses a subset of hermite splines: either cardinal splines + (tightness != 0.5) or catmull-rom-splines (tightness == 0.5). + The animator moves from one control point to the next in + 1/speed seconds. This code was sent in by Matthias Gall. */ virtual ISceneNodeAnimator* createFollowSplineAnimator(s32 startTime, const core::array< core::vector3df >& points, f32 speed = 1.0f, f32 tightness = 0.5f) = 0; @@ -1153,7 +1138,7 @@ namespace scene \endcode \param mesh: Mesh of which the triangles are taken. \param node: Scene node of which visibility and transformation is used. - \return The selector, or null if not successful. + \return Returns the selector, or null if not successful. If you no longer need the selector, you should call ITriangleSelector::drop(). See IReferenceCounted::drop() for more information. */ virtual ITriangleSelector* createTriangleSelector(IMesh* mesh, ISceneNode* node) = 0; @@ -1164,7 +1149,7 @@ namespace scene queried, the triangle selector gets the bounding box of the scene node, an creates new triangles. In this way, it works good with animated scene nodes. \param node: Scene node of which the bounding box, visibility and transformation is used. - \return The selector, or null if not successful. + \return Returns the selector, or null if not successful. If you no longer need the selector, you should call ITriangleSelector::drop(). See IReferenceCounted::drop() for more information. */ virtual ITriangleSelector* createTriangleSelectorFromBoundingBox(ISceneNode* node) = 0; @@ -1189,7 +1174,7 @@ namespace scene \param minimalPolysPerNode: Specifies the minimal polygons contained a octree node. If a node gets less polys the this value, it will not be splitted into smaller nodes. - \return The selector, or null if not successful. + \return Returns the selector, or null if not successful. If you no longer need the selector, you should call ITriangleSelector::drop(). See IReferenceCounted::drop() for more information. */ virtual ITriangleSelector* createOctTreeTriangleSelector(IMesh* mesh, @@ -1200,37 +1185,30 @@ namespace scene collection of one or more triangle selectors providing together the interface of one triangle selector. In this way, collision tests can be done with different triangle soups in one pass. - \return The selector, or null if not successful. + \return Returns the selector, or null if not successful. If you no longer need the selector, you should call ITriangleSelector::drop(). See IReferenceCounted::drop() for more information. */ virtual IMetaTriangleSelector* createMetaTriangleSelector() = 0; //! Creates a triangle selector which can select triangles from a terrain scene node. /** \param node: Pointer to the created terrain scene node - \param LOD: Level of detail, 0 for highest detail. - \return The selector, or null if not successful. - If you no longer need the selector, you should call ITriangleSelector::drop(). - See IReferenceCounted::drop() for more information. */ + \param LOD: Level of detail, 0 for highest detail. */ virtual ITriangleSelector* createTerrainTriangleSelector( ITerrainSceneNode* node, s32 LOD=0) = 0; //! Adds an external mesh loader for extending the engine with new file formats. /** If you want the engine to be extended with - file formats it currently is not able to load (e.g. .cob), just implement - the IMeshLoader interface in your loading class and add it with this method. - Using this method it is also possible to override built-in mesh loaders with - newer or updated versions without the need of recompiling the engine. - \param externalLoader: Implementation of a new mesh loader. */ + file formats it currently is not able to load (e.g. .cob), just implement + the IMeshLoader interface in your loading class and add it with this method. + Using this method it is also possible to override built-in mesh loaders with + newer or updated versions without the need of recompiling the engine. + \param externalLoader: Implementation of a new mesh loader. */ virtual void addExternalMeshLoader(IMeshLoader* externalLoader) = 0; - //! Get pointer to the scene collision manager. - /** \return Pointer to the collision manager - This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ + //! Returns a pointer to the scene collision manager. virtual ISceneCollisionManager* getSceneCollisionManager() = 0; - //! Get pointer to the mesh manipulator. - /** \return Pointer to the mesh manipulator - This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ + //! Returns a pointer to the mesh manipulator. virtual IMeshManipulator* getMeshManipulator() = 0; //! Adds a scene node to the deletion queue. @@ -1253,7 +1231,7 @@ namespace scene /** All scene nodes are removed. */ virtual void clear() = 0; - //! Get interface to the parameters set in this scene. + //! Returns interface to the parameters set in this scene. /** String parameters can be used by plugins and mesh loaders. For example the CMS and LMTS loader want a parameter named 'CSM_TexturePath' and 'LMTS_TexturePath' set to the path were attached textures can be found. See @@ -1261,7 +1239,7 @@ namespace scene COLLADA_CREATE_SCENE_INSTANCES, DMF_TEXTURE_PATH and DMF_USE_MATERIALS_DIRS*/ virtual io::IAttributes* getParameters() = 0; - //! Get current render pass. + //! Returns current render pass. /** All scene nodes are being rendered in a specific order. First lights, cameras, sky boxes, solid geometry, and then transparent stuff. During the rendering process, scene nodes may want to know what the scene @@ -1270,9 +1248,7 @@ namespace scene pass currently is active they can render the correct part of their geometry. */ virtual E_SCENE_NODE_RENDER_PASS getSceneNodeRenderPass() const = 0; - //! Get the default scene node factory which can create all built in scene nodes - /** \return Pointer to the default scene node factory - This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ + //! Returns the default scene node factory which can create all built in scene nodes virtual ISceneNodeFactory* getDefaultSceneNodeFactory() = 0; //! Adds a scene node factory to the scene manager. @@ -1280,17 +1256,13 @@ namespace scene able to create automaticly, for example when loading data from xml files. */ virtual void registerSceneNodeFactory(ISceneNodeFactory* factoryToAdd) = 0; - //! Get amount of registered scene node factories. + //! Returns amount of registered scene node factories. virtual u32 getRegisteredSceneNodeFactoryCount() const = 0; - //! Get a scene node factory by index - /** \return Pointer to the requested scene node factory, or 0 if it does not exist. - This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ + //! Returns a scene node factory by index virtual ISceneNodeFactory* getSceneNodeFactory(u32 index) = 0; - //! Get the default scene node animator factory which can create all built-in scene node animators - /** \return Pointer to the default scene node animator factory - This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ + //! Returns the default scene node animator factory which can create all built-in scene node animators virtual ISceneNodeAnimatorFactory* getDefaultSceneNodeAnimatorFactory() = 0; //! Adds a scene node animator factory to the scene manager. @@ -1298,20 +1270,16 @@ namespace scene able to create automaticly, for example when loading data from xml files. */ virtual void registerSceneNodeAnimatorFactory(ISceneNodeAnimatorFactory* factoryToAdd) = 0; - //! Get amount of registered scene node animator factories. + //! Returns amount of registered scene node animator factories. virtual u32 getRegisteredSceneNodeAnimatorFactoryCount() const = 0; - //! Get scene node animator factory by index - /** \return Pointer to the requested scene node animator factory, or 0 if it does not exist. - This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ + //! Returns a scene node animator factory by index virtual ISceneNodeAnimatorFactory* getSceneNodeAnimatorFactory(u32 index) = 0; - //! Get typename from a scene node type or null if not found + //! Returns a typename from a scene node type or null if not found virtual const c8* getSceneNodeTypeName(ESCENE_NODE_TYPE type) = 0; //! Adds a scene node to the scene by name - /** \return Pointer to the scene node added by a factory - This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ virtual ISceneNode* addSceneNode(const char* sceneNodeTypeName, ISceneNode* parent=0) = 0; //! Creates a new scene manager. @@ -1344,7 +1312,7 @@ namespace scene \param userDataSerializer: If you want to save some user data for every scene node into the file, implement the ISceneUserDataSerializer interface and provide it as parameter here. Otherwise, simply specify 0 as this parameter. - \return True if successful. */ + \return Returns true if successful. */ virtual bool saveScene(const c8* filename, ISceneUserDataSerializer* userDataSerializer=0) = 0; //! Saves the current scene into a file. @@ -1356,7 +1324,7 @@ namespace scene \param userDataSerializer: If you want to save some user data for every scene node into the file, implement the ISceneUserDataSerializer interface and provide it as parameter here. Otherwise, simply specify 0 as this parameter. - \return True if successful. */ + \return Returns true if successful. */ virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0) = 0; //! Loads a scene. Note that the current scene is not cleared before. @@ -1369,7 +1337,7 @@ namespace scene implement the ISceneUserDataSerializer interface and provide it as parameter here. Otherwise, simply specify 0 as this parameter. - \return True if successful. */ + \return Returns true if successful. */ virtual bool loadScene(const c8* filename, ISceneUserDataSerializer* userDataSerializer=0) = 0; //! Loads a scene. Note that the current scene is not cleared before. @@ -1382,10 +1350,10 @@ namespace scene implement the ISceneUserDataSerializer interface and provide it as parameter here. Otherwise, simply specify 0 as this parameter. - \return True if successful. */ + \return Returns true if successful. */ virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0) = 0; - //! Get a mesh writer implementation if available + //! Returns a mesh writer implementation if available /** Note: You need to drop() the pointer after use again, see IReferenceCounted::drop() for details. */ virtual IMeshWriter* createMeshWriter(EMESH_WRITER_TYPE type) = 0; @@ -1393,7 +1361,7 @@ namespace scene //! Sets ambient color of the scene virtual void setAmbientLight(const video::SColorf &ambientColor) = 0; - //! Get ambient color of the scene + //! Returns ambient color of the scene virtual const video::SColorf& getAmbientLight() const = 0; }; diff --git a/src/dep/include/irrlicht/ISceneNode.h b/src/dep/include/irrlicht/ISceneNode.h index d65a5c9..9442547 100644 --- a/src/dep/include/irrlicht/ISceneNode.h +++ b/src/dep/include/irrlicht/ISceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -107,15 +107,8 @@ namespace scene // animate this node with all animators core::list::Iterator ait = Animators.begin(); - while (ait != Animators.end()) - { - // continue to the next node before calling animateNode() - // so that the animator may remove itself from the scene - // node without the iterator becoming invalid - ISceneNodeAnimator* anim = *ait; - ++ait; - anim->animateNode(this, timeMs); - } + for (; ait != Animators.end(); ++ait) + (*ait)->animateNode(this, timeMs); // update absolute position updateAbsolutePosition(); @@ -208,20 +201,20 @@ namespace scene } - //! Returns whether the node should be visible (if all of its parents are visible). + //! Returns true if the node is visible. /** This is only an option set by the user, but has nothing to do with geometry culling - \return The requested visibility of the node, true means visible (if all parents are also visible). */ + \return The visibility of the node, true means visible. */ virtual bool isVisible() const { _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; return IsVisible; } + //! Sets if the node should be visible or not. /** All children of this node won't be visible either, when set - to false. Invisible nodes are not valid candidates for selection by - collision manager bounding box methods. + to false. \param isVisible If the node shall be visible. */ virtual void setVisible(bool isVisible) { @@ -413,11 +406,8 @@ namespace scene } - //! Gets the scale of the scene node relative to its parent. - /** This is the scale of this node relative to its parent. - If you want the absolute scale, use - getAbsoluteTransformation().getScale() - \return The scale of the scene node. */ + //! Gets the relative scale of the scene node. + /** \return The scale of the scene node. */ virtual const core::vector3df& getScale() const { return RelativeScale; @@ -425,17 +415,15 @@ namespace scene //! Sets the relative scale of the scene node. - /** \param scale New scale of the node, relative to its parent. */ + /** \param scale New scale of the node */ virtual void setScale(const core::vector3df& scale) { RelativeScale = scale; } - //! Gets the rotation of the node relative to its parent. + //! Gets the rotation of the node. /** Note that this is the relative rotation of the node. - If you want the absolute rotation, use - getAbsoluteTransformation().getRotation() \return Current relative rotation of the scene node. */ virtual const core::vector3df& getRotation() const { @@ -443,7 +431,7 @@ namespace scene } - //! Sets the rotation of the node relative to its parent. + //! Sets the rotation of the node. /** This only modifies the relative rotation of the node. \param rotation New rotation of the node in degrees. */ virtual void setRotation(const core::vector3df& rotation) @@ -452,9 +440,8 @@ namespace scene } - //! Gets the position of the node relative to its parent. - /** Note that the position is relative to the parent. If you want - the position in world coordinates, use getAbsolutePosition() instead. + //! Gets the position of the node. + /** Note that the position is relative to the parent. \return The current position of the node relative to the parent. */ virtual const core::vector3df& getPosition() const { @@ -462,19 +449,17 @@ namespace scene } - //! Sets the position of the node relative to its parent. + //! Sets the position of the node. /** Note that the position is relative to the parent. - \param newpos New relative position of the scene node. */ + \param newpos New relative postition of the scene node. */ virtual void setPosition(const core::vector3df& newpos) { RelativeTranslation = newpos; } - //! Gets the absolute position of the node in world coordinates. - /** If you want the position of the node relative to its parent, - use getPosition() instead. - \return The current absolute position of the scene node. */ + //! Gets the abolute position of the node. + /** \return The current absolute position of the scene node. */ virtual core::vector3df getAbsolutePosition() const { return AbsoluteTransformation.getTranslation(); @@ -691,10 +676,6 @@ namespace scene return 0; // to be implemented by derived classes } - //! Retrieve the scene manager for this node. - /** \return The node's scene manager. */ - virtual ISceneManager* getSceneManager(void) const { return SceneManager; } - protected: //! A clone function for the ISceneNode members. diff --git a/src/dep/include/irrlicht/ISceneNodeAnimator.h b/src/dep/include/irrlicht/ISceneNodeAnimator.h index e3315f6..c834636 100644 --- a/src/dep/include/irrlicht/ISceneNodeAnimator.h +++ b/src/dep/include/irrlicht/ISceneNodeAnimator.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/ISceneNodeAnimatorCameraFPS.h b/src/dep/include/irrlicht/ISceneNodeAnimatorCameraFPS.h new file mode 100644 index 0000000..7676d57 --- /dev/null +++ b/src/dep/include/irrlicht/ISceneNodeAnimatorCameraFPS.h @@ -0,0 +1,56 @@ +// Copyright (C) 2002-2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#ifndef __I_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED__ +#define __I_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED__ + +#include "ISceneNodeAnimator.h" +#include "IEventReceiver.h" + +namespace irr +{ + struct SKeyMap; + +namespace scene +{ + + //! Special scene node animator for FPS cameras + /** This scene node animator can be attached to a camera to make it act + like a first person shooter + */ + class ISceneNodeAnimatorCameraFPS : public ISceneNodeAnimator + { + public: + + //! Returns the speed of movement in units per millisecond + virtual f32 getMoveSpeed() const = 0; + + //! Sets the speed of movement in units per millisecond + virtual void setMoveSpeed(f32 moveSpeed) = 0; + + //! Returns the rotation speed in degrees + /** The degrees are equivalent to a half screen movement of the mouse, + i.e. if the mouse cursor had been moved to the border of the screen since + the last animation. */ + virtual f32 getRotateSpeed() const = 0; + + //! Set the rotation speed in degrees + virtual void setRotateSpeed(f32 rotateSpeed) = 0; + + //! Sets the keyboard mapping for this animator + /** \param keymap Array of keyboard mappings, see SKeyMap + \param count Size of the keyboard map array */ + virtual void setKeyMap(SKeyMap *map, u32 count) = 0; + + //! Sets whether vertical movement should be allowed. + /** If vertical movement is enabled then the camera may fight with + gravity causing camera shake. Disable this if the camera has + a collision animator with gravity enabled. */ + virtual void setVerticalMovement(bool allow) = 0; + }; +} // end namespace scene +} // end namespace irr + +#endif + diff --git a/src/dep/include/irrlicht/ISceneNodeAnimatorCameraMaya.h b/src/dep/include/irrlicht/ISceneNodeAnimatorCameraMaya.h new file mode 100644 index 0000000..4169814 --- /dev/null +++ b/src/dep/include/irrlicht/ISceneNodeAnimatorCameraMaya.h @@ -0,0 +1,50 @@ +// Copyright (C) 2002-2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#ifndef __I_SCENE_NODE_ANIMATOR_CAMERA_MAYA_H_INCLUDED__ +#define __I_SCENE_NODE_ANIMATOR_CAMERA_MAYA_H_INCLUDED__ + +#include "ISceneNodeAnimator.h" + +namespace irr +{ + +namespace scene +{ + + //! Special scene node animator for Maya-style cameras + /** This scene node animator can be attached to a camera to make it act like a 3d + modelling tool. + The camera is moving relative to the target with the mouse, by pressing either + of the three buttons. + */ + class ISceneNodeAnimatorCameraMaya : public ISceneNodeAnimator + { + public: + + //! Returns the speed of movement + virtual f32 getMoveSpeed() const = 0; + + //! Sets the speed of movement + virtual void setMoveSpeed(f32 moveSpeed) = 0; + + //! Returns the rotation speed + virtual f32 getRotateSpeed() const = 0; + + //! Set the rotation speed + virtual void setRotateSpeed(f32 rotateSpeed) = 0; + + //! Returns the zoom speed + virtual f32 getZoomSpeed() const = 0; + + //! Set the zoom speed + virtual void setZoomSpeed(f32 zoomSpeed) = 0; + + }; + +} // end namespace scene +} // end namespace irr + +#endif + diff --git a/src/dep/include/irrlicht/ISceneNodeAnimatorCollisionResponse.h b/src/dep/include/irrlicht/ISceneNodeAnimatorCollisionResponse.h index 4df9837..e7ad068 100644 --- a/src/dep/include/irrlicht/ISceneNodeAnimatorCollisionResponse.h +++ b/src/dep/include/irrlicht/ISceneNodeAnimatorCollisionResponse.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/ISceneNodeAnimatorFactory.h b/src/dep/include/irrlicht/ISceneNodeAnimatorFactory.h index 589682b..5e220e5 100644 --- a/src/dep/include/irrlicht/ISceneNodeAnimatorFactory.h +++ b/src/dep/include/irrlicht/ISceneNodeAnimatorFactory.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/ISceneNodeFactory.h b/src/dep/include/irrlicht/ISceneNodeFactory.h index 3102e08..4ca6bf1 100644 --- a/src/dep/include/irrlicht/ISceneNodeFactory.h +++ b/src/dep/include/irrlicht/ISceneNodeFactory.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -33,15 +33,13 @@ namespace scene //! adds a scene node to the scene graph based on its type id /** \param type: Type of the scene node to add. \param parent: Parent scene node of the new node, can be null to add the scene node to the root. - \return Returns pointer to the new scene node or null if not successful. - This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ + \return Returns pointer to the new scene node or null if not successful. */ virtual ISceneNode* addSceneNode(ESCENE_NODE_TYPE type, ISceneNode* parent=0) = 0; //! adds a scene node to the scene graph based on its type name /** \param typeName: Type name of the scene node to add. \param parent: Parent scene node of the new node, can be null to add the scene node to the root. - \return Returns pointer to the new scene node or null if not successful. - This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ + \return Returns pointer to the new scene node or null if not successful. */ virtual ISceneNode* addSceneNode(const c8* typeName, ISceneNode* parent=0) = 0; //! returns amount of scene node types this factory is able to create diff --git a/src/dep/include/irrlicht/ISceneUserDataSerializer.h b/src/dep/include/irrlicht/ISceneUserDataSerializer.h index 33c299d..d756fe3 100644 --- a/src/dep/include/irrlicht/ISceneUserDataSerializer.h +++ b/src/dep/include/irrlicht/ISceneUserDataSerializer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IShaderConstantSetCallBack.h b/src/dep/include/irrlicht/IShaderConstantSetCallBack.h index 8446971..f486b34 100644 --- a/src/dep/include/irrlicht/IShaderConstantSetCallBack.h +++ b/src/dep/include/irrlicht/IShaderConstantSetCallBack.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IShadowVolumeSceneNode.h b/src/dep/include/irrlicht/IShadowVolumeSceneNode.h index e0e838f..8a77fab 100644 --- a/src/dep/include/irrlicht/IShadowVolumeSceneNode.h +++ b/src/dep/include/irrlicht/IShadowVolumeSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/ISkinnedMesh.h b/src/dep/include/irrlicht/ISkinnedMesh.h index d4a733b..047b9d6 100644 --- a/src/dep/include/irrlicht/ISkinnedMesh.h +++ b/src/dep/include/irrlicht/ISkinnedMesh.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/ITerrainSceneNode.h b/src/dep/include/irrlicht/ITerrainSceneNode.h index 88f6453..75f29ad 100644 --- a/src/dep/include/irrlicht/ITerrainSceneNode.h +++ b/src/dep/include/irrlicht/ITerrainSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/ITextSceneNode.h b/src/dep/include/irrlicht/ITextSceneNode.h index 9542199..770693f 100644 --- a/src/dep/include/irrlicht/ITextSceneNode.h +++ b/src/dep/include/irrlicht/ITextSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/ITexture.h b/src/dep/include/irrlicht/ITexture.h index 1173d73..11731b9 100644 --- a/src/dep/include/irrlicht/ITexture.h +++ b/src/dep/include/irrlicht/ITexture.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -18,58 +18,59 @@ namespace video { -//! Enumeration flags telling the video driver in which format textures should be created. +//! Enumeration flags telling the video driver in which format textures +//! should be created. enum E_TEXTURE_CREATION_FLAG { - /** Forces the driver to create 16 bit textures always, independent of - which format the file on disk has. When choosing this you may loose - some color detail, but gain much speed and memory. 16 bit textures can - be transferred twice as fast as 32 bit textures and only use half of - the space in memory. - When using this flag, it does not make sense to use the flags - ETCF_ALWAYS_32_BIT, ETCF_OPTIMIZED_FOR_QUALITY, or - ETCF_OPTIMIZED_FOR_SPEED at the same time. */ + //! Forces the driver to create 16 bit textures always, independent of + //! which format the file on disk has. When choosing this you may loose + //! some color detail, but gain much speed and memory. 16 bit textures + //! can be transferred twice as fast as 32 bit textures and only use + //! half of the space in memory. + //! When using this flag, it does not make sense to use the flags + //! ETCF_ALWAYS_32_BIT, ETCF_OPTIMIZED_FOR_QUALITY, + //! or ETCF_OPTIMIZED_FOR_SPEED at the same time. ETCF_ALWAYS_16_BIT = 0x00000001, - /** Forces the driver to create 32 bit textures always, independent of - which format the file on disk has. Please note that some drivers (like - the software device) will ignore this, because they are only able to - create and use 16 bit textures. - When using this flag, it does not make sense to use the flags - ETCF_ALWAYS_16_BIT, ETCF_OPTIMIZED_FOR_QUALITY, or - ETCF_OPTIMIZED_FOR_SPEED at the same time. */ + //! Forces the driver to create 32 bit textures always, independent of + //! which format the file on disk has. Please note that some drivers + //! (like the software device) will ignore this, because they are only + //! able to create and use 16 bit textures. + //! When using this flag, it does not make sense to use the flags + //! ETCF_ALWAYS_16_BIT, ETCF_OPTIMIZED_FOR_QUALITY, + //! or ETCF_OPTIMIZED_FOR_SPEED at the same time. ETCF_ALWAYS_32_BIT = 0x00000002, - /** Lets the driver decide in which format the textures are created and - tries to make the textures look as good as possible. Usually it simply - chooses the format in which the texture was stored on disk. - When using this flag, it does not make sense to use the flags - ETCF_ALWAYS_16_BIT, ETCF_ALWAYS_32_BIT, or ETCF_OPTIMIZED_FOR_SPEED at - the same time. */ + //! Lets the driver decide in which format the textures are created and + //! tries to make the textures look as good as possible. + //! Usually it simply chooses the format in which the texture was stored on disk. + //! When using this flag, it does not make sense to use the flags + //! ETCF_ALWAYS_16_BIT, ETCF_ALWAYS_32_BIT, + //! or ETCF_OPTIMIZED_FOR_SPEED at the same time. ETCF_OPTIMIZED_FOR_QUALITY = 0x00000004, - /** Lets the driver decide in which format the textures are created and - tries to create them maximizing render speed. - When using this flag, it does not make sense to use the flags - ETCF_ALWAYS_16_BIT, ETCF_ALWAYS_32_BIT, or ETCF_OPTIMIZED_FOR_QUALITY, - at the same time. */ + //! Lets the driver decide in which format the textures are created and + //! tries to create them maximizing render speed. + //! When using this flag, it does not make sense to use the flags + //! ETCF_ALWAYS_16_BIT, ETCF_ALWAYS_32_BIT, or ETCF_OPTIMIZED_FOR_QUALITY, + //! at the same time. ETCF_OPTIMIZED_FOR_SPEED = 0x00000008, - /** Automatically creates mip map levels for the textures. */ + //! Automatically creates mip map levels for the textures. ETCF_CREATE_MIP_MAPS = 0x00000010, - /** Discard any alpha layer and use non-alpha color format. */ + //! Discard any alpha layer and use non-alpha color format. ETCF_NO_ALPHA_CHANNEL = 0x00000020, - /** This flag is never used, it only forces the compiler to compile - these enumeration values to 32 bit. */ + //! This flag is never used, it only forces the compiler to + //! compile these enumeration values to 32 bit. ETCF_FORCE_32_BIT_DO_NOT_USE = 0x7fffffff }; //! Helper function, helps to get the desired texture creation format from the flags. -/** \return Either ETCF_ALWAYS_32_BIT, ETCF_ALWAYS_16_BIT, -ETCF_OPTIMIZED_FOR_QUALITY, or ETCF_OPTIMIZED_FOR_SPEED. */ +//! Returns either ETCF_ALWAYS_32_BIT, ETCF_ALWAYS_16_BIT, ETCF_OPTIMIZED_FOR_QUALITY, +//! or ETCF_OPTIMIZED_FOR_SPEED. inline E_TEXTURE_CREATION_FLAG getTextureFormatFromFlags(u32 flags) { if (flags & ETCF_OPTIMIZED_FOR_SPEED) @@ -85,13 +86,13 @@ inline E_TEXTURE_CREATION_FLAG getTextureFormatFromFlags(u32 flags) //! Interface of a Video Driver dependent Texture. -/** An ITexture is created by an IVideoDriver by using IVideoDriver::addTexture -or IVideoDriver::getTexture. After that, the texture may only be used by this -VideoDriver. As you can imagine, textures of the DirectX and the OpenGL device -will, e.g., not be compatible. An exception is the Software device and the -NULL device, their textures are compatible. If you try to use a texture -created by one device with an other device, the device will refuse to do that -and write a warning or an error message to the output buffer. +/** + An ITexture is created by an IVideoDriver by using IVideoDriver::addTexture or + IVideoDriver::getTexture. After that, the texture may only be used by this VideoDriver. + As you can imagine, textures of the DirectX and the OpenGL device will, e.g., not be compatible. + An exception is the Software device and the NULL device, their textures are compatible. + If you try to use a texture created by one device with an other device, the device + will refuse to do that and write a warning or an error message to the output buffer. */ class ITexture : public virtual IReferenceCounted { @@ -120,51 +121,52 @@ public: /** One should avoid to call unlock more than once before another lock. */ virtual void unlock() = 0; - //! Get original size of the texture. - /** The texture is usually scaled, if it was created with an unoptimal - size. For example if the size of the texture file it was loaded from - was not a power of two. This returns the size of the texture, it had - before it was scaled. Can be useful when drawing 2d images on the - screen, which should have the exact size of the original texture. Use - ITexture::getSize() if you want to know the real size it has now stored - in the system. - \return The original size of the texture. */ + //! Returns original size of the texture. + /** The texture is usually + scaled, if it was created with an unoptimal size. For example if the size + of the texture file it was loaded from was not a power of two. This returns + the size of the texture, it had before it was scaled. Can be useful + when drawing 2d images on the screen, which should have the exact size + of the original texture. Use ITexture::getSize() if you want to know + the real size it has now stored in the system. + \return Returns the original size of the texture. */ virtual const core::dimension2d& getOriginalSize() const = 0; - //! Get dimension (=size) of the texture. - /** \return The size of the texture. */ + //! Returns dimension (=size) of the texture. + /** \return Returns the size of the texture. */ virtual const core::dimension2d& getSize() const = 0; - //! Get driver type of texture. - /** This is the driver, which created the texture. This method is used - internally by the video devices, to check, if they may use a texture - because textures may be incompatible between different devices. - \return Driver type of texture. */ + //! Returns driver type of texture. + /** This is the driver, which created the texture. + This method is used internally by the video devices, to check, if they may + use a texture because textures may be incompatible between different + devices. + \return Returns driver type of texture. */ virtual E_DRIVER_TYPE getDriverType() const = 0; - //! Get the color format of texture. - /** \return The color format of texture. */ + //! Returns the color format of texture. + /** \return Returns the color format of texture. */ virtual ECOLOR_FORMAT getColorFormat() const = 0; - //! Get pitch of texture (in bytes). - /** The pitch is the amount of bytes used for a row of pixels in a - texture. - \return Pitch of texture in bytes. */ + //! Returns pitch of texture (in bytes). + /** The pitch is the amount of bytes + used for a row of pixels in a texture. + \return Returns pitch of texture in bytes. */ virtual u32 getPitch() const = 0; - //! Check whether the texture has MipMaps - /** \return True if texture has MipMaps, else false. */ + //! Returns whether the texture has MipMaps + /** \return Returns true if texture has MipMaps, else false. */ virtual bool hasMipMaps() const { return false; } //! Regenerates the mip map levels of the texture. - /** Required after modifying the texture, usually after calling unlock(). */ + /** Required after locking and modifying the texture */ virtual void regenerateMipMapLevels() = 0; - //! Check whether the texture is a render target - /** \return True if this is a render target, otherwise false. */ + //! Returns whether the texture is a render target + /** \return Returns true if this is a render target, otherwise false. */ virtual bool isRenderTarget() const { return false; } - //! Get name of texture (in most cases this is the filename) + //! Returns name of texture (in most cases this is the filename) const core::stringc& getName() const { return Name; } protected: diff --git a/src/dep/include/irrlicht/ITimer.h b/src/dep/include/irrlicht/ITimer.h index 104225e..88634bb 100644 --- a/src/dep/include/irrlicht/ITimer.h +++ b/src/dep/include/irrlicht/ITimer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/ITriangleSelector.h b/src/dep/include/irrlicht/ITriangleSelector.h index 385f423..1502d57 100644 --- a/src/dep/include/irrlicht/ITriangleSelector.h +++ b/src/dep/include/irrlicht/ITriangleSelector.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IVertexBuffer.h b/src/dep/include/irrlicht/IVertexBuffer.h new file mode 100644 index 0000000..5192139 --- /dev/null +++ b/src/dep/include/irrlicht/IVertexBuffer.h @@ -0,0 +1,52 @@ +// Copyright (C) 2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#ifndef __I_VERTEX_BUFFER_H_INCLUDED__ +#define __I_VERTEX_BUFFER_H_INCLUDED__ + +#include "IReferenceCounted.h" +#include "irrArray.h" +#include "S3DVertex.h" + +namespace irr +{ +namespace scene +{ + + class IVertexBuffer : public virtual IReferenceCounted + { + public: + virtual void* getData() =0; + virtual video::E_VERTEX_TYPE getType() const =0; + virtual void setType(video::E_VERTEX_TYPE vertexType) =0; + virtual u32 stride() const =0; + virtual u32 size() const =0; + virtual void push_back(const video::S3DVertex &element) =0; + virtual video::S3DVertex& operator [](const u32 index) const =0; + virtual video::S3DVertex& getLast() =0; + virtual void set_used(u32 usedNow) =0; + virtual void reallocate(u32 new_size) =0; + virtual u32 allocated_size() const =0; + virtual video::S3DVertex* pointer() =0; + + //! get the current hardware mapping hint + virtual E_HARDWARE_MAPPING getHardwareMappingHint() const =0; + + //! set the hardware mapping hint, for driver + virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint ) =0; + + //! flags the meshbuffer as changed, reloads hardware buffers + virtual void setDirty() =0; + + //! Get the currently used ID for identification of changes. + /** This shouldn't be used for anything outside the VideoDriver. */ + virtual u32 getChangedID() const = 0; + }; + + +} // end namespace scene +} // end namespace irr + +#endif + diff --git a/src/dep/include/irrlicht/IVideoDriver.h b/src/dep/include/irrlicht/IVideoDriver.h index 9122f58..329a6a3 100644 --- a/src/dep/include/irrlicht/IVideoDriver.h +++ b/src/dep/include/irrlicht/IVideoDriver.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -353,19 +353,19 @@ namespace video virtual const core::rect& getViewPort() const = 0; //! Draws a vertex primitive list - /** Note that, depending on the index type, some vertices might be not - accessible through the index list. The limit is at 65535 vertices for 16bit - indices. + /** Note that there may be at maximum 65536 vertices, because + the index list is an array of 16 bit values each with a maximum + value of 65536. If there are more than 65536 vertices in the + list, results of this operation are not defined. \param vertices Pointer to array of vertices. \param vertexCount Amount of vertices in the array. \param indexList Pointer to array of indices. \param primCount Amount of Primitives - \param vType Vertex type, e.g. video::EVT_STANDARD for S3DVertex. - \param pType Primitive type, e.g. scene::EPT_TRIANGLE_FAN for a triangle fan. - \param iType Index type, e.g. video::EIT_16BIT for a triangle fan. */ + \param vType Vertex type, e.g. EVT_STANDARD for S3DVertex. + \param pType Primitive type, e.g. EPT_TRIANGLE_FAN for a triangle fan. */ virtual void drawVertexPrimitiveList(const void* vertices, u32 vertexCount, const void* indexList, u32 primCount, - E_VERTEX_TYPE vType=EVT_STANDARD, scene::E_PRIMITIVE_TYPE pType=scene::EPT_TRIANGLES, E_INDEX_TYPE iType=EIT_16BIT) = 0; + E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType) = 0; //! Draws an indexed triangle list. /** Note that there may be at maximum 65536 vertices, because @@ -558,7 +558,7 @@ namespace video virtual void draw2DRectangle(SColor color, const core::rect& pos, const core::rect* clip = 0) = 0; - //! Draws a 2d rectangle with a gradient. + //! Draws an 2d rectangle with a gradient. /** \param colorLeftUp Color of the upper left corner to draw. The alpha component will not be ignored and specifies how transparent the rectangle will be. @@ -580,28 +580,20 @@ namespace video SColor colorLeftDown, SColor colorRightDown, const core::rect* clip = 0) = 0; - //! Draws the outline of a 2D rectangle. - /** \param pos Position of the rectangle. - \param color Color of the rectangle to draw. The alpha component - specifies how transparent the rectangle outline will be. */ - virtual void draw2DRectangleOutline(const core::recti& pos, - SColor color=SColor(255,255,255,255)) = 0 ; - //! Draws a 2d line. - /** \param start Screen coordinates of the start of the line + /** \param start: Screen coordinates of the start of the line in pixels. - \param end Screen coordinates of the start of the line in + \param end: Screen coordinates of the start of the line in pixels. - \param color Color of the line to draw. */ + \param color: Color of the line to draw. */ virtual void draw2DLine(const core::position2d& start, const core::position2d& end, SColor color=SColor(255,255,255,255)) = 0; //! Draws a pixel. - /** \param x The x-position of the pixel. - \param y The y-position of the pixel. - \param color Color of the pixel to draw. */ - virtual void drawPixel(u32 x, u32 y, const SColor& color) = 0; + /** \param position: the position of the pixel. + \param color: Color of the pixel to draw. */ + virtual void drawPixel(u32 x, u32 y, const SColor & color) = 0; //! Draws a non filled concyclic regular 2d polyon. /** This method can be used to draw circles, but also @@ -662,8 +654,8 @@ namespace video video::SColor rightDownEdge = video::SColor(255,0,0,0)) = 0; //! Draws a mesh buffer - /** \param mb Buffer to draw; */ - virtual void drawMeshBuffer(const scene::IMeshBuffer* mb) = 0; + /** \param mb: Buffer to draw; */ + virtual void drawMeshBuffer( const scene::IMeshBuffer* mb) = 0; //! Sets the fog mode. /** These are global values attached to each 3d object rendered, diff --git a/src/dep/include/irrlicht/IVideoModeList.h b/src/dep/include/irrlicht/IVideoModeList.h index 9ce5741..1e181cc 100644 --- a/src/dep/include/irrlicht/IVideoModeList.h +++ b/src/dep/include/irrlicht/IVideoModeList.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IVolumeLightSceneNode.h b/src/dep/include/irrlicht/IVolumeLightSceneNode.h new file mode 100644 index 0000000..f3ef5ac --- /dev/null +++ b/src/dep/include/irrlicht/IVolumeLightSceneNode.h @@ -0,0 +1,47 @@ +// Copyright (C) 2002-2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h +// +// created by Dean Wadsworth aka Varmint Dec 31 2007 + +#ifndef __I_VOLUME_LIGHT_SCENE_NODE_H_INCLUDED__ +#define __I_VOLUME_LIGHT_SCENE_NODE_H_INCLUDED__ + +#include "ISceneNode.h" + +namespace irr +{ +namespace scene +{ + class IVolumeLightSceneNode : public ISceneNode + { + public: + + //! constructor + IVolumeLightSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id, + const core::vector3df& position, + const core::vector3df& rotation, + const core::vector3df& scale) + : ISceneNode(parent, mgr, id, position, rotation, scale) {}; + + //! Returns type of the scene node + virtual ESCENE_NODE_TYPE getType() const { return ESNT_CUBE; } + + virtual void setSubDivideU (const u32 inU) =0; + virtual void setSubDivideV (const u32 inV) =0; + + virtual u32 getSubDivideU () const =0; + virtual u32 getSubDivideV () const =0; + + virtual void setFootColour(const video::SColor inColour) =0; + virtual void setTailColour(const video::SColor inColour) =0; + + virtual video::SColor getFootColour () const =0; + virtual video::SColor getTailColour () const =0; + }; + +} // end namespace scene +} // end namespace irr + +#endif + diff --git a/src/dep/include/irrlicht/IWriteFile.h b/src/dep/include/irrlicht/IWriteFile.h index 4f1a694..aaf182f 100644 --- a/src/dep/include/irrlicht/IWriteFile.h +++ b/src/dep/include/irrlicht/IWriteFile.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IXMLReader.h b/src/dep/include/irrlicht/IXMLReader.h index d0bec49..1058e4b 100644 --- a/src/dep/include/irrlicht/IXMLReader.h +++ b/src/dep/include/irrlicht/IXMLReader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IXMLWriter.h b/src/dep/include/irrlicht/IXMLWriter.h index d75e0fd..1fc906d 100644 --- a/src/dep/include/irrlicht/IXMLWriter.h +++ b/src/dep/include/irrlicht/IXMLWriter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/IrrCompileConfig.h b/src/dep/include/irrlicht/IrrCompileConfig.h index 90a9c19..5c40c21 100644 --- a/src/dep/include/irrlicht/IrrCompileConfig.h +++ b/src/dep/include/irrlicht/IrrCompileConfig.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -82,17 +82,10 @@ directX header files, and directX is only available on windows platforms. If you are using Dev-Cpp, and want to compile this using a DX dev pack, you can define _IRR_COMPILE_WITH_DX9_DEV_PACK_. So you simply need to add something like this to the compiler settings: -DIRR_COMPILE_WITH_DX9_DEV_PACK -and this to the linker settings: -ld3dx9 -ld3dx8 - -Microsoft have chosen to remove D3D8 headers from their recent DXSDKs, and -so D3D8 support is now disabled by default. If you really want to build -with D3D8 support, then you will have to source a DXSDK with the appropriate -headers, e.g. Summer 2004. This is a Microsoft issue, not an Irrlicht one. -*/ +and this to the linker settings: -ld3dx9 -ld3dx8 **/ #if defined(_IRR_WINDOWS_API_) && (!defined(__GNUC__) || defined(IRR_COMPILE_WITH_DX9_DEV_PACK)) -//! Only define _IRR_COMPILE_WITH_DIRECT3D_8_ if you have an appropriate DXSDK, e.g. Summer 2004 -//#define _IRR_COMPILE_WITH_DIRECT3D_8_ +#define _IRR_COMPILE_WITH_DIRECT3D_8_ #define _IRR_COMPILE_WITH_DIRECT3D_9_ #endif diff --git a/src/dep/include/irrlicht/IrrlichtDevice.h b/src/dep/include/irrlicht/IrrlichtDevice.h index ef7bad1..4f7e98c 100644 --- a/src/dep/include/irrlicht/IrrlichtDevice.h +++ b/src/dep/include/irrlicht/IrrlichtDevice.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -211,7 +211,7 @@ namespace irr //! Activate any joysticks, and generate events for them. /** Irrlicht contains support for joysticks, but does not generate joystick events by default, as this would consume joystick info that 3rd party libraries might rely on. Call this method to - activate joystick support in Irrlicht and to receive irr::SJoystickEvent events. + activate joystick support in Irrlicht and to receive @ref SJoystickEvent events. \param joystickInfo On return, this will contain an array of each joystick that was found and activated. \return true if joysticks are supported on this device and _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ is defined, false if joysticks are not supported or support is compiled out. diff --git a/src/dep/include/irrlicht/Keycodes.h b/src/dep/include/irrlicht/Keycodes.h index a8d8bff..79dbc90 100644 --- a/src/dep/include/irrlicht/Keycodes.h +++ b/src/dep/include/irrlicht/Keycodes.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/S3DVertex.h b/src/dep/include/irrlicht/S3DVertex.h index 86d64fd..15f472c 100644 --- a/src/dep/include/irrlicht/S3DVertex.h +++ b/src/dep/include/irrlicht/S3DVertex.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/SAnimatedMesh.h b/src/dep/include/irrlicht/SAnimatedMesh.h index 12d191e..09e4c9c 100644 --- a/src/dep/include/irrlicht/SAnimatedMesh.h +++ b/src/dep/include/irrlicht/SAnimatedMesh.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/SColor.h b/src/dep/include/irrlicht/SColor.h index c3c5b9b..d10255b 100644 --- a/src/dep/include/irrlicht/SColor.h +++ b/src/dep/include/irrlicht/SColor.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/SExposedVideoData.h b/src/dep/include/irrlicht/SExposedVideoData.h index 362240d..0ad1232 100644 --- a/src/dep/include/irrlicht/SExposedVideoData.h +++ b/src/dep/include/irrlicht/SExposedVideoData.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/SIrrCreationParameters.h b/src/dep/include/irrlicht/SIrrCreationParameters.h index 3193730..a24b4d7 100644 --- a/src/dep/include/irrlicht/SIrrCreationParameters.h +++ b/src/dep/include/irrlicht/SIrrCreationParameters.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/SKeyMap.h b/src/dep/include/irrlicht/SKeyMap.h index 1836b5c..d86bbb9 100644 --- a/src/dep/include/irrlicht/SKeyMap.h +++ b/src/dep/include/irrlicht/SKeyMap.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/SLight.h b/src/dep/include/irrlicht/SLight.h index 7a45baa..5fcd765 100644 --- a/src/dep/include/irrlicht/SLight.h +++ b/src/dep/include/irrlicht/SLight.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/SMaterial.h b/src/dep/include/irrlicht/SMaterial.h index bb31dff..92a851e 100644 --- a/src/dep/include/irrlicht/SMaterial.h +++ b/src/dep/include/irrlicht/SMaterial.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/SMaterialLayer.h b/src/dep/include/irrlicht/SMaterialLayer.h index 9c25a18..de084d4 100644 --- a/src/dep/include/irrlicht/SMaterialLayer.h +++ b/src/dep/include/irrlicht/SMaterialLayer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/SMesh.h b/src/dep/include/irrlicht/SMesh.h index d4c51af..cb9275c 100644 --- a/src/dep/include/irrlicht/SMesh.h +++ b/src/dep/include/irrlicht/SMesh.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/SMeshBuffer.h b/src/dep/include/irrlicht/SMeshBuffer.h index 2ae24d3..4d48062 100644 --- a/src/dep/include/irrlicht/SMeshBuffer.h +++ b/src/dep/include/irrlicht/SMeshBuffer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/SMeshBufferLightMap.h b/src/dep/include/irrlicht/SMeshBufferLightMap.h index 2ae24d3..4d48062 100644 --- a/src/dep/include/irrlicht/SMeshBufferLightMap.h +++ b/src/dep/include/irrlicht/SMeshBufferLightMap.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/SMeshBufferTangents.h b/src/dep/include/irrlicht/SMeshBufferTangents.h index 2ae24d3..4d48062 100644 --- a/src/dep/include/irrlicht/SMeshBufferTangents.h +++ b/src/dep/include/irrlicht/SMeshBufferTangents.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/SParticle.h b/src/dep/include/irrlicht/SParticle.h index f3c534d..9dbb139 100644 --- a/src/dep/include/irrlicht/SParticle.h +++ b/src/dep/include/irrlicht/SParticle.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/SSharedMeshBuffer.h b/src/dep/include/irrlicht/SSharedMeshBuffer.h index 775a7b4..4afe711 100644 --- a/src/dep/include/irrlicht/SSharedMeshBuffer.h +++ b/src/dep/include/irrlicht/SSharedMeshBuffer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -16,7 +16,7 @@ namespace scene struct SSharedMeshBuffer : public IMeshBuffer { //! constructor - SSharedMeshBuffer() : IMeshBuffer(), ChangedID_Vertex(1), ChangedID_Index(1), Vertices(0), MappingHintVertex(EHM_NEVER), MappingHintIndex(EHM_NEVER) + SSharedMeshBuffer() : IMeshBuffer(), ChangedID_Vertex(1), ChangedID_Index(1), Vertices(0), MappingHint(EHM_NEVER) { #ifdef _DEBUG setDebugName("SSharedMeshBuffer"); @@ -127,32 +127,23 @@ namespace scene //! get the current hardware mapping hint - virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const + virtual E_HARDWARE_MAPPING getHardwareMappingHint() const { - return MappingHintVertex; - } - - //! get the current hardware mapping hint - virtual E_HARDWARE_MAPPING getHardwareMappingHint_Index() const - { - return MappingHintIndex; + return MappingHint; } //! set the hardware mapping hint, for driver - virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX ) + virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint ) { - if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_VERTEX) - MappingHintVertex=NewMappingHint; - if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_INDEX) - MappingHintIndex=NewMappingHint; + MappingHint=NewMappingHint; } //! flags the mesh as changed, reloads hardware buffers - virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX) + virtual void setDirty(E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX) { - if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_VERTEX) + if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_VERTEX) ++ChangedID_Vertex; - if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_INDEX) + if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_INDEX) ++ChangedID_Index; } @@ -179,8 +170,7 @@ namespace scene //! Bounding box core::aabbox3df BoundingBox; //! hardware mapping hint - E_HARDWARE_MAPPING MappingHintVertex; - E_HARDWARE_MAPPING MappingHintIndex; + E_HARDWARE_MAPPING MappingHint; }; diff --git a/src/dep/include/irrlicht/SSkinMeshBuffer.h b/src/dep/include/irrlicht/SSkinMeshBuffer.h index 313fd4a..849236a 100644 --- a/src/dep/include/irrlicht/SSkinMeshBuffer.h +++ b/src/dep/include/irrlicht/SSkinMeshBuffer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/SVertexIndex.h b/src/dep/include/irrlicht/SVertexIndex.h new file mode 100644 index 0000000..0fb47f3 --- /dev/null +++ b/src/dep/include/irrlicht/SVertexIndex.h @@ -0,0 +1,79 @@ +// Copyright (C) 2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#ifndef __S_VERTEX_INDEX_H_INCLUDED__ +#define __S_VERTEX_INDEX_H_INCLUDED__ + +#include "irrTypes.h" + + +namespace irr +{ +namespace video +{ +enum E_INDEX_TYPE +{ + EIT_16BIT = 0, + EIT_32BIT +}; + + +/* +//! vertex index used by the Irrlicht engine. +template +struct SSpecificVertexIndex +{ + T Index; + + //! default constructor + SSpecificVertexIndex() {} + + //! constructor + SSpecificVertexIndex(u32 _index) :Index(_index) {} + + bool operator==(const SSpecificVertexIndex& other) const + { + return (Index == other.Index); + } + + bool operator!=(const SSpecificVertexIndex& other) const + { + return (Index != other.Index); + } + + bool operator<(const SSpecificVertexIndex& other) const + { + return (Index < other.Index); + } + + SSpecificVertexIndex operator+(const u32& other) const + { + return SSpecificVertexIndex(Index + other); + } + + operator const u32() const + { + return (const u32)Index; + } + + E_INDEX_TYPE getType() const + { + if (sizeof(T)==sizeof(u16)) + return video::EIT_16BIT; + return video::EIT_32BIT; + } + +}; + +//typedef SSpecificVertexIndex SVertexIndex; + +typedef u32 SVertexIndex; +*/ + + +} // end namespace video +} // end namespace irr + +#endif + diff --git a/src/dep/include/irrlicht/SViewFrustum.h b/src/dep/include/irrlicht/SViewFrustum.h index f310629..020e425 100644 --- a/src/dep/include/irrlicht/SViewFrustum.h +++ b/src/dep/include/irrlicht/SViewFrustum.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/SceneParameters.h b/src/dep/include/irrlicht/SceneParameters.h index 17b336a..bc91172 100644 --- a/src/dep/include/irrlicht/SceneParameters.h +++ b/src/dep/include/irrlicht/SceneParameters.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/aabbox3d.h b/src/dep/include/irrlicht/aabbox3d.h index 19eacc9..df27b9c 100644 --- a/src/dep/include/irrlicht/aabbox3d.h +++ b/src/dep/include/irrlicht/aabbox3d.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/coreutil.h b/src/dep/include/irrlicht/coreutil.h index e69bbdd..e3b56c6 100644 --- a/src/dep/include/irrlicht/coreutil.h +++ b/src/dep/include/irrlicht/coreutil.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/dimension2d.h b/src/dep/include/irrlicht/dimension2d.h index f9140bb..360f5ca 100644 --- a/src/dep/include/irrlicht/dimension2d.h +++ b/src/dep/include/irrlicht/dimension2d.h @@ -1,179 +1,168 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#ifndef __IRR_DIMENSION2D_H_INCLUDED__ -#define __IRR_DIMENSION2D_H_INCLUDED__ - -#include "irrTypes.h" -#include "irrMath.h" // for irr::core::equals() - -namespace irr -{ -namespace core -{ - - //! Specifies a 2 dimensional size. - template - class dimension2d - { - public: - //! Default constructor for empty dimension - dimension2d() : Width(0), Height(0) {} - //! Constructor with width and height - dimension2d(const T& width, const T& height) - : Width(width), Height(height) {} - - //! Equality operator - bool operator==(const dimension2d& other) const - { - return core::equals(Width, other.Width) && - core::equals(Height, other.Height); - } - - //! Inequality operator - bool operator!=(const dimension2d& other) const - { - return ! (*this == other); - } - - - //! Set to new values - dimension2d& set(const T& width, const T& height) - { - Width = width; - Height = height; - return *this; - } - - //! Divide width and height by scalar - dimension2d& operator/=(const T& scale) - { - Width /= scale; - Height /= scale; - return *this; - } - - //! Divide width and height by scalar - dimension2d operator/(const T& scale) const - { - return dimension2d(Width/scale, Height/scale); - } - - //! Multiply width and height by scalar - dimension2d& operator*=(const T& scale) - { - Width *= scale; - Height *= scale; - return *this; - } - - //! Multiply width and height by scalar - dimension2d operator*(const T& scale) const - { - return dimension2d(Width*scale, Height*scale); - } - - //! Add another dimension to this one. - dimension2d& operator+=(const dimension2d& other) - { - Width += other.Width; - Height += other.Height; - return *this; - } - - //! Subtract a dimension from this one - dimension2d& operator-=(const dimension2d& other) - { - Width -= other.Width; - Height -= other.Height; - return *this; - } - - - //! Add two dimensions - dimension2d operator+(const dimension2d& other) const - { - return dimension2d(Width+other.Width, Height+other.Height); - } - - //! Get area - T getArea() const - { - return Width*Height; - } - - //! Get the optimal size according to some properties - /** This is a function often used for texture dimension - calculations. The function returns the next larger or - smaller dimension which is a power-of-two dimension - (2^n,2^m) and/or square (Width=Height). - \param requirePowerOfTwo Forces the result to use only - powers of two as values. - \param requireSquare Makes width==height in the result - \param larger Choose whether the result is larger or - smaller than the current dimension. If one dimension - need not be changed it is kept with any value of larger. - \return The optimal dimension under the given - constraints. */ - dimension2d getOptimalSize( - bool requirePowerOfTwo=true, - bool requireSquare=false, - bool larger=true) const - { - u32 i=1; - u32 j=1; - if (requirePowerOfTwo) - { - while (i<(u32)Width) - i<<=1; - if (!larger && i!=1 && i!=(u32)Width) - i>>=1; - while (j<(u32)Height) - j<<=1; - if (!larger && j!=1 && j!=(u32)Height) - j>>=1; - } - else - { - i=(u32)Width; - j=(u32)Height; - } - - if (requireSquare) - { - if ((larger && (i>j)) || (!larger && (i((T)i,(T)j); - } - - //! Get the interpolated dimension - /** \param other Other dimension to interpolate with. - \param d Value between 0.0f and 1.0f. - \return Interpolated dimension. */ - dimension2d getInterpolated(const dimension2d& other, f32 d) const - { - T inv = (T) (1.0f - d); - return dimension2d(other.Width*inv + Width*d, other.Height*inv + Height*d); - } - - - //! Width of the dimension. - T Width; - //! Height of the dimension. - T Height; - }; - - //! Typedef for an f32 dimension. - typedef dimension2d dimension2df; - //! Typedef for an integer dimension. - typedef dimension2d dimension2di; - -} // end namespace core -} // end namespace irr - -#endif - +// Copyright (C) 2002-2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#ifndef __IRR_DIMENSION2D_H_INCLUDED__ +#define __IRR_DIMENSION2D_H_INCLUDED__ + +#include "irrTypes.h" + +namespace irr +{ +namespace core +{ + + //! Specifies a 2 dimensional size. + template + class dimension2d + { + public: + //! Default constructor for empty dimension + dimension2d() : Width(0), Height(0) {} + //! Constructor with width and height + dimension2d(const T& width, const T& height) + : Width(width), Height(height) {} + + //! Equality operator + bool operator==(const dimension2d& other) const + { + return Width == other.Width && Height == other.Height; + } + + //! Inequality operator + bool operator!=(const dimension2d& other) const + { + return ! (*this == other); + } + + + //! Set to new values + dimension2d& set(const T& width, const T& height) + { + Width = width; + Height = height; + return *this; + } + + //! Divide width and height by scalar + dimension2d& operator/=(const T& scale) + { + Width /= scale; + Height /= scale; + return *this; + } + + //! Divide width and height by scalar + dimension2d operator/(const T& scale) const + { + return dimension2d(Width/scale, Height/scale); + } + + //! Multiply width and height by scalar + dimension2d& operator*=(const T& scale) + { + Width *= scale; + Height *= scale; + return *this; + } + + //! Multiply width and height by scalar + dimension2d operator*(const T& scale) const + { + return dimension2d(Width*scale, Height*scale); + } + + //! Add two dimensions + dimension2d& operator+=(const dimension2d& other) + { + Width *= other.Width; + Height *= other.Height; + return *this; + } + + //! Add two dimensions + dimension2d operator+(const dimension2d& other) const + { + return dimension2d(Width+other.Width, Height+other.Height); + } + + //! Get area + T getArea() const + { + return Width*Height; + } + + //! Get the optimal size according to some properties + /** This is a function often used for texture dimension + calculations. The function returns the next larger or + smaller dimension which is a power-of-two dimension + (2^n,2^m) and/or square (Width=Height). + \param requirePowerOfTwo Forces the result to use only + powers of two as values. + \param requireSquare Makes width==height in the result + \param larger Choose whether the result is larger or + smaller than the current dimension. If one dimension + need not be changed it is kept with any value of larger. + \return The optimal dimension under the given + constraints. */ + dimension2d getOptimalSize( + bool requirePowerOfTwo=true, + bool requireSquare=false, + bool larger=true) const + { + u32 i=1; + u32 j=1; + if (requirePowerOfTwo) + { + while (i<(u32)Width) + i<<=1; + if (!larger && i!=1 && i!=(u32)Width) + i>>=1; + while (j<(u32)Height) + j<<=1; + if (!larger && j!=1 && j!=(u32)Height) + j>>=1; + } + else + { + i=(u32)Width; + j=(u32)Height; + } + + if (requireSquare) + { + if ((larger && (i>j)) || (!larger && (i((T)i,(T)j); + } + + //! Get the interpolated dimension + /** \param other Other dimension to interpolate with. + \param d Value between 0.0f and 1.0f. + \return Interpolated dimension. */ + dimension2d getInterpolated(const dimension2d& other, f32 d) const + { + T inv = (T) (1.0f - d); + return dimension2d(other.Width*inv + Width*d, other.Height*inv + Height*d); + } + + + //! Width of the dimension. + T Width; + //! Height of the dimension. + T Height; + }; + + //! Typedef for an f32 dimension. + typedef dimension2d dimension2df; + //! Typedef for an integer dimension. + typedef dimension2d dimension2di; + +} // end namespace core +} // end namespace irr + +#endif + diff --git a/src/dep/include/irrlicht/fast_atof.h b/src/dep/include/irrlicht/fast_atof.h index 596a56c..e31af6e 100644 --- a/src/dep/include/irrlicht/fast_atof.h +++ b/src/dep/include/irrlicht/fast_atof.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine" and the "irrXML" project. // For conditions of distribution and use, see copyright notice in irrlicht.h and irrXML.h diff --git a/src/dep/include/irrlicht/heapsort.h b/src/dep/include/irrlicht/heapsort.h index 9c2b3b7..10bb08d 100644 --- a/src/dep/include/irrlicht/heapsort.h +++ b/src/dep/include/irrlicht/heapsort.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/irrAllocator.h b/src/dep/include/irrlicht/irrAllocator.h index b4bb761..9d5b5d4 100644 --- a/src/dep/include/irrlicht/irrAllocator.h +++ b/src/dep/include/irrlicht/irrAllocator.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine" and the "irrXML" project. // For conditions of distribution and use, see copyright notice in irrlicht.h and irrXML.h diff --git a/src/dep/include/irrlicht/irrArray.h b/src/dep/include/irrlicht/irrArray.h index 4904faa..c4a7185 100644 --- a/src/dep/include/irrlicht/irrArray.h +++ b/src/dep/include/irrlicht/irrArray.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine" and the "irrXML" project. // For conditions of distribution and use, see copyright notice in irrlicht.h and irrXML.h diff --git a/src/dep/include/irrlicht/irrList.h b/src/dep/include/irrlicht/irrList.h index 230273c..8c89a02 100644 --- a/src/dep/include/irrlicht/irrList.h +++ b/src/dep/include/irrlicht/irrList.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/irrMap.h b/src/dep/include/irrlicht/irrMap.h index 75f7f20..b53b1c8 100644 --- a/src/dep/include/irrlicht/irrMap.h +++ b/src/dep/include/irrlicht/irrMap.h @@ -1,4 +1,4 @@ -// Copyright (C) 2006-2009 by Kat'Oun +// Copyright 2006-2008 by Kat'Oun // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/irrMath.h b/src/dep/include/irrlicht/irrMath.h index d7ff2fb..7da1c81 100644 --- a/src/dep/include/irrlicht/irrMath.h +++ b/src/dep/include/irrlicht/irrMath.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/irrString.h b/src/dep/include/irrlicht/irrString.h index bf31e81..26ea4bc 100644 --- a/src/dep/include/irrlicht/irrString.h +++ b/src/dep/include/irrlicht/irrString.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine" and the "irrXML" project. // For conditions of distribution and use, see copyright notice in irrlicht.h and irrXML.h @@ -184,7 +184,7 @@ public: } - //! Destructor + //! destructor ~string() { allocator.deallocate(array); // delete [] array; @@ -748,7 +748,7 @@ public: //! Appends a character to this string - /** \param c Character to append. */ + /** \param character: Character to append. */ string& operator += (T c) { append(c); @@ -757,7 +757,7 @@ public: //! Appends a char string to this string - /** \param c Char string to append. */ + /** \param other: Char string to append. */ string& operator += (const T* const c) { append(c); @@ -766,7 +766,7 @@ public: //! Appends a string to this string - /** \param other String to append. */ + /** \param other: String to append. */ string& operator += (const string& other) { append(other); @@ -774,8 +774,6 @@ public: } - //! Appends a string representation of a number to this string - /** \param i Number to append. */ string& operator += (const int i) { append(string(i)); @@ -783,8 +781,6 @@ public: } - //! Appends a string representation of a number to this string - /** \param i Number to append. */ string& operator += (const unsigned int i) { append(string(i)); @@ -792,8 +788,6 @@ public: } - //! Appends a string representation of a number to this string - /** \param i Number to append. */ string& operator += (const long i) { append(string(i)); @@ -801,8 +795,6 @@ public: } - //! Appends a string representation of a number to this string - /** \param i Number to append. */ string& operator += (const unsigned long& i) { append(string(i)); @@ -810,8 +802,6 @@ public: } - //! Appends a string representation of a number to this string - /** \param i Number to append. */ string& operator += (const double i) { append(string(i)); @@ -819,8 +809,6 @@ public: } - //! Appends a string representation of a number to this string - /** \param i Number to append. */ string& operator += (const float i) { append(string(i)); @@ -828,9 +816,7 @@ public: } - //! Replaces all characters of a special type with another one - /** \param toReplace Character to replace. - \param replaceWith Character replacing the old one. */ + //! replaces all characters of a special type with another one void replace(T toReplace, T replaceWith) { for (u32 i=0; i& trim(const string & whitespace = " \t\n\r") diff --git a/src/dep/include/irrlicht/irrTypes.h b/src/dep/include/irrlicht/irrTypes.h index 01b31f1..dd76df5 100644 --- a/src/dep/include/irrlicht/irrTypes.h +++ b/src/dep/include/irrlicht/irrTypes.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/irrXML.h b/src/dep/include/irrlicht/irrXML.h index 428f05e..3b03b7c 100644 --- a/src/dep/include/irrlicht/irrXML.h +++ b/src/dep/include/irrlicht/irrXML.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine" and the "irrXML" project. // For conditions of distribution and use, see copyright notice in irrlicht.h and/or irrXML.h @@ -120,7 +120,7 @@ The irrXML license is based on the zlib license. Basicly, this means you can do with irrXML whatever you want: - Copyright (C) 2002-2009 Nikolaus Gebhardt + Copyright (C) 2002-2008 Nikolaus Gebhardt This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -432,13 +432,10 @@ namespace io \param callback: Callback for file read abstraction. Implement your own callback to make the xml parser read in other things than just files. See IFileReadCallBack for more information about this. - \param deleteCallback: if true, the callback will be deleted after the file - has been read. Otherwise the caller si responsible for cleaning it up. \return Returns a pointer to the created xml parser. This pointer should be deleted using 'delete' after no longer needed. Returns 0 if an error occured and the file could not be opened. */ - IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(IFileReadCallBack* callback, - bool deleteCallback = false); + IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(IFileReadCallBack* callback); //! Creates an instance of an UFT-16 xml parser. /** This means that @@ -472,13 +469,10 @@ namespace io \param callback: Callback for file read abstraction. Implement your own callback to make the xml parser read in other things than just files. See IFileReadCallBack for more information about this. - \param deleteCallback: if true, the callback will be deleted after the file - has been read. Otherwise the caller si responsible for cleaning it up. \return Returns a pointer to the created xml parser. This pointer should be deleted using 'delete' after no longer needed. Returns 0 if an error occured and the file could not be opened. */ - IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(IFileReadCallBack* callback, - bool deleteCallback = false); + IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(IFileReadCallBack* callback); //! Creates an instance of an UFT-32 xml parser. @@ -513,13 +507,10 @@ namespace io \param callback: Callback for file read abstraction. Implement your own callback to make the xml parser read in other things than just files. See IFileReadCallBack for more information about this. - \param deleteCallback: if true, the callback will be deleted after the file - has been read. Otherwise the caller si responsible for cleaning it up. \return Returns a pointer to the created xml parser. This pointer should be deleted using 'delete' after no longer needed. Returns 0 if an error occured and the file could not be opened. */ - IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(IFileReadCallBack* callback, - bool deleteCallback = false); + IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(IFileReadCallBack* callback); /*! \file irrxml.h diff --git a/src/dep/include/irrlicht/irrlicht.h b/src/dep/include/irrlicht/irrlicht.h index ab73d52..96a5158 100644 --- a/src/dep/include/irrlicht/irrlicht.h +++ b/src/dep/include/irrlicht/irrlicht.h @@ -1,6 +1,6 @@ /* irrlicht.h -- interface of the 'Irrlicht Engine' - Copyright (C) 2002-2009 Nikolaus Gebhardt + Copyright (C) 2002-2008 Nikolaus Gebhardt This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/dep/include/irrlicht/line2d.h b/src/dep/include/irrlicht/line2d.h index e6f6d36..1e1c5b6 100644 --- a/src/dep/include/irrlicht/line2d.h +++ b/src/dep/include/irrlicht/line2d.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/line3d.h b/src/dep/include/irrlicht/line3d.h index e4ae5d0..6aff4f6 100644 --- a/src/dep/include/irrlicht/line3d.h +++ b/src/dep/include/irrlicht/line3d.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/matrix4.h b/src/dep/include/irrlicht/matrix4.h index 5ff4bb1..ef15f07 100644 --- a/src/dep/include/irrlicht/matrix4.h +++ b/src/dep/include/irrlicht/matrix4.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -927,14 +927,25 @@ namespace core inline void CMatrix4::transformPlane( core::plane3d &plane) const { vector3df member; - // Transform the plane member point, i.e. rotate, translate and scale it. + // Fully transform the plane member point, i.e. rotate, translate and scale it. transformVect(member, plane.getMemberPoint()); - // Transform the normal by the transposed inverse of the matrix - CMatrix4 transposedInverse(*this, EM4CONST_INVERSE_TRANSPOSED); vector3df normal = plane.Normal; - transposedInverse.transformVect(normal); + normal.normalize(); + // The normal needs to be rotated and inverse scaled, but not translated. + const vector3df scale = getScale(); + + if(!equals(scale.X, 0.f) && !equals(scale.Y, 0.f) && !equals(scale.Z, 0.f) + && (!equals(scale.X, 1.f) || !equals(scale.Y, 1.f) || !equals(scale.Z, 1.f))) + { + // Rotating the vector will also apply the scale, so we have to invert it twice. + normal /= (scale * scale); + } + + rotateVect(normal); + + normal.normalize(); plane.setPlane(member, normal); } diff --git a/src/dep/include/irrlicht/plane3d.h b/src/dep/include/irrlicht/plane3d.h index 74c0386..2c5aa60 100644 --- a/src/dep/include/irrlicht/plane3d.h +++ b/src/dep/include/irrlicht/plane3d.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/position2d.h b/src/dep/include/irrlicht/position2d.h index 31d7eb1..6e8ec8b 100644 --- a/src/dep/include/irrlicht/position2d.h +++ b/src/dep/include/irrlicht/position2d.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/quaternion.h b/src/dep/include/irrlicht/quaternion.h index a4a9e9a..e4040b6 100644 --- a/src/dep/include/irrlicht/quaternion.h +++ b/src/dep/include/irrlicht/quaternion.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -115,10 +115,7 @@ class quaternion quaternion& rotationFromTo(const vector3df& from, const vector3df& to); //! Quaternion elements. - f32 X; // vectorial (imaginary) part - f32 Y; - f32 Z; - f32 W; // real part + f32 X, Y, Z, W; }; diff --git a/src/dep/include/irrlicht/rect.h b/src/dep/include/irrlicht/rect.h index a189b4f..43847c7 100644 --- a/src/dep/include/irrlicht/rect.h +++ b/src/dep/include/irrlicht/rect.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -27,30 +27,24 @@ namespace core { public: - //! Default constructor creating empty rectangle at (0,0) rect() : UpperLeftCorner(0,0), LowerRightCorner(0,0) {} - //! Constructor with two corners rect(T x, T y, T x2, T y2) : UpperLeftCorner(x,y), LowerRightCorner(x2,y2) {} - //! Constructor with two corners rect(const position2d& upperLeft, const position2d& lowerRight) : UpperLeftCorner(upperLeft), LowerRightCorner(lowerRight) {} - //! Constructor with upper left corner and dimension rect(const position2d& pos, const dimension2d& size) : UpperLeftCorner(pos), LowerRightCorner(pos.X + size.Width, pos.Y + size.Height) {} - //! move right by given numbers rect operator+(const position2d& pos) const { rect ret(*this); return ret+=pos; } - //! move right by given numbers rect& operator+=(const position2d& pos) { UpperLeftCorner += pos; @@ -58,14 +52,12 @@ namespace core return *this; } - //! move left by given numbers rect operator-(const position2d& pos) const { rect ret(*this); return ret-=pos; } - //! move left by given numbers rect& operator-=(const position2d& pos) { UpperLeftCorner -= pos; @@ -73,21 +65,20 @@ namespace core return *this; } - //! equality operator bool operator==(const rect& other) const { return (UpperLeftCorner == other.UpperLeftCorner && LowerRightCorner == other.LowerRightCorner); } - //! inequality operator + bool operator!=(const rect& other) const { return (UpperLeftCorner != other.UpperLeftCorner || LowerRightCorner != other.LowerRightCorner); } - //! compares size of rectangles + // compares size of rectangles bool operator<(const rect& other) const { return getArea() < other.getArea(); @@ -110,9 +101,7 @@ namespace core LowerRightCorner.Y >= pos.Y); } - //! Check if the rectangle collides with another rectangle. - /** \param other Rectangle to test collision with - \return True if the rectangles collide. */ + //! Returns if the rectangle collides with another rectangle. bool isRectCollided(const rect& other) const { return (LowerRightCorner.Y > other.UpperLeftCorner.Y && @@ -122,7 +111,6 @@ namespace core } //! Clips this rectangle with another one. - /** \param other Rectangle to clip with */ void clipAgainst(const rect& other) { if (other.LowerRightCorner.X < LowerRightCorner.X) @@ -180,13 +168,13 @@ namespace core return true; } - //! Get width of rectangle. + //! Returns width of rectangle. T getWidth() const { return LowerRightCorner.X - UpperLeftCorner.X; } - //! Get height of rectangle. + //! Returns height of rectangle. T getHeight() const { return LowerRightCorner.Y - UpperLeftCorner.Y; @@ -219,7 +207,7 @@ namespace core (LowerRightCorner.Y >= UpperLeftCorner.Y)); } - //! Get the center of the rectangle + //! Returns the center of the rectangle position2d getCenter() const { return position2d( @@ -227,7 +215,7 @@ namespace core (UpperLeftCorner.Y + LowerRightCorner.Y) / 2); } - //! Get the dimensions of the rectangle + //! Returns the dimensions of the rectangle dimension2d getSize() const { return dimension2d(getWidth(), getHeight()); @@ -235,19 +223,18 @@ namespace core //! Adds a point to the rectangle - /** Causes the rectangle to grow bigger if point is outside of + /** Cause the rectangle to grow bigger, if point is outside of the box - \param p Point to add to the box. */ + \param p Point to add into the box. */ void addInternalPoint(const position2d& p) { addInternalPoint(p.X, p.Y); } //! Adds a point to the bounding rectangle - /** Causes the rectangle to grow bigger if point is outside of - the box - \param x X-Coordinate of the point to add to this box. - \param y Y-Coordinate of the point to add to this box. */ + /** Cause the rectangle to grow bigger, if point is outside of + \param x X Coordinate of the point to add to this box. + \param y Y Coordinate of the point to add to this box. */ void addInternalPoint(T x, T y) { if (x>LowerRightCorner.X) @@ -261,16 +248,10 @@ namespace core UpperLeftCorner.Y = y; } - //! Upper left corner position2d UpperLeftCorner; - //! Lower right corner position2d LowerRightCorner; }; - //! Rectangle with float values - typedef rect rectf; - //! Rectangle with int values - typedef rect recti; } // end namespace core } // end namespace irr diff --git a/src/dep/include/irrlicht/triangle3d.h b/src/dep/include/irrlicht/triangle3d.h index 9fcc253..9559383 100644 --- a/src/dep/include/irrlicht/triangle3d.h +++ b/src/dep/include/irrlicht/triangle3d.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/vector2d.h b/src/dep/include/irrlicht/vector2d.h index d8e9adb..9f55626 100644 --- a/src/dep/include/irrlicht/vector2d.h +++ b/src/dep/include/irrlicht/vector2d.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/include/irrlicht/vector3d.h b/src/dep/include/irrlicht/vector3d.h index 0c50193..1cc026c 100644 --- a/src/dep/include/irrlicht/vector3d.h +++ b/src/dep/include/irrlicht/vector3d.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/BuiltInFont.h b/src/dep/src/irrlicht/BuiltInFont.h index 9da9d0a..551d1f8 100644 --- a/src/dep/src/irrlicht/BuiltInFont.h +++ b/src/dep/src/irrlicht/BuiltInFont.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/C3DSMeshFileLoader.cpp b/src/dep/src/irrlicht/C3DSMeshFileLoader.cpp index efe23a1..f5fedff 100644 --- a/src/dep/src/irrlicht/C3DSMeshFileLoader.cpp +++ b/src/dep/src/irrlicht/C3DSMeshFileLoader.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -366,7 +366,6 @@ bool C3DSMeshFileLoader::readMaterialChunk(io::IReadFile* file, ChunkData* paren break; case C3DS_MATSHININESS: readPercentageChunk(file, &data, CurrentMaterial.Material.Shininess); - CurrentMaterial.Material.Shininess = (1.f-CurrentMaterial.Material.Shininess)*128.f; break; case C3DS_TRANSPARENCY: { diff --git a/src/dep/src/irrlicht/C3DSMeshFileLoader.h b/src/dep/src/irrlicht/C3DSMeshFileLoader.h index 9add65f..478fd83 100644 --- a/src/dep/src/irrlicht/C3DSMeshFileLoader.h +++ b/src/dep/src/irrlicht/C3DSMeshFileLoader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CAnimatedMeshMD2.cpp b/src/dep/src/irrlicht/CAnimatedMeshMD2.cpp index 01de7b7..0742dcb 100644 --- a/src/dep/src/irrlicht/CAnimatedMeshMD2.cpp +++ b/src/dep/src/irrlicht/CAnimatedMeshMD2.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -6,7 +6,9 @@ #ifdef _IRR_COMPILE_WITH_MD2_LOADER_ #include "CAnimatedMeshMD2.h" +#include "os.h" #include "SColor.h" +#include "IReadFile.h" #include "irrMath.h" namespace irr @@ -14,8 +16,85 @@ namespace irr namespace scene { -const s32 MD2_FRAME_SHIFT = 2; -const f32 MD2_FRAME_SHIFT_RECIPROCAL = 1.f / ( 1 << MD2_FRAME_SHIFT ); +#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) +# pragma pack( push, packing ) +# pragma pack( 1 ) +# define PACK_STRUCT +#elif defined( __GNUC__ ) +# define PACK_STRUCT __attribute__((packed)) +#else +# error compiler not supported +#endif + + // structs needed to load the md2-format + + const s32 MD2_MAGIC_NUMBER = 844121161; + const s32 MD2_VERSION = 8; + const s32 MD2_MAX_VERTS = 2048; + + // TA: private + const s32 MD2_FRAME_SHIFT = 2; + const f32 MD2_FRAME_SHIFT_RECIPROCAL = 1.f / ( 1 << MD2_FRAME_SHIFT ); + + struct SMD2Header + { + s32 magic; + s32 version; + s32 skinWidth; + s32 skinHeight; + s32 frameSize; + s32 numSkins; + s32 numVertices; + s32 numTexcoords; + s32 numTriangles; + s32 numGlCommands; + s32 numFrames; + s32 offsetSkins; + s32 offsetTexcoords; + s32 offsetTriangles; + s32 offsetFrames; + s32 offsetGlCommands; + s32 offsetEnd; + } PACK_STRUCT; + + struct SMD2Vertex + { + u8 vertex[3]; + u8 lightNormalIndex; + } PACK_STRUCT; + + struct SMD2Frame + { + f32 scale[3]; + f32 translate[3]; + c8 name[16]; + SMD2Vertex vertices[1]; + } PACK_STRUCT; + + struct SMD2Triangle + { + u16 vertexIndices[3]; + u16 textureIndices[3]; + } PACK_STRUCT; + + struct SMD2TextureCoordinate + { + s16 s; + s16 t; + } PACK_STRUCT; + + struct SMD2GLCommand + { + f32 s, t; + s32 vertexIndex; + } PACK_STRUCT; + +// Default alignment +#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) +# pragma pack( pop, packing ) +#endif + +#undef PACK_STRUCT const s32 Q2_VERTEX_NORMAL_TABLE_SIZE = 162; @@ -220,7 +299,7 @@ static const SMD2AnimationType MD2AnimationTypeList[21] = //! constructor CAnimatedMeshMD2::CAnimatedMeshMD2() -: InterpolationBuffer(0), FrameList(0), FrameCount(0) +: InterpolationBuffer(0), FrameList(0), FrameCount(0), TriangleCount(0) { #ifdef _DEBUG IAnimatedMesh::setDebugName("CAnimatedMeshMD2 IAnimatedMesh"); @@ -238,6 +317,7 @@ CAnimatedMeshMD2::~CAnimatedMeshMD2() InterpolationBuffer->drop(); } + //! returns the amount of frames in milliseconds. If the amount is 1, it is a static (=non animated) mesh. u32 CAnimatedMeshMD2::getFrameCount() const { @@ -262,7 +342,7 @@ IMesh* CAnimatedMeshMD2::getMesh(s32 frame, s32 detailLevel, s32 startFrameLoop, } -//! returns amount of mesh buffers. MD2 meshes only have one buffer +//! returns amount of mesh buffers. u32 CAnimatedMeshMD2::getMeshBufferCount() const { return 1; @@ -272,10 +352,7 @@ u32 CAnimatedMeshMD2::getMeshBufferCount() const //! returns pointer to a mesh buffer IMeshBuffer* CAnimatedMeshMD2::getMeshBuffer(u32 nr) const { - if (nr == 0) - return InterpolationBuffer; - else - return 0; + return InterpolationBuffer; } @@ -294,7 +371,6 @@ void CAnimatedMeshMD2::updateInterpolationBuffer(s32 frame, s32 startFrameLoop, { u32 firstFrame, secondFrame; f32 div; - core::vector3df* NormalTable = (core::vector3df*)&Q2_VERTEX_NORMAL_TABLE; // TA: resolve missing ipol in loop between end-start @@ -322,24 +398,16 @@ void CAnimatedMeshMD2::updateInterpolationBuffer(s32 frame, s32 startFrameLoop, } video::S3DVertex* target = static_cast(InterpolationBuffer->getVertices()); - SMD2Vert* first = FrameList[firstFrame].pointer(); - SMD2Vert* second = FrameList[secondFrame].pointer(); + video::S3DVertex* first = FrameList[firstFrame].pointer(); + video::S3DVertex* second = FrameList[secondFrame].pointer(); // interpolate both frames const u32 count = FrameList[firstFrame].size(); for (u32 i=0; iPos.X) * FrameTransforms[firstFrame].scale.X + FrameTransforms[firstFrame].translate.X; - one.Y = f32(first->Pos.Y) * FrameTransforms[firstFrame].scale.Y + FrameTransforms[firstFrame].translate.Y; - one.Z = f32(first->Pos.Z) * FrameTransforms[firstFrame].scale.Z + FrameTransforms[firstFrame].translate.Z; - two.X = f32(second->Pos.X) * FrameTransforms[secondFrame].scale.X + FrameTransforms[secondFrame].translate.X; - two.Y = f32(second->Pos.Y) * FrameTransforms[secondFrame].scale.Y + FrameTransforms[secondFrame].translate.Y; - two.Z = f32(second->Pos.Z) * FrameTransforms[secondFrame].scale.Z + FrameTransforms[secondFrame].translate.Z; - target->Pos = (two - one) * div + one; + target->Pos = (second->Pos - first->Pos) * div + first->Pos; + target->Normal = (second->Normal - first->Normal) * div + first->Normal; - target->Normal = (NormalTable[second->NormalIdx] - NormalTable[first->NormalIdx]) * div - + NormalTable[first->NormalIdx]; ++target; ++first; ++second; @@ -350,6 +418,242 @@ void CAnimatedMeshMD2::updateInterpolationBuffer(s32 frame, s32 startFrameLoop, InterpolationBuffer->setDirty(); } + +//! loads an md2 file +bool CAnimatedMeshMD2::loadFile(io::IReadFile* file) +{ + if (!file) + return false; + + SMD2Header header; + + file->read(&header, sizeof(SMD2Header)); + +#ifdef __BIG_ENDIAN__ + header.magic = os::Byteswap::byteswap(header.magic); + header.version = os::Byteswap::byteswap(header.version); + header.skinWidth = os::Byteswap::byteswap(header.skinWidth); + header.skinHeight = os::Byteswap::byteswap(header.skinHeight); + header.frameSize = os::Byteswap::byteswap(header.frameSize); + header.numSkins = os::Byteswap::byteswap(header.numSkins); + header.numVertices = os::Byteswap::byteswap(header.numVertices); + header.numTexcoords = os::Byteswap::byteswap(header.numTexcoords); + header.numTriangles = os::Byteswap::byteswap(header.numTriangles); + header.numGlCommands = os::Byteswap::byteswap(header.numGlCommands); + header.numFrames = os::Byteswap::byteswap(header.numFrames); + header.offsetSkins = os::Byteswap::byteswap(header.offsetSkins); + header.offsetTexcoords = os::Byteswap::byteswap(header.offsetTexcoords); + header.offsetTriangles = os::Byteswap::byteswap(header.offsetTriangles); + header.offsetFrames = os::Byteswap::byteswap(header.offsetFrames); + header.offsetGlCommands = os::Byteswap::byteswap(header.offsetGlCommands); + header.offsetEnd = os::Byteswap::byteswap(header.offsetEnd); +#endif + + if (header.magic != MD2_MAGIC_NUMBER || header.version != MD2_VERSION) + { + os::Printer::log("MD2 Loader: Wrong file header", file->getFileName(), ELL_WARNING); + return false; + } + + // create Memory for indices and frames + + TriangleCount = header.numTriangles; + if (FrameList) + delete [] FrameList; + FrameList = new core::array[header.numFrames]; + FrameCount = header.numFrames; + + s32 i; + + for (i=0; iseek(header.offsetTexcoords); + SMD2TextureCoordinate* textureCoords = new SMD2TextureCoordinate[header.numTexcoords]; + + if (!file->read(textureCoords, sizeof(SMD2TextureCoordinate)*header.numTexcoords)) + { + os::Printer::log("MD2 Loader: Error reading TextureCoords.", file->getFileName(), ELL_ERROR); + return false; + } + +#ifdef __BIG_ENDIAN__ + for (i=0; iseek(header.offsetTriangles); + + SMD2Triangle *triangles = new SMD2Triangle[header.numTriangles]; + if (!file->read(triangles, header.numTriangles *sizeof(SMD2Triangle))) + { + os::Printer::log("MD2 Loader: Error reading triangles.", file->getFileName(), ELL_ERROR); + return false; + } + +#ifdef __BIG_ENDIAN__ + for (i=0; i* vertices = new core::array< core::vector3df >[header.numFrames]; + core::array< core::vector3df >* normals = new core::array< core::vector3df >[header.numFrames]; + + file->seek(header.offsetFrames); + + for (i = 0; iread(frame, header.frameSize); + +#ifdef __BIG_ENDIAN__ + frame->scale[0] = os::Byteswap::byteswap(frame->scale[0]); + frame->scale[1] = os::Byteswap::byteswap(frame->scale[1]); + frame->scale[2] = os::Byteswap::byteswap(frame->scale[2]); + frame->translate[0] = os::Byteswap::byteswap(frame->translate[0]); + frame->translate[1] = os::Byteswap::byteswap(frame->translate[1]); + frame->translate[2] = os::Byteswap::byteswap(frame->translate[2]); +#endif + // store frame data + + SFrameData fdata; + fdata.begin = i; + fdata.end = i; + fdata.fps = 7; + + if (frame->name[0]) + { + for (s32 s = 0; frame->name[s]!=0 && (frame->name[s] < '0' || + frame->name[s] > '9'); ++s) + fdata.name += frame->name[s]; + + if (!FrameData.empty() && FrameData[FrameData.size()-1].name == fdata.name) + ++FrameData[FrameData.size()-1].end; + else + FrameData.push_back(fdata); + } + + // add vertices + + vertices[i].reallocate(header.numVertices); + for (s32 j=0; jvertices[j].vertex[0] * frame->scale[0] + frame->translate[0]; + v.Z = frame->vertices[j].vertex[1] * frame->scale[1] + frame->translate[1]; + v.Y = frame->vertices[j].vertex[2] * frame->scale[2] + frame->translate[2]; + + vertices[i].push_back(v); + + u8 normalidx = frame->vertices[j].lightNormalIndex; + if (normalidx < Q2_VERTEX_NORMAL_TABLE_SIZE) + { + v.X = Q2_VERTEX_NORMAL_TABLE[normalidx][0]; + v.Z = Q2_VERTEX_NORMAL_TABLE[normalidx][1]; + v.Y = Q2_VERTEX_NORMAL_TABLE[normalidx][2]; + } + + normals[i].push_back(v); + } + + // calculate bounding boxes + if (header.numVertices) + { + core::aabbox3d box; + box.reset(vertices[i][0]); + + for (s32 j=1; j& vert = vertices[f]; + + for (s32 t=0; tIndices.reallocate(header.numVertices); + const u32 count = TriangleCount*3; + for (u32 n=0; nIndices.push_back(n); + InterpolationBuffer->Indices.push_back(n+1); + InterpolationBuffer->Indices.push_back(n+2); + } + + // reallocate interpolate buffer + if (header.numFrames) + { + const u32 currCount = FrameList[0].size(); + InterpolationBuffer->Vertices.set_used(currCount); + + for (u32 num=0; numVertices[num].TCoords = FrameList[0].pointer()[num].TCoords; + InterpolationBuffer->Vertices[num].Color = vtx.Color; + } + } + + // clean up + + delete [] normals; + delete [] vertices; + delete [] triangles; + delete [] textureCoords; + + // return + + calculateBoundingBox(); + + return true; +} + + //! calculates the bounding box void CAnimatedMeshMD2::calculateBoundingBox() { @@ -362,8 +666,8 @@ void CAnimatedMeshMD2::calculateBoundingBox() if (defaultFrame>=FrameCount) defaultFrame = 0; -// for (u32 j=0; jBoundingBox.addInternalPoint(FrameList[defaultFrame].pointer()[j].Pos); + for (u32 j=0; jBoundingBox.addInternalPoint(FrameList[defaultFrame].pointer()[j].Pos); } } @@ -432,14 +736,14 @@ void CAnimatedMeshMD2::getFrameLoop(EMD2_ANIMATION_TYPE l, bool CAnimatedMeshMD2::getFrameLoop(const c8* name, s32& outBegin, s32&outEnd, s32& outFPS) const { - for (u32 i=0; i < AnimationData.size(); ++i) + for (u32 i=0; i= AnimationData.size()) + if ((u32)nr >= FrameData.size()) return 0; - return AnimationData[nr].name.c_str(); + return FrameData[nr].name.c_str(); } diff --git a/src/dep/src/irrlicht/CAnimatedMeshMD2.h b/src/dep/src/irrlicht/CAnimatedMeshMD2.h index 8b552b5..9307f45 100644 --- a/src/dep/src/irrlicht/CAnimatedMeshMD2.h +++ b/src/dep/src/irrlicht/CAnimatedMeshMD2.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -28,6 +28,9 @@ namespace scene //! destructor virtual ~CAnimatedMeshMD2(); + //! loads an md2 file + virtual bool loadFile(io::IReadFile* file); + //! returns the amount of frames in milliseconds. If the amount is 1, it is a static (=non animated) mesh. virtual u32 getFrameCount() const; @@ -79,16 +82,19 @@ namespace scene //! \param nr: Zero based index of animation. virtual const c8* getAnimationName(s32 nr) const; + private: - // - // exposed for loader - // + //! updates the interpolation buffer + void updateInterpolationBuffer(s32 frame, s32 startFrame, s32 endFrame); + + //! calculates the bounding box + virtual void calculateBoundingBox(); - //! the buffer that contains the most recent animation SMeshBuffer* InterpolationBuffer; + core::array *FrameList; + core::array > BoxList; - //! named animations - struct SAnimationData + struct SFrameData { core::stringc name; s32 begin; @@ -96,44 +102,10 @@ namespace scene s32 fps; }; - //! scale and translations for keyframes - struct SKeyFrameTransform - { - core::vector3df scale; - core::vector3df translate; - }; - - //! md2 vertex data - struct SMD2Vert - { - core::vector3d Pos; - u8 NormalIdx; - }; - - //! keyframe transformations - core::array FrameTransforms; - - //! keyframe vertex data - core::array *FrameList; - - //! bounding boxes for each keyframe - core::array > BoxList; - - //! named animations - core::array< SAnimationData > AnimationData; - - //! calculates the bounding box - virtual void calculateBoundingBox(); + core::array< SFrameData > FrameData; u32 FrameCount; s32 TriangleCount; - - private: - - //! updates the interpolation buffer - void updateInterpolationBuffer(s32 frame, s32 startFrame, s32 endFrame); - - }; } // end namespace scene diff --git a/src/dep/src/irrlicht/CAnimatedMeshMD3.cpp b/src/dep/src/irrlicht/CAnimatedMeshMD3.cpp index 28391fb..27e1045 100644 --- a/src/dep/src/irrlicht/CAnimatedMeshMD3.cpp +++ b/src/dep/src/irrlicht/CAnimatedMeshMD3.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Fabio Concas / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Fabio Concas / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CAnimatedMeshMD3.h b/src/dep/src/irrlicht/CAnimatedMeshMD3.h index c5c8445..cafafb7 100644 --- a/src/dep/src/irrlicht/CAnimatedMeshMD3.h +++ b/src/dep/src/irrlicht/CAnimatedMeshMD3.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CAnimatedMeshSceneNode.cpp b/src/dep/src/irrlicht/CAnimatedMeshSceneNode.cpp index e586887..58d7e3c 100644 --- a/src/dep/src/irrlicht/CAnimatedMeshSceneNode.cpp +++ b/src/dep/src/irrlicht/CAnimatedMeshSceneNode.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -32,8 +32,9 @@ CAnimatedMeshSceneNode::CAnimatedMeshSceneNode(IAnimatedMesh* mesh, const core::vector3df& rotation, const core::vector3df& scale) : IAnimatedMeshSceneNode(parent, mgr, id, position, rotation, scale), Mesh(0), + MeshForCurrentFrame(0), BeginFrameTime(0), StartFrame(0), EndFrame(0), FramesPerSecond(0.f), - CurrentFrameNr(0.f), + CurrentFrameNr(0.f), FrameWhenCurrentMeshWasGenerated(0.f), JointMode(EJUOR_NONE), JointsUsed(false), TransitionTime(0), Transiting(0.f), TransitingBlend(0.f), Looping(true), ReadOnlyMaterials(false), RenderFromIdentity(0), @@ -204,7 +205,8 @@ IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame(void) { if(Mesh->getMeshType() != EAMT_SKINNED) { - return Mesh->getMesh((s32)getFrameNr(), 255, StartFrame, EndFrame); + if(!MeshForCurrentFrame || !core::equals(CurrentFrameNr, FrameWhenCurrentMeshWasGenerated)) + MeshForCurrentFrame = Mesh->getMesh((s32)getFrameNr(), 255, StartFrame, EndFrame); } else { @@ -239,8 +241,11 @@ IMesh * CAnimatedMeshSceneNode::getMeshForCurrentFrame(void) skinnedMesh->updateBoundingBox(); } - return skinnedMesh; + MeshForCurrentFrame = skinnedMesh; } + + FrameWhenCurrentMeshWasGenerated = CurrentFrameNr; + return MeshForCurrentFrame; } diff --git a/src/dep/src/irrlicht/CAnimatedMeshSceneNode.h b/src/dep/src/irrlicht/CAnimatedMeshSceneNode.h index 3d4e864..efb67f7 100644 --- a/src/dep/src/irrlicht/CAnimatedMeshSceneNode.h +++ b/src/dep/src/irrlicht/CAnimatedMeshSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -171,12 +171,14 @@ namespace scene core::array Materials; core::aabbox3d Box; IAnimatedMesh* Mesh; + IMesh* MeshForCurrentFrame; u32 BeginFrameTime; s32 StartFrame; s32 EndFrame; f32 FramesPerSecond; f32 CurrentFrameNr; + f32 FrameWhenCurrentMeshWasGenerated; //0-unused, 1-get joints only, 2-set joints only, 3-move and set E_JOINT_UPDATE_ON_RENDER JointMode; diff --git a/src/dep/src/irrlicht/CAttributeImpl.h b/src/dep/src/irrlicht/CAttributeImpl.h index ce00660..9654e83 100644 --- a/src/dep/src/irrlicht/CAttributeImpl.h +++ b/src/dep/src/irrlicht/CAttributeImpl.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CAttributes.cpp b/src/dep/src/irrlicht/CAttributes.cpp index 62cb9d3..21443ef 100644 --- a/src/dep/src/irrlicht/CAttributes.cpp +++ b/src/dep/src/irrlicht/CAttributes.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CAttributes.h b/src/dep/src/irrlicht/CAttributes.h index 09fe8dc..c001a88 100644 --- a/src/dep/src/irrlicht/CAttributes.h +++ b/src/dep/src/irrlicht/CAttributes.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CB3DMeshFileLoader.cpp b/src/dep/src/irrlicht/CB3DMeshFileLoader.cpp index 092cb83..1fd7422 100644 --- a/src/dep/src/irrlicht/CB3DMeshFileLoader.cpp +++ b/src/dep/src/irrlicht/CB3DMeshFileLoader.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2006-2009 Luke Hoschke +// Copyright (C) 2006-2008 Luke Hoschke // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CB3DMeshFileLoader.h b/src/dep/src/irrlicht/CB3DMeshFileLoader.h index 5f9099e..151ea1c 100644 --- a/src/dep/src/irrlicht/CB3DMeshFileLoader.h +++ b/src/dep/src/irrlicht/CB3DMeshFileLoader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2006-2009 Luke Hoschke +// Copyright (C) 2006-2008 Luke Hoschke // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CBSPMeshFileLoader.cpp b/src/dep/src/irrlicht/CBSPMeshFileLoader.cpp index daedbff..11553fc 100644 --- a/src/dep/src/irrlicht/CBSPMeshFileLoader.cpp +++ b/src/dep/src/irrlicht/CBSPMeshFileLoader.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CBSPMeshFileLoader.h b/src/dep/src/irrlicht/CBSPMeshFileLoader.h index db17392..88e3612 100644 --- a/src/dep/src/irrlicht/CBSPMeshFileLoader.h +++ b/src/dep/src/irrlicht/CBSPMeshFileLoader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CBillboardSceneNode.cpp b/src/dep/src/irrlicht/CBillboardSceneNode.cpp index 2e07989..86cd70d 100644 --- a/src/dep/src/irrlicht/CBillboardSceneNode.cpp +++ b/src/dep/src/irrlicht/CBillboardSceneNode.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CBillboardSceneNode.h b/src/dep/src/irrlicht/CBillboardSceneNode.h index ae70526..d4f96a9 100644 --- a/src/dep/src/irrlicht/CBillboardSceneNode.h +++ b/src/dep/src/irrlicht/CBillboardSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CBoneSceneNode.cpp b/src/dep/src/irrlicht/CBoneSceneNode.cpp index 3363cd2..a12563d 100644 --- a/src/dep/src/irrlicht/CBoneSceneNode.cpp +++ b/src/dep/src/irrlicht/CBoneSceneNode.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CBoneSceneNode.h b/src/dep/src/irrlicht/CBoneSceneNode.h index f6528e7..263e91f 100644 --- a/src/dep/src/irrlicht/CBoneSceneNode.h +++ b/src/dep/src/irrlicht/CBoneSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CBurningShader_Raster_Reference.cpp b/src/dep/src/irrlicht/CBurningShader_Raster_Reference.cpp new file mode 100644 index 0000000..3706f47 --- /dev/null +++ b/src/dep/src/irrlicht/CBurningShader_Raster_Reference.cpp @@ -0,0 +1,1119 @@ +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#include "IrrCompileConfig.h" +#include "IBurningShader.h" + +#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_ + + +namespace irr +{ + +namespace video +{ + + /*! Render states define set-up states for all kinds of vertex and pixel processing. + Some render states set up vertex processing, and some set up pixel processing (see Render States). + Render states can be saved and restored using stateblocks (see State Blocks Save and Restore State). + */ + enum BD3DRENDERSTATETYPE + { + /*! BD3DRS_ZENABLE + Depth-buffering state as one member of the BD3DZBUFFERTYPE enumerated type. + Set this state to D3DZB_TRUE to enable z-buffering, + D3DZB_USEW to enable w-buffering, or D3DZB_FALSE to disable depth buffering. + The default value for this render state is D3DZB_TRUE if a depth stencil was created + along with the swap chain by setting the EnableAutoDepthStencil member of the + D3DPRESENT_PARAMETERS structure to TRUE, and D3DZB_FALSE otherwise. + */ + BD3DRS_ZENABLE, + + /*! BD3DRS_FILLMODE + One or more members of the D3DFILLMODE enumerated type. The default value is D3DFILL_SOLID. + */ + BD3DRS_FILLMODE, + + /*! BD3DRS_SHADEMODE + One or more members of the D3DSHADEMODE enumerated type. The default value is D3DSHADE_GOURAUD. + */ + BD3DRS_SHADEMODE, + + /*! BD3DRS_ZWRITEENABLE + TRUE to enable the application to write to the depth buffer. The default value is TRUE. + This member enables an application to prevent the system from updating the depth buffer with + new depth values. If FALSE, depth comparisons are still made according to the render state + D3DRS_ZFUNC, assuming that depth buffering is taking place, but depth values are not written + to the buffer. + */ + BD3DRS_ZWRITEENABLE, + + /*! BD3DRS_ALPHATESTENABLE + TRUE to enable per pixel alpha testing. If the test passes, the pixel is processed by the frame + buffer. Otherwise, all frame-buffer processing is skipped for the pixel. The test is done by + comparing the incoming alpha value with the reference alpha value, using the comparison function + provided by the D3DRS_ALPHAFUNC render state. The reference alpha value is determined by the value + set for D3DRS_ALPHAREF. For more information, see Alpha Testing State. + The default value of this parameter is FALSE. + */ + BD3DRS_ALPHATESTENABLE, + + /*! BD3DRS_SRCBLEND + One member of the BD3DBLEND enumerated type. The default value is BD3DBLEND_ONE. + */ + BD3DRS_SRCBLEND, + + /*! BD3DRS_DESTBLEND + One member of the BD3DBLEND enumerated type. The default value is BD3DBLEND_ZERO. + */ + BD3DRS_DESTBLEND, + + /*! BD3DRS_CULLMODE + Specifies how back-facing triangles are culled, if at all. This can be set to one + member of the BD3DCULL enumerated type. The default value is BD3DCULL_CCW. + */ + BD3DRS_CULLMODE, + + /*! BD3DRS_ZFUNC + One member of the BD3DCMPFUNC enumerated type. The default value is BD3DCMP_LESSEQUAL. + This member enables an application to accept or reject a pixel, based on its distance from + the camera. The depth value of the pixel is compared with the depth-buffer value. If the depth + value of the pixel passes the comparison function, the pixel is written. + + The depth value is written to the depth buffer only if the render state is TRUE. + Software rasterizers and many hardware accelerators work faster if the depth test fails, + because there is no need to filter and modulate the texture if the pixel is not going to be + rendered. + */ + BD3DRS_ZFUNC, + + /*! BD3DRS_ALPHAREF + Value that specifies a reference alpha value against which pixels are tested when alpha testing + is enabled. This is an 8-bit value placed in the low 8 bits of the DWORD render-state value. + Values can range from 0x00000000 through 0x000000FF. The default value is 0. + */ + BD3DRS_ALPHAREF, + + /*! BD3DRS_ALPHAFUNC + One member of the BD3DCMPFUNC enumerated type. The default value is BD3DCMP_ALWAYS. + This member enables an application to accept or reject a pixel, based on its alpha value. + */ + BD3DRS_ALPHAFUNC, + + /*! BD3DRS_DITHERENABLE + TRUE to enable dithering. The default value is FALSE. + */ + BD3DRS_DITHERENABLE, + + /*! BD3DRS_ALPHABLENDENABLE + TRUE to enable alpha-blended transparency. The default value is FALSE. + The type of alpha blending is determined by the BD3DRS_SRCBLEND and BD3DRS_DESTBLEND render states. + */ + BD3DRS_ALPHABLENDENABLE, + + /*! BD3DRS_FOGENABLE + TRUE to enable fog blending. The default value is FALSE. For more information about using fog + blending, see Fog. + */ + BD3DRS_FOGENABLE, + + /*! BD3DRS_SPECULARENABLE + TRUE to enable specular highlights. The default value is FALSE. + Specular highlights are calculated as though every vertex in the object being lit is at the + object's origin. This gives the expected results as long as the object is modeled around the + origin and the distance from the light to the object is relatively large. In other cases, the + results as undefined. + When this member is set to TRUE, the specular color is added to the base color after the + texture cascade but before alpha blending. + */ + BD3DRS_SPECULARENABLE, + + /*! BD3DRS_FOGCOLOR + Value whose type is D3DCOLOR. The default value is 0. For more information about fog color, + see Fog Color. + */ + BD3DRS_FOGCOLOR, + + /*! BD3DRS_FOGTABLEMODE + The fog formula to be used for pixel fog. Set to one of the members of the D3DFOGMODE + enumerated type. The default value is D3DFOG_NONE. For more information about pixel fog, + see Pixel Fog. + */ + BD3DRS_FOGTABLEMODE, + + /*! BD3DRS_FOGSTART + Depth at which pixel or vertex fog effects begin for linear fog mode. The default value is 0.0f. + Depth is specified in world space for vertex fog and either device space [0.0, 1.0] or world + space for pixel fog. For pixel fog, these values are in device space when the system uses z for + fog calculations and world-world space when the system is using eye-relative fog (w-fog). For + more information, see Fog Parameters and Eye-Relative vs. Z-based Depth. + Values for the this render state are floating-point values. + Because the IDirect3DDevice9::SetRenderState method accepts DWORD values, your + application must cast a variable that contains the value, as shown in the following code example. + pDevice9->SetRenderState( BD3DRS_FOGSTART, *((DWORD*) (&fFogStart))); + */ + BD3DRS_FOGSTART, + + /*! BD3DRS_FOGEND + Depth at which pixel or vertex fog effects end for linear fog mode. The default value is 1.0f. + Depth is specified in world space for vertex fog and either device space [0.0, 1.0] or world space + for pixel fog. For pixel fog, these values are in device space when the system uses z for fog + calculations and in world space when the system is using eye-relative fog (w-fog). For more + information, see Fog Parameters and Eye-Relative vs. Z-based Depth. + Values for this render state are floating-point values. + */ + BD3DRS_FOGEND, + + /*! BD3DRS_FOGDENSITY + Fog density for pixel or vertex fog used in the exponential fog modes (D3DFOG_EXP and D3DFOG_EXP2). + Valid density values range from 0.0 through 1.0. The default value is 1.0. For more information, + see Fog Parameters. + Values for this render state are floating-point values. + */ + BD3DRS_FOGDENSITY, + + + /*! BD3DRS_RANGEFOGENABLE + TRUE to enable range-based vertex fog. The default value is FALSE, in which case the system + uses depth-based fog. In range-based fog, the distance of an object from the viewer is used + to compute fog effects, not the depth of the object (that is, the z-coordinate) in the scene. + In range-based fog, all fog methods work as usual, except that they use range instead of depth + in the computations. + Range is the correct factor to use for fog computations, but depth is commonly used instead + because range is time-consuming to compute and depth is generally already available. Using depth + to calculate fog has the undesirable effect of having the fogginess of peripheral objects change + as the viewer's eye moves - in this case, the depth changes and the range remains constant. + + Because no hardware currently supports per-pixel range-based fog, range correction is offered + only for vertex fog. + For more information, see Vertex Fog. + */ + BD3DRS_RANGEFOGENABLE = 48, + + /*! BD3DRS_STENCILENABLE + TRUE to enable stenciling, or FALSE to disable stenciling. The default value is FALSE. + For more information, see Stencil Buffer Techniques. + */ + BD3DRS_STENCILENABLE = 52, + + /*! BD3DRS_STENCILFAIL + Stencil operation to perform if the stencil test fails. Values are from the D3DSTENCILOP + enumerated type. The default value is D3DSTENCILOP_KEEP. + */ + BD3DRS_STENCILFAIL = 53, + + /*! BD3DRS_STENCILZFAIL + Stencil operation to perform if the stencil test passes and the depth test (z-test) fails. + Values are from the D3DSTENCILOP enumerated type. The default value is D3DSTENCILOP_KEEP. + */ + BD3DRS_STENCILZFAIL = 54, + + /*! BD3DRS_STENCILPASS + Stencil operation to perform if both the stencil and the depth (z) tests pass. Values are + from the D3DSTENCILOP enumerated type. The default value is D3DSTENCILOP_KEEP. + */ + BD3DRS_STENCILPASS = 55, + + /*! BD3DRS_STENCILFUNC + Comparison function for the stencil test. Values are from the D3DCMPFUNC enumerated type. + The default value is D3DCMP_ALWAYS. + The comparison function is used to compare the reference value to a stencil buffer entry. + This comparison applies only to the bits in the reference value and stencil buffer entry that + are set in the stencil mask (set by the D3DRS_STENCILMASK render state). If TRUE, the stencil + test passes. + */ + BD3DRS_STENCILFUNC = 56, + + /*! BD3DRS_STENCILREF + An int reference value for the stencil test. The default value is 0. + */ + BD3DRS_STENCILREF = 57, + + /*! BD3DRS_STENCILMASK + Mask applied to the reference value and each stencil buffer entry to determine the significant + bits for the stencil test. The default mask is 0xFFFFFFFF. + */ + BD3DRS_STENCILMASK = 58, + + /*! BD3DRS_STENCILWRITEMASK + Write mask applied to values written into the stencil buffer. The default mask is 0xFFFFFFFF. + */ + BD3DRS_STENCILWRITEMASK = 59, + + /*! BD3DRS_TEXTUREFACTOR + Color used for multiple-texture blending with the D3DTA_TFACTOR texture-blending argument or the + D3DTOP_BLENDFACTORALPHA texture-blending operation. The associated value is a D3DCOLOR variable. + The default value is opaque white (0xFFFFFFFF). + */ + BD3DRS_TEXTUREFACTOR = 60, + + /*! BD3DRS_WRAP0 + Texture-wrapping behavior for multiple sets of texture coordinates. Valid values for this + render state can be any combination of the D3DWRAPCOORD_0 (or D3DWRAP_U), D3DWRAPCOORD_1 + (or D3DWRAP_V), D3DWRAPCOORD_2 (or D3DWRAP_W), and D3DWRAPCOORD_3 flags. These cause the system + to wrap in the direction of the first, second, third, and fourth dimensions, sometimes referred + to as the s, t, r, and q directions, for a given texture. The default value for this render state + is 0 (wrapping disabled in all directions). + */ + BD3DRS_WRAP0 = 128, + BD3DRS_WRAP1 = 129, + BD3DRS_WRAP2 = 130, + BD3DRS_WRAP3 = 131, + BD3DRS_WRAP4 = 132, + BD3DRS_WRAP5 = 133, + BD3DRS_WRAP6 = 134, + BD3DRS_WRAP7 = 135, + + /*! BD3DRS_CLIPPING + TRUE to enable primitive clipping by Direct3D, or FALSE to disable it. The default value is TRUE. + */ + BD3DRS_CLIPPING = 136, + + /*! BD3DRS_LIGHTING + TRUE to enable Direct3D lighting, or FALSE to disable it. The default value is TRUE. Only + vertices that include a vertex normal are properly lit; vertices that do not contain a normal + employ a dot product of 0 in all lighting calculations. + */ + BD3DRS_LIGHTING = 137, + + /*! D3DRS_AMBIENT + Ambient light color. This value is of type D3DCOLOR. The default value is 0. + */ + BD3DRS_AMBIENT = 139, + + /*! BD3DRS_FOGVERTEXMODE + Fog formula to be used for vertex fog. Set to one member of the BD3DFOGMODE enumerated type. + The default value is D3DFOG_NONE. + */ + BD3DRS_FOGVERTEXMODE = 140, + + /*! BD3DRS_COLORVERTEX + TRUE to enable per-vertex color or FALSE to disable it. The default value is TRUE. Enabling + per-vertex color allows the system to include the color defined for individual vertices in its + lighting calculations. + For more information, see the following render states: + BD3DRS_DIFFUSEMATERIALSOURCE + BD3DRS_SPECULARMATERIALSOURCE + BD3DRS_AMBIENTMATERIALSOURCE + BD3DRS_EMISSIVEMATERIALSOURCE + */ + BD3DRS_COLORVERTEX = 141, + + /*! BD3DRS_LOCALVIEWER + TRUE to enable camera-relative specular highlights, or FALSE to use orthogonal specular + highlights. The default value is TRUE. Applications that use orthogonal projection should + specify false. + */ + BD3DRS_LOCALVIEWER = 142, + + /*! BD3DRS_NORMALIZENORMALS + TRUE to enable automatic normalization of vertex normals, or FALSE to disable it. The default + value is FALSE. Enabling this feature causes the system to normalize the vertex normals for + vertices after transforming them to camera space, which can be computationally time-consuming. + */ + BD3DRS_NORMALIZENORMALS = 143, + + /*! BD3DRS_DIFFUSEMATERIALSOURCE + Diffuse color source for lighting calculations. Valid values are members of the + D3DMATERIALCOLORSOURCE enumerated type. The default value is D3DMCS_COLOR1. The value for this + render state is used only if the D3DRS_COLORVERTEX render state is set to TRUE. + */ + BD3DRS_DIFFUSEMATERIALSOURCE = 145, + + /*! BD3DRS_SPECULARMATERIALSOURCE + Specular color source for lighting calculations. Valid values are members of the + D3DMATERIALCOLORSOURCE enumerated type. The default value is D3DMCS_COLOR2. + */ + BD3DRS_SPECULARMATERIALSOURCE = 146, + + /*! D3DRS_AMBIENTMATERIALSOURCE + Ambient color source for lighting calculations. Valid values are members of the + D3DMATERIALCOLORSOURCE enumerated type. The default value is D3DMCS_MATERIAL. + */ + BD3DRS_AMBIENTMATERIALSOURCE = 147, + + /*! D3DRS_EMISSIVEMATERIALSOURCE + Emissive color source for lighting calculations. Valid values are members of the + D3DMATERIALCOLORSOURCE enumerated type. The default value is D3DMCS_MATERIAL. + */ + BD3DRS_EMISSIVEMATERIALSOURCE = 148, + + /*! D3DRS_VERTEXBLEND + Number of matrices to use to perform geometry blending, if any. Valid values are members + of the D3DVERTEXBLENDFLAGS enumerated type. The default value is D3DVBF_DISABLE. + */ + BD3DRS_VERTEXBLEND = 151, + + /* D3DRS_CLIPPLANEENABLE + Enables or disables user-defined clipping planes. Valid values are any DWORD in which the + status of each bit (set or not set) toggles the activation state of a corresponding user-defined + clipping plane. The least significant bit (bit 0) controls the first clipping plane at index 0, + and subsequent bits control the activation of clipping planes at higher indexes. If a bit is set, + the system applies the appropriate clipping plane during scene rendering. The default value is 0. + The D3DCLIPPLANEn macros are defined to provide a convenient way to enable clipping planes. + */ + BD3DRS_CLIPPLANEENABLE = 152, + BD3DRS_POINTSIZE = 154, + BD3DRS_POINTSIZE_MIN = 155, + BD3DRS_POINTSPRITEENABLE = 156, + BD3DRS_POINTSCALEENABLE = 157, + BD3DRS_POINTSCALE_A = 158, + BD3DRS_POINTSCALE_B = 159, + BD3DRS_POINTSCALE_C = 160, + BD3DRS_MULTISAMPLEANTIALIAS = 161, + BD3DRS_MULTISAMPLEMASK = 162, + BD3DRS_PATCHEDGESTYLE = 163, + BD3DRS_DEBUGMONITORTOKEN = 165, + BD3DRS_POINTSIZE_MAX = 166, + BD3DRS_INDEXEDVERTEXBLENDENABLE = 167, + BD3DRS_COLORWRITEENABLE = 168, + BD3DRS_TWEENFACTOR = 170, + BD3DRS_BLENDOP = 171, + BD3DRS_POSITIONDEGREE = 172, + BD3DRS_NORMALDEGREE = 173, + BD3DRS_SCISSORTESTENABLE = 174, + BD3DRS_SLOPESCALEDEPTHBIAS = 175, + BD3DRS_ANTIALIASEDLINEENABLE = 176, + BD3DRS_MINTESSELLATIONLEVEL = 178, + BD3DRS_MAXTESSELLATIONLEVEL = 179, + BD3DRS_ADAPTIVETESS_X = 180, + BD3DRS_ADAPTIVETESS_Y = 181, + BD3DRS_ADAPTIVETESS_Z = 182, + BD3DRS_ADAPTIVETESS_W = 183, + BD3DRS_ENABLEADAPTIVETESSELLATION = 184, + BD3DRS_TWOSIDEDSTENCILMODE = 185, + BD3DRS_CCW_STENCILFAIL = 186, + BD3DRS_CCW_STENCILZFAIL = 187, + BD3DRS_CCW_STENCILPASS = 188, + BD3DRS_CCW_STENCILFUNC = 189, + BD3DRS_COLORWRITEENABLE1 = 190, + BD3DRS_COLORWRITEENABLE2 = 191, + BD3DRS_COLORWRITEENABLE3 = 192, + BD3DRS_BLENDFACTOR = 193, + BD3DRS_SRGBWRITEENABLE = 194, + BD3DRS_DEPTHBIAS = 195, + BD3DRS_WRAP8 = 198, + BD3DRS_WRAP9 = 199, + BD3DRS_WRAP10 = 200, + BD3DRS_WRAP11 = 201, + BD3DRS_WRAP12 = 202, + BD3DRS_WRAP13 = 203, + BD3DRS_WRAP14 = 204, + BD3DRS_WRAP15 = 205, + BD3DRS_SEPARATEALPHABLENDENABLE = 206, + BD3DRS_SRCBLENDALPHA = 207, + BD3DRS_DESTBLENDALPHA = 208, + BD3DRS_BLENDOPALPHA = 209, + + BD3DRS_MAX_TYPE + }; + + + + /*! Defines constants that describe depth-buffer formats + Members of this enumerated type are used with the D3DRS_ZENABLE render state. + */ + enum BD3DZBUFFERTYPE + { + BD3DZB_FALSE = 0, // Disable depth buffering + BD3DZB_TRUE = 1, // Enable z-buffering + BD3DZB_USEW = 2 //Enable w-buffering. + }; + + //! Defines the supported compare functions. + enum BD3DCMPFUNC + { + BD3DCMP_NEVER = 1,// Always fail the test. + BD3DCMP_LESS, // Accept the new pixel if its value is less than the value of the current pixel. + BD3DCMP_EQUAL, // Accept the new pixel if its value equals the value of the current pixel. + BD3DCMP_LESSEQUAL, // Accept the new pixel if its value is less than or equal to the value of the current pixel. + BD3DCMP_GREATER, // Accept the new pixel if its value is greater than the value of the current pixel. + BD3DCMP_NOTEQUAL, // Accept the new pixel if its value does not equal the value of the current pixel. + BD3DCMP_GREATEREQUAL,// Accept the new pixel if its value is greater than or equal to the value of the current pixel. + BD3DCMP_ALWAYS // Always pass the test. + }; + + enum BD3DMATERIALCOLORSOURCE + { + BD3DMCS_MATERIAL = 0, // Use the color from the current material. + BD3DMCS_COLOR1 = 1, // Use the diffuse vertex color. + BD3DMCS_COLOR2 = 2 // Use the specular vertex color. + }; + + + //! Defines constants that describe the supported shading modes. + enum BD3DSHADEMODE + { + /*! BD3DSHADE_FLAT + Flat shading mode. The color and specular component of the first vertex in the triangle + are used to determine the color and specular component of the face. These colors remain + constant across the triangle; that is, they are not interpolated. The specular alpha is + interpolated. + */ + BD3DSHADE_FLAT = 1, + + /*! BD3DSHADE_GOURAUD + Gouraud shading mode. The color and specular components of the face are determined by a + linear interpolation between all three of the triangle's vertices. + */ + BD3DSHADE_GOURAUD = 2, + + /*! BD3DSHADE_PHONG + Not supported. + */ + BD3DSHADE_PHONG = 3 + }; + + /*! Defines constants describing the fill mode + The values in this enumerated type are used by the BD3DRS_FILLMODE render state + */ + enum BD3DFILLMODE + { + BD3DFILL_POINT = 1, // Fill points. + BD3DFILL_WIREFRAME = 2, // Fill wireframes. + BD3DFILL_SOLID = 3 // Fill solids. + }; + + + + /*! Defines the supported culling modes. + The values in this enumerated type are used by the B3DRS_CULLMODE render state. + The culling modes define how back faces are culled when rendering a geometry. + */ + enum BD3DCULL + { + BD3DCULL_NONE = 1, // Do not cull back faces. + BD3DCULL_CW = 2, // Cull back faces with clockwise vertices. + BD3DCULL_CCW = 3 // Cull back faces with counterclockwise vertices. + }; + + struct SShaderParam + { + u32 ColorUnits; + u32 TextureUnits; + + u32 RenderState [ BD3DRS_MAX_TYPE ]; + void SetRenderState ( BD3DRENDERSTATETYPE state, u32 value ); + }; + + void SShaderParam::SetRenderState ( BD3DRENDERSTATETYPE state, u32 value ) + { + RenderState [ state ] = value; + } + + + +class CBurningShader_Raster_Reference : public IBurningShader +{ +public: + + //! constructor + CBurningShader_Raster_Reference(IDepthBuffer* depthBuffer); + + //! draws an indexed triangle list + virtual void drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4DVertex *c ); + + virtual void setMaterial ( const SBurningShaderMaterial &material ); + + +private: + void scanline (); + void scanline2 (); + + sScanLineData line; + sPixelShaderData pShader; + + void pShader_1 (); + void pShader_EMT_LIGHTMAP_M4 (); + + SShaderParam ShaderParam; + + REALINLINE u32 depthFunc (); + REALINLINE void depthWrite (); + + +}; + +//! constructor +CBurningShader_Raster_Reference::CBurningShader_Raster_Reference(IDepthBuffer* depthBuffer) +: IBurningShader(depthBuffer) +{ + #ifdef _DEBUG + setDebugName("CBurningShader_Raster_Reference"); + #endif +} + + +/*! +*/ +void CBurningShader_Raster_Reference::pShader_EMT_LIGHTMAP_M4 () +{ + tFixPoint r0, g0, b0; + tFixPoint r1, g1, b1; + + f32 inversew = fix_inverse32 ( line.w[0] ); + + getSample_texture ( r0, g0, b0, &IT[0], f32_to_fixPoint ( line.t[0][0].x,inversew), f32_to_fixPoint ( line.t[0][0].y,inversew) ); + getSample_texture ( r1, g1, b1, &IT[1], f32_to_fixPoint ( line.t[1][0].x,inversew), f32_to_fixPoint ( line.t[1][0].y,inversew) ); + + + pShader.dst[pShader.i] = fix_to_color ( clampfix_maxcolor ( imulFix_tex2 ( r0, r1 ) ), + clampfix_maxcolor ( imulFix_tex2 ( g0, g1 ) ), + clampfix_maxcolor ( imulFix_tex2 ( b0, b1 ) ) + ); + +} + +/*! +*/ +void CBurningShader_Raster_Reference::pShader_1 () +{ + tFixPoint r0, g0, b0; + tFixPoint tx0, ty0; + + const f32 inversew = fix_inverse32 ( line.w[0] ); + + tx0 = f32_to_fixPoint ( line.t[0][0].x, inversew ); + ty0 = f32_to_fixPoint ( line.t[0][0].y, inversew ); + + getSample_texture ( r0, g0, b0, &IT[0], tx0, ty0 ); + pShader.dst[pShader.i] = fix_to_color ( r0, g0, b0 ); + +} + + +/*! +*/ +void CBurningShader_Raster_Reference::setMaterial ( const SBurningShaderMaterial &material ) +{ + const video::SMaterial &m = material.org; + + u32 i; + u32 enable; + + ShaderParam.ColorUnits = 0; + ShaderParam.TextureUnits = 0; + for ( i = 0; i != BURNING_MATERIAL_MAX_TEXTURES; ++i ) + { + if ( m.getTexture( i ) ) + ShaderParam.TextureUnits = i; + } + + // shademode + ShaderParam.SetRenderState( BD3DRS_SHADEMODE, + m.GouraudShading ? BD3DSHADE_GOURAUD : BD3DSHADE_FLAT + ); + + // fillmode + ShaderParam.SetRenderState( BD3DRS_FILLMODE, + m.Wireframe ? BD3DFILL_WIREFRAME : m.PointCloud ? BD3DFILL_POINT : BD3DFILL_SOLID + ); + + // back face culling + ShaderParam.SetRenderState( BD3DRS_CULLMODE, + m.BackfaceCulling ? BD3DCULL_CCW : BD3DCULL_NONE + ); + + // lighting + ShaderParam.SetRenderState( BD3DRS_LIGHTING, m.Lighting ); + + // specular highlights + enable = F32_LOWER_EQUAL_0 ( m.Shininess ); + ShaderParam.SetRenderState( BD3DRS_SPECULARENABLE, enable); + ShaderParam.SetRenderState( BD3DRS_NORMALIZENORMALS, enable); + ShaderParam.SetRenderState( BD3DRS_SPECULARMATERIALSOURCE, BD3DMCS_MATERIAL); + + // depth buffer enable and compare + ShaderParam.SetRenderState( BD3DRS_ZENABLE, material.org.ZBuffer ? BD3DZB_USEW : BD3DZB_FALSE); + ShaderParam.SetRenderState( BD3DRS_ZFUNC, material.org.ZBuffer == 2 ? BD3DCMP_EQUAL : BD3DCMP_LESSEQUAL ); + + // depth buffer write + ShaderParam.SetRenderState( BD3DRS_ZWRITEENABLE, m.ZWriteEnable ); + + +} + +/*! +*/ +REALINLINE u32 CBurningShader_Raster_Reference::depthFunc () +{ + if ( ShaderParam.RenderState [ BD3DRS_ZENABLE ] ) + { + switch ( ShaderParam.RenderState [ BD3DRS_ZFUNC ] ) + { + case BD3DCMP_LESSEQUAL: + return line.w[0] >= pShader.z[ pShader.i]; + case BD3DCMP_EQUAL: + return line.w[0] == pShader.z[ pShader.i]; + } + } + return 1; +} + +/*! +*/ +REALINLINE void CBurningShader_Raster_Reference::depthWrite () +{ + if ( ShaderParam.RenderState [ BD3DRS_ZWRITEENABLE ] ) + { + pShader.z[pShader.i] = line.w[0]; + } +} + +/*! +*/ +REALINLINE void CBurningShader_Raster_Reference::scanline2() +{ + // apply top-left fill-convention, left + pShader.xStart = core::ceil32( line.x[0] ); + pShader.xEnd = core::ceil32( line.x[1] ) - 1; + + pShader.dx = pShader.xEnd - pShader.xStart; + if ( pShader.dx < 0 ) + return; + + // slopes + const f32 invDeltaX = core::reciprocal ( line.x[1] - line.x[0] ); + const f32 subPixel = ( (f32) pShader.xStart ) - line.x[0]; + + // store slopes in endpoint, and correct first pixel + + line.w[0] += (line.w[1] = (line.w[1] - line.w[0]) * invDeltaX) * subPixel; + + u32 i; + +#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR + for ( i = 0; i != ShaderParam.ColorUnits; ++i ) + { + line.c[i][1] = (line.c[i][1] - line.c[i][0]) * invDeltaX; + line.c[i][0] += line.c[i][1] * subPixel; + } +#endif + + for ( i = 0; i != ShaderParam.TextureUnits; ++i ) + { + line.t[i][1] = (line.t[i][1] - line.t[i][0]) * invDeltaX; + line.t[i][0] += line.t[i][1] * subPixel; + } + + pShader.dst = (tVideoSample*) ( (u8*) RenderTarget->lock() + ( line.y * RenderTarget->getPitch() ) + ( pShader.xStart << VIDEO_SAMPLE_GRANULARITY ) ); + pShader.z = (fp24*) ( (u8*) DepthBuffer->lock() + ( line.y * DepthBuffer->getPitch() ) + ( pShader.xStart << VIDEO_SAMPLE_GRANULARITY ) ); + + for ( pShader.i = 0; pShader.i <= pShader.dx; ++pShader.i ) + { + if ( depthFunc() ) + { + depthWrite (); + } + + // advance next pixel + line.w[0] += line.w[1]; + +#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR + for ( i = 0; i != ShaderParam.ColorUnits; ++i ) + { + line.c[i][0] += line.c[i][1]; + } +#endif + for ( i = 0; i != ShaderParam.TextureUnits; ++i ) + { + line.t[i][0] += line.t[i][1]; + } + } +} + + +/*! +*/ +REALINLINE void CBurningShader_Raster_Reference::scanline () +{ + u32 i; + + // apply top-left fill-convention, left + pShader.xStart = core::ceil32( line.x[0] ); + pShader.xEnd = core::ceil32( line.x[1] ) - 1; + + pShader.dx = pShader.xEnd - pShader.xStart; + if ( pShader.dx < 0 ) + return; + + // slopes + const f32 invDeltaX = core::reciprocal ( line.x[1] - line.x[0] ); + + // search z-buffer for first not occulled pixel + pShader.z = (fp24*) ( (u8*) DepthBuffer->lock() + ( line.y * DepthBuffer->getPitch() ) + ( pShader.xStart << VIDEO_SAMPLE_GRANULARITY ) ); + + // subTexel + const f32 subPixel = ( (f32) pShader.xStart ) - line.x[0]; + + const f32 b = (line.w[1] - line.w[0]) * invDeltaX; + f32 a = line.w[0] + ( b * subPixel ); + + pShader.i = 0; + + if ( ShaderParam.RenderState [ BD3DRS_ZENABLE ] ) + { + u32 condition; + switch ( ShaderParam.RenderState [ BD3DRS_ZFUNC ] ) + { + case BD3DCMP_LESSEQUAL: + condition = a < pShader.z[pShader.i]; + break; + case BD3DCMP_EQUAL: + condition = a != pShader.z[pShader.i]; + break; + } + while ( a < pShader.z[pShader.i] ) + { + a += b; + + pShader.i += 1; + if ( pShader.i > pShader.dx ) + return; + + } + } + + // lazy setup rest of scanline + + line.w[0] = a; + line.w[1] = b; + + pShader.dst = (tVideoSample*) ( (u8*) RenderTarget->lock() + ( line.y * RenderTarget->getPitch() ) + ( pShader.xStart << VIDEO_SAMPLE_GRANULARITY ) ); + + a = (f32) pShader.i + subPixel; + +#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR + for ( i = 0; i != ShaderParam.ColorUnits; ++i ) + { + line.c[i][1] = (line.c[i][1] - line.c[i][0]) * invDeltaX; + line.c[i][0] += line.c[i][1] * a; + } +#endif + + for ( i = 0; i != ShaderParam.TextureUnits; ++i ) + { + line.t[i][1] = (line.t[i][1] - line.t[i][0]) * invDeltaX; + line.t[i][0] += line.t[i][1] * a; + } + + for ( ; pShader.i <= pShader.dx; ++pShader.i ) + { + if ( line.w[0] >= pShader.z[pShader.i] ) + { + pShader.z[pShader.i] = line.w[0]; + + pShader_EMT_LIGHTMAP_M4 (); + } + + line.w[0] += line.w[1]; + +#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR + for ( i = 0; i != ShaderParam.ColorUnits; ++i ) + { + line.c[i][0] += line.c[i][1]; + } +#endif + for ( i = 0; i != ShaderParam.TextureUnits; ++i ) + { + line.t[i][0] += line.t[i][1]; + } + } + +} + + + +void CBurningShader_Raster_Reference::drawTriangle ( const s4DVertex *a,const s4DVertex *b,const s4DVertex *c ) +{ + sScanConvertData scan; + u32 i; + + // sort on height, y + if ( F32_A_GREATER_B ( a->Pos.y , b->Pos.y ) ) swapVertexPointer(&a, &b); + if ( F32_A_GREATER_B ( a->Pos.y , c->Pos.y ) ) swapVertexPointer(&a, &c); + if ( F32_A_GREATER_B ( b->Pos.y , c->Pos.y ) ) swapVertexPointer(&b, &c); + + + // calculate delta y of the edges + scan.invDeltaY[0] = core::reciprocal ( c->Pos.y - a->Pos.y ); + scan.invDeltaY[1] = core::reciprocal ( b->Pos.y - a->Pos.y ); + scan.invDeltaY[2] = core::reciprocal ( c->Pos.y - b->Pos.y ); + + if ( F32_LOWER_EQUAL_0 ( scan.invDeltaY[0] ) ) + return; + + + // find if the major edge is left or right aligned + f32 temp[4]; + + temp[0] = a->Pos.x - c->Pos.x; + temp[1] = a->Pos.y - c->Pos.y; + temp[2] = b->Pos.x - a->Pos.x; + temp[3] = b->Pos.y - a->Pos.y; + + scan.left = ( temp[0] * temp[3] - temp[1] * temp[2] ) > (f32) 0.0 ? 0 : 1; + scan.right = 1 - scan.left; + + // calculate slopes for the major edge + scan.slopeX[0] = (c->Pos.x - a->Pos.x) * scan.invDeltaY[0]; + scan.x[0] = a->Pos.x; + + scan.slopeW[0] = (c->Pos.w - a->Pos.w) * scan.invDeltaY[0]; + scan.w[0] = a->Pos.w; + +#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR + for ( i = 0; i != ShaderParam.ColorUnits; ++i ) + { + scan.c[i][0] = a->Color[i]; + scan.slopeC[i][0] = (c->Color[i] - a->Color[i]) * scan.invDeltaY[0]; + } +#endif + + for ( i = 0; i != ShaderParam.TextureUnits; ++i ) + { + scan.t[i][0] = a->Tex[i]; + scan.slopeT[i][0] = (c->Tex[i] - a->Tex[i]) * scan.invDeltaY[0]; + } + + // top left fill convention y run + s32 yStart; + s32 yEnd; + + f32 subPixel; + + // rasterize upper sub-triangle + if ( F32_GREATER_0 ( scan.invDeltaY[1] ) ) + { + // calculate slopes for top edge + scan.slopeX[1] = (b->Pos.x - a->Pos.x) * scan.invDeltaY[1]; + scan.x[1] = a->Pos.x; + + scan.slopeW[1] = (b->Pos.w - a->Pos.w) * scan.invDeltaY[1]; + scan.w[1] = a->Pos.w; + +#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR + for ( i = 0; i != ShaderParam.ColorUnits; ++i ) + { + scan.c[i][1] = a->Color[i]; + scan.slopeC[i][1] = (b->Color[i] - a->Color[i]) * scan.invDeltaY[1]; + } +#endif + for ( i = 0; i != ShaderParam.TextureUnits; ++i ) + { + scan.t[i][1] = a->Tex[i]; + scan.slopeT[i][1] = (b->Tex[i] - a->Tex[i]) * scan.invDeltaY[1]; + } + + // apply top-left fill convention, top part + yStart = core::ceil32( a->Pos.y ); + yEnd = core::ceil32( b->Pos.y ) - 1; + + subPixel = ( (f32) yStart ) - a->Pos.y; + + // correct to pixel center + scan.x[0] += scan.slopeX[0] * subPixel; + scan.x[1] += scan.slopeX[1] * subPixel; + + scan.w[0] += scan.slopeW[0] * subPixel; + scan.w[1] += scan.slopeW[1] * subPixel; + + for ( i = 0; i != ShaderParam.ColorUnits; ++i ) + { + scan.c[i][0] += scan.slopeC[i][0] * subPixel; + scan.c[i][1] += scan.slopeC[i][1] * subPixel; + } + + for ( i = 0; i != ShaderParam.TextureUnits; ++i ) + { + scan.t[i][0] += scan.slopeT[i][0] * subPixel; + scan.t[i][1] += scan.slopeT[i][1] * subPixel; + } + + // rasterize the edge scanlines + for( line.y = yStart; line.y <= yEnd; ++line.y) + { + line.x[scan.left] = scan.x[0]; + line.w[scan.left] = scan.w[0]; + + line.x[scan.right] = scan.x[1]; + line.w[scan.right] = scan.w[1]; + +#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR + for ( i = 0; i != ShaderParam.ColorUnits; ++i ) + { + line.c[i][scan.left] = scan.c[i][0]; + line.c[i][scan.right] = scan.c[i][1]; + } +#endif + for ( i = 0; i != ShaderParam.TextureUnits; ++i ) + { + line.t[i][scan.left] = scan.t[i][0]; + line.t[i][scan.right] = scan.t[i][1]; + } + + // render a scanline + scanline (); + + scan.x[0] += scan.slopeX[0]; + scan.x[1] += scan.slopeX[1]; + + scan.w[0] += scan.slopeW[0]; + scan.w[1] += scan.slopeW[1]; + + for ( i = 0; i != ShaderParam.ColorUnits; ++i ) + { + scan.c[i][0] += scan.slopeC[i][0]; + scan.c[i][1] += scan.slopeC[i][1]; + } + + for ( i = 0; i != ShaderParam.TextureUnits; ++i ) + { + scan.t[i][0] += scan.slopeT[i][0]; + scan.t[i][1] += scan.slopeT[i][1]; + } + + } + } + + // rasterize lower sub-triangle + if ( F32_GREATER_0 ( scan.invDeltaY[2] ) ) + { + // advance to middle point + if ( F32_GREATER_0 ( scan.invDeltaY[1] ) ) + { + temp[0] = b->Pos.y - a->Pos.y; // dy + + scan.x[0] = a->Pos.x + scan.slopeX[0] * temp[0]; + scan.w[0] = a->Pos.w + scan.slopeW[0] * temp[0]; + +#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR + for ( i = 0; i != ShaderParam.ColorUnits; ++i ) + { + scan.c[i][0] = a->Color[i] + scan.slopeC[i][0] * temp[0]; + } +#endif + for ( i = 0; i != ShaderParam.TextureUnits; ++i ) + { + scan.t[i][0] = a->Tex[i] + scan.slopeT[i][0] * temp[0]; + } + } + + // calculate slopes for bottom edge + scan.slopeX[1] = (c->Pos.x - b->Pos.x) * scan.invDeltaY[2]; + scan.x[1] = b->Pos.x; + + scan.slopeW[1] = (c->Pos.w - b->Pos.w) * scan.invDeltaY[2]; + scan.w[1] = b->Pos.w; + +#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR + for ( i = 0; i != ShaderParam.ColorUnits; ++i ) + { + scan.c[i][1] = b->Color[i]; + scan.slopeC[i][1] = (c->Color[i] - b->Color[i]) * scan.invDeltaY[2]; + } +#endif + for ( i = 0; i != ShaderParam.TextureUnits; ++i ) + { + scan.t[i][1] = b->Tex[i]; + scan.slopeT[i][1] = (c->Tex[i] - b->Tex[i]) * scan.invDeltaY[2]; + } + + // apply top-left fill convention, top part + yStart = core::ceil32( b->Pos.y ); + yEnd = core::ceil32( c->Pos.y ) - 1; + + + subPixel = ( (f32) yStart ) - b->Pos.y; + + // correct to pixel center + scan.x[0] += scan.slopeX[0] * subPixel; + scan.x[1] += scan.slopeX[1] * subPixel; + + scan.w[0] += scan.slopeW[0] * subPixel; + scan.w[1] += scan.slopeW[1] * subPixel; + + for ( i = 0; i != ShaderParam.ColorUnits; ++i ) + { + scan.c[i][0] += scan.slopeC[i][0] * subPixel; + scan.c[i][1] += scan.slopeC[i][1] * subPixel; + } + + for ( i = 0; i != ShaderParam.TextureUnits; ++i ) + { + scan.t[i][0] += scan.slopeT[i][0] * subPixel; + scan.t[i][1] += scan.slopeT[i][1] * subPixel; + } + + // rasterize the edge scanlines + for( line.y = yStart; line.y <= yEnd; ++line.y) + { + line.x[scan.left] = scan.x[0]; + line.w[scan.left] = scan.w[0]; + + line.x[scan.right] = scan.x[1]; + line.w[scan.right] = scan.w[1]; + +#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR + for ( i = 0; i != ShaderParam.ColorUnits; ++i ) + { + line.c[i][scan.left] = scan.c[i][0]; + line.c[i][scan.right] = scan.c[i][1]; + } +#endif + for ( i = 0; i != ShaderParam.TextureUnits; ++i ) + { + line.t[i][scan.left] = scan.t[i][0]; + line.t[i][scan.right] = scan.t[i][1]; + } + + // render a scanline + scanline (); + + scan.x[0] += scan.slopeX[0]; + scan.x[1] += scan.slopeX[1]; + + scan.w[0] += scan.slopeW[0]; + scan.w[1] += scan.slopeW[1]; + + for ( i = 0; i != ShaderParam.TextureUnits; ++i ) + { + scan.c[i][0] += scan.slopeC[i][0]; + scan.c[i][1] += scan.slopeC[i][1]; + } + + for ( i = 0; i != ShaderParam.TextureUnits; ++i ) + { + scan.t[i][0] += scan.slopeT[i][0]; + scan.t[i][1] += scan.slopeT[i][1]; + } + } + } +} + + +} // end namespace video +} // end namespace irr + + +namespace irr +{ +namespace video +{ + + + +//! creates a flat triangle renderer +IBurningShader* createTriangleRendererReference(IDepthBuffer* depthBuffer) +{ + return new CBurningShader_Raster_Reference(depthBuffer); +} + + +} // end namespace video +} // end namespace irr + +#endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_ + + diff --git a/src/dep/src/irrlicht/CCSMLoader.cpp b/src/dep/src/irrlicht/CCSMLoader.cpp index 57fb41b..8ec2aed 100644 --- a/src/dep/src/irrlicht/CCSMLoader.cpp +++ b/src/dep/src/irrlicht/CCSMLoader.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h // diff --git a/src/dep/src/irrlicht/CCSMLoader.h b/src/dep/src/irrlicht/CCSMLoader.h index bfa2735..cb87167 100644 --- a/src/dep/src/irrlicht/CCSMLoader.h +++ b/src/dep/src/irrlicht/CCSMLoader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h // diff --git a/src/dep/src/irrlicht/CCameraSceneNode.cpp b/src/dep/src/irrlicht/CCameraSceneNode.cpp index 25865fa..93545b8 100644 --- a/src/dep/src/irrlicht/CCameraSceneNode.cpp +++ b/src/dep/src/irrlicht/CCameraSceneNode.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CCameraSceneNode.h b/src/dep/src/irrlicht/CCameraSceneNode.h index b18e542..d4bdd46 100644 --- a/src/dep/src/irrlicht/CCameraSceneNode.h +++ b/src/dep/src/irrlicht/CCameraSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CColladaFileLoader.cpp b/src/dep/src/irrlicht/CColladaFileLoader.cpp index 87f7947..0ba5b89 100644 --- a/src/dep/src/irrlicht/CColladaFileLoader.cpp +++ b/src/dep/src/irrlicht/CColladaFileLoader.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -118,7 +118,6 @@ namespace scene const core::stringc falloffExponentNodeName = "falloff_exponent"; const core::stringc profileCOMMONSectionName = "profile_COMMON"; - const core::stringc profileCOMMONAttributeName = "COMMON"; const char* const inputSemanticNames[] = {"POSITION", "VERTEX", "NORMAL", "TEXCOORD", "UV", "TANGENT", "IMAGE", "TEXTURE", 0}; @@ -368,6 +367,7 @@ IAnimatedMesh* CColladaFileLoader::createMesh(io::IReadFile* file) if (!Version) return 0; + // because this loader loads and creates a complete scene instead of // a single mesh, return an empty dummy mesh to make the scene manager // know that everything went well. @@ -375,9 +375,6 @@ IAnimatedMesh* CColladaFileLoader::createMesh(io::IReadFile* file) DummyMesh = new SAnimatedMesh(); scene::IAnimatedMesh* returnMesh = DummyMesh; - if (Version < 10400) - instantiateNode(SceneManager->getRootSceneNode()); - // add the first loaded mesh into the mesh cache too, if more than one // meshes have been loaded from the file if (LoadedMeshCount>1 && FirstLoadedMesh) @@ -425,7 +422,7 @@ void CColladaFileLoader::skipSection(io::IXMLReaderUTF8* reader, bool reportSkip { #ifdef COLLADA_READER_DEBUG if (reportSkipping) - os::Printer::log("Skipping COLLADA unknown element", core::stringc(reader->getNodeName()).c_str()); + os::Printer::log("Skipping COLLADA unknown element:", core::stringc(reader->getNodeName()).c_str()); #endif // COLLADA_READER_DEBUG ++tagCounter; @@ -444,7 +441,7 @@ void CColladaFileLoader::readColladaSection(io::IXMLReaderUTF8* reader) return; const f32 version = core::fast_atof(core::stringc(reader->getAttributeValue("version")).c_str()); - Version = core::floor32(version)*10000+core::floor32(core::fract(version)*1000.0f); + Version = core::floor32(version)*10000+core::ceil32(core::fract(version)*1000.0f); // Version 1.4 can be checked for by if (Version >= 10400) while(reader->read()) @@ -1077,9 +1074,9 @@ core::matrix4 CColladaFileLoader::readTranslateNode(io::IXMLReaderUTF8* reader) } -//! reads any kind of node -void CColladaFileLoader::readInstanceNode(io::IXMLReaderUTF8* reader, - scene::ISceneNode* parent, scene::ISceneNode** outNode, CScenePrefab* p) +//! reads any kind of node and creates a scene node from it +void CColladaFileLoader::readInstanceNode(io::IXMLReaderUTF8* reader, scene::ISceneNode* parent, + scene::ISceneNode** outNode, CScenePrefab* p) { #ifdef COLLADA_READER_DEBUG os::Printer::log("COLLADA reading instance"); @@ -1106,20 +1103,10 @@ void CColladaFileLoader::readInstanceNode(io::IXMLReaderUTF8* reader, break; } } - instantiateNode(parent, outNode, p, url); -} - - -void CColladaFileLoader::instantiateNode(scene::ISceneNode* parent, - scene::ISceneNode** outNode, CScenePrefab* p, const core::stringc& url) -{ - #ifdef COLLADA_READER_DEBUG - os::Printer::log("COLLADA instantiate node"); - #endif for (u32 i=0; igetId()) + if (url == Prefabs[i]->getId()) { if (p) p->Childs.push_back(Prefabs[i]); @@ -1132,7 +1119,7 @@ void CColladaFileLoader::instantiateNode(scene::ISceneNode* parent, { *outNode = newNode; if (*outNode) - (*outNode)->setName(url); + (*outNode)->setName(readId(reader)); } } return; @@ -1737,15 +1724,12 @@ void CColladaFileLoader::readGeometry(io::IXMLReaderUTF8* reader) } else // trifans, and tristrips missing - if (extraNodeName == nodeName) + if (extraNodeName == reader->getNodeName()) skipSection(reader, false); else - // techniqueCommon or 'technique profile=common' must not be skipped - if ((techniqueCommonSectionName != nodeName) // Collada 1.4+ - && ((techniqueNodeName != nodeName) || - (profileCOMMONAttributeName != reader->getAttributeValue("profile")))) // Collada 1.2/1.3 + if (techniqueCommonSectionName != nodeName) // techniqueCommon must not be skipped { - os::Printer::log("COLLADA loader warning: Wrong tag usage found in geometry", reader->getNodeName(), ELL_WARNING); +// os::Printer::log("COLLADA loader warning: Wrong tag usage found", reader->getNodeName(), ELL_WARNING); skipSection(reader, true); // ignore all other sections } } // end if node type is element @@ -1973,9 +1957,10 @@ void CColladaFileLoader::readPolygonSection(io::IXMLReaderUTF8* reader, } else { + for (u32 i = 0; i < vCounts.size(); i++) { - const int polyVCount = vCounts[i]; + int polyVCount = vCounts[i]; core::array polyCorners; @@ -2410,10 +2395,7 @@ void CColladaFileLoader::readColladaInput(io::IXMLReaderUTF8* reader) // get source p.Source = reader->getAttributeValue("source"); - if (reader->getAttributeValue("offset")) // Collada 1.4+ - p.Offset = (u32)reader->getAttributeValueAsInt("offset"); - else // Collada 1.2/1.3 - p.Offset = (u32)reader->getAttributeValueAsInt("idx"); + p.Offset = (u32)reader->getAttributeValueAsInt("offset"); p.Set = (u32)reader->getAttributeValueAsInt("set"); // add input diff --git a/src/dep/src/irrlicht/CColladaFileLoader.h b/src/dep/src/irrlicht/CColladaFileLoader.h index 2c3270d..84db175 100644 --- a/src/dep/src/irrlicht/CColladaFileLoader.h +++ b/src/dep/src/irrlicht/CColladaFileLoader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -246,14 +246,10 @@ private: //! reads a element f32 readFloatNode(io::IXMLReaderUTF8* reader); - //! reads a node + //! reads a node and creates a scene node from it void readInstanceNode(io::IXMLReaderUTF8* reader, scene::ISceneNode* parent, scene::ISceneNode** outNode, CScenePrefab* p=0); - //! creates a scene node from Prefabs (with name given in 'url') - void instantiateNode(scene::ISceneNode* parent, scene::ISceneNode** outNode=0, - CScenePrefab* p=0, const core::stringc& url=""); - //! reads a element and stores it as prefab void readLightPrefab(io::IXMLReaderUTF8* reader); diff --git a/src/dep/src/irrlicht/CColladaMeshWriter.cpp b/src/dep/src/irrlicht/CColladaMeshWriter.cpp index 0e3ba00..f8b230f 100644 --- a/src/dep/src/irrlicht/CColladaMeshWriter.cpp +++ b/src/dep/src/irrlicht/CColladaMeshWriter.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CColladaMeshWriter.h b/src/dep/src/irrlicht/CColladaMeshWriter.h index 694c73e..a0dc99b 100644 --- a/src/dep/src/irrlicht/CColladaMeshWriter.h +++ b/src/dep/src/irrlicht/CColladaMeshWriter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CColorConverter.cpp b/src/dep/src/irrlicht/CColorConverter.cpp index 65e50dd..e2573af 100644 --- a/src/dep/src/irrlicht/CColorConverter.cpp +++ b/src/dep/src/irrlicht/CColorConverter.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CColorConverter.h b/src/dep/src/irrlicht/CColorConverter.h index e7ef5f7..e457e6b 100644 --- a/src/dep/src/irrlicht/CColorConverter.h +++ b/src/dep/src/irrlicht/CColorConverter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CCubeSceneNode.cpp b/src/dep/src/irrlicht/CCubeSceneNode.cpp index 65928b0..29ee1e8 100644 --- a/src/dep/src/irrlicht/CCubeSceneNode.cpp +++ b/src/dep/src/irrlicht/CCubeSceneNode.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CCubeSceneNode.h b/src/dep/src/irrlicht/CCubeSceneNode.h index 15db555..658b061 100644 --- a/src/dep/src/irrlicht/CCubeSceneNode.h +++ b/src/dep/src/irrlicht/CCubeSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CD3D8Driver.cpp b/src/dep/src/irrlicht/CD3D8Driver.cpp index cd67707..cc6371a 100644 --- a/src/dep/src/irrlicht/CD3D8Driver.cpp +++ b/src/dep/src/irrlicht/CD3D8Driver.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CD3D8Driver.h b/src/dep/src/irrlicht/CD3D8Driver.h index 6c1016d..0891a94 100644 --- a/src/dep/src/irrlicht/CD3D8Driver.h +++ b/src/dep/src/irrlicht/CD3D8Driver.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CD3D8MaterialRenderer.h b/src/dep/src/irrlicht/CD3D8MaterialRenderer.h index 4a3f2c9..6189563 100644 --- a/src/dep/src/irrlicht/CD3D8MaterialRenderer.h +++ b/src/dep/src/irrlicht/CD3D8MaterialRenderer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -116,12 +116,6 @@ public: } - //! Returns if the material is transparent. - virtual bool isTransparent() const - { - return true; - } - private: u32 getD3DBlend ( E_BLEND_FACTOR factor ) const @@ -344,8 +338,7 @@ public: pID3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); - // 127 is required by EMT_TRANSPARENT_ALPHA_CHANNEL_REF - pID3DDevice->SetRenderState(D3DRS_ALPHAREF, 127); + pID3DDevice->SetRenderState(D3DRS_ALPHAREF, core::floor32(material.MaterialTypeParam * 255.f)); pID3DDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL); pID3DDevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE); } diff --git a/src/dep/src/irrlicht/CD3D8NormalMapRenderer.cpp b/src/dep/src/irrlicht/CD3D8NormalMapRenderer.cpp index 5f03131..f924962 100644 --- a/src/dep/src/irrlicht/CD3D8NormalMapRenderer.cpp +++ b/src/dep/src/irrlicht/CD3D8NormalMapRenderer.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CD3D8NormalMapRenderer.h b/src/dep/src/irrlicht/CD3D8NormalMapRenderer.h index c4eb526..9189cf6 100644 --- a/src/dep/src/irrlicht/CD3D8NormalMapRenderer.h +++ b/src/dep/src/irrlicht/CD3D8NormalMapRenderer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CD3D8ParallaxMapRenderer.cpp b/src/dep/src/irrlicht/CD3D8ParallaxMapRenderer.cpp index abe64a7..d892232 100644 --- a/src/dep/src/irrlicht/CD3D8ParallaxMapRenderer.cpp +++ b/src/dep/src/irrlicht/CD3D8ParallaxMapRenderer.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CD3D8ParallaxMapRenderer.h b/src/dep/src/irrlicht/CD3D8ParallaxMapRenderer.h index 53bd89a..f06bc32 100644 --- a/src/dep/src/irrlicht/CD3D8ParallaxMapRenderer.h +++ b/src/dep/src/irrlicht/CD3D8ParallaxMapRenderer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CD3D8ShaderMaterialRenderer.cpp b/src/dep/src/irrlicht/CD3D8ShaderMaterialRenderer.cpp index 88c3a1b..e08d4e1 100644 --- a/src/dep/src/irrlicht/CD3D8ShaderMaterialRenderer.cpp +++ b/src/dep/src/irrlicht/CD3D8ShaderMaterialRenderer.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CD3D8ShaderMaterialRenderer.h b/src/dep/src/irrlicht/CD3D8ShaderMaterialRenderer.h index a50573d..79a695e 100644 --- a/src/dep/src/irrlicht/CD3D8ShaderMaterialRenderer.h +++ b/src/dep/src/irrlicht/CD3D8ShaderMaterialRenderer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CD3D8Texture.cpp b/src/dep/src/irrlicht/CD3D8Texture.cpp index e3afb07..e87b61b 100644 --- a/src/dep/src/irrlicht/CD3D8Texture.cpp +++ b/src/dep/src/irrlicht/CD3D8Texture.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CD3D8Texture.h b/src/dep/src/irrlicht/CD3D8Texture.h index 41735ef..21a054e 100644 --- a/src/dep/src/irrlicht/CD3D8Texture.h +++ b/src/dep/src/irrlicht/CD3D8Texture.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CD3D9Driver.cpp b/src/dep/src/irrlicht/CD3D9Driver.cpp index 6993a25..0d29705 100644 --- a/src/dep/src/irrlicht/CD3D9Driver.cpp +++ b/src/dep/src/irrlicht/CD3D9Driver.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -2321,9 +2321,6 @@ bool CD3D9Driver::reset() if(DepthBuffers[i]->Surface) DepthBuffers[i]->Surface->Release(); } - // this does not require a restore in the reset method, it's updated - // automatically in the next render cycle. - removeAllHardwareBuffers(); DriverWasReset=true; diff --git a/src/dep/src/irrlicht/CD3D9Driver.h b/src/dep/src/irrlicht/CD3D9Driver.h index ca4bc55..0f9dce5 100644 --- a/src/dep/src/irrlicht/CD3D9Driver.h +++ b/src/dep/src/irrlicht/CD3D9Driver.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CD3D9HLSLMaterialRenderer.cpp b/src/dep/src/irrlicht/CD3D9HLSLMaterialRenderer.cpp index f369c64..46cdeaf 100644 --- a/src/dep/src/irrlicht/CD3D9HLSLMaterialRenderer.cpp +++ b/src/dep/src/irrlicht/CD3D9HLSLMaterialRenderer.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CD3D9HLSLMaterialRenderer.h b/src/dep/src/irrlicht/CD3D9HLSLMaterialRenderer.h index 9174473..ed63b09 100644 --- a/src/dep/src/irrlicht/CD3D9HLSLMaterialRenderer.h +++ b/src/dep/src/irrlicht/CD3D9HLSLMaterialRenderer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CD3D9MaterialRenderer.h b/src/dep/src/irrlicht/CD3D9MaterialRenderer.h index 84e983c..4ffe952 100644 --- a/src/dep/src/irrlicht/CD3D9MaterialRenderer.h +++ b/src/dep/src/irrlicht/CD3D9MaterialRenderer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -134,16 +134,6 @@ public: } - //! Returns if the material is transparent. - /** The scene management needs to know this for being able to sort the - materials by opaque and transparent. - The return value could be optimized, but we'd need to know the - MaterialTypeParam for it. */ - virtual bool isTransparent() const - { - return true; - } - private: u32 getD3DBlend ( E_BLEND_FACTOR factor ) const @@ -375,8 +365,7 @@ public: pID3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); - // 127 is required by EMT_TRANSPARENT_ALPHA_CHANNEL_REF - pID3DDevice->SetRenderState(D3DRS_ALPHAREF, 127); + pID3DDevice->SetRenderState(D3DRS_ALPHAREF, core::floor32(material.MaterialTypeParam * 255)); pID3DDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL); pID3DDevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE); } diff --git a/src/dep/src/irrlicht/CD3D9NormalMapRenderer.cpp b/src/dep/src/irrlicht/CD3D9NormalMapRenderer.cpp index c175d93..3565aee 100644 --- a/src/dep/src/irrlicht/CD3D9NormalMapRenderer.cpp +++ b/src/dep/src/irrlicht/CD3D9NormalMapRenderer.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CD3D9NormalMapRenderer.h b/src/dep/src/irrlicht/CD3D9NormalMapRenderer.h index 7f9f88b..f67f6fd 100644 --- a/src/dep/src/irrlicht/CD3D9NormalMapRenderer.h +++ b/src/dep/src/irrlicht/CD3D9NormalMapRenderer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CD3D9ParallaxMapRenderer.cpp b/src/dep/src/irrlicht/CD3D9ParallaxMapRenderer.cpp index e4920d2..2e216be 100644 --- a/src/dep/src/irrlicht/CD3D9ParallaxMapRenderer.cpp +++ b/src/dep/src/irrlicht/CD3D9ParallaxMapRenderer.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CD3D9ParallaxMapRenderer.h b/src/dep/src/irrlicht/CD3D9ParallaxMapRenderer.h index 54719e7..1074ca7 100644 --- a/src/dep/src/irrlicht/CD3D9ParallaxMapRenderer.h +++ b/src/dep/src/irrlicht/CD3D9ParallaxMapRenderer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CD3D9ShaderMaterialRenderer.cpp b/src/dep/src/irrlicht/CD3D9ShaderMaterialRenderer.cpp index 89127b9..03cf69a 100644 --- a/src/dep/src/irrlicht/CD3D9ShaderMaterialRenderer.cpp +++ b/src/dep/src/irrlicht/CD3D9ShaderMaterialRenderer.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CD3D9ShaderMaterialRenderer.h b/src/dep/src/irrlicht/CD3D9ShaderMaterialRenderer.h index b035eb6..621d82a 100644 --- a/src/dep/src/irrlicht/CD3D9ShaderMaterialRenderer.h +++ b/src/dep/src/irrlicht/CD3D9ShaderMaterialRenderer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CD3D9Texture.cpp b/src/dep/src/irrlicht/CD3D9Texture.cpp index f35d5e5..dea1753 100644 --- a/src/dep/src/irrlicht/CD3D9Texture.cpp +++ b/src/dep/src/irrlicht/CD3D9Texture.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CD3D9Texture.h b/src/dep/src/irrlicht/CD3D9Texture.h index 40c0508..3a64a76 100644 --- a/src/dep/src/irrlicht/CD3D9Texture.h +++ b/src/dep/src/irrlicht/CD3D9Texture.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CDMFLoader.cpp b/src/dep/src/irrlicht/CDMFLoader.cpp index b247029..dc4147b 100644 --- a/src/dep/src/irrlicht/CDMFLoader.cpp +++ b/src/dep/src/irrlicht/CDMFLoader.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h // diff --git a/src/dep/src/irrlicht/CDMFLoader.h b/src/dep/src/irrlicht/CDMFLoader.h index 7d23bd5..81d8443 100644 --- a/src/dep/src/irrlicht/CDMFLoader.h +++ b/src/dep/src/irrlicht/CDMFLoader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h // diff --git a/src/dep/src/irrlicht/CDefaultGUIElementFactory.cpp b/src/dep/src/irrlicht/CDefaultGUIElementFactory.cpp index f0a831d..e9e97f6 100644 --- a/src/dep/src/irrlicht/CDefaultGUIElementFactory.cpp +++ b/src/dep/src/irrlicht/CDefaultGUIElementFactory.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CDefaultGUIElementFactory.h b/src/dep/src/irrlicht/CDefaultGUIElementFactory.h index 5a8b142..71c4f89 100644 --- a/src/dep/src/irrlicht/CDefaultGUIElementFactory.h +++ b/src/dep/src/irrlicht/CDefaultGUIElementFactory.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CDefaultSceneNodeAnimatorFactory.cpp b/src/dep/src/irrlicht/CDefaultSceneNodeAnimatorFactory.cpp index ef913f6..d69bc6d 100644 --- a/src/dep/src/irrlicht/CDefaultSceneNodeAnimatorFactory.cpp +++ b/src/dep/src/irrlicht/CDefaultSceneNodeAnimatorFactory.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CDefaultSceneNodeAnimatorFactory.h b/src/dep/src/irrlicht/CDefaultSceneNodeAnimatorFactory.h index d9f59c1..7a00b27 100644 --- a/src/dep/src/irrlicht/CDefaultSceneNodeAnimatorFactory.h +++ b/src/dep/src/irrlicht/CDefaultSceneNodeAnimatorFactory.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CDefaultSceneNodeFactory.cpp b/src/dep/src/irrlicht/CDefaultSceneNodeFactory.cpp index 84364d7..f2a7f68 100644 --- a/src/dep/src/irrlicht/CDefaultSceneNodeFactory.cpp +++ b/src/dep/src/irrlicht/CDefaultSceneNodeFactory.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CDefaultSceneNodeFactory.h b/src/dep/src/irrlicht/CDefaultSceneNodeFactory.h index a3bad9c..95b9938 100644 --- a/src/dep/src/irrlicht/CDefaultSceneNodeFactory.h +++ b/src/dep/src/irrlicht/CDefaultSceneNodeFactory.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CDepthBuffer.cpp b/src/dep/src/irrlicht/CDepthBuffer.cpp index f98151a..c521c6c 100644 --- a/src/dep/src/irrlicht/CDepthBuffer.cpp +++ b/src/dep/src/irrlicht/CDepthBuffer.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CDepthBuffer.h b/src/dep/src/irrlicht/CDepthBuffer.h index ba8d3d1..951ea3d 100644 --- a/src/dep/src/irrlicht/CDepthBuffer.h +++ b/src/dep/src/irrlicht/CDepthBuffer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CDummyTransformationSceneNode.cpp b/src/dep/src/irrlicht/CDummyTransformationSceneNode.cpp index 64cb179..cfca942 100644 --- a/src/dep/src/irrlicht/CDummyTransformationSceneNode.cpp +++ b/src/dep/src/irrlicht/CDummyTransformationSceneNode.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CDummyTransformationSceneNode.h b/src/dep/src/irrlicht/CDummyTransformationSceneNode.h index 379a485..42103e0 100644 --- a/src/dep/src/irrlicht/CDummyTransformationSceneNode.h +++ b/src/dep/src/irrlicht/CDummyTransformationSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CEmptySceneNode.cpp b/src/dep/src/irrlicht/CEmptySceneNode.cpp index 473425f..23d0271 100644 --- a/src/dep/src/irrlicht/CEmptySceneNode.cpp +++ b/src/dep/src/irrlicht/CEmptySceneNode.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CEmptySceneNode.h b/src/dep/src/irrlicht/CEmptySceneNode.h index 9f5c33b..87729a6 100644 --- a/src/dep/src/irrlicht/CEmptySceneNode.h +++ b/src/dep/src/irrlicht/CEmptySceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CFPSCounter.cpp b/src/dep/src/irrlicht/CFPSCounter.cpp index 2466f75..21e4bb2 100644 --- a/src/dep/src/irrlicht/CFPSCounter.cpp +++ b/src/dep/src/irrlicht/CFPSCounter.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CFPSCounter.h b/src/dep/src/irrlicht/CFPSCounter.h index 358ee6d..19f71a7 100644 --- a/src/dep/src/irrlicht/CFPSCounter.h +++ b/src/dep/src/irrlicht/CFPSCounter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CFileList.cpp b/src/dep/src/irrlicht/CFileList.cpp index 7fee16e..cf1fc8a 100644 --- a/src/dep/src/irrlicht/CFileList.cpp +++ b/src/dep/src/irrlicht/CFileList.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CFileList.h b/src/dep/src/irrlicht/CFileList.h index 1940ecb..1ba1195 100644 --- a/src/dep/src/irrlicht/CFileList.h +++ b/src/dep/src/irrlicht/CFileList.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CFileSystem.cpp b/src/dep/src/irrlicht/CFileSystem.cpp index 9d77a5e..52899db 100644 --- a/src/dep/src/irrlicht/CFileSystem.cpp +++ b/src/dep/src/irrlicht/CFileSystem.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -207,9 +207,7 @@ core::stringc CFileSystem::getAbsolutePath(const core::stringc& filename) const c8 *p=0; #ifdef _IRR_WINDOWS_API_ - #if defined ( _WIN32_WCE ) - return filename; - #else + #if !defined ( _WIN32_WCE ) c8 fpath[_MAX_PATH]; p = _fullpath( fpath, filename.c_str(), _MAX_PATH); #endif diff --git a/src/dep/src/irrlicht/CFileSystem.h b/src/dep/src/irrlicht/CFileSystem.h index 7d89807..467d9dc 100644 --- a/src/dep/src/irrlicht/CFileSystem.h +++ b/src/dep/src/irrlicht/CFileSystem.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CGUIButton.cpp b/src/dep/src/irrlicht/CGUIButton.cpp index e9f113a..b4aedf4 100644 --- a/src/dep/src/irrlicht/CGUIButton.cpp +++ b/src/dep/src/irrlicht/CGUIButton.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -18,7 +18,7 @@ namespace gui //! constructor CGUIButton::CGUIButton(IGUIEnvironment* environment, IGUIElement* parent, - s32 id, core::rect rectangle, bool noclip) + s32 id, core::rect rectangle, bool noclip) : IGUIButton(environment, parent, id, rectangle), Pressed(false), IsPushButton(false), UseAlphaChannel(false), Border(true), ClickTime(0), SpriteBank(0), OverrideFont(0), Image(0), PressedImage(0) @@ -99,7 +99,8 @@ bool CGUIButton::OnEvent(const SEvent& event) { case EET_KEY_INPUT_EVENT: if (event.KeyInput.PressedDown && - (event.KeyInput.Key == KEY_RETURN || event.KeyInput.Key == KEY_SPACE)) + (event.KeyInput.Key == KEY_RETURN || + event.KeyInput.Key == KEY_SPACE)) { if (!IsPushButton) setPressed(true); @@ -115,13 +116,14 @@ bool CGUIButton::OnEvent(const SEvent& event) } else if (!event.KeyInput.PressedDown && Pressed && - (event.KeyInput.Key == KEY_RETURN || event.KeyInput.Key == KEY_SPACE)) + (event.KeyInput.Key == KEY_RETURN || + event.KeyInput.Key == KEY_SPACE)) { //Environment->removeFocus(this); if (!IsPushButton) setPressed(false); - + if (Parent) { SEvent newEvent; @@ -145,7 +147,7 @@ bool CGUIButton::OnEvent(const SEvent& event) if (event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN) { if (Environment->hasFocus(this) && - !AbsoluteClippingRect.isPointInside(core::position2d(event.MouseInput.X, event.MouseInput.Y))) + !AbsoluteClippingRect.isPointInside(core::position2d(event.MouseInput.X, event.MouseInput.Y))) { Environment->removeFocus(this); return false; @@ -153,7 +155,7 @@ bool CGUIButton::OnEvent(const SEvent& event) if (!IsPushButton) setPressed(true); - + Environment->setFocus(this); return true; } @@ -176,7 +178,7 @@ bool CGUIButton::OnEvent(const SEvent& event) { setPressed(!Pressed); } - + if ((!IsPushButton && wasPressed && Parent) || (IsPushButton && wasPressed != Pressed)) { @@ -215,7 +217,7 @@ void CGUIButton::draw() core::rect rect = AbsoluteRect; // todo: move sprite up and text down if the pressed state has a sprite - // draw sprites for focused and mouse-over + // draw sprites for focused and mouse-over core::position2di spritePos = AbsoluteRect.getCenter(); if (!Pressed) @@ -229,14 +231,14 @@ void CGUIButton::draw() pos.X -= ImageRect.getWidth() / 2; pos.Y -= ImageRect.getHeight() / 2; - driver->draw2DImage(Image, pos, ImageRect, &AbsoluteClippingRect, + driver->draw2DImage(Image, pos, ImageRect, &AbsoluteClippingRect, video::SColor(255,255,255,255), UseAlphaChannel); } if (SpriteBank && ButtonSprites[EGBS_BUTTON_UP].Index != -1) { // draw pressed sprite - SpriteBank->draw2DSprite(ButtonSprites[EGBS_BUTTON_UP].Index, spritePos, - &AbsoluteClippingRect, ButtonSprites[EGBS_BUTTON_UP].Color, ClickTime, os::Timer::getTime(), + SpriteBank->draw2DSprite(ButtonSprites[EGBS_BUTTON_UP].Index, spritePos, + &AbsoluteClippingRect, ButtonSprites[EGBS_BUTTON_UP].Color, ClickTime, os::Timer::getTime(), ButtonSprites[EGBS_BUTTON_UP].Loop, true); } } @@ -263,8 +265,8 @@ void CGUIButton::draw() if (SpriteBank && ButtonSprites[EGBS_BUTTON_DOWN].Index != -1) { // draw sprite - SpriteBank->draw2DSprite(ButtonSprites[EGBS_BUTTON_DOWN].Index, spritePos, - &AbsoluteClippingRect, ButtonSprites[EGBS_BUTTON_DOWN].Color, ClickTime, os::Timer::getTime(), + SpriteBank->draw2DSprite(ButtonSprites[EGBS_BUTTON_DOWN].Index, spritePos, + &AbsoluteClippingRect, ButtonSprites[EGBS_BUTTON_DOWN].Color, ClickTime, os::Timer::getTime(), ButtonSprites[EGBS_BUTTON_DOWN].Loop, true); } @@ -278,7 +280,7 @@ void CGUIButton::draw() if (font) font->draw(Text.c_str(), rect, - skin->getColor(IsEnabled ? EGDC_BUTTON_TEXT : EGDC_GRAY_TEXT), true, true, + skin->getColor(IsEnabled ? EGDC_BUTTON_TEXT : EGDC_GRAY_TEXT), true, true, &AbsoluteClippingRect); } @@ -289,9 +291,6 @@ void CGUIButton::draw() //! sets another skin independent font. if this is set to zero, the button uses the font of the skin. void CGUIButton::setOverrideFont(IGUIFont* font) { - if (OverrideFont == font) - return; - if (OverrideFont) OverrideFont->drop(); @@ -302,7 +301,7 @@ void CGUIButton::setOverrideFont(IGUIFont* font) } -//! Sets an image which should be displayed on the button when it is in normal state. +//! Sets an image which should be displayed on the button when it is in normal state. void CGUIButton::setImage(video::ITexture* image) { if (Image) @@ -337,7 +336,7 @@ void CGUIButton::setImage(video::ITexture* image, const core::rect& pos) } -//! Sets an image which should be displayed on the button when it is in pressed state. +//! Sets an image which should be displayed on the button when it is in pressed state. void CGUIButton::setPressedImage(video::ITexture* image) { if (PressedImage) diff --git a/src/dep/src/irrlicht/CGUIButton.h b/src/dep/src/irrlicht/CGUIButton.h index 5b7530e..f38f31e 100644 --- a/src/dep/src/irrlicht/CGUIButton.h +++ b/src/dep/src/irrlicht/CGUIButton.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -37,16 +37,16 @@ namespace gui //! sets another skin independent font. if this is set to zero, the button uses the font of the skin. virtual void setOverrideFont(IGUIFont* font=0); - //! Sets an image which should be displayed on the button when it is in normal state. + //! Sets an image which should be displayed on the button when it is in normal state. virtual void setImage(video::ITexture* image); - //! Sets an image which should be displayed on the button when it is in normal state. + //! Sets an image which should be displayed on the button when it is in normal state. virtual void setImage(video::ITexture* image, const core::rect& pos); - //! Sets an image which should be displayed on the button when it is in pressed state. + //! Sets an image which should be displayed on the button when it is in pressed state. virtual void setPressedImage(video::ITexture* image); - //! Sets an image which should be displayed on the button when it is in pressed state. + //! Sets an image which should be displayed on the button when it is in pressed state. virtual void setPressedImage(video::ITexture* image, const core::rect& pos); //! Sets the sprite bank used by the button @@ -58,7 +58,7 @@ namespace gui \param index: The sprite number from the current sprite bank \param color: The color of the sprite */ - virtual void setSprite(EGUI_BUTTON_STATE state, s32 index, + virtual void setSprite(EGUI_BUTTON_STATE state, s32 index, video::SColor color=video::SColor(255,255,255,255), bool loop=false); //! Sets if the button should behave like a push button. Which means it @@ -74,7 +74,7 @@ namespace gui //! Sets if the button should use the skin to draw its border virtual void setDrawBorder(bool border); - + //! Sets if the alpha channel should be used for drawing images on the button (default is false) virtual void setUseAlphaChannel(bool useAlphaChannel); @@ -105,6 +105,7 @@ namespace gui bool Pressed; bool IsPushButton; bool UseAlphaChannel; + bool Border; u32 ClickTime; diff --git a/src/dep/src/irrlicht/CGUICheckBox.cpp b/src/dep/src/irrlicht/CGUICheckBox.cpp index f1791cc..bdb086e 100644 --- a/src/dep/src/irrlicht/CGUICheckBox.cpp +++ b/src/dep/src/irrlicht/CGUICheckBox.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -19,7 +19,7 @@ namespace gui //! constructor CGUICheckBox::CGUICheckBox(bool checked, IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect rectangle) -: IGUICheckBox(environment, parent, id, rectangle), checkTime(0), Pressed(false), Checked(checked) +: IGUICheckBox(environment, parent, id, rectangle), Pressed(false), Checked(checked), checkTime(0) { #ifdef _DEBUG setDebugName("CGUICheckBox"); @@ -31,6 +31,7 @@ CGUICheckBox::CGUICheckBox(bool checked, IGUIEnvironment* environment, IGUIEleme } + //! called if an event happened. bool CGUICheckBox::OnEvent(const SEvent& event) { @@ -40,7 +41,8 @@ bool CGUICheckBox::OnEvent(const SEvent& event) { case EET_KEY_INPUT_EVENT: if (event.KeyInput.PressedDown && - (event.KeyInput.Key == KEY_RETURN || event.KeyInput.Key == KEY_SPACE)) + (event.KeyInput.Key == KEY_RETURN || + event.KeyInput.Key == KEY_SPACE)) { Pressed = true; return true; @@ -53,7 +55,8 @@ bool CGUICheckBox::OnEvent(const SEvent& event) } else if (!event.KeyInput.PressedDown && Pressed && - (event.KeyInput.Key == KEY_RETURN || event.KeyInput.Key == KEY_SPACE)) + (event.KeyInput.Key == KEY_RETURN || + event.KeyInput.Key == KEY_SPACE)) { Pressed = false; if (Parent) @@ -120,6 +123,7 @@ bool CGUICheckBox::OnEvent(const SEvent& event) } + //! draws the element and its children void CGUICheckBox::draw() { @@ -133,8 +137,8 @@ void CGUICheckBox::draw() s32 height = skin->getSize(EGDS_CHECK_BOX_WIDTH); core::rect checkRect(AbsoluteRect.UpperLeftCorner.X, - ((AbsoluteRect.getHeight() - height) / 2) + AbsoluteRect.UpperLeftCorner.Y, - 0, 0); + ((AbsoluteRect.getHeight() - height) / 2) + AbsoluteRect.UpperLeftCorner.Y, + 0, 0); checkRect.LowerRightCorner.X = checkRect.UpperLeftCorner.X + height; checkRect.LowerRightCorner.Y = checkRect.UpperLeftCorner.Y + height; @@ -143,7 +147,7 @@ void CGUICheckBox::draw() false, true, checkRect, &AbsoluteClippingRect); if (Checked && Environment->getSkin()) - Environment->getSkin()->drawIcon(this, EGDI_CHECK_BOX_CHECKED, checkRect.getCenter(), + Environment->getSkin()->drawIcon(this, EGDI_CHECK_BOX_CHECKED, checkRect.getCenter(), checkTime, os::Timer::getTime(), false, &AbsoluteClippingRect); if (Text.size()) @@ -153,7 +157,7 @@ void CGUICheckBox::draw() IGUIFont* font = skin->getFont(); if (font) - font->draw(Text.c_str(), checkRect, + font->draw(Text.c_str(), checkRect, skin->getColor(EGDC_BUTTON_TEXT), false, true, &AbsoluteClippingRect); } @@ -175,15 +179,13 @@ bool CGUICheckBox::isChecked() const return Checked; } - //! Writes attributes of the element. void CGUICheckBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const { IGUICheckBox::serializeAttributes(out,options); - out->addBool("Checked", Checked); + out->addBool ("Checked", Checked ); } - //! Reads attributes of the element void CGUICheckBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) { @@ -197,4 +199,3 @@ void CGUICheckBox::deserializeAttributes(io::IAttributes* in, io::SAttributeRead } // end namespace irr #endif // _IRR_COMPILE_WITH_GUI_ - diff --git a/src/dep/src/irrlicht/CGUICheckBox.h b/src/dep/src/irrlicht/CGUICheckBox.h index ced97bf..8370680 100644 --- a/src/dep/src/irrlicht/CGUICheckBox.h +++ b/src/dep/src/irrlicht/CGUICheckBox.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -42,9 +42,9 @@ namespace gui private: - u32 checkTime; bool Pressed; bool Checked; + u32 checkTime; }; } // end namespace gui diff --git a/src/dep/src/irrlicht/CGUIColorSelectDialog.cpp b/src/dep/src/irrlicht/CGUIColorSelectDialog.cpp index 96d5c71..2667b97 100644 --- a/src/dep/src/irrlicht/CGUIColorSelectDialog.cpp +++ b/src/dep/src/irrlicht/CGUIColorSelectDialog.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CGUIColorSelectDialog.h b/src/dep/src/irrlicht/CGUIColorSelectDialog.h index 97a97ab..d033cf8 100644 --- a/src/dep/src/irrlicht/CGUIColorSelectDialog.h +++ b/src/dep/src/irrlicht/CGUIColorSelectDialog.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -68,6 +68,7 @@ namespace gui SColorCircle ColorRing; void buildColorRing( const core::dimension2d & dim, s32 supersample, const u32 borderColor ); + }; @@ -77,4 +78,3 @@ namespace gui #endif // _IRR_COMPILE_WITH_GUI_ #endif // __C_GUI_COLOR_SELECT_DIALOG_H_INCLUDED__ - diff --git a/src/dep/src/irrlicht/CGUIComboBox.cpp b/src/dep/src/irrlicht/CGUIComboBox.cpp index 0ae795a..f5220eb 100644 --- a/src/dep/src/irrlicht/CGUIComboBox.cpp +++ b/src/dep/src/irrlicht/CGUIComboBox.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -23,8 +23,8 @@ namespace gui CGUIComboBox::CGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect rectangle) : IGUIComboBox(environment, parent, id, rectangle), - ListButton(0), SelectedText(0), ListBox(0), LastFocus(0), - Selected(-1), HAlign(EGUIA_UPPERLEFT), VAlign(EGUIA_CENTER), HasFocus(false) + ListButton(0), SelectedText(0), ListBox(0), Selected(-1), HasFocus(false), LastFocus(0), + HAlign(EGUIA_UPPERLEFT), VAlign(EGUIA_CENTER) { #ifdef _DEBUG setDebugName("CGUIComboBox"); @@ -39,7 +39,7 @@ CGUIComboBox::CGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent, core::rect r; r.UpperLeftCorner.X = rectangle.getWidth() - width - 2; r.LowerRightCorner.X = rectangle.getWidth() - 2; - + r.UpperLeftCorner.Y = 2; r.LowerRightCorner.Y = rectangle.getHeight() - 2; @@ -72,7 +72,6 @@ CGUIComboBox::CGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent, setTabOrder(-1); } - void CGUIComboBox::setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) { HAlign = horizontal; @@ -80,7 +79,6 @@ void CGUIComboBox::setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT ve SelectedText->setTextAlignment(horizontal, vertical); } - //! Returns amount of items in box u32 CGUIComboBox::getItemCount() const { @@ -110,7 +108,6 @@ void CGUIComboBox::removeItem(u32 idx) Items.erase(idx); } - //! Returns caption of this element. const wchar_t* CGUIComboBox::getText() const { @@ -130,6 +127,7 @@ u32 CGUIComboBox::addItem(const wchar_t* text) } + //! deletes all items in the combo box void CGUIComboBox::clear() { @@ -138,6 +136,7 @@ void CGUIComboBox::clear() } + //! returns id of selected item. returns -1 if no item is selected. s32 CGUIComboBox::getSelected() const { @@ -145,6 +144,7 @@ s32 CGUIComboBox::getSelected() const } + //! sets the selected item. Set this to -1 if no item should be selected void CGUIComboBox::setSelected(s32 idx) { @@ -153,12 +153,11 @@ void CGUIComboBox::setSelected(s32 idx) Selected = idx; if (Selected == -1) - SelectedText->setText(L""); + SelectedText->setText(L""); else SelectedText->setText(Items[Selected].c_str()); } - //! called if an event happened. bool CGUIComboBox::OnEvent(const SEvent& event) { @@ -191,10 +190,10 @@ bool CGUIComboBox::OnEvent(const SEvent& event) bool absorb = true; switch (event.KeyInput.Key) { - case KEY_DOWN: - setSelected(Selected+1); + case KEY_DOWN: + setSelected(Selected+1); break; - case KEY_UP: + case KEY_UP: setSelected(Selected-1); break; case KEY_HOME: @@ -228,11 +227,11 @@ bool CGUIComboBox::OnEvent(const SEvent& event) switch(event.GUIEvent.EventType) { case EGET_ELEMENT_FOCUS_LOST: - if (ListBox && - (Environment->hasFocus(ListBox) || ListBox->isMyChild(event.GUIEvent.Caller) ) && - event.GUIEvent.Element != this && - event.GUIEvent.Element != ListButton && - event.GUIEvent.Element != ListBox && + if (ListBox && + (Environment->hasFocus(ListBox) || ListBox->isMyChild(event.GUIEvent.Caller) ) && + event.GUIEvent.Element != this && + event.GUIEvent.Element != ListButton && + event.GUIEvent.Element != ListBox && !ListBox->isMyChild(event.GUIEvent.Element)) { openCloseMenu(); @@ -268,7 +267,7 @@ bool CGUIComboBox::OnEvent(const SEvent& event) case EMIE_LMOUSE_PRESSED_DOWN: { core::position2d p(event.MouseInput.X, event.MouseInput.Y); - + // send to list box if (ListBox && ListBox->isPointInside(p) && ListBox->OnEvent(event)) return true; @@ -313,6 +312,7 @@ bool CGUIComboBox::OnEvent(const SEvent& event) } + void CGUIComboBox::sendSelectionChangedEvent() { if (Parent) @@ -328,6 +328,7 @@ void CGUIComboBox::sendSelectionChangedEvent() } + //! draws the element and its children void CGUIComboBox::draw() { @@ -372,7 +373,7 @@ void CGUIComboBox::openCloseMenu() if (Parent) Parent->bringToFront(this); - IGUISkin* skin = Environment->getSkin(); + IGUISkin* skin = Environment->getSkin(); s32 h = Items.size(); if (h > 5) @@ -402,7 +403,6 @@ void CGUIComboBox::openCloseMenu() } } - //! Writes attributes of the element. void CGUIComboBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const { @@ -422,7 +422,6 @@ void CGUIComboBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadW } } - //! Reads attributes of the element void CGUIComboBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) { diff --git a/src/dep/src/irrlicht/CGUIComboBox.h b/src/dep/src/irrlicht/CGUIComboBox.h index ac8b4ae..c79755c 100644 --- a/src/dep/src/irrlicht/CGUIComboBox.h +++ b/src/dep/src/irrlicht/CGUIComboBox.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -76,11 +76,11 @@ namespace gui IGUIButton* ListButton; IGUIStaticText* SelectedText; IGUIListBox* ListBox; - IGUIElement *LastFocus; core::array< core::stringw > Items; s32 Selected; - EGUI_ALIGNMENT HAlign, VAlign; bool HasFocus; + IGUIElement *LastFocus; + EGUI_ALIGNMENT HAlign, VAlign; }; diff --git a/src/dep/src/irrlicht/CGUIContextMenu.cpp b/src/dep/src/irrlicht/CGUIContextMenu.cpp index 65bb9f0..fc7e59c 100644 --- a/src/dep/src/irrlicht/CGUIContextMenu.cpp +++ b/src/dep/src/irrlicht/CGUIContextMenu.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -23,8 +23,8 @@ namespace gui CGUIContextMenu::CGUIContextMenu(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect rectangle, bool getFocus, bool allowFocus) - : IGUIContextMenu(environment, parent, id, rectangle), EventParent(0), LastFont(0), - HighLighted(-1), ChangeTime(0), AllowFocus(allowFocus) + : IGUIContextMenu(environment, parent, id, rectangle), HighLighted(-1), + ChangeTime(0), EventParent(0), AllowFocus(allowFocus), LastFont(0) { #ifdef _DEBUG setDebugName("CGUIContextMenu"); @@ -242,7 +242,7 @@ bool CGUIContextMenu::OnEvent(const SEvent& event) } break; default: - break; + break; } break; case EET_MOUSE_INPUT_EVENT: @@ -265,7 +265,7 @@ bool CGUIContextMenu::OnEvent(const SEvent& event) highlight(core::position2d(event.MouseInput.X, event.MouseInput.Y), true); return true; default: - break; + break; } break; default: @@ -530,7 +530,8 @@ void CGUIContextMenu::draw() void CGUIContextMenu::recalculateSize() { - IGUIFont* font = Environment->getSkin()->getFont(EGDF_MENU); + IGUISkin* skin = Environment->getSkin(); + IGUIFont* font = skin->getFont(EGDF_MENU); if (!font) return; diff --git a/src/dep/src/irrlicht/CGUIContextMenu.h b/src/dep/src/irrlicht/CGUIContextMenu.h index bf55a0c..b2317ba 100644 --- a/src/dep/src/irrlicht/CGUIContextMenu.h +++ b/src/dep/src/irrlicht/CGUIContextMenu.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -132,13 +132,13 @@ namespace gui void setEventParent(IGUIElement *parent); + s32 HighLighted; core::array Items; core::position2d Pos; - IGUIElement* EventParent; - IGUIFont *LastFont; - s32 HighLighted; u32 ChangeTime; + IGUIElement* EventParent; bool AllowFocus; + IGUIFont *LastFont; }; diff --git a/src/dep/src/irrlicht/CGUIEditBox.cpp b/src/dep/src/irrlicht/CGUIEditBox.cpp index f4619df..39ef4f2 100644 --- a/src/dep/src/irrlicht/CGUIEditBox.cpp +++ b/src/dep/src/irrlicht/CGUIEditBox.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -33,11 +33,13 @@ CGUIEditBox::CGUIEditBox(const wchar_t* text, bool border, IGUIEnvironment* envi const core::rect& rectangle) : IGUIEditBox(environment, parent, id, rectangle), MouseMarking(false), Border(border), OverrideColorEnabled(false), MarkBegin(0), MarkEnd(0), - OverrideColor(video::SColor(101,255,255,255)), OverrideFont(0), LastBreakFont(0), - Operator(0), BlinkStartTime(0), CursorPos(0), HScrollPos(0), VScrollPos(0), Max(0), + OverrideColor(video::SColor(101,255,255,255)), + OverrideFont(0), LastBreakFont(0), CursorPos(0), HScrollPos(0), VScrollPos(0), Max(0), WordWrap(false), MultiLine(false), AutoScroll(true), PasswordBox(false), - PasswordChar(L'*'), HAlign(EGUIA_UPPERLEFT), VAlign(EGUIA_CENTER), + PasswordChar(L'*'), + HAlign(EGUIA_UPPERLEFT), VAlign(EGUIA_CENTER), CurrentTextRect(0,0,1,1), FrameRect(rectangle) + { #ifdef _DEBUG setDebugName("CGUIEditBox"); @@ -45,8 +47,7 @@ CGUIEditBox::CGUIEditBox(const wchar_t* text, bool border, IGUIEnvironment* envi Text = text; - if (Environment) - Operator = Environment->getOSOperator(); + Operator = environment->getOSOperator(); if (Operator) Operator->grab(); @@ -55,9 +56,7 @@ CGUIEditBox::CGUIEditBox(const wchar_t* text, bool border, IGUIEnvironment* envi setTabStop(true); setTabOrder(-1); - IGUISkin *skin = 0; - if (Environment) - skin = Environment->getSkin(); + IGUISkin *skin = Environment->getSkin(); if (Border && skin) { FrameRect.UpperLeftCorner.X += skin->getSize(EGDS_TEXT_DISTANCE_X)+1; @@ -85,9 +84,6 @@ CGUIEditBox::~CGUIEditBox() //! Sets another skin independent font. void CGUIEditBox::setOverrideFont(IGUIFont* font) { - if (OverrideFont == font) - return; - if (OverrideFont) OverrideFont->drop(); @@ -665,7 +661,6 @@ bool CGUIEditBox::processKey(const SEvent& event) return true; } - //! draws the element and its children void CGUIEditBox::draw() { @@ -879,7 +874,6 @@ bool CGUIEditBox::isAutoScrollEnabled() const return AutoScroll; } - //! Gets the area of the text in the edit box //! \return Returns the size in pixels of the text core::dimension2di CGUIEditBox::getTextDimension() @@ -1368,7 +1362,7 @@ void CGUIEditBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadW setPasswordBox(in->getAttributeAsBool("PasswordBox"), ch[0]); setTextAlignment( (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("HTextAlign", GUIAlignmentNames), - (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("VTextAlign", GUIAlignmentNames)); + (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("VTextAlign", GUIAlignmentNames)); // setOverrideFont(in->getAttributeAsFont("OverrideFont")); } diff --git a/src/dep/src/irrlicht/CGUIEditBox.h b/src/dep/src/irrlicht/CGUIEditBox.h index 09c118e..4bace92 100644 --- a/src/dep/src/irrlicht/CGUIEditBox.h +++ b/src/dep/src/irrlicht/CGUIEditBox.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -81,14 +81,14 @@ namespace gui virtual void setText(const wchar_t* text); //! Sets the maximum amount of characters which may be entered in the box. - //! \param max: Maximum amount of characters. If 0, the character amount is + //! \param max: Maximum amount of characters. If 0, the character amount is //! infinity. virtual void setMax(u32 max); //! Returns maximum amount of characters, previously set by setMax(); virtual u32 getMax() const; - //! Sets whether the edit box is a password box. Setting this to true will + //! Sets whether the edit box is a password box. Setting this to true will /** disable MultiLine, WordWrap and the ability to copy with ctrl+c or ctrl+x \param passwordBox: true to enable password, false to disable \param passwordChar: the character that is displayed instead of letters */ diff --git a/src/dep/src/irrlicht/CGUIEnvironment.cpp b/src/dep/src/irrlicht/CGUIEnvironment.cpp index 24ebaef..c923a3e 100644 --- a/src/dep/src/irrlicht/CGUIEnvironment.cpp +++ b/src/dep/src/irrlicht/CGUIEnvironment.cpp @@ -1,5 +1,5 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -192,7 +192,7 @@ void CGUIEnvironment::drawAll() AbsoluteClippingRect = DesiredRect; AbsoluteRect = DesiredRect; updateAbsolutePosition(); - } + } } // make sure tooltip is always on top @@ -243,7 +243,7 @@ bool CGUIEnvironment::setFocus(IGUIElement* element) currentFocus->drop(); currentFocus = 0; } - + if (element) { currentFocus = Focus; @@ -275,7 +275,7 @@ bool CGUIEnvironment::setFocus(IGUIElement* element) // element is the new focus so it doesn't have to be dropped Focus = element; - + return true; } @@ -308,7 +308,7 @@ bool CGUIEnvironment::removeFocus(IGUIElement* element) Focus->drop(); Focus = 0; } - + return true; } @@ -317,7 +317,7 @@ bool CGUIEnvironment::removeFocus(IGUIElement* element) bool CGUIEnvironment::hasFocus(IGUIElement* element) const { _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; - return (element == Focus); + return (element == Focus); } @@ -327,21 +327,18 @@ video::IVideoDriver* CGUIEnvironment::getVideoDriver() const return Driver; } - //! returns the current file system io::IFileSystem* CGUIEnvironment::getFileSystem() const { return FileSystem; } - //! returns the current file system IOSOperator* CGUIEnvironment::getOSOperator() const { return Operator; } - //! clear all GUI elements void CGUIEnvironment::clear() { @@ -373,7 +370,7 @@ bool CGUIEnvironment::OnEvent(const SEvent& event) if (UserReceiver && (event.EventType != EET_MOUSE_INPUT_EVENT) && (event.EventType != EET_KEY_INPUT_EVENT) - && (event.EventType != EET_GUI_EVENT || event.GUIEvent.Caller != this)) + && (event.EventType != EET_GUI_EVENT || event.GUIEvent.Caller != this)) { ret = UserReceiver->OnEvent(event); } @@ -394,7 +391,7 @@ void CGUIEnvironment::OnPostRender( u32 time ) ToolTip.Element == 0 && Hovered != ToolTip.Element && Hovered->getToolTipText().size() && - getSkin() && + getSkin() && getSkin()->getFont(EGDF_TOOLTIP) ) { @@ -446,7 +443,7 @@ void CGUIEnvironment::updateHoveredElement(core::position2d mousePos) if (Hovered != lastHovered) { - SEvent event; + SEvent event; event.EventType = EET_GUI_EVENT; if (lastHovered) @@ -481,7 +478,7 @@ void CGUIEnvironment::updateHoveredElement(core::position2d mousePos) event.GUIEvent.EventType = EGET_ELEMENT_HOVERED; Hovered->OnEvent(event); } - } + } if (lastHovered && lastHovered != this) lastHovered->drop(); @@ -529,8 +526,8 @@ bool CGUIEnvironment::postEventFromUser(const SEvent& event) case EET_KEY_INPUT_EVENT: { // send focus changing event - if (event.EventType == EET_KEY_INPUT_EVENT && - event.KeyInput.PressedDown && + if (event.EventType == EET_KEY_INPUT_EVENT && + event.KeyInput.PressedDown && event.KeyInput.Key == KEY_TAB) { IGUIElement *next = getNextElement(event.KeyInput.Shift, event.KeyInput.Control); @@ -735,7 +732,7 @@ bool CGUIEnvironment::loadGUI(io::IReadFile* file, IGUIElement* parent) _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; return false; } - + // read file while(reader->read()) { @@ -744,8 +741,8 @@ bool CGUIEnvironment::loadGUI(io::IReadFile* file, IGUIElement* parent) // finish up - reader->drop(); - return true; + reader->drop(); + return true; } @@ -813,7 +810,7 @@ void CGUIEnvironment::readGUIElement(io::IXMLReader* reader, IGUIElement* parent else { os::Printer::log("Found unknown element in irrlicht GUI file", - core::stringc(reader->getNodeName()).c_str()); + core::stringc(reader->getNodeName()).c_str()); } break; @@ -921,8 +918,8 @@ void CGUIEnvironment::deserializeAttributes(io::IAttributes* in, io::SAttributeR } - RelativeRect = AbsoluteRect = - core::rect(core::position2d(0,0), + RelativeRect = AbsoluteRect = + core::rect(core::position2d(0,0), Driver ? Driver->getScreenSize() : core::dimension2d(0,0)); } @@ -943,7 +940,7 @@ IGUIButton* CGUIEnvironment::addButton(const core::rect& rectangle, IGUIEle //! adds a window. The returned pointer must not be dropped. -IGUIWindow* CGUIEnvironment::addWindow(const core::rect& rectangle, bool modal, +IGUIWindow* CGUIEnvironment::addWindow(const core::rect& rectangle, bool modal, const wchar_t* text, IGUIElement* parent, s32 id) { parent = parent ? parent : this; @@ -1019,7 +1016,6 @@ IGUIScrollBar* CGUIEnvironment::addScrollBar(bool horizontal, const core::rect& rectangle, IGUIElement* parent, s32 id, bool drawBackground) { CGUITable* b = new CGUITable(this, parent ? parent : this, id, rectangle, true, drawBackground, false); @@ -1027,8 +1023,7 @@ IGUITable* CGUIEnvironment::addTable(const core::rect& rectangle, IGUIEleme return b; } - -//! Adds an image element. +//! Adds an image element. IGUIImage* CGUIEnvironment::addImage(video::ITexture* image, core::position2d pos, bool useAlphaChannel, IGUIElement* parent, s32 id, const wchar_t* text) { @@ -1084,7 +1079,7 @@ IGUIMeshViewer* CGUIEnvironment::addMeshViewer(const core::rect& rectangle, //! adds a checkbox IGUICheckBox* CGUIEnvironment::addCheckBox(bool checked, const core::rect& rectangle, IGUIElement* parent, s32 id, const wchar_t* text) { - IGUICheckBox* b = new CGUICheckBox(checked, this, + IGUICheckBox* b = new CGUICheckBox(checked, this, parent ? parent : this , id , rectangle); if (text) @@ -1096,8 +1091,9 @@ IGUICheckBox* CGUIEnvironment::addCheckBox(bool checked, const core::rect& //! adds a list box -IGUIListBox* CGUIEnvironment::addListBox(const core::rect& rectangle, - IGUIElement* parent, s32 id, bool drawBackground) +IGUIListBox* CGUIEnvironment::addListBox(const core::rect& rectangle, + IGUIElement* parent, s32 id, + bool drawBackground) { IGUIListBox* b = new CGUIListBox(this, parent ? parent : this, id, rectangle, true, drawBackground, false); @@ -1117,8 +1113,9 @@ IGUIListBox* CGUIEnvironment::addListBox(const core::rect& rectangle, //! adds a file open dialog. The returned pointer must not be dropped. -IGUIFileOpenDialog* CGUIEnvironment::addFileOpenDialog(const wchar_t* title, - bool modal, IGUIElement* parent, s32 id) +IGUIFileOpenDialog* CGUIEnvironment::addFileOpenDialog(const wchar_t* title, + bool modal, + IGUIElement* parent, s32 id) { parent = parent ? parent : this; @@ -1136,8 +1133,9 @@ IGUIFileOpenDialog* CGUIEnvironment::addFileOpenDialog(const wchar_t* title, //! adds a color select dialog. The returned pointer must not be dropped. -IGUIColorSelectDialog* CGUIEnvironment::addColorSelectDialog(const wchar_t* title, - bool modal, IGUIElement* parent, s32 id) +IGUIColorSelectDialog* CGUIEnvironment::addColorSelectDialog(const wchar_t* title, + bool modal, + IGUIElement* parent, s32 id) { parent = parent ? parent : this; @@ -1156,10 +1154,11 @@ IGUIColorSelectDialog* CGUIEnvironment::addColorSelectDialog(const wchar_t* titl //! adds a static text. The returned pointer must not be dropped. -IGUIStaticText* CGUIEnvironment::addStaticText(const wchar_t* text, - const core::rect& rectangle, - bool border, bool wordWrap, - IGUIElement* parent, s32 id, bool background) +IGUIStaticText* CGUIEnvironment::addStaticText(const wchar_t* text, + const core::rect& rectangle, + bool border, bool wordWrap, + IGUIElement* parent, s32 id, + bool background) { IGUIStaticText* d = new CGUIStaticText(text, border, this, parent ? parent : this, id, rectangle, background); @@ -1172,9 +1171,10 @@ IGUIStaticText* CGUIEnvironment::addStaticText(const wchar_t* text, //! Adds an edit box. The returned pointer must not be dropped. -IGUIEditBox* CGUIEnvironment::addEditBox(const wchar_t* text, - const core::rect& rectangle, bool border, - IGUIElement* parent, s32 id) +IGUIEditBox* CGUIEnvironment::addEditBox(const wchar_t* text, + const core::rect& rectangle, + bool border, IGUIElement* parent, + s32 id) { IGUIEditBox* d = new CGUIEditBox(text, border, this, parent ? parent : this, id, rectangle); @@ -1185,9 +1185,9 @@ IGUIEditBox* CGUIEnvironment::addEditBox(const wchar_t* text, //! Adds a spin box to the environment -IGUISpinBox* CGUIEnvironment::addSpinBox(const wchar_t* text, - const core::rect &rectangle, - IGUIElement* parent, s32 id) +IGUISpinBox* CGUIEnvironment::addSpinBox(const wchar_t* text, + const core::rect &rectangle, + IGUIElement* parent, s32 id) { IGUISpinBox* d = new CGUISpinBox(text, this, parent ? parent : this, id, rectangle); @@ -1207,7 +1207,7 @@ IGUITabControl* CGUIEnvironment::addTabControl(const core::rect& rectangle, } -//! Adds tab to the environment. +//! Adds tab to the environment. IGUITab* CGUIEnvironment::addTab(const core::rect& rectangle, IGUIElement* parent, s32 id) { @@ -1222,7 +1222,7 @@ IGUITab* CGUIEnvironment::addTab(const core::rect& rectangle, IGUIContextMenu* CGUIEnvironment::addContextMenu(const core::rect& rectangle, IGUIElement* parent, s32 id) { - IGUIContextMenu* c = new CGUIContextMenu(this, + IGUIContextMenu* c = new CGUIContextMenu(this, parent ? parent : this, id, rectangle, true); c->drop(); return c; @@ -1235,7 +1235,7 @@ IGUIContextMenu* CGUIEnvironment::addMenu(IGUIElement* parent, s32 id) if (!parent) parent = this; - IGUIContextMenu* c = new CGUIMenu(this, + IGUIContextMenu* c = new CGUIMenu(this, parent, id, core::rect(0,0, parent->getAbsolutePosition().getWidth(), parent->getAbsolutePosition().getHeight())); @@ -1265,8 +1265,9 @@ IGUIInOutFader* CGUIEnvironment::addInOutFader(const core::rect* rectangle, if (rectangle) rect = *rectangle; - else if (Driver) - rect = core::rect(core::position2d(0,0), Driver->getScreenSize()); + else + if (Driver) + rect = core::rect(core::position2d(0,0), Driver->getScreenSize()); if (!parent) parent = this; @@ -1438,7 +1439,7 @@ IGUISpriteBank* CGUIEnvironment::addEmptySpriteBank(const c8 *name) const s32 index = Banks.binary_search(b); if (index != -1) - return 0; + return 0; // create a new sprite bank @@ -1460,7 +1461,7 @@ IGUIFont* CGUIEnvironment::getBuiltInFont() const } -//! Returns the root gui element. +//! Returns the root gui element. IGUIElement* CGUIEnvironment::getRootGUIElement() { return this; @@ -1479,13 +1480,13 @@ IGUIElement* CGUIEnvironment::getNextElement(bool reverse, bool group) { startOrder = startPos->getTabOrder(); } - else + else if (!group && Focus && !Focus->isTabGroup()) { startOrder = Focus->getTabOrder(); if (startOrder == -1) { - // this element is not part of the tab cycle, + // this element is not part of the tab cycle, // but its parent might be... IGUIElement *el = Focus; while (el && el->getParent() && startOrder == -1) @@ -1530,3 +1531,4 @@ IGUIEnvironment* createGUIEnvironment(io::IFileSystem* fs, #endif // _IRR_COMPILE_WITH_GUI_ + diff --git a/src/dep/src/irrlicht/CGUIEnvironment.h b/src/dep/src/irrlicht/CGUIEnvironment.h index 158dce7..dac1c36 100644 --- a/src/dep/src/irrlicht/CGUIEnvironment.h +++ b/src/dep/src/irrlicht/CGUIEnvironment.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -83,7 +83,7 @@ public: virtual IGUIButton* addButton(const core::rect& rectangle, IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0,const wchar_t* tooltiptext = 0); //! adds a window. The returned pointer must not be dropped. - virtual IGUIWindow* addWindow(const core::rect& rectangle, bool modal = false, + virtual IGUIWindow* addWindow(const core::rect& rectangle, bool modal = false, const wchar_t* text=0, IGUIElement* parent=0, s32 id=-1); //! adds a modal screen. The returned pointer must not be dropped. @@ -96,12 +96,12 @@ public: //! adds a scrollbar. The returned pointer must not be dropped. virtual IGUIScrollBar* addScrollBar(bool horizontal, const core::rect& rectangle, IGUIElement* parent=0, s32 id=-1); - //! Adds an image element. + //! Adds an image element. virtual IGUIImage* addImage(video::ITexture* image, core::position2d pos, bool useAlphaChannel=true, IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0); //! adds an image. The returned pointer must not be dropped. - virtual IGUIImage* addImage(const core::rect& rectangle, + virtual IGUIImage* addImage(const core::rect& rectangle, IGUIElement* parent=0, s32 id=-1, const wchar_t* text=0); //! adds a checkbox @@ -125,18 +125,18 @@ public: bool border=false, bool wordWrap=true, IGUIElement* parent=0, s32 id=-1, bool drawBackground = false); //! Adds an edit box. The returned pointer must not be dropped. - virtual IGUIEditBox* addEditBox(const wchar_t* text, const core::rect& rectangle, + virtual IGUIEditBox* addEditBox(const wchar_t* text, const core::rect& rectangle, bool border=false, IGUIElement* parent=0, s32 id=-1); //! Adds a spin box to the environment - virtual IGUISpinBox* addSpinBox(const wchar_t* text, const core::rect& rectangle, + virtual IGUISpinBox* addSpinBox(const wchar_t* text, const core::rect& rectangle, IGUIElement* parent=0, s32 id=-1); //! Adds a tab control to the environment. virtual IGUITabControl* addTabControl(const core::rect& rectangle, IGUIElement* parent=0, bool fillbackground=false, bool border=true, s32 id=-1); - //! Adds tab to the environment. + //! Adds tab to the environment. virtual IGUITab* addTab(const core::rect& rectangle, IGUIElement* parent=0, s32 id=-1); @@ -156,7 +156,7 @@ public: IGUIElement* parent=0, s32 id=-1); //! Adds a table element. - virtual IGUITable* addTable(const core::rect& rectangle, + virtual IGUITable* addTable(const core::rect& rectangle, IGUIElement* parent=0, s32 id=-1, bool drawBackground=false); //! sets the focus to an element @@ -177,7 +177,7 @@ public: //! Adds an element for fading in or out. virtual IGUIInOutFader* addInOutFader(const core::rect* rectangle=0, IGUIElement* parent=0, s32 id=-1); - //! Returns the root gui element. + //! Returns the root gui element. virtual IGUIElement* getRootGUIElement(); virtual void OnPostRender( u32 time ); @@ -201,27 +201,27 @@ public: //! Saves the current gui into a file. /** \param filename: Name of the file. - \param start: The element to start saving from. - if not specified, the root element will be used */ + \param start: The element to start saving from. + if not specified, the root element will be used */ virtual bool saveGUI(const c8* filename, IGUIElement* start=0); //! Saves the current gui into a file. /** \param file: The file to save the GUI to. - \param start: The element to start saving from. + \param start: The element to start saving from. if not specified, the root element will be used */ virtual bool saveGUI(io::IWriteFile* file, IGUIElement* start=0); //! Loads the gui. Note that the current gui is not cleared before. /** \param filename: Name of the file. - \param parent: The parent of all loaded GUI elements, + \param parent: The parent of all loaded GUI elements, if not specified, the root element will be used */ virtual bool loadGUI(const c8* filename, IGUIElement* parent=0); //! Loads the gui. Note that the current gui is not cleared before. /** \param file: IReadFile to load the GUI from - \param parent: The parent of all loaded GUI elements, + \param parent: The parent of all loaded GUI elements, if not specified, the root element will be used */ - virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0); + virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0); //! Writes attributes of the environment virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const; @@ -235,6 +235,7 @@ public: //! reads an element virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* parent); + private: IGUIElement* getNextElement(bool reverse=false, bool group=false); @@ -267,9 +268,9 @@ private: struct SToolTip { - IGUIStaticText* Element; u32 LastTime; u32 LaunchTime; + IGUIStaticText* Element; }; SToolTip ToolTip; diff --git a/src/dep/src/irrlicht/CGUIFileOpenDialog.cpp b/src/dep/src/irrlicht/CGUIFileOpenDialog.cpp index 5b6a41d..3c7a183 100644 --- a/src/dep/src/irrlicht/CGUIFileOpenDialog.cpp +++ b/src/dep/src/irrlicht/CGUIFileOpenDialog.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -32,7 +32,7 @@ CGUIFileOpenDialog::CGUIFileOpenDialog(const wchar_t* title, (parent->getAbsolutePosition().getHeight()-FOD_HEIGHT)/2, (parent->getAbsolutePosition().getWidth()-FOD_WIDTH)/2+FOD_WIDTH, (parent->getAbsolutePosition().getHeight()-FOD_HEIGHT)/2+FOD_HEIGHT)), - FileNameText(0), FileList(0), Dragging(false) + Dragging(false), FileNameText(0), FileList(0) { #ifdef _DEBUG IGUIElement::setDebugName("CGUIFileOpenDialog"); @@ -49,8 +49,8 @@ CGUIFileOpenDialog::CGUIFileOpenDialog(const wchar_t* title, color = skin->getColor(EGDC_WINDOW_SYMBOL); } - const s32 buttonw = environment->getSkin()->getSize(EGDS_WINDOW_BUTTON_WIDTH); - const s32 posx = RelativeRect.getWidth() - buttonw - 4; + s32 buttonw = environment->getSkin()->getSize(EGDS_WINDOW_BUTTON_WIDTH); + s32 posx = RelativeRect.getWidth() - buttonw - 4; CloseButton = Environment->addButton(core::rect(posx, 3, posx + buttonw, 3 + buttonw), this, -1, L"", skin ? skin->getDefaultText(EGDT_WINDOW_CLOSE) : L"Close"); diff --git a/src/dep/src/irrlicht/CGUIFileOpenDialog.h b/src/dep/src/irrlicht/CGUIFileOpenDialog.h index 43d7a9f..3af2ece 100644 --- a/src/dep/src/irrlicht/CGUIFileOpenDialog.h +++ b/src/dep/src/irrlicht/CGUIFileOpenDialog.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -50,6 +50,7 @@ namespace gui core::position2d DragStart; core::stringw FileName; + bool Dragging; IGUIButton* CloseButton; IGUIButton* OKButton; IGUIButton* CancelButton; @@ -57,8 +58,8 @@ namespace gui IGUIElement* FileNameText; IGUIElement* EventParent; io::IFileSystem* FileSystem; + io::IFileList* FileList; - bool Dragging; }; diff --git a/src/dep/src/irrlicht/CGUIFont.cpp b/src/dep/src/irrlicht/CGUIFont.cpp index 5c74c91..d07da50 100644 --- a/src/dep/src/irrlicht/CGUIFont.cpp +++ b/src/dep/src/irrlicht/CGUIFont.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -96,7 +96,7 @@ bool CGUIFont::load(io::IXMLReader* xml) if (alpha == core::stringw("false")) Driver->makeColorKeyTexture(SpriteBank->getTexture(i), core::position2di(0,0)); } - } + } else if (core::stringw(L"c") == xml->getNodeName()) { // adding a character to this font @@ -112,45 +112,45 @@ bool CGUIFont::load(io::IXMLReader* xml) // parse rectangle core::stringc rectstr = xml->getAttributeValue(L"r"); - wchar_t ch = xml->getAttributeValue(L"c")[0]; + wchar_t ch = xml->getAttributeValue(L"c")[0]; const c8 *c = rectstr.c_str(); s32 val; val = 0; - while (*c >= '0' && *c <= '9') - { - val *= 10; - val += *c - '0'; + while (*c >= '0' && *c <= '9') + { + val *= 10; + val += *c - '0'; c++; } rectangle.UpperLeftCorner.X = val; while (*c == L' ' || *c == L',') c++; val = 0; - while (*c >= '0' && *c <= '9') - { - val *= 10; - val += *c - '0'; + while (*c >= '0' && *c <= '9') + { + val *= 10; + val += *c - '0'; c++; } rectangle.UpperLeftCorner.Y = val; while (*c == L' ' || *c == L',') c++; val = 0; - while (*c >= '0' && *c <= '9') - { - val *= 10; - val += *c - '0'; + while (*c >= '0' && *c <= '9') + { + val *= 10; + val += *c - '0'; c++; } rectangle.LowerRightCorner.X = val; while (*c == L' ' || *c == L',') c++; val = 0; - while (*c >= '0' && *c <= '9') - { - val *= 10; - val += *c - '0'; + while (*c >= '0' && *c <= '9') + { + val *= 10; + val += *c - '0'; c++; } rectangle.LowerRightCorner.Y = val; @@ -158,7 +158,7 @@ bool CGUIFont::load(io::IXMLReader* xml) CharacterMap.insert(ch,Areas.size()); // make frame - f.rectNumber = SpriteBank->getPositions().size(); + f.rectNumber = SpriteBank->getPositions().size(); f.textureNumber = texno; // add frame to sprite @@ -481,7 +481,7 @@ core::dimension2d CGUIFont::getDimension(const wchar_t* text) const //! set an Pixel Offset on Drawing ( scale position on width ) -void CGUIFont::setKerningWidth(s32 kerning) +void CGUIFont::setKerningWidth ( s32 kerning ) { GlobalKerningWidth = kerning; } @@ -507,7 +507,7 @@ s32 CGUIFont::getKerningWidth(const wchar_t* thisLetter, const wchar_t* previous //! set an Pixel Offset on Drawing ( scale position on height ) -void CGUIFont::setKerningHeight(s32 kerning) +void CGUIFont::setKerningHeight ( s32 kerning ) { GlobalKerningHeight = kerning; } @@ -646,4 +646,3 @@ IGUISpriteBank* CGUIFont::getSpriteBank() const } // end namespace irr #endif // _IRR_COMPILE_WITH_GUI_ - diff --git a/src/dep/src/irrlicht/CGUIFont.h b/src/dep/src/irrlicht/CGUIFont.h index 30bd074..9884d02 100644 --- a/src/dep/src/irrlicht/CGUIFont.h +++ b/src/dep/src/irrlicht/CGUIFont.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CGUIImage.cpp b/src/dep/src/irrlicht/CGUIImage.cpp index e532ac9..1a11232 100644 --- a/src/dep/src/irrlicht/CGUIImage.cpp +++ b/src/dep/src/irrlicht/CGUIImage.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -15,10 +15,11 @@ namespace gui { + //! constructor CGUIImage::CGUIImage(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect rectangle) -: IGUIImage(environment, parent, id, rectangle), Texture(0), Color(255,255,255,255), - UseAlphaChannel(false), ScaleImage(false) +: IGUIImage(environment, parent, id, rectangle), Color(255,255,255,255), + Texture(0), UseAlphaChannel(false), ScaleImage(false) { #ifdef _DEBUG setDebugName("CGUIImage"); @@ -26,6 +27,7 @@ CGUIImage::CGUIImage(IGUIEnvironment* environment, IGUIElement* parent, s32 id, } + //! destructor CGUIImage::~CGUIImage() { @@ -34,6 +36,7 @@ CGUIImage::~CGUIImage() } + //! sets an image void CGUIImage::setImage(video::ITexture* image) { @@ -74,13 +77,13 @@ void CGUIImage::draw() { const video::SColor Colors[] = {Color,Color,Color,Color}; - driver->draw2DImage(Texture, AbsoluteRect, + driver->draw2DImage(Texture, AbsoluteRect, core::rect(core::position2d(0,0), Texture->getOriginalSize()), &AbsoluteClippingRect, Colors, UseAlphaChannel); } else { - driver->draw2DImage(Texture, AbsoluteRect.UpperLeftCorner, + driver->draw2DImage(Texture, AbsoluteRect.UpperLeftCorner, core::rect(core::position2d(0,0), Texture->getOriginalSize()), &AbsoluteClippingRect, Color, UseAlphaChannel); } @@ -100,14 +103,12 @@ void CGUIImage::setUseAlphaChannel(bool use) UseAlphaChannel = use; } - //! sets if the image should use its alpha channel to draw itself void CGUIImage::setScaleImage(bool scale) { ScaleImage = scale; } - //! Returns true if the image is scaled to fit, false if not bool CGUIImage::isImageScaled() const { @@ -135,7 +136,6 @@ void CGUIImage::serializeAttributes(io::IAttributes* out, io::SAttributeReadWrit } - //! Reads attributes of the element void CGUIImage::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) { @@ -148,9 +148,10 @@ void CGUIImage::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWri } + + } // end namespace gui } // end namespace irr #endif // _IRR_COMPILE_WITH_GUI_ - diff --git a/src/dep/src/irrlicht/CGUIImage.h b/src/dep/src/irrlicht/CGUIImage.h index f0a9d69..171cef5 100644 --- a/src/dep/src/irrlicht/CGUIImage.h +++ b/src/dep/src/irrlicht/CGUIImage.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -52,9 +52,10 @@ namespace gui //! Reads attributes of the element virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options); + private: - video::ITexture* Texture; video::SColor Color; + video::ITexture* Texture; bool UseAlphaChannel; bool ScaleImage; diff --git a/src/dep/src/irrlicht/CGUIInOutFader.cpp b/src/dep/src/irrlicht/CGUIInOutFader.cpp index bf513ad..e89304f 100644 --- a/src/dep/src/irrlicht/CGUIInOutFader.cpp +++ b/src/dep/src/irrlicht/CGUIInOutFader.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -63,6 +63,7 @@ void CGUIInOutFader::draw() } + //! Gets the color to fade out to or to fade in from. video::SColor CGUIInOutFader::getColor() const { @@ -70,6 +71,7 @@ video::SColor CGUIInOutFader::getColor() const } + //! Sets the color to fade out to or to fade in from. void CGUIInOutFader::setColor(video::SColor color) { @@ -88,7 +90,7 @@ void CGUIInOutFader::setColor(video::SColor color) if (Action == EFA_FADE_OUT) { - FullColor.setAlpha(0); + FullColor.setAlpha(0); TransColor.setAlpha(255); } else @@ -100,7 +102,6 @@ void CGUIInOutFader::setColor(video::SColor color) */ } - void CGUIInOutFader::setColor(video::SColor source, video::SColor dest) { Color[0] = source; @@ -122,7 +123,7 @@ void CGUIInOutFader::setColor(video::SColor source, video::SColor dest) //! Returns if the fade in or out process is done. -bool CGUIInOutFader::isReady() const +bool CGUIInOutFader::isReady() const { u32 now = os::Timer::getTime(); bool ret = (now > EndTime); @@ -131,6 +132,7 @@ bool CGUIInOutFader::isReady() const } + //! Starts the fade in process. void CGUIInOutFader::fadeIn(u32 time) { @@ -150,7 +152,6 @@ void CGUIInOutFader::fadeOut(u32 time) setColor(Color[0],Color[1]); } - //! Writes attributes of the element. void CGUIInOutFader::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const { @@ -161,7 +162,6 @@ void CGUIInOutFader::serializeAttributes(io::IAttributes* out, io::SAttributeRea } - //! Reads attributes of the element void CGUIInOutFader::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) { @@ -172,6 +172,7 @@ void CGUIInOutFader::deserializeAttributes(io::IAttributes* in, io::SAttributeRe } + } // end namespace gui } // end namespace irr diff --git a/src/dep/src/irrlicht/CGUIInOutFader.h b/src/dep/src/irrlicht/CGUIInOutFader.h index 6e9ba3e..7cf58b0 100644 --- a/src/dep/src/irrlicht/CGUIInOutFader.h +++ b/src/dep/src/irrlicht/CGUIInOutFader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -59,11 +59,12 @@ namespace gui u32 StartTime; u32 EndTime; - EFadeAction Action; + EFadeAction Action; video::SColor Color[2]; video::SColor FullColor; video::SColor TransColor; + }; } // end namespace gui diff --git a/src/dep/src/irrlicht/CGUIListBox.cpp b/src/dep/src/irrlicht/CGUIListBox.cpp index 6113290..6f88037 100644 --- a/src/dep/src/irrlicht/CGUIListBox.cpp +++ b/src/dep/src/irrlicht/CGUIListBox.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -25,8 +25,9 @@ CGUIListBox::CGUIListBox(IGUIEnvironment* environment, IGUIElement* parent, bool drawBack, bool moveOverSelect) : IGUIListBox(environment, parent, id, rectangle), Selected(-1), ItemHeight(0), TotalItemHeight(0), ItemsIconWidth(0), Font(0), IconBank(0), - ScrollBar(0), selectTime(0), LastKeyTime(0), Selecting(false), DrawBack(drawBack), - MoveOverSelect(moveOverSelect), AutoScroll(true), HighlightWhenNotFocused(true) + ScrollBar(0), Selecting(false), DrawBack(drawBack), + MoveOverSelect(moveOverSelect), selectTime(0), AutoScroll(true), + KeyBuffer(), LastKeyTime(0), HighlightWhenNotFocused(true) { #ifdef _DEBUG setDebugName("CGUIListBox"); diff --git a/src/dep/src/irrlicht/CGUIListBox.h b/src/dep/src/irrlicht/CGUIListBox.h index 798e561..88e51f8 100644 --- a/src/dep/src/irrlicht/CGUIListBox.h +++ b/src/dep/src/irrlicht/CGUIListBox.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -23,7 +23,7 @@ namespace gui { public: //! constructor - CGUIListBox(IGUIEnvironment* environment, IGUIElement* parent, + CGUIListBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect rectangle, bool clip=true, bool drawBack=false, bool moveOverSelect=false); @@ -72,7 +72,7 @@ namespace gui //! An icon is an index within the icon sprite bank. Several default icons are available in the //! skin through getIcon virtual void setSpriteBank(IGUISpriteBank* bank); - + //! sets if automatic scrolling is enabled or not. Default is true. virtual void setAutoScrollEnabled(bool scroll); @@ -97,22 +97,22 @@ namespace gui //! clear all item colors at index virtual void clearItemOverrideColor(u32 index); - //! clear item color at index for given colortype + //! clear item color at index for given colortype virtual void clearItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType); //! has the item at index its color overwritten? virtual bool hasItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const; - //! return the overwrite color at given item index. + //! return the overwrite color at given item index. virtual video::SColor getItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const; //! return the default color which is used for the given colorType virtual video::SColor getItemDefaultColor(EGUI_LISTBOX_COLOR colorType) const; - //! set the item at the given index + //! set the item at the given index virtual void setItem(u32 index, const wchar_t* text, s32 icon); - //! Insert the item at the given index + //! Insert the item at the given index //! Return the index on success or -1 on failure. virtual s32 insertItem(u32 index, const wchar_t* text, s32 icon); @@ -123,7 +123,7 @@ namespace gui struct ListItem { - ListItem() : icon(-1) + ListItem() : icon(-1) {} core::stringw text; @@ -157,13 +157,13 @@ namespace gui gui::IGUIFont* Font; gui::IGUISpriteBank* IconBank; gui::IGUIScrollBar* ScrollBar; - u32 selectTime; - u32 LastKeyTime; - core::stringw KeyBuffer; bool Selecting; bool DrawBack; bool MoveOverSelect; + u32 selectTime; bool AutoScroll; + core::stringw KeyBuffer; + u32 LastKeyTime; bool HighlightWhenNotFocused; }; diff --git a/src/dep/src/irrlicht/CGUIMenu.cpp b/src/dep/src/irrlicht/CGUIMenu.cpp index 1993037..542fed0 100644 --- a/src/dep/src/irrlicht/CGUIMenu.cpp +++ b/src/dep/src/irrlicht/CGUIMenu.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -19,8 +19,8 @@ namespace gui //! constructor CGUIMenu::CGUIMenu(IGUIEnvironment* environment, IGUIElement* parent, - s32 id, core::rect rectangle) - : CGUIContextMenu(environment, parent, id, rectangle, false, true) + s32 id, core::rect rectangle) + : CGUIContextMenu(environment, parent, id, rectangle, false, true) { #ifdef _DEBUG setDebugName("CGUIMenu"); @@ -42,7 +42,7 @@ void CGUIMenu::draw() IGUISkin* skin = Environment->getSkin(); IGUIFont* font = skin->getFont(EGDF_MENU); - + if (font != LastFont) { if (LastFont) @@ -87,7 +87,7 @@ void CGUIMenu::draw() c = EGDC_GRAY_TEXT; if (font) - font->draw(Items[i].Text.c_str(), rect, + font->draw(Items[i].Text.c_str(), rect, skin->getColor(c), true, true, &AbsoluteClippingRect); } } @@ -135,7 +135,7 @@ bool CGUIMenu::OnEvent(const SEvent& event) } if (Parent) - Parent->bringToFront(this); + Parent->bringToFront(this); core::position2d p(event.MouseInput.X, event.MouseInput.Y); bool shouldCloseSubMenu = hasOpenSubMenu(); @@ -241,14 +241,12 @@ core::rect CGUIMenu::getHRect(const SItem& i, const core::rect& absolu return r; } - //! Gets drawing rect of Item core::rect CGUIMenu::getRect(const SItem& i, const core::rect& absolute) const { return getHRect(i, absolute); } - void CGUIMenu::updateAbsolutePosition() { if (Parent) diff --git a/src/dep/src/irrlicht/CGUIMenu.h b/src/dep/src/irrlicht/CGUIMenu.h index c7168f7..391dd86 100644 --- a/src/dep/src/irrlicht/CGUIMenu.h +++ b/src/dep/src/irrlicht/CGUIMenu.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -49,4 +49,3 @@ namespace gui #endif // __C_GUI_MENU_H_INCLUDED__ #endif // _IRR_COMPILE_WITH_GUI_ - diff --git a/src/dep/src/irrlicht/CGUIMeshViewer.cpp b/src/dep/src/irrlicht/CGUIMeshViewer.cpp index 501218d..99685da 100644 --- a/src/dep/src/irrlicht/CGUIMeshViewer.cpp +++ b/src/dep/src/irrlicht/CGUIMeshViewer.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -172,3 +172,4 @@ void CGUIMeshViewer::draw() #endif // _IRR_COMPILE_WITH_GUI_ + diff --git a/src/dep/src/irrlicht/CGUIMeshViewer.h b/src/dep/src/irrlicht/CGUIMeshViewer.h index cf6d148..ee0b3ed 100644 --- a/src/dep/src/irrlicht/CGUIMeshViewer.h +++ b/src/dep/src/irrlicht/CGUIMeshViewer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CGUIMessageBox.cpp b/src/dep/src/irrlicht/CGUIMessageBox.cpp index 57e524a..8073e35 100644 --- a/src/dep/src/irrlicht/CGUIMessageBox.cpp +++ b/src/dep/src/irrlicht/CGUIMessageBox.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -295,8 +295,8 @@ bool CGUIMessageBox::OnEvent(const SEvent& event) { // cancel press if (OkButton) OkButton->setPressed(false); - if (YesButton) YesButton->setPressed(false); - if (NoButton) NoButton->setPressed(false); + if (YesButton) OkButton->setPressed(false); + if (NoButton) OkButton->setPressed(false); Pressed = false; } else @@ -397,7 +397,6 @@ bool CGUIMessageBox::OnEvent(const SEvent& event) return CGUIWindow::OnEvent(event); } - //! Writes attributes of the element. void CGUIMessageBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const { @@ -411,7 +410,6 @@ void CGUIMessageBox::serializeAttributes(io::IAttributes* out, io::SAttributeRea out->addString ("MessageText", MessageText.c_str()); } - //! Reads attributes of the element void CGUIMessageBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) { @@ -433,5 +431,6 @@ void CGUIMessageBox::deserializeAttributes(io::IAttributes* in, io::SAttributeRe } // end namespace gui } // end namespace irr + #endif // _IRR_COMPILE_WITH_GUI_ diff --git a/src/dep/src/irrlicht/CGUIMessageBox.h b/src/dep/src/irrlicht/CGUIMessageBox.h index 5686e02..80cde84 100644 --- a/src/dep/src/irrlicht/CGUIMessageBox.h +++ b/src/dep/src/irrlicht/CGUIMessageBox.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -57,4 +57,4 @@ namespace gui #endif // _IRR_COMPILE_WITH_GUI_ -#endif +#endif diff --git a/src/dep/src/irrlicht/CGUIModalScreen.cpp b/src/dep/src/irrlicht/CGUIModalScreen.cpp index e69c843..084ef40 100644 --- a/src/dep/src/irrlicht/CGUIModalScreen.cpp +++ b/src/dep/src/irrlicht/CGUIModalScreen.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -24,7 +24,7 @@ CGUIModalScreen::CGUIModalScreen(IGUIEnvironment* environment, IGUIElement* pare setDebugName("CGUIModalScreen"); #endif setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT); - + // this element is a tab group setTabGroup(true); } @@ -69,7 +69,7 @@ bool CGUIModalScreen::OnEvent(const SEvent& event) default: break; } - + IGUIElement::OnEvent(event); return true; // absorb everything else @@ -110,6 +110,7 @@ void CGUIModalScreen::draw() } + //! Removes a child. void CGUIModalScreen::removeChild(IGUIElement* child) { @@ -119,7 +120,6 @@ void CGUIModalScreen::removeChild(IGUIElement* child) remove(); } - //! adds a child void CGUIModalScreen::addChild(IGUIElement* child) { @@ -144,7 +144,6 @@ void CGUIModalScreen::updateAbsolutePosition() IGUIElement::updateAbsolutePosition(); } - //! Writes attributes of the element. void CGUIModalScreen::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const { @@ -162,4 +161,3 @@ void CGUIModalScreen::deserializeAttributes(io::IAttributes* in, io::SAttributeR } // end namespace irr #endif // _IRR_COMPILE_WITH_GUI_ - diff --git a/src/dep/src/irrlicht/CGUIModalScreen.h b/src/dep/src/irrlicht/CGUIModalScreen.h index d87da73..38e339b 100644 --- a/src/dep/src/irrlicht/CGUIModalScreen.h +++ b/src/dep/src/irrlicht/CGUIModalScreen.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -56,4 +56,3 @@ namespace gui #endif // _IRR_COMPILE_WITH_GUI_ #endif - diff --git a/src/dep/src/irrlicht/CGUIScrollBar.cpp b/src/dep/src/irrlicht/CGUIScrollBar.cpp index 09bee5b..b5959d5 100644 --- a/src/dep/src/irrlicht/CGUIScrollBar.cpp +++ b/src/dep/src/irrlicht/CGUIScrollBar.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -185,7 +185,7 @@ bool CGUIScrollBar::OnEvent(const SEvent& event) return true; } } - + if (DraggedBySlider) { setPos(newPos); @@ -219,7 +219,6 @@ bool CGUIScrollBar::OnEvent(const SEvent& event) return IGUIElement::OnEvent(event); } - //! draws the element and its children void CGUIScrollBar::draw() { @@ -240,10 +239,10 @@ void CGUIScrollBar::draw() if (DesiredPos >= Pos + LargeStep) setPos(Pos + LargeStep); - else + else if (DesiredPos <= Pos - LargeStep) setPos(Pos - LargeStep); - else + else if (DesiredPos >= Pos - LargeStep && DesiredPos <= Pos + LargeStep) setPos(DesiredPos); @@ -284,7 +283,6 @@ void CGUIScrollBar::draw() IGUIElement::draw(); } - void CGUIScrollBar::updateAbsolutePosition() { IGUIElement::updateAbsolutePosition(); @@ -325,6 +323,7 @@ s32 CGUIScrollBar::getPosFromMousePos(s32 x, s32 y) const } + //! sets the position of the scrollbar void CGUIScrollBar::setPos(s32 pos) { @@ -369,7 +368,6 @@ void CGUIScrollBar::setSmallStep(s32 step) SmallStep = 10; } - //! gets the small step value s32 CGUIScrollBar::getLargeStep() const { @@ -387,6 +385,7 @@ void CGUIScrollBar::setLargeStep(s32 step) } + //! gets the maximum value of the scrollbar. s32 CGUIScrollBar::getMax() const { diff --git a/src/dep/src/irrlicht/CGUIScrollBar.h b/src/dep/src/irrlicht/CGUIScrollBar.h index 258e273..6bcdc50 100644 --- a/src/dep/src/irrlicht/CGUIScrollBar.h +++ b/src/dep/src/irrlicht/CGUIScrollBar.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CGUISkin.cpp b/src/dep/src/irrlicht/CGUISkin.cpp index 95edab8..d63bcb8 100644 --- a/src/dep/src/irrlicht/CGUISkin.cpp +++ b/src/dep/src/irrlicht/CGUISkin.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -23,7 +23,9 @@ CGUISkin::CGUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver) setDebugName("CGUISkin"); #endif - if ((Type == EGST_WINDOWS_CLASSIC) || (Type == EGST_WINDOWS_METALLIC)) + if ( (Type == EGST_WINDOWS_CLASSIC) | + (Type == EGST_WINDOWS_METALLIC) + ) { Colors[EGDC_3D_DARK_SHADOW] = video::SColor(101,50,50,50); Colors[EGDC_3D_SHADOW] = video::SColor(101,130,130,130); @@ -55,7 +57,7 @@ CGUISkin::CGUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver) Sizes[EGDS_MESSAGE_BOX_HEIGHT] = 200; Sizes[EGDS_BUTTON_WIDTH] = 80; Sizes[EGDS_BUTTON_HEIGHT] = 30; - + Sizes[EGDS_TEXT_DISTANCE_X] = 2; Sizes[EGDS_TEXT_DISTANCE_Y] = 0; } @@ -66,7 +68,7 @@ CGUISkin::CGUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver) //Colors[EGDC_3D_FACE] = 0xc0c9ccd4; // tab background Colors[EGDC_3D_FACE] = 0xc0cbd2d9; // tab background Colors[EGDC_3D_SHADOW] = 0x50e4e8f1; // tab background, and left-top highlight - Colors[EGDC_3D_HIGH_LIGHT] = 0x40c7ccdc; + Colors[EGDC_3D_HIGH_LIGHT] = 0x40c7ccdc; Colors[EGDC_3D_LIGHT] = 0x802e313a; Colors[EGDC_ACTIVE_BORDER] = 0x80404040; // window title Colors[EGDC_ACTIVE_CAPTION] = 0xf0d0d0d0; @@ -135,7 +137,8 @@ CGUISkin::CGUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver) for (u32 i=0; i rect = r; if ( Type == EGST_BURNING_SKIN ) - { + { rect.UpperLeftCorner.Y -= 3; draw3DButtonPaneStandard(element, rect, clip); return; @@ -692,7 +693,7 @@ void CGUISkin::draw3DTabButton(IGUIElement* element, bool active, tr.LowerRightCorner.Y = tr.UpperLeftCorner.Y + 1; tr.UpperLeftCorner.X += 1; Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), tr, clip); - + // draw left highlight tr = frameRect; tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1; @@ -706,15 +707,17 @@ void CGUISkin::draw3DTabButton(IGUIElement* element, bool active, tr.LowerRightCorner.X -= 2; Driver->draw2DRectangle(getColor(EGDC_3D_FACE), tr, clip); + // draw right middle gray shadow tr.LowerRightCorner.X += 1; tr.UpperLeftCorner.X = tr.LowerRightCorner.X - 1; Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), tr, clip); + tr.LowerRightCorner.X += 1; tr.UpperLeftCorner.X += 1; tr.UpperLeftCorner.Y += 1; - Driver->draw2DRectangle(getColor(EGDC_3D_DARK_SHADOW), tr, clip); + Driver->draw2DRectangle(getColor(EGDC_3D_DARK_SHADOW), tr, clip); } else { @@ -722,7 +725,7 @@ void CGUISkin::draw3DTabButton(IGUIElement* element, bool active, tr.UpperLeftCorner.Y = tr.LowerRightCorner.Y - 1; tr.UpperLeftCorner.X += 1; Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), tr, clip); - + // draw left highlight tr = frameRect; tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1; @@ -736,18 +739,20 @@ void CGUISkin::draw3DTabButton(IGUIElement* element, bool active, tr.LowerRightCorner.X -= 2; tr.LowerRightCorner.Y -= 1; Driver->draw2DRectangle(getColor(EGDC_3D_FACE), tr, clip); - + // draw right middle gray shadow tr.LowerRightCorner.X += 1; tr.UpperLeftCorner.X = tr.LowerRightCorner.X - 1; //tr.LowerRightCorner.Y -= 1; Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), tr, clip); + tr.LowerRightCorner.X += 1; tr.UpperLeftCorner.X += 1; tr.LowerRightCorner.Y -= 1; - Driver->draw2DRectangle(getColor(EGDC_3D_DARK_SHADOW), tr, clip); + Driver->draw2DRectangle(getColor(EGDC_3D_DARK_SHADOW), tr, clip); } + } @@ -780,6 +785,7 @@ void CGUISkin::draw3DTabBody(IGUIElement* element, bool border, bool background, tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1; Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), tr, clip); + // draw right shadow tr.UpperLeftCorner.X = rect.LowerRightCorner.X - 1; tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1; @@ -789,6 +795,7 @@ void CGUISkin::draw3DTabBody(IGUIElement* element, bool border, bool background, tr = rect; tr.UpperLeftCorner.Y = tr.LowerRightCorner.Y - 1; Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), tr, clip); + } else { @@ -796,21 +803,23 @@ void CGUISkin::draw3DTabBody(IGUIElement* element, bool border, bool background, tr.LowerRightCorner.Y -= tabHeight + 2; tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1; Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), tr, clip); - + // draw right shadow tr.UpperLeftCorner.X = rect.LowerRightCorner.X - 1; tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1; Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), tr, clip); - + // draw lower shadow tr = rect; tr.LowerRightCorner.Y = tr.UpperLeftCorner.Y + 1; Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), tr, clip); + } } if (background) { + if ( alignment == EGUIA_UPPERLEFT ) { tr = rect; @@ -842,9 +851,9 @@ void CGUISkin::draw3DTabBody(IGUIElement* element, bool border, bool background, //! draws an icon, usually from the skin's sprite bank -/** \param parent: Pointer to the element which wishes to draw this icon. -This parameter is usually not used by IGUISkin, but can be used for example -by more complex implementations to find out how to draw the part exactly. +/** \param parent: Pointer to the element which wishes to draw this icon. +This parameter is usually not used by IGUISkin, but can be used for example +by more complex implementations to find out how to draw the part exactly. \param icon: Specifies the icon to be drawn. \param position: The position to draw the icon \param starttime: The time at the start of the animation @@ -853,13 +862,13 @@ by more complex implementations to find out how to draw the part exactly. \param clip: Clip area. */ void CGUISkin::drawIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon, const core::position2di position, - u32 starttime, u32 currenttime, + u32 starttime, u32 currenttime, bool loop, const core::rect* clip) { if (!SpriteBank) return; - SpriteBank->draw2DSprite(Icons[icon], position, clip, + SpriteBank->draw2DSprite(Icons[icon], position, clip, video::SColor(255,0,0,0), starttime, currenttime, loop, true); } @@ -880,7 +889,7 @@ void CGUISkin::draw2DRectangle(IGUIElement* element, //! Writes attributes of the object. -//! Implement this to expose the attributes of your scene node animator for +//! Implement this to expose the attributes of your scene node animator for //! scripting languages, editors, debuggers or xml serialization purposes. void CGUISkin::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const { @@ -900,7 +909,7 @@ void CGUISkin::serializeAttributes(io::IAttributes* out, io::SAttributeReadWrite //! Reads attributes of the object. -//! Implement this to set the attributes of your scene node animator for +//! Implement this to set the attributes of your scene node animator for //! scripting languages, editors, debuggers or xml deserialization purposes. void CGUISkin::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) { @@ -924,3 +933,4 @@ void CGUISkin::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWrit #endif // _IRR_COMPILE_WITH_GUI_ + diff --git a/src/dep/src/irrlicht/CGUISkin.h b/src/dep/src/irrlicht/CGUISkin.h index 8ac2c20..7d7b56a 100644 --- a/src/dep/src/irrlicht/CGUISkin.h +++ b/src/dep/src/irrlicht/CGUISkin.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -58,56 +58,56 @@ namespace gui virtual u32 getIcon(EGUI_DEFAULT_ICON icon) const; //! Sets a default icon - /** Sets the sprite index used for drawing icons like arrows, - close buttons and ticks in checkboxes + /** Sets the sprite index used for drawing icons like arrows, + close buttons and ticks in checkboxes \param icon: Enum specifying which icon to change \param index: The sprite index used to draw this icon */ virtual void setIcon(EGUI_DEFAULT_ICON icon, u32 index); //! Returns a default text. /** For example for Message box button captions: - "OK", "Cancel", "Yes", "No" and so on. */ + "OK", "Cancel", "Yes", "No" and so on. */ virtual const wchar_t* getDefaultText(EGUI_DEFAULT_TEXT text) const; - //! Sets a default text. + //! Sets a default text. /** For example for Message box button captions: - "OK", "Cancel", "Yes", "No" and so on. */ + "OK", "Cancel", "Yes", "No" and so on. */ virtual void setDefaultText(EGUI_DEFAULT_TEXT which, const wchar_t* newText); //! draws a standard 3d button pane - /** Used for drawing for example buttons in normal state. + /** Used for drawing for example buttons in normal state. It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and - EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details. + EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details. \param rect: Defining area where to draw. \param clip: Clip area. \param element: Pointer to the element which wishes to draw this. This parameter - is usually not used by ISkin, but can be used for example by more complex + is usually not used by ISkin, but can be used for example by more complex implementations to find out how to draw the part exactly. */ - virtual void draw3DButtonPaneStandard(IGUIElement* element, + virtual void draw3DButtonPaneStandard(IGUIElement* element, const core::rect& rect, const core::rect* clip=0); //! draws a pressed 3d button pane - /** Used for drawing for example buttons in pressed state. + /** Used for drawing for example buttons in pressed state. It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and - EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details. + EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details. \param rect: Defining area where to draw. \param clip: Clip area. \param element: Pointer to the element which wishes to draw this. This parameter - is usually not used by ISkin, but can be used for example by more complex + is usually not used by ISkin, but can be used for example by more complex implementations to find out how to draw the part exactly. */ - virtual void draw3DButtonPanePressed(IGUIElement* element, + virtual void draw3DButtonPanePressed(IGUIElement* element, const core::rect& rect, const core::rect* clip=0); //! draws a sunken 3d pane /** Used for drawing the background of edit, combo or check boxes. \param element: Pointer to the element which wishes to draw this. This parameter - is usually not used by ISkin, but can be used for example by more complex - implementations to find out how to draw the part exactly. + is usually not used by ISkin, but can be used for example by more complex + implementations to find out how to draw the part exactly. \param bgcolor: Background color. - \param flat: Specifies if the sunken pane should be flat or displayed as sunken - deep into the ground. + \param flat: Specifies if the sunken pane should be flat or displayed as sunken + deep into the ground. \param rect: Defining area where to draw. \param clip: Clip area. */ virtual void draw3DSunkenPane(IGUIElement* element, @@ -119,8 +119,8 @@ namespace gui //! draws a window background /** Used for drawing the background of dialogs and windows. \param element: Pointer to the element which wishes to draw this. This parameter - is usually not used by ISkin, but can be used for example by more complex - implementations to find out how to draw the part exactly. + is usually not used by ISkin, but can be used for example by more complex + implementations to find out how to draw the part exactly. \param titleBarColor: Title color. \param drawTitleBar: True to enable title drawing. \param rect: Defining area where to draw. @@ -132,12 +132,12 @@ namespace gui const core::rect* clip=0); //! draws a standard 3d menu pane - /** Used for drawing for menus and context menus. + /** Used for drawing for menus and context menus. It uses the colors EGDC_3D_DARK_SHADOW, EGDC_3D_HIGH_LIGHT, EGDC_3D_SHADOW and - EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details. + EGDC_3D_FACE for this. See EGUI_DEFAULT_COLOR for details. \param element: Pointer to the element which wishes to draw this. This parameter - is usually not used by ISkin, but can be used for example by more complex - implementations to find out how to draw the part exactly. + is usually not used by ISkin, but can be used for example by more complex + implementations to find out how to draw the part exactly. \param rect: Defining area where to draw. \param clip: Clip area. */ virtual void draw3DMenuPane(IGUIElement* element, @@ -145,10 +145,10 @@ namespace gui const core::rect* clip=0); //! draws a standard 3d tool bar - /** Used for drawing for toolbars and menus. + /** Used for drawing for toolbars and menus. \param element: Pointer to the element which wishes to draw this. This parameter - is usually not used by ISkin, but can be used for example by more complex - implementations to find out how to draw the part exactly. + is usually not used by ISkin, but can be used for example by more complex + implementations to find out how to draw the part exactly. \param rect: Defining area where to draw. \param clip: Clip area. */ virtual void draw3DToolBar(IGUIElement* element, @@ -156,10 +156,10 @@ namespace gui const core::rect* clip=0); //! draws a tab button - /** Used for drawing for tab buttons on top of tabs. + /** Used for drawing for tab buttons on top of tabs. \param element: Pointer to the element which wishes to draw this. This parameter - is usually not used by ISkin, but can be used for example by more complex - implementations to find out how to draw the part exactly. + is usually not used by ISkin, but can be used for example by more complex + implementations to find out how to draw the part exactly. \param active: Specifies if the tab is currently active. \param rect: Defining area where to draw. \param clip: Clip area. */ @@ -167,9 +167,9 @@ namespace gui const core::rect& rect, const core::rect* clip=0, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT); //! draws a tab control body - /** \param element: Pointer to the element which wishes to draw this. This parameter - is usually not used by ISkin, but can be used for example by more complex - implementations to find out how to draw the part exactly. + /** \param element: Pointer to the element which wishes to draw this. This parameter + is usually not used by ISkin, but can be used for example by more complex + implementations to find out how to draw the part exactly. \param border: Specifies if the border should be drawn. \param background: Specifies if the background should be drawn. \param rect: Defining area where to draw. @@ -178,9 +178,9 @@ namespace gui const core::rect& rect, const core::rect* clip=0, s32 tabHeight=-1, EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT); //! draws an icon, usually from the skin's sprite bank - /** \param element: Pointer to the element which wishes to draw this icon. - This parameter is usually not used by IGUISkin, but can be used for example - by more complex implementations to find out how to draw the part exactly. + /** \param element: Pointer to the element which wishes to draw this icon. + This parameter is usually not used by IGUISkin, but can be used for example + by more complex implementations to find out how to draw the part exactly. \param icon: Specifies the icon to be drawn. \param position: The position to draw the icon \param starttime: The time at the start of the animation @@ -189,20 +189,20 @@ namespace gui \param clip: Clip area. */ virtual void drawIcon(IGUIElement* element, EGUI_DEFAULT_ICON icon, const core::position2di position, - u32 starttime=0, u32 currenttime=0, + u32 starttime=0, u32 currenttime=0, bool loop=false, const core::rect* clip=0); //! draws a 2d rectangle. - /** \param element: Pointer to the element which wishes to draw this icon. - This parameter is usually not used by IGUISkin, but can be used for example - by more complex implementations to find out how to draw the part exactly. - \param color: Color of the rectangle to draw. The alpha component specifies how + /** \param element: Pointer to the element which wishes to draw this icon. + This parameter is usually not used by IGUISkin, but can be used for example + by more complex implementations to find out how to draw the part exactly. + \param color: Color of the rectangle to draw. The alpha component specifies how transparent the rectangle will be. \param pos: Position of the rectangle. \param clip: Pointer to rectangle against which the rectangle will be clipped. If the pointer is null, no clipping will be performed. */ - virtual void draw2DRectangle(IGUIElement* element, const video::SColor &color, + virtual void draw2DRectangle(IGUIElement* element, const video::SColor &color, const core::rect& pos, const core::rect* clip = 0); @@ -210,12 +210,12 @@ namespace gui virtual EGUI_SKIN_TYPE getType() const; //! Writes attributes of the object. - //! Implement this to expose the attributes of your scene node animator for + //! Implement this to expose the attributes of your scene node animator for //! scripting languages, editors, debuggers or xml serialization purposes. virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const; //! Reads attributes of the object. - //! Implement this to set the attributes of your scene node animator for + //! Implement this to set the attributes of your scene node animator for //! scripting languages, editors, debuggers or xml deserialization purposes. virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0); diff --git a/src/dep/src/irrlicht/CGUISpinBox.cpp b/src/dep/src/irrlicht/CGUISpinBox.cpp index 1aeeadc..107c9c1 100644 --- a/src/dep/src/irrlicht/CGUISpinBox.cpp +++ b/src/dep/src/irrlicht/CGUISpinBox.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2006-2009 Michael Zeilfelder +// Copyright (C) 2006-2008 Michael Zeilfelder // This file uses the licence of the Irrlicht Engine. #include "CGUISpinBox.h" @@ -255,7 +255,6 @@ void CGUISpinBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWr out->addInt("DecimalPlaces", DecimalPlaces); } - //! Reads attributes of the element void CGUISpinBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) { diff --git a/src/dep/src/irrlicht/CGUISpinBox.h b/src/dep/src/irrlicht/CGUISpinBox.h index 559ff53..a16065d 100644 --- a/src/dep/src/irrlicht/CGUISpinBox.h +++ b/src/dep/src/irrlicht/CGUISpinBox.h @@ -1,4 +1,4 @@ -// Copyright (C) 2006-2009 Michael Zeilfelder +// Copyright (C) 2006-2008 Michael Zeilfelder // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CGUISpriteBank.cpp b/src/dep/src/irrlicht/CGUISpriteBank.cpp index 06ffbc5..ed75ee7 100644 --- a/src/dep/src/irrlicht/CGUISpriteBank.cpp +++ b/src/dep/src/irrlicht/CGUISpriteBank.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CGUISpriteBank.h b/src/dep/src/irrlicht/CGUISpriteBank.h index 075b472..5881e2b 100644 --- a/src/dep/src/irrlicht/CGUISpriteBank.h +++ b/src/dep/src/irrlicht/CGUISpriteBank.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -47,11 +47,12 @@ public: protected: - core::array Sprites; + core::array Sprites; core::array< core::rect > Rectangles; core::array Textures; IGUIEnvironment* Environment; video::IVideoDriver* Driver; + }; } // end namespace gui @@ -61,3 +62,4 @@ protected: #endif // __C_GUI_SPRITE_BANK_H_INCLUDED__ + diff --git a/src/dep/src/irrlicht/CGUIStaticText.cpp b/src/dep/src/irrlicht/CGUIStaticText.cpp index 6a4d624..3039fb8 100644 --- a/src/dep/src/irrlicht/CGUIStaticText.cpp +++ b/src/dep/src/irrlicht/CGUIStaticText.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -21,9 +21,9 @@ CGUIStaticText::CGUIStaticText(const wchar_t* text, bool border, IGUIEnvironment* environment, IGUIElement* parent, s32 id, const core::rect& rectangle, bool background) -: IGUIStaticText(environment, parent, id, rectangle), +: IGUIStaticText(environment, parent, id, rectangle), Border(border), HAlign(EGUIA_UPPERLEFT), VAlign(EGUIA_UPPERLEFT), - Border(border), OverrideColorEnabled(false), WordWrap(false), Background(background), + OverrideColorEnabled(false), WordWrap(false), Background(background), OverrideColor(video::SColor(101,255,255,255)), BGColor(video::SColor(101,210,210,210)), OverrideFont(0), LastBreakFont(0) { @@ -88,12 +88,12 @@ void CGUIStaticText::draw() { if (VAlign == EGUIA_LOWERRIGHT) { - frameRect.UpperLeftCorner.Y = frameRect.LowerRightCorner.Y - + frameRect.UpperLeftCorner.Y = frameRect.LowerRightCorner.Y - font->getDimension(L"A").Height - font->getKerningHeight(); } if (HAlign == EGUIA_LOWERRIGHT) { - frameRect.UpperLeftCorner.X = frameRect.LowerRightCorner.X - + frameRect.UpperLeftCorner.X = frameRect.LowerRightCorner.X - font->getDimension(Text.c_str()).Width; } @@ -122,7 +122,7 @@ void CGUIStaticText::draw() { if (HAlign == EGUIA_LOWERRIGHT) { - r.UpperLeftCorner.X = frameRect.LowerRightCorner.X - + r.UpperLeftCorner.X = frameRect.LowerRightCorner.X - font->getDimension(BrokenText[i].c_str()).Width; } @@ -349,7 +349,6 @@ void CGUIStaticText::setText(const wchar_t* text) breakText(); } - void CGUIStaticText::updateAbsolutePosition() { IGUIElement::updateAbsolutePosition(); diff --git a/src/dep/src/irrlicht/CGUIStaticText.h b/src/dep/src/irrlicht/CGUIStaticText.h index ec37fa2..9a7f4b9 100644 --- a/src/dep/src/irrlicht/CGUIStaticText.h +++ b/src/dep/src/irrlicht/CGUIStaticText.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -91,8 +91,8 @@ namespace gui //! Breaks the single text line. void breakText(); - EGUI_ALIGNMENT HAlign, VAlign; bool Border; + EGUI_ALIGNMENT HAlign, VAlign; bool OverrideColorEnabled; bool WordWrap; bool Background; diff --git a/src/dep/src/irrlicht/CGUITabControl.cpp b/src/dep/src/irrlicht/CGUITabControl.cpp index 2c6da28..488a3c9 100644 --- a/src/dep/src/irrlicht/CGUITabControl.cpp +++ b/src/dep/src/irrlicht/CGUITabControl.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -24,19 +24,20 @@ namespace gui //! constructor CGUITab::CGUITab(s32 number, IGUIEnvironment* environment, - IGUIElement* parent, const core::rect& rectangle, + IGUIElement* parent, const core::rect& rectangle, s32 id) : IGUITab(environment, parent, id, rectangle), Number(number), - BackColor(0,0,0,0), TextColor(255,0,0,0), - DrawBackground(false) + DrawBackground(false), BackColor(0,0,0,0) { #ifdef _DEBUG setDebugName("CGUITab"); #endif - const IGUISkin* const skin = environment->getSkin(); + IGUISkin* skin = environment->getSkin(); if (skin) TextColor = skin->getColor(EGDC_BUTTON_TEXT); + else + TextColor.set(255,0,0,0); } @@ -83,20 +84,17 @@ void CGUITab::setBackgroundColor(video::SColor c) BackColor = c; } - //! sets the color of the text void CGUITab::setTextColor(video::SColor c) { TextColor = c; } - video::SColor CGUITab::getTextColor() const { return TextColor; } - //! returns true if the tab is drawing its background, false if not bool CGUITab::isDrawingBackground() const { @@ -150,7 +148,7 @@ void CGUITab::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWrite //! constructor CGUITabControl::CGUITabControl(IGUIEnvironment* environment, - IGUIElement* parent, const core::rect& rectangle, + IGUIElement* parent, const core::rect& rectangle, bool fillbackground, bool border, s32 id) : IGUITabControl(environment, parent, id, rectangle), ActiveTab(-1), Border(border), FillBackground(fillbackground), ScrollControl(false), TabHeight(0), VerticalAlignment(EGUIA_UPPERLEFT), @@ -158,7 +156,7 @@ CGUITabControl::CGUITabControl(IGUIEnvironment* environment, { #ifdef _DEBUG setDebugName("CGUITabControl"); - #endif + #endif video::SColor color(255,255,255,255); IGUISkin* skin = Environment->getSkin(); @@ -197,7 +195,7 @@ CGUITabControl::CGUITabControl(IGUIEnvironment* environment, DownButton->setVisible(false); DownButton->setSubElement(true); DownButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_UPPERLEFT); - DownButton->setOverrideFont(Environment->getBuiltInFont()); + DownButton->setOverrideFont(Environment->getBuiltInFont()); DownButton->grab(); } @@ -372,7 +370,6 @@ bool CGUITabControl::OnEvent(const SEvent& event) return IGUIElement::OnEvent(event); } - void CGUITabControl::scrollLeft() { if ( CurrentScrollTabIndex > 0 ) @@ -380,7 +377,6 @@ void CGUITabControl::scrollLeft() recalculateScrollBar(); } - void CGUITabControl::scrollRight() { if ( CurrentScrollTabIndex < (s32)(Tabs.size()) - 1 ) @@ -391,7 +387,6 @@ void CGUITabControl::scrollRight() recalculateScrollBar(); } - bool CGUITabControl::needScrollControl(s32 startIndex, bool withScrollControl) { if ( startIndex >= (s32)Tabs.size() ) @@ -442,7 +437,6 @@ bool CGUITabControl::needScrollControl(s32 startIndex, bool withScrollControl) return false; } - bool CGUITabControl::selectTab(core::position2d p) { IGUISkin* skin = Environment->getSkin(); @@ -512,7 +506,7 @@ void CGUITabControl::draw() if (!font) return; - + if ( VerticalAlignment == EGUIA_UPPERLEFT ) { frameRect.UpperLeftCorner.Y += 2; @@ -573,7 +567,7 @@ void CGUITabControl::draw() // draw active tab if (left != 0 && right != 0 && activeTab != 0) - { + { // draw upper highlight frame if ( VerticalAlignment == EGUIA_UPPERLEFT ) { @@ -582,7 +576,7 @@ void CGUITabControl::draw() frameRect.UpperLeftCorner.Y -= 2; skin->draw3DTabButton(this, true, frameRect, &AbsoluteClippingRect, VerticalAlignment); - + // draw text font->draw(activeTab->getText(), frameRect, activeTab->getTextColor(), true, true, &AbsoluteClippingRect); @@ -605,7 +599,7 @@ void CGUITabControl::draw() frameRect.LowerRightCorner.Y += 2; skin->draw3DTabButton(this, true, frameRect, &AbsoluteClippingRect, VerticalAlignment); - + // draw text font->draw(activeTab->getText(), frameRect, activeTab->getTextColor(), true, true, &AbsoluteClippingRect); @@ -646,7 +640,6 @@ void CGUITabControl::draw() IGUIElement::draw(); } - //! Set the height of the tabs void CGUITabControl::setTabHeight( s32 height ) { @@ -660,14 +653,12 @@ void CGUITabControl::setTabHeight( s32 height ) recalculateScrollBar(); } - //! Get the height of the tabs s32 CGUITabControl::getTabHeight() const { return TabHeight; } - //! Set the extra width added to tabs on each side of the text void CGUITabControl::setTabExtraWidth( s32 extraWidth ) { @@ -679,20 +670,18 @@ void CGUITabControl::setTabExtraWidth( s32 extraWidth ) recalculateScrollBar(); } - //! Get the extra width added to tabs on each side of the text s32 CGUITabControl::getTabExtraWidth() const { return TabExtraWidth; } - void CGUITabControl::recalculateScrollBar() { ScrollControl = needScrollControl() || CurrentScrollTabIndex > 0; if (ScrollControl) - { + { UpButton->setVisible( true ); DownButton->setVisible( true ); } @@ -706,7 +695,6 @@ void CGUITabControl::recalculateScrollBar() this->bringToFront( DownButton ); } - //! Set the alignment of the tabs void CGUITabControl::setTabVerticalAlignment( EGUI_ALIGNMENT alignment ) { @@ -737,7 +725,7 @@ void CGUITabControl::setTabVerticalAlignment( EGUI_ALIGNMENT alignment ) UpButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT); DownButton->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT); } - + UpButton->setRelativePosition(core::rect(ButtonX, ButtonY, ButtonX+ButtonSize, ButtonY+ButtonSize)); ButtonX += ButtonSize + 1; DownButton->setRelativePosition(core::rect(ButtonX, ButtonY, ButtonX+ButtonSize, ButtonY+ButtonSize)); @@ -745,21 +733,18 @@ void CGUITabControl::setTabVerticalAlignment( EGUI_ALIGNMENT alignment ) recalculateScrollBar(); } - //! Get the alignment of the tabs EGUI_ALIGNMENT CGUITabControl::getTabVerticalAlignment() const { return VerticalAlignment; } - //! Returns which tab is currently active s32 CGUITabControl::getActiveTab() const { return ActiveTab; } - //! Brings a tab to front. bool CGUITabControl::setActiveTab(s32 idx) { @@ -781,13 +766,12 @@ bool CGUITabControl::setActiveTab(s32 idx) event.GUIEvent.Caller = this; event.GUIEvent.Element = 0; event.GUIEvent.EventType = EGET_TAB_CHANGED; - Parent->OnEvent(event); + Parent->OnEvent(event); } return true; } - bool CGUITabControl::setActiveTab(IGUIElement *tab) { for (s32 i=0; i<(s32)Tabs.size(); ++i) @@ -796,7 +780,6 @@ bool CGUITabControl::setActiveTab(IGUIElement *tab) return false; } - //! Removes a child. void CGUITabControl::removeChild(IGUIElement* child) { @@ -830,7 +813,6 @@ void CGUITabControl::removeChild(IGUIElement* child) recalculateScrollBar(); } - //! Update the position of the element, decides scroll button status void CGUITabControl::updateAbsolutePosition() { @@ -838,7 +820,6 @@ void CGUITabControl::updateAbsolutePosition() recalculateScrollBar(); } - //! Writes attributes of the element. void CGUITabControl::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const { @@ -874,3 +855,4 @@ void CGUITabControl::deserializeAttributes(io::IAttributes* in, io::SAttributeRe #endif // _IRR_COMPILE_WITH_GUI_ + diff --git a/src/dep/src/irrlicht/CGUITabControl.h b/src/dep/src/irrlicht/CGUITabControl.h index 83a7b64..5a5d6be 100644 --- a/src/dep/src/irrlicht/CGUITabControl.h +++ b/src/dep/src/irrlicht/CGUITabControl.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -47,7 +47,7 @@ namespace gui //! sets the color of the background, if it should be drawn. virtual void setBackgroundColor(video::SColor c); - + //! sets the color of the text virtual void setTextColor(video::SColor c); @@ -69,12 +69,14 @@ namespace gui private: s32 Number; + bool DrawBackground; video::SColor BackColor; video::SColor TextColor; - bool DrawBackground; + }; + //! A standard tab control class CGUITabControl : public IGUITabControl { diff --git a/src/dep/src/irrlicht/CGUITable.cpp b/src/dep/src/irrlicht/CGUITable.cpp new file mode 100644 index 0000000..2feb874 --- /dev/null +++ b/src/dep/src/irrlicht/CGUITable.cpp @@ -0,0 +1,1207 @@ +// Copyright (C) 2002-2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +// 07.10.2005 - Multicolor-Listbox added by A. Buschhueter (Acki) +// A_Buschhueter@gmx.de + +#include "CGUITable.h" +#ifdef _IRR_COMPILE_WITH_GUI_ + +#include "IGUISkin.h" +#include "IGUIEnvironment.h" +#include "IVideoDriver.h" +#include "IGUIFont.h" +#include "CGUIScrollBar.h" +#include "os.h" + +#define ARROW_PAD 15 + +namespace irr +{ +namespace gui +{ + +//! constructor +CGUITable::CGUITable(IGUIEnvironment* environment, IGUIElement* parent, + s32 id, core::rect rectangle, bool clip, + bool drawBack, bool moveOverSelect) +: IGUITable(environment, parent, id, rectangle), Font(0), + VerticalScrollBar(0), HorizontalScrollBar(0), + Clip(clip), DrawBack(drawBack), MoveOverSelect(moveOverSelect), + Selecting(false), CurrentResizedColumn(-1), ResizeStart(0), ResizableColumns(true), + ItemHeight(0), TotalItemHeight(0), TotalItemWidth(0), Selected(-1), + CellHeightPadding(2), CellWidthPadding(5), ActiveTab(-1), + CurrentOrdering(EGOM_NONE), DrawFlags(EGTDF_ROWS | EGTDF_COLUMNS | EGTDF_ACTIVE_ROW ) +{ + #ifdef _DEBUG + setDebugName("CGUITable"); + #endif + + VerticalScrollBar = Environment->addScrollBar(false, core::rect(0, 0, 100, 100), this, -1); + if (VerticalScrollBar) + { + VerticalScrollBar->grab(); + VerticalScrollBar->setNotClipped(false); + VerticalScrollBar->setSubElement(true); + } + + HorizontalScrollBar = Environment->addScrollBar(true, core::rect(0, 0, 100, 100), this, -1); + if ( HorizontalScrollBar ) + { + HorizontalScrollBar->grab(); + HorizontalScrollBar->setNotClipped(false); + HorizontalScrollBar->setSubElement(true); + } + + refreshControls(); +} + + +//! destructor +CGUITable::~CGUITable() +{ + if (VerticalScrollBar) + VerticalScrollBar->drop(); + if ( HorizontalScrollBar ) + HorizontalScrollBar->drop(); + + if (Font) + Font->drop(); +} + + +void CGUITable::addColumn(const wchar_t* caption, s32 columnIndex) +{ + Column tabHeader; + tabHeader.Name = caption; + tabHeader.Width = Font->getDimension(caption).Width + (CellWidthPadding * 2) + ARROW_PAD; + tabHeader.OrderingMode = EGCO_NONE; + + IGUISkin* skin = Environment->getSkin(); + if (skin) + { + tabHeader.TextColor = skin->getColor(EGDC_BUTTON_TEXT); + } + + if ( columnIndex < 0 || columnIndex >= (s32)Columns.size() ) + { + Columns.push_back(tabHeader); + for ( u32 i=0; i < Rows.size(); ++i ) + { + Cell cell; + Rows[i].Items.push_back(cell); + } + } + else + { + Columns.insert(tabHeader, columnIndex); + for ( u32 i=0; i < Rows.size(); ++i ) + { + Cell cell; + Rows[i].Items.insert(cell, columnIndex); + } + } + + if (ActiveTab == -1) + ActiveTab = 0; + + recalculateWidths(); +} + +//! remove a column from the table +void CGUITable::removeColumn(u32 columnIndex) +{ + if ( columnIndex < Columns.size() ) + { + Columns.erase(columnIndex); + for ( u32 i=0; i < Rows.size(); ++i ) + { + Rows[i].Items.erase(columnIndex); + } + } + if ( (s32)columnIndex <= ActiveTab ) + ActiveTab = Columns.size() ? 0 : -1; + + recalculateWidths(); +} + +s32 CGUITable::getColumnCount() const +{ + return Columns.size(); +} + +s32 CGUITable::getRowCount() const +{ + return Rows.size(); +} + +bool CGUITable::setActiveColumn(s32 idx, bool doOrder ) +{ + if (idx < 0 || idx >= (s32)Columns.size()) + return false; + + bool changed = (ActiveTab != idx); + + ActiveTab = idx; + if ( ActiveTab < 0 ) + return false; + + if ( doOrder ) + { + switch ( Columns[idx].OrderingMode ) + { + case EGCO_NONE: + CurrentOrdering = EGOM_NONE; + break; + + case EGCO_CUSTOM: + CurrentOrdering = EGOM_NONE; + if (Parent) + { + SEvent event; + event.EventType = EET_GUI_EVENT; + event.GUIEvent.Caller = this; + event.GUIEvent.EventType = EGET_TABLE_HEADER_CHANGED; + Parent->OnEvent(event); + } + + break; + + case EGCO_ASCENDING: + CurrentOrdering = EGOM_ASCENDING; + break; + + case EGCO_DESCENDING: + CurrentOrdering = EGOM_DESCENDING; + break; + + case EGCO_FLIP_ASCENDING_DESCENDING: + CurrentOrdering = EGOM_ASCENDING == CurrentOrdering ? EGOM_DESCENDING : EGOM_ASCENDING; + break; + default: + CurrentOrdering = EGOM_NONE; + } + + orderRows(getActiveColumn(), CurrentOrdering); + } + + if (changed) + { + SEvent event; + event.EventType = EET_GUI_EVENT; + event.GUIEvent.Caller = this; + event.GUIEvent.EventType = EGET_TABLE_HEADER_CHANGED; + Parent->OnEvent(event); + } + + return true; +} + +s32 CGUITable::getActiveColumn() const +{ + return ActiveTab; +} + +EGUI_ORDERING_MODE CGUITable::getActiveColumnOrdering() const +{ + return CurrentOrdering; +} + +void CGUITable::setColumnWidth(u32 columnIndex, u32 width) +{ + if ( columnIndex < Columns.size() ) + { + const u32 MIN_WIDTH = Font->getDimension(Columns[columnIndex].Name.c_str() ).Width + (CellWidthPadding * 2); + if ( width < MIN_WIDTH ) + width = MIN_WIDTH; + + Columns[columnIndex].Width = width; + + for ( u32 i=0; i < Rows.size(); ++i ) + { + breakText( Rows[i].Items[columnIndex].Text, Rows[i].Items[columnIndex].BrokenText, Columns[columnIndex].Width ); + } + } + recalculateWidths(); +} + + +void CGUITable::setResizableColumns(bool resizable) +{ + ResizableColumns = resizable; +} + + +bool CGUITable::hasResizableColumns() const +{ + return ResizableColumns; +} + + +void CGUITable::addRow(u32 rowIndex) +{ + if ( rowIndex > Rows.size() ) + return; + + Row row; + + if ( rowIndex == Rows.size() ) + Rows.push_back(row); + else + Rows.insert(row, rowIndex); + + for ( u32 i = 0 ; i < Columns.size() ; ++i ) + { + Cell cell; + Rows[rowIndex].Items.push_back(cell); + } + + recalculateHeights(); +} + +void CGUITable::removeRow(u32 rowIndex) +{ + if ( rowIndex > Rows.size() ) + return; + + Rows.erase( rowIndex ); + + if ( !(Selected < s32(Rows.size())) ) + Selected = Rows.size() - 1; + + recalculateHeights(); +} + +//! adds an list item, returns id of item +void CGUITable::setCellText(u32 rowIndex, u32 columnIndex, const wchar_t* text) +{ + if ( rowIndex < Rows.size() && columnIndex < Columns.size() ) + { + Rows[rowIndex].Items[columnIndex].Text = text; + breakText( Rows[rowIndex].Items[columnIndex].Text, Rows[rowIndex].Items[columnIndex].BrokenText, Columns[columnIndex].Width ); + + IGUISkin* skin = Environment->getSkin(); + if ( skin ) + Rows[rowIndex].Items[columnIndex].Color = skin->getColor(EGDC_BUTTON_TEXT); + } +} + +void CGUITable::setCellText(u32 rowIndex, u32 columnIndex, const wchar_t* text, video::SColor color) +{ + if ( rowIndex < Rows.size() && columnIndex < Columns.size() ) + { + Rows[rowIndex].Items[columnIndex].Text = text; + breakText( Rows[rowIndex].Items[columnIndex].Text, Rows[rowIndex].Items[columnIndex].BrokenText, Columns[columnIndex].Width ); + Rows[rowIndex].Items[columnIndex].Color = color; + } +} + +void CGUITable::setCellColor(u32 rowIndex, u32 columnIndex, video::SColor color) +{ + if ( rowIndex < Rows.size() && columnIndex < Columns.size() ) + { + Rows[rowIndex].Items[columnIndex].Color = color; + } +} + +void CGUITable::setCellData(u32 rowIndex, u32 columnIndex, void *data) +{ + if ( rowIndex < Rows.size() && columnIndex < Columns.size() ) + { + Rows[rowIndex].Items[columnIndex].Data = data; + } +} + +const wchar_t* CGUITable::getCellText(u32 rowIndex, u32 columnIndex ) const +{ + if ( rowIndex < Rows.size() && columnIndex < Columns.size() ) + { + return Rows[rowIndex].Items[columnIndex].Text.c_str(); + } + + return 0; +} + +void* CGUITable::getCellData(u32 rowIndex, u32 columnIndex ) const +{ + if ( rowIndex < Rows.size() && columnIndex < Columns.size() ) + { + return Rows[rowIndex].Items[columnIndex].Data; + } + + return 0; +} + +//! clears the list +void CGUITable::clear() +{ + Rows.clear(); + Columns.clear(); + + if (VerticalScrollBar) + VerticalScrollBar->setPos(0); + if ( HorizontalScrollBar ) + HorizontalScrollBar->setPos(0); + + recalculateHeights(); + recalculateWidths(); +} + +void CGUITable::clearRows() +{ + Rows.clear(); + + if (VerticalScrollBar) + VerticalScrollBar->setPos(0); + + recalculateHeights(); +} + +s32 CGUITable::getSelected() const +{ + return Selected; +} + +void CGUITable::recalculateWidths() +{ + TotalItemWidth=0; + for ( u32 i=0; i < Columns.size(); ++i ) + { + TotalItemWidth += Columns[i].Width; + } + checkScrollbars(); +} + +void CGUITable::recalculateHeights() +{ + TotalItemHeight = 0; + IGUISkin* skin = Environment->getSkin(); + if (Font != skin->getFont()) + { + if (Font) + Font->drop(); + + Font = skin->getFont(); + + ItemHeight = 0; + + if(Font) + { + ItemHeight = Font->getDimension(L"A").Height + (CellHeightPadding * 2); + Font->grab(); + } + } + TotalItemHeight = ItemHeight * Rows.size(); // header is not counted, because we only want items + checkScrollbars(); +} + +// automatic enabled/disabling and resizing of scrollbars +void CGUITable::checkScrollbars() +{ + IGUISkin* skin = Environment->getSkin(); + if ( !HorizontalScrollBar || !VerticalScrollBar || !skin) + return; + + s32 scrollBarSize = skin->getSize(EGDS_SCROLLBAR_SIZE); + bool wasHorizontalScrollBarVisible = HorizontalScrollBar->isVisible(); + bool wasVerticalScrollBarVisible = VerticalScrollBar->isVisible(); + HorizontalScrollBar->setVisible(false); + VerticalScrollBar->setVisible(false); + + // CAREFUL: near identical calculations for tableRect and clientClip are also done in draw + // area of table used for drawing without scrollbars + core::rect tableRect(AbsoluteRect); + tableRect.UpperLeftCorner.X += 1; + tableRect.UpperLeftCorner.Y += 1; + s32 headerBottom = tableRect.UpperLeftCorner.Y + ItemHeight; + + // area of for the items (without header and without scrollbars) + core::rect clientClip(tableRect); + clientClip.UpperLeftCorner.Y = headerBottom + 1; + + // needs horizontal scroll be visible? + if( TotalItemWidth > clientClip.getWidth() ) + { + clientClip.LowerRightCorner.Y -= scrollBarSize; + HorizontalScrollBar->setVisible(true); + HorizontalScrollBar->setMax(TotalItemWidth - clientClip.getWidth()); + } + + // needs vertical scroll be visible? + if( TotalItemHeight > clientClip.getHeight() ) + { + clientClip.LowerRightCorner.X -= scrollBarSize; + VerticalScrollBar->setVisible(true); + VerticalScrollBar->setMax(TotalItemHeight - clientClip.getHeight()); + + // check horizontal again because we have now smaller clientClip + if ( !HorizontalScrollBar->isVisible() ) + { + if( TotalItemWidth > clientClip.getWidth() ) + { + clientClip.LowerRightCorner.Y -= scrollBarSize; + HorizontalScrollBar->setVisible(true); + HorizontalScrollBar->setMax(TotalItemWidth - clientClip.getWidth()); + } + } + } + + // find the correct size for the vertical scrollbar + if ( VerticalScrollBar->isVisible() ) + { + if (!wasVerticalScrollBarVisible ) + VerticalScrollBar->setPos(0); + + if ( HorizontalScrollBar->isVisible() ) + { + VerticalScrollBar->setRelativePosition( + core::rect(RelativeRect.getWidth() - scrollBarSize, 1, + RelativeRect.getWidth()-1, RelativeRect.getHeight()-(1+scrollBarSize) ) ); + } + else + { + VerticalScrollBar->setRelativePosition( + core::rect(RelativeRect.getWidth() - scrollBarSize, 1, + RelativeRect.getWidth()-1, RelativeRect.getHeight()-1) ); + } + } + + // find the correct size for the horizontal scrollbar + if ( HorizontalScrollBar->isVisible() ) + { + if ( !wasHorizontalScrollBarVisible ) + HorizontalScrollBar->setPos(0); + + if ( VerticalScrollBar->isVisible() ) + { + HorizontalScrollBar->setRelativePosition( core::rect(1, RelativeRect.getHeight() - scrollBarSize, RelativeRect.getWidth()-(1+scrollBarSize), RelativeRect.getHeight()-1) ); + } + else + { + HorizontalScrollBar->setRelativePosition( core::rect(1, RelativeRect.getHeight() - scrollBarSize, RelativeRect.getWidth()-1, RelativeRect.getHeight()-1) ); + } + } +} + +void CGUITable::refreshControls() +{ + updateAbsolutePosition(); + + if ( VerticalScrollBar ) + VerticalScrollBar->setVisible(false); + + if ( HorizontalScrollBar ) + HorizontalScrollBar->setVisible(false); + + recalculateHeights(); + recalculateWidths(); +} + + +//! called if an event happened. +bool CGUITable::OnEvent(const SEvent &event) +{ + if (IsEnabled) + { + + switch(event.EventType) + { + case EET_GUI_EVENT: + switch(event.GUIEvent.EventType) + { + case gui::EGET_SCROLL_BAR_CHANGED: + if (event.GUIEvent.Caller == VerticalScrollBar) + { + // current position will get read out in draw + return true; + } + if (event.GUIEvent.Caller == HorizontalScrollBar) + { + // current position will get read out in draw + return true; + } + break; + case gui::EGET_ELEMENT_FOCUS_LOST: + { + CurrentResizedColumn = -1; + Selecting = false; + } + break; + default: + break; + } + break; + case EET_MOUSE_INPUT_EVENT: + { + if ( !IsEnabled ) + return false; + + core::position2d p(event.MouseInput.X, event.MouseInput.Y); + + switch(event.MouseInput.Event) + { + case EMIE_MOUSE_WHEEL: + VerticalScrollBar->setPos(VerticalScrollBar->getPos() + (s32)event.MouseInput.Wheel*-10); + return true; + + case EMIE_LMOUSE_PRESSED_DOWN: + + if (Environment->hasFocus(this) && + VerticalScrollBar->isVisible() && + VerticalScrollBar->getAbsolutePosition().isPointInside(p) && + VerticalScrollBar->OnEvent(event)) + return true; + + if (Environment->hasFocus(this) && + HorizontalScrollBar->isVisible() && + HorizontalScrollBar->getAbsolutePosition().isPointInside(p) && + HorizontalScrollBar->OnEvent(event)) + return true; + + if ( dragColumnStart( event.MouseInput.X, event.MouseInput.Y ) ) + { + Environment->setFocus(this); + return true; + } + + if ( selectColumnHeader( event.MouseInput.X, event.MouseInput.Y ) ) + return true; + + Selecting = true; + Environment->setFocus(this); + return true; + + case EMIE_LMOUSE_LEFT_UP: + + CurrentResizedColumn = -1; + Selecting = false; + if (!getAbsolutePosition().isPointInside(p)) + { + Environment->removeFocus(this); + } + + if (Environment->hasFocus(this) && + VerticalScrollBar->isVisible() && + VerticalScrollBar->getAbsolutePosition().isPointInside(p) && + VerticalScrollBar->OnEvent(event)) + { + return true; + } + + if (Environment->hasFocus(this) && + HorizontalScrollBar->isVisible() && + HorizontalScrollBar->getAbsolutePosition().isPointInside(p) && + HorizontalScrollBar->OnEvent(event)) + { + return true; + } + + selectNew(event.MouseInput.Y); + return true; + + case EMIE_MOUSE_MOVED: + if ( CurrentResizedColumn >= 0 ) + { + if ( dragColumnUpdate(event.MouseInput.X) ) + { + return true; + } + } + if (Selecting || MoveOverSelect) + { + if (getAbsolutePosition().isPointInside(p)) + { + selectNew(event.MouseInput.Y); + return true; + } + } + break; + default: + break; + } + } + break; + default: + break; + } + } + + return IGUIElement::OnEvent(event); +} + + +void CGUITable::setColumnOrdering(u32 columnIndex, EGUI_COLUMN_ORDERING mode) +{ + if ( columnIndex < Columns.size() ) + Columns[columnIndex].OrderingMode = mode; +} + + +void CGUITable::swapRows(u32 rowIndexA, u32 rowIndexB) +{ + if ( rowIndexA >= Rows.size() ) + return; + + if ( rowIndexB >= Rows.size() ) + return; + + Row swap = Rows[rowIndexA]; + Rows[rowIndexA] = Rows[rowIndexB]; + Rows[rowIndexB] = swap; + + if ( Selected == s32(rowIndexA) ) + Selected = rowIndexB; + else if( Selected == s32(rowIndexB) ) + Selected = rowIndexA; + +} + +bool CGUITable::dragColumnStart(s32 xpos, s32 ypos) +{ + if ( !ResizableColumns ) + return false; + + if ( ypos > ( AbsoluteRect.UpperLeftCorner.Y + ItemHeight ) ) + return false; + + const s32 CLICK_AREA = 3; // to left and right of line which can be dragged + s32 pos = AbsoluteRect.UpperLeftCorner.X+1; + + if ( HorizontalScrollBar && HorizontalScrollBar->isVisible() ) + pos -= HorizontalScrollBar->getPos(); + + pos += TotalItemWidth; + + // have to search from the right as otherwise lines could no longer be resized when a column width is 0 + for ( s32 i = (s32)Columns.size()-1; i >= 0 ; --i ) + { + u32 colWidth = Columns[i].Width; + + if ( xpos >= (pos - CLICK_AREA) && xpos < ( pos + CLICK_AREA ) ) + { + CurrentResizedColumn = i; + ResizeStart = xpos; + return true; + } + + pos -= colWidth; + } + + return false; +} + +bool CGUITable::dragColumnUpdate(s32 xpos) +{ + if ( !ResizableColumns || CurrentResizedColumn < 0 || CurrentResizedColumn >= s32(Columns.size()) ) + { + CurrentResizedColumn = -1; + return false; + } + + s32 width = s32(Columns[CurrentResizedColumn].Width) + (xpos-ResizeStart); + if ( width < 0 ) + width = 0; + setColumnWidth(CurrentResizedColumn, u32(width)); + ResizeStart = xpos; + + return false; +} + +bool CGUITable::selectColumnHeader(s32 xpos, s32 ypos) +{ + if ( ypos > ( AbsoluteRect.UpperLeftCorner.Y + ItemHeight ) ) + return false; + + s32 pos = AbsoluteRect.UpperLeftCorner.X+1; + + if ( HorizontalScrollBar && HorizontalScrollBar->isVisible() ) + pos -= HorizontalScrollBar->getPos(); + + for ( u32 i = 0 ; i < Columns.size() ; ++i ) + { + u32 colWidth = Columns[i].Width; + + if ( xpos >= pos && xpos < ( pos + s32(colWidth) ) ) + { + setActiveColumn( i, true ); + + return true; + } + + pos += colWidth; + } + + return false; +} + +void CGUITable::orderRows(s32 columnIndex, EGUI_ORDERING_MODE mode) +{ + Row swap; + + if ( columnIndex == -1 ) + columnIndex = getActiveColumn(); + if ( columnIndex < 0 ) + return; + + if ( mode == EGOM_ASCENDING ) + { + for ( s32 i = 0 ; i < s32(Rows.size()) - 1 ; ++i ) + { + for ( s32 j = 0 ; j < s32(Rows.size()) - i - 1 ; ++j ) + { + if ( Rows[j+1].Items[columnIndex].Text < Rows[j].Items[columnIndex].Text ) + { + swap = Rows[j]; + Rows[j] = Rows[j+1]; + Rows[j+1] = swap; + + if ( Selected == j ) + Selected = j+1; + else if( Selected == j+1 ) + Selected = j; + } + } + } + } + else if ( mode == EGOM_DESCENDING ) + { + for ( s32 i = 0 ; i < s32(Rows.size()) - 1 ; ++i ) + { + for ( s32 j = 0 ; j < s32(Rows.size()) - i - 1 ; ++j ) + { + if ( Rows[j].Items[columnIndex].Text < Rows[j+1].Items[columnIndex].Text) + { + swap = Rows[j]; + Rows[j] = Rows[j+1]; + Rows[j+1] = swap; + + if ( Selected == j ) + Selected = j+1; + else if( Selected == j+1 ) + Selected = j; + } + } + } + } +} + + +void CGUITable::selectNew(s32 ypos, bool onlyHover) +{ + IGUISkin* skin = Environment->getSkin(); + if (!skin) + return; + + s32 oldSelected = Selected; + + if ( ypos < ( AbsoluteRect.UpperLeftCorner.Y + ItemHeight ) ) + return; + + // find new selected item. + if (ItemHeight!=0) + Selected = ((ypos - AbsoluteRect.UpperLeftCorner.Y - ItemHeight - 1) + VerticalScrollBar->getPos()) / ItemHeight; + + if (Selected >= (s32)Rows.size()) + Selected = Rows.size() - 1; + else if (Selected<0) + Selected = 0; + + // post the news + if (Parent && !onlyHover) + { + SEvent event; + event.EventType = EET_GUI_EVENT; + event.GUIEvent.Caller = this; + event.GUIEvent.EventType = (Selected != oldSelected) ? EGET_TABLE_CHANGED : EGET_TABLE_SELECTED_AGAIN; + Parent->OnEvent(event); + } +} + + +//! draws the element and its children +void CGUITable::draw() +{ + if (!IsVisible) + return; + + irr::video::IVideoDriver* driver = Environment->getVideoDriver(); + + IGUISkin* skin = Environment->getSkin(); + if (!skin) + return; + + IGUIFont* font = skin->getFont(); + if (!font) + return; + + // CAREFUL: near identical calculations for tableRect and clientClip are also done in checkScrollbars and selectColumnHeader + // Area of table used for drawing without scrollbars + core::rect tableRect(AbsoluteRect); + tableRect.UpperLeftCorner.X += 1; + tableRect.UpperLeftCorner.Y += 1; + if ( VerticalScrollBar && VerticalScrollBar->isVisible() ) + tableRect.LowerRightCorner.X -= skin->getSize(EGDS_SCROLLBAR_SIZE); + if ( HorizontalScrollBar && HorizontalScrollBar->isVisible() ) + tableRect.LowerRightCorner.Y -= skin->getSize(EGDS_SCROLLBAR_SIZE); + + s32 headerBottom = tableRect.UpperLeftCorner.Y + ItemHeight; + + // area of for the items (without header and without scrollbars) + core::rect clientClip(tableRect); + clientClip.UpperLeftCorner.Y = headerBottom + 1; + + core::rect* clipRect = 0; + if (Clip) + clipRect = &AbsoluteClippingRect; + + // draw background for whole element + skin->draw3DSunkenPane(this, skin->getColor(EGDC_3D_HIGH_LIGHT), true, DrawBack, AbsoluteRect, clipRect); + + // scrolledTableClient is the area where the table items would be if it could be drawn completely + core::rect scrolledTableClient(tableRect); + scrolledTableClient.UpperLeftCorner.Y = headerBottom + 1; + scrolledTableClient.LowerRightCorner.Y = scrolledTableClient.UpperLeftCorner.Y + TotalItemHeight; + scrolledTableClient.LowerRightCorner.X = scrolledTableClient.UpperLeftCorner.X + TotalItemWidth; + if ( VerticalScrollBar && VerticalScrollBar->isVisible() ) + { + scrolledTableClient.UpperLeftCorner.Y -= VerticalScrollBar->getPos(); + scrolledTableClient.LowerRightCorner.Y -= VerticalScrollBar->getPos(); + } + if ( HorizontalScrollBar && HorizontalScrollBar->isVisible() ) + { + scrolledTableClient.UpperLeftCorner.X -= HorizontalScrollBar->getPos(); + scrolledTableClient.LowerRightCorner.X -= HorizontalScrollBar->getPos(); + } + + // rowRect is around the scrolled row + core::rect rowRect(scrolledTableClient); + rowRect.LowerRightCorner.Y = rowRect.UpperLeftCorner.Y + ItemHeight; + + u32 pos; + for ( u32 i = 0 ; i < Rows.size() ; ++i ) + { + if (rowRect.LowerRightCorner.Y >= AbsoluteRect.UpperLeftCorner.Y && + rowRect.UpperLeftCorner.Y <= AbsoluteRect.LowerRightCorner.Y) + { + // draw row seperator + if ( DrawFlags & EGTDF_ROWS ) + { + core::rect lineRect(rowRect); + lineRect.UpperLeftCorner.Y = lineRect.LowerRightCorner.Y - 1; + driver->draw2DRectangle(skin->getColor(EGDC_3D_SHADOW), lineRect, &clientClip); + } + + core::rect textRect(rowRect); + pos = rowRect.UpperLeftCorner.X; + + // draw selected row background highlighted + if ((s32)i == Selected && DrawFlags & EGTDF_ACTIVE_ROW ) + driver->draw2DRectangle(skin->getColor(EGDC_HIGH_LIGHT), rowRect, &clientClip); + + for ( u32 j = 0 ; j < Columns.size() ; ++j ) + { + textRect.UpperLeftCorner.X = pos + CellWidthPadding; + textRect.LowerRightCorner.X = pos + Columns[j].Width - CellWidthPadding; + + // draw item text + if ((s32)i == Selected) + { + font->draw(Rows[i].Items[j].BrokenText.c_str(), textRect, skin->getColor(IsEnabled ? EGDC_HIGH_LIGHT_TEXT : EGDC_GRAY_TEXT), false, true, &clientClip); + } + else + { + font->draw(Rows[i].Items[j].BrokenText.c_str(), textRect, IsEnabled ? Rows[i].Items[j].Color : skin->getColor(EGDC_GRAY_TEXT), false, true, &clientClip); + } + + pos += Columns[j].Width; + } + } + + rowRect.UpperLeftCorner.Y += ItemHeight; + rowRect.LowerRightCorner.Y += ItemHeight; + } + + core::rect columnSeparator(clientClip); + pos = scrolledTableClient.UpperLeftCorner.X; + + for (u32 i = 0 ; i < Columns.size() ; ++i ) + { + const wchar_t* text = Columns[i].Name.c_str(); + u32 colWidth = Columns[i].Width; + + //core::dimension2d dim = font->getDimension(text); + + core::rect columnrect(pos, tableRect.UpperLeftCorner.Y, pos + colWidth, headerBottom); + + // draw column background + skin->draw3DButtonPaneStandard(this, columnrect, &tableRect); + + // draw column seperator + if ( DrawFlags & EGTDF_COLUMNS ) + { + columnSeparator.UpperLeftCorner.X = pos; + columnSeparator.LowerRightCorner.X = pos + 1; + driver->draw2DRectangle(skin->getColor(EGDC_3D_SHADOW), columnSeparator, &tableRect); + } + + // draw header column text + columnrect.UpperLeftCorner.X += CellWidthPadding; + font->draw(text, columnrect, skin->getColor( IsEnabled ? EGDC_BUTTON_TEXT : EGDC_GRAY_TEXT), false, true, &tableRect); + + // draw icon for active column tab + if ( (s32)i == ActiveTab ) + { + if ( CurrentOrdering == EGOM_ASCENDING ) + { + columnrect.UpperLeftCorner.X = columnrect.LowerRightCorner.X - CellWidthPadding - ARROW_PAD / 2 + 2; + columnrect.UpperLeftCorner.Y += 7; + skin->drawIcon(this,EGDI_CURSOR_UP,columnrect.UpperLeftCorner,0,0,false,&tableRect); + } + else + { + columnrect.UpperLeftCorner.X = columnrect.LowerRightCorner.X - CellWidthPadding - ARROW_PAD / 2 + 2; + columnrect.UpperLeftCorner.Y += 7; + skin->drawIcon(this,EGDI_CURSOR_DOWN,columnrect.UpperLeftCorner,0,0,false,&tableRect); + } + } + + pos += colWidth; + } + + // fill up header background up to the right side + core::rect columnrect(pos, tableRect.UpperLeftCorner.Y, tableRect.LowerRightCorner.X , headerBottom); + skin->draw3DButtonPaneStandard(this, columnrect, &tableRect); + + IGUIElement::draw(); +} + + +void CGUITable::breakText(const core::stringw& text, core::stringw& brokenText, u32 cellWidth) +{ + IGUISkin* skin = Environment->getSkin(); + + if (!skin) + return; + + if (!Font) + return; + + IGUIFont* font = skin->getFont(); + if (!font) + return; + + core::stringw line, lineDots; + wchar_t c[2]; + c[1] = L'\0'; + + const u32 maxLength = cellWidth - (CellWidthPadding * 2); + const s32 maxLengthDots = cellWidth - (CellWidthPadding * 2) - font->getDimension(L"...").Width; + const u32 size = text.size(); + u32 pos = 0; + + u32 i; + + for (i=0; igetDimension(c).Width; + if ( pos > maxLength ) + break; + + if ( font->getDimension( (line + c).c_str() ).Width > maxLengthDots ) + lineDots = line; + + line += c[0]; + } + + if ( i < size ) + brokenText = lineDots + L"..."; + else + brokenText = line; +} + + +//! Set some flags influencing the layout of the table +void CGUITable::setDrawFlags(s32 flags) +{ + DrawFlags = flags; +} + + +//! Get the flags which influence the layout of the table +s32 CGUITable::getDrawFlags() const +{ + return DrawFlags; +} + + +//! Writes attributes of the element. +void CGUITable::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const +{ + IGUITable::serializeAttributes(out, options); + + out->addInt("ColumnCount", Columns.size()); + u32 i; + for (i=0;iaddString(label.c_str(), Columns[i].Name.c_str() ); + label = "Column"; label += i; label += "color"; + out->addColor(label.c_str(), Columns[i].TextColor ); + label = "Column"; label += i; label += "width"; + out->addInt(label.c_str(), Columns[i].Width ); + label = "Column"; label += i; label += "OrderingMode"; + out->addEnum(label.c_str(), Columns[i].OrderingMode, GUIColumnOrderingNames); + } + + out->addInt("RowCount", Rows.size()); + for (i=0;iaddInt(label.c_str(), Rows[i].Height ); + + //label = "Row"; label += i; label += "ItemCount"; + //out->addInt(label.c_str(), Rows[i].Items.size()); + u32 c; + for ( c=0; c < Rows[i].Items.size(); ++c ) + { + label = "Row"; label += i; label += "cell"; label += c; label += "text"; + out->addString(label.c_str(), Rows[i].Items[c].Text.c_str() ); + // core::stringw BrokenText; // can be recalculated + label = "Row"; label += i; label += "cell"; label += c; label += "color"; + out->addColor(label.c_str(), Rows[i].Items[c].Color ); + // void *data; // can't be serialized + } + } + + // s32 ItemHeight; // can be calculated + // TotalItemHeight // calculated + // TotalItemWidth // calculated + // gui::IGUIFont* Font; // font is just the current font from environment + // gui::IGUIScrollBar* VerticalScrollBar; // not serialized + // gui::IGUIScrollBar* HorizontalScrollBar; // not serialized + + out->addBool ("Clip", Clip); + out->addBool ("DrawBack", DrawBack); + out->addBool ("MoveOverSelect", MoveOverSelect); + + // s32 CurrentResizedColumn; // runtime info - depends on user action + out->addBool ("ResizableColumns", ResizableColumns); + + // s32 Selected; // runtime info - depends on user action + out->addInt("CellWidthPadding", CellWidthPadding ); + out->addInt("CellHeightPadding", CellHeightPadding ); + // s32 ActiveTab; // runtime info - depends on user action + // bool Selecting; // runtime info - depends on user action + out->addEnum("CurrentOrdering", CurrentOrdering, GUIOrderingModeNames); + out->addInt("DrawFlags", DrawFlags); +} + + +//! Reads attributes of the element +void CGUITable::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) +{ + IGUITable::deserializeAttributes(in, options); + + Columns.clear(); + u32 columnCount = in->getAttributeAsInt("ColumnCount"); + u32 i; + for (i=0;igetAttributeAsString(label.c_str()).c_str()); + label = "Column"; label += i; label += "color"; + column.TextColor = in->getAttributeAsColor(label.c_str()); + label = "Column"; label += i; label += "width"; + column.Width = in->getAttributeAsInt(label.c_str()); + label = "Column"; label += i; label += "OrderingMode"; + + column.OrderingMode = EGCO_NONE; + s32 co = in->getAttributeAsEnumeration(label.c_str(), GUIColumnOrderingNames); + if (co > 0) + column.OrderingMode = EGUI_COLUMN_ORDERING(co); + + Columns.push_back(column); + } + + Rows.clear(); + u32 rowCount = in->getAttributeAsInt("RowCount"); + for (i=0; igetAttributeAsInt(label.c_str() ); + + Rows.push_back(row); + + //label = "Row"; label += i; label += "ItemCount"; + //u32 itemCount = in->getAttributeAsInt(label.c_str()); + u32 c; + for ( c=0; c < columnCount; ++c ) + { + Cell cell; + + label = "Row"; label += i; label += "cell"; label += c; label += "text"; + cell.Text = core::stringw(in->getAttributeAsString(label.c_str()).c_str()); + breakText( cell.Text, cell.BrokenText, Columns[c].Width ); + label = "Row"; label += i; label += "cell"; label += c; label += "color"; + cell.Color = in->getAttributeAsColor(label.c_str()); + cell.Data = NULL; + + Rows[Rows.size()-1].Items.push_back(cell); + } + } + + ItemHeight = 0; // calculated + TotalItemHeight = 0; // calculated + TotalItemWidth = 0; // calculated + + // force font recalculation + if ( Font ) + { + Font->drop(); + Font = 0; + } + + Clip = in->getAttributeAsBool("Clip"); + DrawBack = in->getAttributeAsBool("DrawBack"); + MoveOverSelect = in->getAttributeAsBool("MoveOverSelect"); + + CurrentResizedColumn = -1; + ResizeStart = 0; + ResizableColumns = in->getAttributeAsBool("ResizableColumns"); + + Selected = -1; + CellWidthPadding = in->getAttributeAsInt("CellWidthPadding"); + CellHeightPadding = in->getAttributeAsInt("CellHeightPadding"); + ActiveTab = -1; + Selecting = false; + + CurrentOrdering = (EGUI_ORDERING_MODE) in->getAttributeAsEnumeration("CurrentOrdering", GUIOrderingModeNames); + DrawFlags = in->getAttributeAsInt("DrawFlags"); + + refreshControls(); +} + +} // end namespace gui +} // end namespace irr + +#endif + diff --git a/src/dep/src/irrlicht/CGUITable.h b/src/dep/src/irrlicht/CGUITable.h new file mode 100644 index 0000000..4f02be0 --- /dev/null +++ b/src/dep/src/irrlicht/CGUITable.h @@ -0,0 +1,218 @@ +// Copyright (C) 2002-2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +// 07.10.2005 - Multicolor-Listbox addet by A. Buschhueter (Acki) +// A_Buschhueter@gmx.de + +#ifndef __C_GUI_TABLE_BAR_H_INCLUDED__ +#define __C_GUI_TABLE_BAR_H_INCLUDED__ + +#include "IrrCompileConfig.h" +#ifdef _IRR_COMPILE_WITH_GUI_ + +#include "IGUITable.h" +#include "irrArray.h" + +namespace irr +{ +namespace gui +{ + + class IGUIFont; + class IGUIScrollBar; + + class CGUITable : public IGUITable + { + public: + //! constructor + CGUITable(IGUIEnvironment* environment, IGUIElement* parent, + s32 id, core::rect rectangle, bool clip=true, + bool drawBack=false, bool moveOverSelect=true); + + //! destructor + ~CGUITable(); + + //! Adds a column + //! If columnIndex is outside the current range, do push new colum at the end + virtual void addColumn(const wchar_t* caption, s32 columnIndex=-1); + + //! remove a column from the table + virtual void removeColumn(u32 columnIndex); + + //! Returns the number of columns in the table control + virtual s32 getColumnCount() const; + + //! Makes a column active. This will trigger an ordering process. + /** \param idx: The id of the column to make active. + \return Returns true if successful. */ + virtual bool setActiveColumn(s32 columnIndex, bool doOrder=false); + + //! Returns which header is currently active + virtual s32 getActiveColumn() const; + + //! Returns the ordering used by the currently active column + virtual EGUI_ORDERING_MODE getActiveColumnOrdering() const; + + //! set a column width + virtual void setColumnWidth(u32 columnIndex, u32 width); + + //! columns can be resized by drag 'n drop + virtual void setResizableColumns(bool resizable); + + //! can columns be resized by dran 'n drop? + virtual bool hasResizableColumns() const; + + //! This tells the table control which ordering mode should be used when + //! a column header is clicked. + /** \param columnIndex: The index of the column header. + \param state: If true, a EGET_TABLE_HEADER_CHANGED message will be sent and you can order the table data as you whish.*/ + //! \param mode: One of the modes defined in EGUI_COLUMN_ORDERING + virtual void setColumnOrdering(u32 columnIndex, EGUI_COLUMN_ORDERING mode); + + //! Returns which row is currently selected + virtual s32 getSelected() const; + + //! Returns amount of rows in the tabcontrol + virtual s32 getRowCount() const; + + //! adds a row to the table + /** \param rowIndex: zero based index of rows. The row will be + inserted at this position. If a row already exists + there, it will be placed after it. If the row is larger + than the actual number of rows by more than one, it + won't be created. Note that if you create a row that is + not at the end, there might be performance issues*/ + virtual void addRow(u32 rowIndex); + + //! Remove a row from the table + virtual void removeRow(u32 rowIndex); + + //! clear the table rows, but keep the columns intact + virtual void clearRows(); + + //! Swap two row positions. This is useful for a custom ordering algo. + virtual void swapRows(u32 rowIndexA, u32 rowIndexB); + + //! This tells the table to start ordering all the rows. You + //! need to explicitly tell the table to reorder the rows when + //! a new row is added or the cells data is changed. This makes + //! the system more flexible and doesn't make you pay the cost + //! of ordering when adding a lot of rows. + //! \param columnIndex: When set to -1 the active column is used. + virtual void orderRows(s32 columnIndex=-1, EGUI_ORDERING_MODE mode=EGOM_NONE); + + + //! Set the text of a cell + virtual void setCellText(u32 rowIndex, u32 columnIndex, const wchar_t* text); + + //! Set the text of a cell, and set a color of this cell. + virtual void setCellText(u32 rowIndex, u32 columnIndex, const wchar_t* text, video::SColor color); + + //! Set the data of a cell + //! data will not be serialized. + virtual void setCellData(u32 rowIndex, u32 columnIndex, void *data); + + //! Set the color of a cell text + virtual void setCellColor(u32 rowIndex, u32 columnIndex, video::SColor color); + + //! Get the text of a cell + virtual const wchar_t* getCellText(u32 rowIndex, u32 columnIndex ) const; + + //! Get the data of a cell + virtual void* getCellData(u32 rowIndex, u32 columnIndex ) const; + + //! clears the table, deletes all items in the table + virtual void clear(); + + //! called if an event happened. + virtual bool OnEvent(const SEvent &event); + + //! draws the element and its children + virtual void draw(); + + //! Set flags, as defined in EGUI_TABLE_DRAW_FLAGS, which influence the layout + virtual void setDrawFlags(s32 flags); + + //! Get the flags, as defined in EGUI_TABLE_DRAW_FLAGS, which influence the layout + virtual s32 getDrawFlags() const; + + //! Writes attributes of the object. + //! Implement this to expose the attributes of your scene node animator for + //! scripting languages, editors, debuggers or xml serialization purposes. + virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const; + + //! Reads attributes of the object. + //! Implement this to set the attributes of your scene node animator for + //! scripting languages, editors, debuggers or xml deserialization purposes. + virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0); + + protected: + virtual void refreshControls(); + virtual void checkScrollbars(); + + private: + + struct Cell + { + Cell() : Data(0) {} + core::stringw Text; + core::stringw BrokenText; + video::SColor Color; + void *Data; + }; + + struct Row + { + Row() {} + core::array Items; + }; + + struct Column + { + Column() : Width(0), OrderingMode(EGCO_NONE) {} + core::stringw Name; + video::SColor TextColor; + u32 Width; + EGUI_COLUMN_ORDERING OrderingMode; + }; + + void breakText(const core::stringw &text, core::stringw & brokenText, u32 cellWidth); + void selectNew(s32 ypos, bool onlyHover=false); + bool selectColumnHeader(s32 xpos, s32 ypos); + bool dragColumnStart(s32 xpos, s32 ypos); + bool dragColumnUpdate(s32 xpos); + void recalculateHeights(); + void recalculateWidths(); + + core::array< Column > Columns; + core::array< Row > Rows; + gui::IGUIFont* Font; + gui::IGUIScrollBar* VerticalScrollBar; + gui::IGUIScrollBar* HorizontalScrollBar; + bool Clip; + bool DrawBack; + bool MoveOverSelect; + bool Selecting; + s32 CurrentResizedColumn; + s32 ResizeStart; + bool ResizableColumns; + + s32 ItemHeight; + s32 TotalItemHeight; + s32 TotalItemWidth; + s32 Selected; + s32 CellHeightPadding; + s32 CellWidthPadding; + s32 ActiveTab; + EGUI_ORDERING_MODE CurrentOrdering; + s32 DrawFlags; + }; + +} // end namespace gui +} // end namespace irr + +#endif // _IRR_COMPILE_WITH_GUI_ + +#endif + diff --git a/src/dep/src/irrlicht/CGUIToolBar.cpp b/src/dep/src/irrlicht/CGUIToolBar.cpp index e2d06f3..f57c1fd 100644 --- a/src/dep/src/irrlicht/CGUIToolBar.cpp +++ b/src/dep/src/irrlicht/CGUIToolBar.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -69,7 +69,7 @@ bool CGUIToolBar::OnEvent(const SEvent& event) { if (IsEnabled) { - if (event.EventType == EET_MOUSE_INPUT_EVENT && + if (event.EventType == EET_MOUSE_INPUT_EVENT && event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN) { if (AbsoluteClippingRect.isPointInside(core::position2di(event.MouseInput.X, event.MouseInput.Y))) @@ -116,7 +116,7 @@ void CGUIToolBar::updateAbsolutePosition() //! Adds a button to the tool bar IGUIButton* CGUIToolBar::addButton(s32 id, const wchar_t* text,const wchar_t* tooltiptext, - video::ITexture* img, video::ITexture* pressed, bool isPushButton, + video::ITexture* img, video::ITexture* pressed, bool isPushButton, bool useAlphaChannel) { ButtonX += 3; @@ -151,10 +151,10 @@ IGUIButton* CGUIToolBar::addButton(s32 id, const wchar_t* text,const wchar_t* to if (useAlphaChannel) button->setUseAlphaChannel(useAlphaChannel); - + return button; } - + } // end namespace gui } // end namespace irr diff --git a/src/dep/src/irrlicht/CGUIToolBar.h b/src/dep/src/irrlicht/CGUIToolBar.h index 3f6eaf9..0bacb18 100644 --- a/src/dep/src/irrlicht/CGUIToolBar.h +++ b/src/dep/src/irrlicht/CGUIToolBar.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CGUIWindow.cpp b/src/dep/src/irrlicht/CGUIWindow.cpp index ae6a610..8210462 100644 --- a/src/dep/src/irrlicht/CGUIWindow.cpp +++ b/src/dep/src/irrlicht/CGUIWindow.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -31,7 +31,7 @@ CGUIWindow::CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id IGUISpriteBank* sprites = 0; video::SColor color(255,255,255,255); - + s32 buttonw = 15; if (skin) { @@ -41,7 +41,7 @@ CGUIWindow::CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id } s32 posx = RelativeRect.getWidth() - buttonw - 4; - CloseButton = Environment->addButton(core::rect(posx, 3, posx + buttonw, 3 + buttonw), this, -1, + CloseButton = Environment->addButton(core::rect(posx, 3, posx + buttonw, 3 + buttonw), this, -1, L"", skin ? skin->getDefaultText(EGDT_WINDOW_CLOSE) : L"Close" ); CloseButton->setSubElement(true); CloseButton->setTabStop(false); @@ -54,7 +54,7 @@ CGUIWindow::CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id } posx -= buttonw + 2; - RestoreButton = Environment->addButton(core::rect(posx, 3, posx + buttonw, 3 + buttonw), this, -1, + RestoreButton = Environment->addButton(core::rect(posx, 3, posx + buttonw, 3 + buttonw), this, -1, L"", skin ? skin->getDefaultText(EGDT_WINDOW_RESTORE) : L"Restore" ); RestoreButton->setVisible(false); RestoreButton->setSubElement(true); @@ -68,7 +68,7 @@ CGUIWindow::CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id } posx -= buttonw + 2; - MinButton = Environment->addButton(core::rect(posx, 3, posx + buttonw, 3 + buttonw), this, -1, + MinButton = Environment->addButton(core::rect(posx, 3, posx + buttonw, 3 + buttonw), this, -1, L"", skin ? skin->getDefaultText(EGDT_WINDOW_MINIMIZE) : L"Minimize" ); MinButton->setVisible(false); MinButton->setSubElement(true); @@ -171,12 +171,14 @@ bool CGUIWindow::OnEvent(const SEvent& event) if (Dragging) { // gui window should not be dragged outside its parent - if (Parent && - (event.MouseInput.X < Parent->getAbsolutePosition().UpperLeftCorner.X +1 || + if (Parent) + if (event.MouseInput.X < Parent->getAbsolutePosition().UpperLeftCorner.X +1 || event.MouseInput.Y < Parent->getAbsolutePosition().UpperLeftCorner.Y +1 || event.MouseInput.X > Parent->getAbsolutePosition().LowerRightCorner.X -1 || - event.MouseInput.Y > Parent->getAbsolutePosition().LowerRightCorner.Y -1)) - return true; + event.MouseInput.Y > Parent->getAbsolutePosition().LowerRightCorner.Y -1) + + return true; + move(core::position2d(event.MouseInput.X - DragStart.X, event.MouseInput.Y - DragStart.Y)); DragStart.X = event.MouseInput.X; diff --git a/src/dep/src/irrlicht/CGUIWindow.h b/src/dep/src/irrlicht/CGUIWindow.h index 10cdb52..2573d68 100644 --- a/src/dep/src/irrlicht/CGUIWindow.h +++ b/src/dep/src/irrlicht/CGUIWindow.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -46,12 +46,12 @@ namespace gui protected: + core::position2d DragStart; + bool Dragging; + IGUIButton* CloseButton; IGUIButton* MinButton; IGUIButton* RestoreButton; - - core::position2d DragStart; - bool Dragging; }; } // end namespace gui @@ -59,5 +59,5 @@ namespace gui #endif // _IRR_COMPILE_WITH_GUI_ -#endif +#endif diff --git a/src/dep/src/irrlicht/CGeometryCreator.cpp b/src/dep/src/irrlicht/CGeometryCreator.cpp index ef009ed..ccb1982 100644 --- a/src/dep/src/irrlicht/CGeometryCreator.cpp +++ b/src/dep/src/irrlicht/CGeometryCreator.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CGeometryCreator.h b/src/dep/src/irrlicht/CGeometryCreator.h index fdad142..babe2c2 100644 --- a/src/dep/src/irrlicht/CGeometryCreator.h +++ b/src/dep/src/irrlicht/CGeometryCreator.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImage.cpp b/src/dep/src/irrlicht/CImage.cpp index 916bf4b..13233e5 100644 --- a/src/dep/src/irrlicht/CImage.cpp +++ b/src/dep/src/irrlicht/CImage.cpp @@ -1,1487 +1,1485 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#include "CImage.h" -#include "irrString.h" -#include "SoftwareDriver2_helper.h" -#include "CColorConverter.h" - -namespace irr -{ - - struct SBlitJob - { - AbsRectangle Dest; - AbsRectangle Source; - - u32 argb; - - void * src; - void * dst; - - s32 width; - s32 height; - - u32 srcPitch; - u32 dstPitch; - - u32 srcPixelMul; - u32 dstPixelMul; - }; - - // Blitter Operation - enum eBlitter - { - BLITTER_INVALID = 0, - BLITTER_COLOR, - BLITTER_COLOR_ALPHA, - BLITTER_TEXTURE, - BLITTER_TEXTURE_ALPHA_BLEND, - BLITTER_TEXTURE_ALPHA_COLOR_BLEND - }; - - typedef void (*tExecuteBlit) ( const SBlitJob * job ); - - - // Bitfields Cohen Sutherland - enum eClipCode - { - CLIPCODE_EMPTY = 0, - CLIPCODE_BOTTOM = 1, - CLIPCODE_TOP = 2, - CLIPCODE_LEFT = 4, - CLIPCODE_RIGHT = 8 - }; - -inline u32 GetClipCode( const AbsRectangle &r, const core::position2d &p ) -{ - u32 code = CLIPCODE_EMPTY; - - if ( p.X < r.x0 ) - code = CLIPCODE_LEFT; - else - if ( p.X > r.x1 ) - code = CLIPCODE_RIGHT; - - if ( p.Y < r.y0 ) - code |= CLIPCODE_TOP; - else - if ( p.Y > r.y1 ) - code |= CLIPCODE_BOTTOM; - - return code; -} - - -/*! - Cohen Sutherland clipping - @return: 1 if valid -*/ - -static int ClipLine(const AbsRectangle &clipping, - core::position2d &p0, - core::position2d &p1, - const core::position2d& p0_in, - const core::position2d& p1_in) -{ - u32 code0; - u32 code1; - u32 code; - - p0 = p0_in; - p1 = p1_in; - - code0 = GetClipCode( clipping, p0 ); - code1 = GetClipCode( clipping, p1 ); - - // trivial accepted - while ( code0 | code1 ) - { - s32 x=0; - s32 y=0; - - // trivial reject - if ( code0 & code1 ) - return 0; - - if ( code0 ) - { - // clip first point - code = code0; - } - else - { - // clip last point - code = code1; - } - - if ( (code & CLIPCODE_BOTTOM) == CLIPCODE_BOTTOM ) - { - // clip bottom viewport - y = clipping.y1; - x = p0.X + ( p1.X - p0.X ) * ( y - p0.Y ) / ( p1.Y - p0.Y ); - } - else - if ( (code & CLIPCODE_TOP) == CLIPCODE_TOP ) - { - // clip to viewport - y = clipping.y0; - x = p0.X + ( p1.X - p0.X ) * ( y - p0.Y ) / ( p1.Y - p0.Y ); - } - else - if ( (code & CLIPCODE_RIGHT) == CLIPCODE_RIGHT ) - { - // clip right viewport - x = clipping.x1; - y = p0.Y + ( p1.Y - p0.Y ) * ( x - p0.X ) / ( p1.X - p0.X ); - } - else - if ( (code & CLIPCODE_LEFT) == CLIPCODE_LEFT ) - { - // clip left viewport - x = clipping.x0; - y = p0.Y + ( p1.Y - p0.Y ) * ( x - p0.X ) / ( p1.X - p0.X ); - } - - if ( code == code0 ) - { - // modify first point - p0.X = x; - p0.Y = y; - code0 = GetClipCode( clipping, p0 ); - } - else - { - // modify second point - p1.X = x; - p1.Y = y; - code1 = GetClipCode( clipping, p1 ); - } - } - - return 1; -} - -/* -*/ -inline void GetClip(AbsRectangle &clipping, video::IImage * t) -{ - clipping.x0 = 0; - clipping.y0 = 0; - clipping.x1 = t->getDimension().Width - 1; - clipping.y1 = t->getDimension().Height - 1; -} - -/* -*/ -static void RenderLine32_Decal(video::IImage *t, - const core::position2d &p0, - const core::position2d &p1, - u32 argb ) -{ - s32 dx = p1.X - p0.X; - s32 dy = p1.Y - p0.Y; - - s32 c; - s32 m; - s32 d = 0; - s32 run; - - s32 xInc = 4; - s32 yInc = (s32) t->getPitch(); - - if ( dx < 0 ) - { - xInc = -xInc; - dx = -dx; - } - - if ( dy < 0 ) - { - yInc = -yInc; - dy = -dy; - } - - u32 *dst; - dst = (u32*) ( (u8*) t->lock() + ( p0.Y * t->getPitch() ) + ( p0.X << 2 ) ); - - if ( dy > dx ) - { - s32 tmp; - tmp = dx; - dx = dy; - dy = tmp; - tmp = xInc; - xInc = yInc; - yInc = tmp; - } - - c = dx << 1; - m = dy << 1; - - run = dx; - while ( run ) - { - *dst = argb; - - dst = (u32*) ( (u8*) dst + xInc ); // x += xInc - d += m; - if ( d > dx ) - { - dst = (u32*) ( (u8*) dst + yInc ); // y += yInc - d -= c; - } - run -= 1; - } - - t->unlock(); -} - - -/* -*/ -static void RenderLine32_Blend(video::IImage *t, - const core::position2d &p0, - const core::position2d &p1, - u32 argb, u32 alpha) -{ - s32 dx = p1.X - p0.X; - s32 dy = p1.Y - p0.Y; - - s32 c; - s32 m; - s32 d = 0; - s32 run; - - s32 xInc = 4; - s32 yInc = (s32) t->getPitch(); - - if ( dx < 0 ) - { - xInc = -xInc; - dx = -dx; - } - - if ( dy < 0 ) - { - yInc = -yInc; - dy = -dy; - } - - u32 *dst; - dst = (u32*) ( (u8*) t->lock() + ( p0.Y * t->getPitch() ) + ( p0.X << 2 ) ); - - if ( dy > dx ) - { - s32 tmp; - tmp = dx; - dx = dy; - dy = tmp; - tmp = xInc; - xInc = yInc; - yInc = tmp; - } - - c = dx << 1; - m = dy << 1; - - run = dx; - while ( run ) - { - *dst = PixelBlend32( *dst, argb, alpha ); - - dst = (u32*) ( (u8*) dst + xInc ); // x += xInc - d += m; - if ( d > dx ) - { - dst = (u32*) ( (u8*) dst + yInc ); // y += yInc - d -= c; - } - run -= 1; - } - - t->unlock(); -} - -/* -*/ -static void RenderLine16_Decal(video::IImage *t, - const core::position2d &p0, - const core::position2d &p1, - u32 argb ) -{ - s32 dx = p1.X - p0.X; - s32 dy = p1.Y - p0.Y; - - s32 c; - s32 m; - s32 d = 0; - s32 run; - - s32 xInc = 2; - s32 yInc = (s32) t->getPitch(); - - if ( dx < 0 ) - { - xInc = -xInc; - dx = -dx; - } - - if ( dy < 0 ) - { - yInc = -yInc; - dy = -dy; - } - - u16 *dst; - dst = (u16*) ( (u8*) t->lock() + ( p0.Y * t->getPitch() ) + ( p0.X << 1 ) ); - - if ( dy > dx ) - { - s32 tmp; - tmp = dx; - dx = dy; - dy = tmp; - tmp = xInc; - xInc = yInc; - yInc = tmp; - } - - c = dx << 1; - m = dy << 1; - - run = dx; - while ( run ) - { - *dst = (u16)argb; - - dst = (u16*) ( (u8*) dst + xInc ); // x += xInc - d += m; - if ( d > dx ) - { - dst = (u16*) ( (u8*) dst + yInc ); // y += yInc - d -= c; - } - run -= 1; - } - - t->unlock(); -} - -/* -*/ -static void RenderLine16_Blend(video::IImage *t, - const core::position2d &p0, - const core::position2d &p1, - u32 argb, - u32 alpha) -{ - s32 dx = p1.X - p0.X; - s32 dy = p1.Y - p0.Y; - - s32 c; - s32 m; - s32 d = 0; - s32 run; - - s32 xInc = 2; - s32 yInc = (s32) t->getPitch(); - - if ( dx < 0 ) - { - xInc = -xInc; - dx = -dx; - } - - if ( dy < 0 ) - { - yInc = -yInc; - dy = -dy; - } - - u16 *dst; - dst = (u16*) ( (u8*) t->lock() + ( p0.Y * t->getPitch() ) + ( p0.X << 1 ) ); - - if ( dy > dx ) - { - s32 tmp; - tmp = dx; - dx = dy; - dy = tmp; - tmp = xInc; - xInc = yInc; - yInc = tmp; - } - - c = dx << 1; - m = dy << 1; - - run = dx; - while ( run ) - { - *dst = PixelBlend16( *dst, argb, alpha ); - - dst = (u16*) ( (u8*) dst + xInc ); // x += xInc - d += m; - if ( d > dx ) - { - dst = (u16*) ( (u8*) dst + yInc ); // y += yInc - d -= c; - } - run -= 1; - } - - t->unlock(); -} - - -/*! -*/ -static void executeBlit_TextureCopy_x_to_x( const SBlitJob * job ) -{ - const void *src = (void*) job->src; - void *dst = (void*) job->dst; - - const u32 widthPitch = job->width * job->dstPixelMul; - for ( s32 dy = 0; dy != job->height; ++dy ) - { - memcpy( dst, src, widthPitch ); - - src = (void*) ( (u8*) (src) + job->srcPitch ); - dst = (void*) ( (u8*) (dst) + job->dstPitch ); - } -} - - -/*! -*/ -static void executeBlit_TextureCopy_32_to_16( const SBlitJob * job ) -{ - const u32 *src = static_cast(job->src); - u16 *dst = static_cast(job->dst); - - for ( s32 dy = 0; dy != job->height; ++dy ) - { - for ( s32 dx = 0; dx != job->width; ++dx ) - { - //16 bit Blitter depends on pre-multiplied color - const u32 s = PixelLerp32( src[dx] | 0xFF000000, extractAlpha( src[dx] ) ); - dst[dx] = video::A8R8G8B8toA1R5G5B5( s ); - } - - src = (u32*) ( (u8*) (src) + job->srcPitch ); - dst = (u16*) ( (u8*) (dst) + job->dstPitch ); - } -} - -/*! -*/ -static void executeBlit_TextureCopy_24_to_16( const SBlitJob * job ) -{ - const void *src = (void*) job->src; - u16 *dst = (u16*) job->dst; - - for ( s32 dy = 0; dy != job->height; ++dy ) - { - u8 * s = (u8*) src; - - for ( s32 dx = 0; dx != job->width; ++dx ) - { - dst[dx] = video::RGB16(s[0], s[1], s[2]); - s += 3; - } - - src = (void*) ( (u8*) (src) + job->srcPitch ); - dst = (u16*) ( (u8*) (dst) + job->dstPitch ); - } -} - - -/*! -*/ -static void executeBlit_TextureCopy_16_to_32( const SBlitJob * job ) -{ - const u16 *src = (u16*) job->src; - u32 *dst = (u32*) job->dst; - - for ( s32 dy = 0; dy != job->height; ++dy ) - { - for ( s32 dx = 0; dx != job->width; ++dx ) - { - dst[dx] = video::A1R5G5B5toA8R8G8B8( src[dx] ); - } - - src = (u16*) ( (u8*) (src) + job->srcPitch ); - dst = (u32*) ( (u8*) (dst) + job->dstPitch ); - } -} - -static void executeBlit_TextureCopy_16_to_24( const SBlitJob * job ) -{ - const u16 *src = (u16*) job->src; - u8 *dst = (u8*) job->dst; - - for ( s32 dy = 0; dy != job->height; ++dy ) - { - for ( s32 dx = 0; dx != job->width; ++dx ) - { - u32 colour = video::A1R5G5B5toA8R8G8B8( src[dx] ); - u8 * writeTo = &dst[dx * 3]; - *writeTo++ = (colour >> 16)& 0xFF; - *writeTo++ = (colour >> 8) & 0xFF; - *writeTo++ = colour & 0xFF; - } - - src = (u16*) ( (u8*) (src) + job->srcPitch ); - dst += job->dstPitch; - } -} - - -/*! -*/ -static void executeBlit_TextureCopy_24_to_32( const SBlitJob * job ) -{ - void *src = (void*) job->src; - u32 *dst = (u32*) job->dst; - - for ( s32 dy = 0; dy != job->height; ++dy ) - { - u8 * s = (u8*) src; - - for ( s32 dx = 0; dx != job->width; ++dx ) - { - dst[dx] = 0xFF000000 | s[0] << 16 | s[1] << 8 | s[2]; - s += 3; - } - - src = (void*) ( (u8*) (src) + job->srcPitch ); - dst = (u32*) ( (u8*) (dst) + job->dstPitch ); - } -} - -static void executeBlit_TextureCopy_32_to_24( const SBlitJob * job ) -{ - const u32 * src = (u32*) job->src; - u8 * dst = (u8*) job->dst; - - for ( s32 dy = 0; dy != job->height; ++dy ) - { - for ( s32 dx = 0; dx != job->width; ++dx ) - { - u8 * writeTo = &dst[dx * 3]; - *writeTo++ = (src[dx] >> 16)& 0xFF; - *writeTo++ = (src[dx] >> 8) & 0xFF; - *writeTo++ = src[dx] & 0xFF; - } - - src = (u32*) ( (u8*) (src) + job->srcPitch ); - dst += job->dstPitch ; - } - -} - - -/*! -*/ -static void executeBlit_TextureBlend_16_to_16( const SBlitJob * job ) -{ - u32 dx; - s32 dy; - - u32 *src = (u32*) job->src; - u32 *dst = (u32*) job->dst; - - - const u32 rdx = job->width >> 1; - const u32 off = core::if_c_a_else_b( job->width & 1 ,job->width - 1, 0 ); - - - if ( 0 == off ) - { - for ( dy = 0; dy != job->height; ++dy ) - { - for ( dx = 0; dx != rdx; ++dx ) - { - dst[dx] = PixelBlend16_simd( dst[dx], src[dx] ); - } - - src = (u32*) ( (u8*) (src) + job->srcPitch ); - dst = (u32*) ( (u8*) (dst) + job->dstPitch ); - } - - } - else - { - for ( dy = 0; dy != job->height; ++dy ) - { - for ( dx = 0; dx != rdx; ++dx ) - { - dst[dx] = PixelBlend16_simd( dst[dx], src[dx] ); - } - - ((u16*) dst)[off] = PixelBlend16( ((u16*) dst)[off], ((u16*) src)[off] ); - - src = (u32*) ( (u8*) (src) + job->srcPitch ); - dst = (u32*) ( (u8*) (dst) + job->dstPitch ); - } - - } -} - -/*! -*/ -static void executeBlit_TextureBlend_32_to_32( const SBlitJob * job ) -{ - u32 *src = (u32*) job->src; - u32 *dst = (u32*) job->dst; - - for ( s32 dy = 0; dy != job->height; ++dy ) - { - for ( s32 dx = 0; dx != job->width; ++dx ) - { - dst[dx] = PixelBlend32( dst[dx], src[dx] ); - } - src = (u32*) ( (u8*) (src) + job->srcPitch ); - dst = (u32*) ( (u8*) (dst) + job->dstPitch ); - } -} - -/*! -*/ -static void executeBlit_TextureBlendColor_16_to_16( const SBlitJob * job ) -{ - u16 *src = (u16*) job->src; - u16 *dst = (u16*) job->dst; - - u16 blend = video::A8R8G8B8toA1R5G5B5 ( job->argb ); - for ( s32 dy = 0; dy != job->height; ++dy ) - { - for ( s32 dx = 0; dx != job->width; ++dx ) - { - dst[dx] = PixelBlend16( dst[dx], PixelMul16_2( src[dx], blend ) ); - } - src = (u16*) ( (u8*) (src) + job->srcPitch ); - dst = (u16*) ( (u8*) (dst) + job->dstPitch ); - } -} - - -/*! -*/ -static void executeBlit_TextureBlendColor_32_to_32( const SBlitJob * job ) -{ - u32 *src = (u32*) job->src; - u32 *dst = (u32*) job->dst; - - for ( s32 dy = 0; dy != job->height; ++dy ) - { - for ( s32 dx = 0; dx != job->width; ++dx ) - { - dst[dx] = PixelBlend32( dst[dx], PixelMul32_2( src[dx], job->argb ) ); - } - src = (u32*) ( (u8*) (src) + job->srcPitch ); - dst = (u32*) ( (u8*) (dst) + job->dstPitch ); - } -} - -/*! -*/ -static void executeBlit_Color_16_to_16( const SBlitJob * job ) -{ - u16 *dst = (u16*) job->dst; - - u16 c0 = video::A8R8G8B8toA1R5G5B5( job->argb ); - u32 c = c0 | c0 << 16; - - if ( 0 == (job->srcPitch & 3 ) ) - { - for ( s32 dy = 0; dy != job->height; ++dy ) - { - memset32( dst, c, job->srcPitch ); - dst = (u16*) ( (u8*) (dst) + job->dstPitch ); - } - } - else - { - s32 dx = job->width - 1; - - for ( s32 dy = 0; dy != job->height; ++dy ) - { - memset32( dst, c, job->srcPitch ); - dst[dx] = c0; - dst = (u16*) ( (u8*) (dst) + job->dstPitch ); - } - - } -} - -/*! -*/ -static void executeBlit_Color_32_to_32( const SBlitJob * job ) -{ - u32 *dst = (u32*) job->dst; - - for ( s32 dy = 0; dy != job->height; ++dy ) - { - memset32( dst, job->argb, job->srcPitch ); - dst = (u32*) ( (u8*) (dst) + job->dstPitch ); - } -} - -/*! -*/ -static void executeBlit_ColorAlpha_16_to_16( const SBlitJob * job ) -{ - u16 *dst = (u16*) job->dst; - - const u32 alpha = extractAlpha( job->argb ) >> 3; - const u32 src = video::A8R8G8B8toA1R5G5B5( job->argb ); - - for ( s32 dy = 0; dy != job->height; ++dy ) - { - for ( s32 dx = 0; dx != job->width; ++dx ) - { - dst[dx] = PixelBlend16( dst[dx], src, alpha ); - } - dst = (u16*) ( (u8*) (dst) + job->dstPitch ); - } -} - -/*! -*/ -static void executeBlit_ColorAlpha_32_to_32( const SBlitJob * job ) -{ - u32 *dst = (u32*) job->dst; - - const u32 alpha = extractAlpha( job->argb ); - const u32 src = job->argb; - - for ( s32 dy = 0; dy != job->height; ++dy ) - { - for ( s32 dx = 0; dx != job->width; ++dx ) - { - dst[dx] = PixelBlend32( dst[dx], src, alpha ); - } - dst = (u32*) ( (u8*) (dst) + job->dstPitch ); - } -} - -/*! -*/ -static tExecuteBlit getBlitter( eBlitter operation,const video::IImage * dest,const video::IImage * source ) -{ - video::ECOLOR_FORMAT sourceFormat = (video::ECOLOR_FORMAT) -1; - video::ECOLOR_FORMAT destFormat = (video::ECOLOR_FORMAT) -1; - - if ( source ) - sourceFormat = source->getColorFormat(); - - if ( dest ) - destFormat = dest->getColorFormat(); - - switch ( operation ) - { - case BLITTER_TEXTURE: - { - if ( sourceFormat == destFormat ) - return executeBlit_TextureCopy_x_to_x; - - if ( destFormat == video::ECF_A1R5G5B5 && sourceFormat == video::ECF_A8R8G8B8 ) - return executeBlit_TextureCopy_32_to_16; - - if ( destFormat == video::ECF_A1R5G5B5 && sourceFormat == video::ECF_R8G8B8 ) - return executeBlit_TextureCopy_24_to_16; - - if ( destFormat == video::ECF_A8R8G8B8 && sourceFormat == video::ECF_A1R5G5B5 ) - return executeBlit_TextureCopy_16_to_32; - - if ( destFormat == video::ECF_R8G8B8 && sourceFormat == video::ECF_A1R5G5B5 ) - return executeBlit_TextureCopy_16_to_24; - - if ( destFormat == video::ECF_A8R8G8B8 && sourceFormat == video::ECF_R8G8B8 ) - return executeBlit_TextureCopy_24_to_32; - - if ( destFormat == video::ECF_R8G8B8 && sourceFormat == video::ECF_A8R8G8B8 ) - return executeBlit_TextureCopy_32_to_24; - - } break; - - case BLITTER_TEXTURE_ALPHA_BLEND: - { - if ( destFormat == video::ECF_A1R5G5B5 && sourceFormat == video::ECF_A1R5G5B5 ) - return executeBlit_TextureBlend_16_to_16; - - if ( destFormat == video::ECF_A8R8G8B8 && sourceFormat == video::ECF_A8R8G8B8 ) - return executeBlit_TextureBlend_32_to_32; - - } break; - - case BLITTER_TEXTURE_ALPHA_COLOR_BLEND: - { - if ( destFormat == video::ECF_A1R5G5B5 && sourceFormat == video::ECF_A1R5G5B5 ) - return executeBlit_TextureBlendColor_16_to_16; - - if ( destFormat == video::ECF_A8R8G8B8 && sourceFormat == video::ECF_A8R8G8B8 ) - return executeBlit_TextureBlendColor_32_to_32; - } break; - - case BLITTER_COLOR: - { - if ( destFormat == video::ECF_A1R5G5B5 ) - return executeBlit_Color_16_to_16; - - if ( destFormat == video::ECF_A8R8G8B8 ) - return executeBlit_Color_32_to_32; - } break; - - case BLITTER_COLOR_ALPHA: - { - if ( destFormat == video::ECF_A1R5G5B5 ) - return executeBlit_ColorAlpha_16_to_16; - - if ( destFormat == video::ECF_A8R8G8B8 ) - return executeBlit_ColorAlpha_32_to_32; - - } break; - - case BLITTER_INVALID: - break; - } -/* - char buf[64]; - sprintf( buf, "Blit: %d %d->%d unsupported",operation,sourceFormat,destFormat ); - os::Printer::log(buf ); -*/ - return 0; - -} - - - -/*! - a generic 2D Blitter -*/ -static s32 Blit(eBlitter operation, - video::IImage * dest, - const core::rect *destClipping, - const core::position2d *destPos, - video::IImage * const source, - const core::rect *sourceClipping, - u32 argb) -{ - tExecuteBlit blitter = getBlitter( operation, dest, source ); - if ( 0 == blitter ) - { - return 0; - } - - // Clipping - AbsRectangle sourceClip; - AbsRectangle destClip; - AbsRectangle v; - - SBlitJob job; - - if ( sourceClipping ) - { - sourceClip.x0 = sourceClipping->UpperLeftCorner.X; - sourceClip.y0 = sourceClipping->UpperLeftCorner.Y; - sourceClip.x1 = sourceClipping->LowerRightCorner.X; - sourceClip.y1 = sourceClipping->LowerRightCorner.Y; - } - else - { - sourceClip.x0 = 0; - sourceClip.y0 = 0; - sourceClip.x1 = source ? source->getDimension().Width : 0; - sourceClip.y1 = source ? source->getDimension().Height : 0; - } - - if ( destClipping ) - { - destClip.x0 = destClipping->UpperLeftCorner.X; - destClip.y0 = destClipping->UpperLeftCorner.Y; - destClip.x1 = destClipping->LowerRightCorner.X; - destClip.y1 = destClipping->LowerRightCorner.Y; - } - else - { - destClip.x0 = 0; - destClip.y0 = 0; - destClip.x1 = dest ? dest->getDimension().Width : 0; - destClip.y1 = dest ? dest->getDimension().Height : 0; - } - - v.x0 = destPos ? destPos->X : 0; - v.y0 = destPos ? destPos->Y : 0; - v.x1 = v.x0 + ( sourceClip.x1 - sourceClip.x0 ); - v.y1 = v.y0 + ( sourceClip.y1 - sourceClip.y0 ); - - intersect( job.Dest, destClip, v ); - if ( !isValid( job.Dest ) ) - return 0; - - job.width = job.Dest.x1 - job.Dest.x0; - job.height = job.Dest.y1 - job.Dest.y0; - - - job.Source.x0 = sourceClip.x0 + ( job.Dest.x0 - v.x0 ); - job.Source.x1 = job.Source.x0 + job.width; - - job.Source.y0 = sourceClip.y0 + ( job.Dest.y0 - v.y0 ); - job.Source.y1 = job.Source.y0 + job.height; - - job.argb = argb; - - if ( source ) - { - job.srcPitch = source->getPitch(); - job.srcPixelMul = source->getBytesPerPixel(); - job.src = (void*) ( (u8*) source->lock() + ( job.Source.y0 * job.srcPitch ) + ( job.Source.x0 * job.srcPixelMul ) ); - } - else - { - // use srcPitch for color operation on dest - job.srcPitch = job.width * dest->getBytesPerPixel(); - } - - job.dstPitch = dest->getPitch(); - job.dstPixelMul = dest->getBytesPerPixel(); - job.dst = (void*) ( (u8*) dest->lock() + ( job.Dest.y0 * job.dstPitch ) + ( job.Dest.x0 * job.dstPixelMul ) ); - - blitter( &job ); - - if ( source ) - source->unlock(); - - if ( dest ) - dest->unlock(); - - return 1; -} - -} - -namespace irr -{ -namespace video -{ - -//! constructor -CImage::CImage(ECOLOR_FORMAT format, const core::dimension2d& size) -:Data(0), Size(size), Format(format), DeleteMemory(true) -{ - initData(); -} - - -//! constructor -CImage::CImage(ECOLOR_FORMAT format, const core::dimension2d& size, void* data, - bool ownForeignMemory, bool deleteForeignMemory) -: Data(0), Size(size), Format(format), DeleteMemory(deleteForeignMemory) -{ - if (ownForeignMemory) - { - Data = (void*)0xbadf00d; - initData(); - Data = data; - } - else - { - Data = 0; - initData(); - memcpy(Data, data, Size.Height * Pitch); - } -} - - - -//! constructor -CImage::CImage(ECOLOR_FORMAT format, IImage* imageToCopy) -: Data(0), Format(format), DeleteMemory(true) -{ - if (!imageToCopy) - return; - - Size = imageToCopy->getDimension(); - initData(); - - // now copy data from other image - - Blit ( BLITTER_TEXTURE, this, 0, 0, imageToCopy, 0,0 ); -} - - - -//! constructor -CImage::CImage(IImage* imageToCopy, const core::position2d& pos, - const core::dimension2d& size) - : Data(0), Size(0,0), DeleteMemory(true) -{ - if (!imageToCopy) - return; - - Format = imageToCopy->getColorFormat(); - Size = size; - - initData(); - - core::rect sClip( pos.X, pos.Y, pos.X + size.Width,pos.Y + size.Height ); - Blit (BLITTER_TEXTURE, this, 0, 0, imageToCopy, &sClip, 0); -} - - - -//! assumes format and size has been set and creates the rest -void CImage::initData() -{ - setBitMasks(); - BitsPerPixel = getBitsPerPixelFromFormat(Format); - BytesPerPixel = BitsPerPixel / 8; - - // Pitch should be aligned... - Pitch = BytesPerPixel * Size.Width; - - if (!Data) - Data = new s8[Size.Height * Pitch]; -} - - -//! destructor -CImage::~CImage() -{ - if ( DeleteMemory ) - delete [] (s8*)Data; -} - - -//! Returns width and height of image data. -const core::dimension2d& CImage::getDimension() const -{ - return Size; -} - - - -//! Returns bits per pixel. -u32 CImage::getBitsPerPixel() const -{ - return BitsPerPixel; -} - - -//! Returns bytes per pixel -u32 CImage::getBytesPerPixel() const -{ - return BytesPerPixel; -} - - - -//! Returns image data size in bytes -u32 CImage::getImageDataSizeInBytes() const -{ - return Pitch * Size.Height; -} - - - -//! Returns image data size in pixels -u32 CImage::getImageDataSizeInPixels() const -{ - return Size.Width * Size.Height; -} - - - -//! returns mask for red value of a pixel -u32 CImage::getRedMask() const -{ - return RedMask; -} - - - -//! returns mask for green value of a pixel -u32 CImage::getGreenMask() const -{ - return GreenMask; -} - - - -//! returns mask for blue value of a pixel -u32 CImage::getBlueMask() const -{ - return BlueMask; -} - - - -//! returns mask for alpha value of a pixel -u32 CImage::getAlphaMask() const -{ - return AlphaMask; -} - - -void CImage::setBitMasks() -{ - switch(Format) - { - case ECF_A1R5G5B5: - AlphaMask = 0x1<<15; - RedMask = 0x1F<<10; - GreenMask = 0x1F<<5; - BlueMask = 0x1F; - break; - case ECF_R5G6B5: - AlphaMask = 0x0; - RedMask = 0x1F<<11; - GreenMask = 0x3F<<5; - BlueMask = 0x1F; - break; - case ECF_R8G8B8: - AlphaMask = 0x0; - RedMask = 0x00FF0000; - GreenMask = 0x0000FF00; - BlueMask = 0x000000FF; - break; - case ECF_A8R8G8B8: - AlphaMask = 0xFF000000; - RedMask = 0x00FF0000; - GreenMask = 0x0000FF00; - BlueMask = 0x000000FF; - break; - } -} - - -u32 CImage::getBitsPerPixelFromFormat(ECOLOR_FORMAT format) -{ - switch(format) - { - case ECF_A1R5G5B5: - return 16; - case ECF_R5G6B5: - return 16; - case ECF_R8G8B8: - return 24; - case ECF_A8R8G8B8: - return 32; - } - - return 0; -} - -//! sets a pixel -void CImage::setPixel(u32 x, u32 y, const SColor &color ) -{ - if (x >= (u32)Size.Width || y >= (u32)Size.Height) - return; - - switch(Format) - { - case ECF_A1R5G5B5: - { - u16 * dest = (u16*) ((u8*) Data + ( y * Pitch ) + ( x << 1 )); - *dest = video::A8R8G8B8toA1R5G5B5( color.color ); - } break; - - case ECF_R5G6B5: - { - u16 * dest = (u16*) ((u8*) Data + ( y * Pitch ) + ( x << 1 )); - *dest = video::A8R8G8B8toR5G6B5( color.color ); - } break; - - case ECF_R8G8B8: - { - u8* dest = (u8*) Data + ( y * Pitch ) + ( x * 3 ); - dest[0] = (u8)color.getRed(); - dest[1] = (u8)color.getGreen(); - dest[2] = (u8)color.getBlue(); - } break; - - case ECF_A8R8G8B8: - { - u32 * dest = (u32*) ((u8*) Data + ( y * Pitch ) + ( x << 2 )); - *dest = color.color; - } break; - } -} - - -//! returns a pixel -SColor CImage::getPixel(u32 x, u32 y) const -{ - if (x >= (u32)Size.Width || y >= (u32)Size.Height) - return SColor(0); - - switch(Format) - { - case ECF_A1R5G5B5: - return A1R5G5B5toA8R8G8B8(((u16*)Data)[y*Size.Width + x]); - case ECF_R5G6B5: - return R5G6B5toA8R8G8B8(((u16*)Data)[y*Size.Width + x]); - case ECF_A8R8G8B8: - return ((u32*)Data)[y*Size.Width + x]; - case ECF_R8G8B8: - { - u8* p = &((u8*)Data)[(y*3)*Size.Width + (x*3)]; - return SColor(255,p[0],p[1],p[2]); - } - } - - return SColor(0); -} - - -//! returns the color format -ECOLOR_FORMAT CImage::getColorFormat() const -{ - return Format; -} - - -//! draws a rectangle -void CImage::drawRectangle(const core::rect& rect, const SColor &color) -{ - Blit(color.getAlpha() == 0xFF ? BLITTER_COLOR : BLITTER_COLOR_ALPHA, - this, 0, &rect.UpperLeftCorner, 0, &rect, color.color); -} - - -//! copies this surface into another -void CImage::copyTo(IImage* target, const core::position2d& pos) -{ - Blit(BLITTER_TEXTURE, target, 0, &pos, this, 0, 0); -} - - -//! copies this surface into another -void CImage::copyTo(IImage* target, const core::position2d& pos, const core::rect& sourceRect, const core::rect* clipRect) -{ - Blit(BLITTER_TEXTURE, target, clipRect, &pos, this, &sourceRect, 0); -} - - - -//! copies this surface into another, using the alpha mask, an cliprect and a color to add with -void CImage::copyToWithAlpha(IImage* target, const core::position2d& pos, const core::rect& sourceRect, const SColor &color, const core::rect* clipRect) -{ - // color blend only necessary on not full spectrum aka. color.color != 0xFFFFFFFF - Blit(color.color == 0xFFFFFFFF ? BLITTER_TEXTURE_ALPHA_BLEND: BLITTER_TEXTURE_ALPHA_COLOR_BLEND, - target, clipRect, &pos, this, &sourceRect, color.color); -} - - - -//! draws a line from to with color -void CImage::drawLine(const core::position2d& from, const core::position2d& to, const SColor &color) -{ - AbsRectangle clip; - GetClip( clip, this ); - - core::position2d p[2]; - - if ( ClipLine( clip, p[0], p[1], from, to ) ) - { - u32 alpha = extractAlpha( color.color ); - - switch ( Format ) - { - case ECF_A1R5G5B5: - if ( alpha == 256 ) - { - RenderLine16_Decal( this, p[0], p[1], video::A8R8G8B8toA1R5G5B5( color.color ) ); - } - else - { - RenderLine16_Blend( this, p[0], p[1], video::A8R8G8B8toA1R5G5B5( color.color ), alpha >> 3 ); - } - break; - case ECF_A8R8G8B8: - if ( alpha == 256 ) - { - RenderLine32_Decal( this, p[0], p[1], color.color ); - } - else - { - RenderLine32_Blend( this, p[0], p[1], color.color, alpha ); - } - break; - default: - break; - } - } -} - - - -//! copies this surface into another, scaling it to the target image size -// note: this is very very slow. (i didn't want to write a fast version. -// but hopefully, nobody wants to scale surfaces every frame. -void CImage::copyToScaling(void* target, s32 width, s32 height, ECOLOR_FORMAT format, u32 pitch) -{ - if (!target || !width || !height) - return; - - const u32 bpp=getBitsPerPixelFromFormat(format)/8; - if (0==pitch) - pitch = width*bpp; - - if (Format==format && Size.Width==width && Size.Height==height) - { - if (pitch==Pitch) - { - memcpy(target, Data, height*pitch); - return; - } - else - { - u8* tgtpos = (u8*) target; - u8* dstpos = (u8*) Data; - const u32 bwidth = width*bpp; - for (s32 y=0; y& targetSize = target->getDimension(); - - if (targetSize==Size) - { - copyTo(target); - return; - } - - copyToScaling(target->lock(), targetSize.Width, targetSize.Height, target->getColorFormat()); - target->unlock(); -} - -//! copies this surface into another, scaling it to fit it. -void CImage::copyToScalingBoxFilter(IImage* target, s32 bias) -{ - const core::dimension2d destSize = target->getDimension(); - - const f32 sourceXStep = (f32) Size.Width / (f32) destSize.Width; - const f32 sourceYStep = (f32) Size.Height / (f32) destSize.Height; - - target->lock(); - - s32 fx = core::ceil32( sourceXStep ); - s32 fy = core::ceil32( sourceYStep ); - f32 sx; - f32 sy; - - sy = 0.f; - for ( s32 y = 0; y != destSize.Height; ++y ) - { - sx = 0.f; - for ( s32 x = 0; x != destSize.Width; ++x ) - { - target->setPixel( x, y, getPixelBox( core::floor32(sx), core::floor32(sy), fx, fy, bias ) ); - sx += sourceXStep; - } - sy += sourceYStep; - } - - target->unlock(); -} - - -//! fills the surface with given color -void CImage::fill(const SColor &color) -{ - u32 c; - - switch ( Format ) - { - case ECF_A1R5G5B5: - c = video::A8R8G8B8toA1R5G5B5( color.color ); - c |= c << 16; - break; - case ECF_R5G6B5: - c = video::A8R8G8B8toR5G6B5( color.color ); - c |= c << 16; - break; - case ECF_A8R8G8B8: - c = color.color; - break; - default: -// os::Printer::log("CImage::Format not supported", ELL_ERROR); - return; - } - - memset32( Data, c, getImageDataSizeInBytes() ); -} - - -//! get a filtered pixel -inline SColor CImage::getPixelBox( s32 x, s32 y, s32 fx, s32 fy, s32 bias ) const -{ - SColor c; - s32 a = 0, r = 0, g = 0, b = 0; - - for ( s32 dx = 0; dx != fx; ++dx ) - { - for ( s32 dy = 0; dy != fy; ++dy ) - { - c = getPixel( x + dx , y + dy ); - - a += c.getAlpha(); - r += c.getRed(); - g += c.getGreen(); - b += c.getBlue(); - } - } - - s32 sdiv = s32_log2_s32(fx * fy); - - a = core::s32_clamp( ( a >> sdiv ) + bias, 0, 255 ); - r = core::s32_clamp( ( r >> sdiv ) + bias, 0, 255 ); - g = core::s32_clamp( ( g >> sdiv ) + bias, 0, 255 ); - b = core::s32_clamp( ( b >> sdiv ) + bias, 0, 255 ); - - c.set( a, r, g, b ); - return c; -} - - -} // end namespace video -} // end namespace irr - +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#include "CImage.h" +#include "irrString.h" +#include "SoftwareDriver2_helper.h" +#include "CColorConverter.h" + +namespace irr +{ + + struct SBlitJob + { + AbsRectangle Dest; + AbsRectangle Source; + + u32 argb; + + void * src; + void * dst; + + s32 width; + s32 height; + + u32 srcPitch; + u32 dstPitch; + + u32 srcPixelMul; + u32 dstPixelMul; + }; + + // Blitter Operation + enum eBlitter + { + BLITTER_INVALID = 0, + BLITTER_COLOR, + BLITTER_COLOR_ALPHA, + BLITTER_TEXTURE, + BLITTER_TEXTURE_ALPHA_BLEND, + BLITTER_TEXTURE_ALPHA_COLOR_BLEND + }; + + typedef void (*tExecuteBlit) ( const SBlitJob * job ); + + + // Bitfields Cohen Sutherland + enum eClipCode + { + CLIPCODE_EMPTY = 0, + CLIPCODE_BOTTOM = 1, + CLIPCODE_TOP = 2, + CLIPCODE_LEFT = 4, + CLIPCODE_RIGHT = 8 + }; + +inline u32 GetClipCode( const AbsRectangle &r, const core::position2d &p ) +{ + u32 code = CLIPCODE_EMPTY; + + if ( p.X < r.x0 ) + code = CLIPCODE_LEFT; + else + if ( p.X > r.x1 ) + code = CLIPCODE_RIGHT; + + if ( p.Y < r.y0 ) + code |= CLIPCODE_TOP; + else + if ( p.Y > r.y1 ) + code |= CLIPCODE_BOTTOM; + + return code; +} + + +/*! + Cohen Sutherland clipping + @return: 1 if valid +*/ + +static int ClipLine(const AbsRectangle &clipping, + core::position2d &p0, + core::position2d &p1, + const core::position2d& p0_in, + const core::position2d& p1_in) +{ + u32 code0; + u32 code1; + u32 code; + + p0 = p0_in; + p1 = p1_in; + + code0 = GetClipCode( clipping, p0 ); + code1 = GetClipCode( clipping, p1 ); + + // trivial accepted + while ( code0 | code1 ) + { + s32 x=0; + s32 y=0; + + // trivial reject + if ( code0 & code1 ) + return 0; + + if ( code0 ) + { + // clip first point + code = code0; + } + else + { + // clip last point + code = code1; + } + + if ( (code & CLIPCODE_BOTTOM) == CLIPCODE_BOTTOM ) + { + // clip bottom viewport + y = clipping.y1; + x = p0.X + ( p1.X - p0.X ) * ( y - p0.Y ) / ( p1.Y - p0.Y ); + } + else + if ( (code & CLIPCODE_TOP) == CLIPCODE_TOP ) + { + // clip to viewport + y = clipping.y0; + x = p0.X + ( p1.X - p0.X ) * ( y - p0.Y ) / ( p1.Y - p0.Y ); + } + else + if ( (code & CLIPCODE_RIGHT) == CLIPCODE_RIGHT ) + { + // clip right viewport + x = clipping.x1; + y = p0.Y + ( p1.Y - p0.Y ) * ( x - p0.X ) / ( p1.X - p0.X ); + } + else + if ( (code & CLIPCODE_LEFT) == CLIPCODE_LEFT ) + { + // clip left viewport + x = clipping.x0; + y = p0.Y + ( p1.Y - p0.Y ) * ( x - p0.X ) / ( p1.X - p0.X ); + } + + if ( code == code0 ) + { + // modify first point + p0.X = x; + p0.Y = y; + code0 = GetClipCode( clipping, p0 ); + } + else + { + // modify second point + p1.X = x; + p1.Y = y; + code1 = GetClipCode( clipping, p1 ); + } + } + + return 1; +} + +/* +*/ +inline void GetClip(AbsRectangle &clipping, video::IImage * t) +{ + clipping.x0 = 0; + clipping.y0 = 0; + clipping.x1 = t->getDimension().Width - 1; + clipping.y1 = t->getDimension().Height - 1; +} + +/* +*/ +static void RenderLine32_Decal(video::IImage *t, + const core::position2d &p0, + const core::position2d &p1, + u32 argb ) +{ + s32 dx = p1.X - p0.X; + s32 dy = p1.Y - p0.Y; + + s32 c; + s32 m; + s32 d = 0; + s32 run; + + s32 xInc = 4; + s32 yInc = (s32) t->getPitch(); + + if ( dx < 0 ) + { + xInc = -xInc; + dx = -dx; + } + + if ( dy < 0 ) + { + yInc = -yInc; + dy = -dy; + } + + u32 *dst; + dst = (u32*) ( (u8*) t->lock() + ( p0.Y * t->getPitch() ) + ( p0.X << 2 ) ); + + if ( dy > dx ) + { + s32 tmp; + tmp = dx; + dx = dy; + dy = tmp; + tmp = xInc; + xInc = yInc; + yInc = tmp; + } + + c = dx << 1; + m = dy << 1; + + run = dx; + while ( run ) + { + *dst = argb; + + dst = (u32*) ( (u8*) dst + xInc ); // x += xInc + d += m; + if ( d > dx ) + { + dst = (u32*) ( (u8*) dst + yInc ); // y += yInc + d -= c; + } + run -= 1; + } + + t->unlock(); +} + + +/* +*/ +static void RenderLine32_Blend(video::IImage *t, + const core::position2d &p0, + const core::position2d &p1, + u32 argb, u32 alpha) +{ + s32 dx = p1.X - p0.X; + s32 dy = p1.Y - p0.Y; + + s32 c; + s32 m; + s32 d = 0; + s32 run; + + s32 xInc = 4; + s32 yInc = (s32) t->getPitch(); + + if ( dx < 0 ) + { + xInc = -xInc; + dx = -dx; + } + + if ( dy < 0 ) + { + yInc = -yInc; + dy = -dy; + } + + u32 *dst; + dst = (u32*) ( (u8*) t->lock() + ( p0.Y * t->getPitch() ) + ( p0.X << 2 ) ); + + if ( dy > dx ) + { + s32 tmp; + tmp = dx; + dx = dy; + dy = tmp; + tmp = xInc; + xInc = yInc; + yInc = tmp; + } + + c = dx << 1; + m = dy << 1; + + run = dx; + while ( run ) + { + *dst = PixelBlend32( *dst, argb, alpha ); + + dst = (u32*) ( (u8*) dst + xInc ); // x += xInc + d += m; + if ( d > dx ) + { + dst = (u32*) ( (u8*) dst + yInc ); // y += yInc + d -= c; + } + run -= 1; + } + + t->unlock(); +} + +/* +*/ +static void RenderLine16_Decal(video::IImage *t, + const core::position2d &p0, + const core::position2d &p1, + u32 argb ) +{ + s32 dx = p1.X - p0.X; + s32 dy = p1.Y - p0.Y; + + s32 c; + s32 m; + s32 d = 0; + s32 run; + + s32 xInc = 2; + s32 yInc = (s32) t->getPitch(); + + if ( dx < 0 ) + { + xInc = -xInc; + dx = -dx; + } + + if ( dy < 0 ) + { + yInc = -yInc; + dy = -dy; + } + + u16 *dst; + dst = (u16*) ( (u8*) t->lock() + ( p0.Y * t->getPitch() ) + ( p0.X << 1 ) ); + + if ( dy > dx ) + { + s32 tmp; + tmp = dx; + dx = dy; + dy = tmp; + tmp = xInc; + xInc = yInc; + yInc = tmp; + } + + c = dx << 1; + m = dy << 1; + + run = dx; + while ( run ) + { + *dst = (u16)argb; + + dst = (u16*) ( (u8*) dst + xInc ); // x += xInc + d += m; + if ( d > dx ) + { + dst = (u16*) ( (u8*) dst + yInc ); // y += yInc + d -= c; + } + run -= 1; + } + + t->unlock(); +} + +/* +*/ +static void RenderLine16_Blend(video::IImage *t, + const core::position2d &p0, + const core::position2d &p1, + u32 argb, + u32 alpha) +{ + s32 dx = p1.X - p0.X; + s32 dy = p1.Y - p0.Y; + + s32 c; + s32 m; + s32 d = 0; + s32 run; + + s32 xInc = 2; + s32 yInc = (s32) t->getPitch(); + + if ( dx < 0 ) + { + xInc = -xInc; + dx = -dx; + } + + if ( dy < 0 ) + { + yInc = -yInc; + dy = -dy; + } + + u16 *dst; + dst = (u16*) ( (u8*) t->lock() + ( p0.Y * t->getPitch() ) + ( p0.X << 1 ) ); + + if ( dy > dx ) + { + s32 tmp; + tmp = dx; + dx = dy; + dy = tmp; + tmp = xInc; + xInc = yInc; + yInc = tmp; + } + + c = dx << 1; + m = dy << 1; + + run = dx; + while ( run ) + { + *dst = PixelBlend16( *dst, argb, alpha ); + + dst = (u16*) ( (u8*) dst + xInc ); // x += xInc + d += m; + if ( d > dx ) + { + dst = (u16*) ( (u8*) dst + yInc ); // y += yInc + d -= c; + } + run -= 1; + } + + t->unlock(); +} + + +/*! +*/ +static void executeBlit_TextureCopy_x_to_x( const SBlitJob * job ) +{ + const void *src = (void*) job->src; + void *dst = (void*) job->dst; + + const u32 widthPitch = job->width * job->dstPixelMul; + for ( s32 dy = 0; dy != job->height; ++dy ) + { + memcpy( dst, src, widthPitch ); + + src = (void*) ( (u8*) (src) + job->srcPitch ); + dst = (void*) ( (u8*) (dst) + job->dstPitch ); + } +} + + +/*! +*/ +static void executeBlit_TextureCopy_32_to_16( const SBlitJob * job ) +{ + const u32 *src = static_cast(job->src); + u16 *dst = static_cast(job->dst); + + for ( s32 dy = 0; dy != job->height; ++dy ) + { + for ( s32 dx = 0; dx != job->width; ++dx ) + { + //16 bit Blitter depends on pre-multiplied color + const u32 s = PixelLerp32( src[dx] | 0xFF000000, extractAlpha( src[dx] ) ); + dst[dx] = video::A8R8G8B8toA1R5G5B5( s ); + } + + src = (u32*) ( (u8*) (src) + job->srcPitch ); + dst = (u16*) ( (u8*) (dst) + job->dstPitch ); + } +} + +/*! +*/ +static void executeBlit_TextureCopy_24_to_16( const SBlitJob * job ) +{ + const void *src = (void*) job->src; + u16 *dst = (u16*) job->dst; + + for ( s32 dy = 0; dy != job->height; ++dy ) + { + u8 * s = (u8*) src; + + for ( s32 dx = 0; dx != job->width; ++dx ) + { + dst[dx] = video::RGB16(s[0], s[1], s[2]); + s += 3; + } + + src = (void*) ( (u8*) (src) + job->srcPitch ); + dst = (u16*) ( (u8*) (dst) + job->dstPitch ); + } +} + + +/*! +*/ +static void executeBlit_TextureCopy_16_to_32( const SBlitJob * job ) +{ + const u16 *src = (u16*) job->src; + u32 *dst = (u32*) job->dst; + + for ( s32 dy = 0; dy != job->height; ++dy ) + { + for ( s32 dx = 0; dx != job->width; ++dx ) + { + dst[dx] = video::A1R5G5B5toA8R8G8B8( src[dx] ); + } + + src = (u16*) ( (u8*) (src) + job->srcPitch ); + dst = (u32*) ( (u8*) (dst) + job->dstPitch ); + } +} + +static void executeBlit_TextureCopy_16_to_24( const SBlitJob * job ) +{ + const u16 *src = (u16*) job->src; + u8 *dst = (u8*) job->dst; + + for ( s32 dy = 0; dy != job->height; ++dy ) + { + for ( s32 dx = 0; dx != job->width; ++dx ) + { + u32 colour = video::A1R5G5B5toA8R8G8B8( src[dx] ); + u8 * writeTo = &dst[dx * 3]; + *writeTo++ = (colour >> 16)& 0xFF; + *writeTo++ = (colour >> 8) & 0xFF; + *writeTo++ = colour & 0xFF; + } + + src = (u16*) ( (u8*) (src) + job->srcPitch ); + dst += job->dstPitch; + } +} + + +/*! +*/ +static void executeBlit_TextureCopy_24_to_32( const SBlitJob * job ) +{ + void *src = (void*) job->src; + u32 *dst = (u32*) job->dst; + + for ( s32 dy = 0; dy != job->height; ++dy ) + { + u8 * s = (u8*) src; + + for ( s32 dx = 0; dx != job->width; ++dx ) + { + dst[dx] = 0xFF000000 | s[0] << 16 | s[1] << 8 | s[2]; + s += 3; + } + + src = (void*) ( (u8*) (src) + job->srcPitch ); + dst = (u32*) ( (u8*) (dst) + job->dstPitch ); + } +} + +static void executeBlit_TextureCopy_32_to_24( const SBlitJob * job ) +{ + const u32 * src = (u32*) job->src; + u8 * dst = (u8*) job->dst; + + for ( s32 dy = 0; dy != job->height; ++dy ) + { + for ( s32 dx = 0; dx != job->width; ++dx ) + { + u8 * writeTo = &dst[dx * 3]; + *writeTo++ = (src[dx] >> 16)& 0xFF; + *writeTo++ = (src[dx] >> 8) & 0xFF; + *writeTo++ = src[dx] & 0xFF; + } + + src = (u32*) ( (u8*) (src) + job->srcPitch ); + dst += job->dstPitch ; + } + +} + + +/*! +*/ +static void executeBlit_TextureBlend_16_to_16( const SBlitJob * job ) +{ + u32 dx; + s32 dy; + + u32 *src = (u32*) job->src; + u32 *dst = (u32*) job->dst; + + + const u32 rdx = job->width >> 1; + const u32 off = core::if_c_a_else_b( job->width & 1 ,job->width - 1, 0 ); + + + if ( 0 == off ) + { + for ( dy = 0; dy != job->height; ++dy ) + { + for ( dx = 0; dx != rdx; ++dx ) + { + dst[dx] = PixelBlend16_simd( dst[dx], src[dx] ); + } + + src = (u32*) ( (u8*) (src) + job->srcPitch ); + dst = (u32*) ( (u8*) (dst) + job->dstPitch ); + } + + } + else + { + for ( dy = 0; dy != job->height; ++dy ) + { + for ( dx = 0; dx != rdx; ++dx ) + { + dst[dx] = PixelBlend16_simd( dst[dx], src[dx] ); + } + + ((u16*) dst)[off] = PixelBlend16( ((u16*) dst)[off], ((u16*) src)[off] ); + + src = (u32*) ( (u8*) (src) + job->srcPitch ); + dst = (u32*) ( (u8*) (dst) + job->dstPitch ); + } + + } +} + +/*! +*/ +static void executeBlit_TextureBlend_32_to_32( const SBlitJob * job ) +{ + u32 *src = (u32*) job->src; + u32 *dst = (u32*) job->dst; + + for ( s32 dy = 0; dy != job->height; ++dy ) + { + for ( s32 dx = 0; dx != job->width; ++dx ) + { + dst[dx] = PixelBlend32( dst[dx], src[dx] ); + } + src = (u32*) ( (u8*) (src) + job->srcPitch ); + dst = (u32*) ( (u8*) (dst) + job->dstPitch ); + } +} + +/*! +*/ +static void executeBlit_TextureBlendColor_16_to_16( const SBlitJob * job ) +{ + u16 *src = (u16*) job->src; + u16 *dst = (u16*) job->dst; + + u16 blend = video::A8R8G8B8toA1R5G5B5 ( job->argb ); + for ( s32 dy = 0; dy != job->height; ++dy ) + { + for ( s32 dx = 0; dx != job->width; ++dx ) + { + dst[dx] = PixelBlend16( dst[dx], PixelMul16_2( src[dx], blend ) ); + } + src = (u16*) ( (u8*) (src) + job->srcPitch ); + dst = (u16*) ( (u8*) (dst) + job->dstPitch ); + } +} + + +/*! +*/ +static void executeBlit_TextureBlendColor_32_to_32( const SBlitJob * job ) +{ + u32 *src = (u32*) job->src; + u32 *dst = (u32*) job->dst; + + for ( s32 dy = 0; dy != job->height; ++dy ) + { + for ( s32 dx = 0; dx != job->width; ++dx ) + { + dst[dx] = PixelBlend32( dst[dx], PixelMul32_2( src[dx], job->argb ) ); + } + src = (u32*) ( (u8*) (src) + job->srcPitch ); + dst = (u32*) ( (u8*) (dst) + job->dstPitch ); + } +} + +/*! +*/ +static void executeBlit_Color_16_to_16( const SBlitJob * job ) +{ + u16 *dst = (u16*) job->dst; + + u16 c0 = video::A8R8G8B8toA1R5G5B5( job->argb ); + u32 c = c0 | c0 << 16; + + if ( 0 == (job->srcPitch & 3 ) ) + { + for ( s32 dy = 0; dy != job->height; ++dy ) + { + memset32( dst, c, job->srcPitch ); + dst = (u16*) ( (u8*) (dst) + job->dstPitch ); + } + } + else + { + s32 dx = job->width - 1; + + for ( s32 dy = 0; dy != job->height; ++dy ) + { + memset32( dst, c, job->srcPitch ); + dst[dx] = c0; + dst = (u16*) ( (u8*) (dst) + job->dstPitch ); + } + + } +} + +/*! +*/ +static void executeBlit_Color_32_to_32( const SBlitJob * job ) +{ + u32 *dst = (u32*) job->dst; + + for ( s32 dy = 0; dy != job->height; ++dy ) + { + memset32( dst, job->argb, job->srcPitch ); + dst = (u32*) ( (u8*) (dst) + job->dstPitch ); + } +} + +/*! +*/ +static void executeBlit_ColorAlpha_16_to_16( const SBlitJob * job ) +{ + u16 *dst = (u16*) job->dst; + + const u32 alpha = extractAlpha( job->argb ) >> 3; + const u32 src = video::A8R8G8B8toA1R5G5B5( job->argb ); + + for ( s32 dy = 0; dy != job->height; ++dy ) + { + for ( s32 dx = 0; dx != job->width; ++dx ) + { + dst[dx] = PixelBlend16( dst[dx], src, alpha ); + } + dst = (u16*) ( (u8*) (dst) + job->dstPitch ); + } +} + +/*! +*/ +static void executeBlit_ColorAlpha_32_to_32( const SBlitJob * job ) +{ + u32 *dst = (u32*) job->dst; + + const u32 alpha = extractAlpha( job->argb ); + const u32 src = job->argb; + + for ( s32 dy = 0; dy != job->height; ++dy ) + { + for ( s32 dx = 0; dx != job->width; ++dx ) + { + dst[dx] = PixelBlend32( dst[dx], src, alpha ); + } + dst = (u32*) ( (u8*) (dst) + job->dstPitch ); + } +} + +/*! +*/ +static tExecuteBlit getBlitter( eBlitter operation,const video::IImage * dest,const video::IImage * source ) +{ + video::ECOLOR_FORMAT sourceFormat = (video::ECOLOR_FORMAT) -1; + video::ECOLOR_FORMAT destFormat = (video::ECOLOR_FORMAT) -1; + + if ( source ) + sourceFormat = source->getColorFormat(); + + if ( dest ) + destFormat = dest->getColorFormat(); + + switch ( operation ) + { + case BLITTER_TEXTURE: + { + if ( sourceFormat == destFormat ) + return executeBlit_TextureCopy_x_to_x; + + if ( destFormat == video::ECF_A1R5G5B5 && sourceFormat == video::ECF_A8R8G8B8 ) + return executeBlit_TextureCopy_32_to_16; + + if ( destFormat == video::ECF_A1R5G5B5 && sourceFormat == video::ECF_R8G8B8 ) + return executeBlit_TextureCopy_24_to_16; + + if ( destFormat == video::ECF_A8R8G8B8 && sourceFormat == video::ECF_A1R5G5B5 ) + return executeBlit_TextureCopy_16_to_32; + + if ( destFormat == video::ECF_R8G8B8 && sourceFormat == video::ECF_A1R5G5B5 ) + return executeBlit_TextureCopy_16_to_24; + + if ( destFormat == video::ECF_A8R8G8B8 && sourceFormat == video::ECF_R8G8B8 ) + return executeBlit_TextureCopy_24_to_32; + + if ( destFormat == video::ECF_R8G8B8 && sourceFormat == video::ECF_A8R8G8B8 ) + return executeBlit_TextureCopy_32_to_24; + + } break; + + case BLITTER_TEXTURE_ALPHA_BLEND: + { + if ( destFormat == video::ECF_A1R5G5B5 && sourceFormat == video::ECF_A1R5G5B5 ) + return executeBlit_TextureBlend_16_to_16; + + if ( destFormat == video::ECF_A8R8G8B8 && sourceFormat == video::ECF_A8R8G8B8 ) + return executeBlit_TextureBlend_32_to_32; + + } break; + + case BLITTER_TEXTURE_ALPHA_COLOR_BLEND: + { + if ( destFormat == video::ECF_A1R5G5B5 && sourceFormat == video::ECF_A1R5G5B5 ) + return executeBlit_TextureBlendColor_16_to_16; + + if ( destFormat == video::ECF_A8R8G8B8 && sourceFormat == video::ECF_A8R8G8B8 ) + return executeBlit_TextureBlendColor_32_to_32; + } break; + + case BLITTER_COLOR: + { + if ( destFormat == video::ECF_A1R5G5B5 ) + return executeBlit_Color_16_to_16; + + if ( destFormat == video::ECF_A8R8G8B8 ) + return executeBlit_Color_32_to_32; + } break; + + case BLITTER_COLOR_ALPHA: + { + if ( destFormat == video::ECF_A1R5G5B5 ) + return executeBlit_ColorAlpha_16_to_16; + + if ( destFormat == video::ECF_A8R8G8B8 ) + return executeBlit_ColorAlpha_32_to_32; + + } break; + + case BLITTER_INVALID: + break; + } +/* + char buf[64]; + sprintf( buf, "Blit: %d %d->%d unsupported",operation,sourceFormat,destFormat ); + os::Printer::log(buf ); +*/ + return 0; + +} + + + +/*! + a generic 2D Blitter +*/ +static s32 Blit(eBlitter operation, + video::IImage * dest, + const core::rect *destClipping, + const core::position2d *destPos, + video::IImage * const source, + const core::rect *sourceClipping, + u32 argb) +{ + tExecuteBlit blitter = getBlitter( operation, dest, source ); + if ( 0 == blitter ) + { + return 0; + } + + // Clipping + AbsRectangle sourceClip; + AbsRectangle destClip; + AbsRectangle v; + + SBlitJob job; + + if ( sourceClipping ) + { + sourceClip.x0 = sourceClipping->UpperLeftCorner.X; + sourceClip.y0 = sourceClipping->UpperLeftCorner.Y; + sourceClip.x1 = sourceClipping->LowerRightCorner.X; + sourceClip.y1 = sourceClipping->LowerRightCorner.Y; + } + else + { + sourceClip.x0 = 0; + sourceClip.y0 = 0; + sourceClip.x1 = source ? source->getDimension().Width : 0; + sourceClip.y1 = source ? source->getDimension().Height : 0; + } + + if ( destClipping ) + { + destClip.x0 = destClipping->UpperLeftCorner.X; + destClip.y0 = destClipping->UpperLeftCorner.Y; + destClip.x1 = destClipping->LowerRightCorner.X; + destClip.y1 = destClipping->LowerRightCorner.Y; + } + else + { + destClip.x0 = 0; + destClip.y0 = 0; + destClip.x1 = dest ? dest->getDimension().Width : 0; + destClip.y1 = dest ? dest->getDimension().Height : 0; + } + + v.x0 = destPos ? destPos->X : 0; + v.y0 = destPos ? destPos->Y : 0; + v.x1 = v.x0 + ( sourceClip.x1 - sourceClip.x0 ); + v.y1 = v.y0 + ( sourceClip.y1 - sourceClip.y0 ); + + intersect( job.Dest, destClip, v ); + if ( !isValid( job.Dest ) ) + return 0; + + job.width = job.Dest.x1 - job.Dest.x0; + job.height = job.Dest.y1 - job.Dest.y0; + + + job.Source.x0 = sourceClip.x0 + ( job.Dest.x0 - v.x0 ); + job.Source.x1 = job.Source.x0 + job.width; + + job.Source.y0 = sourceClip.y0 + ( job.Dest.y0 - v.y0 ); + job.Source.y1 = job.Source.y0 + job.height; + + job.argb = argb; + + if ( source ) + { + job.srcPitch = source->getPitch(); + job.srcPixelMul = source->getBytesPerPixel(); + job.src = (void*) ( (u8*) source->lock() + ( job.Source.y0 * job.srcPitch ) + ( job.Source.x0 * job.srcPixelMul ) ); + } + else + { + // use srcPitch for color operation on dest + job.srcPitch = job.width * dest->getBytesPerPixel(); + } + + job.dstPitch = dest->getPitch(); + job.dstPixelMul = dest->getBytesPerPixel(); + job.dst = (void*) ( (u8*) dest->lock() + ( job.Dest.y0 * job.dstPitch ) + ( job.Dest.x0 * job.dstPixelMul ) ); + + blitter( &job ); + + if ( source ) + source->unlock(); + + if ( dest ) + dest->unlock(); + + return 1; +} + +} + +namespace irr +{ +namespace video +{ + +//! constructor +CImage::CImage(ECOLOR_FORMAT format, const core::dimension2d& size) +:Data(0), Size(size), Format(format), DeleteMemory(true) +{ + initData(); +} + + +//! constructor +CImage::CImage(ECOLOR_FORMAT format, const core::dimension2d& size, void* data, + bool ownForeignMemory, bool deleteForeignMemory) +: Data(0), Size(size), Format(format), DeleteMemory(deleteForeignMemory) +{ + if (ownForeignMemory) + { + Data = (void*)0xbadf00d; + initData(); + Data = data; + } + else + { + Data = 0; + initData(); + memcpy(Data, data, Size.Height * Pitch); + } +} + + + +//! constructor +CImage::CImage(ECOLOR_FORMAT format, IImage* imageToCopy) +: Data(0), Format(format), DeleteMemory(true) +{ + if (!imageToCopy) + return; + + Size = imageToCopy->getDimension(); + initData(); + + // now copy data from other image + + Blit ( BLITTER_TEXTURE, this, 0, 0, imageToCopy, 0,0 ); +} + + + +//! constructor +CImage::CImage(IImage* imageToCopy, const core::position2d& pos, + const core::dimension2d& size) + : Data(0), Size(0,0), DeleteMemory(true) +{ + if (!imageToCopy) + return; + + Format = imageToCopy->getColorFormat(); + Size = size; + + initData(); + + core::rect sClip( pos.X, pos.Y, pos.X + size.Width,pos.Y + size.Height ); + Blit (BLITTER_TEXTURE, this, 0, 0, imageToCopy, &sClip, 0); +} + + + +//! assumes format and size has been set and creates the rest +void CImage::initData() +{ + setBitMasks(); + BitsPerPixel = getBitsPerPixelFromFormat(Format); + BytesPerPixel = BitsPerPixel / 8; + + // Pitch should be aligned... + Pitch = BytesPerPixel * Size.Width; + + if (!Data) + Data = new s8[Size.Height * Pitch]; +} + + +//! destructor +CImage::~CImage() +{ + if ( DeleteMemory ) + delete [] (s8*)Data; +} + + +//! Returns width and height of image data. +const core::dimension2d& CImage::getDimension() const +{ + return Size; +} + + + +//! Returns bits per pixel. +u32 CImage::getBitsPerPixel() const +{ + return BitsPerPixel; +} + + +//! Returns bytes per pixel +u32 CImage::getBytesPerPixel() const +{ + return BytesPerPixel; +} + + + +//! Returns image data size in bytes +u32 CImage::getImageDataSizeInBytes() const +{ + return Pitch * Size.Height; +} + + + +//! Returns image data size in pixels +u32 CImage::getImageDataSizeInPixels() const +{ + return Size.Width * Size.Height; +} + + + +//! returns mask for red value of a pixel +u32 CImage::getRedMask() const +{ + return RedMask; +} + + + +//! returns mask for green value of a pixel +u32 CImage::getGreenMask() const +{ + return GreenMask; +} + + + +//! returns mask for blue value of a pixel +u32 CImage::getBlueMask() const +{ + return BlueMask; +} + + + +//! returns mask for alpha value of a pixel +u32 CImage::getAlphaMask() const +{ + return AlphaMask; +} + + +void CImage::setBitMasks() +{ + switch(Format) + { + case ECF_A1R5G5B5: + AlphaMask = 0x1<<15; + RedMask = 0x1F<<10; + GreenMask = 0x1F<<5; + BlueMask = 0x1F; + break; + case ECF_R5G6B5: + AlphaMask = 0x0; + RedMask = 0x1F<<11; + GreenMask = 0x3F<<5; + BlueMask = 0x1F; + break; + case ECF_R8G8B8: + AlphaMask = 0x0; + RedMask = 0x00FF0000; + GreenMask = 0x0000FF00; + BlueMask = 0x000000FF; + break; + case ECF_A8R8G8B8: + AlphaMask = 0xFF000000; + RedMask = 0x00FF0000; + GreenMask = 0x0000FF00; + BlueMask = 0x000000FF; + break; + } +} + + +u32 CImage::getBitsPerPixelFromFormat(ECOLOR_FORMAT format) +{ + switch(format) + { + case ECF_A1R5G5B5: + return 16; + case ECF_R5G6B5: + return 16; + case ECF_R8G8B8: + return 24; + case ECF_A8R8G8B8: + return 32; + } + + return 0; +} + +//! sets a pixel +void CImage::setPixel(u32 x, u32 y, const SColor &color ) +{ + if (x >= (u32)Size.Width || y >= (u32)Size.Height) + return; + + switch(Format) + { + case ECF_A1R5G5B5: + { + u16 * dest = (u16*) ((u8*) Data + ( y * Pitch ) + ( x << 1 )); + *dest = video::A8R8G8B8toA1R5G5B5( color.color ); + } break; + + case ECF_R5G6B5: + { + u16 * dest = (u16*) ((u8*) Data + ( y * Pitch ) + ( x << 1 )); + *dest = video::A8R8G8B8toR5G6B5( color.color ); + } break; + + case ECF_R8G8B8: + { + u8* dest = (u8*) Data + ( y * Pitch ) + ( x * 3 ); + dest[0] = (u8)color.getRed(); + dest[1] = (u8)color.getGreen(); + dest[2] = (u8)color.getBlue(); + } break; + + case ECF_A8R8G8B8: + { + u32 * dest = (u32*) ((u8*) Data + ( y * Pitch ) + ( x << 2 )); + *dest = color.color; + } break; + } +} + + +//! returns a pixel +SColor CImage::getPixel(u32 x, u32 y) const +{ + if (x >= (u32)Size.Width || y >= (u32)Size.Height) + return SColor(0); + + switch(Format) + { + case ECF_A1R5G5B5: + return A1R5G5B5toA8R8G8B8(((u16*)Data)[y*Size.Width + x]); + case ECF_R5G6B5: + return R5G6B5toA8R8G8B8(((u16*)Data)[y*Size.Width + x]); + case ECF_A8R8G8B8: + return ((u32*)Data)[y*Size.Width + x]; + case ECF_R8G8B8: + { + u8* p = &((u8*)Data)[(y*3)*Size.Width + (x*3)]; + return SColor(255,p[0],p[1],p[2]); + } + } + + return SColor(0); +} + + +//! returns the color format +ECOLOR_FORMAT CImage::getColorFormat() const +{ + return Format; +} + + +//! draws a rectangle +void CImage::drawRectangle(const core::rect& rect, const SColor &color) +{ + Blit(color.getAlpha() == 0xFF ? BLITTER_COLOR : BLITTER_COLOR_ALPHA, + this, 0, &rect.UpperLeftCorner, 0, &rect, color.color); +} + + +//! copies this surface into another +void CImage::copyTo(IImage* target, const core::position2d& pos) +{ + Blit(BLITTER_TEXTURE, target, 0, &pos, this, 0, 0); +} + + +//! copies this surface into another +void CImage::copyTo(IImage* target, const core::position2d& pos, const core::rect& sourceRect, const core::rect* clipRect) +{ + Blit(BLITTER_TEXTURE, target, clipRect, &pos, this, &sourceRect, 0); +} + + + +//! copies this surface into another, using the alpha mask, an cliprect and a color to add with +void CImage::copyToWithAlpha(IImage* target, const core::position2d& pos, const core::rect& sourceRect, const SColor &color, const core::rect* clipRect) +{ + // color blend only necessary on not full spectrum aka. color.color != 0xFFFFFFFF + Blit(color.color == 0xFFFFFFFF ? BLITTER_TEXTURE_ALPHA_BLEND: BLITTER_TEXTURE_ALPHA_COLOR_BLEND, + target, clipRect, &pos, this, &sourceRect, color.color); +} + + + +//! draws a line from to with color +void CImage::drawLine(const core::position2d& from, const core::position2d& to, const SColor &color) +{ + AbsRectangle clip; + GetClip( clip, this ); + + core::position2d p[2]; + + if ( ClipLine( clip, p[0], p[1], from, to ) ) + { + u32 alpha = extractAlpha( color.color ); + + switch ( Format ) + { + case ECF_A1R5G5B5: + if ( alpha == 256 ) + { + RenderLine16_Decal( this, p[0], p[1], video::A8R8G8B8toA1R5G5B5( color.color ) ); + } + else + { + RenderLine16_Blend( this, p[0], p[1], video::A8R8G8B8toA1R5G5B5( color.color ), alpha >> 3 ); + } + break; + case ECF_A8R8G8B8: + if ( alpha == 256 ) + { + RenderLine32_Decal( this, p[0], p[1], color.color ); + } + else + { + RenderLine32_Blend( this, p[0], p[1], color.color, alpha ); + } + break; + } + } +} + + + +//! copies this surface into another, scaling it to the target image size +// note: this is very very slow. (i didn't want to write a fast version. +// but hopefully, nobody wants to scale surfaces every frame. +void CImage::copyToScaling(void* target, s32 width, s32 height, ECOLOR_FORMAT format, u32 pitch) +{ + if (!target || !width || !height) + return; + + const u32 bpp=getBitsPerPixelFromFormat(format)/8; + if (0==pitch) + pitch = width*bpp; + + if (Format==format && Size.Width==width && Size.Height==height) + { + if (pitch==Pitch) + { + memcpy(target, Data, height*pitch); + return; + } + else + { + u8* tgtpos = (u8*) target; + u8* dstpos = (u8*) Data; + const u32 bwidth = width*bpp; + for (s32 y=0; y& targetSize = target->getDimension(); + + if (targetSize==Size) + { + copyTo(target); + return; + } + + copyToScaling(target->lock(), targetSize.Width, targetSize.Height, target->getColorFormat()); + target->unlock(); +} + +//! copies this surface into another, scaling it to fit it. +void CImage::copyToScalingBoxFilter(IImage* target, s32 bias) +{ + const core::dimension2d destSize = target->getDimension(); + + const f32 sourceXStep = (f32) Size.Width / (f32) destSize.Width; + const f32 sourceYStep = (f32) Size.Height / (f32) destSize.Height; + + target->lock(); + + s32 fx = core::ceil32( sourceXStep ); + s32 fy = core::ceil32( sourceYStep ); + f32 sx; + f32 sy; + + sy = 0.f; + for ( s32 y = 0; y != destSize.Height; ++y ) + { + sx = 0.f; + for ( s32 x = 0; x != destSize.Width; ++x ) + { + target->setPixel( x, y, getPixelBox( core::floor32(sx), core::floor32(sy), fx, fy, bias ) ); + sx += sourceXStep; + } + sy += sourceYStep; + } + + target->unlock(); +} + + +//! fills the surface with given color +void CImage::fill(const SColor &color) +{ + u32 c; + + switch ( Format ) + { + case ECF_A1R5G5B5: + c = video::A8R8G8B8toA1R5G5B5( color.color ); + c |= c << 16; + break; + case ECF_R5G6B5: + c = video::A8R8G8B8toR5G6B5( color.color ); + c |= c << 16; + break; + case ECF_A8R8G8B8: + c = color.color; + break; + default: +// os::Printer::log("CImage::Format not supported", ELL_ERROR); + return; + } + + memset32( Data, c, getImageDataSizeInBytes() ); +} + + +//! get a filtered pixel +inline SColor CImage::getPixelBox( s32 x, s32 y, s32 fx, s32 fy, s32 bias ) const +{ + SColor c; + s32 a = 0, r = 0, g = 0, b = 0; + + for ( s32 dx = 0; dx != fx; ++dx ) + { + for ( s32 dy = 0; dy != fy; ++dy ) + { + c = getPixel( x + dx , y + dy ); + + a += c.getAlpha(); + r += c.getRed(); + g += c.getGreen(); + b += c.getBlue(); + } + } + + s32 sdiv = s32_log2_s32(fx * fy); + + a = core::s32_clamp( ( a >> sdiv ) + bias, 0, 255 ); + r = core::s32_clamp( ( r >> sdiv ) + bias, 0, 255 ); + g = core::s32_clamp( ( g >> sdiv ) + bias, 0, 255 ); + b = core::s32_clamp( ( b >> sdiv ) + bias, 0, 255 ); + + c.set( a, r, g, b ); + return c; +} + + +} // end namespace video +} // end namespace irr + diff --git a/src/dep/src/irrlicht/CImage.h b/src/dep/src/irrlicht/CImage.h index 52c19b4..a6c6c4d 100644 --- a/src/dep/src/irrlicht/CImage.h +++ b/src/dep/src/irrlicht/CImage.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageLoaderBMP.cpp b/src/dep/src/irrlicht/CImageLoaderBMP.cpp index 1aec5fa..7e75441 100644 --- a/src/dep/src/irrlicht/CImageLoaderBMP.cpp +++ b/src/dep/src/irrlicht/CImageLoaderBMP.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageLoaderBMP.h b/src/dep/src/irrlicht/CImageLoaderBMP.h index e7e4076..180e0ce 100644 --- a/src/dep/src/irrlicht/CImageLoaderBMP.h +++ b/src/dep/src/irrlicht/CImageLoaderBMP.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageLoaderJPG.cpp b/src/dep/src/irrlicht/CImageLoaderJPG.cpp index 2aac25b..63ec1d8 100644 --- a/src/dep/src/irrlicht/CImageLoaderJPG.cpp +++ b/src/dep/src/irrlicht/CImageLoaderJPG.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageLoaderJPG.h b/src/dep/src/irrlicht/CImageLoaderJPG.h index 472c9b2..fbc9cac 100644 --- a/src/dep/src/irrlicht/CImageLoaderJPG.h +++ b/src/dep/src/irrlicht/CImageLoaderJPG.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageLoaderPCX.cpp b/src/dep/src/irrlicht/CImageLoaderPCX.cpp index 2bd0600..d62e217 100644 --- a/src/dep/src/irrlicht/CImageLoaderPCX.cpp +++ b/src/dep/src/irrlicht/CImageLoaderPCX.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageLoaderPCX.h b/src/dep/src/irrlicht/CImageLoaderPCX.h index 1024e2c..8468b2a 100644 --- a/src/dep/src/irrlicht/CImageLoaderPCX.h +++ b/src/dep/src/irrlicht/CImageLoaderPCX.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageLoaderPNG.cpp b/src/dep/src/irrlicht/CImageLoaderPNG.cpp index 398a3f1..22192fd 100644 --- a/src/dep/src/irrlicht/CImageLoaderPNG.cpp +++ b/src/dep/src/irrlicht/CImageLoaderPNG.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -184,16 +184,9 @@ IImage* CImageLoaderPng::loadImage(io::IReadFile* file) const // Update the changes png_read_update_info(png_ptr, info_ptr); - { - // Use temporary variables to avoid passing casted pointers - png_uint_32 w,h; - // Extract info - png_get_IHDR(png_ptr, info_ptr, - &w, &h, - &BitDepth, &ColorType, NULL, NULL, NULL); - Width=w; - Height=h; - } + png_get_IHDR(png_ptr, info_ptr, + (png_uint_32*)&Width, (png_uint_32*)&Height, + &BitDepth, &ColorType, NULL, NULL, NULL); // Convert RGBA to BGRA if (ColorType==PNG_COLOR_TYPE_RGB_ALPHA) @@ -206,16 +199,9 @@ IImage* CImageLoaderPng::loadImage(io::IReadFile* file) const } // Update the changes - { - // Use temporary variables to avoid passing casted pointers - png_uint_32 w,h; - // Extract info - png_get_IHDR(png_ptr, info_ptr, - &w, &h, - &BitDepth, &ColorType, NULL, NULL, NULL); - Width=w; - Height=h; - } + png_get_IHDR(png_ptr, info_ptr, + (png_uint_32*)&Width, (png_uint_32*)&Height, + &BitDepth, &ColorType, NULL, NULL, NULL); // Create the image structure to be filled by png data if (ColorType==PNG_COLOR_TYPE_RGB_ALPHA) diff --git a/src/dep/src/irrlicht/CImageLoaderPNG.h b/src/dep/src/irrlicht/CImageLoaderPNG.h index d10d1e6..1b58c56 100644 --- a/src/dep/src/irrlicht/CImageLoaderPNG.h +++ b/src/dep/src/irrlicht/CImageLoaderPNG.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageLoaderPPM.cpp b/src/dep/src/irrlicht/CImageLoaderPPM.cpp index 25630ab..430e944 100644 --- a/src/dep/src/irrlicht/CImageLoaderPPM.cpp +++ b/src/dep/src/irrlicht/CImageLoaderPPM.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2009 Christian Stehno +// Copyright (C) 2007-2008 Christian Stehno // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -39,7 +39,7 @@ bool CImageLoaderPPM::isALoadableFileExtension(const c8* fileName) const //! returns true if the file maybe is able to be loaded by this class bool CImageLoaderPPM::isALoadableFileFormat(io::IReadFile* file) const { - c8 id[2]={0}; + c8 id[2]; file->read(&id, 2); return (id[0]=='P' && id[1]>'0' && id[1]<'7'); } diff --git a/src/dep/src/irrlicht/CImageLoaderPPM.h b/src/dep/src/irrlicht/CImageLoaderPPM.h index af71299..a3bdcb4 100644 --- a/src/dep/src/irrlicht/CImageLoaderPPM.h +++ b/src/dep/src/irrlicht/CImageLoaderPPM.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2009 Christian Stehno +// Copyright (C) 2007-2008 Christian Stehno // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageLoaderPSD.cpp b/src/dep/src/irrlicht/CImageLoaderPSD.cpp index 9268152..c6b5e2e 100644 --- a/src/dep/src/irrlicht/CImageLoaderPSD.cpp +++ b/src/dep/src/irrlicht/CImageLoaderPSD.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageLoaderPSD.h b/src/dep/src/irrlicht/CImageLoaderPSD.h index 6b6cad0..2d4acd7 100644 --- a/src/dep/src/irrlicht/CImageLoaderPSD.h +++ b/src/dep/src/irrlicht/CImageLoaderPSD.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageLoaderTGA.cpp b/src/dep/src/irrlicht/CImageLoaderTGA.cpp index e2e36c8..be96462 100644 --- a/src/dep/src/irrlicht/CImageLoaderTGA.cpp +++ b/src/dep/src/irrlicht/CImageLoaderTGA.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageLoaderTGA.h b/src/dep/src/irrlicht/CImageLoaderTGA.h index 26429d8..2cf5294 100644 --- a/src/dep/src/irrlicht/CImageLoaderTGA.h +++ b/src/dep/src/irrlicht/CImageLoaderTGA.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageLoaderWAL.cpp b/src/dep/src/irrlicht/CImageLoaderWAL.cpp new file mode 100644 index 0000000..ddaa9a0 --- /dev/null +++ b/src/dep/src/irrlicht/CImageLoaderWAL.cpp @@ -0,0 +1,148 @@ +// Copyright (C) 2004 Murphy McCauley +// Copyright (C) 2007-2008 Christian Stehno +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#include "CImageLoaderWAL.h" +#include "CColorConverter.h" +#include "CImage.h" +#include "os.h" +#include "dimension2d.h" +#include "IVideoDriver.h" +#include "IFileSystem.h" +#include "IReadFile.h" +#include "irrString.h" + +namespace irr +{ +namespace video +{ + +// May or may not be fully implemented +#define TRY_LOADING_PALETTE_FROM_FILE 0 + +// Default palette for Q2 WALs. + +s32 CImageLoaderWAL::DefaultPaletteQ2[256] = { +0x000000L,0x0F0F0FL,0x1F1F1FL,0x2F2F2FL,0x3F3F3FL,0x4B4B4BL,0x5B5B5BL,0x6B6B6BL,0x7B7B7BL,0x8B8B8BL,0x9B9B9BL, +0xABABABL,0xBBBBBBL,0xCBCBCBL,0xDBDBDBL,0xEBEBEBL,0x634B23L,0x5B431FL,0x533F1FL,0x4F3B1BL,0x47371BL,0x3F2F17L, +0x3B2B17L,0x332713L,0x2F2313L,0x2B1F13L,0x271B0FL,0x23170FL,0x1B130BL,0x170F0BL,0x130F07L,0x0F0B07L,0x5F5F6FL, +0x5B5B67L,0x5B535FL,0x574F5BL,0x534B53L,0x4F474BL,0x473F43L,0x3F3B3BL,0x3B3737L,0x332F2FL,0x2F2B2BL,0x272727L, +0x232323L,0x1B1B1BL,0x171717L,0x131313L,0x8F7753L,0x7B6343L,0x735B3BL,0x674F2FL,0xCF974BL,0xA77B3BL,0x8B672FL, +0x6F5327L,0xEB9F27L,0xCB8B23L,0xAF771FL,0x93631BL,0x774F17L,0x5B3B0FL,0x3F270BL,0x231707L,0xA73B2BL,0x9F2F23L, +0x972B1BL,0x8B2713L,0x7F1F0FL,0x73170BL,0x671707L,0x571300L,0x4B0F00L,0x430F00L,0x3B0F00L,0x330B00L,0x2B0B00L, +0x230B00L,0x1B0700L,0x130700L,0x7B5F4BL,0x735743L,0x6B533FL,0x674F3BL,0x5F4737L,0x574333L,0x533F2FL,0x4B372BL, +0x433327L,0x3F2F23L,0x37271BL,0x2F2317L,0x271B13L,0x1F170FL,0x170F0BL,0x0F0B07L,0x6F3B17L,0x5F3717L,0x532F17L, +0x432B17L,0x372313L,0x271B0FL,0x1B130BL,0x0F0B07L,0xB35B4FL,0xBF7B6FL,0xCB9B93L,0xD7BBB7L,0xCBD7DFL,0xB3C7D3L, +0x9FB7C3L,0x87A7B7L,0x7397A7L,0x5B879BL,0x47778BL,0x2F677FL,0x17536FL,0x134B67L,0x0F435BL,0x0B3F53L,0x07374BL, +0x072F3FL,0x072733L,0x001F2BL,0x00171FL,0x000F13L,0x00070BL,0x000000L,0x8B5757L,0x834F4FL,0x7B4747L,0x734343L, +0x6B3B3BL,0x633333L,0x5B2F2FL,0x572B2BL,0x4B2323L,0x3F1F1FL,0x331B1BL,0x2B1313L,0x1F0F0FL,0x130B0BL,0x0B0707L, +0x000000L,0x979F7BL,0x8F9773L,0x878B6BL,0x7F8363L,0x777B5FL,0x737357L,0x6B6B4FL,0x636347L,0x5B5B43L,0x4F4F3BL, +0x434333L,0x37372BL,0x2F2F23L,0x23231BL,0x171713L,0x0F0F0BL,0x9F4B3FL,0x934337L,0x8B3B2FL,0x7F3727L,0x772F23L, +0x6B2B1BL,0x632317L,0x571F13L,0x4F1B0FL,0x43170BL,0x37130BL,0x2B0F07L,0x1F0B07L,0x170700L,0x0B0000L,0x000000L, +0x777BCFL,0x6F73C3L,0x676BB7L,0x6363A7L,0x5B5B9BL,0x53578FL,0x4B4F7FL,0x474773L,0x3F3F67L,0x373757L,0x2F2F4BL, +0x27273FL,0x231F2FL,0x1B1723L,0x130F17L,0x0B0707L,0x9BAB7BL,0x8F9F6FL,0x879763L,0x7B8B57L,0x73834BL,0x677743L, +0x5F6F3BL,0x576733L,0x4B5B27L,0x3F4F1BL,0x374313L,0x2F3B0BL,0x232F07L,0x1B2300L,0x131700L,0x0B0F00L,0x00FF00L, +0x23E70FL,0x3FD31BL,0x53BB27L,0x5FA72FL,0x5F8F33L,0x5F7B33L,0xFFFFFFL,0xFFFFD3L,0xFFFFA7L,0xFFFF7FL,0xFFFF53L, +0xFFFF27L,0xFFEB1FL,0xFFD717L,0xFFBF0FL,0xFFAB07L,0xFF9300L,0xEF7F00L,0xE36B00L,0xD35700L,0xC74700L,0xB73B00L, +0xAB2B00L,0x9B1F00L,0x8F1700L,0x7F0F00L,0x730700L,0x5F0000L,0x470000L,0x2F0000L,0x1B0000L,0xEF0000L,0x3737FFL, +0xFF0000L,0x0000FFL,0x2B2B23L,0x1B1B17L,0x13130FL,0xEB977FL,0xC37353L,0x9F5733L,0x7B3F1BL,0xEBD3C7L,0xC7AB9BL, +0xA78B77L,0x876B57L,0x9F5B53L +}; + + +bool CImageLoaderWAL::isALoadableFileExtension(const c8* fileName) const +{ + return strstr(fileName, ".wal") != 0; +} + + +bool CImageLoaderWAL::isALoadableFileFormat(irr::io::IReadFile* file) const +{ + return (false); // no recognition possible, use a proper file ending +} + + +IImage* CImageLoaderWAL::loadImage(irr::io::IReadFile* file) const +{ + // Try to get the color palette from elsewhere (usually in a pak along with the WAL). + // If this fails we use the DefaultPaletteQ2. + static s32 * palette = 0; +#if TRY_LOADING_PALETTE_FROM_FILE + s32 loadedPalette[256]; +#endif + if (!palette) + { +#if TRY_LOADING_PALETTE_FROM_FILE + IImage * paletteImage; + // Look in a couple different places... + paletteImage = createImageFromFile("pics/colormap.pcx"); + if (!paletteImage) + paletteImage = createImageFromFile("pics/colormap.tga"); + if (!paletteImage) + paletteImage = createImageFromFile("colormap.pcx"); + if (!paletteImage) + paletteImage = createImageFromFile("colormap.tga"); + if (paletteImage && (paletteImage->getDimension().Width == 256) ) { + palette = &loadedPalette; + for (u32 i = 0; i < 256; ++i) { + palette[i] = paletteImage->getPixel(i, 0).color; + } + } else { + //FIXME: try reading a simple palette from "wal.pal" + palette = DefaultPaletteQ2; + } + if (paletteImage) + paletteImage->drop(); +#endif + } + else + { + palette = DefaultPaletteQ2; + } + + SWALHeader header; + + file->seek(0); + if (file->read(&header, sizeof(SWALHeader)) != sizeof(SWALHeader) ) + return 0; + + if (file->getSize() < header.MipmapOffset[0]) + return 0; + file->seek(header.MipmapOffset[0]); + + // read image + + const u32 imageSize = header.ImageHeight * header.ImageWidth; + if (file->getSize() < (long)(imageSize + header.MipmapOffset[0])) + return 0; + + u8* data = new u8[imageSize]; + file->read(data, imageSize); + + IImage* image = 0; + + image = new CImage(ECF_A1R5G5B5, + core::dimension2d(header.ImageWidth, header.ImageHeight)); + + // I wrote an 8 to 32 converter, but this works with released Irrlicht code. + CColorConverter::convert8BitTo16Bit(data, + (s16*)image->lock(), header.ImageWidth, header.ImageHeight, palette); + image->unlock(); + + delete [] data; + + return image; +} + + +IImageLoader* createImageLoaderWAL() +{ + return new irr::video::CImageLoaderWAL(); +} + + +} +} + + diff --git a/src/dep/src/irrlicht/CImageLoaderWAL.h b/src/dep/src/irrlicht/CImageLoaderWAL.h new file mode 100644 index 0000000..e22e66b --- /dev/null +++ b/src/dep/src/irrlicht/CImageLoaderWAL.h @@ -0,0 +1,68 @@ +// Copyright (C) 2004 Murphy McCauley +// Copyright (C) 2007-2008 Christian Stehno +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h +/* + Thanks to: + Max McGuire for his Flipcode article about WAL textures + Nikolaus Gebhardt for the Irrlicht 3D engine +*/ + +#ifndef __C_IMAGE_LOADER_WAL_H_INCLUDED__ +#define __C_IMAGE_LOADER_WAL_H_INCLUDED__ + +#include "IImageLoader.h" + +namespace irr +{ +namespace video +{ + +#ifdef _MSC_VER +# pragma pack( push, packing ) +# pragma pack( 1 ) +# define PACK_STRUCT +#elif defined( __GNUC__ ) +# define PACK_STRUCT __attribute__((packed)) +#else +# error compiler not supported +#endif + + struct SWALHeader { + char FrameName[32]; + + u32 ImageWidth; + u32 ImageHeight; + + s32 MipmapOffset[4]; + + char NextFrameName[32]; + + u32 Flags; // surface properties, i.e. slick, sky, nodraw + u32 Contents; // i.e. solid, clip, area portal + u32 Value; // light + } PACK_STRUCT; + +#ifdef _MSC_VER +# pragma pack( pop, packing ) +#endif +#undef PACK_STRUCT + +//! An Irrlicht image loader for Quake engine WAL textures +class CImageLoaderWAL : public irr::video::IImageLoader +{ +public: + virtual bool isALoadableFileExtension(const c8* fileName) const; + + virtual bool isALoadableFileFormat(irr::io::IReadFile* file) const; + + virtual irr::video::IImage* loadImage(irr::io::IReadFile* file) const; + +private: + static s32 DefaultPaletteQ2[256]; +}; + +} +} + +#endif diff --git a/src/dep/src/irrlicht/CImageWriterBMP.cpp b/src/dep/src/irrlicht/CImageWriterBMP.cpp index f4c7689..064c1e6 100644 --- a/src/dep/src/irrlicht/CImageWriterBMP.cpp +++ b/src/dep/src/irrlicht/CImageWriterBMP.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageWriterBMP.h b/src/dep/src/irrlicht/CImageWriterBMP.h index 759c183..3f9deb9 100644 --- a/src/dep/src/irrlicht/CImageWriterBMP.h +++ b/src/dep/src/irrlicht/CImageWriterBMP.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageWriterJPG.cpp b/src/dep/src/irrlicht/CImageWriterJPG.cpp index df7b12e..3adbc94 100644 --- a/src/dep/src/irrlicht/CImageWriterJPG.cpp +++ b/src/dep/src/irrlicht/CImageWriterJPG.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageWriterJPG.h b/src/dep/src/irrlicht/CImageWriterJPG.h index f44cd56..db4ffa5 100644 --- a/src/dep/src/irrlicht/CImageWriterJPG.h +++ b/src/dep/src/irrlicht/CImageWriterJPG.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageWriterPCX.cpp b/src/dep/src/irrlicht/CImageWriterPCX.cpp index d942e0b..ff0d3d0 100644 --- a/src/dep/src/irrlicht/CImageWriterPCX.cpp +++ b/src/dep/src/irrlicht/CImageWriterPCX.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageWriterPCX.h b/src/dep/src/irrlicht/CImageWriterPCX.h index 7cf09f1..152e7e6 100644 --- a/src/dep/src/irrlicht/CImageWriterPCX.h +++ b/src/dep/src/irrlicht/CImageWriterPCX.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageWriterPNG.cpp b/src/dep/src/irrlicht/CImageWriterPNG.cpp index 805d233..4bd80b9 100644 --- a/src/dep/src/irrlicht/CImageWriterPNG.cpp +++ b/src/dep/src/irrlicht/CImageWriterPNG.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageWriterPNG.h b/src/dep/src/irrlicht/CImageWriterPNG.h index 0b45ed8..133a59c 100644 --- a/src/dep/src/irrlicht/CImageWriterPNG.h +++ b/src/dep/src/irrlicht/CImageWriterPNG.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageWriterPPM.cpp b/src/dep/src/irrlicht/CImageWriterPPM.cpp index a686d9e..1de1789 100644 --- a/src/dep/src/irrlicht/CImageWriterPPM.cpp +++ b/src/dep/src/irrlicht/CImageWriterPPM.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageWriterPPM.h b/src/dep/src/irrlicht/CImageWriterPPM.h index 99a68a9..82a6ce8 100644 --- a/src/dep/src/irrlicht/CImageWriterPPM.h +++ b/src/dep/src/irrlicht/CImageWriterPPM.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageWriterPSD.cpp b/src/dep/src/irrlicht/CImageWriterPSD.cpp index 25c4d5b..42fb419 100644 --- a/src/dep/src/irrlicht/CImageWriterPSD.cpp +++ b/src/dep/src/irrlicht/CImageWriterPSD.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageWriterPSD.h b/src/dep/src/irrlicht/CImageWriterPSD.h index bf0be8d..b3cd238 100644 --- a/src/dep/src/irrlicht/CImageWriterPSD.h +++ b/src/dep/src/irrlicht/CImageWriterPSD.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageWriterTGA.cpp b/src/dep/src/irrlicht/CImageWriterTGA.cpp index 7016c67..da6d94f 100644 --- a/src/dep/src/irrlicht/CImageWriterTGA.cpp +++ b/src/dep/src/irrlicht/CImageWriterTGA.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CImageWriterTGA.h b/src/dep/src/irrlicht/CImageWriterTGA.h index 7f24338..983b8ef 100644 --- a/src/dep/src/irrlicht/CImageWriterTGA.h +++ b/src/dep/src/irrlicht/CImageWriterTGA.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CIrrDeviceLinux.cpp b/src/dep/src/irrlicht/CIrrDeviceLinux.cpp index c1254e1..a106f26 100644 --- a/src/dep/src/irrlicht/CIrrDeviceLinux.cpp +++ b/src/dep/src/irrlicht/CIrrDeviceLinux.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CIrrDeviceLinux.h b/src/dep/src/irrlicht/CIrrDeviceLinux.h index cfc44cc..0ca353b 100644 --- a/src/dep/src/irrlicht/CIrrDeviceLinux.h +++ b/src/dep/src/irrlicht/CIrrDeviceLinux.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CIrrDeviceSDL.cpp b/src/dep/src/irrlicht/CIrrDeviceSDL.cpp index 5e09c30..d5eb71d 100644 --- a/src/dep/src/irrlicht/CIrrDeviceSDL.cpp +++ b/src/dep/src/irrlicht/CIrrDeviceSDL.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -117,6 +117,10 @@ CIrrDeviceSDL::~CIrrDeviceSDL() for (u32 i=0; iOnResize(core::dimension2d(Width, Height)); @@ -593,6 +599,8 @@ void CIrrDeviceSDL::setResizeAble(bool resize) SDL_Flags |= SDL_RESIZABLE; else SDL_Flags &= ~SDL_RESIZABLE; + if (Screen) + SDL_FreeSurface(Screen); Screen = SDL_SetVideoMode( Width, Height, CreationParams.Bits, SDL_Flags ); Resizeable = resize; } diff --git a/src/dep/src/irrlicht/CIrrDeviceSDL.h b/src/dep/src/irrlicht/CIrrDeviceSDL.h index b6e87cb..2dcbf53 100644 --- a/src/dep/src/irrlicht/CIrrDeviceSDL.h +++ b/src/dep/src/irrlicht/CIrrDeviceSDL.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h // This device code is based on the original SDL device implementation diff --git a/src/dep/src/irrlicht/CIrrDeviceStub.cpp b/src/dep/src/irrlicht/CIrrDeviceStub.cpp index 87cd5f1..b420da2 100644 --- a/src/dep/src/irrlicht/CIrrDeviceStub.cpp +++ b/src/dep/src/irrlicht/CIrrDeviceStub.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CIrrDeviceStub.h b/src/dep/src/irrlicht/CIrrDeviceStub.h index 5e49475..8cc2c54 100644 --- a/src/dep/src/irrlicht/CIrrDeviceStub.h +++ b/src/dep/src/irrlicht/CIrrDeviceStub.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CIrrDeviceWin32.cpp b/src/dep/src/irrlicht/CIrrDeviceWin32.cpp index 33e3e95..3f0e22a 100644 --- a/src/dep/src/irrlicht/CIrrDeviceWin32.cpp +++ b/src/dep/src/irrlicht/CIrrDeviceWin32.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CIrrDeviceWin32.h b/src/dep/src/irrlicht/CIrrDeviceWin32.h index 0bb53c1..0eb6052 100644 --- a/src/dep/src/irrlicht/CIrrDeviceWin32.h +++ b/src/dep/src/irrlicht/CIrrDeviceWin32.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -96,12 +96,9 @@ namespace irr //! Changes the visible state of the mouse cursor. virtual void setVisible(bool visible) { - if(visible != IsVisible) - { - IsVisible = visible; - updateInternalCursorPosition(); - setPosition(CursorPos.X, CursorPos.Y); - } + IsVisible = visible; + updateInternalCursorPosition(); + setPosition(CursorPos.X, CursorPos.Y); } //! Returns if the cursor is currently visible. diff --git a/src/dep/src/irrlicht/CIrrDeviceWinCE.cpp b/src/dep/src/irrlicht/CIrrDeviceWinCE.cpp new file mode 100644 index 0000000..6085ba5 --- /dev/null +++ b/src/dep/src/irrlicht/CIrrDeviceWinCE.cpp @@ -0,0 +1,799 @@ +// Copyright (C) 2002-2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#include "IrrCompileConfig.h" + +#ifdef _IRR_USE_WINDOWS_CE_DEVICE_ + +#include "CIrrDeviceWinCE.h" +#include "IEventReceiver.h" +#include "irrList.h" +#include "os.h" + +#include "CTimer.h" +#include "irrString.h" +#include "COSOperator.h" +#include "dimension2d.h" +#include +#include "irrlicht.h" + +#ifdef _MSC_VER + #pragma comment (lib, "aygshell.lib") +#endif + + +namespace irr +{ + namespace video + { + #ifdef _IRR_COMPILE_WITH_DIRECT3D_8_ + IVideoDriver* createDirectX8Driver(const core::dimension2d& screenSize, HWND window, + u32 bits, bool fullscreen, bool stencilbuffer, io::IFileSystem* io, + bool pureSoftware, bool highPrecisionFPU, bool vsync, bool antiAlias); + #endif + + #ifdef _IRR_COMPILE_WITH_DIRECT3D_9_ + IVideoDriver* createDirectX9Driver(const core::dimension2d& screenSize, HWND window, + u32 bits, bool fullscreen, bool stencilbuffer, io::IFileSystem* io, + bool pureSoftware, bool highPrecisionFPU, bool vsync, bool antiAlias); + #endif + + #ifdef _IRR_COMPILE_WITH_OPENGL_ + IVideoDriver* createOpenGLDriver(const irr::SIrrlichtCreationParameters& params, io::IFileSystem* io); + #endif + } +} // end namespace irr + + + +struct SEnvMapper +{ + HWND hWnd; + irr::CIrrDeviceWinCE* irrDev; +}; + +irr::core::list EnvMap; + +SEnvMapper* getEnvMapperFromHWnd(HWND hWnd) +{ + irr::core::list::Iterator it = EnvMap.begin(); + for (; it!= EnvMap.end(); ++it) + if ((*it).hWnd == hWnd) + return &(*it); + + return 0; +} + +irr::CIrrDeviceWinCE* getDeviceFromHWnd(HWND hWnd) +{ + irr::core::list::Iterator it = EnvMap.begin(); + for (; it!= EnvMap.end(); ++it) + if ((*it).hWnd == hWnd) + return (*it).irrDev; + + return 0; +} + + +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + #ifndef WM_MOUSEWHEEL + #define WM_MOUSEWHEEL 0x020A + #endif + #ifndef WHEEL_DELTA + #define WHEEL_DELTA 120 + #endif + + irr::CIrrDeviceWinCE* dev = 0; + irr::SEvent event; + SEnvMapper* envm = 0; + + //BYTE allKeys[256]; + + static irr::s32 ClickCount=0; + if (GetCapture() != hWnd && ClickCount > 0) + ClickCount = 0; + + switch (message) + { + case WM_PAINT: + { + PAINTSTRUCT ps; + BeginPaint(hWnd, &ps); + EndPaint(hWnd, &ps); + } + return 0; + + case WM_ERASEBKGND: + return 0; + + case WM_SETCURSOR: + envm = getEnvMapperFromHWnd(hWnd); + if (envm && !envm->irrDev->getWin32CursorControl()->isVisible()) + { + SetCursor(NULL); + return 0; + } + break; + + case WM_MOUSEWHEEL: + event.EventType = irr::EET_MOUSE_INPUT_EVENT; + event.MouseInput.Wheel = ((irr::f32)((short)HIWORD(wParam))) / (irr::f32)WHEEL_DELTA; + event.MouseInput.Event = irr::EMIE_MOUSE_WHEEL; + + POINT p; // fixed by jox + p.x = 0; p.y = 0; + ClientToScreen(hWnd, &p); + event.MouseInput.X = LOWORD(lParam) - p.x; + event.MouseInput.Y = HIWORD(lParam) - p.y; + + dev = getDeviceFromHWnd(hWnd); + if (dev) + dev->postEventFromUser(event); + break; + + case WM_LBUTTONDOWN: + ClickCount++; + SetCapture(hWnd); + event.EventType = irr::EET_MOUSE_INPUT_EVENT; + event.MouseInput.Event = irr::EMIE_LMOUSE_PRESSED_DOWN; + event.MouseInput.X = (short)LOWORD(lParam); + event.MouseInput.Y = (short)HIWORD(lParam); + dev = getDeviceFromHWnd(hWnd); + if (dev) + dev->postEventFromUser(event); + return 0; + + case WM_LBUTTONUP: + ClickCount--; + if (ClickCount<1) + { + ClickCount=0; + ReleaseCapture(); + } + event.EventType = irr::EET_MOUSE_INPUT_EVENT; + event.MouseInput.Event = irr::EMIE_LMOUSE_LEFT_UP; + event.MouseInput.X = (short)LOWORD(lParam); + event.MouseInput.Y = (short)HIWORD(lParam); + dev = getDeviceFromHWnd(hWnd); + if (dev) + dev->postEventFromUser(event); + return 0; + + case WM_RBUTTONDOWN: + ClickCount++; + SetCapture(hWnd); + event.EventType = irr::EET_MOUSE_INPUT_EVENT; + event.MouseInput.Event = irr::EMIE_RMOUSE_PRESSED_DOWN; + event.MouseInput.X = (short)LOWORD(lParam); + event.MouseInput.Y = (short)HIWORD(lParam); + dev = getDeviceFromHWnd(hWnd); + if (dev) + dev->postEventFromUser(event); + return 0; + + case WM_RBUTTONUP: + ClickCount--; + if (ClickCount<1) + { + ClickCount=0; + ReleaseCapture(); + } + event.EventType = irr::EET_MOUSE_INPUT_EVENT; + event.MouseInput.Event = irr::EMIE_RMOUSE_LEFT_UP; + event.MouseInput.X = (short)LOWORD(lParam); + event.MouseInput.Y = (short)HIWORD(lParam); + dev = getDeviceFromHWnd(hWnd); + if (dev) + dev->postEventFromUser(event); + return 0; + + case WM_MBUTTONDOWN: + ClickCount++; + SetCapture(hWnd); + event.EventType = irr::EET_MOUSE_INPUT_EVENT; + event.MouseInput.Event = irr::EMIE_MMOUSE_PRESSED_DOWN; + event.MouseInput.X = (short)LOWORD(lParam); + event.MouseInput.Y = (short)HIWORD(lParam); + dev = getDeviceFromHWnd(hWnd); + if (dev) + dev->postEventFromUser(event); + return 0; + + case WM_MBUTTONUP: + ClickCount--; + if (ClickCount<1) + { + ClickCount=0; + ReleaseCapture(); + } + event.EventType = irr::EET_MOUSE_INPUT_EVENT; + event.MouseInput.Event = irr::EMIE_MMOUSE_LEFT_UP; + event.MouseInput.X = (short)LOWORD(lParam); + event.MouseInput.Y = (short)HIWORD(lParam); + dev = getDeviceFromHWnd(hWnd); + if (dev) + dev->postEventFromUser(event); + return 0; + + case WM_MOUSEMOVE: + event.EventType = irr::EET_MOUSE_INPUT_EVENT; + event.MouseInput.Event = irr::EMIE_MOUSE_MOVED; + event.MouseInput.X = (short)LOWORD(lParam); + event.MouseInput.Y = (short)HIWORD(lParam); + dev = getDeviceFromHWnd(hWnd); + + if (dev) + dev->postEventFromUser(event); + + return 0; + + case WM_KEYDOWN: + case WM_KEYUP: + { + event.EventType = irr::EET_KEY_INPUT_EVENT; + event.KeyInput.Key = (irr::EKEY_CODE)wParam; + event.KeyInput.PressedDown = (message==WM_KEYDOWN); + dev = getDeviceFromHWnd(hWnd); +/* + WORD KeyAsc=0; + GetKeyboardState(allKeys); + ToAscii(wParam,lParam,allKeys,&KeyAsc,0); +*/ +// event.KeyInput.Shift = ((allKeys[VK_SHIFT] & 0x80)!=0); +// event.KeyInput.Control = ((allKeys[VK_CONTROL] & 0x80)!=0); +// event.KeyInput.Char = (KeyAsc & 0x00ff); //KeyAsc >= 0 ? KeyAsc : 0; + + if (dev) + dev->postEventFromUser(event); + + return 0; + } + + case WM_SIZE: + { + // resize + dev = getDeviceFromHWnd(hWnd); + if (dev) + dev->OnResized(); + } + return 0; + + case WM_DESTROY: + PostQuitMessage(0); + return 0; + + } + + return DefWindowProc(hWnd, message, wParam, lParam); +} + +namespace irr +{ + +//! constructor +CIrrDeviceWinCE::CIrrDeviceWinCE(const SIrrlichtCreationParameters& params) +: CIrrDeviceStub(params), HWnd(0), + Win32CursorControl(0), ChangedToFullScreen(false), Resized(false), + ExternalWindow(false) +{ + #ifdef _DEBUG + setDebugName("CIrrDeviceWinCE"); + #endif + + core::stringc winversion; + getWindowsVersion(winversion); + Operator = new COSOperator(winversion.c_str()); + os::Printer::log(winversion.c_str(), ELL_INFORMATION); + + HINSTANCE hInstance = GetModuleHandle(0); + + // create the window only if we do not use the null device + if (!CreationParams.WindowId && (CreationParams.DriverType != video::EDT_NULL)) + { + const wchar_t* ClassName = L"CIrrDeviceWinCE"; + + // Register Class + WNDCLASS wc; + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = (WNDPROC)WndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInstance; + wc.hIcon = NULL; + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wc.lpszMenuName = 0; + wc.lpszClassName = ClassName; + + // if there is an icon, load it + wc.hIcon = (HICON)LoadImageW(hInstance, L"irrlicht.ico", IMAGE_ICON, 0,0, 0); + + RegisterClass(&wc); + + // calculate client size + + RECT clientSize; + clientSize.top = 0; + clientSize.left = 0; + clientSize.right = CreationParams.WindowSize.Width; + clientSize.bottom = CreationParams.WindowSize.Height; + + DWORD style = WS_POPUP; + + if (!CreationParams.Fullscreen) + style = WS_SYSMENU | WS_BORDER | WS_CAPTION | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; + + AdjustWindowRectEx(&clientSize, style, FALSE, 0); + + const s32 realWidth = clientSize.right - clientSize.left; + const s32 realHeight = clientSize.bottom - clientSize.top; + + const s32 windowLeft = core::s32_max ( 0, (GetSystemMetrics(SM_CXSCREEN) - realWidth) >> 1 ); + const s32 windowTop = core::s32_max ( 0, (GetSystemMetrics(SM_CYSCREEN) - realHeight) >> 1 ); + + // create window + + HWnd = CreateWindowW( ClassName, L"", style, windowLeft, windowTop, + realWidth, realHeight, NULL, NULL, hInstance, NULL); + + ShowWindow(HWnd , SW_SHOW); + UpdateWindow(HWnd); + + // fix ugly ATI driver bugs. Thanks to ariaci + MoveWindow(HWnd, windowLeft, windowTop, realWidth, realHeight, TRUE); + } + else if (CreationParams.WindowId) + { + // attach external window + HWnd = static_cast(CreationParams.WindowId); + RECT r; + GetWindowRect(HWnd, &r); + CreationParams.WindowSize.Width = r.right - r.left; + CreationParams.WindowSize.Height = r.bottom - r.top; + CreationParams.Fullscreen = false; + ExternalWindow = true; + } + + // create cursor control + + Win32CursorControl = new CCursorControl(CreationParams.WindowSize, HWnd, CreationParams.Fullscreen); + CursorControl = Win32CursorControl; + + // create driver + + createDriver(); + + if (VideoDriver) + createGUIAndScene(); + + // register environment + + SEnvMapper em; + em.irrDev = this; + em.hWnd = HWnd; + EnvMap.push_back(em); + + // set this as active window + SetActiveWindow(HWnd); + SetForegroundWindow(HWnd); +} + + +//! destructor +CIrrDeviceWinCE::~CIrrDeviceWinCE() +{ + // unregister environment + + if (ChangedToFullScreen) + SHFullScreen(HWnd, SHFS_SHOWTASKBAR | SHFS_SHOWSTARTICON | SHFS_SHOWSIPBUTTON); + + irr::core::list::Iterator it = EnvMap.begin(); + for (; it!= EnvMap.end(); ++it) + if ((*it).hWnd == HWnd) + { + EnvMap.erase(it); + break; + } +} + + +//! create the driver +void CIrrDeviceWinCE::createDriver() +{ + switch(CreationParams.DriverType) + { + case video::EDT_DIRECT3D8: + #ifdef _IRR_COMPILE_WITH_DIRECT3D_8_ + VideoDriver = video::createDirectX8Driver(CreationParams.WindowSize, HWnd, CreationParams.Bits, CreationParams.Fullscreen, + CreationParams.Stencilbuffer, FileSystem, false, CreationParams.HighPrecisionFPU, CreationParams.Vsync, CreationParams.AntiAlias); + if (!VideoDriver) + { + os::Printer::log("Could not create DIRECT3D8 Driver.", ELL_ERROR); + } + #else + os::Printer::log("DIRECT3D8 Driver was not compiled into this dll. Try another one.", ELL_ERROR); + #endif // _IRR_COMPILE_WITH_DIRECT3D_8_ + + break; + + case video::EDT_DIRECT3D9: + #ifdef _IRR_COMPILE_WITH_DIRECT3D_9_ + VideoDriver = video::createDirectX9Driver(CreationParams.WindowSize, HWnd, CreationParams.Bits, CreationParams.Fullscreen, + CreationParams.Stencilbuffer, FileSystem, false, CreationParams.HighPrecisionFPU, CreationParams.Vsync, CreationParams.AntiAlias); + if (!VideoDriver) + { + os::Printer::log("Could not create DIRECT3D9 Driver.", ELL_ERROR); + } + #else + os::Printer::log("DIRECT3D9 Driver was not compiled into this dll. Try another one.", ELL_ERROR); + #endif // _IRR_COMPILE_WITH_DIRECT3D_9_ + + break; + + case video::EDT_OPENGL: + + #ifdef _IRR_COMPILE_WITH_OPENGL_ + if (CreationParams.Fullscreen) + switchToFullScreen(); + VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem); + if (!VideoDriver) + { + os::Printer::log("Could not create OpenGL driver.", ELL_ERROR); + } + #else + os::Printer::log("OpenGL driver was not compiled in.", ELL_ERROR); + #endif + break; + + case video::EDT_SOFTWARE: + + #ifdef _IRR_COMPILE_WITH_SOFTWARE_ + if (CreationParams.Fullscreen) + switchToFullScreen(); + VideoDriver = video::createSoftwareDriver(CreationParams.WindowSize, CreationParams.Fullscreen, FileSystem, this); + #else + os::Printer::log("Software driver was not compiled in.", ELL_ERROR); + #endif + + break; + + case video::EDT_BURNINGSVIDEO: + #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_ + if (CreationParams.Fullscreen) + switchToFullScreen(); + VideoDriver = video::createSoftwareDriver2(CreationParams.WindowSize, CreationParams.Fullscreen, FileSystem, this); + #else + os::Printer::log("Burning's Video driver was not compiled in.", ELL_ERROR); + #endif + break; + + case video::EDT_NULL: + // create null driver + VideoDriver = video::createNullDriver(FileSystem, CreationParams.WindowSize); + break; + + default: + os::Printer::log("Unable to create video driver of unknown type.", ELL_ERROR); + break; + } +} + + +//! runs the device. Returns false if device wants to be deleted +bool CIrrDeviceWinCE::run() +{ + os::Timer::tick(); + + MSG msg; + + bool quit = false; + + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + { + TranslateMessage(&msg); + + if (ExternalWindow && msg.hwnd == HWnd) + WndProc(HWnd, msg.message, msg.wParam, msg.lParam); + else + DispatchMessage(&msg); + + if (msg.message == WM_QUIT) + quit = true; + } + + if (!quit) + resizeIfNecessary(); + + _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; + return !quit; +} + + +//! Pause the current process for the minimum time allowed only to allow other processes to execute +void CIrrDeviceWinCE::yield() +{ + Sleep(1); +} + + +//! Pause execution and let other processes to run for a specified amount of time. +void CIrrDeviceWinCE::sleep(u32 timeMs, bool pauseTimer) +{ + const bool wasStopped = Timer ? Timer->isStopped() : true; + if (pauseTimer && !wasStopped) + Timer->stop(); + + Sleep(timeMs); + + if (pauseTimer && !wasStopped) + Timer->start(); +} + + +void CIrrDeviceWinCE::resizeIfNecessary() +{ + if (!Resized) + return; + + RECT r; + GetClientRect(HWnd, &r); + + char tmp[255]; + + if (r.right < 2 || r.bottom < 2) + { + sprintf(tmp, "Ignoring resize operation to (%ld %ld)", r.right, r.bottom); + os::Printer::log(tmp); + } + else + { + sprintf(tmp, "Resizing window (%ld %ld)", r.right, r.bottom); + os::Printer::log(tmp); + + getVideoDriver()->OnResize(irr::core::dimension2d(r.right, r.bottom)); + } + + Resized = false; +} + + +//! sets the caption of the window +void CIrrDeviceWinCE::setWindowCaption(const wchar_t* text) +{ + SetWindowTextW(HWnd, text); +} + + +#if !defined(BITMAPV4HEADER) +typedef struct { + DWORD bV4Size; + LONG bV4Width; + LONG bV4Height; + WORD bV4Planes; + WORD bV4BitCount; + DWORD bV4V4Compression; + DWORD bV4SizeImage; + LONG bV4XPelsPerMeter; + LONG bV4YPelsPerMeter; + DWORD bV4ClrUsed; + DWORD bV4ClrImportant; + DWORD bV4RedMask; + DWORD bV4GreenMask; + DWORD bV4BlueMask; + DWORD bV4AlphaMask; + DWORD bV4CSType; + DWORD un[9]; +} BITMAPV4HEADER, *PBITMAPV4HEADER; +#endif + + +//! presents a surface in the client area +bool CIrrDeviceWinCE::present(video::IImage* image, void* windowId, core::rect* src) +{ + HWND hwnd = HWnd; + if ( windowId ) + hwnd = (HWND)windowId; + + HDC dc = GetDC(hwnd); + + if ( dc ) + { + RECT rect; + GetClientRect(hwnd, &rect); + const void* memory = (const void *)image->lock(); + + BITMAPV4HEADER bi; + memset (&bi, 0, sizeof(bi)); + bi.bV4Size = sizeof(BITMAPINFOHEADER); + bi.bV4BitCount = image->getBitsPerPixel(); + bi.bV4Planes = 1; + bi.bV4Width = image->getDimension().Width; + bi.bV4Height = -image->getDimension().Height; + bi.bV4V4Compression = BI_BITFIELDS; + bi.bV4AlphaMask = image->getAlphaMask (); + bi.bV4RedMask = image->getRedMask (); + bi.bV4GreenMask = image->getGreenMask(); + bi.bV4BlueMask = image->getBlueMask(); + + int r = 0; + if ( src ) + { + r = StretchDIBits(dc, 0,0, rect.right, rect.bottom, + src->UpperLeftCorner.X, src->UpperLeftCorner.Y, + src->getWidth(), src->getHeight(), + memory, (const BITMAPINFO*)(&bi), DIB_RGB_COLORS, SRCCOPY); + } + else + { + r = StretchDIBits(dc, 0,0, rect.right, rect.bottom, + 0, 0, image->getDimension().Width, image->getDimension().Height, + memory, (const BITMAPINFO*)(&bi), DIB_RGB_COLORS, SRCCOPY); + } + + image->unlock(); + + ReleaseDC(hwnd, dc); + } + return true; +} + + +//! notifies the device that it should close itself +void CIrrDeviceWinCE::closeDevice() +{ + MSG msg; + PeekMessage(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE); + PostQuitMessage(0); + PeekMessage(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE); + DestroyWindow(HWnd); +} + + +//! returns if window is active. if not, nothing need to be drawn +bool CIrrDeviceWinCE::isWindowActive() const +{ + bool ret = (GetActiveWindow() == HWnd); + _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; + return ret; +} + + +//! returns if window has focus +bool CIrrDeviceWinCE::isWindowFocused() const +{ + bool ret = (GetFocus() == HWnd); + _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; + return ret; +} + + +//! returns if window is minimized +bool CIrrDeviceWinCE::isWindowMinimized() const +{ +#if 0 + WINDOWPLACEMENT plc; + plc.length=sizeof(WINDOWPLACEMENT); + bool ret=false; + if (GetWindowPlacement(HWnd,&plc)) + ret=(plc.showCmd & SW_SHOWMINIMIZED); + _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; + return ret; +#endif + return false; +} + + +//! switches to fullscreen +bool CIrrDeviceWinCE::switchToFullScreen() +{ + ChangedToFullScreen = SHFullScreen(HWnd, SHFS_HIDESIPBUTTON | SHFS_HIDETASKBAR) != 0; + return ChangedToFullScreen; +} + + +//! returns the win32 cursor control +CIrrDeviceWinCE::CCursorControl* CIrrDeviceWinCE::getWin32CursorControl() +{ + return Win32CursorControl; +} + + +//! Return pointer to a list with all video modes supported by the gfx adapter. +/** \return Pointer to video modes list */ +video::IVideoModeList* CIrrDeviceWinCE::getVideoModeList() +{ + if (!VideoModeList.getVideoModeCount()) + { + // enumerate video modes. + DWORD i=0; + DEVMODE mode; + memset(&mode, 0, sizeof(mode)); + mode.dmSize = sizeof(mode); + + while (EnumDisplaySettings(NULL, i, &mode)) + { + VideoModeList.addMode(core::dimension2d(mode.dmPelsWidth, mode.dmPelsHeight), + mode.dmBitsPerPel); + + ++i; + } + + if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &mode)) + VideoModeList.setDesktop(mode.dmBitsPerPel, core::dimension2d(mode.dmPelsWidth, mode.dmPelsHeight)); + } + + return &VideoModeList; +} + + +void CIrrDeviceWinCE::getWindowsVersion(core::stringc& out) +{ + out = "WinCE"; +} + + +//! Notifies the device, that it has been resized +void CIrrDeviceWinCE::OnResized() +{ + Resized = true; +} + + +//! Sets if the window should be resizeable in windowed mode. +void CIrrDeviceWinCE::setResizeAble(bool resize) +{ + if (ExternalWindow || !getVideoDriver() || CreationParams.Fullscreen) + return; + + LONG style = WS_POPUP; + + if (!resize) + style = WS_SYSMENU | WS_BORDER | WS_CAPTION | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; + else + style = WS_THICKFRAME | WS_SYSMENU | WS_CAPTION | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_MAXIMIZEBOX; + + if (!SetWindowLong(HWnd, GWL_STYLE, style)) + os::Printer::log("Could not change window style."); + + RECT clientSize; + clientSize.top = 0; + clientSize.left = 0; + clientSize.right = getVideoDriver()->getScreenSize().Width; + clientSize.bottom = getVideoDriver()->getScreenSize().Height; + + AdjustWindowRectEx(&clientSize, style, FALSE, 0); + + const s32 realWidth = clientSize.right - clientSize.left; + const s32 realHeight = clientSize.bottom - clientSize.top; + + const s32 windowLeft = (GetSystemMetrics(SM_CXSCREEN) - realWidth) / 2; + const s32 windowTop = (GetSystemMetrics(SM_CYSCREEN) - realHeight) / 2; + + SetWindowPos(HWnd, HWND_TOP, windowLeft, windowTop, realWidth, realHeight, + SWP_FRAMECHANGED | SWP_NOMOVE | SWP_SHOWWINDOW); +} + + +IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx( + const SIrrlichtCreationParameters& parameters) +{ + CIrrDeviceWinCE* dev = new CIrrDeviceWinCE(parameters); + + if (dev && !dev->getVideoDriver() && parameters.DriverType != video::EDT_NULL) + { + dev->closeDevice(); // destroy window + dev->run(); // consume quit message + dev->drop(); + dev = 0; + } + + return dev; +} + + +} // end namespace + +#endif // _IRR_USE_WINDOWS_CE_DEVICE_ + diff --git a/src/dep/src/irrlicht/CIrrDeviceWinCE.h b/src/dep/src/irrlicht/CIrrDeviceWinCE.h new file mode 100644 index 0000000..a96272e --- /dev/null +++ b/src/dep/src/irrlicht/CIrrDeviceWinCE.h @@ -0,0 +1,261 @@ +// Copyright (C) 2002-2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#ifndef __C_IRR_DEVICE_WINCE_H_INCLUDED__ +#define __C_IRR_DEVICE_WINCE_H_INCLUDED__ + +#include "IrrCompileConfig.h" +#ifdef _IRR_USE_WINDOWS_CE_DEVICE_ + +#include "CIrrDeviceStub.h" +#include "IrrlichtDevice.h" +#include "IImagePresenter.h" + +#include +#include +#include +#include +#include +#include + +namespace irr +{ + class CIrrDeviceWinCE : public CIrrDeviceStub, video::IImagePresenter + { + public: + + //! constructor + CIrrDeviceWinCE( const SIrrlichtCreationParameters& params); + + //! destructor + virtual ~CIrrDeviceWinCE(); + + //! runs the device. Returns false if device wants to be deleted + virtual bool run(); + + //! Cause the device to temporarily pause execution and let other processes to run + // This should bring down processor usage without major performance loss for Irrlicht + virtual void yield(); + + //! Pause execution and let other processes to run for a specified amount of time. + virtual void sleep(u32 timeMs, bool pauseTimer); + + //! sets the caption of the window + virtual void setWindowCaption(const wchar_t* text); + + //! returns if window is active. if not, nothing need to be drawn + virtual bool isWindowActive() const; + + //! returns if window has focus + virtual bool isWindowFocused() const; + + //! returns if window is minimized + virtual bool isWindowMinimized() const; + + //! presents a surface in the client area + virtual bool present(video::IImage* surface, void* windowId = 0, core::rect* src=0 ); + + //! notifies the device that it should close itself + virtual void closeDevice(); + + //! \return Returns a pointer to a list with all video modes + //! supported by the gfx adapter. + video::IVideoModeList* getVideoModeList(); + + //! Notifies the device, that it has been resized + void OnResized(); + + //! Sets if the window should be resizeable in windowed mode. + virtual void setResizeAble(bool resize=false); + + //! Implementation of the win32 cursor control + class CCursorControl : public gui::ICursorControl + { + public: + + CCursorControl(const core::dimension2d& wsize, HWND hwnd, bool fullscreen) + : WindowSize(wsize), InvWindowSize(0.0f, 0.0f), IsVisible(true), + HWnd(hwnd), BorderX(0), BorderY(0), UseReferenceRect(false) + { + if (WindowSize.Width!=0) + InvWindowSize.Width = 1.0f / WindowSize.Width; + + if (WindowSize.Height!=0) + InvWindowSize.Height = 1.0f / WindowSize.Height; + + if (!fullscreen) + { + BorderX = GetSystemMetrics(SM_CXDLGFRAME); + BorderY = GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYDLGFRAME); + } + } + + //! Changes the visible state of the mouse cursor. + virtual void setVisible(bool visible) + { + IsVisible = visible; + } + + //! Returns if the cursor is currently visible. + virtual bool isVisible() const + { + _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; + return IsVisible; + } + + //! Sets the new position of the cursor. + virtual void setPosition(const core::position2d &pos) + { + setPosition(pos.X, pos.Y); + } + + //! Sets the new position of the cursor. + virtual void setPosition(f32 x, f32 y) + { + if (!UseReferenceRect) + setPosition((s32)(x*WindowSize.Width), (s32)(y*WindowSize.Height)); + else + setPosition((s32)(x*ReferenceRect.getWidth()), (s32)(y*ReferenceRect.getHeight())); + } + + //! Sets the new position of the cursor. + virtual void setPosition(const core::position2d &pos) + { + setPosition(pos.X, pos.Y); + } + + //! Sets the new position of the cursor. + virtual void setPosition(s32 x, s32 y) + { + RECT rect; + + if (UseReferenceRect) + { + SetCursorPos(ReferenceRect.UpperLeftCorner.X + x, + ReferenceRect.UpperLeftCorner.Y + y); + } + else + { + if (GetWindowRect(HWnd, &rect)) + SetCursorPos(x + rect.left + BorderX, y + rect.top + BorderY); + } + + CursorPos.X = x; + CursorPos.Y = y; + } + + //! Returns the current position of the mouse cursor. + virtual core::position2d getPosition() + { + updateInternalCursorPosition(); + return CursorPos; + } + + //! Returns the current position of the mouse cursor. + virtual core::position2d getRelativePosition() + { + updateInternalCursorPosition(); + + if (!UseReferenceRect) + { + return core::position2d(CursorPos.X * InvWindowSize.Width, + CursorPos.Y * InvWindowSize.Height); + } + + return core::position2d(CursorPos.X / (f32)ReferenceRect.getWidth(), + CursorPos.Y / (f32)ReferenceRect.getHeight()); + } + + //! Sets an absolute reference rect for calculating the cursor position. + virtual void setReferenceRect(core::rect* rect=0) + { + if (rect) + { + ReferenceRect = *rect; + UseReferenceRect = true; + + // prevent division through zero and uneven sizes + + if (!ReferenceRect.getHeight() || ReferenceRect.getHeight()%2) + ReferenceRect.LowerRightCorner.Y += 1; + + if (!ReferenceRect.getWidth() || ReferenceRect.getWidth()%2) + ReferenceRect.LowerRightCorner.X += 1; + } + else + UseReferenceRect = false; + } + + private: + + //! Updates the internal cursor position + void updateInternalCursorPosition() + { + POINT p; + GetCursorPos(&p); + RECT rect; + + if (UseReferenceRect) + { + CursorPos.X = p.x - ReferenceRect.UpperLeftCorner.X; + CursorPos.Y = p.y - ReferenceRect.UpperLeftCorner.Y; + } + else + { + if (GetWindowRect(HWnd, &rect)) + { + CursorPos.X = p.x-rect.left-BorderX; + CursorPos.Y = p.y-rect.top-BorderY; + } + else + { + // window seems not to be existent, so set cursor to + // a negative value + CursorPos.X = -1; + CursorPos.Y = -1; + } + } + } + + core::position2d CursorPos; + core::dimension2d WindowSize; + core::dimension2d InvWindowSize; + bool IsVisible; + HWND HWnd; + + s32 BorderX, BorderY; + bool UseReferenceRect; + core::rect ReferenceRect; + }; + + + //! returns the win32 cursor control + CCursorControl* getWin32CursorControl(); + + private: + + //! create the driver + void createDriver(); + + //! switchs to fullscreen + bool switchToFullScreen(); + + void getWindowsVersion(core::stringc& version); + + void resizeIfNecessary(); + + HWND HWnd; + CCursorControl* Win32CursorControl; + + bool ChangedToFullScreen; + bool Resized; + bool ExternalWindow; + }; + + +} // end namespace irr + +#endif +#endif + diff --git a/src/dep/src/irrlicht/CIrrMeshFileLoader.cpp b/src/dep/src/irrlicht/CIrrMeshFileLoader.cpp index 0bba98a..eeafa6d 100644 --- a/src/dep/src/irrlicht/CIrrMeshFileLoader.cpp +++ b/src/dep/src/irrlicht/CIrrMeshFileLoader.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CIrrMeshFileLoader.h b/src/dep/src/irrlicht/CIrrMeshFileLoader.h index abcff37..099a6b4 100644 --- a/src/dep/src/irrlicht/CIrrMeshFileLoader.h +++ b/src/dep/src/irrlicht/CIrrMeshFileLoader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CIrrMeshWriter.cpp b/src/dep/src/irrlicht/CIrrMeshWriter.cpp index 451a959..87b813c 100644 --- a/src/dep/src/irrlicht/CIrrMeshWriter.cpp +++ b/src/dep/src/irrlicht/CIrrMeshWriter.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CIrrMeshWriter.h b/src/dep/src/irrlicht/CIrrMeshWriter.h index 94cf6f3..d3b8f41 100644 --- a/src/dep/src/irrlicht/CIrrMeshWriter.h +++ b/src/dep/src/irrlicht/CIrrMeshWriter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CLMTSMeshFileLoader.cpp b/src/dep/src/irrlicht/CLMTSMeshFileLoader.cpp index dff5d0b..310dea1 100644 --- a/src/dep/src/irrlicht/CLMTSMeshFileLoader.cpp +++ b/src/dep/src/irrlicht/CLMTSMeshFileLoader.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h // This file was written by Jonas Petersen and modified by Nikolaus Gebhardt. diff --git a/src/dep/src/irrlicht/CLMTSMeshFileLoader.h b/src/dep/src/irrlicht/CLMTSMeshFileLoader.h index 8d17e53..b1868f9 100644 --- a/src/dep/src/irrlicht/CLMTSMeshFileLoader.h +++ b/src/dep/src/irrlicht/CLMTSMeshFileLoader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h // diff --git a/src/dep/src/irrlicht/CLWOMeshFileLoader.cpp b/src/dep/src/irrlicht/CLWOMeshFileLoader.cpp new file mode 100644 index 0000000..4bd9ab1 --- /dev/null +++ b/src/dep/src/irrlicht/CLWOMeshFileLoader.cpp @@ -0,0 +1,1790 @@ +// Copyright (C) 2002-2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#include "CLWOMeshFileLoader.h" +#include "os.h" +#include "SAnimatedMesh.h" +#include "SMesh.h" +#include "IReadFile.h" +#include "ISceneManager.h" +#include "IFileSystem.h" +#include "IVideoDriver.h" +#include "IMeshManipulator.h" + +using namespace std; + +namespace irr +{ +namespace scene +{ + +#ifdef _DEBUG +#define LWO_READER_DEBUG +#endif + +#define charsToUIntD(a, b, c, d) ((a << 24) | (b << 16) | (c << 8) | d) +inline unsigned int charsToUInt(const char *str) +{ + return (str[0] << 24) | (str[1] << 16) | (str[2] << 8) | str[3]; +} + + +struct tLWOTextureInfo +{ + tLWOTextureInfo() : Flags(0), WidthWrap(2), HeightWrap(2), OpacType(0), + Color(0xffffffff), Value(0.0f), AntiAliasing(1.0f), + Opacity(1.0f), TCoords(0), Active(false) {}; + core::stringc Type; + core::stringc Map; + core::stringc AlphaMap; + u16 Flags; + u16 WidthWrap; + u16 HeightWrap; + u16 OpacType; + u16 IParam[3]; + core::vector3df Size; + core::vector3df Center; + core::vector3df Falloff; + core::vector3df Velocity; + video::SColor Color; + f32 Value; + f32 AntiAliasing; + f32 Opacity; + f32 FParam[3]; + core::array* TCoords; + bool Active; +}; + +struct CLWOMeshFileLoader::tLWOMaterial +{ + tLWOMaterial() : Meshbuffer(0), TagType(0), Flags(0), ReflMode(3), TranspMode(3), + Glow(0), AlphaMode(2), Luminance(0.0f), Diffuse(1.0f), Specular(0.0f), + Reflection(0.0f), Transparency(0.0f), Translucency(0.0f), + Sharpness(0.0f), ReflSeamAngle(0.0f), ReflBlur(0.0f), + RefrIndex(1.0f), TranspBlur(0.0f), SmoothingAngle(0.0f), + EdgeTransparency(0.0f), HighlightColor(0.0f), ColorFilter(0.0f), + AdditiveTransparency(0.0f), GlowIntensity(0.0f), GlowSize(0.0f), + AlphaValue(0.0f), VertexColorIntensity(0.0f), VertexColor() {}; + + core::stringc Name; + scene::SMeshBuffer *Meshbuffer; + core::stringc ReflMap; + u16 TagType; + u16 Flags; + u16 ReflMode; + u16 TranspMode; + u16 Glow; + u16 AlphaMode; + f32 Luminance; + f32 Diffuse; + f32 Specular; + f32 Reflection; + f32 Transparency; + f32 Translucency; + f32 Sharpness; + f32 ReflSeamAngle; + f32 ReflBlur; + f32 RefrIndex; + f32 TranspBlur; + f32 SmoothingAngle; + f32 EdgeTransparency; + f32 HighlightColor; + f32 ColorFilter; + f32 AdditiveTransparency; + f32 GlowIntensity; + f32 GlowSize; + f32 AlphaValue; + f32 VertexColorIntensity; + video::SColorf VertexColor; + u32 Envelope[23]; + tLWOTextureInfo Texture[7]; +}; + +struct tLWOLayerInfo +{ + u16 Number; + u16 Parent; + u16 Flags; + bool Active; + core::stringc Name; + core::vector3df Pivot; +}; + + +//! Constructor +CLWOMeshFileLoader::CLWOMeshFileLoader(scene::ISceneManager* smgr, + io::IFileSystem* fs) +: SceneManager(smgr), FileSystem(fs), File(0), Mesh(0) +{ + #ifdef _DEBUG + setDebugName("CLWOMeshFileLoader"); + #endif +} + + +//! destructor +CLWOMeshFileLoader::~CLWOMeshFileLoader() +{ + if (Mesh) + Mesh->drop(); +} + + +//! returns true if the file maybe is able to be loaded by this class +//! based on the file extension (e.g. ".bsp") +bool CLWOMeshFileLoader::isALoadableFileExtension(const c8* filename) const +{ + return strstr(filename, ".lwo")!=0; +} + + + +//! creates/loads an animated mesh from the file. +//! \return Pointer to the created mesh. Returns 0 if loading failed. +//! If you no longer need the mesh, you should call IAnimatedMesh::drop(). +//! See IUnknown::drop() for more information. +IAnimatedMesh* CLWOMeshFileLoader::createMesh(io::IReadFile* file) +{ + File = file; + + if (Mesh) + Mesh->drop(); + + Mesh = new SMesh(); + + if (!readFileHeader()) + return false; + + if (!readChunks()) + return false; + + SAnimatedMesh* am = new SAnimatedMesh(); + am->Type = EAMT_3DS; + + for (u32 polyIndex=0; polyIndexMeshbuffer; + const s32 vertCount=mb->Vertices.size(); + const core::array& poly = Indices[polyIndex]; + const u32 polySize=poly.size(); + video::S3DVertex vertex; + for (u32 i=0; iTexture[0].TCoords && (Materials[tag]->Texture[0].TCoords->size()>0)) + vertex.TCoords=(*Materials[tag]->Texture[0].TCoords)[j]; + mb->Vertices.push_back(vertex); + } + if (polySize>2) + { + for (u32 i=1; iVertices[vertCount].Pos,mb->Vertices[vertCount+i].Pos,mb->Vertices[vertCount+i+1].Pos).Normal.normalize(); + mb->Vertices[vertCount].Normal=normal; + mb->Vertices[vertCount+i].Normal=normal; + mb->Vertices[vertCount+i+1].Normal=normal; + mb->Indices.push_back(vertCount); + mb->Indices.push_back(vertCount+i); + mb->Indices.push_back(vertCount+i+1); + } + } + } + for (u32 i=0; iMeshbuffer->Vertices.size(); ++j) + Materials[i]->Meshbuffer->Vertices[j].Color=Materials[i]->Meshbuffer->Material.DiffuseColor; + Materials[i]->Meshbuffer->recalculateBoundingBox(); + if (Materials[i]->Meshbuffer->Material.MaterialType==video::EMT_NORMAL_MAP_SOLID) + { + SMesh tmpmesh; + tmpmesh.addMeshBuffer(Materials[i]->Meshbuffer); + SceneManager->getMeshManipulator()->createMeshWithTangents(&tmpmesh); + Mesh->addMeshBuffer(tmpmesh.getMeshBuffer(0)); + } + else + Mesh->addMeshBuffer(Materials[i]->Meshbuffer); + Mesh->getMeshBuffer(Mesh->getMeshBufferCount()-1)->drop(); + } + + Mesh->recalculateBoundingBox(); + + am->addMesh(Mesh); + am->recalculateBoundingBox(); + Mesh->drop(); + Mesh = 0; + + Points.clear(); + Indices.clear(); + MaterialMapping.clear(); + VMap.clear(); + TCoords.clear(); + Materials.clear(); + Images.clear(); + + return am; +} + + +bool CLWOMeshFileLoader::readChunks() +{ + s32 lastPos; + u32 size; + unsigned int uiType; + char type[5]; + type[4]=0; + tLWOLayerInfo layer; + + while(File->getPos()getSize()) + { + File->read(&type, 4); + //Convert 4-char string to 4-byte integer + //Makes it possible to do a switch statement + uiType = charsToUInt(type); + File->read(&size, 4); +#ifndef __BIG_ENDIAN__ + size=os::Byteswap::byteswap(size); +#endif + lastPos=File->getPos(); + + switch(uiType) + { + case charsToUIntD('L','A','Y','R'): + { +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading layer."); +#endif + u16 tmp16; + File->read(&tmp16, 2); // number + File->read(&tmp16, 2); // flags + size -= 4; +#ifndef __BIG_ENDIAN__ + tmp16=os::Byteswap::byteswap(tmp16); +#endif + if (((FormatVersion==1)&&(tmp16!=1)) || + ((FormatVersion==2)&&(tmp16&1))) + layer.Active=false; + else + layer.Active=true; + if (FormatVersion==2) + size -= readVec(layer.Pivot); + size -= readString(layer.Name); + if (size) + { + File->read(&tmp16, 2); +#ifndef __BIG_ENDIAN__ + tmp16=os::Byteswap::byteswap(tmp16); +#endif + layer.Parent = tmp16; + } + } + break; + case charsToUIntD('P','N','T','S'): + { +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading points."); +#endif + core::vector3df vec; + Points.clear(); + const u32 tmpsize = size/12; + Points.reallocate(tmpsize); + for (u32 i=0; iName=""; + mat->Meshbuffer=new scene::SMeshBuffer(); + size -= readString(mat->Name); + if (FormatVersion!=2) + mat->TagType = 1; // format 2 has more types + Materials.push_back(mat); + } + } + break; + case charsToUIntD('P','T','A','G'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading tag mapping."); +#endif + readTagMapping(size); + break; +// case charsToUIntD('V','M','A','D'): // dicontinuous vertex mapping, i.e. additional texcoords +// case charsToUIntD('V','M','P','A'): +// case charsToUIntD('E','N','V','L'): +// break; + case charsToUIntD('C','L','I','P'): + { +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading clips."); +#endif + u32 index; + u16 subsize; + File->read(&index, 4); +#ifndef __BIG_ENDIAN__ + index=os::Byteswap::byteswap(index); +#endif + size -= 4; + while (size != 0) + { + File->read(&type, 4); + File->read(&subsize, 2); +#ifndef __BIG_ENDIAN__ + subsize=os::Byteswap::byteswap(subsize); +#endif + size -= 6; + if (strncmp(type, "STIL", 4)) + { + File->seek(subsize, true); + size -= subsize; + continue; + } + core::stringc path; + size -= readString(path, subsize); + #ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loaded clip", path.c_str()); + #endif + Images.push_back(path); + } + } + break; + case charsToUIntD('S','U','R','F'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading material."); +#endif + readMat(size); + break; + case charsToUIntD('B','B','O','X'): + { +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading bbox."); +#endif + // not stored + core::vector3df vec; + for (u32 i=0; i<2; ++i) + readVec(vec); + size -= 24; + } + break; + case charsToUIntD('D','E','S','C'): + case charsToUIntD('T','E','X','T'): + { +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading text."); +#endif + core::stringc text; + size -= readString(text, size); + } + break; + // not needed + case charsToUIntD('I','C','O','N'): + // not yet supported + case charsToUIntD('P','C','H','S'): + case charsToUIntD('C','R','V','S'): + default: +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: skipping ", type); +#endif + //Go to next chunk + File->seek(lastPos + size, false); + break; + } + } + return true; +} + + +void CLWOMeshFileLoader::readObj1(u32 size) +{ + u32 pos; + u16 numVerts, vertIndex; + s16 material; + video::S3DVertex vertex; + + while (size!=0) + { + File->read(&numVerts, 2); +#ifndef __BIG_ENDIAN__ + numVerts=os::Byteswap::byteswap(numVerts); +#endif + pos=File->getPos(); + File->seek(2*numVerts, true); + File->read(&material, 2); +#ifndef __BIG_ENDIAN__ + material=os::Byteswap::byteswap(material); +#endif + size -=2*numVerts+4; + // detail meshes ? + scene::SMeshBuffer *mb; + if (material<0) + mb=Materials[-material-1]->Meshbuffer; + else + mb=Materials[material-1]->Meshbuffer; + File->seek(pos, false); + + u16 vertCount=mb->Vertices.size(); + for (u16 i=0; iread(&vertIndex, 2); +#ifndef __BIG_ENDIAN__ + vertIndex=os::Byteswap::byteswap(vertIndex); +#endif + vertex.Pos=Points[vertIndex]; + mb->Vertices.push_back(vertex); + } + for (u16 i=1; iVertices[vertCount].Pos,mb->Vertices[vertCount+i].Pos,mb->Vertices[vertCount+i+1].Pos).Normal.normalize(); + mb->Vertices[vertCount].Normal=normal; + mb->Vertices[vertCount+i].Normal=normal; + mb->Vertices[vertCount+i+1].Normal=normal; + mb->Indices.push_back(vertCount); + mb->Indices.push_back(vertCount+i); + mb->Indices.push_back(vertCount+i+1); + } + // skip material number and detail surface count + if (material<0) + File->read(&material, 2); + File->read(&material, 2); + } +} + +void CLWOMeshFileLoader::readVertexMapping(u32 size) +{ + char type[5]; + type[4]=0; + u16 dimension; + core::stringc name; + File->read(&type, 4); +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: Vertex map type", type); +#endif + File->read(&dimension, 2); +#ifndef __BIG_ENDIAN__ + dimension=os::Byteswap::byteswap(dimension); +#endif + size -= 6; + size -= readString(name); +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: Vertex map", name.c_str()); +#endif + if (strncmp(type, "TXUV", 4)) // also support RGB, RGBA, WGHT, ... + { + File->seek(size, true); + return; + } + VMap.insert(name,TCoords.size()); + TCoords.push_back(core::array()); + + u32 index; + core::vector2df tcoord; + core::array& tcArray = TCoords.getLast(); + tcArray.set_used(Points.size()); + while (size!=0) + { + size -= readVX(index); + File->read(&tcoord.X, 4); +#ifndef __BIG_ENDIAN__ + tcoord.X=os::Byteswap::byteswap(tcoord.X); +#endif + File->read(&tcoord.Y, 4); +#ifndef __BIG_ENDIAN__ + tcoord.Y=os::Byteswap::byteswap(tcoord.Y); +#endif + tcoord.Y=tcoord.Y; + tcArray[index]=tcoord; + size -= 8; + } +} + +void CLWOMeshFileLoader::readTagMapping(u32 size) +{ + char type[5]; + type[4]=0; + File->read(&type, 4); + size -= 4; + if ((strncmp(type, "SURF", 4))||(Indices.size()==0)) + { + File->seek(size, true); + return; + } + + while (size!=0) + { + u16 tag; + u32 polyIndex; + size-=readVX(polyIndex); + File->read(&tag, 2); +#ifndef __BIG_ENDIAN__ + tag=os::Byteswap::byteswap(tag); +#endif + size -= 2; + MaterialMapping[polyIndex]=tag; + Materials[tag]->TagType=1; + } +} + +void CLWOMeshFileLoader::readObj2(u32 size) +{ + char type[5]; + type[4]=0; + File->read(&type, 4); + size -= 4; + Indices.clear(); + if (strncmp(type, "FACE", 4)) // also possible are splines, subdivision patches, metaballs, and bones + { + File->seek(size, true); + return; + } + u16 numVerts=0; + while (size!=0) + { + File->read(&numVerts, 2); +#ifndef __BIG_ENDIAN__ + numVerts=os::Byteswap::byteswap(numVerts); +#endif + // mask out flags + numVerts &= 0x03FF; + + size -= 2; + Indices.push_back(core::array()); + u32 vertIndex; + core::array& polyArray = Indices.getLast(); + polyArray.reallocate(numVerts); + for (u16 i=0; iTagType==1) && (Materials[i]->Name==name)) + { + mat=Materials[i]; + break; + } + } + if (!mat) + { + File->seek(size, true); + return; + } + if (FormatVersion==2) + size -= readString(name); + + video::SMaterial *irrMat=&mat->Meshbuffer->Material; + + u8 currTexture=0; + while (size!=0) + { + char type[5]; + type[4]=0; + u32 uiType; + u32 tmp32; + u16 subsize, tmp16; + f32 tmpf32; + File->read(&type, 4); + //Convert 4-char string to 4-byte integer + //Makes it possible to do a switch statement + uiType = charsToUInt(type); + File->read(&subsize, 2); +#ifndef __BIG_ENDIAN__ + subsize=os::Byteswap::byteswap(subsize); +#endif + size -= 6; + switch (uiType) + { + case charsToUIntD('C','O','L','R'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading Ambient color."); +#endif + { + s32 colSize = readColor(irrMat->DiffuseColor); + irrMat->AmbientColor=irrMat->DiffuseColor; + size -= colSize; + subsize -= colSize; + if (FormatVersion==2) + size -= readVX(mat->Envelope[0]); + } + break; + case charsToUIntD('D','I','F','F'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading Diffuse color."); +#endif + { + if (FormatVersion==2) + { + File->read(&mat->Diffuse, 4); +#ifndef __BIG_ENDIAN__ + mat->Diffuse=os::Byteswap::byteswap(mat->Diffuse); +#endif + size -= 4; + subsize -= 4; + size -= readVX(mat->Envelope[1]); + } + else + { + File->read(&tmp16, 2); +#ifndef __BIG_ENDIAN__ + tmp16=os::Byteswap::byteswap(tmp16); +#endif + mat->Diffuse=tmp16/256.0f; + size -= 2; + subsize -= 2; + } + } + break; + case charsToUIntD('V','D','I','F'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading Diffuse color."); +#endif + { + File->read(&mat->Diffuse, 4); +#ifndef __BIG_ENDIAN__ + mat->Diffuse=os::Byteswap::byteswap(mat->Diffuse); +#endif + size -= 4; + } + break; + case charsToUIntD('L','U','M','I'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading luminance."); +#endif + { + if (FormatVersion==2) + { + File->read(&mat->Luminance, 4); +#ifndef __BIG_ENDIAN__ + mat->Luminance=os::Byteswap::byteswap(mat->Luminance); +#endif + size -= 4; + subsize -= 4; + size -= readVX(mat->Envelope[2]); + } + else + { + File->read(&tmp16, 2); +#ifndef __BIG_ENDIAN__ + tmp16=os::Byteswap::byteswap(tmp16); +#endif + mat->Luminance=tmp16/256.0f; + size -= 2; + subsize -= 2; + } } + break; + case charsToUIntD('V','L','U','M'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading luminance."); +#endif + { + File->read(&mat->Luminance, 4); +#ifndef __BIG_ENDIAN__ + mat->Luminance=os::Byteswap::byteswap(mat->Luminance); +#endif + size -= 4; + } + break; + case charsToUIntD('S','P','E','C'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading specular."); +#endif + { + if (FormatVersion==2) + { + File->read(&mat->Specular, 4); +#ifndef __BIG_ENDIAN__ + mat->Specular=os::Byteswap::byteswap(mat->Specular); +#endif + size -= 4; + subsize -= 4; + size -= readVX(mat->Envelope[3]); + } + else + { + File->read(&tmp16, 2); +#ifndef __BIG_ENDIAN__ + tmp16=os::Byteswap::byteswap(tmp16); +#endif + mat->Specular=tmp16/256.0f;; + size -= 2; + subsize -= 2; + } + } + break; + case charsToUIntD('V','S','P','C'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading specular."); +#endif + { + File->read(&mat->Specular, 4); +#ifndef __BIG_ENDIAN__ + mat->Specular=os::Byteswap::byteswap(mat->Specular); +#endif + size -= 4; + } + break; + case charsToUIntD('R','E','F','L'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading reflection."); +#endif + { + if (FormatVersion==2) + { + File->read(&mat->Reflection, 4); +#ifndef __BIG_ENDIAN__ + mat->Reflection=os::Byteswap::byteswap(mat->Reflection); +#endif + size -= 4; + subsize -= 4; + size -= readVX(mat->Envelope[4]); + } + else + { + File->read(&tmp16, 2); +#ifndef __BIG_ENDIAN__ + tmp16=os::Byteswap::byteswap(tmp16); +#endif + mat->Reflection=tmp16/256.0f; + size -= 2; + subsize -= 2; + } + } + break; + case charsToUIntD('V','R','F','L'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading reflection."); +#endif + { + File->read(&mat->Reflection, 4); +#ifndef __BIG_ENDIAN__ + mat->Reflection=os::Byteswap::byteswap(mat->Reflection); +#endif + size -= 4; + } + break; + case charsToUIntD('T','R','A','N'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading transparency."); +#endif + { + if (FormatVersion==2) + { + File->read(&mat->Transparency, 4); +#ifndef __BIG_ENDIAN__ + mat->Transparency=os::Byteswap::byteswap(mat->Transparency); +#endif + size -= 4; + subsize -= 4; + size -= readVX(mat->Envelope[5]); + } + else + { + File->read(&tmp16, 2); +#ifndef __BIG_ENDIAN__ + tmp16=os::Byteswap::byteswap(tmp16); +#endif + mat->Transparency=tmp16/256.0f; + size -= 2; + subsize -= 2; + } + } + break; + case charsToUIntD('V','T','R','N'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading transparency."); +#endif + { + File->read(&mat->Transparency, 4); +#ifndef __BIG_ENDIAN__ + mat->Transparency=os::Byteswap::byteswap(mat->Transparency); +#endif + size -= 4; + } + break; + case charsToUIntD('T','R','N','L'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading translucency."); +#endif + { + File->read(&mat->Translucency, 4); +#ifndef __BIG_ENDIAN__ + mat->Translucency=os::Byteswap::byteswap(mat->Translucency); +#endif + size -= 4; + subsize -= 4; + if (FormatVersion==2) + size -= readVX(mat->Envelope[6]); + } + break; + case charsToUIntD('G','L','O','S'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading glossy."); +#endif + { + if (FormatVersion == 2) + { + File->read(&irrMat->Shininess, 4); +#ifndef __BIG_ENDIAN__ + irrMat->Shininess=os::Byteswap::byteswap(irrMat->Shininess); +#endif + size -= 4; + subsize -= 4; + size -= readVX(mat->Envelope[7]); + } + else + { + File->read(&tmp16, 2); +#ifndef __BIG_ENDIAN__ + tmp16=os::Byteswap::byteswap(tmp16); +#endif + irrMat->Shininess=tmp16/16.f; + size -= 2; + subsize -= 2; + } + } + break; + case charsToUIntD('S','H','R','P'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading sharpness."); +#endif + { + File->read(&mat->Sharpness, 4); +#ifndef __BIG_ENDIAN__ + mat->Sharpness=os::Byteswap::byteswap(mat->Sharpness); +#endif + size -= 4; + subsize -= 4; + if (FormatVersion==2) + size -= readVX(mat->Envelope[8]); + } + break; + case charsToUIntD('B','U','M','P'): + case charsToUIntD('T','A','M','P'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading bumpiness."); +#endif + { + File->read(&tmpf32, 4); +#ifndef __BIG_ENDIAN__ + tmpf32=os::Byteswap::byteswap(tmpf32); +#endif + if (currTexture==6) + irrMat->MaterialTypeParam=tmpf32; + size -= 4; + subsize -= 4; + if (FormatVersion==2) + size -= readVX(mat->Envelope[9]); + } + break; + case charsToUIntD('S','I','D','E'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading backface culled."); +#endif + { + File->read(&tmp16, 2); +#ifndef __BIG_ENDIAN__ + tmp16=os::Byteswap::byteswap(tmp16); +#endif + if (tmp16==1) + irrMat->BackfaceCulling=true; + if (tmp16==3) + irrMat->BackfaceCulling=false; + size -= 2; + } + break; + case charsToUIntD('S','M','A','N'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading smoothing angle."); +#endif + { + File->read(&mat->SmoothingAngle, 4); +#ifndef __BIG_ENDIAN__ + mat->SmoothingAngle=os::Byteswap::byteswap(mat->SmoothingAngle); +#endif + size -= 4; + } + break; + case charsToUIntD('R','F','O','P'): + case charsToUIntD('R','F','L','T'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading reflection mode."); +#endif + { + File->read(&mat->ReflMode, 2); +#ifndef __BIG_ENDIAN__ + mat->ReflMode=os::Byteswap::byteswap(mat->ReflMode); +#endif + size -= 2; + } + break; + case charsToUIntD('R','I','M','G'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading reflection map."); +#endif + { + if (FormatVersion==2) + { + size -= readVX(tmp32); + if (tmp32) + mat->ReflMap=Images[tmp32-1]; + } + else + size -= readString(mat->ReflMap, size); + } + break; + case charsToUIntD('R','S','A','N'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading reflection seam angle."); +#endif + { + File->read(&mat->ReflSeamAngle, 4); +#ifndef __BIG_ENDIAN__ + mat->ReflSeamAngle=os::Byteswap::byteswap(mat->ReflSeamAngle); +#endif + size -= 4; + if (FormatVersion==2) + size -= readVX(mat->Envelope[10]); + } + break; + case charsToUIntD('R','B','L','R'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading reflection blur."); +#endif + { + File->read(&mat->ReflBlur, 4); +#ifndef __BIG_ENDIAN__ + mat->ReflBlur=os::Byteswap::byteswap(mat->ReflBlur); +#endif + size -= 4; + if (FormatVersion==2) + size -= readVX(mat->Envelope[11]); + } + break; + case charsToUIntD('R','I','N','D'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading refraction index."); +#endif + { + File->read(&mat->RefrIndex, 4); +#ifndef __BIG_ENDIAN__ + mat->RefrIndex=os::Byteswap::byteswap(mat->RefrIndex); +#endif + size -= 4; + subsize -= 4; + if (FormatVersion==2) + size -= readVX(mat->Envelope[12]); + } + break; + case charsToUIntD('T','R','O','P'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading transparency mode."); +#endif + { + File->read(&mat->TranspMode, 2); +#ifndef __BIG_ENDIAN__ + mat->TranspMode=os::Byteswap::byteswap(mat->TranspMode); +#endif + size -= 2; + } + break; + case charsToUIntD('T','I','M','G'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading refraction map."); +#endif + { + if (FormatVersion==2) + { + size -= readVX(tmp32); +#ifndef __BIG_ENDIAN__ + tmp32=os::Byteswap::byteswap(tmp32); +#endif + if (tmp32) + mat->Texture[currTexture].Map=Images[tmp32-1]; + } + else + size -= readString(mat->Texture[currTexture].Map, size); + } + break; + case charsToUIntD('T','B','L','R'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading transparency blur."); +#endif + { + File->read(&mat->TranspBlur, 4); +#ifndef __BIG_ENDIAN__ + mat->TranspBlur=os::Byteswap::byteswap(mat->TranspBlur); +#endif + size -= 4; + if (FormatVersion==2) + size -= readVX(mat->Envelope[13]); + } + break; + case charsToUIntD('C','L','R','H'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading highlight color."); +#endif + { + File->read(&mat->HighlightColor, 4); +#ifndef __BIG_ENDIAN__ + mat->HighlightColor=os::Byteswap::byteswap(mat->HighlightColor); +#endif + size -= 4; + if (FormatVersion==2) + size -= readVX(mat->Envelope[14]); + } + break; + case charsToUIntD('C','L','R','F'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading color filter."); +#endif + { + File->read(&mat->ColorFilter, 4); +#ifndef __BIG_ENDIAN__ + mat->ColorFilter=os::Byteswap::byteswap(mat->ColorFilter); +#endif + size -= 4; + if (FormatVersion==2) + size -= readVX(mat->Envelope[15]); + } + break; + case charsToUIntD('A','D','T','R'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading additive transparency."); +#endif + { + File->read(&mat->AdditiveTransparency, 4); +#ifndef __BIG_ENDIAN__ + mat->AdditiveTransparency=os::Byteswap::byteswap(mat->AdditiveTransparency); +#endif + size -= 4; + if (FormatVersion==2) + size -= readVX(mat->Envelope[16]); + } + break; + case charsToUIntD('G','L','O','W'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading glow."); +#endif + { + File->read(&mat->Glow, 2); +#ifndef __BIG_ENDIAN__ + mat->Glow=os::Byteswap::byteswap(mat->Glow); +#endif + size -= 2; + File->read(&mat->GlowIntensity, 4); +#ifndef __BIG_ENDIAN__ + mat->GlowIntensity=os::Byteswap::byteswap(mat->GlowIntensity); +#endif + size -= 4; + if (FormatVersion==2) + size -= readVX(mat->Envelope[17]); + File->read(&mat->GlowSize, 4); +#ifndef __BIG_ENDIAN__ + mat->GlowSize=os::Byteswap::byteswap(mat->GlowSize); +#endif + size -= 4; + if (FormatVersion==2) + size -= readVX(mat->Envelope[18]); + } + break; + case charsToUIntD('G','V','A','L'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading glow intensity."); +#endif + { + File->read(&mat->GlowIntensity, 4); +#ifndef __BIG_ENDIAN__ + mat->GlowIntensity=os::Byteswap::byteswap(mat->GlowIntensity); +#endif + size -= 4; + if (FormatVersion==2) + size -= readVX(mat->Envelope[17]); + } + break; + case charsToUIntD('L','I','N','E'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading isWireframe."); +#endif + { + File->read(&tmp16, 2); +#ifndef __BIG_ENDIAN__ + tmp16=os::Byteswap::byteswap(tmp16); +#endif + if (tmp16&1) + irrMat->Wireframe=true; + size -= 2; + if (size!=0) + { + File->read(&irrMat->Thickness, 4); +#ifndef __BIG_ENDIAN__ + irrMat->Thickness=os::Byteswap::byteswap(irrMat->Thickness); +#endif + size -= 4; + if (FormatVersion==2) + size -= readVX(mat->Envelope[19]); + } + if (size!=0) + { + video::SColor lineColor; + size -= readColor(lineColor); + if (FormatVersion==2) + size -= readVX(mat->Envelope[20]); + } + } + break; + case charsToUIntD('A','L','P','H'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading alpha mode."); +#endif + { + File->read(&mat->AlphaMode, 2); +#ifndef __BIG_ENDIAN__ + mat->AlphaMode=os::Byteswap::byteswap(mat->AlphaMode); +#endif + size -= 2; + File->read(&mat->AlphaValue, 4); +#ifndef __BIG_ENDIAN__ + mat->AlphaValue=os::Byteswap::byteswap(mat->AlphaValue); +#endif + size -= 4; + } + break; + case charsToUIntD('V','C','O','L'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading vertex color."); +#endif + { + File->read(&mat->VertexColorIntensity, 4); +#ifndef __BIG_ENDIAN__ + mat->VertexColorIntensity=os::Byteswap::byteswap(mat->VertexColorIntensity); +#endif + size -= 4; + if (FormatVersion==2) + size -= readVX(mat->Envelope[21]); + File->read(&tmp32, 4); // skip type + size -= 4; + core::stringc tmpname; + size -= readString(tmpname, size); +// mat->VertexColor = getColorVMAP(tmpname); + } + break; + case charsToUIntD('F','L','A','G'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading flag."); +#endif + { + File->read(&mat->Flags, 2); +#ifndef __BIG_ENDIAN__ + mat->Flags=os::Byteswap::byteswap(mat->Flags); +#endif + if (mat->Flags&1) + mat->Luminance=1.0f; + if (mat->Flags&256) + irrMat->BackfaceCulling=false; + size -= 2; + } + break; + case charsToUIntD('E','D','G','E'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading edge."); +#endif + { + File->read(&mat->EdgeTransparency, 4); +#ifndef __BIG_ENDIAN__ + mat->EdgeTransparency=os::Byteswap::byteswap(mat->EdgeTransparency); +#endif + size -= 4; + } + break; + case charsToUIntD('C','T','E','X'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading ctex."); +#endif + currTexture=0; + size -= readString(mat->Texture[currTexture].Type, size); + break; + case charsToUIntD('D','T','E','X'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading dtex."); +#endif + currTexture=1; + size -= readString(mat->Texture[currTexture].Type, size); + break; + case charsToUIntD('S','T','E','X'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading stex."); +#endif + currTexture=2; + size -= readString(mat->Texture[currTexture].Type, size); + break; + case charsToUIntD('R','T','E','X'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading rtex."); +#endif + currTexture=3; + size -= readString(mat->Texture[currTexture].Type, size); + break; + case charsToUIntD('T','T','E','X'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading ttex."); +#endif + currTexture=4; + size -= readString(mat->Texture[currTexture].Type, size); + break; + case charsToUIntD('L','T','E','X'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading ltex."); +#endif + currTexture=5; + size -= readString(mat->Texture[currTexture].Type, size); + break; + case charsToUIntD('B','T','E','X'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading btex."); +#endif + currTexture=6; + size -= readString(mat->Texture[currTexture].Type, size); + break; + case charsToUIntD('T','A','L','P'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading alpha map."); +#endif + size -= readString(mat->Texture[currTexture].AlphaMap, size); + break; + case charsToUIntD('T','F','L','G'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading texture flag."); +#endif + { + File->read(&mat->Texture[currTexture].Flags, 2); +#ifndef __BIG_ENDIAN__ + mat->Texture[currTexture].Flags=os::Byteswap::byteswap(mat->Texture[currTexture].Flags); +#endif + size -= 2; + } + break; + case charsToUIntD('E','N','A','B'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading isEnabled."); +#endif + { + File->read(&tmp16, 2); +#ifndef __BIG_ENDIAN__ + tmp16=os::Byteswap::byteswap(tmp16); +#endif + mat->Texture[currTexture].Active=(tmp16!=0); + size -= 2; + } + break; + case charsToUIntD('W','R','A','P'): + case charsToUIntD('T','W','R','P'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading texture wrap."); +#endif + { + File->read(&mat->Texture[currTexture].WidthWrap, 2); +#ifndef __BIG_ENDIAN__ + mat->Texture[currTexture].WidthWrap=os::Byteswap::byteswap(mat->Texture[currTexture].WidthWrap); +#endif + File->read(&mat->Texture[currTexture].HeightWrap, 2); +#ifndef __BIG_ENDIAN__ + mat->Texture[currTexture].HeightWrap=os::Byteswap::byteswap(mat->Texture[currTexture].HeightWrap); +#endif + size -= 4; + } + break; + case charsToUIntD('T','S','I','Z'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading texture size."); +#endif + size -= readVec(mat->Texture[currTexture].Size); + break; + case charsToUIntD('T','C','T','R'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading texture center."); +#endif + size -= readVec(mat->Texture[currTexture].Center); + break; + case charsToUIntD('T','F','A','L'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading texture falloff."); +#endif + size -= readVec(mat->Texture[currTexture].Falloff); + break; + case charsToUIntD('T','V','E','L'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading texture velocity."); +#endif + size -= readVec(mat->Texture[currTexture].Velocity); + break; + case charsToUIntD('T','C','L','R'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading texture color."); +#endif + size -= readColor(mat->Texture[currTexture].Color); + break; + case charsToUIntD('A','A','S','T'): + case charsToUIntD('T','A','A','S'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading texture antialias."); +#endif + { + tmp16=0; + if (FormatVersion==2) + { + File->read(&tmp16, 2); +#ifndef __BIG_ENDIAN__ + tmp16=os::Byteswap::byteswap(tmp16); +#endif + size -= 2; + } + File->read(&mat->Texture[currTexture].AntiAliasing, 4); +#ifndef __BIG_ENDIAN__ + mat->Texture[currTexture].AntiAliasing=os::Byteswap::byteswap(mat->Texture[currTexture].AntiAliasing); +#endif + if (tmp16 & ~0x01) + mat->Texture[currTexture].AntiAliasing=0.0f; // disabled + size -= 4; + } + break; + case charsToUIntD('T','O','P','C'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading texture opacity."); +#endif + { + File->read(&mat->Texture[currTexture].Opacity, 4); +#ifndef __BIG_ENDIAN__ + mat->Texture[currTexture].Opacity=os::Byteswap::byteswap(mat->Texture[currTexture].Opacity); +#endif + size -= 4; + } + break; + case charsToUIntD('O','P','A','C'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading texture opacity and type."); +#endif + { + File->read(&mat->Texture[currTexture].OpacType, 2); +#ifndef __BIG_ENDIAN__ + mat->Texture[currTexture].OpacType=os::Byteswap::byteswap(mat->Texture[currTexture].OpacType); +#endif + File->read(&mat->Texture[currTexture].Opacity, 4); +#ifndef __BIG_ENDIAN__ + mat->Texture[currTexture].Opacity=os::Byteswap::byteswap(mat->Texture[currTexture].Opacity); +#endif + size -= 6; + subsize -= 6; + if (FormatVersion==2) + size -= readVX(mat->Envelope[22]); + } + break; + case charsToUIntD('T','V','A','L'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading texture value."); +#endif + { + File->read(&tmp16, 2); +#ifndef __BIG_ENDIAN__ + tmp16=os::Byteswap::byteswap(tmp16); +#endif + mat->Texture[currTexture].Value=tmp16/256.0f; + size -= 2; + } + break; + case charsToUIntD('T','F','P','0'): + case charsToUIntD('T','S','P','0'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading texture param 0."); +#endif + { + File->read(&mat->Texture[currTexture].FParam[0], 4); +#ifndef __BIG_ENDIAN__ + mat->Texture[currTexture].FParam[0]=os::Byteswap::byteswap(mat->Texture[currTexture].FParam[0]); +#endif + size -= 4; + } + break; + case charsToUIntD('T','F','P','1'): + case charsToUIntD('T','S','P','1'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading texture param 1."); +#endif + { + File->read(&mat->Texture[currTexture].FParam[1], 4); +#ifndef __BIG_ENDIAN__ + mat->Texture[currTexture].FParam[1]=os::Byteswap::byteswap(mat->Texture[currTexture].FParam[1]); +#endif + size -= 4; + } + break; + case charsToUIntD('T','F','P','2'): + case charsToUIntD('T','S','P','2'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading texture param 2."); +#endif + { + File->read(&mat->Texture[currTexture].FParam[2], 4); +#ifndef __BIG_ENDIAN__ + mat->Texture[currTexture].FParam[2]=os::Byteswap::byteswap(mat->Texture[currTexture].FParam[2]); +#endif + size -= 4; + } + break; + case charsToUIntD('T','F','R','Q'): + case charsToUIntD('T','I','P','0'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading texture iparam 0."); +#endif + { + File->read(&mat->Texture[currTexture].IParam[0], 2); +#ifndef __BIG_ENDIAN__ + mat->Texture[currTexture].IParam[0]=os::Byteswap::byteswap(mat->Texture[currTexture].IParam[0]); +#endif + size -= 2; + } + break; + case charsToUIntD('T','I','P','1'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading texture param 1."); +#endif + { + File->read(&mat->Texture[currTexture].IParam[1], 2); +#ifndef __BIG_ENDIAN__ + mat->Texture[currTexture].IParam[1]=os::Byteswap::byteswap(mat->Texture[currTexture].IParam[1]); +#endif + size -= 2; + } + break; + case charsToUIntD('T','I','P','2'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading texture param 2."); +#endif + { + File->read(&mat->Texture[currTexture].IParam[2], 2); +#ifndef __BIG_ENDIAN__ + mat->Texture[currTexture].IParam[2]=os::Byteswap::byteswap(mat->Texture[currTexture].IParam[2]); +#endif + size -= 2; + } + break; + case charsToUIntD('V','M','A','P'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading material vmap binding."); +#endif + { + core::stringc tmpname; + size -= readString(tmpname); + if (VMap.find(tmpname) != 0) + mat->Texture[currTexture].TCoords = &TCoords[VMap.find(tmpname)->getValue()]; + } + break; + case charsToUIntD('B','L','O','K'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading blok."); +#endif + { + core::stringc ordinal; + File->read(&type, 4); + File->read(&subsize, 2); +#ifndef __BIG_ENDIAN__ + subsize=os::Byteswap::byteswap(subsize); +#endif + size -= 6; + size -= readString(ordinal, size); + } + break; + case charsToUIntD('C','H','A','N'): + { + File->read(&type, 4); + size -= 4; + if (!strncmp(type, "COLR", 4)) + currTexture=0; + else if (!strncmp(type, "DIFF", 4)) + currTexture=1; + else if (!strncmp(type, "LUMI", 4)) + currTexture=5; + else if (!strncmp(type, "SPEC", 4)) + currTexture=2; + else if (!strncmp(type, "REFL", 4)) + currTexture=3; + else if (!strncmp(type, "TRAN", 4)) + currTexture=4; + else if (!strncmp(type, "BUMP", 4)) + currTexture=6; + } +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading channel ", type); +#endif + break; + case charsToUIntD('I','M','A','G'): +#ifdef LWO_READER_DEBUG + os::Printer::log("LWO loader: loading channel map."); +#endif + { + u16 index; + File->read(&index, 2); +#ifndef __BIG_ENDIAN__ + index=os::Byteswap::byteswap(index); +#endif + size -= 2; + if (index) + mat->Texture[currTexture].Map=Images[index-1]; + } + break; + default: + { + File->seek(subsize, true); + size -= subsize; + } + } + } + + if (mat->Texture[0].Map != "") // diffuse + irrMat->setTexture(0,loadTexture(mat->Texture[0].Map)); + if (mat->Texture[3].Map != "") // reflection + { + video::ITexture* reflTexture = loadTexture(mat->Texture[3].Map); + if (reflTexture) + { + irrMat->setTexture(1, irrMat->getTexture(0)); + irrMat->setTexture(0, reflTexture); + irrMat->MaterialType=video::EMT_REFLECTION_2_LAYER; + } + } + if (mat->Texture[4].Map != "") // transparency + { + video::ITexture* transTexture = loadTexture(mat->Texture[4].Map); + if (transTexture) + { + irrMat->setTexture(1, irrMat->getTexture(0)); + irrMat->setTexture(0, transTexture); + irrMat->MaterialType=video::EMT_TRANSPARENT_ADD_COLOR; + } + } + if (mat->Texture[6].Map != "") // bump + { + irrMat->setTexture(1, loadTexture(mat->Texture[6].Map)); + if (irrMat->getTexture(1)) + { +// SceneManager->getVideoDriver()->makeNormalMapTexture(irrMat->getTexture(1)); + irrMat->MaterialType=video::EMT_NORMAL_MAP_SOLID; + } + } +} + + +u32 CLWOMeshFileLoader::readColor(video::SColor& color) +{ + if (FormatVersion!=2) + { + u8 colorComponent; + File->read(&colorComponent, 1); + color.setRed(colorComponent); + File->read(&colorComponent, 1); + color.setGreen(colorComponent); + File->read(&colorComponent, 1); + color.setBlue(colorComponent); + // unknown value + File->read(&colorComponent, 1); + return 4; + } + else + { + video::SColorf col; + File->read(&col.r, 4); +#ifndef __BIG_ENDIAN__ + col.r=os::Byteswap::byteswap(col.r); +#endif + File->read(&col.g, 4); +#ifndef __BIG_ENDIAN__ + col.g=os::Byteswap::byteswap(col.g); +#endif + File->read(&col.b, 4); +#ifndef __BIG_ENDIAN__ + col.b=os::Byteswap::byteswap(col.b); +#endif + color=col.toSColor(); + return 12; + } +} + +u32 CLWOMeshFileLoader::readString(core::stringc& name, u32 size) +{ + c8 c; + + name=""; + if (size) + name.reserve(size); + File->read(&c, 1); + while (c) + { + name.append(c); + File->read(&c, 1); + } + // read extra 0 upon odd file position + if (File->getPos() & 0x1) + { + File->read(&c, 1); + return (name.size()+2); + } + return (name.size()+1); +} + + +u32 CLWOMeshFileLoader::readVec(core::vector3df& vec) +{ + File->read(&vec.X, 4); +#ifndef __BIG_ENDIAN__ + vec.X=os::Byteswap::byteswap(vec.X); +#endif + File->read(&vec.Y, 4); +#ifndef __BIG_ENDIAN__ + vec.Y=os::Byteswap::byteswap(vec.Y); +#endif + File->read(&vec.Z, 4); +#ifndef __BIG_ENDIAN__ + vec.Z=os::Byteswap::byteswap(vec.Z); +#endif + return 12; +} + + +u32 CLWOMeshFileLoader::readVX(u32& num) +{ + u16 tmpIndex; + + File->read(&tmpIndex, 2); +#ifndef __BIG_ENDIAN__ + tmpIndex=os::Byteswap::byteswap(tmpIndex); +#endif + num=tmpIndex; + if (num >= 0xFF00) + { + File->read(&tmpIndex, 2); +#ifndef __BIG_ENDIAN__ + tmpIndex=os::Byteswap::byteswap(tmpIndex); +#endif + num=((num << 16)|tmpIndex) & ~0xFF000000; + return 4; + } + return 2; +} + + +bool CLWOMeshFileLoader::readFileHeader() +{ + u32 Id; + + File->read(&Id, 4); +#ifndef __BIG_ENDIAN__ + Id=os::Byteswap::byteswap(Id); +#endif + if (Id != 0x464f524d) // FORM + return false; + + //skip the file length + File->read(&Id, 4); + + File->read(&Id, 4); +#ifndef __BIG_ENDIAN__ + Id=os::Byteswap::byteswap(Id); +#endif + // Currently supported: LWOB, LWLO, LWO2 + switch (Id) + { + case 0x4c574f42: + FormatVersion = 0; // LWOB + break; + case 0x4c574c4f: + FormatVersion = 1; // LWLO + break; + case 0x4c574f32: + FormatVersion = 2; // LWO2 + break; + default: + return false; // unsupported + } + + return true; +} + + +video::ITexture* CLWOMeshFileLoader::loadTexture(const core::stringc& file) +{ + video::IVideoDriver* driver = SceneManager->getVideoDriver(); + + if (FileSystem->existFile(file.c_str())) + return driver->getTexture(file.c_str()); + + core::stringc strippedName; + s32 stringPos = file.findLast('/'); + if (stringPos==-1) + stringPos = file.findLast('\\'); + if (stringPos != -1) + { + strippedName = file.subString(stringPos+1, file.size()-stringPos); + if (FileSystem->existFile(strippedName.c_str())) + return driver->getTexture(strippedName.c_str()); + } + else + strippedName = file; + core::stringc newpath = File->getFileName(); + stringPos = newpath.findLast('/'); + if (stringPos==-1) + stringPos = newpath.findLast('\\'); + if (stringPos != -1) + { + newpath = newpath.subString(0,stringPos+1); + newpath.append(strippedName); + if (FileSystem->existFile(newpath.c_str())) + return driver->getTexture(newpath.c_str()); + } + os::Printer::log("Could not load texture", file.c_str(), ELL_WARNING); + + return 0; +} + + +} // end namespace scene +} // end namespace irr diff --git a/src/dep/src/irrlicht/CLWOMeshFileLoader.h b/src/dep/src/irrlicht/CLWOMeshFileLoader.h new file mode 100644 index 0000000..674690b --- /dev/null +++ b/src/dep/src/irrlicht/CLWOMeshFileLoader.h @@ -0,0 +1,82 @@ +// Copyright (C) 2002-2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#ifndef __C_LWO_MESH_FILE_LOADER_H_INCLUDED__ +#define __C_LWO_MESH_FILE_LOADER_H_INCLUDED__ + +#include "IMeshLoader.h" +#include "SMeshBuffer.h" +#include "irrString.h" +#include "irrMap.h" + +namespace irr +{ +namespace io +{ + class IReadFile; + class IFileSystem; +} // end namespace io +namespace scene +{ + + struct SMesh; + class ISceneManager; + +//! Meshloader capable of loading Lightwave 3D meshes. +class CLWOMeshFileLoader : public IMeshLoader +{ +public: + + //! Constructor + CLWOMeshFileLoader(scene::ISceneManager* smgr, io::IFileSystem* fs); + + //! destructor + virtual ~CLWOMeshFileLoader(); + + //! returns true if the file maybe is able to be loaded by this class + //! based on the file extension (e.g. ".bsp") + virtual bool isALoadableFileExtension(const c8* fileName) const; + + //! creates/loads an animated mesh from the file. + //! \return Pointer to the created mesh. Returns 0 if loading failed. + //! If you no longer need the mesh, you should call IAnimatedMesh::drop(). + //! See IUnknown::drop() for more information. + virtual IAnimatedMesh* createMesh(io::IReadFile* file); + +private: + + struct tLWOMaterial; + + bool readFileHeader(); + bool readChunks(); + void readObj1(u32 size); + void readTagMapping(u32 size); + void readVertexMapping(u32 size); + void readObj2(u32 size); + void readMat(u32 size); + u32 readString(core::stringc& name, u32 size=0); + u32 readVec(core::vector3df& vec); + u32 readVX(u32& num); + u32 readColor(video::SColor& color); + video::ITexture* loadTexture(const core::stringc& file); + + scene::ISceneManager* SceneManager; + io::IFileSystem* FileSystem; + io::IReadFile* File; + SMesh* Mesh; + + core::array Points; + core::array > Indices; + core::array MaterialMapping; + core::map VMap; + core::array > TCoords; + core::array Materials; + core::array Images; + u8 FormatVersion; +}; + +} // end namespace scene +} // end namespace irr + +#endif diff --git a/src/dep/src/irrlicht/CLightSceneNode.cpp b/src/dep/src/irrlicht/CLightSceneNode.cpp index 22be4d6..ec6cf75 100644 --- a/src/dep/src/irrlicht/CLightSceneNode.cpp +++ b/src/dep/src/irrlicht/CLightSceneNode.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CLightSceneNode.h b/src/dep/src/irrlicht/CLightSceneNode.h index c4f629a..689e3f6 100644 --- a/src/dep/src/irrlicht/CLightSceneNode.h +++ b/src/dep/src/irrlicht/CLightSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CLimitReadFile.cpp b/src/dep/src/irrlicht/CLimitReadFile.cpp index 2127f82..f192141 100644 --- a/src/dep/src/irrlicht/CLimitReadFile.cpp +++ b/src/dep/src/irrlicht/CLimitReadFile.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CLimitReadFile.h b/src/dep/src/irrlicht/CLimitReadFile.h index b543605..0f3c543 100644 --- a/src/dep/src/irrlicht/CLimitReadFile.h +++ b/src/dep/src/irrlicht/CLimitReadFile.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CLogger.cpp b/src/dep/src/irrlicht/CLogger.cpp index dafcd3b..84eaa9a 100644 --- a/src/dep/src/irrlicht/CLogger.cpp +++ b/src/dep/src/irrlicht/CLogger.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CLogger.h b/src/dep/src/irrlicht/CLogger.h index a311ba8..d9be303 100644 --- a/src/dep/src/irrlicht/CLogger.h +++ b/src/dep/src/irrlicht/CLogger.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CMD2MeshFileLoader.cpp b/src/dep/src/irrlicht/CMD2MeshFileLoader.cpp index 583ff15..5652d57 100644 --- a/src/dep/src/irrlicht/CMD2MeshFileLoader.cpp +++ b/src/dep/src/irrlicht/CMD2MeshFileLoader.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -7,96 +7,20 @@ #include "CMD2MeshFileLoader.h" #include "CAnimatedMeshMD2.h" -#include "os.h" namespace irr { namespace scene { - -#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) -# pragma pack( push, packing ) -# pragma pack( 1 ) -# define PACK_STRUCT -#elif defined( __GNUC__ ) -# define PACK_STRUCT __attribute__((packed)) -#else -# error compiler not supported -#endif - - // structs needed to load the md2-format - - const s32 MD2_MAGIC_NUMBER = 844121161; - const s32 MD2_VERSION = 8; - const s32 MD2_MAX_VERTS = 2048; - - struct SMD2Header - { - s32 magic; // four character code "IDP2" - s32 version; // must be 8 - s32 skinWidth; // width of the texture - s32 skinHeight; // height of the texture - s32 frameSize; // size in bytes of an animation frame - s32 numSkins; // number of textures - s32 numVertices; // total number of vertices - s32 numTexcoords; // number of vertices with texture coords - s32 numTriangles; // number of triangles - s32 numGlCommands; // number of opengl commands (triangle strip or triangle fan) - s32 numFrames; // animation keyframe count - s32 offsetSkins; // offset in bytes to 64 character skin names - s32 offsetTexcoords; // offset in bytes to texture coordinate list - s32 offsetTriangles; // offset in bytes to triangle list - s32 offsetFrames; // offset in bytes to frame list - s32 offsetGlCommands;// offset in bytes to opengl commands - s32 offsetEnd; // offset in bytes to end of file - } PACK_STRUCT; - - struct SMD2Vertex - { - u8 vertex[3]; // [0] = X, [1] = Z, [2] = Y - u8 lightNormalIndex; // index in the normal table - } PACK_STRUCT; - - struct SMD2Frame - { - f32 scale[3]; // first scale the vertex position - f32 translate[3]; // then translate the position - c8 name[16]; // the name of the animation that this key belongs to - SMD2Vertex vertices[1]; // vertex 1 of SMD2Header.numVertices - } PACK_STRUCT; - - struct SMD2Triangle - { - u16 vertexIndices[3]; - u16 textureIndices[3]; - } PACK_STRUCT; - - struct SMD2TextureCoordinate - { - s16 s; - s16 t; - } PACK_STRUCT; - - struct SMD2GLCommand - { - f32 s, t; - s32 vertexIndex; - } PACK_STRUCT; - -// Default alignment -#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) -# pragma pack( pop, packing ) -#endif - -#undef PACK_STRUCT - //! Constructor CMD2MeshFileLoader::CMD2MeshFileLoader() { + #ifdef _DEBUG setDebugName("CMD2MeshFileLoader"); #endif + } @@ -117,7 +41,7 @@ IAnimatedMesh* CMD2MeshFileLoader::createMesh(io::IReadFile* file) IAnimatedMesh* msh = new CAnimatedMeshMD2(); if (msh) { - if (loadFile(file, (CAnimatedMeshMD2*)msh) ) + if (((CAnimatedMeshMD2*)msh)->loadFile(file)) return msh; msh->drop(); @@ -126,246 +50,6 @@ IAnimatedMesh* CMD2MeshFileLoader::createMesh(io::IReadFile* file) return 0; } -//! loads an md2 file -bool CMD2MeshFileLoader::loadFile(io::IReadFile* file, CAnimatedMeshMD2* mesh) -{ - if (!file) - return false; - - SMD2Header header; - - file->read(&header, sizeof(SMD2Header)); - -#ifdef __BIG_ENDIAN__ - header.magic = os::Byteswap::byteswap(header.magic); - header.version = os::Byteswap::byteswap(header.version); - header.skinWidth = os::Byteswap::byteswap(header.skinWidth); - header.skinHeight = os::Byteswap::byteswap(header.skinHeight); - header.frameSize = os::Byteswap::byteswap(header.frameSize); - header.numSkins = os::Byteswap::byteswap(header.numSkins); - header.numVertices = os::Byteswap::byteswap(header.numVertices); - header.numTexcoords = os::Byteswap::byteswap(header.numTexcoords); - header.numTriangles = os::Byteswap::byteswap(header.numTriangles); - header.numGlCommands = os::Byteswap::byteswap(header.numGlCommands); - header.numFrames = os::Byteswap::byteswap(header.numFrames); - header.offsetSkins = os::Byteswap::byteswap(header.offsetSkins); - header.offsetTexcoords = os::Byteswap::byteswap(header.offsetTexcoords); - header.offsetTriangles = os::Byteswap::byteswap(header.offsetTriangles); - header.offsetFrames = os::Byteswap::byteswap(header.offsetFrames); - header.offsetGlCommands = os::Byteswap::byteswap(header.offsetGlCommands); - header.offsetEnd = os::Byteswap::byteswap(header.offsetEnd); -#endif - - if (header.magic != MD2_MAGIC_NUMBER || header.version != MD2_VERSION) - { - os::Printer::log("MD2 Loader: Wrong file header", file->getFileName(), ELL_WARNING); - return false; - } - - // - // prepare mesh and allocate memory - // - - mesh->FrameCount = header.numFrames; - - // create keyframes - mesh->FrameTransforms.set_used(header.numFrames); - - // create vertex arrays for each keyframe - if (mesh->FrameList) - delete [] mesh->FrameList; - mesh->FrameList = new core::array[header.numFrames]; - - // allocate space in vertex arrays - s32 i; - for (i=0; iFrameList[i].reallocate(header.numVertices); - - // allocate interpolation buffer vertices - mesh->InterpolationBuffer->Vertices.set_used(header.numTriangles*3); - - // populate triangles - mesh->InterpolationBuffer->Indices.reallocate(header.numTriangles*3); - const s32 count = header.numTriangles*3; - for (i=0; iInterpolationBuffer->Indices.push_back(i); - mesh->InterpolationBuffer->Indices.push_back(i+1); - mesh->InterpolationBuffer->Indices.push_back(i+2); - } - - // - // read texture coordinates - // - - file->seek(header.offsetTexcoords); - SMD2TextureCoordinate* textureCoords = new SMD2TextureCoordinate[header.numTexcoords]; - - if (!file->read(textureCoords, sizeof(SMD2TextureCoordinate)*header.numTexcoords)) - { - os::Printer::log("MD2 Loader: Error reading TextureCoords.", file->getFileName(), ELL_ERROR); - return false; - } - -#ifdef __BIG_ENDIAN__ - for (i=0; iseek(header.offsetTriangles); - - SMD2Triangle *triangles = new SMD2Triangle[header.numTriangles]; - if (!file->read(triangles, header.numTriangles *sizeof(SMD2Triangle))) - { - os::Printer::log("MD2 Loader: Error reading triangles.", file->getFileName(), ELL_ERROR); - return false; - } - -#ifdef __BIG_ENDIAN__ - for (i=0; iseek(header.offsetFrames); - - for (i = 0; iread(frame, header.frameSize); - -#ifdef __BIG_ENDIAN__ - frame->scale[0] = os::Byteswap::byteswap(frame->scale[0]); - frame->scale[1] = os::Byteswap::byteswap(frame->scale[1]); - frame->scale[2] = os::Byteswap::byteswap(frame->scale[2]); - frame->translate[0] = os::Byteswap::byteswap(frame->translate[0]); - frame->translate[1] = os::Byteswap::byteswap(frame->translate[1]); - frame->translate[2] = os::Byteswap::byteswap(frame->translate[2]); -#endif - // - // store frame data - // - - CAnimatedMeshMD2::SAnimationData adata; - adata.begin = i; - adata.end = i; - adata.fps = 7; - - // Add new named animation if necessary - if (frame->name[0]) - { - // get animation name - for (s32 s = 0; s < 16 && frame->name[s]!=0 && (frame->name[s] < '0' || frame->name[s] > '9'); ++s) - { - adata.name += frame->name[s]; - } - - // Does this keyframe have the same animation name as the current animation? - if (!mesh->AnimationData.empty() && mesh->AnimationData[mesh->AnimationData.size()-1].name == adata.name) - { - // Increase the length of the animation - ++mesh->AnimationData[mesh->AnimationData.size() - 1].end; - } - else - { - // Add the new animation - mesh->AnimationData.push_back(adata); - } - } - - // save keyframe scale and translation - - mesh->FrameTransforms[i].scale.X = frame->scale[0]; - mesh->FrameTransforms[i].scale.Z = frame->scale[1]; - mesh->FrameTransforms[i].scale.Y = frame->scale[2]; - mesh->FrameTransforms[i].translate.X = frame->translate[0]; - mesh->FrameTransforms[i].translate.Z = frame->translate[1]; - mesh->FrameTransforms[i].translate.Y = frame->translate[2]; - - // add vertices - for (s32 j=0; jvertices[num].vertex[0]; - v.Pos.Z = frame->vertices[num].vertex[1]; - v.Pos.Y = frame->vertices[num].vertex[2]; - v.NormalIdx = frame->vertices[num].lightNormalIndex; - - mesh->FrameList[i].push_back(v); - } - } - - // calculate bounding boxes - if (header.numVertices) - { - core::aabbox3d box; - core::vector3df pos; - pos.X = f32(mesh->FrameList[i] [0].Pos.X) * mesh->FrameTransforms[i].scale.X + mesh->FrameTransforms[i].translate.X; - pos.Y = f32(mesh->FrameList[i] [0].Pos.Y) * mesh->FrameTransforms[i].scale.Y + mesh->FrameTransforms[i].translate.Y; - pos.Z = f32(mesh->FrameList[i] [0].Pos.Z) * mesh->FrameTransforms[i].scale.Z + mesh->FrameTransforms[i].translate.Z; - - box.reset(pos); - - for (s32 j=1; jFrameList[i] [j].Pos.X) * mesh->FrameTransforms[i].scale.X + mesh->FrameTransforms[i].translate.X; - pos.Y = f32(mesh->FrameList[i] [j].Pos.Y) * mesh->FrameTransforms[i].scale.Y + mesh->FrameTransforms[i].translate.Y; - pos.Z = f32(mesh->FrameList[i] [j].Pos.Z) * mesh->FrameTransforms[i].scale.Z + mesh->FrameTransforms[i].translate.Z; - - box.addInternalPoint(pos); - } - mesh->BoxList.push_back(box); - } - } - - // populate interpolation buffer with texture coordinates and colours - if (header.numFrames) - { - f32 dmaxs = 1.0f/(header.skinWidth); - f32 dmaxt = 1.0f/(header.skinHeight); - - for (s32 t=0; tInterpolationBuffer->Vertices[t*3 + n].TCoords.X = (textureCoords[triangles[t].textureIndices[n]].s + 0.5f) * dmaxs; - mesh->InterpolationBuffer->Vertices[t*3 + n].TCoords.Y = (textureCoords[triangles[t].textureIndices[n]].t + 0.5f) * dmaxt; - mesh->InterpolationBuffer->Vertices[t*3 + n].Color = video::SColor(255,255,255,255); - } - } - } - - // clean up - delete [] triangles; - delete [] textureCoords; - - // return - - mesh->calculateBoundingBox(); - - return true; -} - } // end namespace scene } // end namespace irr diff --git a/src/dep/src/irrlicht/CMD2MeshFileLoader.h b/src/dep/src/irrlicht/CMD2MeshFileLoader.h index b6b828a..24ec8d5 100644 --- a/src/dep/src/irrlicht/CMD2MeshFileLoader.h +++ b/src/dep/src/irrlicht/CMD2MeshFileLoader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -11,8 +11,6 @@ namespace irr { namespace scene { - -class CAnimatedMeshMD2; //! Meshloader capable of loading MD2 files class CMD2MeshFileLoader : public IMeshLoader @@ -32,10 +30,6 @@ public: //! See IReferenceCounted::drop() for more information. virtual IAnimatedMesh* createMesh(io::IReadFile* file); -private: - //! Loads the file data into the mesh - bool loadFile(io::IReadFile* file, CAnimatedMeshMD2* mesh); - }; } // end namespace scene diff --git a/src/dep/src/irrlicht/CMD3MeshFileLoader.cpp b/src/dep/src/irrlicht/CMD3MeshFileLoader.cpp index dc622ac..7405e3a 100644 --- a/src/dep/src/irrlicht/CMD3MeshFileLoader.cpp +++ b/src/dep/src/irrlicht/CMD3MeshFileLoader.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CMD3MeshFileLoader.h b/src/dep/src/irrlicht/CMD3MeshFileLoader.h index 25dcec2..845992c 100644 --- a/src/dep/src/irrlicht/CMD3MeshFileLoader.h +++ b/src/dep/src/irrlicht/CMD3MeshFileLoader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CMS3DMeshFileLoader.cpp b/src/dep/src/irrlicht/CMS3DMeshFileLoader.cpp index 074f6e5..6f35d20 100644 --- a/src/dep/src/irrlicht/CMS3DMeshFileLoader.cpp +++ b/src/dep/src/irrlicht/CMS3DMeshFileLoader.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CMS3DMeshFileLoader.h b/src/dep/src/irrlicht/CMS3DMeshFileLoader.h index a4483f8..84ff7a3 100644 --- a/src/dep/src/irrlicht/CMS3DMeshFileLoader.h +++ b/src/dep/src/irrlicht/CMS3DMeshFileLoader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CMY3DHelper.h b/src/dep/src/irrlicht/CMY3DHelper.h index dcbb8c6..dc54df3 100644 --- a/src/dep/src/irrlicht/CMY3DHelper.h +++ b/src/dep/src/irrlicht/CMY3DHelper.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h // diff --git a/src/dep/src/irrlicht/CMY3DMeshFileLoader.cpp b/src/dep/src/irrlicht/CMY3DMeshFileLoader.cpp index f8e56ca..909696b 100644 --- a/src/dep/src/irrlicht/CMY3DMeshFileLoader.cpp +++ b/src/dep/src/irrlicht/CMY3DMeshFileLoader.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h // diff --git a/src/dep/src/irrlicht/CMY3DMeshFileLoader.h b/src/dep/src/irrlicht/CMY3DMeshFileLoader.h index ab94d53..0cb7849 100644 --- a/src/dep/src/irrlicht/CMY3DMeshFileLoader.h +++ b/src/dep/src/irrlicht/CMY3DMeshFileLoader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h // diff --git a/src/dep/src/irrlicht/CMemoryReadFile.cpp b/src/dep/src/irrlicht/CMemoryReadFile.cpp index 8581956..05e6d9f 100644 --- a/src/dep/src/irrlicht/CMemoryReadFile.cpp +++ b/src/dep/src/irrlicht/CMemoryReadFile.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CMemoryReadFile.h b/src/dep/src/irrlicht/CMemoryReadFile.h index a5a274b..32124b8 100644 --- a/src/dep/src/irrlicht/CMemoryReadFile.h +++ b/src/dep/src/irrlicht/CMemoryReadFile.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CMeshCache.cpp b/src/dep/src/irrlicht/CMeshCache.cpp index 4651398..bb3fbf9 100644 --- a/src/dep/src/irrlicht/CMeshCache.cpp +++ b/src/dep/src/irrlicht/CMeshCache.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CMeshCache.h b/src/dep/src/irrlicht/CMeshCache.h index ff85ca3..dea2ba5 100644 --- a/src/dep/src/irrlicht/CMeshCache.h +++ b/src/dep/src/irrlicht/CMeshCache.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CMeshManipulator.cpp b/src/dep/src/irrlicht/CMeshManipulator.cpp index d4d1834..1b22d15 100644 --- a/src/dep/src/irrlicht/CMeshManipulator.cpp +++ b/src/dep/src/irrlicht/CMeshManipulator.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CMeshManipulator.h b/src/dep/src/irrlicht/CMeshManipulator.h index 606ecc1..59a6bdc 100644 --- a/src/dep/src/irrlicht/CMeshManipulator.h +++ b/src/dep/src/irrlicht/CMeshManipulator.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CMeshSceneNode.cpp b/src/dep/src/irrlicht/CMeshSceneNode.cpp index d99f9f9..bb57b64 100644 --- a/src/dep/src/irrlicht/CMeshSceneNode.cpp +++ b/src/dep/src/irrlicht/CMeshSceneNode.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CMeshSceneNode.h b/src/dep/src/irrlicht/CMeshSceneNode.h index f96ecb1..cc76ff3 100644 --- a/src/dep/src/irrlicht/CMeshSceneNode.h +++ b/src/dep/src/irrlicht/CMeshSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CMetaTriangleSelector.cpp b/src/dep/src/irrlicht/CMetaTriangleSelector.cpp index c7719e8..6641360 100644 --- a/src/dep/src/irrlicht/CMetaTriangleSelector.cpp +++ b/src/dep/src/irrlicht/CMetaTriangleSelector.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CMetaTriangleSelector.h b/src/dep/src/irrlicht/CMetaTriangleSelector.h index 17a8449..e995aec 100644 --- a/src/dep/src/irrlicht/CMetaTriangleSelector.h +++ b/src/dep/src/irrlicht/CMetaTriangleSelector.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CNullDriver.cpp b/src/dep/src/irrlicht/CNullDriver.cpp index b16c791..645d0d6 100644 --- a/src/dep/src/irrlicht/CNullDriver.cpp +++ b/src/dep/src/irrlicht/CNullDriver.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -195,10 +195,6 @@ void CNullDriver::addExternalImageWriter(IImageWriter* writer) //! deletes all textures void CNullDriver::deleteAllTextures() { - // we need to remove previously set textures which might otherwise be kept in the - // last set material member. Could be optimized to reduce state changes. - setMaterial(SMaterial()); - for (u32 i=0; idrop(); @@ -673,7 +669,7 @@ void CNullDriver::draw2DImage(const video::ITexture* texture, const core::rect& destPos, const core::rect& sourceRect, const core::rect* clipRect, SColor color, @@ -682,17 +678,8 @@ void CNullDriver::draw2DImage(const video::ITexture* texture, const core::positi } -//! Draws the outline of a 2d rectangle -void CNullDriver::draw2DRectangleOutline(const core::recti& pos, SColor color) -{ - draw2DLine(pos.UpperLeftCorner, core::position2di(pos.LowerRightCorner.X, pos.UpperLeftCorner.Y), color); - draw2DLine(core::position2di(pos.LowerRightCorner.X, pos.UpperLeftCorner.Y), pos.LowerRightCorner, color); - draw2DLine(pos.LowerRightCorner, core::position2di(pos.UpperLeftCorner.X, pos.LowerRightCorner.Y), color); - draw2DLine(core::position2di(pos.UpperLeftCorner.X, pos.LowerRightCorner.Y), pos.UpperLeftCorner, color); -} - -//! Draw a 2d rectangle +//! draw an 2d rectangle void CNullDriver::draw2DRectangle(SColor color, const core::rect& pos, const core::rect* clip) { draw2DRectangle(pos, color, color, color, color, clip); @@ -700,7 +687,7 @@ void CNullDriver::draw2DRectangle(SColor color, const core::rect& pos, cons -//! Draws a 2d rectangle with a gradient. +//!Draws an 2d rectangle with a gradient. void CNullDriver::draw2DRectangle(const core::rect& pos, SColor colorLeftUp, SColor colorRightUp, SColor colorLeftDown, SColor colorRightDown, const core::rect* clip) @@ -1237,6 +1224,7 @@ IImage* CNullDriver::createImageFromFile(io::IReadFile* file) } + //! Writes the provided image to disk file bool CNullDriver::writeImageToFile(IImage* image, const char* filename,u32 param) { @@ -1258,6 +1246,7 @@ bool CNullDriver::writeImageToFile(IImage* image, const char* filename,u32 param } + //! Creates a software image from a byte array. IImage* CNullDriver::createImageFromData(ECOLOR_FORMAT format, const core::dimension2d& size, @@ -1318,7 +1307,6 @@ void CNullDriver::drawMeshBuffer(const scene::IMeshBuffer* mb) drawVertexPrimitiveList(mb->getVertices(), mb->getVertexCount(), mb->getIndices(), mb->getIndexCount()/3, mb->getVertexType(), scene::EPT_TRIANGLES, mb->getIndexType()); } - CNullDriver::SHWBufferLink *CNullDriver::getBufferLink(const scene::IMeshBuffer* mb) { if (!mb || !isHardwareBufferRecommend(mb)) @@ -1326,13 +1314,11 @@ CNullDriver::SHWBufferLink *CNullDriver::getBufferLink(const scene::IMeshBuffer* //search for hardware links core::map< const scene::IMeshBuffer*,SHWBufferLink* >::Node* node = HWBufferMap.find(mb); - if (node) - return node->getValue(); + if (node) return node->getValue(); return createHardwareBuffer(mb); //no hardware links, and mesh wants one, create it } - //! Update all hardware buffers, remove unused ones void CNullDriver::updateAllHardwareBuffers() { @@ -1356,22 +1342,18 @@ void CNullDriver::updateAllHardwareBuffers() void CNullDriver::deleteHardwareBuffer(SHWBufferLink *HWBuffer) { - if (!HWBuffer) - return; - HWBufferMap.remove(HWBuffer->MeshBuffer); + if (!HWBuffer) return; + HWBufferMap.remove( HWBuffer->MeshBuffer ); delete HWBuffer; } - //! Remove hardware buffer void CNullDriver::removeHardwareBuffer(const scene::IMeshBuffer* mb) { core::map::Node* node = HWBufferMap.find(mb); - if (node) - deleteHardwareBuffer(node->getValue()); + if (node) deleteHardwareBuffer( node->getValue() ); } - //! Remove all hardware buffers void CNullDriver::removeAllHardwareBuffers() { @@ -1379,7 +1361,6 @@ void CNullDriver::removeAllHardwareBuffers() deleteHardwareBuffer(HWBufferMap.getRoot()->getValue()); } - bool CNullDriver::isHardwareBufferRecommend(const scene::IMeshBuffer* mb) { if (!mb || (mb->getHardwareMappingHint_Index()==scene::EHM_NEVER && mb->getHardwareMappingHint_Vertex()==scene::EHM_NEVER)) @@ -1391,7 +1372,6 @@ bool CNullDriver::isHardwareBufferRecommend(const scene::IMeshBuffer* mb) return true; } - //! Only used by the internal engine. Used to notify the driver that //! the window was resized. void CNullDriver::OnResize(const core::dimension2d& size) @@ -1403,7 +1383,6 @@ void CNullDriver::OnResize(const core::dimension2d& size) ScreenSize = size; } - // adds a material renderer and drops it afterwards. To be used for internal creation s32 CNullDriver::addAndDropMaterialRenderer(IMaterialRenderer* m) { @@ -1577,7 +1556,6 @@ E_DRIVER_TYPE CNullDriver::getDriverType() const return EDT_NULL; } - //! deletes all material renderers void CNullDriver::deleteMaterialRenders() { @@ -1623,7 +1601,6 @@ IGPUProgrammingServices* CNullDriver::getGPUProgrammingServices() return 0; } - //! Adds a new material renderer to the VideoDriver, based on a high level shading //! language. Currently only HLSL in D3D9 is supported. s32 CNullDriver::addHighLevelShaderMaterial( @@ -1641,7 +1618,6 @@ s32 CNullDriver::addHighLevelShaderMaterial( return -1; } - //! Like IGPUProgrammingServices::addShaderMaterial() (look there for a detailed description), //! but tries to load the programs from files. s32 CNullDriver::addHighLevelShaderMaterialFromFiles( @@ -1696,7 +1672,6 @@ s32 CNullDriver::addHighLevelShaderMaterialFromFiles( return result; } - //! Like IGPUProgrammingServices::addShaderMaterial() (look there for a detailed description), //! but tries to load the programs from files. s32 CNullDriver::addHighLevelShaderMaterialFromFiles( @@ -1749,7 +1724,6 @@ s32 CNullDriver::addHighLevelShaderMaterialFromFiles( return result; } - //! Adds a new material renderer to the VideoDriver, using pixel and/or //! vertex shaders to render geometry. s32 CNullDriver::addShaderMaterial(const c8* vertexShaderProgram, @@ -1762,7 +1736,6 @@ s32 CNullDriver::addShaderMaterial(const c8* vertexShaderProgram, return -1; } - //! Like IGPUProgrammingServices::addShaderMaterial(), but tries to load the //! programs from files. s32 CNullDriver::addShaderMaterialFromFiles(io::IReadFile* vertexShaderProgram, @@ -1805,6 +1778,7 @@ s32 CNullDriver::addShaderMaterialFromFiles(io::IReadFile* vertexShaderProgram, } + //! Like IGPUProgrammingServices::addShaderMaterial(), but tries to load the //! programs from files. s32 CNullDriver::addShaderMaterialFromFiles(const c8* vertexShaderProgramFileName, @@ -1917,7 +1891,6 @@ bool CNullDriver::setClipPlane(u32 index, const core::plane3df& plane, bool enab return false; } - //! Enable/disable a clipping plane. //! There are at least 6 clipping planes available for the user to set at will. //! \param index: The plane index. Must be between 0 and MaxUserClipPlanes. @@ -1939,3 +1912,5 @@ ITexture* CNullDriver::createRenderTargetTexture(const core::dimension2d& s } // end namespace } // end namespace + + diff --git a/src/dep/src/irrlicht/CNullDriver.h b/src/dep/src/irrlicht/CNullDriver.h index b85785f..8a40f8b 100644 --- a/src/dep/src/irrlicht/CNullDriver.h +++ b/src/dep/src/irrlicht/CNullDriver.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -163,7 +163,7 @@ namespace video SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false); - //! Draws a 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted. + //! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted. virtual void draw2DImage(const video::ITexture* texture, const core::position2d& destPos, const core::rect& sourceRect, const core::rect* clipRect = 0, SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false); @@ -173,17 +173,14 @@ namespace video const core::rect& sourceRect, const core::rect* clipRect = 0, const video::SColor* const colors=0, bool useAlphaChannelOfTexture=false); - //! Draws a 2d rectangle + //! draw an 2d rectangle virtual void draw2DRectangle(SColor color, const core::rect& pos, const core::rect* clip = 0); - //! Draws a 2d rectangle with a gradient. + //!Draws an 2d rectangle with a gradient. virtual void draw2DRectangle(const core::rect& pos, SColor colorLeftUp, SColor colorRightUp, SColor colorLeftDown, SColor colorRightDown, const core::rect* clip = 0); - //! Draws the outline of a 2d rectangle - virtual void draw2DRectangleOutline(const core::recti& pos, SColor color=SColor(255,255,255,255)); - //! Draws a 2d line. virtual void draw2DLine(const core::position2d& start, const core::position2d& end, diff --git a/src/dep/src/irrlicht/COBJMeshFileLoader.cpp b/src/dep/src/irrlicht/COBJMeshFileLoader.cpp index 8734125..14bee80 100644 --- a/src/dep/src/irrlicht/COBJMeshFileLoader.cpp +++ b/src/dep/src/irrlicht/COBJMeshFileLoader.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/COBJMeshFileLoader.h b/src/dep/src/irrlicht/COBJMeshFileLoader.h index 2e10594..6d3a5bd 100644 --- a/src/dep/src/irrlicht/COBJMeshFileLoader.h +++ b/src/dep/src/irrlicht/COBJMeshFileLoader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/COBJMeshWriter.cpp b/src/dep/src/irrlicht/COBJMeshWriter.cpp new file mode 100644 index 0000000..5062555 --- /dev/null +++ b/src/dep/src/irrlicht/COBJMeshWriter.cpp @@ -0,0 +1,241 @@ +// Copyright (C) 2008 Christian Stehno +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#include "IrrCompileConfig.h" + +#ifdef _IRR_COMPILE_WITH_OBJ_WRITER_ + +#include "COBJMeshWriter.h" +#include "os.h" +#include "IMesh.h" +#include "IMeshBuffer.h" +#include "IAttributes.h" +#include "ISceneManager.h" +#include "IMeshCache.h" +#include "IWriteFile.h" +#include "IFileSystem.h" +#include "ITexture.h" + +namespace irr +{ +namespace scene +{ + +COBJMeshWriter::COBJMeshWriter(scene::ISceneManager* smgr, io::IFileSystem* fs) + : SceneManager(smgr), FileSystem(fs) +{ + #ifdef _DEBUG + setDebugName("COBJMeshWriter"); + #endif + + if (SceneManager) + SceneManager->grab(); + + if (FileSystem) + FileSystem->grab(); +} + + +COBJMeshWriter::~COBJMeshWriter() +{ + if (SceneManager) + SceneManager->drop(); + + if (FileSystem) + FileSystem->drop(); +} + + +//! Returns the type of the mesh writer +EMESH_WRITER_TYPE COBJMeshWriter::getType() const +{ + return EMWT_OBJ; +} + + +//! writes a mesh +bool COBJMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 flags) +{ + if (!file) + return false; + + os::Printer::log("Writing mesh", file->getFileName()); + + // write OBJ MESH header + + const core::stringc name(FileSystem->getFileBasename(SceneManager->getMeshCache()->getMeshFilename(mesh), false)+".mtl"); + file->write("# exported by Irrlicht\n",23); + file->write("mtllib ",7); + file->write(name.c_str(),name.size()); + file->write("\n\n",2); + + // write mesh buffers + + core::array mat; + + u32 allVertexCount=1; // count vertices over the whole file + for (u32 i=0; igetMeshBufferCount(); ++i) + { + core::stringc num(i+1); + IMeshBuffer* buffer = mesh->getMeshBuffer(i); + if (buffer && buffer->getVertexCount()) + { + file->write("g grp", 5); + file->write(num.c_str(), num.size()); + file->write("\n",1); + + u32 j; + const u32 vertexCount = buffer->getVertexCount(); + for (j=0; jwrite("v ",2); + getVectorAsStringLine(buffer->getPosition(j), num); + file->write(num.c_str(), num.size()); + } + + for (j=0; jwrite("vt ",3); + getVectorAsStringLine(buffer->getTCoords(j), num); + file->write(num.c_str(), num.size()); + } + + for (j=0; jwrite("vn ",3); + getVectorAsStringLine(buffer->getNormal(j), num); + file->write(num.c_str(), num.size()); + } + + file->write("usemtl mat",10); + num = ""; + for (j=0; jgetMaterial()) + { + num = core::stringc(j); + break; + } + } + if (num == "") + { + num = core::stringc(mat.size()); + mat.push_back(&buffer->getMaterial()); + } + file->write(num.c_str(), num.size()); + file->write("\n",1); + + const u32 indexCount = buffer->getIndexCount(); + for (j=0; jwrite("f ",2); + num = core::stringc(buffer->getIndices()[j+2]+allVertexCount); + file->write(num.c_str(), num.size()); + file->write("/",1); + file->write(num.c_str(), num.size()); + file->write("/",1); + file->write(num.c_str(), num.size()); + file->write(" ",1); + + num = core::stringc(buffer->getIndices()[j+1]+allVertexCount); + file->write(num.c_str(), num.size()); + file->write("/",1); + file->write(num.c_str(), num.size()); + file->write("/",1); + file->write(num.c_str(), num.size()); + file->write(" ",1); + + num = core::stringc(buffer->getIndices()[j+0]+allVertexCount); + file->write(num.c_str(), num.size()); + file->write("/",1); + file->write(num.c_str(), num.size()); + file->write("/",1); + file->write(num.c_str(), num.size()); + file->write(" ",1); + + file->write("\n",1); + } + file->write("\n",1); + allVertexCount += vertexCount; + } + } + + if (mat.size() == 0) + return true; + + file = FileSystem->createAndWriteFile((name).c_str()); + if (file) + { + os::Printer::log("Writing material", file->getFileName()); + + file->write("# exported by Irrlicht\n\n",24); + for (u32 i=0; iwrite("newmtl mat",10); + file->write(num.c_str(),num.size()); + file->write("\n",1); + + getColorAsStringLine(mat[i]->AmbientColor, "Ka", num); + file->write(num.c_str(),num.size()); + getColorAsStringLine(mat[i]->DiffuseColor, "Kd", num); + file->write(num.c_str(),num.size()); + getColorAsStringLine(mat[i]->SpecularColor, "Ks", num); + file->write(num.c_str(),num.size()); + getColorAsStringLine(mat[i]->EmissiveColor, "Ke", num); + file->write(num.c_str(),num.size()); + num = core::stringc(mat[i]->Shininess/0.128f); + file->write(num.c_str(),num.size()); + if (mat[i]->getTexture(0)) + { + file->write("map_Kd ", 7); + file->write(mat[i]->getTexture(0)->getName().c_str(), mat[i]->getTexture(0)->getName().size()); + file->write("\n",1); + } + file->write("\n",1); + } + file->drop(); + } + return true; +} + + +void COBJMeshWriter::getVectorAsStringLine(const core::vector3df& v, core::stringc& s) const +{ + s = core::stringc(-v.X); + s += " "; + s += core::stringc(v.Y); + s += " "; + s += core::stringc(v.Z); + s += "\n"; +} + + +void COBJMeshWriter::getVectorAsStringLine(const core::vector2df& v, core::stringc& s) const +{ + s = core::stringc(v.X); + s += " "; + s += core::stringc(-v.Y); + s += "\n"; +} + + +void COBJMeshWriter::getColorAsStringLine(const video::SColor& color, const c8* const prefix, core::stringc& s) const +{ + s = prefix; + s += " "; + s += core::stringc(color.getRed()/255.f); + s += " "; + s += core::stringc(color.getGreen()/255.f); + s += " "; + s += core::stringc(color.getBlue()/255.f); + s += "\n"; +} + + +} // end namespace +} // end namespace + +#endif + diff --git a/src/dep/src/irrlicht/COBJMeshWriter.h b/src/dep/src/irrlicht/COBJMeshWriter.h new file mode 100644 index 0000000..cc04fa5 --- /dev/null +++ b/src/dep/src/irrlicht/COBJMeshWriter.h @@ -0,0 +1,58 @@ +// Copyright (C) 2008 Christian Stehno +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#ifndef __IRR_OBJ_MESH_WRITER_H_INCLUDED__ +#define __IRR_OBJ_MESH_WRITER_H_INCLUDED__ + +#include "IMeshWriter.h" +#include "S3DVertex.h" +#include "irrString.h" + +namespace irr +{ +namespace io +{ + class IFileSystem; +} // end namespace io +namespace scene +{ + class IMeshBuffer; + class ISceneManager; + + //! class to write meshes, implementing a OBJ writer + class COBJMeshWriter : public IMeshWriter + { + public: + + COBJMeshWriter(scene::ISceneManager* smgr, io::IFileSystem* fs); + virtual ~COBJMeshWriter(); + + //! Returns the type of the mesh writer + virtual EMESH_WRITER_TYPE getType() const; + + //! writes a mesh + virtual bool writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 flags=EMWF_NONE); + + protected: + // create vector output with line end into string + void getVectorAsStringLine(const core::vector3df& v, + core::stringc& s) const; + + // create vector output with line end into string + void getVectorAsStringLine(const core::vector2df& v, + core::stringc& s) const; + + // create color output with line end into string + void getColorAsStringLine(const video::SColor& color, + const c8* const prefix, core::stringc& s) const; + + scene::ISceneManager* SceneManager; + io::IFileSystem* FileSystem; + }; + +} // end namespace +} // end namespace + +#endif + diff --git a/src/dep/src/irrlicht/COCTLoader.cpp b/src/dep/src/irrlicht/COCTLoader.cpp index ca986b1..0fc9b61 100644 --- a/src/dep/src/irrlicht/COCTLoader.cpp +++ b/src/dep/src/irrlicht/COCTLoader.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h // diff --git a/src/dep/src/irrlicht/COCTLoader.h b/src/dep/src/irrlicht/COCTLoader.h index 6e08c78..ba13074 100644 --- a/src/dep/src/irrlicht/COCTLoader.h +++ b/src/dep/src/irrlicht/COCTLoader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h // diff --git a/src/dep/src/irrlicht/COSOperator.cpp b/src/dep/src/irrlicht/COSOperator.cpp index 3e0a7f7..6ad2139 100644 --- a/src/dep/src/irrlicht/COSOperator.cpp +++ b/src/dep/src/irrlicht/COSOperator.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/COSOperator.h b/src/dep/src/irrlicht/COSOperator.h index 9f5a464..a9f794f 100644 --- a/src/dep/src/irrlicht/COSOperator.h +++ b/src/dep/src/irrlicht/COSOperator.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/COctTreeSceneNode.cpp b/src/dep/src/irrlicht/COctTreeSceneNode.cpp index 2e9ffac..7200945 100644 --- a/src/dep/src/irrlicht/COctTreeSceneNode.cpp +++ b/src/dep/src/irrlicht/COctTreeSceneNode.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/COctTreeSceneNode.h b/src/dep/src/irrlicht/COctTreeSceneNode.h index d5d7151..16feeb0 100644 --- a/src/dep/src/irrlicht/COctTreeSceneNode.h +++ b/src/dep/src/irrlicht/COctTreeSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/COctTreeTriangleSelector.cpp b/src/dep/src/irrlicht/COctTreeTriangleSelector.cpp index 316ef7f..3f95563 100644 --- a/src/dep/src/irrlicht/COctTreeTriangleSelector.cpp +++ b/src/dep/src/irrlicht/COctTreeTriangleSelector.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/COctTreeTriangleSelector.h b/src/dep/src/irrlicht/COctTreeTriangleSelector.h index 1e11efb..1a52e4c 100644 --- a/src/dep/src/irrlicht/COctTreeTriangleSelector.h +++ b/src/dep/src/irrlicht/COctTreeTriangleSelector.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/COgreMeshFileLoader.cpp b/src/dep/src/irrlicht/COgreMeshFileLoader.cpp index 6379acb..d7eeea3 100644 --- a/src/dep/src/irrlicht/COgreMeshFileLoader.cpp +++ b/src/dep/src/irrlicht/COgreMeshFileLoader.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h // orginally written by Christian Stehno, modified by Nikolaus Gebhardt diff --git a/src/dep/src/irrlicht/COgreMeshFileLoader.h b/src/dep/src/irrlicht/COgreMeshFileLoader.h index 29adf0f..2d61a65 100644 --- a/src/dep/src/irrlicht/COgreMeshFileLoader.h +++ b/src/dep/src/irrlicht/COgreMeshFileLoader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h // orginally written by Christian Stehno, modified by Nikolaus Gebhardt diff --git a/src/dep/src/irrlicht/COpenGLDriver.cpp b/src/dep/src/irrlicht/COpenGLDriver.cpp index 0b57df5..ec32d03 100644 --- a/src/dep/src/irrlicht/COpenGLDriver.cpp +++ b/src/dep/src/irrlicht/COpenGLDriver.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -116,7 +116,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params) HWND temporary_wnd=CreateWindow(ClassName, "", style, windowLeft, windowTop, realWidth, realHeight, NULL, NULL, lhInstance, NULL); - if (!temporary_wnd) + if(!temporary_wnd) { os::Printer::log("Cannot create a temporary window.", ELL_ERROR); return false; @@ -165,7 +165,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params) SetPixelFormat(HDc, PixelFormat, &pfd); HRc=wglCreateContext(HDc); - if (!HRc) + if(!HRc) { os::Printer::log("Cannot create a temporary GL rendering context.", ELL_ERROR); ReleaseDC(temporary_wnd, HDc); @@ -173,7 +173,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params) return false; } - if (!wglMakeCurrent(HDc, HRc)) + if(!wglMakeCurrent(HDc, HRc)) { os::Printer::log("Cannot activate a temporary GL rendering context.", ELL_ERROR); wglDeleteContext(HRc); @@ -183,7 +183,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params) } PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormat_ARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB"); - if (wglChoosePixelFormat_ARB) + if(wglChoosePixelFormat_ARB) { // This value determines the number of samples used for antialiasing // valid numbers are 2, 4, 8. My experience is that 8 does not @@ -218,12 +218,12 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params) u32 numFormats=0; const s32 valid = wglChoosePixelFormat_ARB(HDc,iAttributes,fAttributes,1,&pixelFormat,&numFormats); - if (valid && numFormats>0) + if(valid && numFormats>0) rv = pixelFormat; else iAttributes[19] >>= 1; } - if (rv) + if(rv) PixelFormat=rv; } @@ -284,7 +284,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params) } // set pixel format - if (!SetPixelFormat(HDc, PixelFormat, &pfd)) + if(!SetPixelFormat(HDc, PixelFormat, &pfd)) { os::Printer::log("Cannot set the pixel format.", ELL_ERROR); return false; @@ -299,7 +299,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params) } // activate rendering context - if (!wglMakeCurrent(HDc, HRc)) + if(!wglMakeCurrent(HDc, HRc)) { os::Printer::log("Cannot activate GL rendering context", ELL_ERROR); wglDeleteContext(HRc); @@ -503,7 +503,7 @@ bool COpenGLDriver::genericDriverInit(const core::dimension2d& screenSize, glClearDepth(1.0); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glDepthFunc(GL_LEQUAL); - glFrontFace(GL_CW); + glFrontFace( GL_CW ); if (AntiAlias) { @@ -660,7 +660,7 @@ void COpenGLDriver::setTransform(E_TRANSFORMATION_STATE state, const core::matri Matrices[state] = mat; Transformation3DChanged = true; - switch (state) + switch(state) { case ETS_VIEW: case ETS_WORLD: @@ -715,7 +715,6 @@ void COpenGLDriver::setTransform(E_TRANSFORMATION_STATE state, const core::matri } } - bool COpenGLDriver::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) { if (!HWBuffer) @@ -779,8 +778,7 @@ bool COpenGLDriver::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) if (!HWBuffer->vbo_verticesID) { extGlGenBuffers(1, &HWBuffer->vbo_verticesID); - if (!HWBuffer->vbo_verticesID) - return false; + if (!HWBuffer->vbo_verticesID) return false; newBuffer=true; } else if (HWBuffer->vbo_verticesSize < vertexCount*vertexSize) @@ -788,7 +786,7 @@ bool COpenGLDriver::updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) newBuffer=true; } - extGlBindBuffer(GL_ARRAY_BUFFER, HWBuffer->vbo_verticesID); + extGlBindBuffer(GL_ARRAY_BUFFER, HWBuffer->vbo_verticesID ); //copy data to graphics card glGetError(); // clear error storage @@ -820,7 +818,7 @@ bool COpenGLDriver::updateIndexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) if (!HWBuffer) return false; - if (!FeatureAvailable[IRR_ARB_vertex_buffer_object]) + if(!FeatureAvailable[IRR_ARB_vertex_buffer_object]) return false; #if defined(GL_ARB_vertex_buffer_object) @@ -832,12 +830,12 @@ bool COpenGLDriver::updateIndexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) GLenum indexSize; switch (mb->getIndexType()) { - case EIT_16BIT: + case (EIT_16BIT): { indexSize=sizeof(u16); break; } - case EIT_32BIT: + case (EIT_32BIT): { indexSize=sizeof(u32); break; @@ -854,8 +852,7 @@ bool COpenGLDriver::updateIndexHardwareBuffer(SHWBufferLink_opengl *HWBuffer) if (!HWBuffer->vbo_indicesID) { extGlGenBuffers(1, &HWBuffer->vbo_indicesID); - if (!HWBuffer->vbo_indicesID) - return false; + if (!HWBuffer->vbo_indicesID) return false; newBuffer=true; } else if (HWBuffer->vbo_indicesSize < indexCount*indexSize) @@ -963,8 +960,8 @@ COpenGLDriver::SHWBufferLink *COpenGLDriver::createHardwareBuffer(const scene::I void COpenGLDriver::deleteHardwareBuffer(SHWBufferLink *_HWBuffer) { - if (!_HWBuffer) - return; + if (!_HWBuffer) return; + #if defined(GL_ARB_vertex_buffer_object) SHWBufferLink_opengl *HWBuffer=(SHWBufferLink_opengl*)_HWBuffer; @@ -981,6 +978,7 @@ void COpenGLDriver::deleteHardwareBuffer(SHWBufferLink *_HWBuffer) #endif CNullDriver::deleteHardwareBuffer(_HWBuffer); + } @@ -990,13 +988,16 @@ void COpenGLDriver::drawHardwareBuffer(SHWBufferLink *_HWBuffer) if (!_HWBuffer) return; - updateHardwareBuffer(_HWBuffer); //check if update is needed - _HWBuffer->LastUsed=0; //reset count - -#if defined(GL_ARB_vertex_buffer_object) SHWBufferLink_opengl *HWBuffer=(SHWBufferLink_opengl*)_HWBuffer; + updateHardwareBuffer(HWBuffer); //check if update is needed + + HWBuffer->LastUsed=0;//reset count + +#if defined(GL_ARB_vertex_buffer_object) const scene::IMeshBuffer* mb = HWBuffer->MeshBuffer; + + const void *vertices=mb->getVertices(); const void *indexList=mb->getIndices(); @@ -1012,12 +1013,17 @@ void COpenGLDriver::drawHardwareBuffer(SHWBufferLink *_HWBuffer) indexList=0; } + drawVertexPrimitiveList(vertices, mb->getVertexCount(), indexList, mb->getIndexCount()/3, mb->getVertexType(), scene::EPT_TRIANGLES, mb->getIndexType()); if (HWBuffer->Mapped_Vertex!=scene::EHM_NEVER) extGlBindBuffer(GL_ARRAY_BUFFER, 0); + if (HWBuffer->Mapped_Index!=scene::EHM_NEVER) extGlBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + + + #endif } @@ -1054,7 +1060,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun case EVT_STANDARD: { const S3DVertex* p = static_cast(vertices); - for (i=0; iColor.toOpenGLColor(&ColorBuffer[i]); ++p; @@ -1064,7 +1070,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun case EVT_2TCOORDS: { const S3DVertex2TCoords* p = static_cast(vertices); - for (i=0; iColor.toOpenGLColor(&ColorBuffer[i]); ++p; @@ -1074,7 +1080,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun case EVT_TANGENTS: { const S3DVertexTangents* p = static_cast(vertices); - for (i=0; iColor.toOpenGLColor(&ColorBuffer[i]); ++p; @@ -1178,7 +1184,7 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun glTexCoordPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), buffer_offset(36)); extGlClientActiveTexture(GL_TEXTURE2_ARB); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glEnableClientState ( GL_TEXTURE_COORD_ARRAY ); if (vertices) glTexCoordPointer(3, GL_FLOAT, sizeof(S3DVertexTangents), &(static_cast(vertices))[0].Binormal); else @@ -1191,12 +1197,12 @@ void COpenGLDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCoun switch (iType) { - case EIT_16BIT: + case (EIT_16BIT): { indexSize=GL_UNSIGNED_SHORT; break; } - case EIT_32BIT: + case (EIT_32BIT): { indexSize=GL_UNSIGNED_INT; break; @@ -1645,7 +1651,7 @@ void COpenGLDriver::draw2DLine(const core::position2d& start, void COpenGLDriver::drawPixel(u32 x, u32 y, const SColor &color) { const core::dimension2d& renderTargetSize = getCurrentRenderTargetSize(); - if (x > (u32)renderTargetSize.Width || y > (u32)renderTargetSize.Height) + if(x > (u32)renderTargetSize.Width || y > (u32)renderTargetSize.Height) return; disableTextures(); @@ -1751,7 +1757,7 @@ void COpenGLDriver::setMaterial(const SMaterial& material) for (s32 i = MaxTextureUnits-1; i>= 0; --i) { - setTransform ((E_TRANSFORMATION_STATE) (ETS_TEXTURE_0 + i), + setTransform ((E_TRANSFORMATION_STATE) ( ETS_TEXTURE_0 + i ), material.getTextureMatrix(i)); } } @@ -1762,7 +1768,7 @@ bool COpenGLDriver::testGLError() { #ifdef _DEBUG GLenum g = glGetError(); - switch (g) + switch(g) { case GL_NO_ERROR: return false; @@ -1815,7 +1821,7 @@ void COpenGLDriver::setRenderStates3DMode() ResetRenderStates = true; } - if (ResetRenderStates || LastMaterial != Material) + if ( ResetRenderStates || LastMaterial != Material) { // unset old material @@ -1982,22 +1988,22 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial& material, const SMater else if (i>0) break; - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (material.TextureLayer[i].BilinearFilter || material.TextureLayer[i].TrilinearFilter) ? GL_LINEAR : GL_NEAREST); if (material.getTexture(i) && material.getTexture(i)->hasMipMaps()) - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, material.TextureLayer[i].TrilinearFilter ? GL_LINEAR_MIPMAP_LINEAR : material.TextureLayer[i].BilinearFilter ? GL_LINEAR_MIPMAP_NEAREST : - GL_NEAREST_MIPMAP_NEAREST); + GL_NEAREST_MIPMAP_NEAREST ); else - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (material.TextureLayer[i].BilinearFilter || material.TextureLayer[i].TrilinearFilter) ? GL_LINEAR : GL_NEAREST); #ifdef GL_EXT_texture_filter_anisotropic if (AnisotropyExtension) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, - material.TextureLayer[i].AnisotropicFilter ? MaxAnisotropy : 1.0f); + material.TextureLayer[i].AnisotropicFilter ? MaxAnisotropy : 1.0f ); #endif } @@ -2033,11 +2039,11 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial& material, const SMater break; case 1: glEnable(GL_DEPTH_TEST); - glDepthFunc(GL_LEQUAL); + glDepthFunc ( GL_LEQUAL ); break; case 2: glEnable(GL_DEPTH_TEST); - glDepthFunc(GL_EQUAL); + glDepthFunc ( GL_EQUAL ); break; } } @@ -2161,8 +2167,8 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh if (texture) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); @@ -2374,7 +2380,7 @@ void COpenGLDriver::drawStencilShadowVolume(const core::vector3df* triangles, s3 glDisable(GL_FOG); glDepthFunc(GL_LEQUAL); glDepthMask(GL_FALSE); // no depth buffer writing - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); // no color buffer drawing + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE ); // no color buffer drawing glEnable(GL_STENCIL_TEST); glEnable(GL_POLYGON_OFFSET_FILL); glPolygonOffset(0.0f, 1.0f); @@ -2512,19 +2518,19 @@ void COpenGLDriver::drawStencilShadow(bool clearStencilBuffer, video::SColor lef disableTextures(); // store attributes - glPushAttrib(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT | GL_POLYGON_BIT | GL_STENCIL_BUFFER_BIT); + glPushAttrib( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT | GL_POLYGON_BIT | GL_STENCIL_BUFFER_BIT ); - glDisable(GL_LIGHTING); + glDisable( GL_LIGHTING ); glDisable(GL_FOG); glDepthMask(GL_FALSE); - glShadeModel(GL_FLAT); - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + glShadeModel( GL_FLAT ); + glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_STENCIL_TEST); + glEnable( GL_STENCIL_TEST ); glStencilFunc(GL_NOTEQUAL, 0, ~0); glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); @@ -2535,17 +2541,17 @@ void COpenGLDriver::drawStencilShadow(bool clearStencilBuffer, video::SColor lef glBegin(GL_QUADS); - glColor4ub(leftDownEdge.getRed(), leftDownEdge.getGreen(), leftDownEdge.getBlue(), leftDownEdge.getAlpha()); + glColor4ub (leftDownEdge.getRed(), leftDownEdge.getGreen(), leftDownEdge.getBlue(), leftDownEdge.getAlpha() ); glVertex3f(-1.1f,-1.1f,0.9f); - glColor4ub(leftUpEdge.getRed(), leftUpEdge.getGreen(), leftUpEdge.getBlue(), leftUpEdge.getAlpha()); + glColor4ub (leftUpEdge.getRed(), leftUpEdge.getGreen(), leftUpEdge.getBlue(), leftUpEdge.getAlpha() ); glVertex3f(-1.1f, 1.1f,0.9f); - glColor4ub(rightUpEdge.getRed(), rightUpEdge.getGreen(), rightUpEdge.getBlue(), rightUpEdge.getAlpha()); - glVertex3f(1.1f, 1.1f,0.9f); + glColor4ub (rightUpEdge.getRed(), rightUpEdge.getGreen(), rightUpEdge.getBlue(), rightUpEdge.getAlpha() ); + glVertex3f( 1.1f, 1.1f,0.9f); - glColor4ub(rightDownEdge.getRed(), rightDownEdge.getGreen(), rightDownEdge.getBlue(), rightDownEdge.getAlpha()); - glVertex3f(1.1f,-1.1f,0.9f); + glColor4ub (rightDownEdge.getRed(), rightDownEdge.getGreen(), rightDownEdge.getBlue(), rightDownEdge.getAlpha() ); + glVertex3f( 1.1f,-1.1f,0.9f); glEnd(); @@ -2570,7 +2576,7 @@ void COpenGLDriver::setFog(SColor c, bool linearFog, f32 start, glFogi(GL_FOG_COORDINATE_SOURCE, GL_FRAGMENT_DEPTH); #endif - if (linearFog) + if(linearFog) { glFogf(GL_FOG_START, start); glFogf(GL_FOG_END, end); @@ -2734,20 +2740,14 @@ ITexture* COpenGLDriver::addRenderTargetTexture(const core::dimension2d& si rtt = new COpenGLFBOTexture(size, name, this); if (rtt) { - bool success = false; addTexture(rtt); ITexture* tex = createDepthTexture(rtt); if (tex) { - success = static_cast(tex)->attach(rtt); + static_cast(tex)->attach(rtt); tex->drop(); } rtt->drop(); - if (!success) - { - removeTexture(rtt); - rtt=0; - } } } else @@ -2841,7 +2841,7 @@ bool COpenGLDriver::setRenderTarget(video::ITexture* texture, bool clearBackBuff // returns the current size of the screen or rendertarget const core::dimension2d& COpenGLDriver::getCurrentRenderTargetSize() const { - if (CurrentRendertargetSize.Width == 0) + if ( CurrentRendertargetSize.Width == 0 ) return ScreenSize; else return CurrentRendertargetSize; diff --git a/src/dep/src/irrlicht/COpenGLDriver.h b/src/dep/src/irrlicht/COpenGLDriver.h index f649ef3..3682a30 100644 --- a/src/dep/src/irrlicht/COpenGLDriver.h +++ b/src/dep/src/irrlicht/COpenGLDriver.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in Irrlicht.h @@ -116,6 +116,7 @@ namespace video GLuint vbo_verticesSize; //tmp GLuint vbo_indicesSize; //tmp + }; bool updateVertexHardwareBuffer(SHWBufferLink_opengl *HWBuffer); diff --git a/src/dep/src/irrlicht/COpenGLExtensionHandler.cpp b/src/dep/src/irrlicht/COpenGLExtensionHandler.cpp index 3d2d8fa..82afe25 100644 --- a/src/dep/src/irrlicht/COpenGLExtensionHandler.cpp +++ b/src/dep/src/irrlicht/COpenGLExtensionHandler.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -21,7 +21,7 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() : MultiTextureExtension(false), MultiSamplingExtension(false), AnisotropyExtension(false), TextureCompressionExtension(false), MaxTextureUnits(1), MaxLights(1), MaxIndices(65535), - MaxAnisotropy(1.0f), MaxUserClipPlanes(0), MaxMultipleRenderTargets(1), + MaxAnisotropy(1.0f), MaxUserClipPlanes(0), Version(0), ShaderLanguageVersion(0) #ifdef _IRR_OPENGL_USE_EXTPOINTER_ ,pGlActiveTextureARB(0), pGlClientActiveTextureARB(0), @@ -45,7 +45,6 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() : pGlCheckFramebufferStatusEXT(0), pGlFramebufferTexture2DEXT(0), pGlBindRenderbufferEXT(0), pGlDeleteRenderbuffersEXT(0), pGlGenRenderbuffersEXT(0), pGlRenderbufferStorageEXT(0), pGlFramebufferRenderbufferEXT(0), - pGlDrawBuffersARB(0), pGlDrawBuffersATI(0), pGlGenBuffersARB(0), pGlBindBufferARB(0), pGlBufferDataARB(0), pGlDeleteBuffersARB(0), pGlBufferSubDataARB(0), pGlGetBufferSubDataARB(0), pGlMapBufferARB(0), pGlUnmapBufferARB(0), pGlIsBufferARB(0), pGlGetBufferParameterivARB(0), pGlGetBufferPointervARB(0) @@ -67,7 +66,7 @@ void COpenGLExtensionHandler::dump() const void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) { const f32 ogl_ver = core::fast_atof(reinterpret_cast(glGetString(GL_VERSION))); - Version = core::floor32(ogl_ver)*100+core::round32(core::fract(ogl_ver)*10.0f); + Version = core::floor32(ogl_ver)*100+core::ceil32(core::fract(ogl_ver)*10.0f); if ( Version >= 102) os::Printer::log("OpenGL driver version is 1.2 or better.", ELL_INFORMATION); else @@ -164,8 +163,6 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) pGlGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC) wglGetProcAddress("glGenRenderbuffersEXT"); pGlRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC) wglGetProcAddress("glRenderbufferStorageEXT"); pGlFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) wglGetProcAddress("glFramebufferRenderbufferEXT"); - pGlDrawBuffersARB = (PFNGLDRAWBUFFERSARBPROC) wglGetProcAddress("glDrawBuffersARB"); - pGlDrawBuffersATI = (PFNGLDRAWBUFFERSATIPROC) wglGetProcAddress("glDrawBuffersATI"); // get vertex buffer extension pGlGenBuffersARB = (PFNGLGENBUFFERSARBPROC) wglGetProcAddress("glGenBuffersARB"); @@ -355,12 +352,6 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) pGlFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) IRR_OGL_LOAD_EXTENSION(reinterpret_cast("glFramebufferRenderbufferEXT")); - pGlDrawBuffersARB = (PFNGLDRAWBUFFERSARBPROC) - IRR_OGL_LOAD_EXTENSION(reinterpret_cast("glDrawBuffersARB")); - - pGlDrawBuffersATI = (PFNGLDRAWBUFFERSATIPROC) - IRR_OGL_LOAD_EXTENSION(reinterpret_cast("glDrawBuffersATI")); - pGlGenBuffersARB = (PFNGLGENBUFFERSARBPROC) IRR_OGL_LOAD_EXTENSION(reinterpret_cast("glGenBuffersARB")); @@ -415,19 +406,6 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) #ifdef GL_VERSION_1_2 if (Version>101) glGetIntegerv(GL_MAX_ELEMENTS_INDICES, &MaxIndices); -#endif -#ifdef ARB_draw_buffers - if (FeatureAvailable[IRR_ARB_draw_buffers]) - { - glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, reinterpret_cast(&MaxUserClipPlanes)); - MaxMultipleRenderTargets = static_cast(MaxUserClipPlanes); - } -#elif defined(ATI_draw_buffers) - if (FeatureAvailable[IRR_ATI_draw_buffers]) - { - glGetIntegerv(GL_MAX_DRAW_BUFFERS_ATI, reinterpret_cast(&MaxUserClipPlanes)); - MaxMultipleRenderTargets = static_cast(MaxUserClipPlanes); - } #endif glGetIntegerv(GL_MAX_CLIP_PLANES, reinterpret_cast(&MaxUserClipPlanes)); #if defined(GL_ARB_shading_language_100) || defined (GL_VERSION_2_0) @@ -444,7 +422,7 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) else { const f32 sl_ver = core::fast_atof(reinterpret_cast(shaderVersion)); - ShaderLanguageVersion = core::floor32(sl_ver)*100+core::round32(core::fract(sl_ver)*10.0f); + ShaderLanguageVersion = core::floor32(sl_ver)*100+core::ceil32(core::fract(sl_ver)*10.0f); } } #endif diff --git a/src/dep/src/irrlicht/COpenGLExtensionHandler.h b/src/dep/src/irrlicht/COpenGLExtensionHandler.h index 14b4959..ade7b3a 100644 --- a/src/dep/src/irrlicht/COpenGLExtensionHandler.h +++ b/src/dep/src/irrlicht/COpenGLExtensionHandler.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in Irrlicht.h @@ -723,8 +723,6 @@ class COpenGLExtensionHandler f32 MaxAnisotropy; //! Number of user clipplanes u32 MaxUserClipPlanes; - //! Number of rendertargets available as MRTs - u8 MaxMultipleRenderTargets; //! OpenGL version as Integer: 100*Major+Minor, i.e. 2.1 becomes 201 u32 Version; @@ -782,7 +780,6 @@ class COpenGLExtensionHandler void extGlRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); void extGlFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); void extGlActiveStencilFace(GLenum face); - void extGlDrawBuffers(GLsizei n, const GLenum *bufs); // vertex buffer object void extGlGenBuffers(GLsizei n, GLuint *buffers); @@ -854,8 +851,6 @@ class COpenGLExtensionHandler PFNGLRENDERBUFFERSTORAGEEXTPROC pGlRenderbufferStorageEXT; PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC pGlFramebufferRenderbufferEXT; PFNGLACTIVESTENCILFACEEXTPROC pGlActiveStencilFaceEXT; - PFNGLDRAWBUFFERSARBPROC pGlDrawBuffersARB; - PFNGLDRAWBUFFERSATIPROC pGlDrawBuffersATI; PFNGLGENBUFFERSARBPROC pGlGenBuffersARB; PFNGLBINDBUFFERARBPROC pGlBindBufferARB; PFNGLBUFFERDATAARBPROC pGlBufferDataARB; @@ -1399,22 +1394,6 @@ inline void COpenGLExtensionHandler::extGlActiveStencilFace(GLenum face) #endif } -inline void COpenGLExtensionHandler::extGlDrawBuffers(GLsizei n, const GLenum *bufs) -{ -#ifdef _IRR_OPENGL_USE_EXTPOINTER_ - if (pGlDrawBuffersARB) - pGlDrawBuffersARB(n, bufs); - else if (pGlDrawBuffersATI) - pGlDrawBuffersATI(n, bufs); -#elif defined(GL_ARB_draw_buffers) - glDrawBuffersARB(n, bufs); -#elif defined(GL_ATI_draw_buffers) - glDrawBuffersATI(n, bufs); -#else - os::Printer::log("glDrawBuffers not supported", ELL_ERROR); -#endif -} - inline void COpenGLExtensionHandler::extGlGenBuffers(GLsizei n, GLuint *buffers) { diff --git a/src/dep/src/irrlicht/COpenGLMaterialRenderer.h b/src/dep/src/irrlicht/COpenGLMaterialRenderer.h index f8da565..83dde8a 100644 --- a/src/dep/src/irrlicht/COpenGLMaterialRenderer.h +++ b/src/dep/src/irrlicht/COpenGLMaterialRenderer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -155,13 +155,6 @@ public: glDisable(GL_ALPHA_TEST); } - //! Returns if the material is transparent. - /** Is not always transparent, but mostly. */ - virtual bool isTransparent() const - { - return true; - } - private: u32 getGLBlend ( E_BLEND_FACTOR factor ) const diff --git a/src/dep/src/irrlicht/COpenGLNormalMapRenderer.cpp b/src/dep/src/irrlicht/COpenGLNormalMapRenderer.cpp index 2f7606b..d901712 100644 --- a/src/dep/src/irrlicht/COpenGLNormalMapRenderer.cpp +++ b/src/dep/src/irrlicht/COpenGLNormalMapRenderer.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/COpenGLNormalMapRenderer.h b/src/dep/src/irrlicht/COpenGLNormalMapRenderer.h index 4b50954..9f7d755 100644 --- a/src/dep/src/irrlicht/COpenGLNormalMapRenderer.h +++ b/src/dep/src/irrlicht/COpenGLNormalMapRenderer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/COpenGLParallaxMapRenderer.cpp b/src/dep/src/irrlicht/COpenGLParallaxMapRenderer.cpp index 04243a0..dde494e 100644 --- a/src/dep/src/irrlicht/COpenGLParallaxMapRenderer.cpp +++ b/src/dep/src/irrlicht/COpenGLParallaxMapRenderer.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/COpenGLParallaxMapRenderer.h b/src/dep/src/irrlicht/COpenGLParallaxMapRenderer.h index a97c3ab..0fc0f1d 100644 --- a/src/dep/src/irrlicht/COpenGLParallaxMapRenderer.h +++ b/src/dep/src/irrlicht/COpenGLParallaxMapRenderer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/COpenGLSLMaterialRenderer.cpp b/src/dep/src/irrlicht/COpenGLSLMaterialRenderer.cpp index 0a7825b..e4b5bad 100644 --- a/src/dep/src/irrlicht/COpenGLSLMaterialRenderer.cpp +++ b/src/dep/src/irrlicht/COpenGLSLMaterialRenderer.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/COpenGLSLMaterialRenderer.h b/src/dep/src/irrlicht/COpenGLSLMaterialRenderer.h index af1709e..ef7f58a 100644 --- a/src/dep/src/irrlicht/COpenGLSLMaterialRenderer.h +++ b/src/dep/src/irrlicht/COpenGLSLMaterialRenderer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/COpenGLShaderMaterialRenderer.cpp b/src/dep/src/irrlicht/COpenGLShaderMaterialRenderer.cpp index 2583312..4dac60e 100644 --- a/src/dep/src/irrlicht/COpenGLShaderMaterialRenderer.cpp +++ b/src/dep/src/irrlicht/COpenGLShaderMaterialRenderer.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/COpenGLShaderMaterialRenderer.h b/src/dep/src/irrlicht/COpenGLShaderMaterialRenderer.h index 2fd2a46..c433de9 100644 --- a/src/dep/src/irrlicht/COpenGLShaderMaterialRenderer.h +++ b/src/dep/src/irrlicht/COpenGLShaderMaterialRenderer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/COpenGLTexture.cpp b/src/dep/src/irrlicht/COpenGLTexture.cpp index 4047f74..6130d8a 100644 --- a/src/dep/src/irrlicht/COpenGLTexture.cpp +++ b/src/dep/src/irrlicht/COpenGLTexture.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -178,7 +178,7 @@ void COpenGLTexture::copyTexture(bool newTexture) break; } - Driver->setTexture(0, this); + glBindTexture(GL_TEXTURE_2D, TextureName); if (Driver->testGLError()) os::Printer::log("Could not bind Texture", ELL_ERROR); @@ -416,7 +416,7 @@ void COpenGLTexture::bindRTT() //! Unbind Render Target Texture void COpenGLTexture::unbindRTT() { - Driver->setTexture(0, this); + glBindTexture(GL_TEXTURE_2D, getOpenGLTextureName()); // Copy Our ViewPort To The Texture glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, getSize().Width, getSize().Height); @@ -425,8 +425,11 @@ void COpenGLTexture::unbindRTT() /* FBO Textures */ +#ifdef GL_EXT_framebuffer_object // helper function for render to texture static bool checkFBOStatus(COpenGLDriver* Driver); +#endif + //! RTT ColorFrameBuffer constructor COpenGLFBOTexture::COpenGLFBOTexture(const core::dimension2d& size, @@ -453,7 +456,7 @@ COpenGLFBOTexture::COpenGLFBOTexture(const core::dimension2d& size, // generate color texture glGenTextures(1, &TextureName); - Driver->setTexture(0, this); + glBindTexture(GL_TEXTURE_2D, TextureName); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); @@ -594,10 +597,10 @@ COpenGLFBODepthTexture::~COpenGLFBODepthTexture() //combine depth texture and rtt -bool COpenGLFBODepthTexture::attach(ITexture* renderTex) +void COpenGLFBODepthTexture::attach(ITexture* renderTex) { if (!renderTex) - return false; + return; video::COpenGLFBOTexture* rtt = static_cast(renderTex); rtt->bindRTT(); #ifdef GL_EXT_framebuffer_object @@ -625,17 +628,13 @@ bool COpenGLFBODepthTexture::attach(ITexture* renderTex) GL_RENDERBUFFER_EXT, DepthRenderBuffer); } -#endif // check the status if (!checkFBOStatus(Driver)) - { os::Printer::log("FBO incomplete"); - return false; - } +#endif rtt->DepthTexture=this; grab(); // grab the depth buffer, not the RTT rtt->unbindRTT(); - return true; } @@ -651,9 +650,9 @@ void COpenGLFBODepthTexture::unbindRTT() } +#ifdef GL_EXT_framebuffer_object bool checkFBOStatus(COpenGLDriver* Driver) { -#ifdef GL_EXT_framebuffer_object GLenum status = Driver->extGlCheckFramebufferStatus(GL_FRAMEBUFFER_EXT); switch (status) @@ -700,10 +699,10 @@ bool checkFBOStatus(COpenGLDriver* Driver) default: break; } -#endif os::Printer::log("FBO error", ELL_ERROR); return false; } +#endif } // end namespace video diff --git a/src/dep/src/irrlicht/COpenGLTexture.h b/src/dep/src/irrlicht/COpenGLTexture.h index e2ee95c..6989395 100644 --- a/src/dep/src/irrlicht/COpenGLTexture.h +++ b/src/dep/src/irrlicht/COpenGLTexture.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -175,7 +175,7 @@ public: //! Unbind RenderTargetTexture virtual void unbindRTT(); - bool attach(ITexture*); + void attach(ITexture*); protected: GLuint DepthRenderBuffer; diff --git a/src/dep/src/irrlicht/CPakReader.cpp b/src/dep/src/irrlicht/CPakReader.cpp index 9daca52..0315f69 100644 --- a/src/dep/src/irrlicht/CPakReader.cpp +++ b/src/dep/src/irrlicht/CPakReader.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h // Code contributed by skreamz diff --git a/src/dep/src/irrlicht/CPakReader.h b/src/dep/src/irrlicht/CPakReader.h index 82d75e0..5ed6b24 100644 --- a/src/dep/src/irrlicht/CPakReader.h +++ b/src/dep/src/irrlicht/CPakReader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticleAnimatedMeshSceneNodeEmitter.cpp b/src/dep/src/irrlicht/CParticleAnimatedMeshSceneNodeEmitter.cpp index 6ecead6..c8a56f5 100644 --- a/src/dep/src/irrlicht/CParticleAnimatedMeshSceneNodeEmitter.cpp +++ b/src/dep/src/irrlicht/CParticleAnimatedMeshSceneNodeEmitter.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticleAnimatedMeshSceneNodeEmitter.h b/src/dep/src/irrlicht/CParticleAnimatedMeshSceneNodeEmitter.h index d6bf923..ccf6049 100644 --- a/src/dep/src/irrlicht/CParticleAnimatedMeshSceneNodeEmitter.h +++ b/src/dep/src/irrlicht/CParticleAnimatedMeshSceneNodeEmitter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticleAttractionAffector.cpp b/src/dep/src/irrlicht/CParticleAttractionAffector.cpp index 872c945..15c376e 100644 --- a/src/dep/src/irrlicht/CParticleAttractionAffector.cpp +++ b/src/dep/src/irrlicht/CParticleAttractionAffector.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticleAttractionAffector.h b/src/dep/src/irrlicht/CParticleAttractionAffector.h index 0c5edda..4cc3e22 100644 --- a/src/dep/src/irrlicht/CParticleAttractionAffector.h +++ b/src/dep/src/irrlicht/CParticleAttractionAffector.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticleBoxEmitter.cpp b/src/dep/src/irrlicht/CParticleBoxEmitter.cpp index 86b8f17..fd72b8f 100644 --- a/src/dep/src/irrlicht/CParticleBoxEmitter.cpp +++ b/src/dep/src/irrlicht/CParticleBoxEmitter.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticleBoxEmitter.h b/src/dep/src/irrlicht/CParticleBoxEmitter.h index 052ee49..4ea1ee2 100644 --- a/src/dep/src/irrlicht/CParticleBoxEmitter.h +++ b/src/dep/src/irrlicht/CParticleBoxEmitter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticleCylinderEmitter.cpp b/src/dep/src/irrlicht/CParticleCylinderEmitter.cpp index 095f447..c0287e6 100644 --- a/src/dep/src/irrlicht/CParticleCylinderEmitter.cpp +++ b/src/dep/src/irrlicht/CParticleCylinderEmitter.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticleCylinderEmitter.h b/src/dep/src/irrlicht/CParticleCylinderEmitter.h index 709aa56..1907066 100644 --- a/src/dep/src/irrlicht/CParticleCylinderEmitter.h +++ b/src/dep/src/irrlicht/CParticleCylinderEmitter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticleFadeOutAffector.cpp b/src/dep/src/irrlicht/CParticleFadeOutAffector.cpp index 87c3897..0df27ba 100644 --- a/src/dep/src/irrlicht/CParticleFadeOutAffector.cpp +++ b/src/dep/src/irrlicht/CParticleFadeOutAffector.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticleFadeOutAffector.h b/src/dep/src/irrlicht/CParticleFadeOutAffector.h index 9db8af4..71cfc7a 100644 --- a/src/dep/src/irrlicht/CParticleFadeOutAffector.h +++ b/src/dep/src/irrlicht/CParticleFadeOutAffector.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticleGravityAffector.cpp b/src/dep/src/irrlicht/CParticleGravityAffector.cpp index 295677c..f6ce52c 100644 --- a/src/dep/src/irrlicht/CParticleGravityAffector.cpp +++ b/src/dep/src/irrlicht/CParticleGravityAffector.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticleGravityAffector.h b/src/dep/src/irrlicht/CParticleGravityAffector.h index 1ab67a0..df082b6 100644 --- a/src/dep/src/irrlicht/CParticleGravityAffector.h +++ b/src/dep/src/irrlicht/CParticleGravityAffector.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticleMeshEmitter.cpp b/src/dep/src/irrlicht/CParticleMeshEmitter.cpp index 2f67355..d18288c 100644 --- a/src/dep/src/irrlicht/CParticleMeshEmitter.cpp +++ b/src/dep/src/irrlicht/CParticleMeshEmitter.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticleMeshEmitter.h b/src/dep/src/irrlicht/CParticleMeshEmitter.h index 3cbb4f3..9a8d7b8 100644 --- a/src/dep/src/irrlicht/CParticleMeshEmitter.h +++ b/src/dep/src/irrlicht/CParticleMeshEmitter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticlePointEmitter.cpp b/src/dep/src/irrlicht/CParticlePointEmitter.cpp index 889076b..8ea9236 100644 --- a/src/dep/src/irrlicht/CParticlePointEmitter.cpp +++ b/src/dep/src/irrlicht/CParticlePointEmitter.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticlePointEmitter.h b/src/dep/src/irrlicht/CParticlePointEmitter.h index ae436ae..bc3ebc4 100644 --- a/src/dep/src/irrlicht/CParticlePointEmitter.h +++ b/src/dep/src/irrlicht/CParticlePointEmitter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticleRingEmitter.cpp b/src/dep/src/irrlicht/CParticleRingEmitter.cpp index e424f94..91ea47b 100644 --- a/src/dep/src/irrlicht/CParticleRingEmitter.cpp +++ b/src/dep/src/irrlicht/CParticleRingEmitter.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticleRingEmitter.h b/src/dep/src/irrlicht/CParticleRingEmitter.h index 21451e9..5b40e25 100644 --- a/src/dep/src/irrlicht/CParticleRingEmitter.h +++ b/src/dep/src/irrlicht/CParticleRingEmitter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticleRotationAffector.cpp b/src/dep/src/irrlicht/CParticleRotationAffector.cpp index 90a1594..4f9210b 100644 --- a/src/dep/src/irrlicht/CParticleRotationAffector.cpp +++ b/src/dep/src/irrlicht/CParticleRotationAffector.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticleRotationAffector.h b/src/dep/src/irrlicht/CParticleRotationAffector.h index 68fc81a..3ced836 100644 --- a/src/dep/src/irrlicht/CParticleRotationAffector.h +++ b/src/dep/src/irrlicht/CParticleRotationAffector.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticleScaleAffector.cpp b/src/dep/src/irrlicht/CParticleScaleAffector.cpp new file mode 100644 index 0000000..6bf002c --- /dev/null +++ b/src/dep/src/irrlicht/CParticleScaleAffector.cpp @@ -0,0 +1,47 @@ +#include "CParticleScaleAffector.h" +#include "IAttributes.h" + +namespace irr +{ + namespace scene + { + CParticleScaleAffector::CParticleScaleAffector(const core::dimension2df& scaleTo) + : ScaleTo(scaleTo) + { + } + + + void CParticleScaleAffector::affect (u32 now, SParticle *particlearray, u32 count) + { + for(u32 i=0;iaddFloat("ScaleToWidth", ScaleTo.Width); + out->addFloat("ScaleToHeight", ScaleTo.Height); + } + + + s32 CParticleScaleAffector::deserializeAttributes(s32 startIndex, io::IAttributes* in, io::SAttributeReadWriteOptions* options) + { + ScaleTo.Width = in->getAttributeAsFloat("ScaleToWidth"); + ScaleTo.Height = in->getAttributeAsFloat("ScaleToHeight"); + return 0; + } + + + E_PARTICLE_AFFECTOR_TYPE CParticleScaleAffector::getType() const + { + return scene::EPAT_SCALE; + } + } +} + diff --git a/src/dep/src/irrlicht/CParticleScaleAffector.h b/src/dep/src/irrlicht/CParticleScaleAffector.h new file mode 100644 index 0000000..6079ab7 --- /dev/null +++ b/src/dep/src/irrlicht/CParticleScaleAffector.h @@ -0,0 +1,40 @@ +#ifndef C_PARTICLE_SCALE_AFFECTOR_H +#define C_PARTICLE_SCALE_AFFECTOR_H + +#include + +namespace irr +{ + namespace scene + { + class CParticleScaleAffector : public IParticleAffector + { + public: + CParticleScaleAffector(const core::dimension2df& scaleTo = core::dimension2df(1.0f, 1.0f)); + + virtual void affect(u32 now, SParticle *particlearray, u32 count); + + //! Writes attributes of the object. + //! Implement this to expose the attributes of your scene node animator for + //! scripting languages, editors, debuggers or xml serialization purposes. + virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options); + + //! Reads attributes of the object. + //! Implement this to set the attributes of your scene node animator for + //! scripting languages, editors, debuggers or xml deserialization purposes. + //! \param startIndex: start index where to start reading attributes. + //! \return: returns last index of an attribute read by this affector + virtual s32 deserializeAttributes(s32 startIndex, io::IAttributes* in, io::SAttributeReadWriteOptions* options); + + //! Get emitter type + virtual E_PARTICLE_AFFECTOR_TYPE getType() const; + + protected: + core::dimension2df ScaleTo; + }; + } +} + + +#endif // C_PARTICLE_SCALE_AFFECTOR_H + diff --git a/src/dep/src/irrlicht/CParticleSphereEmitter.cpp b/src/dep/src/irrlicht/CParticleSphereEmitter.cpp index 5fefe7d..fc4cee2 100644 --- a/src/dep/src/irrlicht/CParticleSphereEmitter.cpp +++ b/src/dep/src/irrlicht/CParticleSphereEmitter.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticleSphereEmitter.h b/src/dep/src/irrlicht/CParticleSphereEmitter.h index 7618d0b..3858bcc 100644 --- a/src/dep/src/irrlicht/CParticleSphereEmitter.h +++ b/src/dep/src/irrlicht/CParticleSphereEmitter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticleSystemSceneNode.cpp b/src/dep/src/irrlicht/CParticleSystemSceneNode.cpp index 984c8a3..dc27d21 100644 --- a/src/dep/src/irrlicht/CParticleSystemSceneNode.cpp +++ b/src/dep/src/irrlicht/CParticleSystemSceneNode.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CParticleSystemSceneNode.h b/src/dep/src/irrlicht/CParticleSystemSceneNode.h index 915cf95..85f8c11 100644 --- a/src/dep/src/irrlicht/CParticleSystemSceneNode.h +++ b/src/dep/src/irrlicht/CParticleSystemSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CQ3LevelMesh.cpp b/src/dep/src/irrlicht/CQ3LevelMesh.cpp index b6c7771..cf28c76 100644 --- a/src/dep/src/irrlicht/CQ3LevelMesh.cpp +++ b/src/dep/src/irrlicht/CQ3LevelMesh.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CQ3LevelMesh.h b/src/dep/src/irrlicht/CQ3LevelMesh.h index ca08ba3..864ce72 100644 --- a/src/dep/src/irrlicht/CQ3LevelMesh.h +++ b/src/dep/src/irrlicht/CQ3LevelMesh.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CQuake3ShaderSceneNode.cpp b/src/dep/src/irrlicht/CQuake3ShaderSceneNode.cpp index 9f8e353..4527c85 100644 --- a/src/dep/src/irrlicht/CQuake3ShaderSceneNode.cpp +++ b/src/dep/src/irrlicht/CQuake3ShaderSceneNode.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CQuake3ShaderSceneNode.h b/src/dep/src/irrlicht/CQuake3ShaderSceneNode.h index 7ffc7b6..34082c4 100644 --- a/src/dep/src/irrlicht/CQuake3ShaderSceneNode.h +++ b/src/dep/src/irrlicht/CQuake3ShaderSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CReadFile.cpp b/src/dep/src/irrlicht/CReadFile.cpp index a8550f3..7fe733f 100644 --- a/src/dep/src/irrlicht/CReadFile.cpp +++ b/src/dep/src/irrlicht/CReadFile.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CReadFile.h b/src/dep/src/irrlicht/CReadFile.h index 497c58c..b09da7b 100644 --- a/src/dep/src/irrlicht/CReadFile.h +++ b/src/dep/src/irrlicht/CReadFile.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSTLMeshFileLoader.cpp b/src/dep/src/irrlicht/CSTLMeshFileLoader.cpp index 8779dbb..3f4a496 100644 --- a/src/dep/src/irrlicht/CSTLMeshFileLoader.cpp +++ b/src/dep/src/irrlicht/CSTLMeshFileLoader.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2009 Christian Stehno +// Copyright (C) 2007-2008 Christian Stehno // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSTLMeshFileLoader.h b/src/dep/src/irrlicht/CSTLMeshFileLoader.h index 3210f29..41e86d3 100644 --- a/src/dep/src/irrlicht/CSTLMeshFileLoader.h +++ b/src/dep/src/irrlicht/CSTLMeshFileLoader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2009 Christian Stehno +// Copyright (C) 2007-2008 Christian Stehno // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSTLMeshWriter.cpp b/src/dep/src/irrlicht/CSTLMeshWriter.cpp index 647aa6a..ca87c6a 100644 --- a/src/dep/src/irrlicht/CSTLMeshWriter.cpp +++ b/src/dep/src/irrlicht/CSTLMeshWriter.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSTLMeshWriter.h b/src/dep/src/irrlicht/CSTLMeshWriter.h index 017d0eb..1380245 100644 --- a/src/dep/src/irrlicht/CSTLMeshWriter.h +++ b/src/dep/src/irrlicht/CSTLMeshWriter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSceneCollisionManager.cpp b/src/dep/src/irrlicht/CSceneCollisionManager.cpp index b6ceec5..511b918 100644 --- a/src/dep/src/irrlicht/CSceneCollisionManager.cpp +++ b/src/dep/src/irrlicht/CSceneCollisionManager.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -64,7 +64,7 @@ ISceneNode* CSceneCollisionManager::getSceneNodeFromRayBB(core::line3d ray, ISceneNode* best = 0; f32 dist = FLT_MAX; - getPickedNodeBB(SceneManager->getRootSceneNode(), ray, + getPickedNodeBB(SceneManager->getRootSceneNode(), ray, idBitMask, bNoDebugObjects, dist, best); return best; @@ -88,60 +88,46 @@ void CSceneCollisionManager::getPickedNodeBB(ISceneNode* root, { ISceneNode* current = *it; - if (current->isVisible()) - { - if((bNoDebugObjects ? !current->isDebugObject() : true) && - (bits==0 || (bits != 0 && (current->getID() & bits)))) - { - // get world to object space transform - core::matrix4 mat; - if (!current->getAbsoluteTransformation().getInverse(mat)) - continue; + if (current->isVisible() && + (bNoDebugObjects ? !current->isDebugObject() : true) && + (bits==0 || (bits != 0 && (current->getID() & bits)))) + { + // get world to object space transform + core::matrix4 mat; + if (!current->getAbsoluteTransformation().getInverse(mat)) + continue; - // transform vector from world space to object space - core::line3df line(ray); - mat.transformVect(line.start); - mat.transformVect(line.end); + // transform vector from world space to object space + core::line3df line(ray); + mat.transformVect(line.start); + mat.transformVect(line.end); - const core::aabbox3df& box = current->getBoundingBox(); + const core::aabbox3df& box = current->getBoundingBox(); - // do the initial intersection test in object space, since the - // object space box is more accurate. - if (box.intersectsWithLine(line)) - { - box.getEdges(edges); - f32 distance = 0.0f; + // do intersection test in object space + if (box.intersectsWithLine(line)) + { + box.getEdges(edges); + f32 distance = 0.0f; - for (s32 e=0; e<8; ++e) - { - // Transform the corner into world coordinates, to take - // scaling into account. - current->getAbsoluteTransformation().transformVect(edges[e]); + for (s32 e=0; e<8; ++e) + { + f32 t = edges[e].getDistanceFromSQ(line.start); + if (t > distance) + distance = t; + } - // and compare it against the world space ray start position - f32 t = edges[e].getDistanceFromSQ(ray.start); + if (distance < outbestdistance) + { + outbestnode = current; + outbestdistance = distance; + } + } + } - // We're looking for the furthest corner; this is a crude - // test; we should be checking the actual ray/plane - // intersection. - // http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?p=181419 - if (t > distance) - distance = t; - } - - if (distance < outbestdistance) - { - outbestnode = current; - outbestdistance = distance; - } - } - } - - // Only check the children if this node is visible. - getPickedNodeBB(current, ray, bits, bNoDebugObjects, outbestdistance, outbestnode); - } + getPickedNodeBB(current, ray, bits, bNoDebugObjects, outbestdistance, outbestnode); } -} +} @@ -211,6 +197,11 @@ bool CSceneCollisionManager::getCollisionPoint(const core::line3d& ray, if(maxZ < triangle.pointA.Z && maxZ < triangle.pointB.Z && maxZ < triangle.pointC.Z) continue; + if(ray.start.getDistanceFromSQ(triangle.pointA) >= nearest && + ray.start.getDistanceFromSQ(triangle.pointB) >= nearest && + ray.start.getDistanceFromSQ(triangle.pointC) >= nearest) + continue; + if (triangle.getIntersectionWithLine(ray.start, linevect, intersection)) { const f32 tmp = intersection.getDistanceFromSQ(ray.start); @@ -589,7 +580,7 @@ core::vector3df CSceneCollisionManager::collideWithWorld(s32 recursionDepth, core::matrix4 scaleMatrix; scaleMatrix.setScale( - core::vector3df(1.0f / colData.eRadius.X, + core::vector3df(1.0f / colData.eRadius.X, 1.0f / colData.eRadius.Y, 1.0f / colData.eRadius.Z) ); diff --git a/src/dep/src/irrlicht/CSceneCollisionManager.h b/src/dep/src/irrlicht/CSceneCollisionManager.h index cb28b0e..95ac9e4 100644 --- a/src/dep/src/irrlicht/CSceneCollisionManager.h +++ b/src/dep/src/irrlicht/CSceneCollisionManager.h @@ -1,7 +1,7 @@ #ifndef __C_SCENE_COLLISION_MANAGER_H_INCLUDED__ #define __C_SCENE_COLLISION_MANAGER_H_INCLUDED__ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSceneManager.cpp b/src/dep/src/irrlicht/CSceneManager.cpp index 2eebb87..596ed8c 100644 --- a/src/dep/src/irrlicht/CSceneManager.cpp +++ b/src/dep/src/irrlicht/CSceneManager.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSceneManager.h b/src/dep/src/irrlicht/CSceneManager.h index 0d8ee8c..d6b90d3 100644 --- a/src/dep/src/irrlicht/CSceneManager.h +++ b/src/dep/src/irrlicht/CSceneManager.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSceneNodeAnimatorCameraFPS.cpp b/src/dep/src/irrlicht/CSceneNodeAnimatorCameraFPS.cpp new file mode 100644 index 0000000..1b1d0d5 --- /dev/null +++ b/src/dep/src/irrlicht/CSceneNodeAnimatorCameraFPS.cpp @@ -0,0 +1,322 @@ +// Copyright (C) 2002-2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#include "CSceneNodeAnimatorCameraFPS.h" +#include "IVideoDriver.h" +#include "ISceneManager.h" +#include "Keycodes.h" +#include "ICursorControl.h" +#include "ICameraSceneNode.h" +#include "ISceneNodeAnimatorCollisionResponse.h" + +namespace irr +{ +namespace scene +{ + +//! constructor +CSceneNodeAnimatorCameraFPS::CSceneNodeAnimatorCameraFPS(gui::ICursorControl* cursorControl, + f32 rotateSpeed, f32 moveSpeed, f32 jumpSpeed, + SKeyMap* keyMapArray, u32 keyMapSize, bool noVerticalMovement) +: CursorControl(cursorControl), MaxVerticalAngle(88.0f), + MoveSpeed(moveSpeed), RotateSpeed(rotateSpeed), JumpSpeed(jumpSpeed), + LastAnimationTime(0), firstUpdate(true), NoVerticalMovement(noVerticalMovement) +{ + #ifdef _DEBUG + setDebugName("CCameraSceneNodeAnimatorFPS"); + #endif + + if (CursorControl) + CursorControl->grab(); + + allKeysUp(); + + // create key map + if (!keyMapArray || !keyMapSize) + { + // create default key map + KeyMap.push_back(SCamKeyMap(EKA_MOVE_FORWARD, irr::KEY_UP)); + KeyMap.push_back(SCamKeyMap(EKA_MOVE_BACKWARD, irr::KEY_DOWN)); + KeyMap.push_back(SCamKeyMap(EKA_STRAFE_LEFT, irr::KEY_LEFT)); + KeyMap.push_back(SCamKeyMap(EKA_STRAFE_RIGHT, irr::KEY_RIGHT)); + KeyMap.push_back(SCamKeyMap(EKA_JUMP_UP, irr::KEY_KEY_J)); + } + else + { + // create custom key map + setKeyMap(keyMapArray, keyMapSize); + } +} + + +//! destructor +CSceneNodeAnimatorCameraFPS::~CSceneNodeAnimatorCameraFPS() +{ + if (CursorControl) + CursorControl->drop(); +} + + +//! It is possible to send mouse and key events to the camera. Most cameras +//! may ignore this input, but camera scene nodes which are created for +//! example with scene::ISceneManager::addMayaCameraSceneNode or +//! scene::ISceneManager::addFPSCameraSceneNode, may want to get this input +//! for changing their position, look at target or whatever. +bool CSceneNodeAnimatorCameraFPS::OnEvent(const SEvent& evt) +{ + switch(evt.EventType) + { + case EET_KEY_INPUT_EVENT: + for (u32 i=0; igetRelativePosition(); + return true; + } + break; + + default: + break; + } + + return false; +} + + +void CSceneNodeAnimatorCameraFPS::animateNode(ISceneNode* node, u32 timeMs) +{ + if (node->getType() != ESNT_CAMERA) + return; + + ICameraSceneNode* camera = static_cast(node); + + if (firstUpdate) + { + camera->updateAbsolutePosition(); + if (CursorControl && camera) + { + CursorControl->setPosition(0.5f, 0.5f); + CursorPos = CenterCursor = CursorControl->getRelativePosition(); + } + + LastAnimationTime = timeMs; + + firstUpdate = false; + } + + // get time + f32 timeDiff = (f32) ( timeMs - LastAnimationTime ); + LastAnimationTime = timeMs; + + // update position + core::vector3df pos = camera->getPosition(); + + // Update rotation + core::vector3df target = (camera->getTarget() - camera->getAbsolutePosition()); + core::vector3df relativeRotation = target.getHorizontalAngle(); + + if (CursorControl) + { + if (CursorPos != CenterCursor) + { + relativeRotation.Y -= (0.5f - CursorPos.X) * RotateSpeed; + relativeRotation.X -= (0.5f - CursorPos.Y) * RotateSpeed; + + // X < MaxVerticalAngle or X > 360-MaxVerticalAngle + + if (relativeRotation.X > MaxVerticalAngle*2 && + relativeRotation.X < 360.0f-MaxVerticalAngle) + { + relativeRotation.X = 360.0f-MaxVerticalAngle; + } + else + if (relativeRotation.X > MaxVerticalAngle && + relativeRotation.X < 360.0f-MaxVerticalAngle) + { + relativeRotation.X = MaxVerticalAngle; + } + + // reset cursor position + CursorControl->setPosition(0.5f, 0.5f); + CenterCursor = CursorControl->getRelativePosition(); + // needed to avoid problems when the ecent receiver is + // disabled + CursorPos = CenterCursor; + } + } + + // set target + + target.set(0,0, core::max_(1.f, pos.getLength())); + core::vector3df movedir = target; + + core::matrix4 mat; + mat.setRotationDegrees(core::vector3df(relativeRotation.X, relativeRotation.Y, 0)); + mat.transformVect(target); + + if (NoVerticalMovement) + { + mat.setRotationDegrees(core::vector3df(0, relativeRotation.Y, 0)); + mat.transformVect(movedir); + } + else + { + movedir = target; + } + + movedir.normalize(); + + if (CursorKeys[EKA_MOVE_FORWARD]) + pos += movedir * timeDiff * MoveSpeed; + + if (CursorKeys[EKA_MOVE_BACKWARD]) + pos -= movedir * timeDiff * MoveSpeed; + + // strafing + + core::vector3df strafevect = target; + strafevect = strafevect.crossProduct(camera->getUpVector()); + + if (NoVerticalMovement) + strafevect.Y = 0.0f; + + strafevect.normalize(); + + if (CursorKeys[EKA_STRAFE_LEFT]) + pos += strafevect * timeDiff * MoveSpeed; + + if (CursorKeys[EKA_STRAFE_RIGHT]) + pos -= strafevect * timeDiff * MoveSpeed; + + // For jumping, we find the collision response animator attached to our camera + // and if it's not falling, we tell it to jump. + if (CursorKeys[EKA_JUMP_UP]) + { + const core::list & animators = camera->getAnimators(); + core::list::ConstIterator it = animators.begin(); + while(it != animators.end()) + { + if(ESNAT_COLLISION_RESPONSE == (*it)->getType()) + { + ISceneNodeAnimatorCollisionResponse * collisionResponse = + static_cast(*it); + + if(!collisionResponse->isFalling()) + collisionResponse->jump(JumpSpeed); + } + + it++; + } + } + + // write translation + camera->setPosition(pos); + + // write right target + + TargetVector = target; + target += pos; + camera->setTarget(target); +} + + +void CSceneNodeAnimatorCameraFPS::allKeysUp() +{ + for (u32 i=0; i<6; ++i) + CursorKeys[i] = false; +} + + +//! Sets the rotation speed +void CSceneNodeAnimatorCameraFPS::setRotateSpeed(f32 speed) +{ + RotateSpeed = speed; +} + + +//! Sets the movement speed +void CSceneNodeAnimatorCameraFPS::setMoveSpeed(f32 speed) +{ + MoveSpeed = speed; +} + + +//! Gets the rotation speed +f32 CSceneNodeAnimatorCameraFPS::getRotateSpeed() const +{ + return RotateSpeed; +} + + +// Gets the movement speed +f32 CSceneNodeAnimatorCameraFPS::getMoveSpeed() const +{ + return MoveSpeed; +} + + +//! Sets the keyboard mapping for this animator +void CSceneNodeAnimatorCameraFPS::setKeyMap(SKeyMap *map, u32 count) +{ + // clear the keymap + KeyMap.clear(); + + // add actions + for (u32 i=0; isetKeyMap(KeyMap); + return newAnimator; +} + + +void CSceneNodeAnimatorCameraFPS::setKeyMap(const core::array& keymap) +{ + KeyMap=keymap; +} + + +} // namespace scene +} // namespace irr + diff --git a/src/dep/src/irrlicht/CSceneNodeAnimatorCameraFPS.h b/src/dep/src/irrlicht/CSceneNodeAnimatorCameraFPS.h new file mode 100644 index 0000000..c4bc8e7 --- /dev/null +++ b/src/dep/src/irrlicht/CSceneNodeAnimatorCameraFPS.h @@ -0,0 +1,121 @@ +// Copyright (C) 2002-2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#ifndef __C_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED__ +#define __C_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED__ + +#include "ISceneNodeAnimatorCameraFPS.h" +#include "vector2d.h" +#include "SKeyMap.h" +#include "irrArray.h" + +namespace irr +{ +namespace gui +{ + class ICursorControl; +} + +namespace scene +{ + + //! Special scene node animator for FPS cameras + class CSceneNodeAnimatorCameraFPS : public ISceneNodeAnimatorCameraFPS + { + public: + + //! Constructor + CSceneNodeAnimatorCameraFPS(gui::ICursorControl* cursorControl, + f32 rotateSpeed = 100.0f, f32 moveSpeed = .5f, f32 jumpSpeed=0.f, + SKeyMap* keyMapArray=0, u32 keyMapSize=0, bool noVerticalMovement=false); + + //! Destructor + virtual ~CSceneNodeAnimatorCameraFPS(); + + //! Animates the scene node, currently only works on cameras + virtual void animateNode(ISceneNode* node, u32 timeMs); + + //! Event receiver + virtual bool OnEvent(const SEvent& event); + + //! Returns the speed of movement in units per second + virtual f32 getMoveSpeed() const; + + //! Sets the speed of movement in units per second + virtual void setMoveSpeed(f32 moveSpeed); + + //! Returns the rotation speed + virtual f32 getRotateSpeed() const; + + //! Set the rotation speed + virtual void setRotateSpeed(f32 rotateSpeed); + + //! Sets the keyboard mapping for this animator + //! \param keymap: an array of keyboard mappings, see SKeyMap + //! \param count: the size of the keyboard map array + virtual void setKeyMap(SKeyMap *map, u32 count); + + //! Sets whether vertical movement should be allowed. + virtual void setVerticalMovement(bool allow); + + //! This animator will receive events when attached to the active camera + virtual bool isEventReceiverEnabled() const + { + return true; + } + + //! Returns the type of this animator + virtual ESCENE_NODE_ANIMATOR_TYPE getType() const + { + return ESNAT_CAMERA_FPS; + } + + //! Creates a clone of this animator. + /** Please note that you will have to drop + (IReferenceCounted::drop()) the returned pointer after calling + this. */ + virtual ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0); + + struct SCamKeyMap + { + SCamKeyMap() {}; + SCamKeyMap(s32 a, EKEY_CODE k) : action(a), keycode(k) {} + + s32 action; + EKEY_CODE keycode; + }; + + //! Sets the keyboard mapping for this animator + /** Helper function for the clone method. + \param keymap the new keymap array */ + void setKeyMap(const core::array& keymap); + + private: + void allKeysUp(); + + gui::ICursorControl *CursorControl; + + f32 MaxVerticalAngle; + + f32 MoveSpeed; + f32 RotateSpeed; + f32 JumpSpeed; + + s32 LastAnimationTime; + + core::vector3df TargetVector; + core::array KeyMap; + core::position2d CenterCursor, CursorPos; + + bool CursorKeys[6]; + + bool firstUpdate; + bool NoVerticalMovement; + }; + +} // end namespace scene +} // end namespace irr + +#endif // __C_SCENE_NODE_ANIMATOR_CAMERA_FPS_H_INCLUDED__ + diff --git a/src/dep/src/irrlicht/CSceneNodeAnimatorCameraMaya.cpp b/src/dep/src/irrlicht/CSceneNodeAnimatorCameraMaya.cpp new file mode 100644 index 0000000..27fe15d --- /dev/null +++ b/src/dep/src/irrlicht/CSceneNodeAnimatorCameraMaya.cpp @@ -0,0 +1,285 @@ +// Copyright (C) 2002-2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#include "CSceneNodeAnimatorCameraMaya.h" +#include "ICursorControl.h" +#include "ICameraSceneNode.h" +#include "SViewFrustum.h" + +namespace irr +{ +namespace scene +{ + +//! constructor +CSceneNodeAnimatorCameraMaya::CSceneNodeAnimatorCameraMaya(gui::ICursorControl* cursor, f32 rotate, f32 zoom, f32 translate) + : CursorControl(cursor), Zooming(false), Rotating(false), Moving(false), + Translating(false), ZoomSpeed(zoom), RotateSpeed(rotate), TranslateSpeed(translate), + CurrentZoom(70.0f), RotX(0.0f), RotY(0.0f), OldCamera(0), MousePos(0.5f, 0.5f) +{ + #ifdef _DEBUG + setDebugName("CSceneNodeAnimatorCameraMaya"); + #endif + + if (CursorControl) + { + CursorControl->grab(); + MousePos = CursorControl->getRelativePosition(); + } + + allKeysUp(); +} + + +//! destructor +CSceneNodeAnimatorCameraMaya::~CSceneNodeAnimatorCameraMaya() +{ + if (CursorControl) + CursorControl->drop(); +} + + +//! It is possible to send mouse and key events to the camera. Most cameras +//! may ignore this input, but camera scene nodes which are created for +//! example with scene::ISceneManager::addMayaCameraSceneNode or +//! scene::ISceneManager::addMeshViewerCameraSceneNode, may want to get this input +//! for changing their position, look at target or whatever. +bool CSceneNodeAnimatorCameraMaya::OnEvent(const SEvent& event) +{ + if (event.EventType != EET_MOUSE_INPUT_EVENT) + return false; + + switch(event.MouseInput.Event) + { + case EMIE_LMOUSE_PRESSED_DOWN: + MouseKeys[0] = true; + break; + case EMIE_RMOUSE_PRESSED_DOWN: + MouseKeys[2] = true; + break; + case EMIE_MMOUSE_PRESSED_DOWN: + MouseKeys[1] = true; + break; + case EMIE_LMOUSE_LEFT_UP: + MouseKeys[0] = false; + break; + case EMIE_RMOUSE_LEFT_UP: + MouseKeys[2] = false; + break; + case EMIE_MMOUSE_LEFT_UP: + MouseKeys[1] = false; + break; + case EMIE_MOUSE_MOVED: + MousePos = CursorControl->getRelativePosition(); + break; + case EMIE_MOUSE_WHEEL: + case EMIE_COUNT: + return false; + } + return true; +} + + +//! OnAnimate() is called just before rendering the whole scene. +//! nodes may calculate or store animations here, and may do other useful things, +//! dependent on what they are. +void CSceneNodeAnimatorCameraMaya::animateNode(ISceneNode *node, u32 timeMs) +{ + //Alt + LM = Rotate around camera pivot + //Alt + LM + MM = Dolly forth/back in view direction (speed % distance camera pivot - max distance to pivot) + //Alt + MM = Move on camera plane (Screen center is about the mouse pointer, depending on move speed) + + if (node->getType() != ESNT_CAMERA) + return; + + ICameraSceneNode* camera = static_cast(node); + + if (OldCamera != camera) + { + OldTarget = camera->getTarget(); + OldCamera = camera; + } + + core::vector3df target = camera->getTarget(); + + f32 nRotX = RotX; + f32 nRotY = RotY; + f32 nZoom = CurrentZoom; + + if ( (isMouseKeyDown(0) && isMouseKeyDown(2)) || isMouseKeyDown(1) ) + { + if (!Zooming) + { + ZoomStart = MousePos; + Zooming = true; + nZoom = CurrentZoom; + } + else + { + const f32 targetMinDistance = 0.1f; + nZoom += (ZoomStart.X - MousePos.X) * ZoomSpeed; + + if (nZoom < targetMinDistance) // jox: fixed bug: bounce back when zooming to close + nZoom = targetMinDistance; + } + } + else if (Zooming) + { + const f32 old = CurrentZoom; + CurrentZoom = CurrentZoom + (ZoomStart.X - MousePos.X ) * ZoomSpeed; + nZoom = CurrentZoom; + + if (nZoom < 0) + nZoom = CurrentZoom = old; + Zooming = false; + } + + // Translation --------------------------------- + + core::vector3df translate(OldTarget), upVector(camera->getUpVector()); + + core::vector3df tvectX = Pos - target; + tvectX = tvectX.crossProduct(upVector); + tvectX.normalize(); + + const SViewFrustum* const va = camera->getViewFrustum(); + core::vector3df tvectY = (va->getFarLeftDown() - va->getFarRightDown()); + tvectY = tvectY.crossProduct(upVector.Y > 0 ? Pos - target : target - Pos); + tvectY.normalize(); + + if (isMouseKeyDown(2) && !Zooming) + { + if (!Translating) + { + TranslateStart = MousePos; + Translating = true; + } + else + { + translate += tvectX * (TranslateStart.X - MousePos.X)*TranslateSpeed + + tvectY * (TranslateStart.Y - MousePos.Y)*TranslateSpeed; + } + } + else if (Translating) + { + translate += tvectX * (TranslateStart.X - MousePos.X)*TranslateSpeed + + tvectY * (TranslateStart.Y - MousePos.Y)*TranslateSpeed; + OldTarget = translate; + Translating = false; + } + + // Rotation ------------------------------------ + + if (isMouseKeyDown(0) && !Zooming) + { + if (!Rotating) + { + RotateStart = MousePos; + Rotating = true; + nRotX = RotX; + nRotY = RotY; + } + else + { + nRotX += (RotateStart.X - MousePos.X) * RotateSpeed; + nRotY += (RotateStart.Y - MousePos.Y) * RotateSpeed; + } + } + else if (Rotating) + { + RotX += (RotateStart.X - MousePos.X) * RotateSpeed; + RotY += (RotateStart.Y - MousePos.Y) * RotateSpeed; + nRotX = RotX; + nRotY = RotY; + Rotating = false; + } + + // Set Pos ------------------------------------ + + target = translate; + + Pos.X = nZoom + target.X; + Pos.Y = target.Y; + Pos.Z = target.Z; + + Pos.rotateXYBy(nRotY, target); + Pos.rotateXZBy(-nRotX, target); + + // Rotation Error ---------------------------- + + // jox: fixed bug: jitter when rotating to the top and bottom of y + upVector.set(0,1,0); + upVector.rotateXYBy(-nRotY); + upVector.rotateXZBy(-nRotX+180.f); + + camera->setPosition(Pos); + camera->setTarget(target); + camera->setUpVector(upVector); +} + + +bool CSceneNodeAnimatorCameraMaya::isMouseKeyDown(s32 key) +{ + return MouseKeys[key]; +} + + +void CSceneNodeAnimatorCameraMaya::allKeysUp() +{ + for (s32 i=0; i<3; ++i) + MouseKeys[i] = false; +} + + +//! Sets the rotation speed +void CSceneNodeAnimatorCameraMaya::setRotateSpeed(f32 speed) +{ + RotateSpeed = speed; +} + + +//! Sets the movement speed +void CSceneNodeAnimatorCameraMaya::setMoveSpeed(f32 speed) +{ + TranslateSpeed = speed; +} + + +//! Sets the zoom speed +void CSceneNodeAnimatorCameraMaya::setZoomSpeed(f32 speed) +{ + ZoomSpeed = speed; +} + + +//! Gets the rotation speed +f32 CSceneNodeAnimatorCameraMaya::getRotateSpeed() const +{ + return RotateSpeed; +} + + +// Gets the movement speed +f32 CSceneNodeAnimatorCameraMaya::getMoveSpeed() const +{ + return TranslateSpeed; +} + + +//! Gets the zoom speed +f32 CSceneNodeAnimatorCameraMaya::getZoomSpeed() const +{ + return ZoomSpeed; +} + +ISceneNodeAnimator* CSceneNodeAnimatorCameraMaya::createClone(ISceneNode* node, ISceneManager* newManager) +{ + CSceneNodeAnimatorCameraMaya * newAnimator = + new CSceneNodeAnimatorCameraMaya(CursorControl, RotateSpeed, ZoomSpeed, TranslateSpeed); + return newAnimator; +} + +} // end namespace +} // end namespace + diff --git a/src/dep/src/irrlicht/CSceneNodeAnimatorCameraMaya.h b/src/dep/src/irrlicht/CSceneNodeAnimatorCameraMaya.h new file mode 100644 index 0000000..39010f3 --- /dev/null +++ b/src/dep/src/irrlicht/CSceneNodeAnimatorCameraMaya.h @@ -0,0 +1,111 @@ +// Copyright (C) 2002-2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#ifndef __C_SCENE_NODE_ANIMATOR_CAMERA_MAYA_H_INCLUDED__ +#define __C_SCENE_NODE_ANIMATOR_CAMERA_MAYA_H_INCLUDED__ + +#include "ISceneNodeAnimatorCameraMaya.h" +#include "ICameraSceneNode.h" +#include "vector2d.h" + +namespace irr +{ + +namespace gui +{ + class ICursorControl; +} + +namespace scene +{ + + //! Special scene node animator for FPS cameras + /** This scene node animator can be attached to a camera to make it act + like a 3d modelling tool camera + */ + class CSceneNodeAnimatorCameraMaya : public ISceneNodeAnimatorCameraMaya + { + public: + //! Constructor + CSceneNodeAnimatorCameraMaya(gui::ICursorControl* cursor, f32 rotateSpeed = -1500.0f, + f32 zoomSpeed = 200.0f, f32 translationSpeed = 1500.0f); + + //! Destructor + virtual ~CSceneNodeAnimatorCameraMaya(); + + //! Animates the scene node, currently only works on cameras + virtual void animateNode(ISceneNode* node, u32 timeMs); + + //! Event receiver + virtual bool OnEvent(const SEvent& event); + + //! Returns the speed of movement in units per millisecond + virtual f32 getMoveSpeed() const; + + //! Sets the speed of movement in units per millisecond + virtual void setMoveSpeed(f32 moveSpeed); + + //! Returns the rotation speed + virtual f32 getRotateSpeed() const; + + //! Set the rotation speed + virtual void setRotateSpeed(f32 rotateSpeed); + + //! Returns the zoom speed + virtual f32 getZoomSpeed() const; + + //! Set the zoom speed + virtual void setZoomSpeed(f32 zoomSpeed); + + //! This animator will receive events when attached to the active camera + virtual bool isEventReceiverEnabled() const + { + return true; + } + + //! Returns type of the scene node + virtual ESCENE_NODE_ANIMATOR_TYPE getType() const + { + return ESNAT_CAMERA_MAYA; + } + + //! Creates a clone of this animator. + /** Please note that you will have to drop + (IReferenceCounted::drop()) the returned pointer after calling + this. */ + virtual ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0); + + private: + + void allKeysUp(); + void animate(); + bool isMouseKeyDown(s32 key); + + bool MouseKeys[3]; + + gui::ICursorControl *CursorControl; + core::vector3df Pos; + bool Zooming; + bool Rotating; + bool Moving; + bool Translating; + f32 ZoomSpeed; + f32 RotateSpeed; + f32 TranslateSpeed; + core::position2df RotateStart; + core::position2df ZoomStart; + core::position2df TranslateStart; + f32 CurrentZoom; + f32 RotX, RotY; + core::vector3df OldTarget; + scene::ICameraSceneNode* OldCamera; + + core::position2df MousePos; + }; + +} // end namespace scene +} // end namespace irr + +#endif + diff --git a/src/dep/src/irrlicht/CSceneNodeAnimatorCollisionResponse.cpp b/src/dep/src/irrlicht/CSceneNodeAnimatorCollisionResponse.cpp index d18d152..7603252 100644 --- a/src/dep/src/irrlicht/CSceneNodeAnimatorCollisionResponse.cpp +++ b/src/dep/src/irrlicht/CSceneNodeAnimatorCollisionResponse.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSceneNodeAnimatorCollisionResponse.h b/src/dep/src/irrlicht/CSceneNodeAnimatorCollisionResponse.h index 3230872..6058be1 100644 --- a/src/dep/src/irrlicht/CSceneNodeAnimatorCollisionResponse.h +++ b/src/dep/src/irrlicht/CSceneNodeAnimatorCollisionResponse.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSceneNodeAnimatorDelete.cpp b/src/dep/src/irrlicht/CSceneNodeAnimatorDelete.cpp index 2f8abec..68f09a2 100644 --- a/src/dep/src/irrlicht/CSceneNodeAnimatorDelete.cpp +++ b/src/dep/src/irrlicht/CSceneNodeAnimatorDelete.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSceneNodeAnimatorDelete.h b/src/dep/src/irrlicht/CSceneNodeAnimatorDelete.h index 041d666..36a933c 100644 --- a/src/dep/src/irrlicht/CSceneNodeAnimatorDelete.h +++ b/src/dep/src/irrlicht/CSceneNodeAnimatorDelete.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSceneNodeAnimatorFlyCircle.cpp b/src/dep/src/irrlicht/CSceneNodeAnimatorFlyCircle.cpp index 2276f57..79d877c 100644 --- a/src/dep/src/irrlicht/CSceneNodeAnimatorFlyCircle.cpp +++ b/src/dep/src/irrlicht/CSceneNodeAnimatorFlyCircle.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSceneNodeAnimatorFlyCircle.h b/src/dep/src/irrlicht/CSceneNodeAnimatorFlyCircle.h index 675c799..3c1fe38 100644 --- a/src/dep/src/irrlicht/CSceneNodeAnimatorFlyCircle.h +++ b/src/dep/src/irrlicht/CSceneNodeAnimatorFlyCircle.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSceneNodeAnimatorFlyStraight.cpp b/src/dep/src/irrlicht/CSceneNodeAnimatorFlyStraight.cpp index f770e0d..cb419e2 100644 --- a/src/dep/src/irrlicht/CSceneNodeAnimatorFlyStraight.cpp +++ b/src/dep/src/irrlicht/CSceneNodeAnimatorFlyStraight.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSceneNodeAnimatorFlyStraight.h b/src/dep/src/irrlicht/CSceneNodeAnimatorFlyStraight.h index 3d56e4d..b412978 100644 --- a/src/dep/src/irrlicht/CSceneNodeAnimatorFlyStraight.h +++ b/src/dep/src/irrlicht/CSceneNodeAnimatorFlyStraight.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSceneNodeAnimatorFollowSpline.cpp b/src/dep/src/irrlicht/CSceneNodeAnimatorFollowSpline.cpp index 17f4a35..b13c743 100644 --- a/src/dep/src/irrlicht/CSceneNodeAnimatorFollowSpline.cpp +++ b/src/dep/src/irrlicht/CSceneNodeAnimatorFollowSpline.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSceneNodeAnimatorFollowSpline.h b/src/dep/src/irrlicht/CSceneNodeAnimatorFollowSpline.h index ce10873..6c9d80c 100644 --- a/src/dep/src/irrlicht/CSceneNodeAnimatorFollowSpline.h +++ b/src/dep/src/irrlicht/CSceneNodeAnimatorFollowSpline.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSceneNodeAnimatorRotation.cpp b/src/dep/src/irrlicht/CSceneNodeAnimatorRotation.cpp index e48d051..8aab8ab 100644 --- a/src/dep/src/irrlicht/CSceneNodeAnimatorRotation.cpp +++ b/src/dep/src/irrlicht/CSceneNodeAnimatorRotation.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSceneNodeAnimatorRotation.h b/src/dep/src/irrlicht/CSceneNodeAnimatorRotation.h index cbaa769..78dfdbd 100644 --- a/src/dep/src/irrlicht/CSceneNodeAnimatorRotation.h +++ b/src/dep/src/irrlicht/CSceneNodeAnimatorRotation.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSceneNodeAnimatorTexture.cpp b/src/dep/src/irrlicht/CSceneNodeAnimatorTexture.cpp index d3f5943..c569e6b 100644 --- a/src/dep/src/irrlicht/CSceneNodeAnimatorTexture.cpp +++ b/src/dep/src/irrlicht/CSceneNodeAnimatorTexture.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSceneNodeAnimatorTexture.h b/src/dep/src/irrlicht/CSceneNodeAnimatorTexture.h index 04bc6ae..9617891 100644 --- a/src/dep/src/irrlicht/CSceneNodeAnimatorTexture.h +++ b/src/dep/src/irrlicht/CSceneNodeAnimatorTexture.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CShadowVolumeSceneNode.cpp b/src/dep/src/irrlicht/CShadowVolumeSceneNode.cpp index 8ca6c4d..397b3ee 100644 --- a/src/dep/src/irrlicht/CShadowVolumeSceneNode.cpp +++ b/src/dep/src/irrlicht/CShadowVolumeSceneNode.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CShadowVolumeSceneNode.h b/src/dep/src/irrlicht/CShadowVolumeSceneNode.h index 40ae828..4c924f0 100644 --- a/src/dep/src/irrlicht/CShadowVolumeSceneNode.h +++ b/src/dep/src/irrlicht/CShadowVolumeSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSkinnedMesh.cpp b/src/dep/src/irrlicht/CSkinnedMesh.cpp index 3fbd846..971244b 100644 --- a/src/dep/src/irrlicht/CSkinnedMesh.cpp +++ b/src/dep/src/irrlicht/CSkinnedMesh.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSkinnedMesh.h b/src/dep/src/irrlicht/CSkinnedMesh.h index 901b30d..9ce64ab 100644 --- a/src/dep/src/irrlicht/CSkinnedMesh.h +++ b/src/dep/src/irrlicht/CSkinnedMesh.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSkyBoxSceneNode.cpp b/src/dep/src/irrlicht/CSkyBoxSceneNode.cpp index 7b3978b..eda6bee 100644 --- a/src/dep/src/irrlicht/CSkyBoxSceneNode.cpp +++ b/src/dep/src/irrlicht/CSkyBoxSceneNode.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSkyBoxSceneNode.h b/src/dep/src/irrlicht/CSkyBoxSceneNode.h index e229cd1..7d9fa12 100644 --- a/src/dep/src/irrlicht/CSkyBoxSceneNode.h +++ b/src/dep/src/irrlicht/CSkyBoxSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSkyDomeSceneNode.cpp b/src/dep/src/irrlicht/CSkyDomeSceneNode.cpp index 9eed38d..0d6837b 100644 --- a/src/dep/src/irrlicht/CSkyDomeSceneNode.cpp +++ b/src/dep/src/irrlicht/CSkyDomeSceneNode.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h // Code for this scene node has been contributed by Anders la Cour-Harbo (alc) diff --git a/src/dep/src/irrlicht/CSkyDomeSceneNode.h b/src/dep/src/irrlicht/CSkyDomeSceneNode.h index 77dc0ac..11090d1 100644 --- a/src/dep/src/irrlicht/CSkyDomeSceneNode.h +++ b/src/dep/src/irrlicht/CSkyDomeSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h // Code for this scene node has been contributed by Anders la Cour-Harbo (alc) diff --git a/src/dep/src/irrlicht/CSoftware2MaterialRenderer.h b/src/dep/src/irrlicht/CSoftware2MaterialRenderer.h index f961846..7057230 100644 --- a/src/dep/src/irrlicht/CSoftware2MaterialRenderer.h +++ b/src/dep/src/irrlicht/CSoftware2MaterialRenderer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSoftwareDriver.cpp b/src/dep/src/irrlicht/CSoftwareDriver.cpp index bcb1208..9893927 100644 --- a/src/dep/src/irrlicht/CSoftwareDriver.cpp +++ b/src/dep/src/irrlicht/CSoftwareDriver.cpp @@ -1,954 +1,952 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#include "CSoftwareDriver.h" - -#include "IrrCompileConfig.h" -#ifdef _IRR_COMPILE_WITH_SOFTWARE_ - -#include "CSoftwareTexture.h" -#include "os.h" -#include "S3DVertex.h" - -namespace irr -{ -namespace video -{ - - -//! constructor -CSoftwareDriver::CSoftwareDriver(const core::dimension2d& windowSize, bool fullscreen, io::IFileSystem* io, video::IImagePresenter* presenter) -: CNullDriver(io, windowSize), BackBuffer(0), Presenter(presenter), WindowId(0), - SceneSourceRect(0), RenderTargetTexture(0), RenderTargetSurface(0), - CurrentTriangleRenderer(0), ZBuffer(0), Texture(0) -{ - #ifdef _DEBUG - setDebugName("CSoftwareDriver"); - #endif - - // create backbuffer - - BackBuffer = new CImage(ECF_A1R5G5B5, windowSize); - if (BackBuffer) - { - BackBuffer->fill(SColor(0)); - - // create z buffer - ZBuffer = video::createZBuffer(BackBuffer->getDimension()); - } - - // create triangle renderers - - TriangleRenderers[ETR_FLAT] = createTriangleRendererFlat(ZBuffer); - TriangleRenderers[ETR_FLAT_WIRE] = createTriangleRendererFlatWire(ZBuffer); - TriangleRenderers[ETR_GOURAUD] = createTriangleRendererGouraud(ZBuffer); - TriangleRenderers[ETR_GOURAUD_WIRE] = createTriangleRendererGouraudWire(ZBuffer); - TriangleRenderers[ETR_TEXTURE_FLAT] = createTriangleRendererTextureFlat(ZBuffer); - TriangleRenderers[ETR_TEXTURE_FLAT_WIRE] = createTriangleRendererTextureFlatWire(ZBuffer); - TriangleRenderers[ETR_TEXTURE_GOURAUD] = createTriangleRendererTextureGouraud(ZBuffer); - TriangleRenderers[ETR_TEXTURE_GOURAUD_WIRE] = createTriangleRendererTextureGouraudWire(ZBuffer); - TriangleRenderers[ETR_TEXTURE_GOURAUD_NOZ] = createTriangleRendererTextureGouraudNoZ(); - TriangleRenderers[ETR_TEXTURE_GOURAUD_ADD] = createTriangleRendererTextureGouraudAdd(ZBuffer); - - // select render target - - setRenderTarget(BackBuffer); - - // select the right renderer - - selectRightTriangleRenderer(); -} - - - -//! destructor -CSoftwareDriver::~CSoftwareDriver() -{ - // delete Backbuffer - if (BackBuffer) - BackBuffer->drop(); - - // delete triangle renderers - - for (s32 i=0; idrop(); - - // delete zbuffer - - if (ZBuffer) - ZBuffer->drop(); - - // delete current texture - - if (Texture) - Texture->drop(); - - if (RenderTargetTexture) - RenderTargetTexture->drop(); - - if (RenderTargetSurface) - RenderTargetSurface->drop(); -} - - - -//! switches to a triangle renderer -void CSoftwareDriver::switchToTriangleRenderer(ETriangleRenderer renderer) -{ - video::IImage* s = 0; - if (Texture) - s = ((CSoftwareTexture*)Texture)->getTexture(); - - CurrentTriangleRenderer = TriangleRenderers[renderer]; - CurrentTriangleRenderer->setBackfaceCulling(Material.BackfaceCulling == true); - CurrentTriangleRenderer->setTexture(s); - CurrentTriangleRenderer->setRenderTarget(RenderTargetSurface, ViewPort); -} - - -//! void selects the right triangle renderer based on the render states. -void CSoftwareDriver::selectRightTriangleRenderer() -{ - - ETriangleRenderer renderer = ETR_FLAT; - - if (Texture) - { - if (!Material.GouraudShading) - renderer = (!Material.Wireframe) ? ETR_TEXTURE_FLAT : ETR_TEXTURE_FLAT_WIRE; - else - { - if (Material.Wireframe) - renderer = ETR_TEXTURE_GOURAUD_WIRE; - else - { - if (Material.MaterialType == EMT_TRANSPARENT_ADD_COLOR || - Material.MaterialType == EMT_TRANSPARENT_ALPHA_CHANNEL || - Material.MaterialType == EMT_TRANSPARENT_VERTEX_ALPHA) - { - // simply draw all transparent stuff with the same renderer. at - // least it is transparent then. - renderer = ETR_TEXTURE_GOURAUD_ADD; - } - else - if (!Material.ZBuffer && !Material.ZWriteEnable) - renderer = ETR_TEXTURE_GOURAUD_NOZ; - else - { - renderer = ETR_TEXTURE_GOURAUD; - } - } - } - } - else - { - if (!Material.GouraudShading) - renderer = (!Material.Wireframe) ? ETR_FLAT : ETR_FLAT_WIRE; - else - renderer = (!Material.Wireframe) ? ETR_GOURAUD : ETR_GOURAUD_WIRE; - } - - switchToTriangleRenderer(renderer); -} - - -//! queries the features of the driver, returns true if feature is available -bool CSoftwareDriver::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const -{ - switch (feature) - { - case EVDF_RENDER_TO_TARGET: - case EVDF_TEXTURE_NSQUARE: - return FeatureEnabled[feature]; - default: - return false; - }; -} - - - -//! sets transformation -void CSoftwareDriver::setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat) -{ - TransformationMatrix[state] = mat; -} - - - - -//! sets the current Texture -bool CSoftwareDriver::setTexture(video::ITexture* texture) -{ - if (texture && texture->getDriverType() != EDT_SOFTWARE) - { - os::Printer::log("Fatal Error: Tried to set a texture not owned by this driver.", ELL_ERROR); - return false; - } - - if (Texture) - Texture->drop(); - - Texture = texture; - - if (Texture) - Texture->grab(); - - selectRightTriangleRenderer(); - return true; -} - - - -//! sets a material -void CSoftwareDriver::setMaterial(const SMaterial& material) -{ - Material = material; - - for (u32 i = 0; i < 1; ++i) - { - setTexture(Material.getTexture(i)); - setTransform ((E_TRANSFORMATION_STATE) ( ETS_TEXTURE_0 + i ), - material.getTextureMatrix(i)); - } -} - - -//! clears the zbuffer -bool CSoftwareDriver::beginScene(bool backBuffer, bool zBuffer, SColor color, - void* windowId, core::rect* sourceRect) -{ - CNullDriver::beginScene(backBuffer, zBuffer, color, windowId, sourceRect); - WindowId=windowId; - SceneSourceRect = sourceRect; - - if (backBuffer && BackBuffer) - BackBuffer->fill(color); - - if (ZBuffer && zBuffer) - ZBuffer->clear(); - - return true; -} - - -//! presents the rendered scene on the screen, returns false if failed -bool CSoftwareDriver::endScene() -{ - CNullDriver::endScene(); - - return Presenter->present(BackBuffer, WindowId, SceneSourceRect); -} - - -//! sets a render target -bool CSoftwareDriver::setRenderTarget(video::ITexture* texture, bool clearBackBuffer, - bool clearZBuffer, SColor color) -{ - if (texture && texture->getDriverType() != EDT_SOFTWARE) - { - os::Printer::log("Fatal Error: Tried to set a texture not owned by this driver.", ELL_ERROR); - return false; - } - - if (RenderTargetTexture) - RenderTargetTexture->drop(); - - RenderTargetTexture = texture; - - if (RenderTargetTexture) - { - RenderTargetTexture->grab(); - setRenderTarget(((CSoftwareTexture*)RenderTargetTexture)->getTexture()); - } - else - { - setRenderTarget(BackBuffer); - } - - if (RenderTargetSurface && (clearBackBuffer || clearZBuffer)) - { - if (clearZBuffer) - ZBuffer->clear(); - - if (clearBackBuffer) - ((video::CImage*)RenderTargetSurface)->fill( color ); - } - - return true; -} - - -//! sets a render target -void CSoftwareDriver::setRenderTarget(video::CImage* image) -{ - if (RenderTargetSurface) - RenderTargetSurface->drop(); - - RenderTargetSurface = image; - RenderTargetSize.Width = 0; - RenderTargetSize.Height = 0; - Render2DTranslation.X = 0; - Render2DTranslation.Y = 0; - - if (RenderTargetSurface) - { - RenderTargetSurface->grab(); - RenderTargetSize = RenderTargetSurface->getDimension(); - } - - setViewPort(core::rect(0,0,RenderTargetSize.Width,RenderTargetSize.Height)); - - if (ZBuffer) - ZBuffer->setSize(RenderTargetSize); -} - - - -//! sets a viewport -void CSoftwareDriver::setViewPort(const core::rect& area) -{ - ViewPort = area; - - //TODO: the clipping is not correct, because the projection is affected. - // to correct this, ViewPortSize and Render2DTranslation will have to be corrected. - core::rect rendert(0,0,RenderTargetSize.Width,RenderTargetSize.Height); - ViewPort.clipAgainst(rendert); - - ViewPortSize = ViewPort.getSize(); - Render2DTranslation.X = (ViewPortSize.Width / 2) + ViewPort.UpperLeftCorner.X; - Render2DTranslation.Y = ViewPort.UpperLeftCorner.Y + ViewPortSize.Height - (ViewPortSize.Height / 2);// + ViewPort.UpperLeftCorner.Y; - - if (CurrentTriangleRenderer) - CurrentTriangleRenderer->setRenderTarget(RenderTargetSurface, ViewPort); -} - -void CSoftwareDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCount, - const void* indexList, u32 primitiveCount, - E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType) - -{ - switch (iType) - { - case (EIT_16BIT): - { - drawVertexPrimitiveList16(vertices, vertexCount, (const u16*)indexList, primitiveCount, vType, pType); - break; - } - case (EIT_32BIT): - { - os::Printer::log("Software driver can not render 32bit buffers", ELL_ERROR); - break; - } - } - - -} - -//! draws a vertex primitive list -void CSoftwareDriver::drawVertexPrimitiveList16(const void* vertices, u32 vertexCount, const u16* indexList, u32 primitiveCount, E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType) -{ - const u16* indexPointer=0; - core::array newBuffer; - switch (pType) - { - case scene::EPT_LINE_STRIP: - { - switch (vType) - { - case EVT_STANDARD: - { - for (u32 i=0; i < primitiveCount-1; ++i) - draw3DLine(((S3DVertex*)vertices)[indexList[i]].Pos, - ((S3DVertex*)vertices)[indexList[i+1]].Pos, - ((S3DVertex*)vertices)[indexList[i]].Color); - } - break; - case EVT_2TCOORDS: - { - for (u32 i=0; i < primitiveCount-1; ++i) - draw3DLine(((S3DVertex2TCoords*)vertices)[indexList[i]].Pos, - ((S3DVertex2TCoords*)vertices)[indexList[i+1]].Pos, - ((S3DVertex2TCoords*)vertices)[indexList[i]].Color); - } - break; - case EVT_TANGENTS: - { - for (u32 i=0; i < primitiveCount-1; ++i) - draw3DLine(((S3DVertexTangents*)vertices)[indexList[i]].Pos, - ((S3DVertexTangents*)vertices)[indexList[i+1]].Pos, - ((S3DVertexTangents*)vertices)[indexList[i]].Color); - } - break; - } - } - return; - case scene::EPT_LINE_LOOP: - drawVertexPrimitiveList16(vertices, vertexCount, indexList, primitiveCount-1, vType, scene::EPT_LINE_STRIP); - switch (vType) - { - case EVT_STANDARD: - draw3DLine(((S3DVertex*)vertices)[indexList[primitiveCount-1]].Pos, - ((S3DVertex*)vertices)[indexList[0]].Pos, - ((S3DVertex*)vertices)[indexList[primitiveCount-1]].Color); - break; - case EVT_2TCOORDS: - draw3DLine(((S3DVertex2TCoords*)vertices)[indexList[primitiveCount-1]].Pos, - ((S3DVertex2TCoords*)vertices)[indexList[0]].Pos, - ((S3DVertex2TCoords*)vertices)[indexList[primitiveCount-1]].Color); - break; - case EVT_TANGENTS: - draw3DLine(((S3DVertexTangents*)vertices)[indexList[primitiveCount-1]].Pos, - ((S3DVertexTangents*)vertices)[indexList[0]].Pos, - ((S3DVertexTangents*)vertices)[indexList[primitiveCount-1]].Color); - break; - } - return; - case scene::EPT_LINES: - { - switch (vType) - { - case EVT_STANDARD: - { - for (u32 i=0; i < 2*primitiveCount; i+=2) - draw3DLine(((S3DVertex*)vertices)[indexList[i]].Pos, - ((S3DVertex*)vertices)[indexList[i+1]].Pos, - ((S3DVertex*)vertices)[indexList[i]].Color); - } - break; - case EVT_2TCOORDS: - { - for (u32 i=0; i < 2*primitiveCount; i+=2) - draw3DLine(((S3DVertex2TCoords*)vertices)[indexList[i]].Pos, - ((S3DVertex2TCoords*)vertices)[indexList[i+1]].Pos, - ((S3DVertex2TCoords*)vertices)[indexList[i]].Color); - } - break; - case EVT_TANGENTS: - { - for (u32 i=0; i < 2*primitiveCount; i+=2) - draw3DLine(((S3DVertexTangents*)vertices)[indexList[i]].Pos, - ((S3DVertexTangents*)vertices)[indexList[i+1]].Pos, - ((S3DVertexTangents*)vertices)[indexList[i]].Color); - } - break; - } - } - return; - case scene::EPT_TRIANGLE_FAN: - { - // TODO: don't convert fan to list - newBuffer.reallocate(primitiveCount*3); - for( u32 t=0; t -void CSoftwareDriver::drawClippedIndexedTriangleListT(const VERTEXTYPE* vertices, - s32 vertexCount, const u16* indexList, s32 triangleCount) -{ - if (!RenderTargetSurface || !ZBuffer || !triangleCount) - return; - - if (!checkPrimitiveCount(triangleCount)) - return; - - // arrays for storing clipped vertices - core::array clippedVertices; - core::array clippedIndices; - - // calculate inverse world transformation - core::matrix4 worldinv(TransformationMatrix[ETS_WORLD]); - worldinv.makeInverse(); - - // calculate view frustum planes - scene::SViewFrustum frustum(TransformationMatrix[ETS_PROJECTION] * TransformationMatrix[ETS_VIEW]); - - // copy and transform clipping planes ignoring far plane - core::plane3df planes[5]; // ordered by near, left, right, bottom, top - for (int p=0; p<5; ++p) - worldinv.transformPlane(frustum.planes[p+1], planes[p]); - - core::EIntersectionRelation3D inout[3]; // is point in front or back of plane? - - // temporary buffer for vertices to be clipped by all planes - core::array tClpBuf; - int t; - - int i; - for (i=0; i textureSize(0,0); - f32 zDiv; - - if (Texture) - textureSize = ((CSoftwareTexture*)Texture)->getTexture()->getDimension(); - - f32 transformedPos[4]; // transform all points in the list - - core::matrix4 matrix(TransformationMatrix[ETS_PROJECTION]); - matrix *= TransformationMatrix[ETS_VIEW]; - matrix *= TransformationMatrix[ETS_WORLD]; - - s32 ViewTransformWidth = (ViewPortSize.Width>>1); - s32 ViewTransformHeight = (ViewPortSize.Height>>1); - - for (i=0; i<(int)clippedVertices.size(); ++i) - { - transformedPos[0] = currentVertex->Pos.X; - transformedPos[1] = currentVertex->Pos.Y; - transformedPos[2] = currentVertex->Pos.Z; - transformedPos[3] = 1.0f; - - matrix.multiplyWith1x4Matrix(transformedPos); - zDiv = transformedPos[3] == 0.0f ? 1.0f : (1.0f / transformedPos[3]); - - tp->Pos.X = (s32)(ViewTransformWidth * (transformedPos[0] * zDiv) + (Render2DTranslation.X)); - tp->Pos.Y = (Render2DTranslation.Y - (s32)(ViewTransformHeight * (transformedPos[1] * zDiv))); - tp->Color = currentVertex->Color.toA1R5G5B5(); - tp->ZValue = (TZBufferType)(32767.0f * zDiv); - - tp->TCoords.X = (s32)(currentVertex->TCoords.X * textureSize.Width); - tp->TCoords.X <<= 8; - tp->TCoords.Y = (s32)(currentVertex->TCoords.Y * textureSize.Height); - tp->TCoords.Y <<= 8; - - ++currentVertex; - ++tp; - } - - // draw all transformed points from the index list - CurrentTriangleRenderer->drawIndexedTriangleList(&TransformedPoints[0], - clippedVertices.size(), clippedIndices.pointer(), clippedIndices.size()/3); -} - - -//! Draws a 3d line. -void CSoftwareDriver::draw3DLine(const core::vector3df& start, - const core::vector3df& end, SColor color) -{ - core::vector3df vect = start.crossProduct(end); - vect.normalize(); - vect *= Material.Thickness*0.3f; - - S3DVertex vtx[4]; - - vtx[0].Color = color; - vtx[1].Color = color; - vtx[2].Color = color; - vtx[3].Color = color; - - vtx[0].Pos = start; - vtx[1].Pos = end; - - vtx[2].Pos = start + vect; - vtx[3].Pos = end + vect; - - u16 idx[12] = {0,1,2, 0,2,1, 0,1,3, 0,3,1}; - - drawIndexedTriangleList(vtx, 4, idx, 4); -} - - -//! clips a triangle against the viewing frustum -void CSoftwareDriver::clipTriangle(f32* transformedPos) -{ -} - - -//! Only used by the internal engine. Used to notify the driver that -//! the window was resized. -void CSoftwareDriver::OnResize(const core::dimension2d& size) -{ - // make sure width and height are multiples of 2 - core::dimension2d realSize(size); - - if (realSize.Width % 2) - realSize.Width += 1; - - if (realSize.Height % 2) - realSize.Height += 1; - - if (ScreenSize != realSize) - { - if (ViewPort.getWidth() == ScreenSize.Width && - ViewPort.getHeight() == ScreenSize.Height) - { - ViewPort = core::rect(core::position2d(0,0), realSize); - } - - ScreenSize = realSize; - - bool resetRT = (RenderTargetSurface == BackBuffer); - - if (BackBuffer) - BackBuffer->drop(); - BackBuffer = new CImage(ECF_A1R5G5B5, realSize); - - if (resetRT) - setRenderTarget(BackBuffer); - } -} - -//! returns the current render target size -const core::dimension2d& CSoftwareDriver::getCurrentRenderTargetSize() const -{ - return RenderTargetSize; -} - - -//! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted. -void CSoftwareDriver::draw2DImage(const video::ITexture* texture, const core::position2d& destPos, - const core::rect& sourceRect, - const core::rect* clipRect, SColor color, - bool useAlphaChannelOfTexture) -{ - if (texture) - { - if (texture->getDriverType() != EDT_SOFTWARE) - { - os::Printer::log("Fatal Error: Tried to copy from a surface not owned by this driver.", ELL_ERROR); - return; - } - - if (useAlphaChannelOfTexture) - ((CSoftwareTexture*)texture)->getImage()->copyToWithAlpha( - ((CImage*)RenderTargetSurface), destPos, sourceRect, color, clipRect); - else - ((CSoftwareTexture*)texture)->getImage()->copyTo( - ((CImage*)RenderTargetSurface), destPos, sourceRect, clipRect); - } -} - - - -//! Draws a 2d line. -void CSoftwareDriver::draw2DLine(const core::position2d& start, - const core::position2d& end, - SColor color) -{ - ((CImage*)RenderTargetSurface)->drawLine(start, end, color ); -} - -//! Draws a pixel -void CSoftwareDriver::drawPixel(u32 x, u32 y, const SColor & color) -{ - ((CImage*)BackBuffer)->setPixel(x, y, color); -} - - -//! draw a 2d rectangle -void CSoftwareDriver::draw2DRectangle(SColor color, const core::rect& pos, - const core::rect* clip) -{ - if (clip) - { - core::rect p(pos); - - p.clipAgainst(*clip); - - if(!p.isValid()) - return; - - ((CImage*)RenderTargetSurface)->drawRectangle(p, color); - } - else - { - if(!pos.isValid()) - return; - - ((CImage*)RenderTargetSurface)->drawRectangle(pos, color); - } -} - - -//!Draws an 2d rectangle with a gradient. -void CSoftwareDriver::draw2DRectangle(const core::rect& pos, - SColor colorLeftUp, SColor colorRightUp, SColor colorLeftDown, SColor colorRightDown, - const core::rect* clip) -{ - // TODO: implement - draw2DRectangle(colorLeftUp, pos, clip); -} - - -//! \return Returns the name of the video driver. Example: In case of the Direct3D8 -//! driver, it would return "Direct3D8.1". -const wchar_t* CSoftwareDriver::getName() const -{ - return L"Irrlicht Software Device 1.0"; -} - - -//! Returns type of video driver -E_DRIVER_TYPE CSoftwareDriver::getDriverType() const -{ - return EDT_SOFTWARE; -} - - -//! returns color format -ECOLOR_FORMAT CSoftwareDriver::getColorFormat() const -{ - if (BackBuffer) - return BackBuffer->getColorFormat(); - else - return CNullDriver::getColorFormat(); -} - - -//! Returns the transformation set by setTransform -const core::matrix4& CSoftwareDriver::getTransform(E_TRANSFORMATION_STATE state) const -{ - return TransformationMatrix[state]; -} - - -//! Creates a render target texture. -ITexture* CSoftwareDriver::addRenderTargetTexture(const core::dimension2d& size, const c8* name) -{ - CImage* img = new CImage(video::ECF_A1R5G5B5, size); - if (!name) - name="rt"; - ITexture* tex = new CSoftwareTexture(img, name, true); - img->drop(); - addTexture(tex); - tex->drop(); - return tex; -} - - -//! Clears the ZBuffer. -void CSoftwareDriver::clearZBuffer() -{ - if (ZBuffer) - ZBuffer->clear(); -} - - -//! Returns an image created from the last rendered frame. -IImage* CSoftwareDriver::createScreenShot() -{ - if (BackBuffer) - return new CImage(BackBuffer->getColorFormat(), BackBuffer); - else - return 0; -} - - -//! Returns the maximum amount of primitives (mostly vertices) which -//! the device is able to render with one drawIndexedTriangleList -//! call. -u32 CSoftwareDriver::getMaximalPrimitiveCount() const -{ - return 0x00800000; -} - -} // end namespace video -} // end namespace irr - -#endif // _IRR_COMPILE_WITH_SOFTWARE_ - -namespace irr -{ -namespace video -{ - - -//! creates a video driver -IVideoDriver* createSoftwareDriver(const core::dimension2d& windowSize, bool fullscreen, io::IFileSystem* io, video::IImagePresenter* presenter) -{ - #ifdef _IRR_COMPILE_WITH_SOFTWARE_ - return new CSoftwareDriver(windowSize, fullscreen, io, presenter); - #else - return 0; - #endif -} - - -} // end namespace video -} // end namespace irr +// Copyright (C) 2002-2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#include "CSoftwareDriver.h" + +#include "IrrCompileConfig.h" +#ifdef _IRR_COMPILE_WITH_SOFTWARE_ + +#include "CSoftwareTexture.h" +#include "os.h" +#include "S3DVertex.h" + +namespace irr +{ +namespace video +{ + + +//! constructor +CSoftwareDriver::CSoftwareDriver(const core::dimension2d& windowSize, bool fullscreen, io::IFileSystem* io, video::IImagePresenter* presenter) +: CNullDriver(io, windowSize), BackBuffer(0), Presenter(presenter), WindowId(0), + SceneSourceRect(0), RenderTargetTexture(0), RenderTargetSurface(0), + CurrentTriangleRenderer(0), ZBuffer(0), Texture(0) +{ + #ifdef _DEBUG + setDebugName("CSoftwareDriver"); + #endif + + // create backbuffer + + BackBuffer = new CImage(ECF_A1R5G5B5, windowSize); + if (BackBuffer) + { + BackBuffer->fill(SColor(0)); + + // create z buffer + ZBuffer = video::createZBuffer(BackBuffer->getDimension()); + } + + // create triangle renderers + + TriangleRenderers[ETR_FLAT] = createTriangleRendererFlat(ZBuffer); + TriangleRenderers[ETR_FLAT_WIRE] = createTriangleRendererFlatWire(ZBuffer); + TriangleRenderers[ETR_GOURAUD] = createTriangleRendererGouraud(ZBuffer); + TriangleRenderers[ETR_GOURAUD_WIRE] = createTriangleRendererGouraudWire(ZBuffer); + TriangleRenderers[ETR_TEXTURE_FLAT] = createTriangleRendererTextureFlat(ZBuffer); + TriangleRenderers[ETR_TEXTURE_FLAT_WIRE] = createTriangleRendererTextureFlatWire(ZBuffer); + TriangleRenderers[ETR_TEXTURE_GOURAUD] = createTriangleRendererTextureGouraud(ZBuffer); + TriangleRenderers[ETR_TEXTURE_GOURAUD_WIRE] = createTriangleRendererTextureGouraudWire(ZBuffer); + TriangleRenderers[ETR_TEXTURE_GOURAUD_NOZ] = createTriangleRendererTextureGouraudNoZ(); + TriangleRenderers[ETR_TEXTURE_GOURAUD_ADD] = createTriangleRendererTextureGouraudAdd(ZBuffer); + + // select render target + + setRenderTarget(BackBuffer); + + // select the right renderer + + selectRightTriangleRenderer(); +} + + + +//! destructor +CSoftwareDriver::~CSoftwareDriver() +{ + // delete Backbuffer + if (BackBuffer) + BackBuffer->drop(); + + // delete triangle renderers + + for (s32 i=0; idrop(); + + // delete zbuffer + + if (ZBuffer) + ZBuffer->drop(); + + // delete current texture + + if (Texture) + Texture->drop(); + + if (RenderTargetTexture) + RenderTargetTexture->drop(); + + if (RenderTargetSurface) + RenderTargetSurface->drop(); +} + + + +//! switches to a triangle renderer +void CSoftwareDriver::switchToTriangleRenderer(ETriangleRenderer renderer) +{ + video::IImage* s = 0; + if (Texture) + s = ((CSoftwareTexture*)Texture)->getTexture(); + + CurrentTriangleRenderer = TriangleRenderers[renderer]; + CurrentTriangleRenderer->setBackfaceCulling(Material.BackfaceCulling == true); + CurrentTriangleRenderer->setTexture(s); + CurrentTriangleRenderer->setRenderTarget(RenderTargetSurface, ViewPort); +} + + +//! void selects the right triangle renderer based on the render states. +void CSoftwareDriver::selectRightTriangleRenderer() +{ + + ETriangleRenderer renderer = ETR_FLAT; + + if (Texture) + { + if (!Material.GouraudShading) + renderer = (!Material.Wireframe) ? ETR_TEXTURE_FLAT : ETR_TEXTURE_FLAT_WIRE; + else + { + if (Material.Wireframe) + renderer = ETR_TEXTURE_GOURAUD_WIRE; + else + { + if (Material.MaterialType == EMT_TRANSPARENT_ADD_COLOR || + Material.MaterialType == EMT_TRANSPARENT_ALPHA_CHANNEL || + Material.MaterialType == EMT_TRANSPARENT_VERTEX_ALPHA) + { + // simply draw all transparent stuff with the same renderer. at + // least it is transparent then. + renderer = ETR_TEXTURE_GOURAUD_ADD; + } + else + if (!Material.ZBuffer && !Material.ZWriteEnable) + renderer = ETR_TEXTURE_GOURAUD_NOZ; + else + { + renderer = ETR_TEXTURE_GOURAUD; + } + } + } + } + else + { + if (!Material.GouraudShading) + renderer = (!Material.Wireframe) ? ETR_FLAT : ETR_FLAT_WIRE; + else + renderer = (!Material.Wireframe) ? ETR_GOURAUD : ETR_GOURAUD_WIRE; + } + + switchToTriangleRenderer(renderer); +} + + +//! queries the features of the driver, returns true if feature is available +bool CSoftwareDriver::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const +{ + switch (feature) + { + case EVDF_RENDER_TO_TARGET: + case EVDF_TEXTURE_NSQUARE: + return FeatureEnabled[feature]; + default: + return false; + }; +} + + + +//! sets transformation +void CSoftwareDriver::setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat) +{ + TransformationMatrix[state] = mat; +} + + + + +//! sets the current Texture +bool CSoftwareDriver::setTexture(video::ITexture* texture) +{ + if (texture && texture->getDriverType() != EDT_SOFTWARE) + { + os::Printer::log("Fatal Error: Tried to set a texture not owned by this driver.", ELL_ERROR); + return false; + } + + if (Texture) + Texture->drop(); + + Texture = texture; + + if (Texture) + Texture->grab(); + + selectRightTriangleRenderer(); + return true; +} + + + +//! sets a material +void CSoftwareDriver::setMaterial(const SMaterial& material) +{ + Material = material; + + for (u32 i = 0; i < 1; ++i) + { + setTexture(Material.getTexture(i)); + setTransform ((E_TRANSFORMATION_STATE) ( ETS_TEXTURE_0 + i ), + material.getTextureMatrix(i)); + } +} + + +//! clears the zbuffer +bool CSoftwareDriver::beginScene(bool backBuffer, bool zBuffer, SColor color, + void* windowId, core::rect* sourceRect) +{ + CNullDriver::beginScene(backBuffer, zBuffer, color, windowId, sourceRect); + WindowId=windowId; + SceneSourceRect = sourceRect; + + if (backBuffer && BackBuffer) + BackBuffer->fill(color); + + if (ZBuffer && zBuffer) + ZBuffer->clear(); + + return true; +} + + +//! presents the rendered scene on the screen, returns false if failed +bool CSoftwareDriver::endScene() +{ + CNullDriver::endScene(); + + return Presenter->present(BackBuffer, WindowId, SceneSourceRect); +} + + +//! sets a render target +bool CSoftwareDriver::setRenderTarget(video::ITexture* texture, bool clearBackBuffer, + bool clearZBuffer, SColor color) +{ + if (texture && texture->getDriverType() != EDT_SOFTWARE) + { + os::Printer::log("Fatal Error: Tried to set a texture not owned by this driver.", ELL_ERROR); + return false; + } + + if (RenderTargetTexture) + RenderTargetTexture->drop(); + + RenderTargetTexture = texture; + + if (RenderTargetTexture) + { + RenderTargetTexture->grab(); + setRenderTarget(((CSoftwareTexture*)RenderTargetTexture)->getTexture()); + } + else + { + setRenderTarget(BackBuffer); + } + + if (RenderTargetSurface && (clearBackBuffer || clearZBuffer)) + { + if (clearZBuffer) + ZBuffer->clear(); + + if (clearBackBuffer) + ((video::CImage*)RenderTargetSurface)->fill( color ); + } + + return true; +} + + +//! sets a render target +void CSoftwareDriver::setRenderTarget(video::CImage* image) +{ + if (RenderTargetSurface) + RenderTargetSurface->drop(); + + RenderTargetSurface = image; + RenderTargetSize.Width = 0; + RenderTargetSize.Height = 0; + Render2DTranslation.X = 0; + Render2DTranslation.Y = 0; + + if (RenderTargetSurface) + { + RenderTargetSurface->grab(); + RenderTargetSize = RenderTargetSurface->getDimension(); + } + + setViewPort(core::rect(0,0,RenderTargetSize.Width,RenderTargetSize.Height)); + + if (ZBuffer) + ZBuffer->setSize(RenderTargetSize); +} + + + +//! sets a viewport +void CSoftwareDriver::setViewPort(const core::rect& area) +{ + ViewPort = area; + + //TODO: the clipping is not correct, because the projection is affected. + // to correct this, ViewPortSize and Render2DTranslation will have to be corrected. + core::rect rendert(0,0,RenderTargetSize.Width,RenderTargetSize.Height); + ViewPort.clipAgainst(rendert); + + ViewPortSize = ViewPort.getSize(); + Render2DTranslation.X = (ViewPortSize.Width / 2) + ViewPort.UpperLeftCorner.X; + Render2DTranslation.Y = ViewPort.UpperLeftCorner.Y + ViewPortSize.Height - (ViewPortSize.Height / 2);// + ViewPort.UpperLeftCorner.Y; + + if (CurrentTriangleRenderer) + CurrentTriangleRenderer->setRenderTarget(RenderTargetSurface, ViewPort); +} + +void CSoftwareDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCount, + const void* indexList, u32 primitiveCount, + E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType) + +{ + switch (iType) + { + case (EIT_16BIT): + { + drawVertexPrimitiveList16(vertices, vertexCount, (const u16*)indexList, primitiveCount, vType, pType); + break; + } + case (EIT_32BIT): + { + os::Printer::log("Software driver can not render 32bit buffers", ELL_ERROR); + break; + } + } + + +} + +//! draws a vertex primitive list +void CSoftwareDriver::drawVertexPrimitiveList16(const void* vertices, u32 vertexCount, const u16* indexList, u32 primitiveCount, E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType) +{ + const u16* indexPointer=0; + core::array newBuffer; + switch (pType) + { + case scene::EPT_LINE_STRIP: + { + switch (vType) + { + case EVT_STANDARD: + { + for (u32 i=0; i < primitiveCount-1; ++i) + draw3DLine(((S3DVertex*)vertices)[indexList[i]].Pos, + ((S3DVertex*)vertices)[indexList[i+1]].Pos, + ((S3DVertex*)vertices)[indexList[i]].Color); + } + break; + case EVT_2TCOORDS: + { + for (u32 i=0; i < primitiveCount-1; ++i) + draw3DLine(((S3DVertex2TCoords*)vertices)[indexList[i]].Pos, + ((S3DVertex2TCoords*)vertices)[indexList[i+1]].Pos, + ((S3DVertex2TCoords*)vertices)[indexList[i]].Color); + } + break; + case EVT_TANGENTS: + { + for (u32 i=0; i < primitiveCount-1; ++i) + draw3DLine(((S3DVertexTangents*)vertices)[indexList[i]].Pos, + ((S3DVertexTangents*)vertices)[indexList[i+1]].Pos, + ((S3DVertexTangents*)vertices)[indexList[i]].Color); + } + break; + } + } + return; + case scene::EPT_LINE_LOOP: + drawVertexPrimitiveList16(vertices, vertexCount, indexList, primitiveCount-1, vType, scene::EPT_LINE_STRIP); + switch (vType) + { + case EVT_STANDARD: + draw3DLine(((S3DVertex*)vertices)[indexList[primitiveCount-1]].Pos, + ((S3DVertex*)vertices)[indexList[0]].Pos, + ((S3DVertex*)vertices)[indexList[primitiveCount-1]].Color); + break; + case EVT_2TCOORDS: + draw3DLine(((S3DVertex2TCoords*)vertices)[indexList[primitiveCount-1]].Pos, + ((S3DVertex2TCoords*)vertices)[indexList[0]].Pos, + ((S3DVertex2TCoords*)vertices)[indexList[primitiveCount-1]].Color); + break; + case EVT_TANGENTS: + draw3DLine(((S3DVertexTangents*)vertices)[indexList[primitiveCount-1]].Pos, + ((S3DVertexTangents*)vertices)[indexList[0]].Pos, + ((S3DVertexTangents*)vertices)[indexList[primitiveCount-1]].Color); + break; + } + return; + case scene::EPT_LINES: + { + switch (vType) + { + case EVT_STANDARD: + { + for (u32 i=0; i < 2*primitiveCount; i+=2) + draw3DLine(((S3DVertex*)vertices)[indexList[i]].Pos, + ((S3DVertex*)vertices)[indexList[i+1]].Pos, + ((S3DVertex*)vertices)[indexList[i]].Color); + } + break; + case EVT_2TCOORDS: + { + for (u32 i=0; i < 2*primitiveCount; i+=2) + draw3DLine(((S3DVertex2TCoords*)vertices)[indexList[i]].Pos, + ((S3DVertex2TCoords*)vertices)[indexList[i+1]].Pos, + ((S3DVertex2TCoords*)vertices)[indexList[i]].Color); + } + break; + case EVT_TANGENTS: + { + for (u32 i=0; i < 2*primitiveCount; i+=2) + draw3DLine(((S3DVertexTangents*)vertices)[indexList[i]].Pos, + ((S3DVertexTangents*)vertices)[indexList[i+1]].Pos, + ((S3DVertexTangents*)vertices)[indexList[i]].Color); + } + break; + } + } + return; + case scene::EPT_TRIANGLE_FAN: + { + // TODO: don't convert fan to list + newBuffer.reallocate(primitiveCount*3); + for( u32 t=0; t +void CSoftwareDriver::drawClippedIndexedTriangleListT(const VERTEXTYPE* vertices, + s32 vertexCount, const u16* indexList, s32 triangleCount) +{ + if (!RenderTargetSurface || !ZBuffer || !triangleCount) + return; + + if (!checkPrimitiveCount(triangleCount)) + return; + + // arrays for storing clipped vertices + core::array clippedVertices; + core::array clippedIndices; + + // calculate inverse world transformation + core::matrix4 worldinv(TransformationMatrix[ETS_WORLD]); + worldinv.makeInverse(); + + // calculate view frustum planes + scene::SViewFrustum frustum(TransformationMatrix[ETS_PROJECTION] * TransformationMatrix[ETS_VIEW]); + + // copy and transform clipping planes ignoring far plane + core::plane3df planes[5]; // ordered by near, left, right, bottom, top + for (int p=0; p<5; ++p) + worldinv.transformPlane(frustum.planes[p+1], planes[p]); + + core::EIntersectionRelation3D inout[3]; // is point in front or back of plane? + + // temporary buffer for vertices to be clipped by all planes + core::array tClpBuf; + int t; + + int i; + for (i=0; i textureSize(0,0); + f32 zDiv; + + if (Texture) + textureSize = ((CSoftwareTexture*)Texture)->getTexture()->getDimension(); + + f32 transformedPos[4]; // transform all points in the list + + core::matrix4 matrix(TransformationMatrix[ETS_PROJECTION]); + matrix *= TransformationMatrix[ETS_VIEW]; + matrix *= TransformationMatrix[ETS_WORLD]; + + s32 ViewTransformWidth = (ViewPortSize.Width>>1); + s32 ViewTransformHeight = (ViewPortSize.Height>>1); + + for (i=0; i<(int)clippedVertices.size(); ++i) + { + transformedPos[0] = currentVertex->Pos.X; + transformedPos[1] = currentVertex->Pos.Y; + transformedPos[2] = currentVertex->Pos.Z; + transformedPos[3] = 1.0f; + + matrix.multiplyWith1x4Matrix(transformedPos); + zDiv = transformedPos[3] == 0.0f ? 1.0f : (1.0f / transformedPos[3]); + + tp->Pos.X = (s32)(ViewTransformWidth * (transformedPos[0] * zDiv) + (Render2DTranslation.X)); + tp->Pos.Y = (Render2DTranslation.Y - (s32)(ViewTransformHeight * (transformedPos[1] * zDiv))); + tp->Color = currentVertex->Color.toA1R5G5B5(); + tp->ZValue = (TZBufferType)(32767.0f * zDiv); + + tp->TCoords.X = (s32)(currentVertex->TCoords.X * textureSize.Width); + tp->TCoords.X <<= 8; + tp->TCoords.Y = (s32)(currentVertex->TCoords.Y * textureSize.Height); + tp->TCoords.Y <<= 8; + + ++currentVertex; + ++tp; + } + + // draw all transformed points from the index list + CurrentTriangleRenderer->drawIndexedTriangleList(&TransformedPoints[0], + clippedVertices.size(), clippedIndices.pointer(), clippedIndices.size()/3); +} + + +//! Draws a 3d line. +void CSoftwareDriver::draw3DLine(const core::vector3df& start, + const core::vector3df& end, SColor color) +{ + core::vector3df vect = start.crossProduct(end); + vect.normalize(); + vect *= Material.Thickness*0.3f; + + S3DVertex vtx[4]; + + vtx[0].Color = color; + vtx[1].Color = color; + vtx[2].Color = color; + vtx[3].Color = color; + + vtx[0].Pos = start; + vtx[1].Pos = end; + + vtx[2].Pos = start + vect; + vtx[3].Pos = end + vect; + + u16 idx[12] = {0,1,2, 0,2,1, 0,1,3, 0,3,1}; + + drawIndexedTriangleList(vtx, 4, idx, 4); +} + + +//! clips a triangle against the viewing frustum +void CSoftwareDriver::clipTriangle(f32* transformedPos) +{ +} + + +//! Only used by the internal engine. Used to notify the driver that +//! the window was resized. +void CSoftwareDriver::OnResize(const core::dimension2d& size) +{ + // make sure width and height are multiples of 2 + core::dimension2d realSize(size); + + if (realSize.Width % 2) + realSize.Width += 1; + + if (realSize.Height % 2) + realSize.Height += 1; + + if (ScreenSize != realSize) + { + if (ViewPort.getWidth() == ScreenSize.Width && + ViewPort.getHeight() == ScreenSize.Height) + { + ViewPort = core::rect(core::position2d(0,0), realSize); + } + + ScreenSize = realSize; + + bool resetRT = (RenderTargetSurface == BackBuffer); + + if (BackBuffer) + BackBuffer->drop(); + BackBuffer = new CImage(ECF_A1R5G5B5, realSize); + + if (resetRT) + setRenderTarget(BackBuffer); + } +} + +//! returns the current render target size +const core::dimension2d& CSoftwareDriver::getCurrentRenderTargetSize() const +{ + return RenderTargetSize; +} + + +//! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted. +void CSoftwareDriver::draw2DImage(const video::ITexture* texture, const core::position2d& destPos, + const core::rect& sourceRect, + const core::rect* clipRect, SColor color, + bool useAlphaChannelOfTexture) +{ + if (texture) + { + if (texture->getDriverType() != EDT_SOFTWARE) + { + os::Printer::log("Fatal Error: Tried to copy from a surface not owned by this driver.", ELL_ERROR); + return; + } + + if (useAlphaChannelOfTexture) + ((CSoftwareTexture*)texture)->getImage()->copyToWithAlpha( + ((CImage*)RenderTargetSurface), destPos, sourceRect, color, clipRect); + else + ((CSoftwareTexture*)texture)->getImage()->copyTo( + ((CImage*)RenderTargetSurface), destPos, sourceRect, clipRect); + } +} + + + +//! Draws a 2d line. +void CSoftwareDriver::draw2DLine(const core::position2d& start, + const core::position2d& end, + SColor color) +{ + ((CImage*)RenderTargetSurface)->drawLine(start, end, color ); +} + +//! Draws a pixel +void CSoftwareDriver::drawPixel(u32 x, u32 y, const SColor & color) +{ + ((CImage*)BackBuffer)->setPixel(x, y, color); +} + + +//! draw a 2d rectangle +void CSoftwareDriver::draw2DRectangle(SColor color, const core::rect& pos, + const core::rect* clip) +{ + if (clip) + { + core::rect p(pos); + + p.clipAgainst(*clip); + + if(!p.isValid()) + return; + + ((CImage*)RenderTargetSurface)->drawRectangle(p, color); + } + else + { + if(!pos.isValid()) + return; + + ((CImage*)RenderTargetSurface)->drawRectangle(pos, color); + } +} + + +//!Draws an 2d rectangle with a gradient. +void CSoftwareDriver::draw2DRectangle(const core::rect& pos, + SColor colorLeftUp, SColor colorRightUp, SColor colorLeftDown, SColor colorRightDown, + const core::rect* clip) +{ + // TODO: implement + draw2DRectangle(colorLeftUp, pos, clip); +} + + +//! \return Returns the name of the video driver. Example: In case of the Direct3D8 +//! driver, it would return "Direct3D8.1". +const wchar_t* CSoftwareDriver::getName() const +{ + return L"Irrlicht Software Device 1.0"; +} + + +//! Returns type of video driver +E_DRIVER_TYPE CSoftwareDriver::getDriverType() const +{ + return EDT_SOFTWARE; +} + + +//! returns color format +ECOLOR_FORMAT CSoftwareDriver::getColorFormat() const +{ + if (BackBuffer) + return BackBuffer->getColorFormat(); + else + return CNullDriver::getColorFormat(); +} + + +//! Returns the transformation set by setTransform +const core::matrix4& CSoftwareDriver::getTransform(E_TRANSFORMATION_STATE state) const +{ + return TransformationMatrix[state]; +} + + +//! Creates a render target texture. +ITexture* CSoftwareDriver::addRenderTargetTexture(const core::dimension2d& size, const c8* name) +{ + CImage* img = new CImage(video::ECF_A1R5G5B5, size); + if (!name) + name="rt"; + ITexture* tex = new CSoftwareTexture(img, name, true); + img->drop(); + addTexture(tex); + tex->drop(); + return tex; +} + + +//! Clears the ZBuffer. +void CSoftwareDriver::clearZBuffer() +{ + if (ZBuffer) + ZBuffer->clear(); +} + + +//! Returns an image created from the last rendered frame. +IImage* CSoftwareDriver::createScreenShot() +{ + if (BackBuffer) + return new CImage(BackBuffer->getColorFormat(), BackBuffer); + else + return 0; +} + + +//! Returns the maximum amount of primitives (mostly vertices) which +//! the device is able to render with one drawIndexedTriangleList +//! call. +u32 CSoftwareDriver::getMaximalPrimitiveCount() const +{ + return 0x00800000; +} + +} // end namespace video +} // end namespace irr + +#endif // _IRR_COMPILE_WITH_SOFTWARE_ + +namespace irr +{ +namespace video +{ + + +//! creates a video driver +IVideoDriver* createSoftwareDriver(const core::dimension2d& windowSize, bool fullscreen, io::IFileSystem* io, video::IImagePresenter* presenter) +{ + #ifdef _IRR_COMPILE_WITH_SOFTWARE_ + return new CSoftwareDriver(windowSize, fullscreen, io, presenter); + #else + return 0; + #endif +} + + +} // end namespace video +} // end namespace irr diff --git a/src/dep/src/irrlicht/CSoftwareDriver.h b/src/dep/src/irrlicht/CSoftwareDriver.h index 0eac0ac..7494ea2 100644 --- a/src/dep/src/irrlicht/CSoftwareDriver.h +++ b/src/dep/src/irrlicht/CSoftwareDriver.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSoftwareDriver2.cpp b/src/dep/src/irrlicht/CSoftwareDriver2.cpp index bcd7fe1..8b96646 100644 --- a/src/dep/src/irrlicht/CSoftwareDriver2.cpp +++ b/src/dep/src/irrlicht/CSoftwareDriver2.cpp @@ -1,2006 +1,2006 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#include "CSoftwareDriver2.h" - -#include "IrrCompileConfig.h" - -#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_ - -#include "SoftwareDriver2_helper.h" -#include "CSoftwareTexture2.h" -#include "CSoftware2MaterialRenderer.h" -#include "S3DVertex.h" -#include "S4DVertex.h" - - -#define MAT_TEXTURE(tex) ( (video::CSoftwareTexture2*) Material.org.getTexture ( tex ) ) - - -namespace irr -{ -namespace video -{ - - -//! constructor -CBurningVideoDriver::CBurningVideoDriver(const core::dimension2d& windowSize, bool fullscreen, io::IFileSystem* io, video::IImagePresenter* presenter) -: CNullDriver(io, windowSize), BackBuffer(0), Presenter(presenter), - WindowId(0), SceneSourceRect(0), - RenderTargetTexture(0), RenderTargetSurface(0), CurrentShader(0), - DepthBuffer(0), CurrentOut ( 12 * 2, 128 ), Temp ( 12 * 2, 128 ) -{ - #ifdef _DEBUG - setDebugName("CBurningVideoDriver"); - #endif - - // create backbuffer - BackBuffer = new CImage(BURNINGSHADER_COLOR_FORMAT, windowSize); - if (BackBuffer) - { - BackBuffer->fill(SColor(0)); - - // create z buffer - DepthBuffer = video::createDepthBuffer(BackBuffer->getDimension()); - } - - // create triangle renderers - - irr::memset32 ( BurningShader, 0, sizeof ( BurningShader ) ); - //BurningShader[ETR_FLAT] = createTRFlat2(DepthBuffer); - //BurningShader[ETR_FLAT_WIRE] = createTRFlatWire2(DepthBuffer); - BurningShader[ETR_GOURAUD] = createTriangleRendererGouraud2(DepthBuffer); - BurningShader[ETR_GOURAUD_ALPHA] = createTriangleRendererGouraudAlpha2(DepthBuffer ); - BurningShader[ETR_GOURAUD_ALPHA_NOZ] = createTRGouraudAlphaNoZ2(DepthBuffer ); - //BurningShader[ETR_GOURAUD_WIRE] = createTriangleRendererGouraudWire2(DepthBuffer); - //BurningShader[ETR_TEXTURE_FLAT] = createTriangleRendererTextureFlat2(DepthBuffer); - //BurningShader[ETR_TEXTURE_FLAT_WIRE] = createTriangleRendererTextureFlatWire2(DepthBuffer); - BurningShader[ETR_TEXTURE_GOURAUD] = createTriangleRendererTextureGouraud2(DepthBuffer); - BurningShader[ETR_TEXTURE_GOURAUD_LIGHTMAP] = createTriangleRendererTextureLightMap2_M1(DepthBuffer); - BurningShader[ETR_TEXTURE_GOURAUD_LIGHTMAP_M2] = createTriangleRendererTextureLightMap2_M2(DepthBuffer); - BurningShader[ETR_TEXTURE_GOURAUD_LIGHTMAP_M4] = createTriangleRendererGTextureLightMap2_M4(DepthBuffer); - BurningShader[ETR_TEXTURE_LIGHTMAP_M4] = createTriangleRendererTextureLightMap2_M4(DepthBuffer); - BurningShader[ETR_TEXTURE_GOURAUD_LIGHTMAP_ADD] = createTriangleRendererTextureLightMap2_Add(DepthBuffer); - BurningShader[ETR_TEXTURE_GOURAUD_DETAIL_MAP] = createTriangleRendererTextureDetailMap2(DepthBuffer); - - BurningShader[ETR_TEXTURE_GOURAUD_WIRE] = createTriangleRendererTextureGouraudWire2(DepthBuffer); - BurningShader[ETR_TEXTURE_GOURAUD_NOZ] = createTRTextureGouraudNoZ2(); - BurningShader[ETR_TEXTURE_GOURAUD_ADD] = createTRTextureGouraudAdd2(DepthBuffer); - BurningShader[ETR_TEXTURE_GOURAUD_ADD_NO_Z] = createTRTextureGouraudAddNoZ2(DepthBuffer); - BurningShader[ETR_TEXTURE_GOURAUD_VERTEX_ALPHA] = createTriangleRendererTextureVertexAlpha2 ( DepthBuffer ); - - BurningShader[ETR_TEXTURE_GOURAUD_ALPHA] = createTRTextureGouraudAlpha(DepthBuffer ); - BurningShader[ETR_TEXTURE_GOURAUD_ALPHA_NOZ] = createTRTextureGouraudAlphaNoZ( DepthBuffer ); - - BurningShader[ETR_TEXTURE_BLEND] = createTRTextureBlend( DepthBuffer ); - - BurningShader[ETR_REFERENCE] = createTriangleRendererReference ( DepthBuffer ); - - - // add the same renderer for all solid types - CSoftware2MaterialRenderer_SOLID* smr = new CSoftware2MaterialRenderer_SOLID( this); - CSoftware2MaterialRenderer_TRANSPARENT_ADD_COLOR* tmr = new CSoftware2MaterialRenderer_TRANSPARENT_ADD_COLOR( this); - CSoftware2MaterialRenderer_UNSUPPORTED * umr = new CSoftware2MaterialRenderer_UNSUPPORTED ( this ); - - //!TODO: addMaterialRenderer depends on pushing order.... - addMaterialRenderer ( smr ); // EMT_SOLID - addMaterialRenderer ( smr ); // EMT_SOLID_2_LAYER, - addMaterialRenderer ( smr ); // EMT_LIGHTMAP, - addMaterialRenderer ( tmr ); // EMT_LIGHTMAP_ADD, - addMaterialRenderer ( smr ); // EMT_LIGHTMAP_M2, - addMaterialRenderer ( smr ); // EMT_LIGHTMAP_M4, - addMaterialRenderer ( smr ); // EMT_LIGHTMAP_LIGHTING, - addMaterialRenderer ( smr ); // EMT_LIGHTMAP_LIGHTING_M2, - addMaterialRenderer ( smr ); // EMT_LIGHTMAP_LIGHTING_M4, - addMaterialRenderer ( smr ); // EMT_DETAIL_MAP, - addMaterialRenderer ( umr ); // EMT_SPHERE_MAP, - addMaterialRenderer ( smr ); // EMT_REFLECTION_2_LAYER, - addMaterialRenderer ( tmr ); // EMT_TRANSPARENT_ADD_COLOR, - addMaterialRenderer ( tmr ); // EMT_TRANSPARENT_ALPHA_CHANNEL, - addMaterialRenderer ( tmr ); // EMT_TRANSPARENT_ALPHA_CHANNEL_REF, - addMaterialRenderer ( tmr ); // EMT_TRANSPARENT_VERTEX_ALPHA, - addMaterialRenderer ( smr ); // EMT_TRANSPARENT_REFLECTION_2_LAYER, - addMaterialRenderer ( umr ); // EMT_NORMAL_MAP_SOLID, - addMaterialRenderer ( umr ); // EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR, - addMaterialRenderer ( umr ); // EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA, - addMaterialRenderer ( umr ); // EMT_PARALLAX_MAP_SOLID, - addMaterialRenderer ( umr ); // EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR, - addMaterialRenderer ( umr ); // EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA, - addMaterialRenderer ( tmr ); // EMT_ONETEXTURE_BLEND - - smr->drop (); - tmr->drop (); - umr->drop (); - - // select render target - - setRenderTarget(BackBuffer); - - LightSpace.Global_AmbientLight.set ( 0.f, 0.f, 0.f, 0.f ); - - // select the right renderer - //CurrentShader = BurningShader[ETR_REFERENCE]; - setCurrentShader(); -} - - -//! destructor -CBurningVideoDriver::~CBurningVideoDriver() -{ - // delete Backbuffer - if (BackBuffer) - BackBuffer->drop(); - - // delete triangle renderers - - for (s32 i=0; idrop(); - - // delete zbuffer - - if (DepthBuffer) - DepthBuffer->drop(); - - if (RenderTargetTexture) - RenderTargetTexture->drop(); - - if (RenderTargetSurface) - RenderTargetSurface->drop(); -} - - -//! void selects the right triangle renderer based on the render states. -void CBurningVideoDriver::setCurrentShader() -{ - EBurningFFShader shader = ETR_TEXTURE_GOURAUD; - - bool zMaterialTest = true; - switch ( Material.org.MaterialType ) - { - case EMT_ONETEXTURE_BLEND: - shader = ETR_TEXTURE_BLEND; - zMaterialTest = false; - break; - - case EMT_TRANSPARENT_ALPHA_CHANNEL_REF: - case EMT_TRANSPARENT_ALPHA_CHANNEL: - if ( Material.org.ZBuffer ) - { - shader = ETR_TEXTURE_GOURAUD_ALPHA; - } - else - { - shader = ETR_TEXTURE_GOURAUD_ALPHA_NOZ; - } - zMaterialTest = false; - break; - - case EMT_TRANSPARENT_ADD_COLOR: - if ( Material.org.ZBuffer ) - { - shader = ETR_TEXTURE_GOURAUD_ADD; - } - else - { - shader = ETR_TEXTURE_GOURAUD_ADD_NO_Z; - } - zMaterialTest = false; - break; - - case EMT_TRANSPARENT_VERTEX_ALPHA: - shader = ETR_TEXTURE_GOURAUD_VERTEX_ALPHA; - break; - - case EMT_LIGHTMAP: - case EMT_LIGHTMAP_LIGHTING: - shader = ETR_TEXTURE_GOURAUD_LIGHTMAP; - break; - - case EMT_LIGHTMAP_M2: - case EMT_LIGHTMAP_LIGHTING_M2: - shader = ETR_TEXTURE_GOURAUD_LIGHTMAP_M2; - break; - - case EMT_LIGHTMAP_LIGHTING_M4: - if ( Material.org.getTexture(1) ) - shader = ETR_TEXTURE_GOURAUD_LIGHTMAP_M4; - break; - case EMT_LIGHTMAP_M4: - if ( Material.org.getTexture(1) ) - shader = ETR_TEXTURE_LIGHTMAP_M4; - break; - - case EMT_LIGHTMAP_ADD: - if ( Material.org.getTexture(1) ) - shader = ETR_TEXTURE_GOURAUD_LIGHTMAP_ADD; - break; - - case EMT_DETAIL_MAP: - shader = ETR_TEXTURE_GOURAUD_DETAIL_MAP; - break; - - default: - break; - - } - - if ( zMaterialTest && !Material.org.ZBuffer && !Material.org.ZWriteEnable) - { - shader = ETR_TEXTURE_GOURAUD_NOZ; - } - - if ( 0 == Material.org.getTexture(0) ) - { - shader = ETR_GOURAUD; - } - - if ( Material.org.Wireframe ) - { - shader = ETR_TEXTURE_GOURAUD_WIRE; - } - - //shader = ETR_REFERENCE; - - // switchToTriangleRenderer - CurrentShader = BurningShader[shader]; - if ( CurrentShader ) - { - CurrentShader->setZCompareFunc ( Material.org.ZBuffer ); - switch ( shader ) - { - case ETR_TEXTURE_GOURAUD_ALPHA: - case ETR_TEXTURE_GOURAUD_ALPHA_NOZ: - CurrentShader->setParam ( 0, Material.org.MaterialTypeParam ); - break; - - case EMT_ONETEXTURE_BLEND: - { - E_BLEND_FACTOR srcFact,dstFact; - E_MODULATE_FUNC modulate; - unpack_texureBlendFunc ( srcFact, dstFact, modulate, Material.org.MaterialTypeParam ); - CurrentShader->setParam ( 0, Material.org.MaterialTypeParam ); - } - break; - default: - break; - } - - CurrentShader->setRenderTarget(RenderTargetSurface, ViewPort); - CurrentShader->setMaterial ( Material ); - } -} - - - -//! queries the features of the driver, returns true if feature is available -bool CBurningVideoDriver::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const -{ - if (!FeatureEnabled[feature]) - return false; - - switch (feature) - { -#ifdef SOFTWARE_DRIVER_2_BILINEAR - case EVDF_BILINEAR_FILTER: - return true; -#endif -#ifdef SOFTWARE_DRIVER_2_MIPMAPPING - case EVDF_MIP_MAP: - return true; -#endif - case EVDF_RENDER_TO_TARGET: - case EVDF_MULTITEXTURE: - case EVDF_HARDWARE_TL: - case EVDF_TEXTURE_NSQUARE: - return true; - - default: - return false; - } -} - - - -//! sets transformation -void CBurningVideoDriver::setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat) -{ - Transformation[state].m = mat; - Transformation[state].isIdentity = mat.isIdentity(); - - switch ( state ) - { - case ETS_VIEW: - Transformation[ETS_VIEW_PROJECTION].m.setbyproduct_nocheck ( - Transformation[ETS_PROJECTION].m, - Transformation[ETS_VIEW].m - ); - break; - - case ETS_WORLD: - if ( Transformation[state].isIdentity ) - { - Transformation[ETS_CURRENT] = Transformation[ETS_VIEW_PROJECTION]; - } - else - { - Transformation[ETS_CURRENT].m.setbyproduct_nocheck ( - Transformation[ETS_VIEW_PROJECTION].m, - Transformation[ETS_WORLD].m - ); - } - Transformation[ETS_CURRENT].isIdentity = 0; - -#ifdef SOFTWARE_DRIVER_2_LIGHTING - if ( Material.org.Lighting ) - { - if ( Transformation[state].isIdentity ) - { - Transformation[ETS_WORLD_VIEW] = Transformation[ETS_VIEW]; - } - else - { - Transformation[ETS_WORLD_VIEW].m.setbyproduct_nocheck ( - Transformation[ETS_VIEW].m, - Transformation[ETS_WORLD].m - ); - } - - core::matrix4 m2 ( Transformation[ETS_WORLD_VIEW].m ); - m2.makeInverse (); - m2.getTransposed ( Transformation[ETS_WORLD_VIEW_INVERSE_TRANSPOSED].m ); - } -#endif - break; - default: - break; - } -} - - -//! sets a material -void CBurningVideoDriver::setMaterial(const SMaterial& material) -{ - Material.org = material; - - Material.AmbientColor.setA8R8G8B8 ( Material.org.AmbientColor.color ); - Material.DiffuseColor.setA8R8G8B8 ( Material.org.DiffuseColor.color ); - Material.EmissiveColor.setA8R8G8B8 ( Material.org.EmissiveColor.color ); - Material.SpecularColor.setA8R8G8B8 ( Material.org.SpecularColor.color ); - - Material.SpecularEnabled = Material.org.Shininess != 0.f; - if (Material.SpecularEnabled) - Material.org.NormalizeNormals = true; - - for (u32 i = 0; i < 2; ++i) - { - setTransform((E_TRANSFORMATION_STATE) (ETS_TEXTURE_0 + i), - material.getTextureMatrix(i)); - } - - setCurrentShader(); -} - - -//! clears the zbuffer -bool CBurningVideoDriver::beginScene(bool backBuffer, bool zBuffer, - SColor color, void* windowId, core::rect* sourceRect) -{ - CNullDriver::beginScene(backBuffer, zBuffer, color, windowId, sourceRect); - WindowId = windowId; - SceneSourceRect = sourceRect; - - if (backBuffer && BackBuffer) - BackBuffer->fill(color); - - if (DepthBuffer && zBuffer) - DepthBuffer->clear(); - - return true; -} - - -//! presents the rendered scene on the screen, returns false if failed -bool CBurningVideoDriver::endScene() -{ - CNullDriver::endScene(); - - return Presenter->present(BackBuffer, WindowId, SceneSourceRect); -} - - -//! sets a render target -bool CBurningVideoDriver::setRenderTarget(video::ITexture* texture, bool clearBackBuffer, - bool clearZBuffer, SColor color) -{ - if (texture && texture->getDriverType() != EDT_BURNINGSVIDEO) - { - os::Printer::log("Fatal Error: Tried to set a texture not owned by this driver.", ELL_ERROR); - return false; - } - - if (RenderTargetTexture) - RenderTargetTexture->drop(); - - RenderTargetTexture = texture; - - if (RenderTargetTexture) - { - RenderTargetTexture->grab(); - setRenderTarget(((CSoftwareTexture2*)RenderTargetTexture)->getTexture()); - } - else - { - setRenderTarget(BackBuffer); - } - - if (RenderTargetSurface && (clearBackBuffer || clearZBuffer)) - { - if (clearZBuffer) - DepthBuffer->clear(); - - if (clearBackBuffer) - ((video::CImage*)RenderTargetSurface)->fill( color ); - } - - return true; -} - - -//! sets a render target -void CBurningVideoDriver::setRenderTarget(video::CImage* image) -{ - if (RenderTargetSurface) - RenderTargetSurface->drop(); - - RenderTargetSurface = image; - RenderTargetSize.Width = 0; - RenderTargetSize.Height = 0; - - if (RenderTargetSurface) - { - RenderTargetSurface->grab(); - RenderTargetSize = RenderTargetSurface->getDimension(); - } - - setViewPort(core::rect(0,0,RenderTargetSize.Width,RenderTargetSize.Height)); - - if (DepthBuffer) - DepthBuffer->setSize(RenderTargetSize); -} - - - -//! sets a viewport -void CBurningVideoDriver::setViewPort(const core::rect& area) -{ - ViewPort = area; - - core::rect rendert(0,0,RenderTargetSize.Width,RenderTargetSize.Height); - ViewPort.clipAgainst(rendert); - - Transformation [ ETS_CLIPSCALE ].m.buildNDCToDCMatrix ( ViewPort, 1 ); - - - if (CurrentShader) - CurrentShader->setRenderTarget(RenderTargetSurface, ViewPort); -} - -/* - generic plane clipping in homogenous coordinates - special case ndc frustum <-w,w>,<-w,w>,<-w,w> - can be rewritten with compares e.q near plane, a.z < -a.w and b.z < -b.w -*/ - -const sVec4 CBurningVideoDriver::NDCPlane[6] = -{ - sVec4( 0.f, 0.f, -1.f, -1.f ), // near - sVec4( 0.f, 0.f, 1.f, -1.f ), // far - sVec4( 1.f, 0.f, 0.f, -1.f ), // left - sVec4( -1.f, 0.f, 0.f, -1.f ), // right - sVec4( 0.f, 1.f, 0.f, -1.f ), // bottom - sVec4( 0.f, -1.f, 0.f, -1.f ) // top -}; - - - -/* - test a vertex if it's inside the standard frustum - - this is the generic one.. - - f32 dotPlane; - for ( u32 i = 0; i!= 6; ++i ) - { - dotPlane = v->Pos.dotProduct ( NDCPlane[i] ); - core::setbit_cond( flag, dotPlane <= 0.f, 1 << i ); - } - - // this is the base for ndc frustum <-w,w>,<-w,w>,<-w,w> - core::setbit_cond( flag, ( v->Pos.z - v->Pos.w ) <= 0.f, 1 ); - core::setbit_cond( flag, (-v->Pos.z - v->Pos.w ) <= 0.f, 2 ); - core::setbit_cond( flag, ( v->Pos.x - v->Pos.w ) <= 0.f, 4 ); - core::setbit_cond( flag, (-v->Pos.x - v->Pos.w ) <= 0.f, 8 ); - core::setbit_cond( flag, ( v->Pos.y - v->Pos.w ) <= 0.f, 16 ); - core::setbit_cond( flag, (-v->Pos.y - v->Pos.w ) <= 0.f, 32 ); - -*/ -#ifdef IRRLICHT_FAST_MATH - -REALINLINE u32 CBurningVideoDriver::clipToFrustumTest ( const s4DVertex * v ) const -{ - f32 test[6]; - u32 flag; - const f32 w = - v->Pos.w; - - // a conditional move is needed....FCOMI ( but we don't have it ) - // so let the fpu calculate and write it back. - // cpu makes the compare, interleaving - - test[0] = v->Pos.z + w; - test[1] = -v->Pos.z + w; - test[2] = v->Pos.x + w; - test[3] = -v->Pos.x + w; - test[4] = v->Pos.y + w; - test[5] = -v->Pos.y + w; - - flag = (IR ( test[0] ) ) >> 31; - flag |= (IR ( test[1] ) & 0x80000000 ) >> 30; - flag |= (IR ( test[2] ) & 0x80000000 ) >> 29; - flag |= (IR ( test[3] ) & 0x80000000 ) >> 28; - flag |= (IR ( test[4] ) & 0x80000000 ) >> 27; - flag |= (IR ( test[5] ) & 0x80000000 ) >> 26; - -/* - flag = F32_LOWER_EQUAL_0 ( test[0] ); - flag |= F32_LOWER_EQUAL_0 ( test[1] ) << 1; - flag |= F32_LOWER_EQUAL_0 ( test[2] ) << 2; - flag |= F32_LOWER_EQUAL_0 ( test[3] ) << 3; - flag |= F32_LOWER_EQUAL_0 ( test[4] ) << 4; - flag |= F32_LOWER_EQUAL_0 ( test[5] ) << 5; -*/ - return flag; -} - -#else - - -REALINLINE u32 CBurningVideoDriver::clipToFrustumTest ( const s4DVertex * v ) const -{ - u32 flag = 0; - for ( u32 i = 0; i!= 6; ++i ) - { - core::setbit_cond( flag, v->Pos.dotProduct ( NDCPlane[i] ) <= 0.f, 1 << i ); - } - return flag; -} - -#endif // _MSC_VER - -u32 CBurningVideoDriver::clipToHyperPlane ( s4DVertex * dest, const s4DVertex * source, u32 inCount, const sVec4 &plane ) -{ - u32 outCount = 0; - s4DVertex * out = dest; - - const s4DVertex * a; - const s4DVertex * b = source; - - f32 bDotPlane; - - bDotPlane = b->Pos.dotProduct ( plane ); - - for( u32 i = 1; i < inCount + 1; ++i) - { - const s32 condition = i - inCount; - const s32 index = (( ( condition >> 31 ) & ( i ^ condition ) ) ^ condition ) << 1; - - a = &source[ index ]; - - // current point inside - if ( a->Pos.dotProduct ( plane ) <= 0.f ) - { - // last point outside - if ( F32_GREATER_0 ( bDotPlane ) ) - { - // intersect line segment with plane - out->interpolate ( *b, *a, bDotPlane / (b->Pos - a->Pos).dotProduct ( plane ) ); - out += 2; - outCount += 1; - } - - // copy current to out - //*out = *a; - irr::memcpy32_small ( out, a, SIZEOF_SVERTEX * 2 ); - b = out; - - out += 2; - outCount += 1; - } - else - { - // current point outside - - if ( F32_LOWER_EQUAL_0 ( bDotPlane ) ) - { - // previous was inside - // intersect line segment with plane - out->interpolate ( *b, *a, bDotPlane / (b->Pos - a->Pos).dotProduct ( plane ) ); - out += 2; - outCount += 1; - } - // pointer - b = a; - } - - bDotPlane = b->Pos.dotProduct ( plane ); - - } - - return outCount; -} - - -u32 CBurningVideoDriver::clipToFrustum ( s4DVertex *v0, s4DVertex * v1, const u32 vIn ) -{ - u32 vOut = vIn; - - vOut = clipToHyperPlane ( v1, v0, vOut, NDCPlane[0] ); if ( vOut < vIn ) return vOut; - vOut = clipToHyperPlane ( v0, v1, vOut, NDCPlane[1] ); if ( vOut < vIn ) return vOut; - vOut = clipToHyperPlane ( v1, v0, vOut, NDCPlane[2] ); if ( vOut < vIn ) return vOut; - vOut = clipToHyperPlane ( v0, v1, vOut, NDCPlane[3] ); if ( vOut < vIn ) return vOut; - vOut = clipToHyperPlane ( v1, v0, vOut, NDCPlane[4] ); if ( vOut < vIn ) return vOut; - vOut = clipToHyperPlane ( v0, v1, vOut, NDCPlane[5] ); - return vOut; -} - -/*! - Part I: - apply Clip Scale matrix - From Normalized Device Coordiante ( NDC ) Space to Device Coordinate Space ( DC ) - - Part II: - Project homogeneous vector - homogeneous to non-homogenous coordinates ( dividebyW ) - - Incoming: ( xw, yw, zw, w, u, v, 1, R, G, B, A ) - Outgoing: ( xw/w, yw/w, zw/w, w/w, u/w, v/w, 1/w, R/w, G/w, B/w, A/w ) - - - replace w/w by 1/w -*/ -inline void CBurningVideoDriver::ndc_2_dc_and_project ( s4DVertex *dest,s4DVertex *source, u32 vIn ) const -{ - u32 g; - - for ( g = 0; g != vIn; g += 2 ) - { - if ( (dest[g].flag & VERTEX4D_PROJECTED ) == VERTEX4D_PROJECTED ) - continue; - - dest[g].flag = source[g].flag | VERTEX4D_PROJECTED; - - const f32 w = source[g].Pos.w; - const f32 iw = core::reciprocal ( w ); - - // to device coordinates - dest[g].Pos.x = iw * ( source[g].Pos.x * Transformation [ ETS_CLIPSCALE ].m[ 0] + w * Transformation [ ETS_CLIPSCALE ].m[12] ); - dest[g].Pos.y = iw * ( source[g].Pos.y * Transformation [ ETS_CLIPSCALE ].m[ 5] + w * Transformation [ ETS_CLIPSCALE ].m[13] ); - -#ifndef SOFTWARE_DRIVER_2_USE_WBUFFER - dest[g].Pos.z = iw * source[g].Pos.z; -#endif - - #ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR - #ifdef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT - dest[g].Color[0] = source[g].Color[0] * iw; - #else - dest[g].Color[0] = source[g].Color[0]; - #endif - - #endif - - dest[g].Pos.w = iw; - } -} - - -inline void CBurningVideoDriver::ndc_2_dc_and_project2 ( const s4DVertex **v, const u32 size ) const -{ - u32 g; - - for ( g = 0; g != size; g += 1 ) - { - s4DVertex * a = (s4DVertex*) v[g]; - - if ( (a[1].flag & VERTEX4D_PROJECTED ) == VERTEX4D_PROJECTED ) - continue; - - a[1].flag = a->flag | VERTEX4D_PROJECTED; - - // project homogenous vertex, store 1/w - const f32 w = a->Pos.w; - const f32 iw = core::reciprocal ( w ); - - // to device coordinates - a[1].Pos.x = iw * ( a->Pos.x * Transformation [ ETS_CLIPSCALE ].m[ 0] + w * Transformation [ ETS_CLIPSCALE ].m[12] ); - a[1].Pos.y = iw * ( a->Pos.y * Transformation [ ETS_CLIPSCALE ].m[ 5] + w * Transformation [ ETS_CLIPSCALE ].m[13] ); - -#ifndef SOFTWARE_DRIVER_2_USE_WBUFFER - a[1].Pos.z = a->Pos.z * iw; -#endif - - #ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR - #ifdef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT - a[1].Color[0] = a->Color[0] * iw; - #else - a[1].Color[0] = a->Color[0]; - #endif - #endif - - a[1].Pos.w = iw; - - } - -} - - -/*! - crossproduct in projected 2D -> screen area triangle -*/ -inline f32 CBurningVideoDriver::screenarea ( const s4DVertex *v ) const -{ - return ( ( v[3].Pos.x - v[1].Pos.x ) * ( v[5].Pos.y - v[1].Pos.y ) ) - - ( ( v[3].Pos.y - v[1].Pos.y ) * ( v[5].Pos.x - v[1].Pos.x ) ); -} - - -/*! -*/ -inline f32 CBurningVideoDriver::texelarea ( const s4DVertex *v, int tex ) const -{ - f32 z; - - z = ( (v[2].Tex[tex].x - v[0].Tex[tex].x ) * (v[4].Tex[tex].y - v[0].Tex[tex].y ) ) - - ( (v[4].Tex[tex].x - v[0].Tex[tex].x ) * (v[2].Tex[tex].y - v[0].Tex[tex].y ) ); - - return MAT_TEXTURE ( tex )->getLODFactor ( z ); -} - -/*! - crossproduct in projected 2D -*/ -inline f32 CBurningVideoDriver::screenarea2 ( const s4DVertex **v ) const -{ - return ( (( v[1] + 1 )->Pos.x - (v[0] + 1 )->Pos.x ) * ( (v[2] + 1 )->Pos.y - (v[0] + 1 )->Pos.y ) ) - - ( (( v[1] + 1 )->Pos.y - (v[0] + 1 )->Pos.y ) * ( (v[2] + 1 )->Pos.x - (v[0] + 1 )->Pos.x ) ); -} - -/*! -*/ -inline f32 CBurningVideoDriver::texelarea2 ( const s4DVertex **v, s32 tex ) const -{ - f32 z; - z = ( (v[1]->Tex[tex].x - v[0]->Tex[tex].x ) * (v[2]->Tex[tex].y - v[0]->Tex[tex].y ) ) - - ( (v[2]->Tex[tex].x - v[0]->Tex[tex].x ) * (v[1]->Tex[tex].y - v[0]->Tex[tex].y ) ); - - return MAT_TEXTURE ( tex )->getLODFactor ( z ); -} - - -/*! -*/ -inline void CBurningVideoDriver::select_polygon_mipmap ( s4DVertex *v, u32 vIn, s32 tex ) -{ - f32 f[2]; - - f[0] = (f32) MAT_TEXTURE ( tex )->getSize().Width; - f[1] = (f32) MAT_TEXTURE ( tex )->getSize().Height; - -#ifdef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT - for ( u32 g = 0; g != vIn; g += 2 ) - { - (v + g + 1 )->Tex[tex].x = (v + g + 0)->Tex[tex].x * ( v + g + 1 )->Pos.w * f[0]; - (v + g + 1 )->Tex[tex].y = (v + g + 0)->Tex[tex].y * ( v + g + 1 )->Pos.w * f[1]; - } -#else - for ( u32 g = 0; g != vIn; g += 2 ) - { - (v + g + 1 )->Tex[tex].x = (v + g + 0)->Tex[tex].x * f[0]; - (v + g + 1 )->Tex[tex].y = (v + g + 0)->Tex[tex].y * f[1]; - } -#endif -} - -inline void CBurningVideoDriver::select_polygon_mipmap2 ( s4DVertex **v, s32 tex ) const -{ - f32 f[2]; - - f[0] = (f32) MAT_TEXTURE ( tex )->getSize().Width; - f[1] = (f32) MAT_TEXTURE ( tex )->getSize().Height; - -#ifdef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT - (v[0] + 1 )->Tex[tex].x = v[0]->Tex[tex].x * ( v[0] + 1 )->Pos.w * f[0]; - (v[0] + 1 )->Tex[tex].y = v[0]->Tex[tex].y * ( v[0] + 1 )->Pos.w * f[1]; - - (v[1] + 1 )->Tex[tex].x = v[1]->Tex[tex].x * ( v[1] + 1 )->Pos.w * f[0]; - (v[1] + 1 )->Tex[tex].y = v[1]->Tex[tex].y * ( v[1] + 1 )->Pos.w * f[1]; - - (v[2] + 1 )->Tex[tex].x = v[2]->Tex[tex].x * ( v[2] + 1 )->Pos.w * f[0]; - (v[2] + 1 )->Tex[tex].y = v[2]->Tex[tex].y * ( v[2] + 1 )->Pos.w * f[1]; - -#else - (v[0] + 1 )->Tex[tex].x = v[0]->Tex[tex].x * f[0]; - (v[0] + 1 )->Tex[tex].y = v[0]->Tex[tex].y * f[1]; - - (v[1] + 1 )->Tex[tex].x = v[1]->Tex[tex].x * f[0]; - (v[1] + 1 )->Tex[tex].y = v[1]->Tex[tex].y * f[1]; - - (v[2] + 1 )->Tex[tex].x = v[2]->Tex[tex].x * f[0]; - (v[2] + 1 )->Tex[tex].y = v[2]->Tex[tex].y * f[1]; -#endif -} - -// Vertex Cache -const SVSize CBurningVideoDriver::vSize[] = -{ - { VERTEX4D_FORMAT_TEXTURE_1 | VERTEX4D_FORMAT_COLOR_1, sizeof(S3DVertex), 1 }, - { VERTEX4D_FORMAT_TEXTURE_2 | VERTEX4D_FORMAT_COLOR_1, sizeof(S3DVertex2TCoords),2 }, - { VERTEX4D_FORMAT_TEXTURE_2 | VERTEX4D_FORMAT_COLOR_1, sizeof(S3DVertexTangents),2 } -}; - - - -/*! - fill a cache line with transformed, light and clipp test triangles -*/ -void CBurningVideoDriver::VertexCache_fill(const u32 sourceIndex, - const u32 destIndex) -{ - u8 * source; - s4DVertex *dest; - - source = (u8*) VertexCache.vertices + ( sourceIndex * vSize[VertexCache.vType].Pitch ); - - // it's a look ahead so we never hit it.. - // but give priority... - //VertexCache.info[ destIndex ].hit = hitCount; - - // store info - VertexCache.info[ destIndex ].index = sourceIndex; - VertexCache.info[ destIndex ].hit = 0; - - // destination Vertex - dest = (s4DVertex *) ( (u8*) VertexCache.mem.data + ( destIndex << ( SIZEOF_SVERTEX_LOG2 + 1 ) ) ); - - // transform Model * World * Camera * Projection * NDCSpace matrix - Transformation [ ETS_CURRENT].m.transformVect ( &dest->Pos.x, ((S3DVertex*) source )->Pos ); - -#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR - - // light Vertex - #ifdef SOFTWARE_DRIVER_2_LIGHTING - lightVertex ( dest, ((S3DVertex*) source ) ); - #else - dest->Color[0].setA8R8G8B8 ( ((S3DVertex*) source )->Color.color ); - #endif -#endif - - // transfer texture coordinates - if ( Transformation [ ETS_TEXTURE_0 ].isIdentity ) - { - // only look on first transform - irr::memcpy32_small ( &dest->Tex[0], - &((S3DVertex*) source )->TCoords, - vSize[VertexCache.vType].TexSize * ( sizeof ( f32 ) * 2 ) - ); - } - else - { - /* - Generate texture coordinates as linear functions so that: - u = Ux*x + Uy*y + Uz*z + Uw - v = Vx*x + Vy*y + Vz*z + Vw - The matrix M for this case is: - Ux Vx 0 0 - Uy Vy 0 0 - Uz Vz 0 0 - Uw Vw 0 0 - */ - - const core::vector2d *src = &((S3DVertex*) source )->TCoords; - u32 t; - - for ( t = 0; t != vSize[VertexCache.vType].TexSize; ++t ) - { - const core::matrix4& M = Transformation [ ETS_TEXTURE_0 + t ].m; - if ( Material.org.TextureLayer[t].TextureWrap==ETC_REPEAT ) - { - dest->Tex[t].x = M[0] * src[t].X + M[4] * src[t].Y + M[8]; - dest->Tex[t].y = M[1] * src[t].X + M[5] * src[t].Y + M[9]; - } - else - { - f32 tx1, ty1; - - tx1 = M[0] * src[t].X + M[4] * src[t].Y + M[8]; - ty1 = M[1] * src[t].X + M[5] * src[t].Y + M[9]; - - dest->Tex[t].x = tx1 <= 0.f ? 0.f : tx1 >= 1.f ? 1.f : tx1; - dest->Tex[t].y = ty1 <= 0.f ? 0.f : ty1 >= 1.f ? 1.f : ty1; - - //dest->Tex[t].x = core::clamp ( M[0] * src[t].X + M[4] * src[t].Y + M[8], 0.f, 1.f ); - //dest->Tex[t].y = core::clamp ( M[1] * src[t].X + M[5] * src[t].Y + M[9], 0.f, 1.f ); - } - } - - } - - dest[0].flag = dest[1].flag = vSize[VertexCache.vType].Format; - - // test vertex - dest[0].flag |= clipToFrustumTest ( dest); - - // to DC Space, project homogenous vertex - if ( (dest[0].flag & VERTEX4D_CLIPMASK ) == VERTEX4D_INSIDE ) - { - ndc_2_dc_and_project2 ( (const s4DVertex**) &dest, 1 ); - } - - //return dest; -} - -// - -REALINLINE s4DVertex * CBurningVideoDriver::VertexCache_getVertex ( const u32 sourceIndex ) -{ - for ( s32 i = 0; i < VERTEXCACHE_ELEMENT; ++i ) - { - if ( VertexCache.info[ i ].index == sourceIndex ) - { - return (s4DVertex *) ( (u8*) VertexCache.mem.data + ( i << ( SIZEOF_SVERTEX_LOG2 + 1 ) ) ); - } - } - return 0; -} - - -/* - Cache based on linear walk indices - fill blockwise on the next 16(Cache_Size) unique vertices in indexlist - merge the next 16 vertices with the current -*/ -REALINLINE void CBurningVideoDriver::VertexCache_get ( s4DVertex ** face ) -{ - SCacheInfo info[VERTEXCACHE_ELEMENT]; - - // next primitive must be complete in cache - if ( VertexCache.indicesIndex - VertexCache.indicesRun < 3 && - VertexCache.indicesIndex < VertexCache.indexCount - ) - { - // rewind to start of primitive - VertexCache.indicesIndex = VertexCache.indicesRun; - - irr::memset32 ( info, VERTEXCACHE_MISS, sizeof ( info ) ); - - // get the next unique vertices cache line - u32 fillIndex = 0; - u32 dIndex; - u32 i; - - while ( VertexCache.indicesIndex < VertexCache.indexCount && - fillIndex < VERTEXCACHE_ELEMENT - ) - { - u32 sourceIndex = VertexCache.indices [ VertexCache.indicesIndex++ ]; - - // if not exist, push back - s32 exist = 0; - for ( dIndex = 0; dIndex < fillIndex; ++dIndex ) - { - if ( info[ dIndex ].index == sourceIndex ) - { - exist = 1; - break; - } - } - - if ( 0 == exist ) - { - info[fillIndex++].index = sourceIndex; - } - } - - // clear marks - for ( i = 0; i!= VERTEXCACHE_ELEMENT; ++i ) - { - VertexCache.info[i].hit = 0; - } - - // mark all exisiting - for ( i = 0; i!= fillIndex; ++i ) - { - for ( dIndex = 0; dIndex < VERTEXCACHE_ELEMENT; ++dIndex ) - { - if ( VertexCache.info[ dIndex ].index == info[i].index ) - { - info[i].hit = dIndex; - VertexCache.info[ dIndex ].hit = 1; - break; - } - } - } - - // fill new - for ( i = 0; i!= fillIndex; ++i ) - { - if ( info[i].hit != VERTEXCACHE_MISS ) - continue; - - for ( dIndex = 0; dIndex < VERTEXCACHE_ELEMENT; ++dIndex ) - { - if ( 0 == VertexCache.info[dIndex].hit ) - { - VertexCache_fill ( info[i].index, dIndex ); - VertexCache.info[dIndex].hit += 1; - info[i].hit = dIndex; - break; - } - } - } - } - - const u32 i0 = core::if_c_a_else_0 ( VertexCache.pType != scene::EPT_TRIANGLE_FAN, VertexCache.indicesRun ); - - face[0] = VertexCache_getVertex ( VertexCache.indices[ i0 ] ); - face[1] = VertexCache_getVertex ( VertexCache.indices[ VertexCache.indicesRun + 1] ); - face[2] = VertexCache_getVertex ( VertexCache.indices[ VertexCache.indicesRun + 2] ); - - VertexCache.indicesRun += VertexCache.primitivePitch; -} - -REALINLINE void CBurningVideoDriver::VertexCache_get2 ( s4DVertex ** face ) -{ - const u32 i0 = core::if_c_a_else_0 ( VertexCache.pType != scene::EPT_TRIANGLE_FAN, VertexCache.indicesRun ); - - VertexCache_fill ( VertexCache.indices[ i0 ], 0 ); - VertexCache_fill ( VertexCache.indices[ VertexCache.indicesRun + 1], 1 ); - VertexCache_fill ( VertexCache.indices[ VertexCache.indicesRun + 2], 2 ); - - VertexCache.indicesRun += VertexCache.primitivePitch; - - face[0] = (s4DVertex *) ( (u8*) VertexCache.mem.data + ( 0 << ( SIZEOF_SVERTEX_LOG2 + 1 ) ) ); - face[1] = (s4DVertex *) ( (u8*) VertexCache.mem.data + ( 1 << ( SIZEOF_SVERTEX_LOG2 + 1 ) ) ); - face[2] = (s4DVertex *) ( (u8*) VertexCache.mem.data + ( 2 << ( SIZEOF_SVERTEX_LOG2 + 1 ) ) ); - -} - -void CBurningVideoDriver::VertexCache_reset ( const void* vertices, u32 vertexCount, - const u16* indices, u32 primitiveCount, - E_VERTEX_TYPE vType,scene::E_PRIMITIVE_TYPE pType ) -{ - VertexCache.vertices = vertices; - VertexCache.vertexCount = vertexCount; - - VertexCache.indices = indices; - VertexCache.indicesIndex = 0; - VertexCache.indicesRun = 0; - - VertexCache.vType = vType; - VertexCache.pType = pType; - - switch ( VertexCache.pType ) - { - case scene::EPT_TRIANGLES: - VertexCache.indexCount = primitiveCount + primitiveCount + primitiveCount; - VertexCache.primitivePitch = 3; - break; - case scene::EPT_TRIANGLE_FAN: - VertexCache.indexCount = primitiveCount + 2; - VertexCache.primitivePitch = 1; - break; - } - - irr::memset32 ( VertexCache.info, VERTEXCACHE_MISS, sizeof ( VertexCache.info ) ); - -} - - -void CBurningVideoDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCount, - const void* indexList, u32 primitiveCount, - E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType) - -{ - switch (iType) - { - case (EIT_16BIT): - { - drawVertexPrimitiveList16(vertices, vertexCount, (const u16*) indexList, primitiveCount, vType, pType); - break; - } - case (EIT_32BIT): - { - os::Printer::log("Software driver can not render 32bit buffers", ELL_ERROR); - break; - } - } - - -} - - - -//! draws a vertex primitive list -void CBurningVideoDriver::drawVertexPrimitiveList16(const void* vertices, u32 vertexCount, const u16* indexList, u32 primitiveCount, E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType) -{ - if (!checkPrimitiveCount(primitiveCount)) - return; - - CNullDriver::drawVertexPrimitiveList(vertices, vertexCount, indexList, primitiveCount, vType, pType, EIT_16BIT); - - if ( 0 == CurrentShader ) - return; - - - VertexCache_reset ( vertices, vertexCount, indexList, primitiveCount, vType, pType ); - - const s4DVertex * face[3]; - - f32 dc_area; - s32 lodLevel; - u32 i; - u32 g; - - for ( i = 0; i < (u32) primitiveCount; ++i ) - { - VertexCache_get ( (s4DVertex**) face ); - - // if fully outside or outside on same side - if ( ( (face[0]->flag | face[1]->flag | face[2]->flag) & VERTEX4D_CLIPMASK ) - != VERTEX4D_INSIDE - ) - continue; - - // if fully inside - if ( ( face[0]->flag & face[1]->flag & face[2]->flag & VERTEX4D_CLIPMASK ) == VERTEX4D_INSIDE ) - { - dc_area = screenarea2 ( face ); - if ( Material.org.BackfaceCulling && F32_LOWER_EQUAL_0( dc_area ) ) - continue; - if ( Material.org.FrontfaceCulling && F32_GREATER_EQUAL_0( dc_area ) ) - continue; - - dc_area = core::reciprocal ( dc_area ); - - // select mipmap - - for ( g = 0; g != vSize[VertexCache.vType].TexSize; ++g ) - //for ( g = 0; g != BURNING_MATERIAL_MAX_TEXTURES; ++g ) - { - if ( 0 == MAT_TEXTURE ( g ) ) - { - CurrentShader->setTextureParam(g, 0, 0); - continue; - } - - lodLevel = s32_log2_f32 ( texelarea2 ( face, g ) * dc_area ); - CurrentShader->setTextureParam(g, MAT_TEXTURE ( g ), lodLevel); - select_polygon_mipmap2 ( (s4DVertex**) face, g ); - - } - - // rasterize - CurrentShader->drawTriangle ( face[0] + 1, face[1] + 1, face[2] + 1 ); - continue; - } - - // else if not complete inside clipping necessary - irr::memcpy32_small ( ( (u8*) CurrentOut.data + ( 0 << ( SIZEOF_SVERTEX_LOG2 + 1 ) ) ), face[0], SIZEOF_SVERTEX * 2 ); - irr::memcpy32_small ( ( (u8*) CurrentOut.data + ( 1 << ( SIZEOF_SVERTEX_LOG2 + 1 ) ) ), face[1], SIZEOF_SVERTEX * 2 ); - irr::memcpy32_small ( ( (u8*) CurrentOut.data + ( 2 << ( SIZEOF_SVERTEX_LOG2 + 1 ) ) ), face[2], SIZEOF_SVERTEX * 2 ); - - const u32 flag = CurrentOut.data->flag & VERTEX4D_FORMAT_MASK; - - for ( g = 0; g != CurrentOut.ElementSize; ++g ) - { - CurrentOut.data[g].flag = flag; - Temp.data[g].flag = flag; - } - - u32 vOut; - vOut = clipToFrustum ( CurrentOut.data, Temp.data, 3 ); -/* - if ( vOut < 3 ) - { - char buf[256]; - struct SCheck - { - u32 flag; - const char * name; - }; - - SCheck check[5]; - check[0].flag = face[0]->flag; - check[0].name = "face0"; - check[1].flag = face[1]->flag; - check[1].name = "face1"; - check[2].flag = face[2]->flag; - check[2].name = "face2"; - check[3].flag = (face[0]->flag & face[1]->flag & face[2]->flag); - check[3].name = "AND "; - check[4].flag = (face[0]->flag | face[1]->flag | face[2]->flag); - check[4].name = "OR "; - - for ( s32 h = 0; h!= 5; ++h ) - { - sprintf ( buf, "%s: %d %d %d %d %d %d", - check[h].name, - ( check[h].flag & 1 ), - ( check[h].flag & 2 ) >> 1, - ( check[h].flag & 4 ) >> 2, - ( check[h].flag & 8 ) >> 3, - ( check[h].flag & 16 ) >> 4, - ( check[h].flag & 32 ) >> 5 - ); - os::Printer::print ( buf ); - } - - sprintf ( buf, "Vout: %d\n", vOut ); - os::Printer::print ( buf ); - - int hold = 1; - } -*/ - if ( vOut < 3 ) - continue; - - vOut <<= 1; - - // to DC Space, project homogenous vertex - ndc_2_dc_and_project ( CurrentOut.data + 1, CurrentOut.data, vOut ); - -/* - // TODO: don't stick on 32 Bit Pointer - #define PointerAsValue(x) ( (u32) (u32*) (x) ) - - // if not complete inside clipping necessary - if ( ( test & VERTEX4D_INSIDE ) != VERTEX4D_INSIDE ) - { - u32 v[2] = { PointerAsValue ( Temp ) , PointerAsValue ( CurrentOut ) }; - for ( g = 0; g != 6; ++g ) - { - vOut = clipToHyperPlane ( (s4DVertex*) v[0], (s4DVertex*) v[1], vOut, NDCPlane[g] ); - if ( vOut < 3 ) - break; - - v[0] ^= v[1]; - v[1] ^= v[0]; - v[0] ^= v[1]; - } - - if ( vOut < 3 ) - continue; - - } -*/ - - // check 2d backface culling on first - dc_area = screenarea ( CurrentOut.data ); - if ( Material.org.BackfaceCulling && F32_LOWER_EQUAL_0 ( dc_area ) ) - continue; - if ( Material.org.FrontfaceCulling && F32_GREATER_EQUAL_0( dc_area ) ) - continue; - - // select mipmap - //for ( g = 0; g != BURNING_MATERIAL_MAX_TEXTURES; ++g ) - for ( g = 0; g != vSize[VertexCache.vType].TexSize; ++g ) - { - if ( 0 == MAT_TEXTURE ( g ) ) - { - CurrentShader->setTextureParam(g, 0, 0); - continue; - } - - lodLevel = s32_log2_f32 ( texelarea ( CurrentOut.data, g ) / dc_area ); - - CurrentShader->setTextureParam(g, MAT_TEXTURE ( g ), lodLevel); - select_polygon_mipmap ( CurrentOut.data, vOut, g ); - } - - // re-tesselate ( triangle-fan, 0-1-2,0-2-3.. ) - for ( g = 0; g <= vOut - 6; g += 2 ) - { - // rasterize - CurrentShader->drawTriangle ( CurrentOut.data + 0 + 1, - CurrentOut.data + g + 3, - CurrentOut.data + g + 5); - } - - } - - // dump statistics -/* - char buf [64]; - sprintf ( buf,"VCount:%d PCount:%d CacheMiss: %d", - vertexCount, primitiveCount, - VertexCache.CacheMiss - ); - os::Printer::print ( buf ); -*/ -} - -//! Sets the dynamic ambient light color. The default color is -//! (0,0,0,0) which means it is dark. -//! \param color: New color of the ambient light. -void CBurningVideoDriver::setAmbientLight(const SColorf& color) -{ - LightSpace.Global_AmbientLight.setColorf ( color ); -} - - -//! adds a dynamic light -void CBurningVideoDriver::addDynamicLight(const SLight& dl) -{ - if ( LightSpace.Light.size () >= getMaximalDynamicLightAmount () ) - return; - - SBurningShaderLight l; - l.org = dl; - - // light in eye space - Transformation[ETS_VIEW].m.transformVect ( &l.posEyeSpace.x, l.org.Position ); - - l.constantAttenuation = l.org.Attenuation.X; - l.linearAttenuation = l.org.Attenuation.Y; - l.quadraticAttenuation = l.org.Attenuation.Z; - - l.AmbientColor.setColorf ( l.org.AmbientColor ); - l.DiffuseColor.setColorf ( l.org.DiffuseColor ); - l.SpecularColor.setColorf ( l.org.SpecularColor ); - - switch ( dl.Type ) - { - case video::ELT_DIRECTIONAL: - { - l.posEyeSpace.normalize_xyz (); - } break; - - default: - break; - } - - LightSpace.Light.push_back ( l ); - CNullDriver::addDynamicLight( l.org ); -} - -//! deletes all dynamic lights there are -void CBurningVideoDriver::deleteAllDynamicLights() -{ - LightSpace.Light.set_used ( 0 ); - CNullDriver::deleteAllDynamicLights(); - -} - -//! returns the maximal amount of dynamic lights the device can handle -u32 CBurningVideoDriver::getMaximalDynamicLightAmount() const -{ - return 8; -} - - - -#ifdef SOFTWARE_DRIVER_2_LIGHTING - -/*! -*/ -void CBurningVideoDriver::lightVertex ( s4DVertex *dest, const S3DVertex *source ) -{ - // apply lighting model - if ( false == Material.org.Lighting ) - { - // should use the DiffuseColor but using pre-lit vertex color - dest->Color[0].setA8R8G8B8 ( source->Color.color ); - return; - } - - // eyespace -/* - core::matrix4 modelview = Transformation[ETS_WORLD].m * Transformation[ETS_VIEW].m; - - core::matrix4 m2 ( modelview ); - m2.makeInverse (); - core::matrix4 modelviewinversetransposed ( m2.getTransposed() ); -*/ - - sVec4 vertexEyeSpace; - sVec4 normalEyeSpace; - sVec4 vertexEyeSpaceUnit; - - // vertex in eye space - Transformation[ETS_WORLD_VIEW].m.transformVect ( &vertexEyeSpace.x, source->Pos ); - vertexEyeSpace.project_xyz (); - - vertexEyeSpaceUnit = vertexEyeSpace; - vertexEyeSpaceUnit.normalize_xyz(); - - // vertex normal in eye-space - //modelviewinversetransposed.transformVect ( &normalEyeSpace.x, source->Normal ); - Transformation[ETS_WORLD_VIEW_INVERSE_TRANSPOSED].m.rotateVect ( &normalEyeSpace.x, source->Normal ); - if ( Material.org.NormalizeNormals ) - { - normalEyeSpace.normalize_xyz(); - } - - - sVec4 ambient; - sVec4 diffuse; - sVec4 specular; - - - // the universe started in darkness.. - ambient.set ( 0.f, 0.f, 0.f, 0.f ); - diffuse.set ( 0.f, 0.f, 0.f, 0.f ); - specular.set ( 0.f, 0.f, 0.f, 0.f ); - - f32 attenuation = 1.f; - - u32 i; - for ( i = 0; i!= LightSpace.Light.size (); ++i ) - { - const SBurningShaderLight &light = LightSpace.Light[i]; - - sVec4 vp; // unit vector vertex to light - sVec4 lightHalf; // blinn-phong reflection - - - switch ( light.org.Type ) - { - case video::ELT_POINT: - { - // surface to light - vp.x = light.posEyeSpace.x - vertexEyeSpace.x; - vp.y = light.posEyeSpace.y - vertexEyeSpace.y; - vp.z = light.posEyeSpace.z - vertexEyeSpace.z; - - // irrlicht attenuation model -#if 0 - const f32 d = vp.get_inverse_length_xyz(); - - vp.x *= d; - vp.y *= d; - vp.z *= d; - attenuation = light.org.Radius * d; - -#else - const f32 d = vp.get_length_xyz(); - attenuation = core::reciprocal (light.constantAttenuation + - light.linearAttenuation * d + - light.quadraticAttenuation * d * d - ); - - // normalize surface to light - vp.normalize_xyz(); -#endif - - lightHalf.x = vp.x - vertexEyeSpaceUnit.x; - lightHalf.y = vp.y - vertexEyeSpaceUnit.y; - lightHalf.z = vp.z - vertexEyeSpaceUnit.z; - lightHalf.normalize_xyz(); - - } break; - - case video::ELT_DIRECTIONAL: - { - attenuation = 1.f; - vp = light.posEyeSpace; - - // half angle = lightvector + eye vector ( 0, 0, 1 ) - lightHalf.x = vp.x; - lightHalf.y = vp.y; - lightHalf.z = vp.z - 1.f; - lightHalf.normalize_xyz(); - } break; - - default: - break; - } - - // build diffuse reflection - - //angle between normal and light vector - f32 dotVP = core::max_ ( 0.f, normalEyeSpace.dot_xyz ( vp ) ); - f32 dotHV = core::max_ ( 0.f, normalEyeSpace.dot_xyz ( lightHalf ) ); - - f32 pf; - if ( dotVP == 0.0 ) - { - pf = 0.f; - } - else - { - pf = (f32)pow(dotHV, Material.org.Shininess ); - } - - // accumulate ambient - ambient += light.AmbientColor * attenuation; - diffuse += light.DiffuseColor * ( dotVP * attenuation ); - specular += light.SpecularColor * ( pf * attenuation ); - - } - - sVec4 dColor; - - dColor = LightSpace.Global_AmbientLight; - dColor += Material.EmissiveColor; - dColor += ambient * Material.AmbientColor; - dColor += diffuse * Material.DiffuseColor; - dColor += specular * Material.SpecularColor; - dColor.saturate(); - - dest->Color[0] = dColor; -} - -#endif - - -//! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted. -void CBurningVideoDriver::draw2DImage(const video::ITexture* texture, const core::position2d& destPos, - const core::rect& sourceRect, - const core::rect* clipRect, SColor color, - bool useAlphaChannelOfTexture) -{ - if (texture) - { - if (texture->getDriverType() != EDT_BURNINGSVIDEO) - { - os::Printer::log("Fatal Error: Tried to copy from a surface not owned by this driver.", ELL_ERROR); - return; - } - - if (useAlphaChannelOfTexture) - ((CSoftwareTexture2*)texture)->getImage()->copyToWithAlpha( - BackBuffer, destPos, sourceRect, color, clipRect); - else - ((CSoftwareTexture2*)texture)->getImage()->copyTo( - BackBuffer, destPos, sourceRect, clipRect); - } -} - - - -//! Draws a 2d line. -void CBurningVideoDriver::draw2DLine(const core::position2d& start, - const core::position2d& end, - SColor color) -{ - ((CImage*)BackBuffer)->drawLine(start, end, color ); -} - -//! Draws a pixel -void CBurningVideoDriver::drawPixel(u32 x, u32 y, const SColor & color) -{ - ((CImage*)BackBuffer)->setPixel(x, y, color); -} - -//! draw an 2d rectangle -void CBurningVideoDriver::draw2DRectangle(SColor color, const core::rect& pos, - const core::rect* clip) -{ - if (clip) - { - core::rect p(pos); - - p.clipAgainst(*clip); - - if(!p.isValid()) - return; - - BackBuffer->drawRectangle(p, color); - } - else - { - if(!pos.isValid()) - return; - - BackBuffer->drawRectangle(pos, color); - } -} - - -//! Only used by the internal engine. Used to notify the driver that -//! the window was resized. -void CBurningVideoDriver::OnResize(const core::dimension2d& size) -{ - // make sure width and height are multiples of 2 - core::dimension2d realSize(size); - - if (realSize.Width % 2) - realSize.Width += 1; - - if (realSize.Height % 2) - realSize.Height += 1; - - if (ScreenSize != realSize) - { - if (ViewPort.getWidth() == ScreenSize.Width && - ViewPort.getHeight() == ScreenSize.Height) - { - ViewPort = core::rect(core::position2d(0,0), realSize); - } - - ScreenSize = realSize; - - bool resetRT = (RenderTargetSurface == BackBuffer); - - if (BackBuffer) - BackBuffer->drop(); - BackBuffer = new CImage(BURNINGSHADER_COLOR_FORMAT, realSize); - - if (resetRT) - setRenderTarget(BackBuffer); - } -} - - -//! returns the current render target size -const core::dimension2d& CBurningVideoDriver::getCurrentRenderTargetSize() const -{ - return RenderTargetSize; -} - - -//!Draws an 2d rectangle with a gradient. -void CBurningVideoDriver::draw2DRectangle(const core::rect& position, - SColor colorLeftUp, SColor colorRightUp, SColor colorLeftDown, SColor colorRightDown, - const core::rect* clip) -{ -#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR - - core::rect pos = position; - - if (clip) - pos.clipAgainst(*clip); - - if (!pos.isValid()) - return; - - const core::dimension2d renderTargetSize ( ViewPort.getSize() ); - - const s32 xPlus = -(renderTargetSize.Width>>1); - const f32 xFact = 1.0f / (renderTargetSize.Width>>1); - - const s32 yPlus = renderTargetSize.Height-(renderTargetSize.Height>>1); - const f32 yFact = 1.0f / (renderTargetSize.Height>>1); - - // fill VertexCache direct - s4DVertex *v; - - VertexCache.vertexCount = 4; - - VertexCache.info[0].index = 0; - VertexCache.info[1].index = 1; - VertexCache.info[2].index = 2; - VertexCache.info[3].index = 3; - - v = &VertexCache.mem.data [ 0 ]; - - v[0].Pos.set ( (f32)(pos.UpperLeftCorner.X+xPlus) * xFact, (f32)(yPlus-pos.UpperLeftCorner.Y) * yFact, 0.f, 1.f ); - v[0].Color[0].setA8R8G8B8 ( colorLeftUp.color ); - - v[2].Pos.set ( (f32)(pos.LowerRightCorner.X+xPlus) * xFact, (f32)(yPlus- pos.UpperLeftCorner.Y) * yFact, 0.f, 1.f ); - v[2].Color[0].setA8R8G8B8 ( colorRightUp.color ); - - v[4].Pos.set ( (f32)(pos.LowerRightCorner.X+xPlus) * xFact, (f32)(yPlus-pos.LowerRightCorner.Y) * yFact, 0.f ,1.f ); - v[4].Color[0].setA8R8G8B8 ( colorRightDown.color ); - - v[6].Pos.set ( (f32)(pos.UpperLeftCorner.X+xPlus) * xFact, (f32)(yPlus-pos.LowerRightCorner.Y) * yFact, 0.f, 1.f ); - v[6].Color[0].setA8R8G8B8 ( colorLeftDown.color ); - - s32 i; - u32 g; - - for ( i = 0; i!= 8; i += 2 ) - { - v[i + 0].flag = clipToFrustumTest ( v + i ); - v[i + 1].flag = 0; - if ( (v[i].flag & VERTEX4D_INSIDE ) == VERTEX4D_INSIDE ) - { - ndc_2_dc_and_project ( v + i + 1, v + i, 2 ); - } - } - - - IBurningShader * render; - - render = BurningShader [ ETR_GOURAUD_ALPHA_NOZ ]; - render->setRenderTarget(RenderTargetSurface, ViewPort); - - static const s16 indexList[6] = {0,1,2,0,2,3}; - - s4DVertex * face[3]; - - for ( i = 0; i!= 6; i += 3 ) - { - face[0] = VertexCache_getVertex ( indexList [ i + 0 ] ); - face[1] = VertexCache_getVertex ( indexList [ i + 1 ] ); - face[2] = VertexCache_getVertex ( indexList [ i + 2 ] ); - - // test clipping - u32 test = face[0]->flag & face[1]->flag & face[2]->flag & VERTEX4D_INSIDE; - - if ( test == VERTEX4D_INSIDE ) - { - render->drawTriangle ( face[0] + 1, face[1] + 1, face[2] + 1 ); - continue; - } - // Todo: all vertices are clipped in 2d.. - // is this true ? - u32 vOut = 6; - memcpy ( CurrentOut.data + 0, face[0], sizeof ( s4DVertex ) * 2 ); - memcpy ( CurrentOut.data + 2, face[1], sizeof ( s4DVertex ) * 2 ); - memcpy ( CurrentOut.data + 4, face[2], sizeof ( s4DVertex ) * 2 ); - - vOut = clipToFrustum ( CurrentOut.data, Temp.data, 3 ); - if ( vOut < 3 ) - continue; - - vOut <<= 1; - // to DC Space, project homogenous vertex - ndc_2_dc_and_project ( CurrentOut.data + 1, CurrentOut.data, vOut ); - - // re-tesselate ( triangle-fan, 0-1-2,0-2-3.. ) - for ( g = 0; g <= vOut - 6; g += 2 ) - { - // rasterize - render->drawTriangle ( CurrentOut.data + 1, &CurrentOut.data[g + 3], &CurrentOut.data[g + 5] ); - } - - } -#else - draw2DRectangle ( colorLeftUp, position, clip ); -#endif -} - - -//! Draws a 3d line. -void CBurningVideoDriver::draw3DLine(const core::vector3df& start, - const core::vector3df& end, SColor color) -{ - Transformation [ ETS_CURRENT].m.transformVect ( &CurrentOut.data[0].Pos.x, start ); - Transformation [ ETS_CURRENT].m.transformVect ( &CurrentOut.data[2].Pos.x, end ); - - u32 g; - u32 vOut; - - // no clipping flags - for ( g = 0; g != CurrentOut.ElementSize; ++g ) - { - CurrentOut.data[g].flag = 0; - Temp.data[g].flag = 0; - } - - // vertices count per line - vOut = clipToFrustum ( CurrentOut.data, Temp.data, 2 ); - if ( vOut < 2 ) - return; - - vOut <<= 1; - - IBurningShader * line; - line = BurningShader [ ETR_TEXTURE_GOURAUD_WIRE ]; - line->setRenderTarget(RenderTargetSurface, ViewPort); - - // to DC Space, project homogenous vertex - ndc_2_dc_and_project ( CurrentOut.data + 1, CurrentOut.data, vOut ); - - // unproject vertex color -#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR - for ( g = 0; g != vOut; g+= 2 ) - { - CurrentOut.data[ g + 1].Color[0].setA8R8G8B8 ( color.color ); - } -#endif - - - for ( g = 0; g <= vOut - 4; g += 2 ) - { - // rasterize - line->drawLine ( CurrentOut.data + 1, CurrentOut.data + g + 3 ); - } -} - - -//! \return Returns the name of the video driver. Example: In case of the DirectX8 -//! driver, it would return "Direct3D8.1". -const wchar_t* CBurningVideoDriver::getName() const -{ -#ifdef BURNINGVIDEO_RENDERER_BEAUTIFUL - return L"burnings video 0.39b"; -#elif defined ( BURNINGVIDEO_RENDERER_ULTRA_FAST ) - return L"burnings video 0.39uf"; -#elif defined ( BURNINGVIDEO_RENDERER_FAST ) - return L"burnings video 0.39f"; -#else - return L"burnings video 0.39"; -#endif -} - - -//! Returns type of video driver -E_DRIVER_TYPE CBurningVideoDriver::getDriverType() const -{ - return EDT_BURNINGSVIDEO; -} - - -//! returns color format -ECOLOR_FORMAT CBurningVideoDriver::getColorFormat() const -{ - return BURNINGSHADER_COLOR_FORMAT; -} - - -//! Returns the transformation set by setTransform -const core::matrix4& CBurningVideoDriver::getTransform(E_TRANSFORMATION_STATE state) const -{ - return Transformation[state].m; -} - - -//! Creates a render target texture. -ITexture* CBurningVideoDriver::addRenderTargetTexture(const core::dimension2d& size, - const c8* name) -{ - CImage* img = new CImage(BURNINGSHADER_COLOR_FORMAT, size); - if (!name) - name="rt"; - ITexture* tex = new CSoftwareTexture2(img, name, false, true); - img->drop(); - addTexture(tex); - tex->drop(); - return tex; -} - - -//! Clears the DepthBuffer. -void CBurningVideoDriver::clearZBuffer() -{ - if (DepthBuffer) - DepthBuffer->clear(); -} - - -//! Returns an image created from the last rendered frame. -IImage* CBurningVideoDriver::createScreenShot() -{ - if (BackBuffer) - return new CImage(BackBuffer->getColorFormat(), BackBuffer); - else - return 0; -} - - -//! returns a device dependent texture from a software surface (IImage) -//! THIS METHOD HAS TO BE OVERRIDDEN BY DERIVED DRIVERS WITH OWN TEXTURES -ITexture* CBurningVideoDriver::createDeviceDependentTexture(IImage* surface, const char* name) -{ - return new CSoftwareTexture2(surface, name, getTextureCreationFlag(ETCF_CREATE_MIP_MAPS)); - -} - - -//! Returns the maximum amount of primitives (mostly vertices) which -//! the device is able to render with one drawIndexedTriangleList -//! call. -u32 CBurningVideoDriver::getMaximalPrimitiveCount() const -{ - return 0x00800000; -} - - -//! Draws a shadow volume into the stencil buffer. To draw a stencil shadow, do -//! this: First, draw all geometry. Then use this method, to draw the shadow -//! volume. Then, use IVideoDriver::drawStencilShadow() to visualize the shadow. -void CBurningVideoDriver::drawStencilShadowVolume(const core::vector3df* triangles, s32 count, bool zfail) -{ -/* - if (!StencilBuffer || !count) - return; - - setRenderStatesStencilShadowMode(zfail); - - if (!zfail) - { - // ZPASS Method - - // Draw front-side of shadow volume in stencil/z only - pID3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW ); - pID3DDevice->SetRenderState(D3DRS_STENCILPASS, D3DSTENCILOP_INCRSAT); - pID3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLELIST, count / 3, triangles, sizeof(core::vector3df)); - - // Now reverse cull order so front sides of shadow volume are written. - pID3DDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CW ); - pID3DDevice->SetRenderState( D3DRS_STENCILPASS, D3DSTENCILOP_DECRSAT); - pID3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLELIST, count / 3, triangles, sizeof(core::vector3df)); - } - else - { - // ZFAIL Method - - // Draw front-side of shadow volume in stencil/z only - pID3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW ); - pID3DDevice->SetRenderState(D3DRS_STENCILZFAIL, D3DSTENCILOP_INCRSAT ); - pID3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLELIST, count / 3, triangles, sizeof(core::vector3df)); - - // Now reverse cull order so front sides of shadow volume are written. - pID3DDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW ); - pID3DDevice->SetRenderState( D3DRS_STENCILZFAIL, D3DSTENCILOP_DECRSAT ); - pID3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLELIST, count / 3, triangles, sizeof(core::vector3df)); - } -*/ -} - - - -//! Fills the stencil shadow with color. After the shadow volume has been drawn -//! into the stencil buffer using IVideoDriver::drawStencilShadowVolume(), use this -//! to draw the color of the shadow. -void CBurningVideoDriver::drawStencilShadow(bool clearStencilBuffer, video::SColor leftUpEdge, - video::SColor rightUpEdge, video::SColor leftDownEdge, video::SColor rightDownEdge) -{ -/* - if (!StencilBuffer) - return; - - S3DVertex vtx[4]; - vtx[0] = S3DVertex(1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, leftUpEdge, 0.0f, 0.0f); - vtx[1] = S3DVertex(1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, rightUpEdge, 0.0f, 1.0f); - vtx[2] = S3DVertex(-1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, leftDownEdge, 1.0f, 0.0f); - vtx[3] = S3DVertex(-1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, rightDownEdge, 1.0f, 1.0f); - - s16 indices[6] = {0,1,2,1,3,2}; - - setRenderStatesStencilFillMode( - leftUpEdge.getAlpha() < 255 || - rightUpEdge.getAlpha() < 255 || - leftDownEdge.getAlpha() < 255 || - rightDownEdge.getAlpha() < 255); - - setTexture(0,0); - - setVertexShader(EVT_STANDARD); - - pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST, 0, 4, 2, &indices[0], - D3DFMT_INDEX16, &vtx[0], sizeof(S3DVertex)); - - if (clearStencilBuffer) - pID3DDevice->Clear( 0, NULL, D3DCLEAR_STENCIL,0, 1.0, 0); -*/ -} - - -} // end namespace video -} // end namespace irr - -#endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_ - -namespace irr -{ -namespace video -{ - -//! creates a video driver -IVideoDriver* createSoftwareDriver2(const core::dimension2d& windowSize, bool fullscreen, io::IFileSystem* io, video::IImagePresenter* presenter) -{ - #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_ - return new CBurningVideoDriver(windowSize, fullscreen, io, presenter); - #else - return 0; - #endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_ -} - - - -} // end namespace video -} // end namespace irr +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#include "CSoftwareDriver2.h" + +#include "IrrCompileConfig.h" + +#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_ + +#include "SoftwareDriver2_helper.h" +#include "CSoftwareTexture2.h" +#include "CSoftware2MaterialRenderer.h" +#include "S3DVertex.h" +#include "S4DVertex.h" + + +#define MAT_TEXTURE(tex) ( (video::CSoftwareTexture2*) Material.org.getTexture ( tex ) ) + + +namespace irr +{ +namespace video +{ + + +//! constructor +CBurningVideoDriver::CBurningVideoDriver(const core::dimension2d& windowSize, bool fullscreen, io::IFileSystem* io, video::IImagePresenter* presenter) +: CNullDriver(io, windowSize), BackBuffer(0), Presenter(presenter), + WindowId(0), SceneSourceRect(0), + RenderTargetTexture(0), RenderTargetSurface(0), CurrentShader(0), + DepthBuffer(0), CurrentOut ( 12 * 2, 128 ), Temp ( 12 * 2, 128 ) +{ + #ifdef _DEBUG + setDebugName("CBurningVideoDriver"); + #endif + + // create backbuffer + BackBuffer = new CImage(BURNINGSHADER_COLOR_FORMAT, windowSize); + if (BackBuffer) + { + BackBuffer->fill(SColor(0)); + + // create z buffer + DepthBuffer = video::createDepthBuffer(BackBuffer->getDimension()); + } + + // create triangle renderers + + irr::memset32 ( BurningShader, 0, sizeof ( BurningShader ) ); + //BurningShader[ETR_FLAT] = createTRFlat2(DepthBuffer); + //BurningShader[ETR_FLAT_WIRE] = createTRFlatWire2(DepthBuffer); + BurningShader[ETR_GOURAUD] = createTriangleRendererGouraud2(DepthBuffer); + BurningShader[ETR_GOURAUD_ALPHA] = createTriangleRendererGouraudAlpha2(DepthBuffer ); + BurningShader[ETR_GOURAUD_ALPHA_NOZ] = createTRGouraudAlphaNoZ2(DepthBuffer ); + //BurningShader[ETR_GOURAUD_WIRE] = createTriangleRendererGouraudWire2(DepthBuffer); + //BurningShader[ETR_TEXTURE_FLAT] = createTriangleRendererTextureFlat2(DepthBuffer); + //BurningShader[ETR_TEXTURE_FLAT_WIRE] = createTriangleRendererTextureFlatWire2(DepthBuffer); + BurningShader[ETR_TEXTURE_GOURAUD] = createTriangleRendererTextureGouraud2(DepthBuffer); + BurningShader[ETR_TEXTURE_GOURAUD_LIGHTMAP] = createTriangleRendererTextureLightMap2_M1(DepthBuffer); + BurningShader[ETR_TEXTURE_GOURAUD_LIGHTMAP_M2] = createTriangleRendererTextureLightMap2_M2(DepthBuffer); + BurningShader[ETR_TEXTURE_GOURAUD_LIGHTMAP_M4] = createTriangleRendererGTextureLightMap2_M4(DepthBuffer); + BurningShader[ETR_TEXTURE_LIGHTMAP_M4] = createTriangleRendererTextureLightMap2_M4(DepthBuffer); + BurningShader[ETR_TEXTURE_GOURAUD_LIGHTMAP_ADD] = createTriangleRendererTextureLightMap2_Add(DepthBuffer); + BurningShader[ETR_TEXTURE_GOURAUD_DETAIL_MAP] = createTriangleRendererTextureDetailMap2(DepthBuffer); + + BurningShader[ETR_TEXTURE_GOURAUD_WIRE] = createTriangleRendererTextureGouraudWire2(DepthBuffer); + BurningShader[ETR_TEXTURE_GOURAUD_NOZ] = createTRTextureGouraudNoZ2(); + BurningShader[ETR_TEXTURE_GOURAUD_ADD] = createTRTextureGouraudAdd2(DepthBuffer); + BurningShader[ETR_TEXTURE_GOURAUD_ADD_NO_Z] = createTRTextureGouraudAddNoZ2(DepthBuffer); + BurningShader[ETR_TEXTURE_GOURAUD_VERTEX_ALPHA] = createTriangleRendererTextureVertexAlpha2 ( DepthBuffer ); + + BurningShader[ETR_TEXTURE_GOURAUD_ALPHA] = createTRTextureGouraudAlpha(DepthBuffer ); + BurningShader[ETR_TEXTURE_GOURAUD_ALPHA_NOZ] = createTRTextureGouraudAlphaNoZ( DepthBuffer ); + + BurningShader[ETR_TEXTURE_BLEND] = createTRTextureBlend( DepthBuffer ); + + BurningShader[ETR_REFERENCE] = createTriangleRendererReference ( DepthBuffer ); + + + // add the same renderer for all solid types + CSoftware2MaterialRenderer_SOLID* smr = new CSoftware2MaterialRenderer_SOLID( this); + CSoftware2MaterialRenderer_TRANSPARENT_ADD_COLOR* tmr = new CSoftware2MaterialRenderer_TRANSPARENT_ADD_COLOR( this); + CSoftware2MaterialRenderer_UNSUPPORTED * umr = new CSoftware2MaterialRenderer_UNSUPPORTED ( this ); + + //!TODO: addMaterialRenderer depends on pushing order.... + addMaterialRenderer ( smr ); // EMT_SOLID + addMaterialRenderer ( smr ); // EMT_SOLID_2_LAYER, + addMaterialRenderer ( smr ); // EMT_LIGHTMAP, + addMaterialRenderer ( tmr ); // EMT_LIGHTMAP_ADD, + addMaterialRenderer ( smr ); // EMT_LIGHTMAP_M2, + addMaterialRenderer ( smr ); // EMT_LIGHTMAP_M4, + addMaterialRenderer ( smr ); // EMT_LIGHTMAP_LIGHTING, + addMaterialRenderer ( smr ); // EMT_LIGHTMAP_LIGHTING_M2, + addMaterialRenderer ( smr ); // EMT_LIGHTMAP_LIGHTING_M4, + addMaterialRenderer ( smr ); // EMT_DETAIL_MAP, + addMaterialRenderer ( umr ); // EMT_SPHERE_MAP, + addMaterialRenderer ( smr ); // EMT_REFLECTION_2_LAYER, + addMaterialRenderer ( tmr ); // EMT_TRANSPARENT_ADD_COLOR, + addMaterialRenderer ( tmr ); // EMT_TRANSPARENT_ALPHA_CHANNEL, + addMaterialRenderer ( tmr ); // EMT_TRANSPARENT_ALPHA_CHANNEL_REF, + addMaterialRenderer ( tmr ); // EMT_TRANSPARENT_VERTEX_ALPHA, + addMaterialRenderer ( smr ); // EMT_TRANSPARENT_REFLECTION_2_LAYER, + addMaterialRenderer ( umr ); // EMT_NORMAL_MAP_SOLID, + addMaterialRenderer ( umr ); // EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR, + addMaterialRenderer ( umr ); // EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA, + addMaterialRenderer ( umr ); // EMT_PARALLAX_MAP_SOLID, + addMaterialRenderer ( umr ); // EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR, + addMaterialRenderer ( umr ); // EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA, + addMaterialRenderer ( tmr ); // EMT_ONETEXTURE_BLEND + + smr->drop (); + tmr->drop (); + umr->drop (); + + // select render target + + setRenderTarget(BackBuffer); + + LightSpace.Global_AmbientLight.set ( 0.f, 0.f, 0.f, 0.f ); + + // select the right renderer + //CurrentShader = BurningShader[ETR_REFERENCE]; + setCurrentShader(); +} + + +//! destructor +CBurningVideoDriver::~CBurningVideoDriver() +{ + // delete Backbuffer + if (BackBuffer) + BackBuffer->drop(); + + // delete triangle renderers + + for (s32 i=0; idrop(); + + // delete zbuffer + + if (DepthBuffer) + DepthBuffer->drop(); + + if (RenderTargetTexture) + RenderTargetTexture->drop(); + + if (RenderTargetSurface) + RenderTargetSurface->drop(); +} + + +//! void selects the right triangle renderer based on the render states. +void CBurningVideoDriver::setCurrentShader() +{ + EBurningFFShader shader = ETR_TEXTURE_GOURAUD; + + bool zMaterialTest = true; + switch ( Material.org.MaterialType ) + { + case EMT_ONETEXTURE_BLEND: + shader = ETR_TEXTURE_BLEND; + zMaterialTest = false; + break; + + case EMT_TRANSPARENT_ALPHA_CHANNEL_REF: + case EMT_TRANSPARENT_ALPHA_CHANNEL: + if ( Material.org.ZBuffer ) + { + shader = ETR_TEXTURE_GOURAUD_ALPHA; + } + else + { + shader = ETR_TEXTURE_GOURAUD_ALPHA_NOZ; + } + zMaterialTest = false; + break; + + case EMT_TRANSPARENT_ADD_COLOR: + if ( Material.org.ZBuffer ) + { + shader = ETR_TEXTURE_GOURAUD_ADD; + } + else + { + shader = ETR_TEXTURE_GOURAUD_ADD_NO_Z; + } + zMaterialTest = false; + break; + + case EMT_TRANSPARENT_VERTEX_ALPHA: + shader = ETR_TEXTURE_GOURAUD_VERTEX_ALPHA; + break; + + case EMT_LIGHTMAP: + case EMT_LIGHTMAP_LIGHTING: + shader = ETR_TEXTURE_GOURAUD_LIGHTMAP; + break; + + case EMT_LIGHTMAP_M2: + case EMT_LIGHTMAP_LIGHTING_M2: + shader = ETR_TEXTURE_GOURAUD_LIGHTMAP_M2; + break; + + case EMT_LIGHTMAP_LIGHTING_M4: + if ( Material.org.getTexture(1) ) + shader = ETR_TEXTURE_GOURAUD_LIGHTMAP_M4; + break; + case EMT_LIGHTMAP_M4: + if ( Material.org.getTexture(1) ) + shader = ETR_TEXTURE_LIGHTMAP_M4; + break; + + case EMT_LIGHTMAP_ADD: + if ( Material.org.getTexture(1) ) + shader = ETR_TEXTURE_GOURAUD_LIGHTMAP_ADD; + break; + + case EMT_DETAIL_MAP: + shader = ETR_TEXTURE_GOURAUD_DETAIL_MAP; + break; + + default: + break; + + } + + if ( zMaterialTest && !Material.org.ZBuffer && !Material.org.ZWriteEnable) + { + shader = ETR_TEXTURE_GOURAUD_NOZ; + } + + if ( 0 == Material.org.getTexture(0) ) + { + shader = ETR_GOURAUD; + } + + if ( Material.org.Wireframe ) + { + shader = ETR_TEXTURE_GOURAUD_WIRE; + } + + //shader = ETR_REFERENCE; + + // switchToTriangleRenderer + CurrentShader = BurningShader[shader]; + if ( CurrentShader ) + { + CurrentShader->setZCompareFunc ( Material.org.ZBuffer ); + switch ( shader ) + { + case ETR_TEXTURE_GOURAUD_ALPHA: + case ETR_TEXTURE_GOURAUD_ALPHA_NOZ: + CurrentShader->setParam ( 0, Material.org.MaterialTypeParam ); + break; + + case EMT_ONETEXTURE_BLEND: + { + E_BLEND_FACTOR srcFact,dstFact; + E_MODULATE_FUNC modulate; + unpack_texureBlendFunc ( srcFact, dstFact, modulate, Material.org.MaterialTypeParam ); + CurrentShader->setParam ( 0, Material.org.MaterialTypeParam ); + } + break; + default: + break; + } + + CurrentShader->setRenderTarget(RenderTargetSurface, ViewPort); + CurrentShader->setMaterial ( Material ); + } +} + + + +//! queries the features of the driver, returns true if feature is available +bool CBurningVideoDriver::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const +{ + if (!FeatureEnabled[feature]) + return false; + + switch (feature) + { +#ifdef SOFTWARE_DRIVER_2_BILINEAR + case EVDF_BILINEAR_FILTER: + return true; +#endif +#ifdef SOFTWARE_DRIVER_2_MIPMAPPING + case EVDF_MIP_MAP: + return true; +#endif + case EVDF_RENDER_TO_TARGET: + case EVDF_MULTITEXTURE: + case EVDF_HARDWARE_TL: + case EVDF_TEXTURE_NSQUARE: + return true; + + default: + return false; + } +} + + + +//! sets transformation +void CBurningVideoDriver::setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat) +{ + Transformation[state].m = mat; + Transformation[state].isIdentity = mat.isIdentity(); + + switch ( state ) + { + case ETS_VIEW: + Transformation[ETS_VIEW_PROJECTION].m.setbyproduct_nocheck ( + Transformation[ETS_PROJECTION].m, + Transformation[ETS_VIEW].m + ); + break; + + case ETS_WORLD: + if ( Transformation[state].isIdentity ) + { + Transformation[ETS_CURRENT] = Transformation[ETS_VIEW_PROJECTION]; + } + else + { + Transformation[ETS_CURRENT].m.setbyproduct_nocheck ( + Transformation[ETS_VIEW_PROJECTION].m, + Transformation[ETS_WORLD].m + ); + } + Transformation[ETS_CURRENT].isIdentity = 0; + +#ifdef SOFTWARE_DRIVER_2_LIGHTING + if ( Material.org.Lighting ) + { + if ( Transformation[state].isIdentity ) + { + Transformation[ETS_WORLD_VIEW] = Transformation[ETS_VIEW]; + } + else + { + Transformation[ETS_WORLD_VIEW].m.setbyproduct_nocheck ( + Transformation[ETS_VIEW].m, + Transformation[ETS_WORLD].m + ); + } + + core::matrix4 m2 ( Transformation[ETS_WORLD_VIEW].m ); + m2.makeInverse (); + m2.getTransposed ( Transformation[ETS_WORLD_VIEW_INVERSE_TRANSPOSED].m ); + } +#endif + break; + default: + break; + } +} + + +//! sets a material +void CBurningVideoDriver::setMaterial(const SMaterial& material) +{ + Material.org = material; + + Material.AmbientColor.setA8R8G8B8 ( Material.org.AmbientColor.color ); + Material.DiffuseColor.setA8R8G8B8 ( Material.org.DiffuseColor.color ); + Material.EmissiveColor.setA8R8G8B8 ( Material.org.EmissiveColor.color ); + Material.SpecularColor.setA8R8G8B8 ( Material.org.SpecularColor.color ); + + Material.SpecularEnabled = Material.org.Shininess != 0.f; + if (Material.SpecularEnabled) + Material.org.NormalizeNormals = true; + + for (u32 i = 0; i < 2; ++i) + { + setTransform((E_TRANSFORMATION_STATE) (ETS_TEXTURE_0 + i), + material.getTextureMatrix(i)); + } + + setCurrentShader(); +} + + +//! clears the zbuffer +bool CBurningVideoDriver::beginScene(bool backBuffer, bool zBuffer, + SColor color, void* windowId, core::rect* sourceRect) +{ + CNullDriver::beginScene(backBuffer, zBuffer, color, windowId, sourceRect); + WindowId = windowId; + SceneSourceRect = sourceRect; + + if (backBuffer && BackBuffer) + BackBuffer->fill(color); + + if (DepthBuffer && zBuffer) + DepthBuffer->clear(); + + return true; +} + + +//! presents the rendered scene on the screen, returns false if failed +bool CBurningVideoDriver::endScene() +{ + CNullDriver::endScene(); + + return Presenter->present(BackBuffer, WindowId, SceneSourceRect); +} + + +//! sets a render target +bool CBurningVideoDriver::setRenderTarget(video::ITexture* texture, bool clearBackBuffer, + bool clearZBuffer, SColor color) +{ + if (texture && texture->getDriverType() != EDT_BURNINGSVIDEO) + { + os::Printer::log("Fatal Error: Tried to set a texture not owned by this driver.", ELL_ERROR); + return false; + } + + if (RenderTargetTexture) + RenderTargetTexture->drop(); + + RenderTargetTexture = texture; + + if (RenderTargetTexture) + { + RenderTargetTexture->grab(); + setRenderTarget(((CSoftwareTexture2*)RenderTargetTexture)->getTexture()); + } + else + { + setRenderTarget(BackBuffer); + } + + if (RenderTargetSurface && (clearBackBuffer || clearZBuffer)) + { + if (clearZBuffer) + DepthBuffer->clear(); + + if (clearBackBuffer) + ((video::CImage*)RenderTargetSurface)->fill( color ); + } + + return true; +} + + +//! sets a render target +void CBurningVideoDriver::setRenderTarget(video::CImage* image) +{ + if (RenderTargetSurface) + RenderTargetSurface->drop(); + + RenderTargetSurface = image; + RenderTargetSize.Width = 0; + RenderTargetSize.Height = 0; + + if (RenderTargetSurface) + { + RenderTargetSurface->grab(); + RenderTargetSize = RenderTargetSurface->getDimension(); + } + + setViewPort(core::rect(0,0,RenderTargetSize.Width,RenderTargetSize.Height)); + + if (DepthBuffer) + DepthBuffer->setSize(RenderTargetSize); +} + + + +//! sets a viewport +void CBurningVideoDriver::setViewPort(const core::rect& area) +{ + ViewPort = area; + + core::rect rendert(0,0,RenderTargetSize.Width,RenderTargetSize.Height); + ViewPort.clipAgainst(rendert); + + Transformation [ ETS_CLIPSCALE ].m.buildNDCToDCMatrix ( ViewPort, 1 ); + + + if (CurrentShader) + CurrentShader->setRenderTarget(RenderTargetSurface, ViewPort); +} + +/* + generic plane clipping in homogenous coordinates + special case ndc frustum <-w,w>,<-w,w>,<-w,w> + can be rewritten with compares e.q near plane, a.z < -a.w and b.z < -b.w +*/ + +const sVec4 CBurningVideoDriver::NDCPlane[6] = +{ + sVec4( 0.f, 0.f, -1.f, -1.f ), // near + sVec4( 0.f, 0.f, 1.f, -1.f ), // far + sVec4( 1.f, 0.f, 0.f, -1.f ), // left + sVec4( -1.f, 0.f, 0.f, -1.f ), // right + sVec4( 0.f, 1.f, 0.f, -1.f ), // bottom + sVec4( 0.f, -1.f, 0.f, -1.f ) // top +}; + + + +/* + test a vertex if it's inside the standard frustum + + this is the generic one.. + + f32 dotPlane; + for ( u32 i = 0; i!= 6; ++i ) + { + dotPlane = v->Pos.dotProduct ( NDCPlane[i] ); + core::setbit_cond( flag, dotPlane <= 0.f, 1 << i ); + } + + // this is the base for ndc frustum <-w,w>,<-w,w>,<-w,w> + core::setbit_cond( flag, ( v->Pos.z - v->Pos.w ) <= 0.f, 1 ); + core::setbit_cond( flag, (-v->Pos.z - v->Pos.w ) <= 0.f, 2 ); + core::setbit_cond( flag, ( v->Pos.x - v->Pos.w ) <= 0.f, 4 ); + core::setbit_cond( flag, (-v->Pos.x - v->Pos.w ) <= 0.f, 8 ); + core::setbit_cond( flag, ( v->Pos.y - v->Pos.w ) <= 0.f, 16 ); + core::setbit_cond( flag, (-v->Pos.y - v->Pos.w ) <= 0.f, 32 ); + +*/ +#ifdef IRRLICHT_FAST_MATH + +REALINLINE u32 CBurningVideoDriver::clipToFrustumTest ( const s4DVertex * v ) const +{ + f32 test[6]; + u32 flag; + const f32 w = - v->Pos.w; + + // a conditional move is needed....FCOMI ( but we don't have it ) + // so let the fpu calculate and write it back. + // cpu makes the compare, interleaving + + test[0] = v->Pos.z + w; + test[1] = -v->Pos.z + w; + test[2] = v->Pos.x + w; + test[3] = -v->Pos.x + w; + test[4] = v->Pos.y + w; + test[5] = -v->Pos.y + w; + + flag = (IR ( test[0] ) ) >> 31; + flag |= (IR ( test[1] ) & 0x80000000 ) >> 30; + flag |= (IR ( test[2] ) & 0x80000000 ) >> 29; + flag |= (IR ( test[3] ) & 0x80000000 ) >> 28; + flag |= (IR ( test[4] ) & 0x80000000 ) >> 27; + flag |= (IR ( test[5] ) & 0x80000000 ) >> 26; + +/* + flag = F32_LOWER_EQUAL_0 ( test[0] ); + flag |= F32_LOWER_EQUAL_0 ( test[1] ) << 1; + flag |= F32_LOWER_EQUAL_0 ( test[2] ) << 2; + flag |= F32_LOWER_EQUAL_0 ( test[3] ) << 3; + flag |= F32_LOWER_EQUAL_0 ( test[4] ) << 4; + flag |= F32_LOWER_EQUAL_0 ( test[5] ) << 5; +*/ + return flag; +} + +#else + + +REALINLINE u32 CBurningVideoDriver::clipToFrustumTest ( const s4DVertex * v ) const +{ + u32 flag = 0; + for ( u32 i = 0; i!= 6; ++i ) + { + core::setbit_cond( flag, v->Pos.dotProduct ( NDCPlane[i] ) <= 0.f, 1 << i ); + } + return flag; +} + +#endif // _MSC_VER + +u32 CBurningVideoDriver::clipToHyperPlane ( s4DVertex * dest, const s4DVertex * source, u32 inCount, const sVec4 &plane ) +{ + u32 outCount = 0; + s4DVertex * out = dest; + + const s4DVertex * a; + const s4DVertex * b = source; + + f32 bDotPlane; + + bDotPlane = b->Pos.dotProduct ( plane ); + + for( u32 i = 1; i < inCount + 1; ++i) + { + const s32 condition = i - inCount; + const s32 index = (( ( condition >> 31 ) & ( i ^ condition ) ) ^ condition ) << 1; + + a = &source[ index ]; + + // current point inside + if ( a->Pos.dotProduct ( plane ) <= 0.f ) + { + // last point outside + if ( F32_GREATER_0 ( bDotPlane ) ) + { + // intersect line segment with plane + out->interpolate ( *b, *a, bDotPlane / (b->Pos - a->Pos).dotProduct ( plane ) ); + out += 2; + outCount += 1; + } + + // copy current to out + //*out = *a; + irr::memcpy32_small ( out, a, SIZEOF_SVERTEX * 2 ); + b = out; + + out += 2; + outCount += 1; + } + else + { + // current point outside + + if ( F32_LOWER_EQUAL_0 ( bDotPlane ) ) + { + // previous was inside + // intersect line segment with plane + out->interpolate ( *b, *a, bDotPlane / (b->Pos - a->Pos).dotProduct ( plane ) ); + out += 2; + outCount += 1; + } + // pointer + b = a; + } + + bDotPlane = b->Pos.dotProduct ( plane ); + + } + + return outCount; +} + + +u32 CBurningVideoDriver::clipToFrustum ( s4DVertex *v0, s4DVertex * v1, const u32 vIn ) +{ + u32 vOut = vIn; + + vOut = clipToHyperPlane ( v1, v0, vOut, NDCPlane[0] ); if ( vOut < vIn ) return vOut; + vOut = clipToHyperPlane ( v0, v1, vOut, NDCPlane[1] ); if ( vOut < vIn ) return vOut; + vOut = clipToHyperPlane ( v1, v0, vOut, NDCPlane[2] ); if ( vOut < vIn ) return vOut; + vOut = clipToHyperPlane ( v0, v1, vOut, NDCPlane[3] ); if ( vOut < vIn ) return vOut; + vOut = clipToHyperPlane ( v1, v0, vOut, NDCPlane[4] ); if ( vOut < vIn ) return vOut; + vOut = clipToHyperPlane ( v0, v1, vOut, NDCPlane[5] ); + return vOut; +} + +/*! + Part I: + apply Clip Scale matrix + From Normalized Device Coordiante ( NDC ) Space to Device Coordinate Space ( DC ) + + Part II: + Project homogeneous vector + homogeneous to non-homogenous coordinates ( dividebyW ) + + Incoming: ( xw, yw, zw, w, u, v, 1, R, G, B, A ) + Outgoing: ( xw/w, yw/w, zw/w, w/w, u/w, v/w, 1/w, R/w, G/w, B/w, A/w ) + + + replace w/w by 1/w +*/ +inline void CBurningVideoDriver::ndc_2_dc_and_project ( s4DVertex *dest,s4DVertex *source, u32 vIn ) const +{ + u32 g; + + for ( g = 0; g != vIn; g += 2 ) + { + if ( (dest[g].flag & VERTEX4D_PROJECTED ) == VERTEX4D_PROJECTED ) + continue; + + dest[g].flag = source[g].flag | VERTEX4D_PROJECTED; + + const f32 w = source[g].Pos.w; + const f32 iw = core::reciprocal ( w ); + + // to device coordinates + dest[g].Pos.x = iw * ( source[g].Pos.x * Transformation [ ETS_CLIPSCALE ].m[ 0] + w * Transformation [ ETS_CLIPSCALE ].m[12] ); + dest[g].Pos.y = iw * ( source[g].Pos.y * Transformation [ ETS_CLIPSCALE ].m[ 5] + w * Transformation [ ETS_CLIPSCALE ].m[13] ); + +#ifndef SOFTWARE_DRIVER_2_USE_WBUFFER + dest[g].Pos.z = iw * source[g].Pos.z; +#endif + + #ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR + #ifdef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT + dest[g].Color[0] = source[g].Color[0] * iw; + #else + dest[g].Color[0] = source[g].Color[0]; + #endif + + #endif + + dest[g].Pos.w = iw; + } +} + + +inline void CBurningVideoDriver::ndc_2_dc_and_project2 ( const s4DVertex **v, const u32 size ) const +{ + u32 g; + + for ( g = 0; g != size; g += 1 ) + { + s4DVertex * a = (s4DVertex*) v[g]; + + if ( (a[1].flag & VERTEX4D_PROJECTED ) == VERTEX4D_PROJECTED ) + continue; + + a[1].flag = a->flag | VERTEX4D_PROJECTED; + + // project homogenous vertex, store 1/w + const f32 w = a->Pos.w; + const f32 iw = core::reciprocal ( w ); + + // to device coordinates + a[1].Pos.x = iw * ( a->Pos.x * Transformation [ ETS_CLIPSCALE ].m[ 0] + w * Transformation [ ETS_CLIPSCALE ].m[12] ); + a[1].Pos.y = iw * ( a->Pos.y * Transformation [ ETS_CLIPSCALE ].m[ 5] + w * Transformation [ ETS_CLIPSCALE ].m[13] ); + +#ifndef SOFTWARE_DRIVER_2_USE_WBUFFER + a[1].Pos.z = a->Pos.z * iw; +#endif + + #ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR + #ifdef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT + a[1].Color[0] = a->Color[0] * iw; + #else + a[1].Color[0] = a->Color[0]; + #endif + #endif + + a[1].Pos.w = iw; + + } + +} + + +/*! + crossproduct in projected 2D -> screen area triangle +*/ +inline f32 CBurningVideoDriver::screenarea ( const s4DVertex *v ) const +{ + return ( ( v[3].Pos.x - v[1].Pos.x ) * ( v[5].Pos.y - v[1].Pos.y ) ) - + ( ( v[3].Pos.y - v[1].Pos.y ) * ( v[5].Pos.x - v[1].Pos.x ) ); +} + + +/*! +*/ +inline f32 CBurningVideoDriver::texelarea ( const s4DVertex *v, int tex ) const +{ + f32 z; + + z = ( (v[2].Tex[tex].x - v[0].Tex[tex].x ) * (v[4].Tex[tex].y - v[0].Tex[tex].y ) ) + - ( (v[4].Tex[tex].x - v[0].Tex[tex].x ) * (v[2].Tex[tex].y - v[0].Tex[tex].y ) ); + + return MAT_TEXTURE ( tex )->getLODFactor ( z ); +} + +/*! + crossproduct in projected 2D +*/ +inline f32 CBurningVideoDriver::screenarea2 ( const s4DVertex **v ) const +{ + return ( (( v[1] + 1 )->Pos.x - (v[0] + 1 )->Pos.x ) * ( (v[2] + 1 )->Pos.y - (v[0] + 1 )->Pos.y ) ) - + ( (( v[1] + 1 )->Pos.y - (v[0] + 1 )->Pos.y ) * ( (v[2] + 1 )->Pos.x - (v[0] + 1 )->Pos.x ) ); +} + +/*! +*/ +inline f32 CBurningVideoDriver::texelarea2 ( const s4DVertex **v, s32 tex ) const +{ + f32 z; + z = ( (v[1]->Tex[tex].x - v[0]->Tex[tex].x ) * (v[2]->Tex[tex].y - v[0]->Tex[tex].y ) ) + - ( (v[2]->Tex[tex].x - v[0]->Tex[tex].x ) * (v[1]->Tex[tex].y - v[0]->Tex[tex].y ) ); + + return MAT_TEXTURE ( tex )->getLODFactor ( z ); +} + + +/*! +*/ +inline void CBurningVideoDriver::select_polygon_mipmap ( s4DVertex *v, u32 vIn, s32 tex ) +{ + f32 f[2]; + + f[0] = (f32) MAT_TEXTURE ( tex )->getSize().Width; + f[1] = (f32) MAT_TEXTURE ( tex )->getSize().Height; + +#ifdef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT + for ( u32 g = 0; g != vIn; g += 2 ) + { + (v + g + 1 )->Tex[tex].x = (v + g + 0)->Tex[tex].x * ( v + g + 1 )->Pos.w * f[0]; + (v + g + 1 )->Tex[tex].y = (v + g + 0)->Tex[tex].y * ( v + g + 1 )->Pos.w * f[1]; + } +#else + for ( u32 g = 0; g != vIn; g += 2 ) + { + (v + g + 1 )->Tex[tex].x = (v + g + 0)->Tex[tex].x * f[0]; + (v + g + 1 )->Tex[tex].y = (v + g + 0)->Tex[tex].y * f[1]; + } +#endif +} + +inline void CBurningVideoDriver::select_polygon_mipmap2 ( s4DVertex **v, s32 tex ) const +{ + f32 f[2]; + + f[0] = (f32) MAT_TEXTURE ( tex )->getSize().Width; + f[1] = (f32) MAT_TEXTURE ( tex )->getSize().Height; + +#ifdef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT + (v[0] + 1 )->Tex[tex].x = v[0]->Tex[tex].x * ( v[0] + 1 )->Pos.w * f[0]; + (v[0] + 1 )->Tex[tex].y = v[0]->Tex[tex].y * ( v[0] + 1 )->Pos.w * f[1]; + + (v[1] + 1 )->Tex[tex].x = v[1]->Tex[tex].x * ( v[1] + 1 )->Pos.w * f[0]; + (v[1] + 1 )->Tex[tex].y = v[1]->Tex[tex].y * ( v[1] + 1 )->Pos.w * f[1]; + + (v[2] + 1 )->Tex[tex].x = v[2]->Tex[tex].x * ( v[2] + 1 )->Pos.w * f[0]; + (v[2] + 1 )->Tex[tex].y = v[2]->Tex[tex].y * ( v[2] + 1 )->Pos.w * f[1]; + +#else + (v[0] + 1 )->Tex[tex].x = v[0]->Tex[tex].x * f[0]; + (v[0] + 1 )->Tex[tex].y = v[0]->Tex[tex].y * f[1]; + + (v[1] + 1 )->Tex[tex].x = v[1]->Tex[tex].x * f[0]; + (v[1] + 1 )->Tex[tex].y = v[1]->Tex[tex].y * f[1]; + + (v[2] + 1 )->Tex[tex].x = v[2]->Tex[tex].x * f[0]; + (v[2] + 1 )->Tex[tex].y = v[2]->Tex[tex].y * f[1]; +#endif +} + +// Vertex Cache +const SVSize CBurningVideoDriver::vSize[] = +{ + { VERTEX4D_FORMAT_TEXTURE_1 | VERTEX4D_FORMAT_COLOR_1, sizeof(S3DVertex), 1 }, + { VERTEX4D_FORMAT_TEXTURE_2 | VERTEX4D_FORMAT_COLOR_1, sizeof(S3DVertex2TCoords),2 }, + { VERTEX4D_FORMAT_TEXTURE_2 | VERTEX4D_FORMAT_COLOR_1, sizeof(S3DVertexTangents),2 } +}; + + + +/*! + fill a cache line with transformed, light and clipp test triangles +*/ +void CBurningVideoDriver::VertexCache_fill(const u32 sourceIndex, + const u32 destIndex) +{ + u8 * source; + s4DVertex *dest; + + source = (u8*) VertexCache.vertices + ( sourceIndex * vSize[VertexCache.vType].Pitch ); + + // it's a look ahead so we never hit it.. + // but give priority... + //VertexCache.info[ destIndex ].hit = hitCount; + + // store info + VertexCache.info[ destIndex ].index = sourceIndex; + VertexCache.info[ destIndex ].hit = 0; + + // destination Vertex + dest = (s4DVertex *) ( (u8*) VertexCache.mem.data + ( destIndex << ( SIZEOF_SVERTEX_LOG2 + 1 ) ) ); + + // transform Model * World * Camera * Projection * NDCSpace matrix + Transformation [ ETS_CURRENT].m.transformVect ( &dest->Pos.x, ((S3DVertex*) source )->Pos ); + +#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR + + // light Vertex + #ifdef SOFTWARE_DRIVER_2_LIGHTING + lightVertex ( dest, ((S3DVertex*) source ) ); + #else + dest->Color[0].setA8R8G8B8 ( ((S3DVertex*) source )->Color.color ); + #endif +#endif + + // transfer texture coordinates + if ( Transformation [ ETS_TEXTURE_0 ].isIdentity ) + { + // only look on first transform + irr::memcpy32_small ( &dest->Tex[0], + &((S3DVertex*) source )->TCoords, + vSize[VertexCache.vType].TexSize * ( sizeof ( f32 ) * 2 ) + ); + } + else + { + /* + Generate texture coordinates as linear functions so that: + u = Ux*x + Uy*y + Uz*z + Uw + v = Vx*x + Vy*y + Vz*z + Vw + The matrix M for this case is: + Ux Vx 0 0 + Uy Vy 0 0 + Uz Vz 0 0 + Uw Vw 0 0 + */ + + const core::vector2d *src = &((S3DVertex*) source )->TCoords; + u32 t; + + for ( t = 0; t != vSize[VertexCache.vType].TexSize; ++t ) + { + const core::matrix4& M = Transformation [ ETS_TEXTURE_0 + t ].m; + if ( Material.org.TextureLayer[t].TextureWrap==ETC_REPEAT ) + { + dest->Tex[t].x = M[0] * src[t].X + M[4] * src[t].Y + M[8]; + dest->Tex[t].y = M[1] * src[t].X + M[5] * src[t].Y + M[9]; + } + else + { + f32 tx1, ty1; + + tx1 = M[0] * src[t].X + M[4] * src[t].Y + M[8]; + ty1 = M[1] * src[t].X + M[5] * src[t].Y + M[9]; + + dest->Tex[t].x = tx1 <= 0.f ? 0.f : tx1 >= 1.f ? 1.f : tx1; + dest->Tex[t].y = ty1 <= 0.f ? 0.f : ty1 >= 1.f ? 1.f : ty1; + + //dest->Tex[t].x = core::clamp ( M[0] * src[t].X + M[4] * src[t].Y + M[8], 0.f, 1.f ); + //dest->Tex[t].y = core::clamp ( M[1] * src[t].X + M[5] * src[t].Y + M[9], 0.f, 1.f ); + } + } + + } + + dest[0].flag = dest[1].flag = vSize[VertexCache.vType].Format; + + // test vertex + dest[0].flag |= clipToFrustumTest ( dest); + + // to DC Space, project homogenous vertex + if ( (dest[0].flag & VERTEX4D_CLIPMASK ) == VERTEX4D_INSIDE ) + { + ndc_2_dc_and_project2 ( (const s4DVertex**) &dest, 1 ); + } + + //return dest; +} + +// + +REALINLINE s4DVertex * CBurningVideoDriver::VertexCache_getVertex ( const u32 sourceIndex ) +{ + for ( s32 i = 0; i < VERTEXCACHE_ELEMENT; ++i ) + { + if ( VertexCache.info[ i ].index == sourceIndex ) + { + return (s4DVertex *) ( (u8*) VertexCache.mem.data + ( i << ( SIZEOF_SVERTEX_LOG2 + 1 ) ) ); + } + } + return 0; +} + + +/* + Cache based on linear walk indices + fill blockwise on the next 16(Cache_Size) unique vertices in indexlist + merge the next 16 vertices with the current +*/ +REALINLINE void CBurningVideoDriver::VertexCache_get ( s4DVertex ** face ) +{ + SCacheInfo info[VERTEXCACHE_ELEMENT]; + + // next primitive must be complete in cache + if ( VertexCache.indicesIndex - VertexCache.indicesRun < 3 && + VertexCache.indicesIndex < VertexCache.indexCount + ) + { + // rewind to start of primitive + VertexCache.indicesIndex = VertexCache.indicesRun; + + irr::memset32 ( info, VERTEXCACHE_MISS, sizeof ( info ) ); + + // get the next unique vertices cache line + u32 fillIndex = 0; + u32 dIndex; + u32 i; + + while ( VertexCache.indicesIndex < VertexCache.indexCount && + fillIndex < VERTEXCACHE_ELEMENT + ) + { + u32 sourceIndex = VertexCache.indices [ VertexCache.indicesIndex++ ]; + + // if not exist, push back + s32 exist = 0; + for ( dIndex = 0; dIndex < fillIndex; ++dIndex ) + { + if ( info[ dIndex ].index == sourceIndex ) + { + exist = 1; + break; + } + } + + if ( 0 == exist ) + { + info[fillIndex++].index = sourceIndex; + } + } + + // clear marks + for ( i = 0; i!= VERTEXCACHE_ELEMENT; ++i ) + { + VertexCache.info[i].hit = 0; + } + + // mark all exisiting + for ( i = 0; i!= fillIndex; ++i ) + { + for ( dIndex = 0; dIndex < VERTEXCACHE_ELEMENT; ++dIndex ) + { + if ( VertexCache.info[ dIndex ].index == info[i].index ) + { + info[i].hit = dIndex; + VertexCache.info[ dIndex ].hit = 1; + break; + } + } + } + + // fill new + for ( i = 0; i!= fillIndex; ++i ) + { + if ( info[i].hit != VERTEXCACHE_MISS ) + continue; + + for ( dIndex = 0; dIndex < VERTEXCACHE_ELEMENT; ++dIndex ) + { + if ( 0 == VertexCache.info[dIndex].hit ) + { + VertexCache_fill ( info[i].index, dIndex ); + VertexCache.info[dIndex].hit += 1; + info[i].hit = dIndex; + break; + } + } + } + } + + const u32 i0 = core::if_c_a_else_0 ( VertexCache.pType != scene::EPT_TRIANGLE_FAN, VertexCache.indicesRun ); + + face[0] = VertexCache_getVertex ( VertexCache.indices[ i0 ] ); + face[1] = VertexCache_getVertex ( VertexCache.indices[ VertexCache.indicesRun + 1] ); + face[2] = VertexCache_getVertex ( VertexCache.indices[ VertexCache.indicesRun + 2] ); + + VertexCache.indicesRun += VertexCache.primitivePitch; +} + +REALINLINE void CBurningVideoDriver::VertexCache_get2 ( s4DVertex ** face ) +{ + const u32 i0 = core::if_c_a_else_0 ( VertexCache.pType != scene::EPT_TRIANGLE_FAN, VertexCache.indicesRun ); + + VertexCache_fill ( VertexCache.indices[ i0 ], 0 ); + VertexCache_fill ( VertexCache.indices[ VertexCache.indicesRun + 1], 1 ); + VertexCache_fill ( VertexCache.indices[ VertexCache.indicesRun + 2], 2 ); + + VertexCache.indicesRun += VertexCache.primitivePitch; + + face[0] = (s4DVertex *) ( (u8*) VertexCache.mem.data + ( 0 << ( SIZEOF_SVERTEX_LOG2 + 1 ) ) ); + face[1] = (s4DVertex *) ( (u8*) VertexCache.mem.data + ( 1 << ( SIZEOF_SVERTEX_LOG2 + 1 ) ) ); + face[2] = (s4DVertex *) ( (u8*) VertexCache.mem.data + ( 2 << ( SIZEOF_SVERTEX_LOG2 + 1 ) ) ); + +} + +void CBurningVideoDriver::VertexCache_reset ( const void* vertices, u32 vertexCount, + const u16* indices, u32 primitiveCount, + E_VERTEX_TYPE vType,scene::E_PRIMITIVE_TYPE pType ) +{ + VertexCache.vertices = vertices; + VertexCache.vertexCount = vertexCount; + + VertexCache.indices = indices; + VertexCache.indicesIndex = 0; + VertexCache.indicesRun = 0; + + VertexCache.vType = vType; + VertexCache.pType = pType; + + switch ( VertexCache.pType ) + { + case scene::EPT_TRIANGLES: + VertexCache.indexCount = primitiveCount + primitiveCount + primitiveCount; + VertexCache.primitivePitch = 3; + break; + case scene::EPT_TRIANGLE_FAN: + VertexCache.indexCount = primitiveCount + 2; + VertexCache.primitivePitch = 1; + break; + } + + irr::memset32 ( VertexCache.info, VERTEXCACHE_MISS, sizeof ( VertexCache.info ) ); + +} + + +void CBurningVideoDriver::drawVertexPrimitiveList(const void* vertices, u32 vertexCount, + const void* indexList, u32 primitiveCount, + E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType) + +{ + switch (iType) + { + case (EIT_16BIT): + { + drawVertexPrimitiveList16(vertices, vertexCount, (const u16*) indexList, primitiveCount, vType, pType); + break; + } + case (EIT_32BIT): + { + os::Printer::log("Software driver can not render 32bit buffers", ELL_ERROR); + break; + } + } + + +} + + + +//! draws a vertex primitive list +void CBurningVideoDriver::drawVertexPrimitiveList16(const void* vertices, u32 vertexCount, const u16* indexList, u32 primitiveCount, E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType) +{ + if (!checkPrimitiveCount(primitiveCount)) + return; + + CNullDriver::drawVertexPrimitiveList(vertices, vertexCount, indexList, primitiveCount, vType, pType, EIT_16BIT); + + if ( 0 == CurrentShader ) + return; + + + VertexCache_reset ( vertices, vertexCount, indexList, primitiveCount, vType, pType ); + + const s4DVertex * face[3]; + + f32 dc_area; + s32 lodLevel; + u32 i; + u32 g; + + for ( i = 0; i < (u32) primitiveCount; ++i ) + { + VertexCache_get ( (s4DVertex**) face ); + + // if fully outside or outside on same side + if ( ( (face[0]->flag | face[1]->flag | face[2]->flag) & VERTEX4D_CLIPMASK ) + != VERTEX4D_INSIDE + ) + continue; + + // if fully inside + if ( ( face[0]->flag & face[1]->flag & face[2]->flag & VERTEX4D_CLIPMASK ) == VERTEX4D_INSIDE ) + { + dc_area = screenarea2 ( face ); + if ( Material.org.BackfaceCulling && F32_LOWER_EQUAL_0( dc_area ) ) + continue; + if ( Material.org.FrontfaceCulling && F32_GREATER_EQUAL_0( dc_area ) ) + continue; + + dc_area = core::reciprocal ( dc_area ); + + // select mipmap + + for ( g = 0; g != vSize[VertexCache.vType].TexSize; ++g ) + //for ( g = 0; g != BURNING_MATERIAL_MAX_TEXTURES; ++g ) + { + if ( 0 == MAT_TEXTURE ( g ) ) + { + CurrentShader->setTextureParam(g, 0, 0); + continue; + } + + lodLevel = s32_log2_f32 ( texelarea2 ( face, g ) * dc_area ); + CurrentShader->setTextureParam(g, MAT_TEXTURE ( g ), lodLevel); + select_polygon_mipmap2 ( (s4DVertex**) face, g ); + + } + + // rasterize + CurrentShader->drawTriangle ( face[0] + 1, face[1] + 1, face[2] + 1 ); + continue; + } + + // else if not complete inside clipping necessary + irr::memcpy32_small ( ( (u8*) CurrentOut.data + ( 0 << ( SIZEOF_SVERTEX_LOG2 + 1 ) ) ), face[0], SIZEOF_SVERTEX * 2 ); + irr::memcpy32_small ( ( (u8*) CurrentOut.data + ( 1 << ( SIZEOF_SVERTEX_LOG2 + 1 ) ) ), face[1], SIZEOF_SVERTEX * 2 ); + irr::memcpy32_small ( ( (u8*) CurrentOut.data + ( 2 << ( SIZEOF_SVERTEX_LOG2 + 1 ) ) ), face[2], SIZEOF_SVERTEX * 2 ); + + const u32 flag = CurrentOut.data->flag & VERTEX4D_FORMAT_MASK; + + for ( g = 0; g != CurrentOut.ElementSize; ++g ) + { + CurrentOut.data[g].flag = flag; + Temp.data[g].flag = flag; + } + + u32 vOut; + vOut = clipToFrustum ( CurrentOut.data, Temp.data, 3 ); +/* + if ( vOut < 3 ) + { + char buf[256]; + struct SCheck + { + u32 flag; + const char * name; + }; + + SCheck check[5]; + check[0].flag = face[0]->flag; + check[0].name = "face0"; + check[1].flag = face[1]->flag; + check[1].name = "face1"; + check[2].flag = face[2]->flag; + check[2].name = "face2"; + check[3].flag = (face[0]->flag & face[1]->flag & face[2]->flag); + check[3].name = "AND "; + check[4].flag = (face[0]->flag | face[1]->flag | face[2]->flag); + check[4].name = "OR "; + + for ( s32 h = 0; h!= 5; ++h ) + { + sprintf ( buf, "%s: %d %d %d %d %d %d", + check[h].name, + ( check[h].flag & 1 ), + ( check[h].flag & 2 ) >> 1, + ( check[h].flag & 4 ) >> 2, + ( check[h].flag & 8 ) >> 3, + ( check[h].flag & 16 ) >> 4, + ( check[h].flag & 32 ) >> 5 + ); + os::Printer::print ( buf ); + } + + sprintf ( buf, "Vout: %d\n", vOut ); + os::Printer::print ( buf ); + + int hold = 1; + } +*/ + if ( vOut < 3 ) + continue; + + vOut <<= 1; + + // to DC Space, project homogenous vertex + ndc_2_dc_and_project ( CurrentOut.data + 1, CurrentOut.data, vOut ); + +/* + // TODO: don't stick on 32 Bit Pointer + #define PointerAsValue(x) ( (u32) (u32*) (x) ) + + // if not complete inside clipping necessary + if ( ( test & VERTEX4D_INSIDE ) != VERTEX4D_INSIDE ) + { + u32 v[2] = { PointerAsValue ( Temp ) , PointerAsValue ( CurrentOut ) }; + for ( g = 0; g != 6; ++g ) + { + vOut = clipToHyperPlane ( (s4DVertex*) v[0], (s4DVertex*) v[1], vOut, NDCPlane[g] ); + if ( vOut < 3 ) + break; + + v[0] ^= v[1]; + v[1] ^= v[0]; + v[0] ^= v[1]; + } + + if ( vOut < 3 ) + continue; + + } +*/ + + // check 2d backface culling on first + dc_area = screenarea ( CurrentOut.data ); + if ( Material.org.BackfaceCulling && F32_LOWER_EQUAL_0 ( dc_area ) ) + continue; + if ( Material.org.FrontfaceCulling && F32_GREATER_EQUAL_0( dc_area ) ) + continue; + + // select mipmap + //for ( g = 0; g != BURNING_MATERIAL_MAX_TEXTURES; ++g ) + for ( g = 0; g != vSize[VertexCache.vType].TexSize; ++g ) + { + if ( 0 == MAT_TEXTURE ( g ) ) + { + CurrentShader->setTextureParam(g, 0, 0); + continue; + } + + lodLevel = s32_log2_f32 ( texelarea ( CurrentOut.data, g ) / dc_area ); + + CurrentShader->setTextureParam(g, MAT_TEXTURE ( g ), lodLevel); + select_polygon_mipmap ( CurrentOut.data, vOut, g ); + } + + // re-tesselate ( triangle-fan, 0-1-2,0-2-3.. ) + for ( g = 0; g <= vOut - 6; g += 2 ) + { + // rasterize + CurrentShader->drawTriangle ( CurrentOut.data + 0 + 1, + CurrentOut.data + g + 3, + CurrentOut.data + g + 5); + } + + } + + // dump statistics +/* + char buf [64]; + sprintf ( buf,"VCount:%d PCount:%d CacheMiss: %d", + vertexCount, primitiveCount, + VertexCache.CacheMiss + ); + os::Printer::print ( buf ); +*/ +} + +//! Sets the dynamic ambient light color. The default color is +//! (0,0,0,0) which means it is dark. +//! \param color: New color of the ambient light. +void CBurningVideoDriver::setAmbientLight(const SColorf& color) +{ + LightSpace.Global_AmbientLight.setColorf ( color ); +} + + +//! adds a dynamic light +void CBurningVideoDriver::addDynamicLight(const SLight& dl) +{ + if ( LightSpace.Light.size () >= getMaximalDynamicLightAmount () ) + return; + + SBurningShaderLight l; + l.org = dl; + + // light in eye space + Transformation[ETS_VIEW].m.transformVect ( &l.posEyeSpace.x, l.org.Position ); + + l.constantAttenuation = l.org.Attenuation.X; + l.linearAttenuation = l.org.Attenuation.Y; + l.quadraticAttenuation = l.org.Attenuation.Z; + + l.AmbientColor.setColorf ( l.org.AmbientColor ); + l.DiffuseColor.setColorf ( l.org.DiffuseColor ); + l.SpecularColor.setColorf ( l.org.SpecularColor ); + + switch ( dl.Type ) + { + case video::ELT_DIRECTIONAL: + { + l.posEyeSpace.normalize_xyz (); + } break; + } + + LightSpace.Light.push_back ( l ); + CNullDriver::addDynamicLight( l.org ); +} + +//! deletes all dynamic lights there are +void CBurningVideoDriver::deleteAllDynamicLights() +{ + LightSpace.Light.set_used ( 0 ); + CNullDriver::deleteAllDynamicLights(); + +} + +//! returns the maximal amount of dynamic lights the device can handle +u32 CBurningVideoDriver::getMaximalDynamicLightAmount() const +{ + return 8; +} + + + +#ifdef SOFTWARE_DRIVER_2_LIGHTING + +/*! +*/ +void CBurningVideoDriver::lightVertex ( s4DVertex *dest, const S3DVertex *source ) +{ + // apply lighting model + if ( false == Material.org.Lighting ) + { + // should use the DiffuseColor but using pre-lit vertex color + dest->Color[0].setA8R8G8B8 ( source->Color.color ); + return; + } + + if ( Lights.size () == 0 ) + { + dest->Color[0] = Material.EmissiveColor; + return; + } + + // eyespace +/* + core::matrix4 modelview = Transformation[ETS_WORLD].m * Transformation[ETS_VIEW].m; + + core::matrix4 m2 ( modelview ); + m2.makeInverse (); + core::matrix4 modelviewinversetransposed ( m2.getTransposed() ); +*/ + + sVec4 vertexEyeSpace; + sVec4 normalEyeSpace; + sVec4 vertexEyeSpaceUnit; + + // vertex in eye space + Transformation[ETS_WORLD_VIEW].m.transformVect ( &vertexEyeSpace.x, source->Pos ); + vertexEyeSpace.project_xyz (); + + vertexEyeSpaceUnit = vertexEyeSpace; + vertexEyeSpaceUnit.normalize_xyz(); + + // vertex normal in eye-space + //modelviewinversetransposed.transformVect ( &normalEyeSpace.x, source->Normal ); + Transformation[ETS_WORLD_VIEW_INVERSE_TRANSPOSED].m.rotateVect ( &normalEyeSpace.x, source->Normal ); + if ( Material.org.NormalizeNormals ) + { + normalEyeSpace.normalize_xyz(); + } + + + sVec4 ambient; + sVec4 diffuse; + sVec4 specular; + + + // the universe started in darkness.. + ambient.set ( 0.f, 0.f, 0.f, 0.f ); + diffuse.set ( 0.f, 0.f, 0.f, 0.f ); + specular.set ( 0.f, 0.f, 0.f, 0.f ); + + f32 attenuation = 1.f; + + u32 i; + for ( i = 0; i!= LightSpace.Light.size (); ++i ) + { + const SBurningShaderLight &light = LightSpace.Light[i]; + + sVec4 vp; // unit vector vertex to light + sVec4 lightHalf; // blinn-phong reflection + + + switch ( light.org.Type ) + { + case video::ELT_POINT: + { + // surface to light + vp.x = light.posEyeSpace.x - vertexEyeSpace.x; + vp.y = light.posEyeSpace.y - vertexEyeSpace.y; + vp.z = light.posEyeSpace.z - vertexEyeSpace.z; + + // irrlicht attenuation model +#if 0 + const f32 d = vp.get_inverse_length_xyz(); + + vp.x *= d; + vp.y *= d; + vp.z *= d; + attenuation = light.org.Radius * d; + +#else + const f32 d = vp.get_length_xyz(); + attenuation = core::reciprocal (light.constantAttenuation + + light.linearAttenuation * d + + light.quadraticAttenuation * d * d + ); + + // normalize surface to light + vp.normalize_xyz(); +#endif + + lightHalf.x = vp.x - vertexEyeSpaceUnit.x; + lightHalf.y = vp.y - vertexEyeSpaceUnit.y; + lightHalf.z = vp.z - vertexEyeSpaceUnit.z; + lightHalf.normalize_xyz(); + + } break; + + case video::ELT_DIRECTIONAL: + { + attenuation = 1.f; + vp = light.posEyeSpace; + + // half angle = lightvector + eye vector ( 0, 0, 1 ) + lightHalf.x = vp.x; + lightHalf.y = vp.y; + lightHalf.z = vp.z - 1.f; + lightHalf.normalize_xyz(); + } break; + } + + // build diffuse reflection + + //angle between normal and light vector + f32 dotVP = core::max_ ( 0.f, normalEyeSpace.dot_xyz ( vp ) ); + f32 dotHV = core::max_ ( 0.f, normalEyeSpace.dot_xyz ( lightHalf ) ); + + f32 pf; + if ( dotVP == 0.0 ) + { + pf = 0.f; + } + else + { + pf = (f32)pow(dotHV, Material.org.Shininess ); + } + + // accumulate ambient + ambient += light.AmbientColor * attenuation; + diffuse += light.DiffuseColor * ( dotVP * attenuation ); + specular += light.SpecularColor * ( pf * attenuation ); + + } + + sVec4 dColor; + + dColor = LightSpace.Global_AmbientLight; + dColor += Material.EmissiveColor; + dColor += ambient * Material.AmbientColor; + dColor += diffuse * Material.DiffuseColor; + dColor += specular * Material.SpecularColor; + dColor.saturate(); + + dest->Color[0] = dColor; +} + +#endif + + +//! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted. +void CBurningVideoDriver::draw2DImage(const video::ITexture* texture, const core::position2d& destPos, + const core::rect& sourceRect, + const core::rect* clipRect, SColor color, + bool useAlphaChannelOfTexture) +{ + if (texture) + { + if (texture->getDriverType() != EDT_BURNINGSVIDEO) + { + os::Printer::log("Fatal Error: Tried to copy from a surface not owned by this driver.", ELL_ERROR); + return; + } + + if (useAlphaChannelOfTexture) + ((CSoftwareTexture2*)texture)->getImage()->copyToWithAlpha( + BackBuffer, destPos, sourceRect, color, clipRect); + else + ((CSoftwareTexture2*)texture)->getImage()->copyTo( + BackBuffer, destPos, sourceRect, clipRect); + } +} + + + +//! Draws a 2d line. +void CBurningVideoDriver::draw2DLine(const core::position2d& start, + const core::position2d& end, + SColor color) +{ + ((CImage*)BackBuffer)->drawLine(start, end, color ); +} + +//! Draws a pixel +void CBurningVideoDriver::drawPixel(u32 x, u32 y, const SColor & color) +{ + ((CImage*)BackBuffer)->setPixel(x, y, color); +} + +//! draw an 2d rectangle +void CBurningVideoDriver::draw2DRectangle(SColor color, const core::rect& pos, + const core::rect* clip) +{ + if (clip) + { + core::rect p(pos); + + p.clipAgainst(*clip); + + if(!p.isValid()) + return; + + BackBuffer->drawRectangle(p, color); + } + else + { + if(!pos.isValid()) + return; + + BackBuffer->drawRectangle(pos, color); + } +} + + +//! Only used by the internal engine. Used to notify the driver that +//! the window was resized. +void CBurningVideoDriver::OnResize(const core::dimension2d& size) +{ + // make sure width and height are multiples of 2 + core::dimension2d realSize(size); + + if (realSize.Width % 2) + realSize.Width += 1; + + if (realSize.Height % 2) + realSize.Height += 1; + + if (ScreenSize != realSize) + { + if (ViewPort.getWidth() == ScreenSize.Width && + ViewPort.getHeight() == ScreenSize.Height) + { + ViewPort = core::rect(core::position2d(0,0), realSize); + } + + ScreenSize = realSize; + + bool resetRT = (RenderTargetSurface == BackBuffer); + + if (BackBuffer) + BackBuffer->drop(); + BackBuffer = new CImage(BURNINGSHADER_COLOR_FORMAT, realSize); + + if (resetRT) + setRenderTarget(BackBuffer); + } +} + + +//! returns the current render target size +const core::dimension2d& CBurningVideoDriver::getCurrentRenderTargetSize() const +{ + return RenderTargetSize; +} + + +//!Draws an 2d rectangle with a gradient. +void CBurningVideoDriver::draw2DRectangle(const core::rect& position, + SColor colorLeftUp, SColor colorRightUp, SColor colorLeftDown, SColor colorRightDown, + const core::rect* clip) +{ +#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR + + core::rect pos = position; + + if (clip) + pos.clipAgainst(*clip); + + if (!pos.isValid()) + return; + + const core::dimension2d renderTargetSize ( ViewPort.getSize() ); + + const s32 xPlus = -(renderTargetSize.Width>>1); + const f32 xFact = 1.0f / (renderTargetSize.Width>>1); + + const s32 yPlus = renderTargetSize.Height-(renderTargetSize.Height>>1); + const f32 yFact = 1.0f / (renderTargetSize.Height>>1); + + // fill VertexCache direct + s4DVertex *v; + + VertexCache.vertexCount = 4; + + VertexCache.info[0].index = 0; + VertexCache.info[1].index = 1; + VertexCache.info[2].index = 2; + VertexCache.info[3].index = 3; + + v = &VertexCache.mem.data [ 0 ]; + + v[0].Pos.set ( (f32)(pos.UpperLeftCorner.X+xPlus) * xFact, (f32)(yPlus-pos.UpperLeftCorner.Y) * yFact, 0.f, 1.f ); + v[0].Color[0].setA8R8G8B8 ( colorLeftUp.color ); + + v[2].Pos.set ( (f32)(pos.LowerRightCorner.X+xPlus) * xFact, (f32)(yPlus- pos.UpperLeftCorner.Y) * yFact, 0.f, 1.f ); + v[2].Color[0].setA8R8G8B8 ( colorRightUp.color ); + + v[4].Pos.set ( (f32)(pos.LowerRightCorner.X+xPlus) * xFact, (f32)(yPlus-pos.LowerRightCorner.Y) * yFact, 0.f ,1.f ); + v[4].Color[0].setA8R8G8B8 ( colorRightDown.color ); + + v[6].Pos.set ( (f32)(pos.UpperLeftCorner.X+xPlus) * xFact, (f32)(yPlus-pos.LowerRightCorner.Y) * yFact, 0.f, 1.f ); + v[6].Color[0].setA8R8G8B8 ( colorLeftDown.color ); + + s32 i; + u32 g; + + for ( i = 0; i!= 8; i += 2 ) + { + v[i + 0].flag = clipToFrustumTest ( v + i ); + v[i + 1].flag = 0; + if ( (v[i].flag & VERTEX4D_INSIDE ) == VERTEX4D_INSIDE ) + { + ndc_2_dc_and_project ( v + i + 1, v + i, 2 ); + } + } + + + IBurningShader * render; + + render = BurningShader [ ETR_GOURAUD_ALPHA_NOZ ]; + render->setRenderTarget(RenderTargetSurface, ViewPort); + + static const s16 indexList[6] = {0,1,2,0,2,3}; + + s4DVertex * face[3]; + + for ( i = 0; i!= 6; i += 3 ) + { + face[0] = VertexCache_getVertex ( indexList [ i + 0 ] ); + face[1] = VertexCache_getVertex ( indexList [ i + 1 ] ); + face[2] = VertexCache_getVertex ( indexList [ i + 2 ] ); + + // test clipping + u32 test = face[0]->flag & face[1]->flag & face[2]->flag & VERTEX4D_INSIDE; + + if ( test == VERTEX4D_INSIDE ) + { + render->drawTriangle ( face[0] + 1, face[1] + 1, face[2] + 1 ); + continue; + } + // Todo: all vertices are clipped in 2d.. + // is this true ? + u32 vOut = 6; + memcpy ( CurrentOut.data + 0, face[0], sizeof ( s4DVertex ) * 2 ); + memcpy ( CurrentOut.data + 2, face[1], sizeof ( s4DVertex ) * 2 ); + memcpy ( CurrentOut.data + 4, face[2], sizeof ( s4DVertex ) * 2 ); + + vOut = clipToFrustum ( CurrentOut.data, Temp.data, 3 ); + if ( vOut < 3 ) + continue; + + vOut <<= 1; + // to DC Space, project homogenous vertex + ndc_2_dc_and_project ( CurrentOut.data + 1, CurrentOut.data, vOut ); + + // re-tesselate ( triangle-fan, 0-1-2,0-2-3.. ) + for ( g = 0; g <= vOut - 6; g += 2 ) + { + // rasterize + render->drawTriangle ( CurrentOut.data + 1, &CurrentOut.data[g + 3], &CurrentOut.data[g + 5] ); + } + + } +#else + draw2DRectangle ( colorLeftUp, position, clip ); +#endif +} + + +//! Draws a 3d line. +void CBurningVideoDriver::draw3DLine(const core::vector3df& start, + const core::vector3df& end, SColor color) +{ + Transformation [ ETS_CURRENT].m.transformVect ( &CurrentOut.data[0].Pos.x, start ); + Transformation [ ETS_CURRENT].m.transformVect ( &CurrentOut.data[2].Pos.x, end ); + + u32 g; + u32 vOut; + + // no clipping flags + for ( g = 0; g != CurrentOut.ElementSize; ++g ) + { + CurrentOut.data[g].flag = 0; + Temp.data[g].flag = 0; + } + + // vertices count per line + vOut = clipToFrustum ( CurrentOut.data, Temp.data, 2 ); + if ( vOut < 2 ) + return; + + vOut <<= 1; + + IBurningShader * line; + line = BurningShader [ ETR_TEXTURE_GOURAUD_WIRE ]; + line->setRenderTarget(RenderTargetSurface, ViewPort); + + // to DC Space, project homogenous vertex + ndc_2_dc_and_project ( CurrentOut.data + 1, CurrentOut.data, vOut ); + + // unproject vertex color +#ifdef SOFTWARE_DRIVER_2_USE_VERTEX_COLOR + for ( g = 0; g != vOut; g+= 2 ) + { + CurrentOut.data[ g + 1].Color[0].setA8R8G8B8 ( color.color ); + } +#endif + + + for ( g = 0; g <= vOut - 4; g += 2 ) + { + // rasterize + line->drawLine ( CurrentOut.data + 1, CurrentOut.data + g + 3 ); + } +} + + +//! \return Returns the name of the video driver. Example: In case of the DirectX8 +//! driver, it would return "Direct3D8.1". +const wchar_t* CBurningVideoDriver::getName() const +{ +#ifdef BURNINGVIDEO_RENDERER_BEAUTIFUL + return L"burnings video 0.39b"; +#elif defined ( BURNINGVIDEO_RENDERER_ULTRA_FAST ) + return L"burnings video 0.39uf"; +#elif defined ( BURNINGVIDEO_RENDERER_FAST ) + return L"burnings video 0.39f"; +#else + return L"burnings video 0.39"; +#endif +} + + +//! Returns type of video driver +E_DRIVER_TYPE CBurningVideoDriver::getDriverType() const +{ + return EDT_BURNINGSVIDEO; +} + + +//! returns color format +ECOLOR_FORMAT CBurningVideoDriver::getColorFormat() const +{ + return BURNINGSHADER_COLOR_FORMAT; +} + + +//! Returns the transformation set by setTransform +const core::matrix4& CBurningVideoDriver::getTransform(E_TRANSFORMATION_STATE state) const +{ + return Transformation[state].m; +} + + +//! Creates a render target texture. +ITexture* CBurningVideoDriver::addRenderTargetTexture(const core::dimension2d& size, + const c8* name) +{ + CImage* img = new CImage(BURNINGSHADER_COLOR_FORMAT, size); + if (!name) + name="rt"; + ITexture* tex = new CSoftwareTexture2(img, name, false, true); + img->drop(); + addTexture(tex); + tex->drop(); + return tex; +} + + +//! Clears the DepthBuffer. +void CBurningVideoDriver::clearZBuffer() +{ + if (DepthBuffer) + DepthBuffer->clear(); +} + + +//! Returns an image created from the last rendered frame. +IImage* CBurningVideoDriver::createScreenShot() +{ + if (BackBuffer) + return new CImage(BackBuffer->getColorFormat(), BackBuffer); + else + return 0; +} + + +//! returns a device dependent texture from a software surface (IImage) +//! THIS METHOD HAS TO BE OVERRIDDEN BY DERIVED DRIVERS WITH OWN TEXTURES +ITexture* CBurningVideoDriver::createDeviceDependentTexture(IImage* surface, const char* name) +{ + return new CSoftwareTexture2(surface, name, getTextureCreationFlag(ETCF_CREATE_MIP_MAPS)); + +} + + +//! Returns the maximum amount of primitives (mostly vertices) which +//! the device is able to render with one drawIndexedTriangleList +//! call. +u32 CBurningVideoDriver::getMaximalPrimitiveCount() const +{ + return 0x00800000; +} + + +//! Draws a shadow volume into the stencil buffer. To draw a stencil shadow, do +//! this: First, draw all geometry. Then use this method, to draw the shadow +//! volume. Then, use IVideoDriver::drawStencilShadow() to visualize the shadow. +void CBurningVideoDriver::drawStencilShadowVolume(const core::vector3df* triangles, s32 count, bool zfail) +{ +/* + if (!StencilBuffer || !count) + return; + + setRenderStatesStencilShadowMode(zfail); + + if (!zfail) + { + // ZPASS Method + + // Draw front-side of shadow volume in stencil/z only + pID3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW ); + pID3DDevice->SetRenderState(D3DRS_STENCILPASS, D3DSTENCILOP_INCRSAT); + pID3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLELIST, count / 3, triangles, sizeof(core::vector3df)); + + // Now reverse cull order so front sides of shadow volume are written. + pID3DDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CW ); + pID3DDevice->SetRenderState( D3DRS_STENCILPASS, D3DSTENCILOP_DECRSAT); + pID3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLELIST, count / 3, triangles, sizeof(core::vector3df)); + } + else + { + // ZFAIL Method + + // Draw front-side of shadow volume in stencil/z only + pID3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW ); + pID3DDevice->SetRenderState(D3DRS_STENCILZFAIL, D3DSTENCILOP_INCRSAT ); + pID3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLELIST, count / 3, triangles, sizeof(core::vector3df)); + + // Now reverse cull order so front sides of shadow volume are written. + pID3DDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW ); + pID3DDevice->SetRenderState( D3DRS_STENCILZFAIL, D3DSTENCILOP_DECRSAT ); + pID3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLELIST, count / 3, triangles, sizeof(core::vector3df)); + } +*/ +} + + + +//! Fills the stencil shadow with color. After the shadow volume has been drawn +//! into the stencil buffer using IVideoDriver::drawStencilShadowVolume(), use this +//! to draw the color of the shadow. +void CBurningVideoDriver::drawStencilShadow(bool clearStencilBuffer, video::SColor leftUpEdge, + video::SColor rightUpEdge, video::SColor leftDownEdge, video::SColor rightDownEdge) +{ +/* + if (!StencilBuffer) + return; + + S3DVertex vtx[4]; + vtx[0] = S3DVertex(1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, leftUpEdge, 0.0f, 0.0f); + vtx[1] = S3DVertex(1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, rightUpEdge, 0.0f, 1.0f); + vtx[2] = S3DVertex(-1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, leftDownEdge, 1.0f, 0.0f); + vtx[3] = S3DVertex(-1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, rightDownEdge, 1.0f, 1.0f); + + s16 indices[6] = {0,1,2,1,3,2}; + + setRenderStatesStencilFillMode( + leftUpEdge.getAlpha() < 255 || + rightUpEdge.getAlpha() < 255 || + leftDownEdge.getAlpha() < 255 || + rightDownEdge.getAlpha() < 255); + + setTexture(0,0); + + setVertexShader(EVT_STANDARD); + + pID3DDevice->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST, 0, 4, 2, &indices[0], + D3DFMT_INDEX16, &vtx[0], sizeof(S3DVertex)); + + if (clearStencilBuffer) + pID3DDevice->Clear( 0, NULL, D3DCLEAR_STENCIL,0, 1.0, 0); +*/ +} + + +} // end namespace video +} // end namespace irr + +#endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_ + +namespace irr +{ +namespace video +{ + +//! creates a video driver +IVideoDriver* createSoftwareDriver2(const core::dimension2d& windowSize, bool fullscreen, io::IFileSystem* io, video::IImagePresenter* presenter) +{ + #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_ + return new CBurningVideoDriver(windowSize, fullscreen, io, presenter); + #else + return 0; + #endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_ +} + + + +} // end namespace video +} // end namespace irr diff --git a/src/dep/src/irrlicht/CSoftwareDriver2.h b/src/dep/src/irrlicht/CSoftwareDriver2.h index 8a1e85d..3647111 100644 --- a/src/dep/src/irrlicht/CSoftwareDriver2.h +++ b/src/dep/src/irrlicht/CSoftwareDriver2.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSoftwareTexture.cpp b/src/dep/src/irrlicht/CSoftwareTexture.cpp index f933c0a..5418100 100644 --- a/src/dep/src/irrlicht/CSoftwareTexture.cpp +++ b/src/dep/src/irrlicht/CSoftwareTexture.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSoftwareTexture.h b/src/dep/src/irrlicht/CSoftwareTexture.h index b6dcbdc..acd13c6 100644 --- a/src/dep/src/irrlicht/CSoftwareTexture.h +++ b/src/dep/src/irrlicht/CSoftwareTexture.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSoftwareTexture2.cpp b/src/dep/src/irrlicht/CSoftwareTexture2.cpp index 4f4fe43..67895e1 100644 --- a/src/dep/src/irrlicht/CSoftwareTexture2.cpp +++ b/src/dep/src/irrlicht/CSoftwareTexture2.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSoftwareTexture2.h b/src/dep/src/irrlicht/CSoftwareTexture2.h index 751722b..3ef61aa 100644 --- a/src/dep/src/irrlicht/CSoftwareTexture2.h +++ b/src/dep/src/irrlicht/CSoftwareTexture2.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSphereSceneNode.cpp b/src/dep/src/irrlicht/CSphereSceneNode.cpp index a596e52..a37083b 100644 --- a/src/dep/src/irrlicht/CSphereSceneNode.cpp +++ b/src/dep/src/irrlicht/CSphereSceneNode.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CSphereSceneNode.h b/src/dep/src/irrlicht/CSphereSceneNode.h index 1583ac3..5b8e9da 100644 --- a/src/dep/src/irrlicht/CSphereSceneNode.h +++ b/src/dep/src/irrlicht/CSphereSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRFlat.cpp b/src/dep/src/irrlicht/CTRFlat.cpp index f9ac119..800d966 100644 --- a/src/dep/src/irrlicht/CTRFlat.cpp +++ b/src/dep/src/irrlicht/CTRFlat.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRFlatWire.cpp b/src/dep/src/irrlicht/CTRFlatWire.cpp index 7113360..4ea0b25 100644 --- a/src/dep/src/irrlicht/CTRFlatWire.cpp +++ b/src/dep/src/irrlicht/CTRFlatWire.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRGouraud.cpp b/src/dep/src/irrlicht/CTRGouraud.cpp index 5ffb723..508b421 100644 --- a/src/dep/src/irrlicht/CTRGouraud.cpp +++ b/src/dep/src/irrlicht/CTRGouraud.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRGouraud2.cpp b/src/dep/src/irrlicht/CTRGouraud2.cpp index ecd086e..93e1b59 100644 --- a/src/dep/src/irrlicht/CTRGouraud2.cpp +++ b/src/dep/src/irrlicht/CTRGouraud2.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRGouraudAlpha2.cpp b/src/dep/src/irrlicht/CTRGouraudAlpha2.cpp index 465f77f..9c42eff 100644 --- a/src/dep/src/irrlicht/CTRGouraudAlpha2.cpp +++ b/src/dep/src/irrlicht/CTRGouraudAlpha2.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRGouraudAlphaNoZ2.cpp b/src/dep/src/irrlicht/CTRGouraudAlphaNoZ2.cpp index cfa31a3..7ab18fd 100644 --- a/src/dep/src/irrlicht/CTRGouraudAlphaNoZ2.cpp +++ b/src/dep/src/irrlicht/CTRGouraudAlphaNoZ2.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRGouraudWire.cpp b/src/dep/src/irrlicht/CTRGouraudWire.cpp index c301a4c..a6822d0 100644 --- a/src/dep/src/irrlicht/CTRGouraudWire.cpp +++ b/src/dep/src/irrlicht/CTRGouraudWire.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRTextureBlend.cpp b/src/dep/src/irrlicht/CTRTextureBlend.cpp index a09a671..53b48ce 100644 --- a/src/dep/src/irrlicht/CTRTextureBlend.cpp +++ b/src/dep/src/irrlicht/CTRTextureBlend.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRTextureDetailMap2.cpp b/src/dep/src/irrlicht/CTRTextureDetailMap2.cpp index 122a139..97f7dac 100644 --- a/src/dep/src/irrlicht/CTRTextureDetailMap2.cpp +++ b/src/dep/src/irrlicht/CTRTextureDetailMap2.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRTextureFlat.cpp b/src/dep/src/irrlicht/CTRTextureFlat.cpp index 67c3b7a..f93216a 100644 --- a/src/dep/src/irrlicht/CTRTextureFlat.cpp +++ b/src/dep/src/irrlicht/CTRTextureFlat.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRTextureFlatWire.cpp b/src/dep/src/irrlicht/CTRTextureFlatWire.cpp index d1d4694..d7b20ec 100644 --- a/src/dep/src/irrlicht/CTRTextureFlatWire.cpp +++ b/src/dep/src/irrlicht/CTRTextureFlatWire.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRTextureGouraud.cpp b/src/dep/src/irrlicht/CTRTextureGouraud.cpp index bd8225d..24e7636 100644 --- a/src/dep/src/irrlicht/CTRTextureGouraud.cpp +++ b/src/dep/src/irrlicht/CTRTextureGouraud.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRTextureGouraud.h b/src/dep/src/irrlicht/CTRTextureGouraud.h index 443f16c..715dc6a 100644 --- a/src/dep/src/irrlicht/CTRTextureGouraud.h +++ b/src/dep/src/irrlicht/CTRTextureGouraud.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRTextureGouraud2.cpp b/src/dep/src/irrlicht/CTRTextureGouraud2.cpp index f428867..e9d6765 100644 --- a/src/dep/src/irrlicht/CTRTextureGouraud2.cpp +++ b/src/dep/src/irrlicht/CTRTextureGouraud2.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRTextureGouraudAdd.cpp b/src/dep/src/irrlicht/CTRTextureGouraudAdd.cpp index 6b373af..2e845c5 100644 --- a/src/dep/src/irrlicht/CTRTextureGouraudAdd.cpp +++ b/src/dep/src/irrlicht/CTRTextureGouraudAdd.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRTextureGouraudAdd2.cpp b/src/dep/src/irrlicht/CTRTextureGouraudAdd2.cpp index 46363de..78b72b0 100644 --- a/src/dep/src/irrlicht/CTRTextureGouraudAdd2.cpp +++ b/src/dep/src/irrlicht/CTRTextureGouraudAdd2.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRTextureGouraudAddNoZ2.cpp b/src/dep/src/irrlicht/CTRTextureGouraudAddNoZ2.cpp index 0798f44..3bd1516 100644 --- a/src/dep/src/irrlicht/CTRTextureGouraudAddNoZ2.cpp +++ b/src/dep/src/irrlicht/CTRTextureGouraudAddNoZ2.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRTextureGouraudAlpha.cpp b/src/dep/src/irrlicht/CTRTextureGouraudAlpha.cpp index 617f4d6..240be1e 100644 --- a/src/dep/src/irrlicht/CTRTextureGouraudAlpha.cpp +++ b/src/dep/src/irrlicht/CTRTextureGouraudAlpha.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRTextureGouraudAlphaNoZ.cpp b/src/dep/src/irrlicht/CTRTextureGouraudAlphaNoZ.cpp index 590aeb7..de71bf6 100644 --- a/src/dep/src/irrlicht/CTRTextureGouraudAlphaNoZ.cpp +++ b/src/dep/src/irrlicht/CTRTextureGouraudAlphaNoZ.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRTextureGouraudNoZ.cpp b/src/dep/src/irrlicht/CTRTextureGouraudNoZ.cpp index 9f105ce..fa052f9 100644 --- a/src/dep/src/irrlicht/CTRTextureGouraudNoZ.cpp +++ b/src/dep/src/irrlicht/CTRTextureGouraudNoZ.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRTextureGouraudNoZ2.cpp b/src/dep/src/irrlicht/CTRTextureGouraudNoZ2.cpp index 18a7db0..622e83c 100644 --- a/src/dep/src/irrlicht/CTRTextureGouraudNoZ2.cpp +++ b/src/dep/src/irrlicht/CTRTextureGouraudNoZ2.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRTextureGouraudVertexAlpha2.cpp b/src/dep/src/irrlicht/CTRTextureGouraudVertexAlpha2.cpp index e03c4e0..85ea2ee 100644 --- a/src/dep/src/irrlicht/CTRTextureGouraudVertexAlpha2.cpp +++ b/src/dep/src/irrlicht/CTRTextureGouraudVertexAlpha2.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRTextureGouraudWire.cpp b/src/dep/src/irrlicht/CTRTextureGouraudWire.cpp index 0cbf20e..75cdbd3 100644 --- a/src/dep/src/irrlicht/CTRTextureGouraudWire.cpp +++ b/src/dep/src/irrlicht/CTRTextureGouraudWire.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRTextureLightMap2_Add.cpp b/src/dep/src/irrlicht/CTRTextureLightMap2_Add.cpp index 9441092..88dea23 100644 --- a/src/dep/src/irrlicht/CTRTextureLightMap2_Add.cpp +++ b/src/dep/src/irrlicht/CTRTextureLightMap2_Add.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRTextureLightMap2_M1.cpp b/src/dep/src/irrlicht/CTRTextureLightMap2_M1.cpp index dd197ca..d1cf9ed 100644 --- a/src/dep/src/irrlicht/CTRTextureLightMap2_M1.cpp +++ b/src/dep/src/irrlicht/CTRTextureLightMap2_M1.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRTextureLightMap2_M2.cpp b/src/dep/src/irrlicht/CTRTextureLightMap2_M2.cpp index 644565e..b32ea31 100644 --- a/src/dep/src/irrlicht/CTRTextureLightMap2_M2.cpp +++ b/src/dep/src/irrlicht/CTRTextureLightMap2_M2.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRTextureLightMap2_M4.cpp b/src/dep/src/irrlicht/CTRTextureLightMap2_M4.cpp index ebc864d..e096ec1 100644 --- a/src/dep/src/irrlicht/CTRTextureLightMap2_M4.cpp +++ b/src/dep/src/irrlicht/CTRTextureLightMap2_M4.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRTextureLightMapGouraud2_M4.cpp b/src/dep/src/irrlicht/CTRTextureLightMapGouraud2_M4.cpp index 6d81892..421e31b 100644 --- a/src/dep/src/irrlicht/CTRTextureLightMapGouraud2_M4.cpp +++ b/src/dep/src/irrlicht/CTRTextureLightMapGouraud2_M4.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTRTextureWire2.cpp b/src/dep/src/irrlicht/CTRTextureWire2.cpp index 843c94b..2309143 100644 --- a/src/dep/src/irrlicht/CTRTextureWire2.cpp +++ b/src/dep/src/irrlicht/CTRTextureWire2.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTerrainSceneNode.cpp b/src/dep/src/irrlicht/CTerrainSceneNode.cpp index 732ca26..537b1ed 100644 --- a/src/dep/src/irrlicht/CTerrainSceneNode.cpp +++ b/src/dep/src/irrlicht/CTerrainSceneNode.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -39,7 +39,6 @@ namespace scene OverrideDistanceThreshold(false), UseDefaultRotationPivot(true), ForceRecalculation(false), OldCameraPosition(core::vector3df(-99999.9f, -99999.9f, -99999.9f)), OldCameraRotation(core::vector3df(-99999.9f, -99999.9f, -99999.9f)), - OldCameraUp(core::vector3df(-99999.9f, -99999.9f, -99999.9f)), CameraMovementDelta(10.0f), CameraRotationDelta(1.0f),CameraFOVDelta(0.1f), TCoordScale1(1.0f), TCoordScale2(1.0f), FileSystem(fs) { @@ -48,13 +47,11 @@ namespace scene #endif RenderBuffer = new CDynamicMeshBuffer(video::EVT_2TCOORDS, video::EIT_16BIT); - RenderBuffer->setHardwareMappingHint(scene::EHM_STATIC, scene::EBT_VERTEX); - RenderBuffer->setHardwareMappingHint(scene::EHM_DYNAMIC, scene::EBT_INDEX); if (FileSystem) FileSystem->grab(); - setAutomaticCulling(scene::EAC_OFF); + setAutomaticCulling( scene::EAC_OFF ); } @@ -75,7 +72,7 @@ namespace scene bool CTerrainSceneNode::loadHeightMap(io::IReadFile* file, video::SColor vertexColor, s32 smoothFactor) { - if (!file) + if( !file ) return false; Mesh.MeshBuffers.clear(); @@ -93,34 +90,34 @@ namespace scene // Get the dimension of the heightmap data TerrainData.Size = heightMap->getDimension().Width; - switch (TerrainData.PatchSize) + switch( TerrainData.PatchSize ) { case ETPS_9: - if (TerrainData.MaxLOD > 3) + if( TerrainData.MaxLOD > 3 ) { TerrainData.MaxLOD = 3; } break; case ETPS_17: - if (TerrainData.MaxLOD > 4) + if( TerrainData.MaxLOD > 4 ) { TerrainData.MaxLOD = 4; } break; case ETPS_33: - if (TerrainData.MaxLOD > 5) + if( TerrainData.MaxLOD > 5 ) { TerrainData.MaxLOD = 5; } break; case ETPS_65: - if (TerrainData.MaxLOD > 6) + if( TerrainData.MaxLOD > 6 ) { TerrainData.MaxLOD = 6; } break; case ETPS_129: - if (TerrainData.MaxLOD > 7) + if( TerrainData.MaxLOD > 7 ) { TerrainData.MaxLOD = 7; } @@ -134,7 +131,7 @@ namespace scene scene::CDynamicMeshBuffer *mb=0; const u32 numVertices = TerrainData.Size * TerrainData.Size; - if (numVertices <= 65536) + if (numVertices <65535) { //small enough for 16bit buffers mb=new scene::CDynamicMeshBuffer(video::EVT_2TCOORDS, video::EIT_16BIT); @@ -155,17 +152,17 @@ namespace scene s32 index = 0; float fx=0.f; float fx2=0.f; - for (s32 x = 0; x < TerrainData.Size; ++x) + for( s32 x = 0; x < TerrainData.Size; ++x ) { float fz=0.f; float fz2=0.f; - for (s32 z = 0; z < TerrainData.Size; ++z) + for( s32 z = 0; z < TerrainData.Size; ++z ) { video::S3DVertex2TCoords& vertex= static_cast(mb->getVertexBuffer().pointer())[index++]; vertex.Normal.set(0.0f, 1.0f, 0.0f); vertex.Color = vertexColor; vertex.Pos.X = fx; - vertex.Pos.Y = (f32) heightMap->getPixel(TerrainData.Size-x-1,z).getLuminance(); + vertex.Pos.Y = (f32) heightMap->getPixel(TerrainData.Size-x,z).getLuminance(); vertex.Pos.Z = fz; vertex.TCoords.X = vertex.TCoords2.X = 1.f-fx2; @@ -192,7 +189,7 @@ namespace scene // We copy the data to the renderBuffer, after the normals have been calculated. RenderBuffer->getVertexBuffer().set_used(numVertices); - for (u32 i = 0; i < numVertices; ++i) + for( u32 i = 0; i < numVertices; ++i ) { RenderBuffer->getVertexBuffer()[i] = mb->getVertexBuffer()[i]; RenderBuffer->getVertexBuffer()[i].Pos *= TerrainData.Scale; @@ -235,9 +232,7 @@ namespace scene //! Initializes the terrain data. Loads the vertices from the heightMapFile - bool CTerrainSceneNode::loadHeightMapRAW(io::IReadFile* file, - s32 bitsPerPixel, bool signedData, bool floatVals, - s32 width, video::SColor vertexColor, s32 smoothFactor) + bool CTerrainSceneNode::loadHeightMapRAW( io::IReadFile* file, s32 bitsPerPixel, bool signedData, bool floatVals, s32 width, video::SColor vertexColor, s32 smoothFactor ) { if (!file) return false; @@ -254,7 +249,7 @@ namespace scene // Get the dimension of the heightmap data const s32 filesize = file->getSize(); if (!width) - TerrainData.Size = core::floor32(sqrtf((f32)(filesize / bytesPerPixel))); + TerrainData.Size = core::floor32(sqrtf( (f32)( filesize / bytesPerPixel ) )); else { if ((filesize-file->getPos())/bytesPerPixel>width*width) @@ -265,34 +260,34 @@ namespace scene TerrainData.Size = width; } - switch (TerrainData.PatchSize) + switch( TerrainData.PatchSize ) { case ETPS_9: - if (TerrainData.MaxLOD > 3) + if( TerrainData.MaxLOD > 3 ) { TerrainData.MaxLOD = 3; } break; case ETPS_17: - if (TerrainData.MaxLOD > 4) + if( TerrainData.MaxLOD > 4 ) { TerrainData.MaxLOD = 4; } break; case ETPS_33: - if (TerrainData.MaxLOD > 5) + if( TerrainData.MaxLOD > 5 ) { TerrainData.MaxLOD = 5; } break; case ETPS_65: - if (TerrainData.MaxLOD > 6) + if( TerrainData.MaxLOD > 6 ) { TerrainData.MaxLOD = 6; } break; case ETPS_129: - if (TerrainData.MaxLOD > 7) + if( TerrainData.MaxLOD > 7 ) { TerrainData.MaxLOD = 7; } @@ -303,7 +298,7 @@ namespace scene // resize the vertex array for the mesh buffer one time (makes loading faster) scene::CDynamicMeshBuffer *mb=0; const u32 numVertices = TerrainData.Size * TerrainData.Size; - if (numVertices <= 65536) + if (numVertices <65535) { //small enough for 16bit buffers mb=new scene::CDynamicMeshBuffer(video::EVT_2TCOORDS, video::EIT_16BIT); @@ -327,17 +322,17 @@ namespace scene const f32 tdSize = 1.0f/(f32)(TerrainData.Size-1); float fx=0.f; float fx2=0.f; - for (s32 x = 0; x < TerrainData.Size; ++x) + for( s32 x = 0; x < TerrainData.Size; ++x ) { float fz=0.f; float fz2=0.f; - for (s32 z = 0; z < TerrainData.Size; ++z) + for( s32 z = 0; z < TerrainData.Size; ++z ) { bool failure=false; vertex.Pos.X = fx; if (floatVals) { - if (file->read(&vertex.Pos.Y, bytesPerPixel) != bytesPerPixel) + if( file->read( &vertex.Pos.Y, bytesPerPixel ) != bytesPerPixel ) failure=true; } else if (signedData) @@ -347,7 +342,7 @@ namespace scene case 1: { s8 val; - if (file->read(&val, bytesPerPixel) != bytesPerPixel) + if( file->read( &val, bytesPerPixel ) != bytesPerPixel ) failure=true; vertex.Pos.Y=val; } @@ -355,7 +350,7 @@ namespace scene case 2: { s16 val; - if (file->read(&val, bytesPerPixel) != bytesPerPixel) + if( file->read( &val, bytesPerPixel ) != bytesPerPixel ) failure=true; vertex.Pos.Y=val/256.f; } @@ -363,7 +358,7 @@ namespace scene case 4: { s32 val; - if (file->read(&val, bytesPerPixel) != bytesPerPixel) + if( file->read( &val, bytesPerPixel ) != bytesPerPixel ) failure=true; vertex.Pos.Y=val/16777216.f; } @@ -377,7 +372,7 @@ namespace scene case 1: { u8 val; - if (file->read(&val, bytesPerPixel) != bytesPerPixel) + if( file->read( &val, bytesPerPixel ) != bytesPerPixel ) failure=true; vertex.Pos.Y=val; } @@ -385,7 +380,7 @@ namespace scene case 2: { u16 val; - if (file->read(&val, bytesPerPixel) != bytesPerPixel) + if( file->read( &val, bytesPerPixel ) != bytesPerPixel ) failure=true; vertex.Pos.Y=val/256.f; } @@ -393,7 +388,7 @@ namespace scene case 4: { u32 val; - if (file->read(&val, bytesPerPixel) != bytesPerPixel) + if( file->read( &val, bytesPerPixel ) != bytesPerPixel ) failure=true; vertex.Pos.Y=val/16777216.f; } @@ -411,7 +406,7 @@ namespace scene vertex.TCoords.X = vertex.TCoords2.X = 1.f-fx2; vertex.TCoords.Y = vertex.TCoords2.Y = fz2; - mb->getVertexBuffer().push_back(vertex); + mb->getVertexBuffer().push_back( vertex ); ++fz; fz2 += tdSize; } @@ -422,16 +417,16 @@ namespace scene smoothTerrain(mb, smoothFactor); // calculate smooth normals for the vertices - calculateNormals(mb); + calculateNormals( mb ); // add the MeshBuffer to the mesh - Mesh.addMeshBuffer(mb); + Mesh.addMeshBuffer( mb ); const u32 vertexCount = mb->getVertexCount(); // We copy the data to the renderBuffer, after the normals have been calculated. - RenderBuffer->getVertexBuffer().set_used(vertexCount); + RenderBuffer->getVertexBuffer().set_used( vertexCount ); - for (u32 i = 0; i < vertexCount; i++) + for( u32 i = 0; i < vertexCount; i++ ) { RenderBuffer->getVertexBuffer()[i] = mb->getVertexBuffer()[i]; RenderBuffer->getVertexBuffer()[i].Pos *= TerrainData.Scale; @@ -452,12 +447,11 @@ namespace scene // Rotate the vertices of the terrain by the rotation specified. Must be done // after calculating the terrain data, so we know what the current center of the // terrain is. - setRotation(TerrainData.Rotation); + setRotation( TerrainData.Rotation ); // Pre-allocate memory for indices - RenderBuffer->getIndexBuffer().set_used( - TerrainData.PatchCount*TerrainData.PatchCount* - TerrainData.CalcPatchSize*TerrainData.CalcPatchSize*6); + RenderBuffer->getIndexBuffer().set_used( TerrainData.PatchCount * TerrainData.PatchCount * + TerrainData.CalcPatchSize * TerrainData.CalcPatchSize * 6 ); const u32 endTime = os::Timer::getTime(); @@ -494,7 +488,7 @@ namespace scene //! Sets the pivot point for rotation of this node. This is useful for the TiledTerrainManager to //! rotate all terrain tiles around a global world point. //! NOTE: The default for the RotationPivot will be the center of the individual tile. - void CTerrainSceneNode::setRotationPivot(const core::vector3df& pivot) + void CTerrainSceneNode::setRotationPivot( const core::vector3df& pivot ) { UseDefaultRotationPivot = false; TerrainData.RotationPivot = pivot; @@ -511,28 +505,28 @@ namespace scene } - //! Apply transformation changes(scale, position, rotation) + //! Apply transformation changes( scale, position, rotation ) void CTerrainSceneNode::applyTransformation() { - if (!Mesh.getMeshBufferCount()) + if( !Mesh.getMeshBufferCount() ) return; TerrainData.Position = TerrainData.Position; video::S3DVertex2TCoords* meshVertices = (video::S3DVertex2TCoords*)Mesh.getMeshBuffer(0)->getVertices(); - s32 vtxCount = Mesh.getMeshBuffer(0)->getVertexCount(); + s32 vtxCount = Mesh.getMeshBuffer( 0 )->getVertexCount(); core::matrix4 rotMatrix; - rotMatrix.setRotationDegrees(TerrainData.Rotation); + rotMatrix.setRotationDegrees( TerrainData.Rotation ); - for (s32 i = 0; i < vtxCount; ++i) + for( s32 i = 0; i < vtxCount; ++i ) { RenderBuffer->getVertexBuffer()[i].Pos = meshVertices[i].Pos * TerrainData.Scale + TerrainData.Position; RenderBuffer->getVertexBuffer()[i].Pos -= TerrainData.RotationPivot; - rotMatrix.inverseRotateVect(RenderBuffer->getVertexBuffer()[i].Pos); + rotMatrix.inverseRotateVect( RenderBuffer->getVertexBuffer()[i].Pos ); RenderBuffer->getVertexBuffer()[i].Pos += TerrainData.RotationPivot; } - calculateDistanceThresholds(true); + calculateDistanceThresholds( true ); calculatePatchData(); RenderBuffer->setDirty(EBT_VERTEX); @@ -558,32 +552,25 @@ namespace scene void CTerrainSceneNode::preRenderLODCalculations() { - scene::ICameraSceneNode * camera = SceneManager->getActiveCamera(); - if(!camera) - return; - SceneManager->registerNodeForRendering(this); // Do Not call ISceneNode::OnRegisterSceneNode(), this node should have no children // Determine the camera rotation, based on the camera direction. - const core::vector3df cameraPosition = camera->getAbsolutePosition(); - const core::vector3df cameraRotation = core::line3d(cameraPosition, camera->getTarget()).getVector().getHorizontalAngle(); - core::vector3df cameraUp = camera->getUpVector(); - cameraUp.normalize(); + const core::vector3df cameraPosition = SceneManager->getActiveCamera()->getAbsolutePosition(); + const core::vector3df cameraRotation = core::line3d(cameraPosition, SceneManager->getActiveCamera()->getTarget()).getVector().getHorizontalAngle(); const f32 CameraFOV = SceneManager->getActiveCamera()->getFOV(); // Only check on the Camera's Y Rotation if (!ForceRecalculation) { - if ((fabsf(cameraRotation.X - OldCameraRotation.X) < CameraRotationDelta) && - (fabsf(cameraRotation.Y - OldCameraRotation.Y) < CameraRotationDelta)) + if (( fabs(cameraRotation.X - OldCameraRotation.X) < CameraRotationDelta) && + ( fabs(cameraRotation.Y - OldCameraRotation.Y) < CameraRotationDelta)) { if ((fabs(cameraPosition.X - OldCameraPosition.X) < CameraMovementDelta) && (fabs(cameraPosition.Y - OldCameraPosition.Y) < CameraMovementDelta) && (fabs(cameraPosition.Z - OldCameraPosition.Z) < CameraMovementDelta)) { - if (fabs(CameraFOV-OldCameraFOV) < CameraFOVDelta && - cameraUp.dotProduct(OldCameraUp) > (1.f - (cos(core::DEGTORAD * CameraRotationDelta)))) + if (fabs(CameraFOV-OldCameraFOV) < CameraFOVDelta) { return; } @@ -593,7 +580,6 @@ namespace scene OldCameraPosition = cameraPosition; OldCameraRotation = cameraRotation; - OldCameraUp = cameraUp; OldCameraFOV = CameraFOV; const SViewFrustum* frustum = SceneManager->getActiveCamera()->getViewFrustum(); @@ -601,22 +587,22 @@ namespace scene // Determine each patches LOD based on distance from camera (and whether or not they are in // the view frustum). const s32 count = TerrainData.PatchCount * TerrainData.PatchCount; - for (s32 j = 0; j < count; ++j) + for( s32 j = 0; j < count; ++j ) { - if (frustum->getBoundingBox().intersectsWithBox(TerrainData.Patches[j].BoundingBox)) + if( frustum->getBoundingBox().intersectsWithBox( TerrainData.Patches[j].BoundingBox ) ) { const f32 distance = (cameraPosition.X - TerrainData.Patches[j].Center.X) * (cameraPosition.X - TerrainData.Patches[j].Center.X) + (cameraPosition.Y - TerrainData.Patches[j].Center.Y) * (cameraPosition.Y - TerrainData.Patches[j].Center.Y) + (cameraPosition.Z - TerrainData.Patches[j].Center.Z) * (cameraPosition.Z - TerrainData.Patches[j].Center.Z); - for (s32 i = TerrainData.MaxLOD - 1; i >= 0; --i) + for( s32 i = TerrainData.MaxLOD - 1; i >= 0; --i ) { - if (distance >= TerrainData.LODDistanceThreshold[i]) + if( distance >= TerrainData.LODDistanceThreshold[i] ) { TerrainData.Patches[j].CurrentLOD = i; break; } - //else if (i == 0) + //else if( i == 0 ) { // If we've turned off a patch from viewing, because of the frustum, and now we turn around and it's // too close, we need to turn it back on, at the highest LOD. The if above doesn't catch this. @@ -652,12 +638,12 @@ namespace scene IndicesToRender = 0; // Then generate the indices for all patches that are visible. - for (s32 i = 0; i < TerrainData.PatchCount; ++i) + for( s32 i = 0; i < TerrainData.PatchCount; ++i ) { - for (s32 j = 0; j < TerrainData.PatchCount; ++j) + for( s32 j = 0; j < TerrainData.PatchCount; ++j ) { const s32 index = i * TerrainData.PatchCount + j; - if (TerrainData.Patches[index].CurrentLOD >= 0) + if( TerrainData.Patches[index].CurrentLOD >= 0 ) { s32 x = 0; s32 z = 0; @@ -666,12 +652,12 @@ namespace scene const s32 step = 1 << TerrainData.Patches[index].CurrentLOD; // Loop through patch and generate indices - while (z < TerrainData.CalcPatchSize) + while( z < TerrainData.CalcPatchSize ) { - const s32 index11 = getIndex(j, i, index, x, z); - const s32 index21 = getIndex(j, i, index, x + step, z); - const s32 index12 = getIndex(j, i, index, x, z + step); - const s32 index22 = getIndex(j, i, index, x + step, z + step); + const s32 index11 = getIndex( j, i, index, x, z ); + const s32 index21 = getIndex( j, i, index, x + step, z ); + const s32 index12 = getIndex( j, i, index, x, z + step ); + const s32 index22 = getIndex( j, i, index, x + step, z + step ); IndexBuffer[IndicesToRender++]= static_cast(index12); IndexBuffer[IndicesToRender++]= static_cast(index11); @@ -696,7 +682,7 @@ namespace scene RenderBuffer->setDirty(EBT_INDEX); - if (DynamicSelectorUpdate && TriangleSelector) + if ( DynamicSelectorUpdate && TriangleSelector ) { CTerrainTriangleSelector* selector = (CTerrainTriangleSelector*)TriangleSelector; selector->setTriangleData(this, -1); @@ -723,7 +709,7 @@ namespace scene // For use with geomorphing driver->drawMeshBuffer(RenderBuffer); - RenderBuffer->getIndexBuffer().set_used(RenderBuffer->getIndexBuffer().allocated_size()); + RenderBuffer->getIndexBuffer().set_used( RenderBuffer->getIndexBuffer().allocated_size() ); // for debug purposes only: if (DebugDataVisible) @@ -732,15 +718,15 @@ namespace scene m.Lighting = false; driver->setMaterial(m); if (DebugDataVisible & scene::EDS_BBOX) - driver->draw3DBox(TerrainData.BoundingBox, video::SColor(255,255,255,255)); + driver->draw3DBox( TerrainData.BoundingBox, video::SColor(255,255,255,255)); const s32 count = TerrainData.PatchCount * TerrainData.PatchCount; s32 visible = 0; if (DebugDataVisible & scene::EDS_BBOX_BUFFERS) { - for (s32 j = 0; j < count; ++j) + for( s32 j = 0; j < count; ++j ) { - driver->draw3DBox(TerrainData.Patches[j].BoundingBox, video::SColor(255,255,0,0)); + driver->draw3DBox( TerrainData.Patches[j].BoundingBox, video::SColor(255,255,0,0)); visible += (TerrainData.Patches[j].CurrentLOD >= 0); } } @@ -751,9 +737,9 @@ namespace scene "__debugnormal", 0xFFECEC00, 0xFF999900, 4, 8, 1.f, 0.6f, 0.05f, 0.3f); - if (0 == arrow) + if ( 0 == arrow ) { - arrow = SceneManager->getMesh("__debugnormal"); + arrow = SceneManager->getMesh( "__debugnormal" ); } IMesh *mesh = arrow->getMesh(0); @@ -763,7 +749,7 @@ namespace scene // draw normals driver->setTransform(video::ETS_WORLD, core::IdentityMatrix); - for (u32 i=0; i != RenderBuffer->getVertexCount(); ++i) + for ( u32 i=0; i != RenderBuffer->getVertexCount(); ++i ) { const core::vector3df& v = RenderBuffer->getNormal(i); // align to v->Normal @@ -782,7 +768,7 @@ namespace scene m2=AbsoluteTransformation*m2; driver->setTransform(video::ETS_WORLD, m2 ); - for (u32 a = 0; a != mesh->getMeshBufferCount(); ++a) + for ( u32 a = 0; a != mesh->getMeshBufferCount(); ++a ) driver->drawMeshBuffer(mesh->getMeshBuffer(a)); } driver->setTransform(video::ETS_WORLD, AbsoluteTransformation); @@ -811,7 +797,7 @@ namespace scene //! Return the bounding box of a patch - const core::aabbox3d& CTerrainSceneNode::getBoundingBox(s32 patchX, s32 patchZ) const + const core::aabbox3d& CTerrainSceneNode::getBoundingBox( s32 patchX, s32 patchZ ) const { return TerrainData.Patches[patchX * TerrainData.PatchCount + patchZ].BoundingBox; } @@ -834,7 +820,7 @@ namespace scene for (u32 n=0; ngetIndexBuffer().getType()); + mb.getIndexBuffer().setType( RenderBuffer->getIndexBuffer().getType() ); // calculate the step we take for all patches, since LOD is the same const s32 step = 1 << LOD; @@ -851,17 +837,17 @@ namespace scene // Loop through patch and generate indices while (z < TerrainData.CalcPatchSize) { - const s32 index11 = getIndex(j, i, index, x, z); - const s32 index21 = getIndex(j, i, index, x + step, z); - const s32 index12 = getIndex(j, i, index, x, z + step); - const s32 index22 = getIndex(j, i, index, x + step, z + step); + const s32 index11 = getIndex( j, i, index, x, z ); + const s32 index21 = getIndex( j, i, index, x + step, z ); + const s32 index12 = getIndex( j, i, index, x, z + step ); + const s32 index22 = getIndex( j, i, index, x + step, z + step ); - mb.getIndexBuffer().push_back(index12); - mb.getIndexBuffer().push_back(index11); - mb.getIndexBuffer().push_back(index22); - mb.getIndexBuffer().push_back(index22); - mb.getIndexBuffer().push_back(index11); - mb.getIndexBuffer().push_back(index21); + mb.getIndexBuffer().push_back( index12 ); + mb.getIndexBuffer().push_back( index11 ); + mb.getIndexBuffer().push_back( index22 ); + mb.getIndexBuffer().push_back( index22 ); + mb.getIndexBuffer().push_back( index11 ); + mb.getIndexBuffer().push_back( index21 ); // increment index position horizontally x += step; @@ -888,18 +874,17 @@ namespace scene //! \return: Number if indices put into the buffer. s32 CTerrainSceneNode::getIndicesForPatch(core::array& indices, s32 patchX, s32 patchZ, s32 LOD) { - if (patchX < 0 || patchX > TerrainData.PatchCount-1 || - patchZ < 0 || patchZ > TerrainData.PatchCount-1) + if ( patchX < 0 || patchX > TerrainData.PatchCount - 1 || patchZ < 0 || patchZ > TerrainData.PatchCount - 1 ) return -1; - if (LOD < -1 || LOD > TerrainData.MaxLOD - 1) + if ( LOD < -1 || LOD > TerrainData.MaxLOD - 1 ) return -1; core::array cLODs; bool setLODs = false; // If LOD of -1 was passed in, use the CurrentLOD of the patch specified - if (LOD == -1) + if ( LOD == -1 ) { LOD = TerrainData.Patches[patchX * TerrainData.PatchCount + patchZ].CurrentLOD; } @@ -910,7 +895,7 @@ namespace scene setLODs = true; } - if (LOD < 0) + if ( LOD < 0 ) return -2; // Patch not visible, don't generate indices. // calculate the step we take for this LOD @@ -928,10 +913,10 @@ namespace scene s32 rv=0; while (z TerrainData.MaxLOD - 1) + if ( LOD < 0 || LOD > TerrainData.MaxLOD - 1 ) return false; TerrainData.LODDistanceThreshold[LOD] = newDistance * newDistance; @@ -1022,7 +1007,7 @@ namespace scene if (RenderBuffer->getVertexType()==video::EVT_2TCOORDS) { - if (resolution2 == 0) + if ( resolution2 == 0 ) { ((video::S3DVertex2TCoords&)RenderBuffer->getVertexBuffer()[index]).TCoords2 = RenderBuffer->getVertexBuffer()[index].TCoords; } @@ -1054,47 +1039,47 @@ namespace scene { if (TerrainData.Patches[PatchIndex].Top && TerrainData.Patches[PatchIndex].CurrentLOD < TerrainData.Patches[PatchIndex].Top->CurrentLOD && - (vX % (1 << TerrainData.Patches[PatchIndex].Top->CurrentLOD)) != 0 ) + (vX % ( 1 << TerrainData.Patches[PatchIndex].Top->CurrentLOD)) != 0 ) { - vX -= vX % (1 << TerrainData.Patches[PatchIndex].Top->CurrentLOD); + vX -= vX % ( 1 << TerrainData.Patches[PatchIndex].Top->CurrentLOD ); } } else - if (vZ == (u32)TerrainData.CalcPatchSize) // bottom border + if ( vZ == (u32)TerrainData.CalcPatchSize ) // bottom border { if (TerrainData.Patches[PatchIndex].Bottom && TerrainData.Patches[PatchIndex].CurrentLOD < TerrainData.Patches[PatchIndex].Bottom->CurrentLOD && - (vX % (1 << TerrainData.Patches[PatchIndex].Bottom->CurrentLOD)) != 0) + (vX % ( 1 << TerrainData.Patches[PatchIndex].Bottom->CurrentLOD)) != 0) { - vX -= vX % (1 << TerrainData.Patches[PatchIndex].Bottom->CurrentLOD); + vX -= vX % ( 1 << TerrainData.Patches[PatchIndex].Bottom->CurrentLOD ); } } // left border - if (vX == 0) + if ( vX == 0 ) { if (TerrainData.Patches[PatchIndex].Left && TerrainData.Patches[PatchIndex].CurrentLOD < TerrainData.Patches[PatchIndex].Left->CurrentLOD && - (vZ % (1 << TerrainData.Patches[PatchIndex].Left->CurrentLOD)) != 0) + ( vZ % ( 1 << TerrainData.Patches[PatchIndex].Left->CurrentLOD ) ) != 0) { - vZ -= vZ % (1 << TerrainData.Patches[PatchIndex].Left->CurrentLOD); + vZ -= vZ % ( 1 << TerrainData.Patches[PatchIndex].Left->CurrentLOD ); } } else - if (vX == (u32)TerrainData.CalcPatchSize) // right border + if ( vX == (u32)TerrainData.CalcPatchSize ) // right border { if (TerrainData.Patches[PatchIndex].Right && TerrainData.Patches[PatchIndex].CurrentLOD < TerrainData.Patches[PatchIndex].Right->CurrentLOD && - (vZ % (1 << TerrainData.Patches[PatchIndex].Right->CurrentLOD)) != 0) + ( vZ % ( 1 << TerrainData.Patches[PatchIndex].Right->CurrentLOD ) ) != 0) { - vZ -= vZ % (1 << TerrainData.Patches[PatchIndex].Right->CurrentLOD); + vZ -= vZ % ( 1 << TerrainData.Patches[PatchIndex].Right->CurrentLOD ); } } - if (vZ >= (u32)TerrainData.PatchSize) + if ( vZ >= (u32)TerrainData.PatchSize ) vZ = TerrainData.CalcPatchSize; - if (vX >= (u32)TerrainData.PatchSize) + if ( vX >= (u32)TerrainData.PatchSize ) vX = TerrainData.CalcPatchSize; return (vZ + ((TerrainData.CalcPatchSize) * PatchZ)) * TerrainData.Size + @@ -1125,7 +1110,7 @@ namespace scene //! calculate smooth normals - void CTerrainSceneNode::calculateNormals(CDynamicMeshBuffer* mb) + void CTerrainSceneNode::calculateNormals( CDynamicMeshBuffer* mb ) { s32 count; core::vector3df a, b, c, t; @@ -1239,7 +1224,7 @@ namespace scene } else { - normal.set(0.0f, 1.0f, 0.0f); + normal.set( 0.0f, 1.0f, 0.0f ); } mb->getVertexBuffer()[x * TerrainData.Size + z].Normal = normal; @@ -1251,7 +1236,7 @@ namespace scene //! create patches, stuff that needs to be done only once for patches goes here. void CTerrainSceneNode::createPatches() { - TerrainData.PatchCount = (TerrainData.Size - 1) / (TerrainData.CalcPatchSize); + TerrainData.PatchCount = (TerrainData.Size - 1) / ( TerrainData.CalcPatchSize ); if (TerrainData.Patches) delete [] TerrainData.Patches; @@ -1266,9 +1251,9 @@ namespace scene // Reset the Terrains Bounding Box for re-calculation TerrainData.BoundingBox = core::aabbox3df(999999.9f, 999999.9f, 999999.9f, -999999.9f, -999999.9f, -999999.9f); - for (s32 x = 0; x < TerrainData.PatchCount; ++x) + for( s32 x = 0; x < TerrainData.PatchCount; ++x ) { - for (s32 z = 0; z < TerrainData.PatchCount; ++z) + for( s32 z = 0; z < TerrainData.PatchCount; ++z ) { const s32 index = x * TerrainData.PatchCount + z; TerrainData.Patches[index].CurrentLOD = 0; @@ -1277,38 +1262,38 @@ namespace scene TerrainData.Patches[index].BoundingBox = core::aabbox3df(999999.9f, 999999.9f, 999999.9f, -999999.9f, -999999.9f, -999999.9f); - for (s32 xx = x*(TerrainData.CalcPatchSize); xx <= (x + 1) * TerrainData.CalcPatchSize; ++xx) - for (s32 zz = z*(TerrainData.CalcPatchSize); zz <= (z + 1) * TerrainData.CalcPatchSize; ++zz) - TerrainData.Patches[index].BoundingBox.addInternalPoint(RenderBuffer->getVertexBuffer()[xx * TerrainData.Size + zz].Pos); + for( s32 xx = x*(TerrainData.CalcPatchSize); xx <= ( x + 1 ) * TerrainData.CalcPatchSize; ++xx ) + for( s32 zz = z*(TerrainData.CalcPatchSize); zz <= ( z + 1 ) * TerrainData.CalcPatchSize; ++zz ) + TerrainData.Patches[index].BoundingBox.addInternalPoint( RenderBuffer->getVertexBuffer()[xx * TerrainData.Size + zz].Pos ); // Reconfigure the bounding box of the terrain as a whole - TerrainData.BoundingBox.addInternalBox(TerrainData.Patches[index].BoundingBox); + TerrainData.BoundingBox.addInternalBox( TerrainData.Patches[index].BoundingBox ); // get center of Patch TerrainData.Patches[index].Center = TerrainData.Patches[index].BoundingBox.getCenter(); // Assign Neighbours // Top - if (x > 0) + if( x > 0 ) TerrainData.Patches[index].Top = &TerrainData.Patches[(x-1) * TerrainData.PatchCount + z]; else TerrainData.Patches[index].Top = 0; // Bottom - if (x < TerrainData.PatchCount - 1) + if( x < TerrainData.PatchCount - 1 ) TerrainData.Patches[index].Bottom = &TerrainData.Patches[(x+1) * TerrainData.PatchCount + z]; else TerrainData.Patches[index].Bottom = 0; // Left - if (z > 0) + if( z > 0 ) TerrainData.Patches[index].Left = &TerrainData.Patches[x * TerrainData.PatchCount + z - 1]; else TerrainData.Patches[index].Left = 0; // Right - if (z < TerrainData.PatchCount - 1) + if( z < TerrainData.PatchCount - 1 ) TerrainData.Patches[index].Right = &TerrainData.Patches[x * TerrainData.PatchCount + z + 1]; else TerrainData.Patches[index].Right = 0; @@ -1319,7 +1304,7 @@ namespace scene TerrainData.Center = TerrainData.BoundingBox.getCenter(); // if the default rotation pivot is still being used, update it. - if (UseDefaultRotationPivot) + if( UseDefaultRotationPivot ) { TerrainData.RotationPivot = TerrainData.Center; } @@ -1371,29 +1356,28 @@ namespace scene f32 height = -999999.9f; core::matrix4 rotMatrix; - rotMatrix.setRotationDegrees(TerrainData.Rotation); - core::vector3df pos(x, 0.0f, z); - rotMatrix.rotateVect(pos); + rotMatrix.setRotationDegrees( TerrainData.Rotation ); + core::vector3df pos( x, 0.0f, z ); + rotMatrix.rotateVect( pos ); pos -= TerrainData.Position; pos /= TerrainData.Scale; - s32 X(core::floor32(pos.X)); - s32 Z(core::floor32(pos.Z)); + s32 X(core::floor32( pos.X )); + s32 Z(core::floor32( pos.Z )); - if (X >= 0 && X < TerrainData.Size-1 && - Z >= 0 && Z < TerrainData.Size-1) + if( X >= 0 && X < TerrainData.Size && Z >= 0 && Z < TerrainData.Size ) { const video::S3DVertex2TCoords* Vertices = (const video::S3DVertex2TCoords*)Mesh.getMeshBuffer(0)->getVertices(); const core::vector3df& a = Vertices[X * TerrainData.Size + Z].Pos; const core::vector3df& b = Vertices[(X + 1) * TerrainData.Size + Z].Pos; - const core::vector3df& c = Vertices[X * TerrainData.Size + (Z + 1)].Pos; - const core::vector3df& d = Vertices[(X + 1) * TerrainData.Size + (Z + 1)].Pos; + const core::vector3df& c = Vertices[X * TerrainData.Size + ( Z + 1 )].Pos; + const core::vector3df& d = Vertices[(X + 1) * TerrainData.Size + ( Z + 1 )].Pos; // offset from integer position const f32 dx = pos.X - X; const f32 dz = pos.Z - Z; - if (dx > dz) + if( dx > dz ) height = a.Y + (d.Y - b.Y)*dz + (b.Y - a.Y)*dx; else height = a.Y + (d.Y - c.Y)*dx + (c.Y - a.Y)*dz; diff --git a/src/dep/src/irrlicht/CTerrainSceneNode.h b/src/dep/src/irrlicht/CTerrainSceneNode.h index d0677f6..0c262ce 100644 --- a/src/dep/src/irrlicht/CTerrainSceneNode.h +++ b/src/dep/src/irrlicht/CTerrainSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -323,7 +323,6 @@ namespace scene core::vector3df OldCameraPosition; core::vector3df OldCameraRotation; - core::vector3df OldCameraUp; f32 OldCameraFOV; f32 CameraMovementDelta; f32 CameraRotationDelta; diff --git a/src/dep/src/irrlicht/CTerrainTriangleSelector.cpp b/src/dep/src/irrlicht/CTerrainTriangleSelector.cpp index 61a60cc..fedeee1 100644 --- a/src/dep/src/irrlicht/CTerrainTriangleSelector.cpp +++ b/src/dep/src/irrlicht/CTerrainTriangleSelector.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTerrainTriangleSelector.h b/src/dep/src/irrlicht/CTerrainTriangleSelector.h index 9ebf6b1..013818b 100644 --- a/src/dep/src/irrlicht/CTerrainTriangleSelector.h +++ b/src/dep/src/irrlicht/CTerrainTriangleSelector.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTextSceneNode.cpp b/src/dep/src/irrlicht/CTextSceneNode.cpp index 143810a..a7eb0fb 100644 --- a/src/dep/src/irrlicht/CTextSceneNode.cpp +++ b/src/dep/src/irrlicht/CTextSceneNode.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTextSceneNode.h b/src/dep/src/irrlicht/CTextSceneNode.h index 8588dc7..8700a9c 100644 --- a/src/dep/src/irrlicht/CTextSceneNode.h +++ b/src/dep/src/irrlicht/CTextSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTimer.h b/src/dep/src/irrlicht/CTimer.h index 3e4d4e7..a106c50 100644 --- a/src/dep/src/irrlicht/CTimer.h +++ b/src/dep/src/irrlicht/CTimer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTriangleBBSelector.cpp b/src/dep/src/irrlicht/CTriangleBBSelector.cpp index 034e19d..954472e 100644 --- a/src/dep/src/irrlicht/CTriangleBBSelector.cpp +++ b/src/dep/src/irrlicht/CTriangleBBSelector.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTriangleBBSelector.h b/src/dep/src/irrlicht/CTriangleBBSelector.h index db85286..f30b5eb 100644 --- a/src/dep/src/irrlicht/CTriangleBBSelector.h +++ b/src/dep/src/irrlicht/CTriangleBBSelector.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTriangleSelector.cpp b/src/dep/src/irrlicht/CTriangleSelector.cpp index e026793..635bc32 100644 --- a/src/dep/src/irrlicht/CTriangleSelector.cpp +++ b/src/dep/src/irrlicht/CTriangleSelector.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CTriangleSelector.h b/src/dep/src/irrlicht/CTriangleSelector.h index ea48816..ed8ebc7 100644 --- a/src/dep/src/irrlicht/CTriangleSelector.h +++ b/src/dep/src/irrlicht/CTriangleSelector.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CVideoModeList.cpp b/src/dep/src/irrlicht/CVideoModeList.cpp index 492a71b..4784eb5 100644 --- a/src/dep/src/irrlicht/CVideoModeList.cpp +++ b/src/dep/src/irrlicht/CVideoModeList.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CVideoModeList.h b/src/dep/src/irrlicht/CVideoModeList.h index c05d621..e670e69 100644 --- a/src/dep/src/irrlicht/CVideoModeList.h +++ b/src/dep/src/irrlicht/CVideoModeList.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CVolumeLightSceneNode.cpp b/src/dep/src/irrlicht/CVolumeLightSceneNode.cpp new file mode 100644 index 0000000..10396f5 --- /dev/null +++ b/src/dep/src/irrlicht/CVolumeLightSceneNode.cpp @@ -0,0 +1,324 @@ +// Copyright (C) 2002-2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h +// +// created by Dean Wadsworth aka Varmint Dec 31 2007 + +#include "CVolumeLightSceneNode.h" +#include "IVideoDriver.h" +#include "ISceneManager.h" +#include "S3DVertex.h" +#include "os.h" + +namespace irr +{ +namespace scene +{ + +//! constructor +CVolumeLightSceneNode::CVolumeLightSceneNode(ISceneNode* parent, ISceneManager* mgr, + s32 id, const u32 subdivU, const u32 subdivV, + const video::SColor foot, + const video::SColor tail, + const core::vector3df& position, + const core::vector3df& rotation, const core::vector3df& scale) + : IVolumeLightSceneNode(parent, mgr, id, position, rotation, scale), + LPDistance(8.0f), SubdivideU(subdivU), SubdivideV(subdivV), + FootColour(foot), TailColour(tail), + LightDimensions(core::vector3df(1.0f, 1.2f, 1.0f)) +{ + #ifdef _DEBUG + setDebugName("CVolumeLightSceneNode"); + #endif + + Buffer = new SMeshBuffer(); + if (Buffer) + { + Buffer->setHardwareMappingHint(EHM_STATIC); + constructLight(); + } +} + + +CVolumeLightSceneNode::~CVolumeLightSceneNode() +{ + if (Buffer) + Buffer->drop(); +} + + +void CVolumeLightSceneNode::addToBuffer(const video::S3DVertex& v) +{ + const s32 tnidx = Buffer->Vertices.linear_reverse_search(v); + const bool alreadyIn = (tnidx != -1); + u16 nidx = (u16)tnidx; + if (!alreadyIn) { + nidx = (u16)Buffer->Vertices.size(); + Buffer->Indices.push_back(nidx); + Buffer->Vertices.push_back(v); + } else + Buffer->Indices.push_back(nidx); +} + + +void CVolumeLightSceneNode::constructLight() +{ + const core::vector3df lightPoint(0, -(LPDistance*LightDimensions.Y), 0); + const f32 ax = LightDimensions.X * 0.5f; // X Axis + const f32 az = LightDimensions.Z * 0.5f; // Z Axis + + Buffer->Vertices.clear(); + Buffer->Vertices.reallocate(6+12*(SubdivideU+SubdivideV)); + Buffer->Indices.clear(); + Buffer->Indices.reallocate(6+12*(SubdivideU+SubdivideV)); + //draw the bottom foot.. the glowing region + addToBuffer(video::S3DVertex(-ax, 0, az, 0,0,0, FootColour, 0, 1)); + addToBuffer(video::S3DVertex(ax , 0, az, 0,0,0, FootColour, 1, 1)); + addToBuffer(video::S3DVertex(ax , 0,-az, 0,0,0, FootColour, 1, 0)); + + addToBuffer(video::S3DVertex(ax , 0,-az, 0,0,0, FootColour, 1, 0)); + addToBuffer(video::S3DVertex(-ax, 0,-az, 0,0,0, FootColour, 0, 0)); + addToBuffer(video::S3DVertex(-ax, 0, az, 0,0,0, FootColour, 0, 1)); + + f32 tu = 0.f; + const f32 tuStep = 1.f/SubdivideU; + f32 bx = -ax; + const f32 bxStep = LightDimensions.X * tuStep; + // Slices in X/U space + for (u32 i = 0; i <= SubdivideU; ++i) + { + // These are the two endpoints for a slice at the foot + core::vector3df end1(bx, 0.0f, -az); + core::vector3df end2(bx, 0.0f, az); + + end1 -= lightPoint; // get a vector from point to lightsource + end1.normalize(); // normalize vector + end1 *= LightDimensions.Y; // multiply it out by shootlength + + end1.X += bx; // Add the original point location to the vector + end1.Z -= az; + + // Do it again for the other point. + end2 -= lightPoint; + end2.normalize(); + end2 *= LightDimensions.Y; + + end2.X += bx; + end2.Z += az; + + addToBuffer(video::S3DVertex(bx , 0, az, 0,0,0, FootColour, tu, 1)); + addToBuffer(video::S3DVertex(bx , 0, -az, 0,0,0, FootColour, tu, 0)); + addToBuffer(video::S3DVertex(end2.X , end2.Y, end2.Z, 0,0,0, TailColour, tu, 1)); + + addToBuffer(video::S3DVertex(bx , 0, -az, 0,0,0, FootColour, tu, 0)); + addToBuffer(video::S3DVertex(end1.X , end1.Y, end1.Z, 0,0,0, TailColour, tu, 0)); + addToBuffer(video::S3DVertex(end2.X , end2.Y, end2.Z, 0,0,0, TailColour, tu, 1)); + + //back side + addToBuffer(video::S3DVertex(-end2.X , end2.Y, -end2.Z, 0,0,0, TailColour, tu, 1)); + addToBuffer(video::S3DVertex(-bx , 0, -az, 0,0,0, FootColour, tu, 1)); + addToBuffer(video::S3DVertex(-bx , 0, az, 0,0,0, FootColour, tu, 0)); + + addToBuffer(video::S3DVertex(-bx , 0, az, 0,0,0, FootColour, tu, 0)); + addToBuffer(video::S3DVertex(-end1.X , end1.Y, -end1.Z, 0,0,0, TailColour, tu, 0)); + addToBuffer(video::S3DVertex(-end2.X , end2.Y, -end2.Z, 0,0,0, TailColour, tu, 1)); + tu += tuStep; + bx += bxStep; + } + + f32 tv = 0.f; + const f32 tvStep = 1.f/SubdivideV; + f32 bz = -az; + const f32 bzStep = LightDimensions.Z * tvStep; + // Slices in Z/V space + for(u32 i = 0; i <= SubdivideV; ++i) + { + // These are the two endpoints for a slice at the foot + core::vector3df end1(-ax, 0.0f, bz); + core::vector3df end2(ax, 0.0f, bz); + + end1 -= lightPoint; // get a vector from point to lightsource + end1.normalize(); // normalize vector + end1 *= LightDimensions.Y; // multiply it out by shootlength + + end1.X -= ax; // Add the original point location to the vector + end1.Z += bz; + + // Do it again for the other point. + end2 -= lightPoint; + end2.normalize(); + end2 *= LightDimensions.Y; + + end2.X += ax; + end2.Z += bz; + + addToBuffer(video::S3DVertex(-ax , 0, bz, 0,0,0, FootColour, 0, tv)); + addToBuffer(video::S3DVertex(ax , 0, bz, 0,0,0, FootColour, 1, tv)); + addToBuffer(video::S3DVertex(end2.X , end2.Y, end2.Z, 0,0,0, TailColour, 1, tv)); + + addToBuffer(video::S3DVertex(end2.X , end2.Y, end2.Z, 0,0,0, TailColour, 1, tv)); + addToBuffer(video::S3DVertex(end1.X , end1.Y, end1.Z, 0,0,0, TailColour, 0, tv)); + addToBuffer(video::S3DVertex(-ax , 0, bz, 0,0,0, FootColour, 0, tv)); + + //back side + addToBuffer(video::S3DVertex(ax , 0, -bz, 0,0,0, FootColour, 0, tv)); + addToBuffer(video::S3DVertex(-ax , 0, -bz, 0,0,0, FootColour, 1, tv)); + addToBuffer(video::S3DVertex(-end2.X , end2.Y, -end2.Z, 0,0,0, TailColour, 1, tv)); + + addToBuffer(video::S3DVertex(-end2.X , end2.Y, -end2.Z, 0,0,0, TailColour, 1, tv)); + addToBuffer(video::S3DVertex(-end1.X , end1.Y, -end1.Z, 0,0,0, TailColour, 0, tv)); + addToBuffer(video::S3DVertex(ax , 0, -bz, 0,0,0, FootColour, 0, tv)); + tv += tvStep; + bz += bzStep; + } + + Buffer->recalculateBoundingBox(); + + Buffer->Material.MaterialType = video::EMT_ONETEXTURE_BLEND; + Buffer->Material.MaterialTypeParam = pack_texureBlendFunc( video::EBF_SRC_COLOR, video::EBF_SRC_ALPHA, video::EMFN_MODULATE_1X ); + + Buffer->Material.Lighting = false; + Buffer->Material.ZWriteEnable = false; + + Buffer->setDirty(EBT_VERTEX_AND_INDEX); +} + + +//! renders the node. +void CVolumeLightSceneNode::render() +{ + if (!Buffer) + return; + + video::IVideoDriver* driver = SceneManager->getVideoDriver(); + driver->setTransform(video::ETS_WORLD, AbsoluteTransformation); + + driver->setMaterial(Buffer->Material); + driver->drawMeshBuffer(Buffer); +} + + +//! returns the axis aligned bounding box of this node +const core::aabbox3d& CVolumeLightSceneNode::getBoundingBox() const +{ + return Buffer->BoundingBox; +} + + +void CVolumeLightSceneNode::OnRegisterSceneNode() +{ + if (IsVisible) + { + SceneManager->registerNodeForRendering(this, ESNRP_TRANSPARENT); + } + ISceneNode::OnRegisterSceneNode(); +} + + +//! returns the material based on the zero based index i. To get the amount +//! of materials used by this scene node, use getMaterialCount(). +//! This function is needed for inserting the node into the scene hirachy on a +//! optimal position for minimizing renderstate changes, but can also be used +//! to directly modify the material of a scene node. +video::SMaterial& CVolumeLightSceneNode::getMaterial(u32 i) +{ + return Buffer->Material; +} + + +//! returns amount of materials used by this scene node. +u32 CVolumeLightSceneNode::getMaterialCount() const +{ + return 1; +} + + +void CVolumeLightSceneNode::setSubDivideU (const u32 inU) +{ + SubdivideU = inU; + constructLight(); +} + + +void CVolumeLightSceneNode::setSubDivideV (const u32 inV) +{ + SubdivideV = inV; + constructLight(); +} + + +void CVolumeLightSceneNode::setFootColour(const video::SColor inColouf) +{ + FootColour = inColouf; + constructLight(); +} + + +void CVolumeLightSceneNode::setTailColour(const video::SColor inColouf) +{ + TailColour = inColouf; + constructLight(); +} + + +//! Writes attributes of the scene node. +void CVolumeLightSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const +{ + ISceneNode::serializeAttributes(out, options); + + out->addFloat("lpDistance", LPDistance); + out->addInt("subDivideU", SubdivideU); + out->addInt("subDivideV", SubdivideV); + + out->addColor("footColour", FootColour); + out->addColor("tailColour", TailColour); + + out->addVector3d("lightDimension", LightDimensions); +} + + +//! Reads attributes of the scene node. +void CVolumeLightSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) +{ + LPDistance = in->getAttributeAsFloat("lpDistance"); + LPDistance = core::max_(LPDistance, 8.0f); + + SubdivideU = in->getAttributeAsInt("subDivideU"); + SubdivideU = core::max_(SubdivideU, 1u); + + SubdivideV = in->getAttributeAsInt("subDivideV"); + SubdivideV = core::max_(SubdivideV, 1u); + + FootColour = in->getAttributeAsColor("footColour"); + TailColour = in->getAttributeAsColor("tailColour"); + + LightDimensions = in->getAttributeAsVector3d("lightDimension"); + + constructLight(); + + ISceneNode::deserializeAttributes(in, options); +} + + +//! Creates a clone of this scene node and its children. +ISceneNode* CVolumeLightSceneNode::clone(ISceneNode* newParent, ISceneManager* newManager) +{ + if (!newParent) + newParent = Parent; + if (!newManager) + newManager = SceneManager; + + CVolumeLightSceneNode* nb = new CVolumeLightSceneNode(newParent, + newManager, ID, SubdivideU, SubdivideV, FootColour, TailColour, RelativeTranslation); + + nb->cloneMembers(this, newManager); + nb->Buffer->Material = Buffer->Material; + + nb->drop(); + return nb; +} + + +} // end namespace scene +} // end namespace irr + diff --git a/src/dep/src/irrlicht/CVolumeLightSceneNode.h b/src/dep/src/irrlicht/CVolumeLightSceneNode.h new file mode 100644 index 0000000..68ade2b --- /dev/null +++ b/src/dep/src/irrlicht/CVolumeLightSceneNode.h @@ -0,0 +1,98 @@ +// Copyright (C) 2002-2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h +// +// created by Dean Wadsworth aka Varmint Dec 31 2007 + +#ifndef __VOLUME_LIGHT_SCENE_NODE_H_INCLUDED__ +#define __VOLUME_LIGHT_SCENE_NODE_H_INCLUDED__ + +#include "IVolumeLightSceneNode.h" +#include "SMeshBuffer.h" + +namespace irr +{ +namespace scene +{ + class CVolumeLightSceneNode : public IVolumeLightSceneNode + { + public: + + //! constructor + CVolumeLightSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id, + const u32 subdivU = 32, const u32 subdivV = 32, + const video::SColor foot = video::SColor(51, 0, 230, 180), + const video::SColor tail = video::SColor(0, 0, 0, 0), + const core::vector3df& position = core::vector3df(0,0,0), + const core::vector3df& rotation = core::vector3df(0,0,0), + const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)); + + virtual ~CVolumeLightSceneNode(); + + virtual void OnRegisterSceneNode(); + + //! renders the node. + virtual void render(); + + //! returns the axis aligned bounding box of this node + virtual const core::aabbox3d& getBoundingBox() const; + + //! returns the material based on the zero based index i. To get the amount + //! of materials used by this scene node, use getMaterialCount(). + //! This function is needed for inserting the node into the scene hirachy on a + //! optimal position for minimizing renderstate changes, but can also be used + //! to directly modify the material of a scene node. + virtual video::SMaterial& getMaterial(u32 i); + + //! returns amount of materials used by this scene node. + virtual u32 getMaterialCount() const; + + //! Returns type of the scene node + virtual ESCENE_NODE_TYPE getType() const { return ESNT_CUBE; } + + //! Writes attributes of the scene node. + virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const; + + //! Reads attributes of the scene node. + virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0); + + //! Creates a clone of this scene node and its children. + virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0); + + virtual void setSubDivideU (const u32 inU); + virtual void setSubDivideV (const u32 inV); + + virtual u32 getSubDivideU () const { return SubdivideU; } + virtual u32 getSubDivideV () const { return SubdivideV; } + + virtual void setFootColour(const video::SColor inColouf); + virtual void setTailColour(const video::SColor inColouf); + + virtual video::SColor getFootColour () const { return FootColour; } + virtual video::SColor getTailColour () const { return TailColour; } + + private: + void addToBuffer(const video::S3DVertex& v); + void constructLight(); + + SMeshBuffer* Buffer; + + f32 LPDistance; // Distance to hypothetical lightsource point -- affects fov angle + + u32 SubdivideU; // Number of subdivisions in U and V space. + u32 SubdivideV; // Controls the number of "slices" in the volume. + // NOTE : Total number of polygons = 2 + ((SubdivideU + 1) + (SubdivideV + 1)) * 2 + // Each slice being a quad plus the rectangular plane at the bottom. + + video::SColor FootColour; // Color at the source + video::SColor TailColour; // Color at the end. + + core::vector3df LightDimensions; // LightDimensions.Y Distance of shooting -- Length of beams + // LightDimensions.X and LightDimensions.Z determine the size/dimension of the plane + }; + +} // end namespace scene +} // end namespace irr + +#endif + diff --git a/src/dep/src/irrlicht/CWaterSurfaceSceneNode.cpp b/src/dep/src/irrlicht/CWaterSurfaceSceneNode.cpp index e03cc9b..c83a2e3 100644 --- a/src/dep/src/irrlicht/CWaterSurfaceSceneNode.cpp +++ b/src/dep/src/irrlicht/CWaterSurfaceSceneNode.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CWaterSurfaceSceneNode.h b/src/dep/src/irrlicht/CWaterSurfaceSceneNode.h index 05c4714..6ccb053 100644 --- a/src/dep/src/irrlicht/CWaterSurfaceSceneNode.h +++ b/src/dep/src/irrlicht/CWaterSurfaceSceneNode.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CWriteFile.cpp b/src/dep/src/irrlicht/CWriteFile.cpp index dc29e16..1dd1f61 100644 --- a/src/dep/src/irrlicht/CWriteFile.cpp +++ b/src/dep/src/irrlicht/CWriteFile.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CWriteFile.h b/src/dep/src/irrlicht/CWriteFile.h index f1add8e..e8dae3a 100644 --- a/src/dep/src/irrlicht/CWriteFile.h +++ b/src/dep/src/irrlicht/CWriteFile.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CXMLReader.cpp b/src/dep/src/irrlicht/CXMLReader.cpp index dac2c7a..6de37ab 100644 --- a/src/dep/src/irrlicht/CXMLReader.cpp +++ b/src/dep/src/irrlicht/CXMLReader.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CXMLReader.h b/src/dep/src/irrlicht/CXMLReader.h index 62c1b90..67005ff 100644 --- a/src/dep/src/irrlicht/CXMLReader.h +++ b/src/dep/src/irrlicht/CXMLReader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CXMLReaderImpl.h b/src/dep/src/irrlicht/CXMLReaderImpl.h index 24f12b1..11594ae 100644 --- a/src/dep/src/irrlicht/CXMLReaderImpl.h +++ b/src/dep/src/irrlicht/CXMLReaderImpl.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine" and the "irrXML" project. // For conditions of distribution and use, see copyright notice in irrlicht.h and/or irrXML.h @@ -555,7 +555,7 @@ private: long size = callback->getSize(); if (size<0) return false; - size += 4; // We need four terminating 0's at the end. + size += 4; // We need two terminating 0's at the end. // For ASCII we need 1 0's, for UTF-16 2, for UTF-32 4. char* data8 = new char[size]; @@ -588,35 +588,35 @@ private: { // UTF-32, big endian SourceFormat = ETF_UTF32_BE; - convertTextData(data32+1, data8, (size/4)-1); // data32+1 because we need to skip the header + convertTextData(data32+1, data8, (size/4)); // data32+1 because we need to skip the header } else if (size >= 4 && data32[0] == (char32)UTF32_LE) { // UTF-32, little endian SourceFormat = ETF_UTF32_LE; - convertTextData(data32+1, data8, (size/4)-1); // data32+1 because we need to skip the header + convertTextData(data32+1, data8, (size/4)); // data32+1 because we need to skip the header } else if (size >= 2 && data16[0] == UTF16_BE) { // UTF-16, big endian SourceFormat = ETF_UTF16_BE; - convertTextData(data16+1, data8, (size/2)-1); // data16+1 because we need to skip the header + convertTextData(data16+1, data8, (size/2)); // data16+1 because we need to skip the header } else if (size >= 2 && data16[0] == UTF16_LE) { // UTF-16, little endian SourceFormat = ETF_UTF16_LE; - convertTextData(data16+1, data8, (size/2)-1); // data16+1 because we need to skip the header + convertTextData(data16+1, data8, (size/2)); // data16+1 because we need to skip the header } else - if (size >= 3 && memcmp(data8,UTF8,3)==0) + if (size >= 3 && data8[0] == UTF8[0] && data8[1] == UTF8[1] && data8[2] == UTF8[2]) { // UTF-8 SourceFormat = ETF_UTF8; - convertTextData(data8+3, data8, size-3); // data8+3 because we need to skip the header + convertTextData(data8+3, data8, size); // data8+3 because we need to skip the header } else { diff --git a/src/dep/src/irrlicht/CXMLWriter.cpp b/src/dep/src/irrlicht/CXMLWriter.cpp index 43dea14..ffc7c4e 100644 --- a/src/dep/src/irrlicht/CXMLWriter.cpp +++ b/src/dep/src/irrlicht/CXMLWriter.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CXMLWriter.h b/src/dep/src/irrlicht/CXMLWriter.h index 0921d36..f3667e0 100644 --- a/src/dep/src/irrlicht/CXMLWriter.h +++ b/src/dep/src/irrlicht/CXMLWriter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CXMeshFileLoader.cpp b/src/dep/src/irrlicht/CXMeshFileLoader.cpp index 21646ee..62a098d 100644 --- a/src/dep/src/irrlicht/CXMeshFileLoader.cpp +++ b/src/dep/src/irrlicht/CXMeshFileLoader.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CXMeshFileLoader.h b/src/dep/src/irrlicht/CXMeshFileLoader.h index b01413d..8c298b9 100644 --- a/src/dep/src/irrlicht/CXMeshFileLoader.h +++ b/src/dep/src/irrlicht/CXMeshFileLoader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CZBuffer.cpp b/src/dep/src/irrlicht/CZBuffer.cpp index 070e9d8..1300bb8 100644 --- a/src/dep/src/irrlicht/CZBuffer.cpp +++ b/src/dep/src/irrlicht/CZBuffer.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CZBuffer.h b/src/dep/src/irrlicht/CZBuffer.h index 29c8845..a1fb11f 100644 --- a/src/dep/src/irrlicht/CZBuffer.h +++ b/src/dep/src/irrlicht/CZBuffer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CZipReader.cpp b/src/dep/src/irrlicht/CZipReader.cpp index 2bb8f1f..d8f43a3 100644 --- a/src/dep/src/irrlicht/CZipReader.cpp +++ b/src/dep/src/irrlicht/CZipReader.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/CZipReader.h b/src/dep/src/irrlicht/CZipReader.h index a6317b4..c206e79 100644 --- a/src/dep/src/irrlicht/CZipReader.h +++ b/src/dep/src/irrlicht/CZipReader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/IBurningShader.cpp b/src/dep/src/irrlicht/IBurningShader.cpp index f3d9ad4..26d9b85 100644 --- a/src/dep/src/irrlicht/IBurningShader.cpp +++ b/src/dep/src/irrlicht/IBurningShader.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/IBurningShader.h b/src/dep/src/irrlicht/IBurningShader.h index 3bdb76b..a9b7976 100644 --- a/src/dep/src/irrlicht/IBurningShader.h +++ b/src/dep/src/irrlicht/IBurningShader.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/IDepthBuffer.h b/src/dep/src/irrlicht/IDepthBuffer.h index e151c15..8110cad 100644 --- a/src/dep/src/irrlicht/IDepthBuffer.h +++ b/src/dep/src/irrlicht/IDepthBuffer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/IImagePresenter.h b/src/dep/src/irrlicht/IImagePresenter.h index 7507713..ef01f69 100644 --- a/src/dep/src/irrlicht/IImagePresenter.h +++ b/src/dep/src/irrlicht/IImagePresenter.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/ITriangleRenderer.h b/src/dep/src/irrlicht/ITriangleRenderer.h index 36f975d..a42cfee 100644 --- a/src/dep/src/irrlicht/ITriangleRenderer.h +++ b/src/dep/src/irrlicht/ITriangleRenderer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/IZBuffer.h b/src/dep/src/irrlicht/IZBuffer.h index 3f171b7..7df7678 100644 --- a/src/dep/src/irrlicht/IZBuffer.h +++ b/src/dep/src/irrlicht/IZBuffer.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/Irrlicht-gcc.cbp b/src/dep/src/irrlicht/Irrlicht-gcc.cbp new file mode 100644 index 0000000..a310b02 --- /dev/null +++ b/src/dep/src/irrlicht/Irrlicht-gcc.cbp @@ -0,0 +1,965 @@ + + + + + + diff --git a/src/dep/src/irrlicht/Irrlicht-gcc.depend b/src/dep/src/irrlicht/Irrlicht-gcc.depend new file mode 100644 index 0000000..ec4cb1c --- /dev/null +++ b/src/dep/src/irrlicht/Irrlicht-gcc.depend @@ -0,0 +1,3934 @@ +# depslib dependency file v1.0 +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\c3dsmeshfileloader.cpp + "IrrCompileConfig.h" + "C3DSMeshFileLoader.h" + "os.h" + "SMeshBuffer.h" + "SAnimatedMesh.h" + "IReadFile.h" + "IVideoDriver.h" + "IMeshManipulator.h" + +1229235366 c:\development\irrlicht-1.5\include\irrcompileconfig.h + + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\c3dsmeshfileloader.h + "IMeshLoader.h" + "IFileSystem.h" + "ISceneManager.h" + "irrString.h" + "SMesh.h" + "matrix4.h" + +1229235366 c:\development\irrlicht-1.5\include\imeshloader.h + "IReferenceCounted.h" + +1229235366 c:\development\irrlicht-1.5\include\ireferencecounted.h + "irrTypes.h" + +1229235367 c:\development\irrlicht-1.5\include\irrtypes.h + "IrrCompileConfig.h" + + + "assert.h" + + + +1229235366 c:\development\irrlicht-1.5\include\ifilesystem.h + "IReferenceCounted.h" + "IXMLReader.h" + "irrString.h" + +1229235366 c:\development\irrlicht-1.5\include\ixmlreader.h + "IReferenceCounted.h" + "irrXML.h" + +1229235366 c:\development\irrlicht-1.5\include\irrxml.h + + "IrrCompileConfig.h" + + + + + + +1229235367 c:\development\irrlicht-1.5\include\irrstring.h + "irrTypes.h" + "irrAllocator.h" + "irrMath.h" + + + + +1229235366 c:\development\irrlicht-1.5\include\irrallocator.h + "irrTypes.h" + + + +1229235366 c:\development\irrlicht-1.5\include\irrmath.h + "IrrCompileConfig.h" + "irrTypes.h" + + + +1229235366 c:\development\irrlicht-1.5\include\iscenemanager.h + "IReferenceCounted.h" + "irrArray.h" + "vector3d.h" + "dimension2d.h" + "SColor.h" + "ETerrainElements.h" + "ESceneNodeTypes.h" + "EMeshWriterEnums.h" + "SceneParameters.h" + +1229235366 c:\development\irrlicht-1.5\include\irrarray.h + "irrTypes.h" + "heapsort.h" + "irrAllocator.h" + +1229235367 c:\development\irrlicht-1.5\include\heapsort.h + "irrTypes.h" + +1229235366 c:\development\irrlicht-1.5\include\vector3d.h + "irrMath.h" + +1229235366 c:\development\irrlicht-1.5\include\dimension2d.h + "irrTypes.h" + +1229235366 c:\development\irrlicht-1.5\include\scolor.h + "irrTypes.h" + "irrMath.h" + +1229235367 c:\development\irrlicht-1.5\include\eterrainelements.h + +1229235366 c:\development\irrlicht-1.5\include\escenenodetypes.h + "irrTypes.h" + +1229235366 c:\development\irrlicht-1.5\include\emeshwriterenums.h + "irrTypes.h" + +1229235366 c:\development\irrlicht-1.5\include\sceneparameters.h + +1229235366 c:\development\irrlicht-1.5\include\smesh.h + "IMesh.h" + "IMeshBuffer.h" + "aabbox3d.h" + "irrArray.h" + +1229235366 c:\development\irrlicht-1.5\include\imesh.h + "IReferenceCounted.h" + "SMaterial.h" + "EHardwareBufferFlags.h" + +1229235366 c:\development\irrlicht-1.5\include\smaterial.h + "SColor.h" + "matrix4.h" + "irrArray.h" + "EMaterialTypes.h" + "EMaterialFlags.h" + "SMaterialLayer.h" + +1229235367 c:\development\irrlicht-1.5\include\matrix4.h + "irrTypes.h" + "vector3d.h" + "vector2d.h" + "plane3d.h" + "aabbox3d.h" + "rect.h" + "irrString.h" + +1229235367 c:\development\irrlicht-1.5\include\vector2d.h + "irrMath.h" + +1229235366 c:\development\irrlicht-1.5\include\plane3d.h + "irrMath.h" + "vector3d.h" + +1229235366 c:\development\irrlicht-1.5\include\aabbox3d.h + "irrMath.h" + "plane3d.h" + "line3d.h" + +1229235366 c:\development\irrlicht-1.5\include\line3d.h + "irrTypes.h" + "vector3d.h" + +1229235367 c:\development\irrlicht-1.5\include\rect.h + "irrTypes.h" + "dimension2d.h" + "position2d.h" + +1229235367 c:\development\irrlicht-1.5\include\position2d.h + "irrTypes.h" + "dimension2d.h" + +1229235367 c:\development\irrlicht-1.5\include\ematerialtypes.h + +1229235366 c:\development\irrlicht-1.5\include\ematerialflags.h + +1229235366 c:\development\irrlicht-1.5\include\smateriallayer.h + "matrix4.h" + "irrAllocator.h" + +1229235367 c:\development\irrlicht-1.5\include\ehardwarebufferflags.h + +1229235366 c:\development\irrlicht-1.5\include\imeshbuffer.h + "IReferenceCounted.h" + "SMaterial.h" + "aabbox3d.h" + "S3DVertex.h" + "SVertexIndex.h" + "EHardwareBufferFlags.h" + +1229235367 c:\development\irrlicht-1.5\include\s3dvertex.h + "vector3d.h" + "vector2d.h" + "SColor.h" + +1229235366 c:\development\irrlicht-1.5\include\svertexindex.h + "irrTypes.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\os.h + "IrrCompileConfig.h" + "irrTypes.h" + "ILogger.h" + +1229235367 c:\development\irrlicht-1.5\include\ilogger.h + "IReferenceCounted.h" + +1229235366 c:\development\irrlicht-1.5\include\smeshbuffer.h + "CMeshBuffer.h" + +1229235366 c:\development\irrlicht-1.5\include\cmeshbuffer.h + "irrArray.h" + "IMeshBuffer.h" + +1229235366 c:\development\irrlicht-1.5\include\sanimatedmesh.h + "IAnimatedMesh.h" + "IMesh.h" + "aabbox3d.h" + "irrArray.h" + +1229235366 c:\development\irrlicht-1.5\include\ianimatedmesh.h + "aabbox3d.h" + "IMesh.h" + +1229235367 c:\development\irrlicht-1.5\include\ireadfile.h + "IReferenceCounted.h" + +1229235366 c:\development\irrlicht-1.5\include\ivideodriver.h + "rect.h" + "SColor.h" + "ITexture.h" + "irrArray.h" + "matrix4.h" + "plane3d.h" + "dimension2d.h" + "position2d.h" + "SMaterial.h" + "IMeshBuffer.h" + "triangle3d.h" + "EDriverTypes.h" + "EDriverFeatures.h" + +1229235366 c:\development\irrlicht-1.5\include\itexture.h + "IReferenceCounted.h" + "IImage.h" + "dimension2d.h" + "EDriverTypes.h" + "irrString.h" + "matrix4.h" + +1229235366 c:\development\irrlicht-1.5\include\iimage.h + "IReferenceCounted.h" + "position2d.h" + "rect.h" + "SColor.h" + +1229235367 c:\development\irrlicht-1.5\include\edrivertypes.h + +1229235366 c:\development\irrlicht-1.5\include\triangle3d.h + "vector3d.h" + "line3d.h" + "plane3d.h" + "aabbox3d.h" + +1229235366 c:\development\irrlicht-1.5\include\edriverfeatures.h + +1229235366 c:\development\irrlicht-1.5\include\imeshmanipulator.h + "IReferenceCounted.h" + "vector3d.h" + "aabbox3d.h" + "matrix4.h" + "IAnimatedMesh.h" + "SColor.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\canimatedmeshmd2.cpp + "IrrCompileConfig.h" + "CAnimatedMeshMD2.h" + "os.h" + "SColor.h" + "IReadFile.h" + "irrMath.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\canimatedmeshmd2.h + "IAnimatedMeshMD2.h" + "IMesh.h" + "CMeshBuffer.h" + "IReadFile.h" + "S3DVertex.h" + "irrArray.h" + "irrString.h" + +1229235366 c:\development\irrlicht-1.5\include\ianimatedmeshmd2.h + "IAnimatedMesh.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\canimatedmeshmd3.cpp + "IrrCompileConfig.h" + "CAnimatedMeshMD3.h" + "os.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\canimatedmeshmd3.h + "IAnimatedMeshMD3.h" + "IReadFile.h" + "IFileSystem.h" + "irrArray.h" + "irrString.h" + "SMesh.h" + "SMeshBuffer.h" + +1229235366 c:\development\irrlicht-1.5\include\ianimatedmeshmd3.h + "IAnimatedMesh.h" + "IQ3Shader.h" + "quaternion.h" + +1229235366 c:\development\irrlicht-1.5\include\iq3shader.h + "irrArray.h" + "fast_atof.h" + "IFileSystem.h" + "IVideoDriver.h" + "coreutil.h" + +1229235366 c:\development\irrlicht-1.5\include\fast_atof.h + + "irrMath.h" + + + +1229235366 c:\development\irrlicht-1.5\include\coreutil.h + "irrString.h" + +1229235366 c:\development\irrlicht-1.5\include\quaternion.h + "irrTypes.h" + "irrMath.h" + "matrix4.h" + "vector3d.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\canimatedmeshscenenode.cpp + "CAnimatedMeshSceneNode.h" + "IVideoDriver.h" + "ISceneManager.h" + "S3DVertex.h" + "os.h" + "CShadowVolumeSceneNode.h" + "IAnimatedMeshMD3.h" + "CSkinnedMesh.h" + "IDummyTransformationSceneNode.h" + "IBoneSceneNode.h" + "IMaterialRenderer.h" + "IMesh.h" + "IMeshCache.h" + "IAnimatedMesh.h" + "quaternion.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\canimatedmeshscenenode.h + "IAnimatedMeshSceneNode.h" + "IAnimatedMesh.h" + "matrix4.h" + +1229235366 c:\development\irrlicht-1.5\include\ianimatedmeshscenenode.h + "ISceneNode.h" + "IBoneSceneNode.h" + "IAnimatedMeshMD2.h" + "IAnimatedMeshMD3.h" + +1229235366 c:\development\irrlicht-1.5\include\iscenenode.h + "IAttributeExchangingObject.h" + "ESceneNodeTypes.h" + "ECullingTypes.h" + "EDebugSceneTypes.h" + "ISceneNodeAnimator.h" + "ITriangleSelector.h" + "SMaterial.h" + "irrString.h" + "aabbox3d.h" + "matrix4.h" + "irrList.h" + "IAttributes.h" + +1229235367 c:\development\irrlicht-1.5\include\iattributeexchangingobject.h + "IReferenceCounted.h" + +1229235366 c:\development\irrlicht-1.5\include\ecullingtypes.h + "irrTypes.h" + +1229235367 c:\development\irrlicht-1.5\include\edebugscenetypes.h + +1229235366 c:\development\irrlicht-1.5\include\iscenenodeanimator.h + "IReferenceCounted.h" + "vector3d.h" + "ESceneNodeAnimatorTypes.h" + "IAttributeExchangingObject.h" + "IEventReceiver.h" + +1229235366 c:\development\irrlicht-1.5\include\escenenodeanimatortypes.h + +1229235366 c:\development\irrlicht-1.5\include\ieventreceiver.h + "ILogger.h" + "position2d.h" + "Keycodes.h" + "irrString.h" + +1229235366 c:\development\irrlicht-1.5\include\keycodes.h + +1229235366 c:\development\irrlicht-1.5\include\itriangleselector.h + "IReferenceCounted.h" + "triangle3d.h" + "aabbox3d.h" + "matrix4.h" + "line3d.h" + +1229235366 c:\development\irrlicht-1.5\include\irrlist.h + "irrTypes.h" + +1229235366 c:\development\irrlicht-1.5\include\iattributes.h + "IReferenceCounted.h" + "SColor.h" + "vector3d.h" + "vector2d.h" + "line2d.h" + "line3d.h" + "triangle3d.h" + "position2d.h" + "rect.h" + "matrix4.h" + "quaternion.h" + "plane3d.h" + "triangle3d.h" + "line2d.h" + "line3d.h" + "irrString.h" + "irrArray.h" + "IXMLReader.h" + +1229235367 c:\development\irrlicht-1.5\include\line2d.h + "irrTypes.h" + "vector2d.h" + +1229235366 c:\development\irrlicht-1.5\include\ibonescenenode.h + "ISceneNode.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cshadowvolumescenenode.h + "IShadowVolumeSceneNode.h" + +1229235366 c:\development\irrlicht-1.5\include\ishadowvolumescenenode.h + "ISceneNode.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cskinnedmesh.h + "ISkinnedMesh.h" + "SMeshBuffer.h" + "S3DVertex.h" + "irrString.h" + "matrix4.h" + "quaternion.h" + +1229235366 c:\development\irrlicht-1.5\include\iskinnedmesh.h + "irrArray.h" + "IBoneSceneNode.h" + "IAnimatedMesh.h" + "SSkinMeshBuffer.h" + +1229235367 c:\development\irrlicht-1.5\include\sskinmeshbuffer.h + "IMeshBuffer.h" + "S3DVertex.h" + +1229235366 c:\development\irrlicht-1.5\include\idummytransformationscenenode.h + "ISceneNode.h" + +1229235366 c:\development\irrlicht-1.5\include\imaterialrenderer.h + "IReferenceCounted.h" + "SMaterial.h" + "S3DVertex.h" + +1229235367 c:\development\irrlicht-1.5\include\imeshcache.h + "IReferenceCounted.h" + "irrString.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\cattributes.cpp + "CAttributes.h" + "CAttributeImpl.h" + "ITexture.h" + "IXMLWriter.h" + "IVideoDriver.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cattributes.h + "IAttributes.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cattributeimpl.h + "CAttributes.h" + "fast_atof.h" + "ITexture.h" + "IVideoDriver.h" + +1229235366 c:\development\irrlicht-1.5\include\ixmlwriter.h + "IReferenceCounted.h" + "irrArray.h" + "irrString.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cb3dmeshfileloader.cpp + "IrrCompileConfig.h" + "CB3DMeshFileLoader.h" + "IVideoDriver.h" + "os.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cb3dmeshfileloader.h + "IrrCompileConfig.h" + "IMeshLoader.h" + "ISceneManager.h" + "CSkinnedMesh.h" + "IReadFile.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cbspmeshfileloader.cpp + "IrrCompileConfig.h" + "CBSPMeshFileLoader.h" + "CQ3LevelMesh.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cbspmeshfileloader.h + "IMeshLoader.h" + "IFileSystem.h" + "IVideoDriver.h" + "ISceneManager.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\cq3levelmesh.h + "IQ3LevelMesh.h" + "IReadFile.h" + "IFileSystem.h" + "SMesh.h" + "SMeshBufferLightMap.h" + "IVideoDriver.h" + "irrString.h" + "ISceneManager.h" + "os.h" + +1229235366 c:\development\irrlicht-1.5\include\iq3levelmesh.h + "IAnimatedMesh.h" + "IQ3Shader.h" + +1229235366 c:\development\irrlicht-1.5\include\smeshbufferlightmap.h + "CMeshBuffer.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cbillboardscenenode.cpp + "CBillboardSceneNode.h" + "IVideoDriver.h" + "ISceneManager.h" + "ICameraSceneNode.h" + "os.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\cbillboardscenenode.h + "IBillboardSceneNode.h" + "S3DVertex.h" + +1229235367 c:\development\irrlicht-1.5\include\ibillboardscenenode.h + "ISceneNode.h" + +1229235367 c:\development\irrlicht-1.5\include\icamerascenenode.h + "ISceneNode.h" + "IEventReceiver.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cbonescenenode.cpp + "IrrCompileConfig.h" + "CBoneSceneNode.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cbonescenenode.h + "IBoneSceneNode.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\cburningshader_raster_reference.cpp + "IrrCompileConfig.h" + "IBurningShader.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\iburningshader.h + "SoftwareDriver2_compile_config.h" + "IReferenceCounted.h" + "irrMath.h" + "IImage.h" + "S2DVertex.h" + "rect.h" + "IDepthBuffer.h" + "S4DVertex.h" + "irrArray.h" + "SLight.h" + "SMaterial.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\softwaredriver2_compile_config.h + "IrrCompileConfig.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\s2dvertex.h + "vector2d.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\idepthbuffer.h + "IReferenceCounted.h" + "dimension2d.h" + "S4DVertex.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\s4dvertex.h + "SoftwareDriver2_compile_config.h" + "SoftwareDriver2_helper.h" + "irrAllocator.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\softwaredriver2_helper.h + "SoftwareDriver2_compile_config.h" + "irrMath.h" + "CSoftwareTexture2.h" + "SMaterial.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\csoftwaretexture2.h + "SoftwareDriver2_compile_config.h" + "ITexture.h" + "CImage.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cimage.h + "IImage.h" + "rect.h" + +1229235366 c:\development\irrlicht-1.5\include\slight.h + "SColor.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\ccsmloader.cpp + "IrrCompileConfig.h" + "CCSMLoader.h" + "os.h" + "IFileSystem.h" + "IReadFile.h" + "ISceneManager.h" + "IAttributes.h" + "SMesh.h" + "IVideoDriver.h" + "SAnimatedMesh.h" + "SMeshBufferLightMap.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\ccsmloader.h + "irrArray.h" + "IMesh.h" + "irrString.h" + "IFileSystem.h" + "IMeshLoader.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\ccamerascenenode.cpp + "CCameraSceneNode.h" + "ISceneManager.h" + "IVideoDriver.h" + "os.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\ccamerascenenode.h + "ICameraSceneNode.h" + "SViewFrustum.h" + +1229235366 c:\development\irrlicht-1.5\include\sviewfrustum.h + "plane3d.h" + "vector3d.h" + "aabbox3d.h" + "matrix4.h" + "IVideoDriver.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\ccolladafileloader.cpp + "IrrCompileConfig.h" + "CColladaFileLoader.h" + "os.h" + "IXMLReader.h" + "IDummyTransformationSceneNode.h" + "SAnimatedMesh.h" + "fast_atof.h" + "quaternion.h" + "ILightSceneNode.h" + "ICameraSceneNode.h" + "IMeshManipulator.h" + "IReadFile.h" + "IAttributes.h" + "IMeshCache.h" + "IMeshSceneNode.h" + "SMeshBufferLightMap.h" + "irrMap.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\ccolladafileloader.h + "IMeshLoader.h" + "IFileSystem.h" + "IVideoDriver.h" + "irrString.h" + "SMesh.h" + "SMeshBuffer.h" + "ISceneManager.h" + "irrMap.h" + "CAttributes.h" + +1229235366 c:\development\irrlicht-1.5\include\irrmap.h + "irrTypes.h" + +1229235366 c:\development\irrlicht-1.5\include\ilightscenenode.h + "ISceneNode.h" + "SLight.h" + +1229235366 c:\development\irrlicht-1.5\include\imeshscenenode.h + "ISceneNode.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\ccolladameshwriter.cpp + "IrrCompileConfig.h" + "CColladaMeshWriter.h" + "os.h" + "IFileSystem.h" + "IWriteFile.h" + "IXMLWriter.h" + "IMesh.h" + "IAttributes.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\ccolladameshwriter.h + "IMeshWriter.h" + "S3DVertex.h" + "IVideoDriver.h" + +1229235366 c:\development\irrlicht-1.5\include\imeshwriter.h + "IReferenceCounted.h" + "EMeshWriterEnums.h" + +1229235367 c:\development\irrlicht-1.5\include\iwritefile.h + "IReferenceCounted.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\ccolorconverter.cpp + "CColorConverter.h" + "SColor.h" + "os.h" + "irrString.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\ccolorconverter.h + "irrTypes.h" + "IImage.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\ccubescenenode.cpp + "CCubeSceneNode.h" + "IVideoDriver.h" + "ISceneManager.h" + "S3DVertex.h" + "SMeshBuffer.h" + "os.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\ccubescenenode.h + "IMeshSceneNode.h" + "SMesh.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cd3d8driver.cpp + "IrrCompileConfig.h" + "CD3D8Driver.h" + "os.h" + "S3DVertex.h" + "CD3D8Texture.h" + "CImage.h" + "CD3D8MaterialRenderer.h" + "CD3D8ShaderMaterialRenderer.h" + "CD3D8NormalMapRenderer.h" + "CD3D8ParallaxMapRenderer.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cd3d8driver.h + "IrrCompileConfig.h" + + + "CNullDriver.h" + "IMaterialRendererServices.h" + + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cnulldriver.h + "IVideoDriver.h" + "IFileSystem.h" + "IImagePresenter.h" + "IGPUProgrammingServices.h" + "irrArray.h" + "irrString.h" + "irrMap.h" + "IAttributes.h" + "IMeshBuffer.h" + "CFPSCounter.h" + "S3DVertex.h" + "SVertexIndex.h" + "SLight.h" + "SExposedVideoData.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\iimagepresenter.h + "IImage.h" + +1229235366 c:\development\irrlicht-1.5\include\igpuprogrammingservices.h + "IReferenceCounted.h" + "SMaterial.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cfpscounter.h + "irrTypes.h" + +1229235366 c:\development\irrlicht-1.5\include\sexposedvideodata.h + +1229235367 c:\development\irrlicht-1.5\include\imaterialrendererservices.h + "IReferenceCounted.h" + "SMaterial.h" + "S3DVertex.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\cd3d8texture.h + "IrrCompileConfig.h" + "ITexture.h" + "IImage.h" + + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cd3d8materialrenderer.h + "IrrCompileConfig.h" + + "IMaterialRenderer.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cd3d8shadermaterialrenderer.h + "IrrCompileConfig.h" + + + "IMaterialRenderer.h" + "S3DVertex.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cd3d8normalmaprenderer.h + "IrrCompileConfig.h" + + "CD3D8ShaderMaterialRenderer.h" + "IShaderConstantSetCallBack.h" + +1229235367 c:\development\irrlicht-1.5\include\ishaderconstantsetcallback.h + "IReferenceCounted.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cd3d8parallaxmaprenderer.h + "IrrCompileConfig.h" + + "CD3D8ShaderMaterialRenderer.h" + "IShaderConstantSetCallBack.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cd3d8normalmaprenderer.cpp + "IrrCompileConfig.h" + "CD3D8NormalMapRenderer.h" + "IMaterialRendererServices.h" + "IVideoDriver.h" + "os.h" + "SLight.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cd3d8parallaxmaprenderer.cpp + "IrrCompileConfig.h" + "CD3D8ParallaxMapRenderer.h" + "IMaterialRendererServices.h" + "IVideoDriver.h" + "os.h" + "SLight.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cd3d8shadermaterialrenderer.cpp + "CD3D8ShaderMaterialRenderer.h" + "IrrCompileConfig.h" + + + "IShaderConstantSetCallBack.h" + "IMaterialRendererServices.h" + "IVideoDriver.h" + "os.h" + + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cd3d8texture.cpp + "IrrCompileConfig.h" + "CD3D8Texture.h" + "CD3D8Driver.h" + "os.h" + + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\cd3d9driver.cpp + "CD3D9Driver.h" + "os.h" + "S3DVertex.h" + "CD3D9Texture.h" + "CImage.h" + "CD3D9MaterialRenderer.h" + "CD3D9ShaderMaterialRenderer.h" + "CD3D9NormalMapRenderer.h" + "CD3D9ParallaxMapRenderer.h" + "CD3D9HLSLMaterialRenderer.h" + + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cd3d9driver.h + "IrrCompileConfig.h" + + "CNullDriver.h" + "IMaterialRendererServices.h" + + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cd3d9texture.h + "IrrCompileConfig.h" + "ITexture.h" + "IImage.h" + + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cd3d9materialrenderer.h + "IrrCompileConfig.h" + + "IMaterialRenderer.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cd3d9shadermaterialrenderer.h + "IrrCompileConfig.h" + + + "IMaterialRenderer.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cd3d9normalmaprenderer.h + "IrrCompileConfig.h" + + "CD3D9ShaderMaterialRenderer.h" + "IShaderConstantSetCallBack.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cd3d9parallaxmaprenderer.h + "IrrCompileConfig.h" + + "CD3D9ShaderMaterialRenderer.h" + "IShaderConstantSetCallBack.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cd3d9hlslmaterialrenderer.h + "IrrCompileConfig.h" + "CD3D9ShaderMaterialRenderer.h" + "IGPUProgrammingServices.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\cd3d9hlslmaterialrenderer.cpp + "IrrCompileConfig.h" + "CD3D9HLSLMaterialRenderer.h" + "IShaderConstantSetCallBack.h" + "IVideoDriver.h" + "os.h" + "irrString.h" + + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cd3d9normalmaprenderer.cpp + "IrrCompileConfig.h" + "CD3D9NormalMapRenderer.h" + "IVideoDriver.h" + "IMaterialRendererServices.h" + "os.h" + "SLight.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\cd3d9parallaxmaprenderer.cpp + "IrrCompileConfig.h" + "CD3D9ParallaxMapRenderer.h" + "IMaterialRendererServices.h" + "IVideoDriver.h" + "os.h" + "SLight.h" + "CReadFile.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\creadfile.h + + "IReadFile.h" + "irrString.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\cd3d9shadermaterialrenderer.cpp + "IrrCompileConfig.h" + "CD3D9ShaderMaterialRenderer.h" + "IShaderConstantSetCallBack.h" + "IMaterialRendererServices.h" + "IVideoDriver.h" + "os.h" + "irrString.h" + + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\cd3d9texture.cpp + "IrrCompileConfig.h" + "CD3D9Texture.h" + "CD3D9Driver.h" + "os.h" + + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cdmfloader.cpp + "IrrCompileConfig.h" + "os.h" + "CDMFLoader.h" + "ISceneManager.h" + "IAttributes.h" + "SAnimatedMesh.h" + "SMeshBufferLightMap.h" + "irrString.h" + "irrMath.h" + "dmfsupport.h" + "CImage.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cdmfloader.h + "IMeshLoader.h" + "IReadFile.h" + "IFileSystem.h" + "SMesh.h" + "IVideoDriver.h" + "ISceneManager.h" + "SAnimatedMesh.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\dmfsupport.h + "irrString.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cdefaultguielementfactory.cpp + "CDefaultGUIElementFactory.h" + "IGUIEnvironment.h" + "IGUIButton.h" + "IGUICheckBox.h" + "IGUIColorSelectDialog.h" + "IGUIComboBox.h" + "IGUIContextMenu.h" + "IGUIEditBox.h" + "IGUIFileOpenDialog.h" + "IGUIInOutFader.h" + "IGUIImage.h" + "IGUIListBox.h" + "IGUIMeshViewer.h" + "IGUIScrollBar.h" + "IGUISpinBox.h" + "IGUIStaticText.h" + "IGUITabControl.h" + "IGUITable.h" + "IGUIToolbar.h" + "IGUIWindow.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cdefaultguielementfactory.h + "IrrCompileConfig.h" + "IGUIElementFactory.h" + +1229235367 c:\development\irrlicht-1.5\include\iguielementfactory.h + "IReferenceCounted.h" + "EGUIElementTypes.h" + +1229235367 c:\development\irrlicht-1.5\include\eguielementtypes.h + "irrTypes.h" + +1229235366 c:\development\irrlicht-1.5\include\iguienvironment.h + "IReferenceCounted.h" + "IGUISkin.h" + "rect.h" + "EMessageBoxFlags.h" + "IEventReceiver.h" + "IXMLReader.h" + +1229235366 c:\development\irrlicht-1.5\include\iguiskin.h + "IAttributeExchangingObject.h" + "EGUIAlignment.h" + "SColor.h" + "rect.h" + +1229235366 c:\development\irrlicht-1.5\include\eguialignment.h + +1229235366 c:\development\irrlicht-1.5\include\emessageboxflags.h + +1229235367 c:\development\irrlicht-1.5\include\iguibutton.h + "IGUIElement.h" + +1229235367 c:\development\irrlicht-1.5\include\iguielement.h + "IAttributeExchangingObject.h" + "irrList.h" + "rect.h" + "irrString.h" + "IEventReceiver.h" + "EGUIElementTypes.h" + "EGUIAlignment.h" + "IAttributes.h" + +1229235366 c:\development\irrlicht-1.5\include\iguicheckbox.h + "IGUIElement.h" + +1229235366 c:\development\irrlicht-1.5\include\iguicolorselectdialog.h + "IGUIElement.h" + +1229235366 c:\development\irrlicht-1.5\include\iguicombobox.h + "IGUIElement.h" + +1229235367 c:\development\irrlicht-1.5\include\iguicontextmenu.h + "IGUIElement.h" + +1229235366 c:\development\irrlicht-1.5\include\iguieditbox.h + "IGUIElement.h" + "SColor.h" + +1229235366 c:\development\irrlicht-1.5\include\iguifileopendialog.h + "IGUIElement.h" + +1229235367 c:\development\irrlicht-1.5\include\iguiinoutfader.h + "IGUIElement.h" + "SColor.h" + +1229235366 c:\development\irrlicht-1.5\include\iguiimage.h + "IGUIElement.h" + +1229235366 c:\development\irrlicht-1.5\include\iguilistbox.h + "IGUIElement.h" + "SColor.h" + +1229235367 c:\development\irrlicht-1.5\include\iguimeshviewer.h + "IGUIElement.h" + +1229235366 c:\development\irrlicht-1.5\include\iguiscrollbar.h + "IGUIElement.h" + +1229235367 c:\development\irrlicht-1.5\include\iguispinbox.h + "IGUIElement.h" + +1229235366 c:\development\irrlicht-1.5\include\iguistatictext.h + "IGUIElement.h" + "SColor.h" + +1229235367 c:\development\irrlicht-1.5\include\iguitabcontrol.h + "IGUIElement.h" + "SColor.h" + "IGUISkin.h" + +1229235367 c:\development\irrlicht-1.5\include\iguitable.h + "IGUIElement.h" + "irrTypes.h" + "SColor.h" + "IGUISkin.h" + +1229235366 c:\development\irrlicht-1.5\include\iguitoolbar.h + "IGUIElement.h" + +1229235367 c:\development\irrlicht-1.5\include\iguiwindow.h + "IGUIElement.h" + "EMessageBoxFlags.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cdefaultscenenodeanimatorfactory.cpp + "CDefaultSceneNodeAnimatorFactory.h" + "CSceneNodeAnimatorCameraFPS.h" + "CSceneNodeAnimatorCameraMaya.h" + "ICursorControl.h" + "ISceneNodeAnimatorCollisionResponse.h" + "ISceneManager.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cdefaultscenenodeanimatorfactory.h + "ISceneNodeAnimatorFactory.h" + +1229235366 c:\development\irrlicht-1.5\include\iscenenodeanimatorfactory.h + "IReferenceCounted.h" + "ESceneNodeAnimatorTypes.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cscenenodeanimatorcamerafps.h + "ISceneNodeAnimatorCameraFPS.h" + "vector2d.h" + "SKeyMap.h" + "irrArray.h" + +1229235366 c:\development\irrlicht-1.5\include\iscenenodeanimatorcamerafps.h + "ISceneNodeAnimator.h" + "IEventReceiver.h" + +1229235367 c:\development\irrlicht-1.5\include\skeymap.h + "Keycodes.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cscenenodeanimatorcameramaya.h + "ISceneNodeAnimatorCameraMaya.h" + "ICameraSceneNode.h" + "vector2d.h" + +1229235367 c:\development\irrlicht-1.5\include\iscenenodeanimatorcameramaya.h + "ISceneNodeAnimator.h" + +1229235366 c:\development\irrlicht-1.5\include\icursorcontrol.h + "IReferenceCounted.h" + "position2d.h" + "rect.h" + +1229235366 c:\development\irrlicht-1.5\include\iscenenodeanimatorcollisionresponse.h + "ISceneNode.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\cdefaultscenenodefactory.cpp + "CDefaultSceneNodeFactory.h" + "ISceneManager.h" + "ITextSceneNode.h" + "ITerrainSceneNode.h" + "IDummyTransformationSceneNode.h" + "ICameraSceneNode.h" + "IBillboardSceneNode.h" + "IAnimatedMeshSceneNode.h" + "IParticleSystemSceneNode.h" + "ILightSceneNode.h" + "IMeshSceneNode.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cdefaultscenenodefactory.h + "ISceneNodeFactory.h" + "irrArray.h" + "irrString.h" + +1229235367 c:\development\irrlicht-1.5\include\iscenenodefactory.h + "IReferenceCounted.h" + "ESceneNodeTypes.h" + +1229235366 c:\development\irrlicht-1.5\include\itextscenenode.h + "ISceneNode.h" + +1229235366 c:\development\irrlicht-1.5\include\iterrainscenenode.h + "ETerrainElements.h" + "ISceneNode.h" + "IDynamicMeshBuffer.h" + "irrArray.h" + +1229235366 c:\development\irrlicht-1.5\include\idynamicmeshbuffer.h + "IMeshBuffer.h" + "IVertexBuffer.h" + "IIndexBuffer.h" + +1229235366 c:\development\irrlicht-1.5\include\ivertexbuffer.h + "IReferenceCounted.h" + "irrArray.h" + "S3DVertex.h" + +1229235366 c:\development\irrlicht-1.5\include\iindexbuffer.h + "IReferenceCounted.h" + "irrArray.h" + "SVertexIndex.h" + +1229235366 c:\development\irrlicht-1.5\include\iparticlesystemscenenode.h + "ISceneNode.h" + "IParticleAnimatedMeshSceneNodeEmitter.h" + "IParticleBoxEmitter.h" + "IParticleCylinderEmitter.h" + "IParticleMeshEmitter.h" + "IParticleRingEmitter.h" + "IParticleSphereEmitter.h" + "IParticleAttractionAffector.h" + "IParticleFadeOutAffector.h" + "IParticleGravityAffector.h" + "IParticleRotationAffector.h" + "dimension2d.h" + +1229235366 c:\development\irrlicht-1.5\include\iparticleanimatedmeshscenenodeemitter.h + "IParticleEmitter.h" + "IAnimatedMeshSceneNode.h" + +1229235367 c:\development\irrlicht-1.5\include\iparticleemitter.h + "IAttributeExchangingObject.h" + "SParticle.h" + +1229235366 c:\development\irrlicht-1.5\include\sparticle.h + "vector3d.h" + "dimension2d.h" + "SColor.h" + +1229235366 c:\development\irrlicht-1.5\include\iparticleboxemitter.h + "IParticleEmitter.h" + "aabbox3d.h" + +1229235366 c:\development\irrlicht-1.5\include\iparticlecylinderemitter.h + "IParticleEmitter.h" + +1229235366 c:\development\irrlicht-1.5\include\iparticlemeshemitter.h + "IParticleEmitter.h" + "IMesh.h" + +1229235367 c:\development\irrlicht-1.5\include\iparticleringemitter.h + "IParticleEmitter.h" + +1229235366 c:\development\irrlicht-1.5\include\iparticlesphereemitter.h + "IParticleEmitter.h" + +1229235366 c:\development\irrlicht-1.5\include\iparticleattractionaffector.h + "IParticleAffector.h" + +1229235367 c:\development\irrlicht-1.5\include\iparticleaffector.h + "IAttributeExchangingObject.h" + "SParticle.h" + +1229235366 c:\development\irrlicht-1.5\include\iparticlefadeoutaffector.h + "IParticleAffector.h" + +1229235367 c:\development\irrlicht-1.5\include\iparticlegravityaffector.h + "IParticleAffector.h" + +1229235367 c:\development\irrlicht-1.5\include\iparticlerotationaffector.h + "IParticleAffector.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\cdepthbuffer.cpp + "IrrCompileConfig.h" + "SoftwareDriver2_compile_config.h" + "CDepthBuffer.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cdepthbuffer.h + "IDepthBuffer.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cdummytransformationscenenode.cpp + "CDummyTransformationSceneNode.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\cdummytransformationscenenode.h + "IDummyTransformationSceneNode.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cemptyscenenode.cpp + "CEmptySceneNode.h" + "ISceneManager.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cemptyscenenode.h + "ISceneNode.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cfpscounter.cpp + "CFPSCounter.h" + "irrMath.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cfilelist.cpp + "CFileList.h" + "IrrCompileConfig.h" + "irrArray.h" + + + + + + + + + + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cfilelist.h + "IFileList.h" + "irrString.h" + "irrArray.h" + +1229235366 c:\development\irrlicht-1.5\include\ifilelist.h + "IReferenceCounted.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cfilesystem.cpp + "CFileSystem.h" + "IReadFile.h" + "IWriteFile.h" + "CZipReader.h" + "CPakReader.h" + "CFileList.h" + "CXMLReader.h" + "CXMLWriter.h" + "stdio.h" + "os.h" + "IrrCompileConfig.h" + "CAttributes.h" + "CMemoryReadFile.h" + + + + + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cfilesystem.h + "IFileSystem.h" + "irrArray.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\czipreader.h + "IReferenceCounted.h" + "IReadFile.h" + "irrArray.h" + "irrString.h" + "IFileSystem.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\cpakreader.h + "IReferenceCounted.h" + "IReadFile.h" + "irrArray.h" + "irrString.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cxmlreader.h + "IXMLReader.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cxmlwriter.h + + "IXMLWriter.h" + "IWriteFile.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cmemoryreadfile.h + "IReadFile.h" + "irrString.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cguibutton.cpp + "CGUIButton.h" + "IGUISkin.h" + "IGUIEnvironment.h" + "IVideoDriver.h" + "IGUIFont.h" + "os.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cguibutton.h + "IrrCompileConfig.h" + "IGUIButton.h" + "IGUISpriteBank.h" + "SColor.h" + +1229235366 c:\development\irrlicht-1.5\include\iguispritebank.h + "IReferenceCounted.h" + "irrArray.h" + "SColor.h" + "rect.h" + +1229235367 c:\development\irrlicht-1.5\include\iguifont.h + "IReferenceCounted.h" + "SColor.h" + "rect.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cguicheckbox.cpp + "CGUICheckBox.h" + "IGUISkin.h" + "IGUIEnvironment.h" + "IVideoDriver.h" + "IGUIFont.h" + "os.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cguicheckbox.h + "IrrCompileConfig.h" + "IGUICheckBox.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cguicolorselectdialog.cpp + "CGUIColorSelectDialog.h" + "IGUISkin.h" + "IGUIEnvironment.h" + "IVideoDriver.h" + "IGUIButton.h" + "IGUIStaticText.h" + "IGUIFont.h" + "IGUISpriteBank.h" + "IFileList.h" + "os.h" + "SoftwareDriver2_helper.h" + "CImage.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cguicolorselectdialog.h + "IrrCompileConfig.h" + "IGUIColorSelectDialog.h" + "IGUIButton.h" + "IGUIEditBox.h" + "IGUIScrollBar.h" + "IGUIImage.h" + "irrArray.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cguicombobox.cpp + "CGUIComboBox.h" + "IGUIEnvironment.h" + "IVideoDriver.h" + "IGUISkin.h" + "IGUIEnvironment.h" + "IGUIFont.h" + "IGUIButton.h" + "CGUIListBox.h" + "os.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cguicombobox.h + "IrrCompileConfig.h" + "IGUIComboBox.h" + "IGUIStaticText.h" + "irrString.h" + "irrArray.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cguilistbox.h + "IrrCompileConfig.h" + "IGUIListBox.h" + "irrArray.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\cguicontextmenu.cpp + "CGUIContextMenu.h" + "IGUISkin.h" + "IGUIEnvironment.h" + "IVideoDriver.h" + "IGUIFont.h" + "IGUISpriteBank.h" + "os.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cguicontextmenu.h + "IrrCompileConfig.h" + "IGUIContextMenu.h" + "irrString.h" + "irrArray.h" + "IGUIFont.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cguieditbox.cpp + "CGUIEditBox.h" + "IGUISkin.h" + "IGUIEnvironment.h" + "IGUIFont.h" + "IVideoDriver.h" + "rect.h" + "os.h" + "Keycodes.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cguieditbox.h + "IrrCompileConfig.h" + "IGUIEditBox.h" + "irrArray.h" + "IOSOperator.h" + +1229235367 c:\development\irrlicht-1.5\include\iosoperator.h + "IReferenceCounted.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cguienvironment.cpp + "CGUIEnvironment.h" + "IVideoDriver.h" + "CGUISkin.h" + "CGUIButton.h" + "CGUIWindow.h" + "CGUIScrollBar.h" + "CGUIFont.h" + "CGUISpriteBank.h" + "CGUIImage.h" + "CGUIMeshViewer.h" + "CGUICheckBox.h" + "CGUIListBox.h" + "CGUIFileOpenDialog.h" + "CGUIColorSelectDialog.h" + "CGUIStaticText.h" + "CGUIEditBox.h" + "CGUISpinBox.h" + "CGUIInOutFader.h" + "CGUIMessageBox.h" + "CGUIModalScreen.h" + "CGUITabControl.h" + "CGUIContextMenu.h" + "CGUIComboBox.h" + "CGUIMenu.h" + "CGUIToolBar.h" + "CGUITable.h" + "CDefaultGUIElementFactory.h" + "IWriteFile.h" + "IXMLWriter.h" + "BuiltInFont.h" + "os.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cguienvironment.h + "IrrCompileConfig.h" + "IGUIEnvironment.h" + "IGUIElement.h" + "irrArray.h" + "IFileSystem.h" + "IOSOperator.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\cguiskin.h + "IrrCompileConfig.h" + "IGUISkin.h" + "irrString.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cguiwindow.h + "IrrCompileConfig.h" + "IGUIWindow.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cguiscrollbar.h + "IrrCompileConfig.h" + "IGUIScrollBar.h" + "IGUIButton.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cguifont.h + "IrrCompileConfig.h" + "IGUIFontBitmap.h" + "irrString.h" + "irrMap.h" + "IXMLReader.h" + "IReadFile.h" + "irrArray.h" + +1229235367 c:\development\irrlicht-1.5\include\iguifontbitmap.h + "IGUIFont.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cguispritebank.h + "IrrCompileConfig.h" + "IGUISpriteBank.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cguiimage.h + "IrrCompileConfig.h" + "IGUIImage.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cguimeshviewer.h + "IrrCompileConfig.h" + "IGUIMeshViewer.h" + "SMaterial.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\cguifileopendialog.h + "IrrCompileConfig.h" + "IGUIFileOpenDialog.h" + "IGUIButton.h" + "IGUIListBox.h" + "IFileSystem.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cguistatictext.h + "IrrCompileConfig.h" + "IGUIStaticText.h" + "irrArray.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cguispinbox.h + "IrrCompileConfig.h" + "IGUISpinBox.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cguiinoutfader.h + "IrrCompileConfig.h" + "IGUIInOutFader.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cguimessagebox.h + "IrrCompileConfig.h" + "CGUIWindow.h" + "IGUIStaticText.h" + "irrArray.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cguimodalscreen.h + "IrrCompileConfig.h" + "IGUIElement.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cguitabcontrol.h + "IrrCompileConfig.h" + "IGUITabControl.h" + "irrArray.h" + "IGUISkin.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cguimenu.h + "IrrCompileConfig.h" + "CGUIContextMenu.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cguitoolbar.h + "IrrCompileConfig.h" + "IGUIToolbar.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cguitable.h + "IrrCompileConfig.h" + "IGUITable.h" + "irrArray.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\builtinfont.h + "IrrCompileConfig.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cguifileopendialog.cpp + "CGUIFileOpenDialog.h" + "IGUISkin.h" + "IGUIEnvironment.h" + "IVideoDriver.h" + "IGUIButton.h" + "IGUIStaticText.h" + "IGUIFont.h" + "IGUIFontBitmap.h" + "IFileList.h" + "os.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\cguifont.cpp + "CGUIFont.h" + "os.h" + "IGUIEnvironment.h" + "IXMLReader.h" + "IReadFile.h" + "IVideoDriver.h" + "IGUISpriteBank.h" + "CImage.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\cguiimage.cpp + "CGUIImage.h" + "IGUISkin.h" + "IGUIEnvironment.h" + "IVideoDriver.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\cguiinoutfader.cpp + "CGUIInOutFader.h" + "IGUIEnvironment.h" + "IVideoDriver.h" + "os.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cguilistbox.cpp + "CGUIListBox.h" + "CGUIListBox.h" + "IGUISkin.h" + "IGUIEnvironment.h" + "IVideoDriver.h" + "IGUIFont.h" + "IGUISpriteBank.h" + "CGUIScrollBar.h" + "os.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cguimenu.cpp + "CGUIMenu.h" + "IGUISkin.h" + "IGUIEnvironment.h" + "IVideoDriver.h" + "IGUIFont.h" + "os.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cguimeshviewer.cpp + "CGUIMeshViewer.h" + "IGUIEnvironment.h" + "IVideoDriver.h" + "IAnimatedMesh.h" + "IMesh.h" + "os.h" + "IGUISkin.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cguimessagebox.cpp + "CGUIMessageBox.h" + "IGUISkin.h" + "IGUIEnvironment.h" + "IGUIButton.h" + "IGUIFont.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\cguimodalscreen.cpp + "CGUIModalScreen.h" + "IGUIEnvironment.h" + "os.h" + "IVideoDriver.h" + "IGUISkin.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cguiscrollbar.cpp + "CGUIScrollBar.h" + "IGUISkin.h" + "IGUIEnvironment.h" + "IVideoDriver.h" + "CGUIButton.h" + "IGUIFont.h" + "IGUIFontBitmap.h" + "os.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\cguiskin.cpp + "CGUISkin.h" + "IGUIFont.h" + "IGUISpriteBank.h" + "IVideoDriver.h" + "IAttributes.h" + "SoftwareDriver2_helper.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cguispinbox.cpp + "CGUISpinBox.h" + "CGUIEditBox.h" + "CGUIButton.h" + "IGUIEnvironment.h" + "IEventReceiver.h" + "fast_atof.h" + + + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\cguispritebank.cpp + "CGUISpriteBank.h" + "IGUIEnvironment.h" + "IVideoDriver.h" + "ITexture.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\cguistatictext.cpp + "CGUIStaticText.h" + "IGUISkin.h" + "IGUIEnvironment.h" + "IGUIFont.h" + "IVideoDriver.h" + "rect.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cguitabcontrol.cpp + "CGUITabControl.h" + "CGUIButton.h" + "IGUISkin.h" + "IGUIEnvironment.h" + "IGUIFont.h" + "IVideoDriver.h" + "rect.h" + "os.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\cguitable.cpp + "CGUITable.h" + "IGUISkin.h" + "IGUIEnvironment.h" + "IVideoDriver.h" + "IGUIFont.h" + "CGUIScrollBar.h" + "os.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cguitoolbar.cpp + "CGUIToolBar.h" + "IGUISkin.h" + "IGUIEnvironment.h" + "IVideoDriver.h" + "IGUIButton.h" + "IGUIFont.h" + "CGUIButton.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cguiwindow.cpp + "CGUIWindow.h" + "IGUISkin.h" + "IGUIEnvironment.h" + "IVideoDriver.h" + "IGUIButton.h" + "IGUIFont.h" + "IGUIFontBitmap.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cgeometrycreator.cpp + "CGeometryCreator.h" + "SAnimatedMesh.h" + "SMeshBuffer.h" + "SMesh.h" + "IMesh.h" + "IVideoDriver.h" + "CImage.h" + "os.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cgeometrycreator.h + "IMesh.h" + "IImage.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\cimage.cpp + "CImage.h" + "irrString.h" + "SoftwareDriver2_helper.h" + "CColorConverter.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cimageloaderbmp.cpp + "CImageLoaderBMP.h" + "IReadFile.h" + "SColor.h" + "CColorConverter.h" + "CImage.h" + "os.h" + "irrString.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cimageloaderbmp.h + "IrrCompileConfig.h" + "IImageLoader.h" + +1229235367 c:\development\irrlicht-1.5\include\iimageloader.h + "IReferenceCounted.h" + "IImage.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\cimageloaderjpg.cpp + "CImageLoaderJPG.h" + "IReadFile.h" + "CImage.h" + "os.h" + "irrString.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cimageloaderjpg.h + "IrrCompileConfig.h" + "IImageLoader.h" + + + "jpeglib/jpeglib.h" + + +1229235350 c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jpeglib.h + "jconfig.h" + "jmorecfg.h" + "jpegint.h" + "jerror.h" + +1229235351 c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jconfig.h + +1229235350 c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jmorecfg.h + +1229235350 c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jpegint.h + +1229235351 c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jerror.h + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cimageloaderpcx.cpp + "CImageLoaderPCX.h" + "IReadFile.h" + "SColor.h" + "CColorConverter.h" + "CImage.h" + "os.h" + "irrString.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\cimageloaderpcx.h + "IrrCompileConfig.h" + "IImageLoader.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cimageloaderpng.cpp + "CImageLoaderPNG.h" + + "libpng/png.h" + "CImage.h" + "CReadFile.h" + "os.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cimageloaderpng.h + "IrrCompileConfig.h" + "IImageLoader.h" + +1229235343 c:\development\irrlicht-1.5\source\irrlicht\libpng\png.h + "zlib.h" + "pngconf.h" + + +1229235346 c:\development\irrlicht-1.5\source\irrlicht\zlib\zlib.h + "zconf.h" + +1229235346 c:\development\irrlicht-1.5\source\irrlicht\zlib\zconf.h + + + + + +1229235343 c:\development\irrlicht-1.5\source\irrlicht\libpng\pngconf.h + "pngusr.h" + "config.h" + + + + + + + + + + + + + + + + + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cimageloaderppm.cpp + "CImageLoaderPPM.h" + "IReadFile.h" + "CColorConverter.h" + "CImage.h" + "os.h" + "fast_atof.h" + "coreutil.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cimageloaderppm.h + "IrrCompileConfig.h" + "IImageLoader.h" + "irrString.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cimageloaderpsd.cpp + "CImageLoaderPSD.h" + "IReadFile.h" + "os.h" + "CImage.h" + "irrString.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cimageloaderpsd.h + "IrrCompileConfig.h" + "IImageLoader.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cimageloadertga.cpp + "CImageLoaderTGA.h" + "IReadFile.h" + "os.h" + "CColorConverter.h" + "CImage.h" + "irrString.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cimageloadertga.h + "IrrCompileConfig.h" + "IImageLoader.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cimageloaderwal.cpp + "CImageLoaderWAL.h" + "CColorConverter.h" + "CImage.h" + "os.h" + "dimension2d.h" + "IVideoDriver.h" + "IFileSystem.h" + "IReadFile.h" + "irrString.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cimageloaderwal.h + "IImageLoader.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cimagewriterbmp.cpp + "CImageWriterBMP.h" + "CImageLoaderBMP.h" + "IWriteFile.h" + "CColorConverter.h" + "irrString.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\cimagewriterbmp.h + "IrrCompileConfig.h" + "IImageWriter.h" + +1229235367 c:\development\irrlicht-1.5\include\iimagewriter.h + "IReferenceCounted.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cimagewriterjpg.cpp + "CImageWriterJPG.h" + "CColorConverter.h" + "IWriteFile.h" + "CImage.h" + "irrString.h" + + + + "jpeglib/jpeglib.h" + "jpeglib/jerror.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cimagewriterjpg.h + "IrrCompileConfig.h" + "IImageWriter.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\cimagewriterpcx.cpp + "CImageWriterPCX.h" + "CImageLoaderPCX.h" + "IWriteFile.h" + "os.h" + "irrString.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cimagewriterpcx.h + "IrrCompileConfig.h" + "IImageWriter.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\cimagewriterpng.cpp + "CImageWriterPNG.h" + "CImageLoaderPNG.h" + "CColorConverter.h" + "IWriteFile.h" + "irrString.h" + "os.h" + + "libpng/png.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cimagewriterpng.h + "IrrCompileConfig.h" + "IImageWriter.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\cimagewriterppm.cpp + "CImageWriterPPM.h" + "IWriteFile.h" + "IImage.h" + "dimension2d.h" + "irrString.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cimagewriterppm.h + "IrrCompileConfig.h" + "IImageWriter.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\cimagewriterpsd.cpp + "CImageWriterPSD.h" + "CImageLoaderPSD.h" + "IWriteFile.h" + "os.h" + "irrString.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cimagewriterpsd.h + "IrrCompileConfig.h" + "IImageWriter.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cimagewritertga.cpp + "CImageWriterTGA.h" + "CImageLoaderTGA.h" + "IWriteFile.h" + "CColorConverter.h" + "irrString.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cimagewritertga.h + "IrrCompileConfig.h" + "IImageWriter.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cirrdevicelinux.cpp + "CIrrDeviceLinux.h" + + + + + "IEventReceiver.h" + "os.h" + "CTimer.h" + "irrString.h" + "Keycodes.h" + "COSOperator.h" + "CColorConverter.h" + "SIrrCreationParameters.h" + + + + + + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cirrdevicelinux.h + "IrrCompileConfig.h" + "CIrrDeviceStub.h" + "IrrlichtDevice.h" + "IImagePresenter.h" + "ICursorControl.h" + + + "glxext.h" + + + + + + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cirrdevicestub.h + "IrrlichtDevice.h" + "IImagePresenter.h" + "SIrrCreationParameters.h" + "CVideoModeList.h" + +1229235366 c:\development\irrlicht-1.5\include\irrlichtdevice.h + "IReferenceCounted.h" + "dimension2d.h" + "IVideoDriver.h" + "EDriverTypes.h" + "IEventReceiver.h" + "ICursorControl.h" + "IVideoModeList.h" + "ITimer.h" + "IOSOperator.h" + +1229235366 c:\development\irrlicht-1.5\include\ivideomodelist.h + "IReferenceCounted.h" + "dimension2d.h" + +1229235366 c:\development\irrlicht-1.5\include\itimer.h + "IReferenceCounted.h" + +1229235367 c:\development\irrlicht-1.5\include\sirrcreationparameters.h + "EDriverTypes.h" + "dimension2d.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cvideomodelist.h + "IVideoModeList.h" + "dimension2d.h" + "irrArray.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\glxext.h + + + + + + + + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\ctimer.h + "ITimer.h" + "os.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\cosoperator.h + "IOSOperator.h" + "irrString.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cirrdevicestub.cpp + "CIrrDeviceStub.h" + "ISceneManager.h" + "IEventReceiver.h" + "IFileSystem.h" + "IGUIEnvironment.h" + "os.h" + "IrrCompileConfig.h" + "CTimer.h" + "CLogger.h" + "irrString.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\clogger.h + "ILogger.h" + "os.h" + "irrString.h" + "IEventReceiver.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cirrdevicewin32.cpp + "IrrCompileConfig.h" + "CIrrDeviceWin32.h" + "IEventReceiver.h" + "irrList.h" + "os.h" + "CTimer.h" + "irrString.h" + "COSOperator.h" + "dimension2d.h" + + "irrlicht.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cirrdevicewin32.h + "IrrCompileConfig.h" + "CIrrDeviceStub.h" + "IrrlichtDevice.h" + "IImagePresenter.h" + + + +1229235367 c:\development\irrlicht-1.5\include\irrlicht.h + "IrrCompileConfig.h" + "aabbox3d.h" + "CDynamicMeshBuffer.h" + "CIndexBuffer.h" + "CMeshBuffer.h" + "coreutil.h" + "CVertexBuffer.h" + "dimension2d.h" + "ECullingTypes.h" + "EDebugSceneTypes.h" + "EDriverFeatures.h" + "EDriverTypes.h" + "EGUIAlignment.h" + "EGUIElementTypes.h" + "EHardwareBufferFlags.h" + "EMaterialFlags.h" + "EMaterialTypes.h" + "EMeshWriterEnums.h" + "EMessageBoxFlags.h" + "ESceneNodeAnimatorTypes.h" + "ESceneNodeTypes.h" + "ETerrainElements.h" + "fast_atof.h" + "heapsort.h" + "IAnimatedMesh.h" + "IAnimatedMeshMD2.h" + "IAnimatedMeshMD3.h" + "IAnimatedMeshSceneNode.h" + "IAttributeExchangingObject.h" + "IAttributes.h" + "IBillboardSceneNode.h" + "IBillboardTextSceneNode.h" + "IBoneSceneNode.h" + "ICameraSceneNode.h" + "ICursorControl.h" + "IDummyTransformationSceneNode.h" + "IDynamicMeshBuffer.h" + "IEventReceiver.h" + "IFileList.h" + "IFileSystem.h" + "IGPUProgrammingServices.h" + "IGUIButton.h" + "IGUICheckBox.h" + "IGUIColorSelectDialog.h" + "IGUIComboBox.h" + "IGUIContextMenu.h" + "IGUIEditBox.h" + "IGUIElement.h" + "IGUIElementFactory.h" + "IGUIEnvironment.h" + "IGUIFileOpenDialog.h" + "IGUIFont.h" + "IGUIFontBitmap.h" + "IGUIImage.h" + "IGUIInOutFader.h" + "IGUIListBox.h" + "IGUIMeshViewer.h" + "IGUIScrollBar.h" + "IGUISkin.h" + "IGUISpinBox.h" + "IGUISpriteBank.h" + "IGUIStaticText.h" + "IGUITabControl.h" + "IGUITable.h" + "IGUIToolbar.h" + "IGUIWindow.h" + "IImage.h" + "IImageLoader.h" + "IImageWriter.h" + "IIndexBuffer.h" + "ILightSceneNode.h" + "ILogger.h" + "IMaterialRenderer.h" + "IMaterialRendererServices.h" + "IMesh.h" + "IMeshBuffer.h" + "IMeshCache.h" + "IMeshLoader.h" + "IMeshManipulator.h" + "IMeshSceneNode.h" + "IMeshWriter.h" + "IMetaTriangleSelector.h" + "IOSOperator.h" + "IParticleSystemSceneNode.h" + "IQ3LevelMesh.h" + "IQ3Shader.h" + "IReadFile.h" + "IReferenceCounted.h" + "irrArray.h" + "IrrlichtDevice.h" + "irrList.h" + "irrMap.h" + "irrMath.h" + "irrString.h" + "irrTypes.h" + "irrXML.h" + "ISceneCollisionManager.h" + "ISceneManager.h" + "ISceneNode.h" + "ISceneNodeAnimator.h" + "ISceneNodeAnimatorCameraFPS.h" + "ISceneNodeAnimatorCameraMaya.h" + "ISceneNodeAnimatorCollisionResponse.h" + "ISceneNodeAnimatorFactory.h" + "ISceneNodeFactory.h" + "ISceneUserDataSerializer.h" + "IShaderConstantSetCallBack.h" + "IShadowVolumeSceneNode.h" + "ISkinnedMesh.h" + "ITerrainSceneNode.h" + "ITextSceneNode.h" + "ITexture.h" + "ITimer.h" + "ITriangleSelector.h" + "IVertexBuffer.h" + "IVideoDriver.h" + "IVideoModeList.h" + "IVolumeLightSceneNode.h" + "IWriteFile.h" + "IXMLReader.h" + "IXMLWriter.h" + "Keycodes.h" + "line2d.h" + "line3d.h" + "matrix4.h" + "plane3d.h" + "position2d.h" + "quaternion.h" + "rect.h" + "S3DVertex.h" + "SAnimatedMesh.h" + "SceneParameters.h" + "SColor.h" + "SExposedVideoData.h" + "SIrrCreationParameters.h" + "SKeyMap.h" + "SLight.h" + "SMaterial.h" + "SMesh.h" + "SMeshBuffer.h" + "SMeshBufferLightMap.h" + "SMeshBufferTangents.h" + "SParticle.h" + "SSharedMeshBuffer.h" + "SSkinMeshBuffer.h" + "SVertexIndex.h" + "SViewFrustum.h" + "triangle3d.h" + "vector2d.h" + "vector3d.h" + "SIrrCreationParameters.h" + +1229235366 c:\development\irrlicht-1.5\include\cdynamicmeshbuffer.h + "IDynamicMeshBuffer.h" + "CVertexBuffer.h" + "CIndexBuffer.h" + +1229235367 c:\development\irrlicht-1.5\include\cvertexbuffer.h + "IVertexBuffer.h" + +1229235367 c:\development\irrlicht-1.5\include\cindexbuffer.h + "IIndexBuffer.h" + +1229235366 c:\development\irrlicht-1.5\include\ibillboardtextscenenode.h + "IBillboardSceneNode.h" + +1229235366 c:\development\irrlicht-1.5\include\imetatriangleselector.h + "ITriangleSelector.h" + +1229235366 c:\development\irrlicht-1.5\include\iscenecollisionmanager.h + "IReferenceCounted.h" + "vector3d.h" + "triangle3d.h" + "position2d.h" + "line3d.h" + +1229235366 c:\development\irrlicht-1.5\include\isceneuserdataserializer.h + "IReferenceCounted.h" + +1229235366 c:\development\irrlicht-1.5\include\ivolumelightscenenode.h + "ISceneNode.h" + +1229235367 c:\development\irrlicht-1.5\include\smeshbuffertangents.h + "CMeshBuffer.h" + +1229235366 c:\development\irrlicht-1.5\include\ssharedmeshbuffer.h + "irrArray.h" + "IMeshBuffer.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cirrmeshfileloader.cpp + "IrrCompileConfig.h" + "CIrrMeshFileLoader.h" + "os.h" + "IXMLReader.h" + "SAnimatedMesh.h" + "fast_atof.h" + "IReadFile.h" + "IAttributes.h" + "IMeshSceneNode.h" + "SMeshBufferLightMap.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cirrmeshfileloader.h + "IMeshLoader.h" + "IFileSystem.h" + "IVideoDriver.h" + "irrString.h" + "SMesh.h" + "SMeshBuffer.h" + "ISceneManager.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cirrmeshwriter.cpp + "IrrCompileConfig.h" + "CIrrMeshWriter.h" + "os.h" + "IWriteFile.h" + "IXMLWriter.h" + "IMesh.h" + "IAttributes.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cirrmeshwriter.h + "IMeshWriter.h" + "S3DVertex.h" + "IVideoDriver.h" + "IFileSystem.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\clmtsmeshfileloader.cpp + "IrrCompileConfig.h" + "SMeshBufferLightMap.h" + "SAnimatedMesh.h" + "SMeshBuffer.h" + "irrString.h" + "IReadFile.h" + "IAttributes.h" + "ISceneManager.h" + "CLMTSMeshFileLoader.h" + "os.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\clmtsmeshfileloader.h + "IMeshLoader.h" + "SMesh.h" + "IFileSystem.h" + "IVideoDriver.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\clwomeshfileloader.cpp + "CLWOMeshFileLoader.h" + "os.h" + "SAnimatedMesh.h" + "SMesh.h" + "IReadFile.h" + "ISceneManager.h" + "IFileSystem.h" + "IVideoDriver.h" + "IMeshManipulator.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\clwomeshfileloader.h + "IMeshLoader.h" + "SMeshBuffer.h" + "irrString.h" + "irrMap.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\clightscenenode.cpp + "CLightSceneNode.h" + "IVideoDriver.h" + "ISceneManager.h" + "ICameraSceneNode.h" + "os.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\clightscenenode.h + "ILightSceneNode.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\climitreadfile.cpp + "CLimitReadFile.h" + "irrString.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\climitreadfile.h + "IReadFile.h" + "irrString.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\clogger.cpp + "CLogger.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cmd2meshfileloader.cpp + "IrrCompileConfig.h" + "CMD2MeshFileLoader.h" + "CAnimatedMeshMD2.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cmd2meshfileloader.h + "IMeshLoader.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cmd3meshfileloader.cpp + "IrrCompileConfig.h" + "CMD3MeshFileLoader.h" + "CAnimatedMeshMD3.h" + "irrString.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cmd3meshfileloader.h + "IMeshLoader.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cms3dmeshfileloader.cpp + "IrrCompileConfig.h" + "IReadFile.h" + "os.h" + "CMS3DMeshFileLoader.h" + "CSkinnedMesh.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cms3dmeshfileloader.h + "IMeshLoader.h" + "IVideoDriver.h" + "CSkinnedMesh.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\cmy3dmeshfileloader.cpp + "IrrCompileConfig.h" + "CMY3DMeshFileLoader.h" + "SAnimatedMesh.h" + "SMeshBuffer.h" + "IReadFile.h" + "IAttributes.h" + "CImage.h" + "CColorConverter.h" + "CMY3DHelper.h" + "os.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\cmy3dmeshfileloader.h + "IMeshLoader.h" + "SMesh.h" + "SMeshBufferLightMap.h" + "IFileSystem.h" + "IVideoDriver.h" + "irrString.h" + "ISceneManager.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cmy3dhelper.h + + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\cmemoryreadfile.cpp + "CMemoryReadFile.h" + "irrString.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cmeshcache.cpp + "CMeshCache.h" + "IAnimatedMesh.h" + "IMesh.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cmeshcache.h + "IMeshCache.h" + "irrArray.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\cmeshmanipulator.cpp + "CMeshManipulator.h" + "SMesh.h" + "CMeshBuffer.h" + "SAnimatedMesh.h" + "os.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cmeshmanipulator.h + "IMeshManipulator.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\cmeshscenenode.cpp + "CMeshSceneNode.h" + "IVideoDriver.h" + "ISceneManager.h" + "S3DVertex.h" + "ICameraSceneNode.h" + "IMeshCache.h" + "IAnimatedMesh.h" + "IMaterialRenderer.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\cmeshscenenode.h + "IMeshSceneNode.h" + "IMesh.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cmetatriangleselector.cpp + "CMetaTriangleSelector.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\cmetatriangleselector.h + "IMetaTriangleSelector.h" + "irrArray.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cnulldriver.cpp + "CNullDriver.h" + "CSoftwareTexture.h" + "os.h" + "CImage.h" + "CAttributes.h" + "IReadFile.h" + "IWriteFile.h" + "IImageLoader.h" + "IImageWriter.h" + "IMaterialRenderer.h" + "CMeshManipulator.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\csoftwaretexture.h + "ITexture.h" + "CImage.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cobjmeshfileloader.cpp + "IrrCompileConfig.h" + "COBJMeshFileLoader.h" + "IMeshManipulator.h" + "IVideoDriver.h" + "SMesh.h" + "SMeshBuffer.h" + "SAnimatedMesh.h" + "IReadFile.h" + "IAttributes.h" + "fast_atof.h" + "coreutil.h" + "os.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cobjmeshfileloader.h + "IMeshLoader.h" + "IFileSystem.h" + "ISceneManager.h" + "irrString.h" + "SMeshBuffer.h" + "irrMap.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cobjmeshwriter.cpp + "IrrCompileConfig.h" + "COBJMeshWriter.h" + "os.h" + "IMesh.h" + "IMeshBuffer.h" + "IAttributes.h" + "ISceneManager.h" + "IMeshCache.h" + "IWriteFile.h" + "IFileSystem.h" + "ITexture.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\cobjmeshwriter.h + "IMeshWriter.h" + "S3DVertex.h" + "irrString.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\coctloader.cpp + "IrrCompileConfig.h" + "COCTLoader.h" + "IVideoDriver.h" + "IFileSystem.h" + "os.h" + "SAnimatedMesh.h" + "SMeshBufferLightMap.h" + "irrString.h" + "CImage.h" + "ISceneManager.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\coctloader.h + "IMeshLoader.h" + "IReadFile.h" + "SMesh.h" + "irrString.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cosoperator.cpp + "COSOperator.h" + "IrrCompileConfig.h" + + + + "MacOSX/OSXClipboard.h" + + + +1229235354 c:\development\irrlicht-1.5\source\irrlicht\macosx\osxclipboard.h + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\cocttreescenenode.cpp + "COctTreeSceneNode.h" + "OctTree.h" + "ISceneManager.h" + "IVideoDriver.h" + "ICameraSceneNode.h" + "IMeshCache.h" + "IAnimatedMesh.h" + "IMaterialRenderer.h" + "os.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cocttreescenenode.h + "ISceneNode.h" + "IMesh.h" + "OctTree.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\octtree.h + "SViewFrustum.h" + "S3DVertex.h" + "aabbox3d.h" + "irrArray.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\cocttreetriangleselector.cpp + "COctTreeTriangleSelector.h" + "ISceneNode.h" + "os.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cocttreetriangleselector.h + "CTriangleSelector.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\ctriangleselector.h + "ITriangleSelector.h" + "IMesh.h" + "irrArray.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cogremeshfileloader.cpp + "IrrCompileConfig.h" + "COgreMeshFileLoader.h" + "os.h" + "SMeshBuffer.h" + "SAnimatedMesh.h" + "IReadFile.h" + "fast_atof.h" + "coreutil.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cogremeshfileloader.h + "IMeshLoader.h" + "IFileSystem.h" + "IVideoDriver.h" + "irrString.h" + "SMesh.h" + "SMeshBuffer.h" + "SMeshBufferLightMap.h" + "IMeshManipulator.h" + "matrix4.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\copengldriver.cpp + "COpenGLDriver.h" + "CNullDriver.h" + "COpenGLTexture.h" + "COpenGLMaterialRenderer.h" + "COpenGLShaderMaterialRenderer.h" + "COpenGLSLMaterialRenderer.h" + "COpenGLNormalMapRenderer.h" + "COpenGLParallaxMapRenderer.h" + "CImage.h" + "os.h" + + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\copengldriver.h + "IrrCompileConfig.h" + + "CIrrDeviceMacOSX.h" + "SIrrCreationParameters.h" + "CNullDriver.h" + "IMaterialRendererServices.h" + "COpenGLExtensionHandler.h" + + "glext.h" + "wglext.h" + + "glext.h" + + "glext.h" + + + "glext.h" + "glxext.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\copenglextensionhandler.h + "IrrCompileConfig.h" + "EDriverFeatures.h" + "irrTypes.h" + "os.h" + + + "glext.h" + "CIrrDeviceMacOSX.h" + + "glext.h" + + + "glext.h" + + + "glext.h" + "glxext.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\glext.h + + + + + + + + + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\wglext.h + + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\copengltexture.h + "ITexture.h" + "IImage.h" + "IrrCompileConfig.h" + + + "glext.h" + + + "glext.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\copenglmaterialrenderer.h + "IrrCompileConfig.h" + "COpenGLDriver.h" + "IMaterialRenderer.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\copenglshadermaterialrenderer.h + "IrrCompileConfig.h" + + + + + "glext.h" + "IMaterialRenderer.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\copenglslmaterialrenderer.h + "IrrCompileConfig.h" + + + "glext.h" + + + "glext.h" + "IMaterialRenderer.h" + "IMaterialRendererServices.h" + "IGPUProgrammingServices.h" + "irrArray.h" + "irrString.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\copenglnormalmaprenderer.h + "IrrCompileConfig.h" + "COpenGLShaderMaterialRenderer.h" + "IShaderConstantSetCallBack.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\copenglparallaxmaprenderer.h + "IrrCompileConfig.h" + "COpenGLShaderMaterialRenderer.h" + "IShaderConstantSetCallBack.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\copenglextensionhandler.cpp + "IrrCompileConfig.h" + "COpenGLExtensionHandler.h" + "irrString.h" + "SMaterial.h" + "fast_atof.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\copenglnormalmaprenderer.cpp + "IrrCompileConfig.h" + "COpenGLNormalMapRenderer.h" + "IGPUProgrammingServices.h" + "IShaderConstantSetCallBack.h" + "IVideoDriver.h" + "os.h" + "COpenGLDriver.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\copenglparallaxmaprenderer.cpp + "IrrCompileConfig.h" + "COpenGLParallaxMapRenderer.h" + "COpenGLDriver.h" + "IGPUProgrammingServices.h" + "IShaderConstantSetCallBack.h" + "IVideoDriver.h" + "os.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\copenglslmaterialrenderer.cpp + "IrrCompileConfig.h" + "COpenGLSLMaterialRenderer.h" + "IGPUProgrammingServices.h" + "IShaderConstantSetCallBack.h" + "IMaterialRendererServices.h" + "IVideoDriver.h" + "os.h" + "COpenGLDriver.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\copenglshadermaterialrenderer.cpp + "IrrCompileConfig.h" + "COpenGLShaderMaterialRenderer.h" + "IGPUProgrammingServices.h" + "IShaderConstantSetCallBack.h" + "IVideoDriver.h" + "os.h" + "COpenGLDriver.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\copengltexture.cpp + "IrrCompileConfig.h" + "irrTypes.h" + "COpenGLTexture.h" + "COpenGLDriver.h" + "os.h" + "CImage.h" + "CColorConverter.h" + "irrString.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cpakreader.cpp + "CPakReader.h" + "os.h" + "IrrCompileConfig.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cparticleanimatedmeshscenenodeemitter.cpp + "CParticleAnimatedMeshSceneNodeEmitter.h" + "IAnimatedMeshSceneNode.h" + "IMesh.h" + "os.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cparticleanimatedmeshscenenodeemitter.h + "IParticleAnimatedMeshSceneNodeEmitter.h" + "irrArray.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cparticleattractionaffector.cpp + "CParticleAttractionAffector.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cparticleattractionaffector.h + "IParticleAttractionAffector.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\cparticleboxemitter.cpp + "CParticleBoxEmitter.h" + "os.h" + "IAttributes.h" + "irrMath.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cparticleboxemitter.h + "IParticleBoxEmitter.h" + "irrArray.h" + "aabbox3d.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\cparticlecylinderemitter.cpp + "CParticleCylinderEmitter.h" + "os.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\cparticlecylinderemitter.h + "IParticleCylinderEmitter.h" + "irrArray.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cparticlefadeoutaffector.cpp + "CParticleFadeOutAffector.h" + "IAttributes.h" + "os.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cparticlefadeoutaffector.h + "IParticleFadeOutAffector.h" + "SColor.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cparticlegravityaffector.cpp + "CParticleGravityAffector.h" + "os.h" + "IAttributes.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\cparticlegravityaffector.h + "IParticleGravityAffector.h" + "SColor.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cparticlemeshemitter.cpp + "IrrCompileConfig.h" + "CParticleMeshEmitter.h" + "os.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cparticlemeshemitter.h + "IParticleMeshEmitter.h" + "irrArray.h" + "aabbox3d.h" + "IMeshBuffer.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cparticlepointemitter.cpp + "CParticlePointEmitter.h" + "os.h" + "IAttributes.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cparticlepointemitter.h + "IParticleEmitter.h" + "irrArray.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cparticleringemitter.cpp + "CParticleRingEmitter.h" + "os.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\cparticleringemitter.h + "IParticleRingEmitter.h" + "irrArray.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cparticlerotationaffector.cpp + "CParticleRotationAffector.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cparticlerotationaffector.h + "IParticleRotationAffector.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cparticlescaleaffector.cpp + "CParticleScaleAffector.h" + "IAttributes.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cparticlescaleaffector.h + + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cparticlesphereemitter.cpp + "IrrCompileConfig.h" + "CParticleSphereEmitter.h" + "os.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cparticlesphereemitter.h + "IParticleSphereEmitter.h" + "irrArray.h" + "aabbox3d.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\cparticlesystemscenenode.cpp + "CParticleSystemSceneNode.h" + "os.h" + "ISceneManager.h" + "ICameraSceneNode.h" + "IVideoDriver.h" + "CParticleAnimatedMeshSceneNodeEmitter.h" + "CParticleBoxEmitter.h" + "CParticleCylinderEmitter.h" + "CParticleMeshEmitter.h" + "CParticlePointEmitter.h" + "CParticleRingEmitter.h" + "CParticleSphereEmitter.h" + "CParticleAttractionAffector.h" + "CParticleFadeOutAffector.h" + "CParticleGravityAffector.h" + "CParticleRotationAffector.h" + "CParticleScaleAffector.h" + "SViewFrustum.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cparticlesystemscenenode.h + "IParticleSystemSceneNode.h" + "irrArray.h" + "irrList.h" + "SMeshBuffer.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\cq3levelmesh.cpp + "IrrCompileConfig.h" + "CQ3LevelMesh.h" + "ISceneManager.h" + "os.h" + "SMeshBufferLightMap.h" + "irrString.h" + "ILightSceneNode.h" + "IQ3Shader.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\cquake3shaderscenenode.cpp + "IrrCompileConfig.h" + "CQuake3ShaderSceneNode.h" + "ISceneManager.h" + "IVideoDriver.h" + "ICameraSceneNode.h" + "SViewFrustum.h" + "IMeshManipulator.h" + "SMesh.h" + "IMaterialRenderer.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cquake3shaderscenenode.h + "ISceneNode.h" + "IQ3Shader.h" + "IFileSystem.h" + "SMeshBuffer.h" + "SMeshBufferLightMap.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\creadfile.cpp + "CReadFile.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cstlmeshfileloader.cpp + "IrrCompileConfig.h" + "CSTLMeshFileLoader.h" + "SMesh.h" + "SMeshBuffer.h" + "SAnimatedMesh.h" + "IReadFile.h" + "fast_atof.h" + "coreutil.h" + "os.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cstlmeshfileloader.h + "IMeshLoader.h" + "irrString.h" + "SColor.h" + "vector3d.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\cstlmeshwriter.cpp + "IrrCompileConfig.h" + "CSTLMeshWriter.h" + "os.h" + "IMesh.h" + "IMeshBuffer.h" + "IAttributes.h" + "ISceneManager.h" + "IMeshCache.h" + "IWriteFile.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cstlmeshwriter.h + "IMeshWriter.h" + "S3DVertex.h" + "irrString.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cscenecollisionmanager.cpp + "CSceneCollisionManager.h" + "ISceneNode.h" + "ICameraSceneNode.h" + "ITriangleSelector.h" + "SViewFrustum.h" + "os.h" + "irrMath.h" + + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cscenecollisionmanager.h + "ISceneCollisionManager.h" + "ISceneManager.h" + "IVideoDriver.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\cscenemanager.cpp + "IrrCompileConfig.h" + "CSceneManager.h" + "IVideoDriver.h" + "IFileSystem.h" + "SAnimatedMesh.h" + "CMeshCache.h" + "IWriteFile.h" + "IXMLWriter.h" + "ISceneUserDataSerializer.h" + "IGUIEnvironment.h" + "IMaterialRenderer.h" + "IReadFile.h" + "os.h" + "CGeometryCreator.h" + "CIrrMeshFileLoader.h" + "CBSPMeshFileLoader.h" + "CMD2MeshFileLoader.h" + "CMS3DMeshFileLoader.h" + "C3DSMeshFileLoader.h" + "CXMeshFileLoader.h" + "COCTLoader.h" + "CCSMLoader.h" + "CLMTSMeshFileLoader.h" + "CMY3DMeshFileLoader.h" + "CColladaFileLoader.h" + "CDMFLoader.h" + "COgreMeshFileLoader.h" + "COBJMeshFileLoader.h" + "CMD3MeshFileLoader.h" + "CB3DMeshFileLoader.h" + "CLWOMeshFileLoader.h" + "CSTLMeshFileLoader.h" + "CColladaMeshWriter.h" + "CIrrMeshWriter.h" + "CSTLMeshWriter.h" + "COBJMeshWriter.h" + "CCubeSceneNode.h" + "CSphereSceneNode.h" + "CAnimatedMeshSceneNode.h" + "COctTreeSceneNode.h" + "CCameraSceneNode.h" + "CLightSceneNode.h" + "CBillboardSceneNode.h" + "CMeshSceneNode.h" + "CSkyBoxSceneNode.h" + "CSkyDomeSceneNode.h" + "CParticleSystemSceneNode.h" + "CDummyTransformationSceneNode.h" + "CWaterSurfaceSceneNode.h" + "CTerrainSceneNode.h" + "CEmptySceneNode.h" + "CTextSceneNode.h" + "CDefaultSceneNodeFactory.h" + "CSceneCollisionManager.h" + "CTriangleSelector.h" + "COctTreeTriangleSelector.h" + "CTriangleBBSelector.h" + "CMetaTriangleSelector.h" + "CTerrainTriangleSelector.h" + "CSceneNodeAnimatorRotation.h" + "CSceneNodeAnimatorFlyCircle.h" + "CSceneNodeAnimatorFlyStraight.h" + "CSceneNodeAnimatorTexture.h" + "CSceneNodeAnimatorCollisionResponse.h" + "CSceneNodeAnimatorDelete.h" + "CSceneNodeAnimatorFollowSpline.h" + "CSceneNodeAnimatorCameraFPS.h" + "CSceneNodeAnimatorCameraMaya.h" + "CDefaultSceneNodeAnimatorFactory.h" + "CQuake3ShaderSceneNode.h" + "CVolumeLightSceneNode.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\cscenemanager.h + "ISceneManager.h" + "ISceneNode.h" + "ICursorControl.h" + "irrString.h" + "irrArray.h" + "IMeshLoader.h" + "CAttributes.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cxmeshfileloader.h + "IMeshLoader.h" + "irrString.h" + "CSkinnedMesh.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cspherescenenode.h + "IMeshSceneNode.h" + "IMesh.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cskyboxscenenode.h + "ISceneNode.h" + "S3DVertex.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cskydomescenenode.h + "ISceneNode.h" + "SMeshBuffer.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cwatersurfacescenenode.h + "CMeshSceneNode.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\cterrainscenenode.h + "ITerrainSceneNode.h" + "SMesh.h" + "CDynamicMeshBuffer.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\ctextscenenode.h + "ITextSceneNode.h" + "IBillboardTextSceneNode.h" + "IGUIFont.h" + "IGUIFontBitmap.h" + "ISceneCollisionManager.h" + "SMesh.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\ctrianglebbselector.h + "CTriangleSelector.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cterraintriangleselector.h + "ITriangleSelector.h" + "irrArray.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cscenenodeanimatorrotation.h + "ISceneNode.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cscenenodeanimatorflycircle.h + "ISceneNode.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cscenenodeanimatorflystraight.h + "ISceneNode.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cscenenodeanimatortexture.h + "irrArray.h" + "ISceneNode.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\cscenenodeanimatorcollisionresponse.h + "ISceneNodeAnimatorCollisionResponse.h" + +1229235356 c:\development\irrlicht-1.5\source\irrlicht\cscenenodeanimatordelete.h + "ISceneNode.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cscenenodeanimatorfollowspline.h + "ISceneNode.h" + "irrArray.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cvolumelightscenenode.h + "IVolumeLightSceneNode.h" + "SMeshBuffer.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cscenenodeanimatorcamerafps.cpp + "CSceneNodeAnimatorCameraFPS.h" + "IVideoDriver.h" + "ISceneManager.h" + "Keycodes.h" + "ICursorControl.h" + "ICameraSceneNode.h" + "ISceneNodeAnimatorCollisionResponse.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\cscenenodeanimatorcameramaya.cpp + "CSceneNodeAnimatorCameraMaya.h" + "ICursorControl.h" + "ICameraSceneNode.h" + "SViewFrustum.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cscenenodeanimatorcollisionresponse.cpp + "CSceneNodeAnimatorCollisionResponse.h" + "ISceneCollisionManager.h" + "ISceneManager.h" + "ICameraSceneNode.h" + "os.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\cscenenodeanimatordelete.cpp + "CSceneNodeAnimatorDelete.h" + "ISceneManager.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\cscenenodeanimatorflycircle.cpp + "CSceneNodeAnimatorFlyCircle.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cscenenodeanimatorflystraight.cpp + "CSceneNodeAnimatorFlyStraight.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\cscenenodeanimatorfollowspline.cpp + "CSceneNodeAnimatorFollowSpline.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cscenenodeanimatorrotation.cpp + "CSceneNodeAnimatorRotation.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\cscenenodeanimatortexture.cpp + "CSceneNodeAnimatorTexture.h" + "ITexture.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cshadowvolumescenenode.cpp + "CShadowVolumeSceneNode.h" + "ISceneManager.h" + "IMesh.h" + "IVideoDriver.h" + "SLight.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cskinnedmesh.cpp + "IrrCompileConfig.h" + "CSkinnedMesh.h" + "CBoneSceneNode.h" + "IAnimatedMeshSceneNode.h" + "os.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cskyboxscenenode.cpp + "CSkyBoxSceneNode.h" + "IVideoDriver.h" + "ISceneManager.h" + "ICameraSceneNode.h" + "S3DVertex.h" + "os.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\cskydomescenenode.cpp + "CSkyDomeSceneNode.h" + "IVideoDriver.h" + "ISceneManager.h" + "ICameraSceneNode.h" + "os.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\csoftwaredriver.cpp + "CSoftwareDriver.h" + "IrrCompileConfig.h" + "CSoftwareTexture.h" + "os.h" + "S3DVertex.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\csoftwaredriver.h + "ITriangleRenderer.h" + "CNullDriver.h" + "SViewFrustum.h" + "CImage.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\itrianglerenderer.h + "IReferenceCounted.h" + "S2DVertex.h" + "rect.h" + "IZBuffer.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\izbuffer.h + "IReferenceCounted.h" + "dimension2d.h" + "S2DVertex.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\csoftwaredriver2.cpp + "CSoftwareDriver2.h" + "IrrCompileConfig.h" + "SoftwareDriver2_helper.h" + "CSoftwareTexture2.h" + "CSoftware2MaterialRenderer.h" + "S3DVertex.h" + "S4DVertex.h" + +1229235355 c:\development\irrlicht-1.5\source\irrlicht\csoftwaredriver2.h + "SoftwareDriver2_compile_config.h" + "IBurningShader.h" + "CNullDriver.h" + "CImage.h" + "os.h" + "irrString.h" + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\csoftware2materialrenderer.h + "SoftwareDriver2_compile_config.h" + "IMaterialRenderer.h" + "CSoftwareDriver2.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\csoftwaretexture.cpp + "IrrCompileConfig.h" + "CSoftwareTexture.h" + "os.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\csoftwaretexture2.cpp + "IrrCompileConfig.h" + "SoftwareDriver2_compile_config.h" + "SoftwareDriver2_helper.h" + "CSoftwareTexture2.h" + "os.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cspherescenenode.cpp + "CSphereSceneNode.h" + "IVideoDriver.h" + "ISceneManager.h" + "CGeometryCreator.h" + "S3DVertex.h" + "os.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\ctrflat.cpp + "IrrCompileConfig.h" + "CTRTextureGouraud.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\ctrtexturegouraud.h + "IrrCompileConfig.h" + "ITriangleRenderer.h" + "IImage.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\ctrflatwire.cpp + "IrrCompileConfig.h" + "CTRTextureGouraud.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\ctrgouraud.cpp + "IrrCompileConfig.h" + "CTRTextureGouraud.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\ctrgouraud2.cpp + "IrrCompileConfig.h" + "IBurningShader.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\ctrgouraudalpha2.cpp + "IrrCompileConfig.h" + "IBurningShader.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\ctrgouraudalphanoz2.cpp + "IrrCompileConfig.h" + "IBurningShader.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\ctrgouraudwire.cpp + "IrrCompileConfig.h" + "CTRTextureGouraud.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\ctrtextureblend.cpp + "IrrCompileConfig.h" + "IBurningShader.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\ctrtexturedetailmap2.cpp + "IrrCompileConfig.h" + "IBurningShader.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\ctrtextureflat.cpp + "IrrCompileConfig.h" + "CTRTextureGouraud.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\ctrtextureflatwire.cpp + "IrrCompileConfig.h" + "CTRTextureGouraud.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\ctrtexturegouraud.cpp + "CTRTextureGouraud.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\ctrtexturegouraud2.cpp + "IrrCompileConfig.h" + "IBurningShader.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\ctrtexturegouraudadd.cpp + "IrrCompileConfig.h" + "CTRTextureGouraud.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\ctrtexturegouraudadd2.cpp + "IrrCompileConfig.h" + "IBurningShader.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\ctrtexturegouraudaddnoz2.cpp + "IrrCompileConfig.h" + "IBurningShader.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\ctrtexturegouraudalpha.cpp + "IrrCompileConfig.h" + "IBurningShader.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\ctrtexturegouraudalphanoz.cpp + "IrrCompileConfig.h" + "IBurningShader.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\ctrtexturegouraudnoz.cpp + "IrrCompileConfig.h" + "CTRTextureGouraud.h" + "SColor.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\ctrtexturegouraudnoz2.cpp + "IrrCompileConfig.h" + "IBurningShader.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\ctrtexturegouraudvertexalpha2.cpp + "IrrCompileConfig.h" + "IBurningShader.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\ctrtexturegouraudwire.cpp + "IrrCompileConfig.h" + "CTRTextureGouraud.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\ctrtexturelightmap2_add.cpp + "IrrCompileConfig.h" + "IBurningShader.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\ctrtexturelightmap2_m1.cpp + "IrrCompileConfig.h" + "IBurningShader.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\ctrtexturelightmap2_m2.cpp + "IrrCompileConfig.h" + "IBurningShader.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\ctrtexturelightmap2_m4.cpp + "IrrCompileConfig.h" + "IBurningShader.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\ctrtexturelightmapgouraud2_m4.cpp + "IrrCompileConfig.h" + "IBurningShader.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\ctrtexturewire2.cpp + "IrrCompileConfig.h" + "IBurningShader.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\cterrainscenenode.cpp + "CTerrainSceneNode.h" + "CTerrainTriangleSelector.h" + "IVideoDriver.h" + "ISceneManager.h" + "ICameraSceneNode.h" + "SMeshBufferLightMap.h" + "SViewFrustum.h" + "irrMath.h" + "os.h" + "IGUIFont.h" + "IFileSystem.h" + "IReadFile.h" + "ITextSceneNode.h" + "IAnimatedMesh.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cterraintriangleselector.cpp + "CTerrainTriangleSelector.h" + "CTerrainSceneNode.h" + "os.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\ctextscenenode.cpp + "CTextSceneNode.h" + "ISceneManager.h" + "IVideoDriver.h" + "ICameraSceneNode.h" + "IGUISpriteBank.h" + "SMeshBuffer.h" + "os.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\ctrianglebbselector.cpp + "CTriangleBBSelector.h" + "ISceneNode.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\ctriangleselector.cpp + "CTriangleSelector.h" + "ISceneNode.h" + "IMeshBuffer.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\cvideomodelist.cpp + "CVideoModeList.h" + "irrMath.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cvolumelightscenenode.cpp + "CVolumeLightSceneNode.h" + "IVideoDriver.h" + "ISceneManager.h" + "S3DVertex.h" + "os.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cwatersurfacescenenode.cpp + "CWaterSurfaceSceneNode.h" + "ISceneManager.h" + "IMeshManipulator.h" + "IMeshCache.h" + "S3DVertex.h" + "SMesh.h" + "os.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cwritefile.cpp + "CWriteFile.h" + + +1229235358 c:\development\irrlicht-1.5\source\irrlicht\cwritefile.h + + "IWriteFile.h" + "irrString.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cxmlreader.cpp + "CXMLReaderImpl.h" + "CXMLReader.h" + "IReadFile.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\cxmlreaderimpl.h + "irrXML.h" + "irrString.h" + "irrArray.h" + "fast_atof.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\cxmlwriter.cpp + "CXMLWriter.h" + + "irrString.h" + "IrrCompileConfig.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\cxmeshfileloader.cpp + "IrrCompileConfig.h" + "CXMeshFileLoader.h" + "os.h" + "fast_atof.h" + "coreutil.h" + "ISceneManager.h" + "IVideoDriver.h" + "IFileSystem.h" + "IReadFile.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\czbuffer.cpp + "IrrCompileConfig.h" + "CZBuffer.h" + "irrString.h" + +1229235357 c:\development\irrlicht-1.5\source\irrlicht\czbuffer.h + "IZBuffer.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\czipreader.cpp + "CZipReader.h" + "CFileList.h" + "CReadFile.h" + "os.h" + "IrrCompileConfig.h" + + "zlib/zlib.h" + +1229235355 source:c:\development\irrlicht-1.5\source\irrlicht\iburningshader.cpp + "IrrCompileConfig.h" + "SoftwareDriver2_compile_config.h" + "IBurningShader.h" + +1229235356 source:c:\development\irrlicht-1.5\source\irrlicht\irrlicht.cpp + "IrrCompileConfig.h" + + + + "irrlicht.h" + +1229235358 source:c:\development\irrlicht-1.5\source\irrlicht\irrxml.cpp + "irrXML.h" + "irrString.h" + "irrArray.h" + "fast_atof.h" + "CXMLReaderImpl.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jcapimin.c + "jinclude.h" + "jpeglib.h" + +1229235350 c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jinclude.h + "jconfig.h" + + + + + + + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jcapistd.c + "jinclude.h" + "jpeglib.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jccoefct.c + "jinclude.h" + "jpeglib.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jccolor.c + "jinclude.h" + "jpeglib.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jcdctmgr.c + "jinclude.h" + "jpeglib.h" + "jdct.h" + +1229235351 c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jdct.h + +1229235350 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jchuff.c + "jinclude.h" + "jpeglib.h" + "jchuff.h" + +1229235350 c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jchuff.h + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jcinit.c + "jinclude.h" + "jpeglib.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jcmainct.c + "jinclude.h" + "jpeglib.h" + +1229235350 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jcmarker.c + "jinclude.h" + "jpeglib.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jcmaster.c + "jinclude.h" + "jpeglib.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jcomapi.c + "jinclude.h" + "jpeglib.h" + +1229235350 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jcparam.c + "jinclude.h" + "jpeglib.h" + +1229235350 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jcphuff.c + "jinclude.h" + "jpeglib.h" + "jchuff.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jcprepct.c + "jinclude.h" + "jpeglib.h" + +1229235350 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jcsample.c + "jinclude.h" + "jpeglib.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jctrans.c + "jinclude.h" + "jpeglib.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jdapimin.c + "jinclude.h" + "jpeglib.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jdapistd.c + "jinclude.h" + "jpeglib.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jdatadst.c + "jinclude.h" + "jpeglib.h" + "jerror.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jdatasrc.c + "jinclude.h" + "jpeglib.h" + "jerror.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jdcoefct.c + "jinclude.h" + "jpeglib.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jdcolor.c + "jinclude.h" + "jpeglib.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jddctmgr.c + "jinclude.h" + "jpeglib.h" + "jdct.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jdhuff.c + "jinclude.h" + "jpeglib.h" + "jdhuff.h" + +1229235351 c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jdhuff.h + +1229235350 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jdinput.c + "jinclude.h" + "jpeglib.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jdmainct.c + "jinclude.h" + "jpeglib.h" + +1229235350 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jdmarker.c + "jinclude.h" + "jpeglib.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jdmaster.c + "jinclude.h" + "jpeglib.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jdmerge.c + "jinclude.h" + "jpeglib.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jdphuff.c + "jinclude.h" + "jpeglib.h" + "jdhuff.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jdpostct.c + "jinclude.h" + "jpeglib.h" + +1229235350 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jdsample.c + "jinclude.h" + "jpeglib.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jdtrans.c + "jinclude.h" + "jpeglib.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jerror.c + "jinclude.h" + "jpeglib.h" + "jversion.h" + "jerror.h" + + "jerror.h" + +1229235351 c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jversion.h + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jfdctflt.c + "jinclude.h" + "jpeglib.h" + "jdct.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jfdctfst.c + "jinclude.h" + "jpeglib.h" + "jdct.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jfdctint.c + "jinclude.h" + "jpeglib.h" + "jdct.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jidctflt.c + "jinclude.h" + "jpeglib.h" + "jdct.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jidctfst.c + "jinclude.h" + "jpeglib.h" + "jdct.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jidctint.c + "jinclude.h" + "jpeglib.h" + "jdct.h" + +1229235352 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jidctred.c + "jinclude.h" + "jpeglib.h" + "jdct.h" + +1229235350 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jmemmgr.c + "jinclude.h" + "jpeglib.h" + "jmemsys.h" + +1229235351 c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jmemsys.h + + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jmemnobs.c + "jinclude.h" + "jpeglib.h" + "jmemsys.h" + +1229235350 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jquant1.c + "jinclude.h" + "jpeglib.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jquant2.c + "jinclude.h" + "jpeglib.h" + +1229235351 source:c:\development\irrlicht-1.5\source\irrlicht\jpeglib\jutils.c + "jinclude.h" + "jpeglib.h" + +1229235343 source:c:\development\irrlicht-1.5\source\irrlicht\libpng\png.c + "png.h" + +1229235343 source:c:\development\irrlicht-1.5\source\irrlicht\libpng\pngerror.c + "png.h" + +1229235343 source:c:\development\irrlicht-1.5\source\irrlicht\libpng\pngget.c + "png.h" + +1229235343 source:c:\development\irrlicht-1.5\source\irrlicht\libpng\pngmem.c + "png.h" + +1229235343 source:c:\development\irrlicht-1.5\source\irrlicht\libpng\pngpread.c + "png.h" + +1229235343 source:c:\development\irrlicht-1.5\source\irrlicht\libpng\pngread.c + "png.h" + +1229235343 source:c:\development\irrlicht-1.5\source\irrlicht\libpng\pngrio.c + "png.h" + +1229235343 source:c:\development\irrlicht-1.5\source\irrlicht\libpng\pngrtran.c + "png.h" + +1229235343 source:c:\development\irrlicht-1.5\source\irrlicht\libpng\pngrutil.c + "png.h" + +1229235343 source:c:\development\irrlicht-1.5\source\irrlicht\libpng\pngset.c + "png.h" + +1229235343 source:c:\development\irrlicht-1.5\source\irrlicht\libpng\pngtrans.c + "png.h" + +1229235343 source:c:\development\irrlicht-1.5\source\irrlicht\libpng\pngwio.c + "png.h" + +1229235343 source:c:\development\irrlicht-1.5\source\irrlicht\libpng\pngwrite.c + "png.h" + +1229235343 source:c:\development\irrlicht-1.5\source\irrlicht\libpng\pngwtran.c + "png.h" + +1229235343 source:c:\development\irrlicht-1.5\source\irrlicht\libpng\pngwutil.c + "png.h" + +1229235357 source:c:\development\irrlicht-1.5\source\irrlicht\os.cpp + "os.h" + "irrString.h" + "IrrCompileConfig.h" + "irrMath.h" + + + + + + + + + + + +1229235346 source:c:\development\irrlicht-1.5\source\irrlicht\zlib\adler32.c + "zlib.h" + +1229235346 source:c:\development\irrlicht-1.5\source\irrlicht\zlib\compress.c + "zlib.h" + +1229235346 source:c:\development\irrlicht-1.5\source\irrlicht\zlib\crc32.c + + "zutil.h" + + "crc32.h" + +1229235346 c:\development\irrlicht-1.5\source\irrlicht\zlib\zutil.h + "zlib.h" + + + + + + + + + + +1229235346 c:\development\irrlicht-1.5\source\irrlicht\zlib\crc32.h + +1229235346 source:c:\development\irrlicht-1.5\source\irrlicht\zlib\deflate.c + "deflate.h" + +1229235346 c:\development\irrlicht-1.5\source\irrlicht\zlib\deflate.h + "zutil.h" + +1229235346 source:c:\development\irrlicht-1.5\source\irrlicht\zlib\inffast.c + "zutil.h" + "inftrees.h" + "inflate.h" + "inffast.h" + +1229235346 c:\development\irrlicht-1.5\source\irrlicht\zlib\inftrees.h + +1229235346 c:\development\irrlicht-1.5\source\irrlicht\zlib\inflate.h + +1229235346 c:\development\irrlicht-1.5\source\irrlicht\zlib\inffast.h + +1229235346 source:c:\development\irrlicht-1.5\source\irrlicht\zlib\inflate.c + "zutil.h" + "inftrees.h" + "inflate.h" + "inffast.h" + "inffixed.h" + + +1229235346 c:\development\irrlicht-1.5\source\irrlicht\zlib\inffixed.h + +1229235346 source:c:\development\irrlicht-1.5\source\irrlicht\zlib\inftrees.c + "zutil.h" + "inftrees.h" + +1229235346 source:c:\development\irrlicht-1.5\source\irrlicht\zlib\trees.c + "deflate.h" + + "trees.h" + + +1229235346 c:\development\irrlicht-1.5\source\irrlicht\zlib\trees.h + +1229235346 source:c:\development\irrlicht-1.5\source\irrlicht\zlib\uncompr.c + "zlib.h" + +1229235346 source:c:\development\irrlicht-1.5\source\irrlicht\zlib\zutil.c + "zutil.h" + diff --git a/src/dep/src/irrlicht/Irrlicht-gcc.layout b/src/dep/src/irrlicht/Irrlicht-gcc.layout new file mode 100644 index 0000000..a60345f --- /dev/null +++ b/src/dep/src/irrlicht/Irrlicht-gcc.layout @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/dep/src/irrlicht/Irrlicht.cpp b/src/dep/src/irrlicht/Irrlicht.cpp index 964de40..04d3788 100644 --- a/src/dep/src/irrlicht/Irrlicht.cpp +++ b/src/dep/src/irrlicht/Irrlicht.cpp @@ -1,10 +1,10 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h #include "IrrCompileConfig.h" -static const char* const copyright = "Irrlicht Engine (c) 2002-2009 Nikolaus Gebhardt"; +static const char* const copyright = "Irrlicht Engine (c) 2002-2008 Nikolaus Gebhardt"; #ifdef _IRR_WINDOWS_ #include diff --git a/src/dep/src/irrlicht/Irrlicht9.0.sln b/src/dep/src/irrlicht/Irrlicht9.0.sln new file mode 100644 index 0000000..17f0dab --- /dev/null +++ b/src/dep/src/irrlicht/Irrlicht9.0.sln @@ -0,0 +1,32 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual C++ Express 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Irrlicht", "Irrlicht9.0.vcproj", "{E08E042A-6C45-411B-92BE-3CC31331019F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release - Fast FPU|Win32 = Release - Fast FPU|Win32 + Release|Win32 = Release|Win32 + Static lib - Debug|Win32 = Static lib - Debug|Win32 + Static lib - Release - Fast FPU|Win32 = Static lib - Release - Fast FPU|Win32 + Static lib - Release|Win32 = Static lib - Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.ActiveCfg = Debug|Win32 + {E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.Build.0 = Debug|Win32 + {E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU|Win32.ActiveCfg = Release - Fast FPU|Win32 + {E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU|Win32.Build.0 = Release - Fast FPU|Win32 + {E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.ActiveCfg = Release|Win32 + {E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.Build.0 = Release|Win32 + {E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|Win32.ActiveCfg = Static lib - Debug|Win32 + {E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|Win32.Build.0 = Static lib - Debug|Win32 + {E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release - Fast FPU|Win32.ActiveCfg = Static lib - Release - Fast FPU|Win32 + {E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release - Fast FPU|Win32.Build.0 = Static lib - Release - Fast FPU|Win32 + {E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|Win32.ActiveCfg = Static lib - Release|Win32 + {E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|Win32.Build.0 = Static lib - Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/dep/src/irrlicht/Irrlicht_mobile6.sln b/src/dep/src/irrlicht/Irrlicht_mobile6.sln new file mode 100644 index 0000000..be319a3 --- /dev/null +++ b/src/dep/src/irrlicht/Irrlicht_mobile6.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Irrlicht", "Irrlicht_mobile6.vcproj", "{E08E042A-6C45-411B-92BE-3CC31331019F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Windows Mobile 6 Professional SDK (ARMV4I) = Debug|Windows Mobile 6 Professional SDK (ARMV4I) + Release|Windows Mobile 6 Professional SDK (ARMV4I) = Release|Windows Mobile 6 Professional SDK (ARMV4I) + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 6 Professional SDK (ARMV4I) + {E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I) + {E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I) + {E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I) + {E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I) + {E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I) + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/dep/src/irrlicht/Irrlicht_mobile6.vcproj b/src/dep/src/irrlicht/Irrlicht_mobile6.vcproj new file mode 100644 index 0000000..ec08654 --- /dev/null +++ b/src/dep/src/irrlicht/Irrlicht_mobile6.vcproj @@ -0,0 +1,2880 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/dep/src/irrlicht/MacOSX/AppDelegate.h b/src/dep/src/irrlicht/MacOSX/AppDelegate.h index 5599032..606a397 100644 --- a/src/dep/src/irrlicht/MacOSX/AppDelegate.h +++ b/src/dep/src/irrlicht/MacOSX/AppDelegate.h @@ -1,4 +1,4 @@ -// Copyright (C) 2005 Etienne Petitjean +// Copyright (C) 2005-2008 Etienne Petitjean // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in Irrlicht.h @@ -7,10 +7,11 @@ @interface AppDelegate : NSObject { - BOOL _quit; + BOOL _quit; irr::CIrrDeviceMacOSX *_device; } - (id)initWithDevice:(irr::CIrrDeviceMacOSX *)device; +- (BOOL)isQuit; @end diff --git a/src/dep/src/irrlicht/MacOSX/AppDelegate.mm b/src/dep/src/irrlicht/MacOSX/AppDelegate.mm index 18711f6..244cebd 100644 --- a/src/dep/src/irrlicht/MacOSX/AppDelegate.mm +++ b/src/dep/src/irrlicht/MacOSX/AppDelegate.mm @@ -1,4 +1,4 @@ -// Copyright (C) 2005 Etienne Petitjean +// Copyright (C) 2005-2008 Etienne Petitjean // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in Irrlicht.h @@ -20,22 +20,22 @@ - (void)orderFrontStandardAboutPanel:(id)sender { - [NSApp orderFrontStandardAboutPanel:sender]; + [NSApp orderFrontStandardAboutPanel:sender]; } - (void)unhideAllApplications:(id)sender { - [NSApp unhideAllApplications:sender]; + [NSApp unhideAllApplications:sender]; } - (void)hide:(id)sender { - [NSApp hide:sender]; + [NSApp hide:sender]; } - (void)hideOtherApplications:(id)sender { - [NSApp hideOtherApplications:sender]; + [NSApp hideOtherApplications:sender]; } - (void)terminate:(id)sender @@ -43,11 +43,16 @@ _quit = TRUE; } +- (void)windowWillClose:(id)sender +{ + _quit = TRUE; +} + - (void)windowDidResize:(NSNotification *)aNotification { NSWindow *window; NSRect frame; - + window = [aNotification object]; frame = [window frame]; _device->setResize((int)frame.size.width,(int)frame.size.height); diff --git a/src/dep/src/irrlicht/MacOSX/CIrrDeviceMacOSX.h b/src/dep/src/irrlicht/MacOSX/CIrrDeviceMacOSX.h index 9808f88..c0d62b9 100644 --- a/src/dep/src/irrlicht/MacOSX/CIrrDeviceMacOSX.h +++ b/src/dep/src/irrlicht/MacOSX/CIrrDeviceMacOSX.h @@ -1,214 +1,219 @@ -// Copyright (C) 2005 Etienne Petitjean -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in Irrlicht.h - -#ifndef __C_IRR_DEVICE_MACOSX_H_INCLUDED__ -#define __C_IRR_DEVICE_MACOSX_H_INCLUDED__ - -#include "IrrCompileConfig.h" - -#ifdef MACOSX - -#include "CIrrDeviceStub.h" -#include "IrrlichtDevice.h" -#include "IImagePresenter.h" -#include "IGUIEnvironment.h" -#include "ICursorControl.h" - -#include -#include - -namespace irr -{ - class CIrrDeviceMacOSX : public CIrrDeviceStub, video::IImagePresenter - { - public: - - //! constructor - CIrrDeviceMacOSX(video::E_DRIVER_TYPE driverType, - const core::dimension2d& windowSize, - u32 bits, bool fullscreen, - bool sbuffer, bool vsync, - bool antiAlias, IEventReceiver* receiver, - const char* version); - - //! destructor - virtual ~CIrrDeviceMacOSX(); - - //! runs the device. Returns false if device wants to be deleted - virtual bool run(); - - //! Cause the device to temporarily pause execution and let other processes to run - // This should bring down processor usage without major performance loss for Irrlicht - virtual void yield(); - - //! Pause execution and let other processes to run for a specified amount of time. - virtual void sleep(u32 timeMs, bool pauseTimer); - - //! sets the caption of the window - virtual void setWindowCaption(const wchar_t* text); - - //! returns if window is active. if not, nothing need to be drawn - virtual bool isWindowActive() const; - - //! presents a surface in the client area - virtual void present(video::IImage* surface, s32 windowId = 0, core::rect* src=0 ); - - //! notifies the device that it should close itself - virtual void closeDevice(); - - //! Sets if the window should be resizeable in windowed mode. - virtual void setResizeAble(bool resize); - - void flush(); - void setMouseLocation(int x,int y); - void setResize(int width,int height); - void setCursorVisible(bool visible); - - private: - - //! create the driver - void createDriver(video::E_DRIVER_TYPE driverType, - const core::dimension2d& windowSize, u32 bits, bool fullscreen, - bool stencilbuffer, bool vsync, bool antiAlias); - - //! Implementation of the macos x cursor control - class CCursorControl : public gui::ICursorControl - { - public: - - CCursorControl(const core::dimension2d& wsize, CIrrDeviceMacOSX *device) : WindowSize(wsize), IsVisible(true), InvWindowSize(0.0f, 0.0f), _device(device), UseReferenceRect(false) - { - CursorPos.X = CursorPos.Y = 0; - if (WindowSize.Width!=0) InvWindowSize.Width = 1.0f / WindowSize.Width; - if (WindowSize.Height!=0) InvWindowSize.Height = 1.0f / WindowSize.Height; - } - - //! Changes the visible state of the mouse cursor. - virtual void setVisible(bool visible) - { - IsVisible = visible; - _device->setCursorVisible(visible); - } - - //! Returns if the cursor is currently visible. - virtual bool isVisible() const - { - return IsVisible; - } - - //! Sets the new position of the cursor. - virtual void setPosition(const core::position2d &pos) - { - setPosition(pos.X, pos.Y); - } - - //! Sets the new position of the cursor. - virtual void setPosition(f32 x, f32 y) - { - setPosition((s32)(x*WindowSize.Width), (s32)(y*WindowSize.Height)); - } - - //! Sets the new position of the cursor. - virtual void setPosition(const core::position2d &pos) - { - if (CursorPos.X != pos.X || CursorPos.Y != pos.Y) - setPosition(pos.X, pos.Y); - } - - //! Sets the new position of the cursor. - virtual void setPosition(s32 x, s32 y) - { - if (UseReferenceRect) - { - _device->setMouseLocation(ReferenceRect.UpperLeftCorner.X + x, ReferenceRect.UpperLeftCorner.Y + y); - } - else - { - _device->setMouseLocation(x,y); - } - } - - //! Returns the current position of the mouse cursor. - virtual core::position2d getPosition() - { - return CursorPos; - } - - //! Returns the current position of the mouse cursor. - virtual core::position2d getRelativePosition() - { - if (!UseReferenceRect) - { - return core::position2d(CursorPos.X * InvWindowSize.Width, - CursorPos.Y * InvWindowSize.Height); - } - - return core::position2d(CursorPos.X / (f32)ReferenceRect.getWidth(), - CursorPos.Y / (f32)ReferenceRect.getHeight()); - } - - //! Sets an absolute reference rect for calculating the cursor position. - virtual void setReferenceRect(core::rect* rect=0) - { - if (rect) - { - ReferenceRect = *rect; - UseReferenceRect = true; - - // prevent division through zero and uneven sizes - - if (!ReferenceRect.getHeight() || ReferenceRect.getHeight()%2) - ReferenceRect.LowerRightCorner.Y += 1; - - if (!ReferenceRect.getWidth() || ReferenceRect.getWidth()%2) - ReferenceRect.LowerRightCorner.X += 1; - } - else - UseReferenceRect = false; - } - - //! Updates the internal cursor position - void updateInternalCursorPosition(int x,int y) - { - CursorPos.X = x; - CursorPos.Y = y; - } - - private: - - core::position2d CursorPos; - core::dimension2d WindowSize; - core::dimension2d InvWindowSize; - CIrrDeviceMacOSX *_device; - bool IsVisible; - bool UseReferenceRect; - core::rect ReferenceRect; - }; - - bool createWindow(const irr::core::dimension2d& windowSize, irr::u32 bits, bool fullscreen, bool vsync, bool stencilBuffer); - void initKeycodes(); - void storeMouseLocation(); - void postMouseEvent(void *event,irr::SEvent &ievent); - void postKeyEvent(void *event,irr::SEvent &ievent,bool pressed); - - video::E_DRIVER_TYPE DriverType; - bool stencilbuffer; - - void *_window; - CGLContextObj _cglcontext; - void *_oglcontext; - int _width; - int _height; - std::map _keycodes; - int _screenWidth; - int _screenHeight; - bool _active; - }; - - -} // end namespace irr - -#endif // MACOSX -#endif // __C_IRR_DEVICE_MACOSX_H_INCLUDED__ - +// Copyright (C) 2005-2008 Etienne Petitjean +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in Irrlicht.h + +#ifndef __C_IRR_DEVICE_MACOSX_H_INCLUDED__ +#define __C_IRR_DEVICE_MACOSX_H_INCLUDED__ + +#include "IrrCompileConfig.h" + +#ifdef _IRR_USE_OSX_DEVICE_ + +#include "CIrrDeviceStub.h" +#include "IrrlichtDevice.h" +#include "IImagePresenter.h" +#include "IGUIEnvironment.h" +#include "ICursorControl.h" + +#include +#include + +namespace irr +{ + class CIrrDeviceMacOSX : public CIrrDeviceStub, video::IImagePresenter + { + public: + + //! constructor + CIrrDeviceMacOSX(const SIrrlichtCreationParameters& params); + + //! destructor + virtual ~CIrrDeviceMacOSX(); + + //! runs the device. Returns false if device wants to be deleted + virtual bool run(); + + //! Cause the device to temporarily pause execution and let other processes to run + // This should bring down processor usage without major performance loss for Irrlicht + virtual void yield(); + + //! Pause execution and let other processes to run for a specified amount of time. + virtual void sleep(u32 timeMs, bool pauseTimer); + + //! sets the caption of the window + virtual void setWindowCaption(const wchar_t* text); + + //! returns if window is active. if not, nothing need to be drawn + virtual bool isWindowActive() const; + + //! Checks if the Irrlicht window has focus + virtual bool isWindowFocused() const; + + //! Checks if the Irrlicht window is minimized + virtual bool isWindowMinimized() const; + + //! presents a surface in the client area + virtual bool present(video::IImage* surface, void* windowId=0, core::rect* src=0 ); + + //! notifies the device that it should close itself + virtual void closeDevice(); + + //! Sets if the window should be resizeable in windowed mode. + virtual void setResizeAble(bool resize); + + //! Activate any joysticks, and generate events for them. + virtual bool activateJoysticks(core::array & joystickInfo); + + //! \return Returns a pointer to a list with all video modes + //! supported by the gfx adapter. + virtual video::IVideoModeList* getVideoModeList(); + + void flush(); + void setMouseLocation(int x,int y); + void setResize(int width,int height); + void setCursorVisible(bool visible); + + private: + + //! create the driver + void createDriver(); + + //! Implementation of the macos x cursor control + class CCursorControl : public gui::ICursorControl + { + public: + + CCursorControl(const core::dimension2d& wsize, CIrrDeviceMacOSX *device) : WindowSize(wsize), IsVisible(true), InvWindowSize(0.0f, 0.0f), _device(device), UseReferenceRect(false) + { + CursorPos.X = CursorPos.Y = 0; + if (WindowSize.Width!=0) InvWindowSize.Width = 1.0f / WindowSize.Width; + if (WindowSize.Height!=0) InvWindowSize.Height = 1.0f / WindowSize.Height; + } + + //! Changes the visible state of the mouse cursor. + virtual void setVisible(bool visible) + { + IsVisible = visible; + _device->setCursorVisible(visible); + } + + //! Returns if the cursor is currently visible. + virtual bool isVisible() const + { + return IsVisible; + } + + //! Sets the new position of the cursor. + virtual void setPosition(const core::position2d &pos) + { + setPosition(pos.X, pos.Y); + } + + //! Sets the new position of the cursor. + virtual void setPosition(f32 x, f32 y) + { + setPosition((s32)(x*WindowSize.Width), (s32)(y*WindowSize.Height)); + } + + //! Sets the new position of the cursor. + virtual void setPosition(const core::position2d &pos) + { + if (CursorPos.X != pos.X || CursorPos.Y != pos.Y) + setPosition(pos.X, pos.Y); + } + + //! Sets the new position of the cursor. + virtual void setPosition(s32 x, s32 y) + { + if (UseReferenceRect) + { + _device->setMouseLocation(ReferenceRect.UpperLeftCorner.X + x, ReferenceRect.UpperLeftCorner.Y + y); + } + else + { + _device->setMouseLocation(x,y); + } + } + + //! Returns the current position of the mouse cursor. + virtual core::position2d getPosition() + { + return CursorPos; + } + + //! Returns the current position of the mouse cursor. + virtual core::position2d getRelativePosition() + { + if (!UseReferenceRect) + { + return core::position2d(CursorPos.X * InvWindowSize.Width, + CursorPos.Y * InvWindowSize.Height); + } + + return core::position2d(CursorPos.X / (f32)ReferenceRect.getWidth(), + CursorPos.Y / (f32)ReferenceRect.getHeight()); + } + + //! Sets an absolute reference rect for calculating the cursor position. + virtual void setReferenceRect(core::rect* rect=0) + { + if (rect) + { + ReferenceRect = *rect; + UseReferenceRect = true; + + // prevent division through zero and uneven sizes + + if (!ReferenceRect.getHeight() || ReferenceRect.getHeight()%2) + ReferenceRect.LowerRightCorner.Y += 1; + + if (!ReferenceRect.getWidth() || ReferenceRect.getWidth()%2) + ReferenceRect.LowerRightCorner.X += 1; + } + else + UseReferenceRect = false; + } + + //! Updates the internal cursor position + void updateInternalCursorPosition(int x,int y) + { + CursorPos.X = x; + CursorPos.Y = y; + } + + private: + + core::position2d CursorPos; + core::dimension2d WindowSize; + core::dimension2d InvWindowSize; + core::rect ReferenceRect; + CIrrDeviceMacOSX *_device; + bool IsVisible; + bool UseReferenceRect; + }; + + bool createWindow(); + void initKeycodes(); + void storeMouseLocation(); + void postMouseEvent(void *event,irr::SEvent &ievent); + void postKeyEvent(void *event,irr::SEvent &ievent,bool pressed); + + void *_window; + CGLContextObj _cglcontext; + void *_oglcontext; + int _width; + int _height; + std::map _keycodes; + int _screenWidth; + int _screenHeight; + bool _active; + + void pollJoysticks(); + }; + + +} // end namespace irr + +#endif // _IRR_USE_OSX_DEVICE_ +#endif // __C_IRR_DEVICE_MACOSX_H_INCLUDED__ + diff --git a/src/dep/src/irrlicht/MacOSX/CIrrDeviceMacOSX.mm b/src/dep/src/irrlicht/MacOSX/CIrrDeviceMacOSX.mm index 6e78cd2..403e901 100644 --- a/src/dep/src/irrlicht/MacOSX/CIrrDeviceMacOSX.mm +++ b/src/dep/src/irrlicht/MacOSX/CIrrDeviceMacOSX.mm @@ -1,629 +1,1258 @@ -// Copyright (C) 2005 Etienne Petitjean -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in Irrlicht.h - -#ifdef MACOSX - -#import -#import - -#include "CIrrDeviceMacOSX.h" -#include "IEventReceiver.h" -#include "irrList.h" -#include "os.h" -#include "CTimer.h" -#include "irrString.h" -#include "Keycodes.h" -#include -#include -#include "COSOperator.h" -#include "irrlicht.h" -#import -#import -#import "AppDelegate.h" - -namespace irr -{ - namespace video - { - IVideoDriver* createOpenGLDriver(const core::dimension2d& screenSize, CIrrDeviceMacOSX *device, bool fullscreen, bool stencilBuffer, io::IFileSystem* io, bool vsync, bool antiAlias); - } -} // end namespace irr - -static bool firstLaunch = true; - -namespace irr -{ -//! constructor -CIrrDeviceMacOSX::CIrrDeviceMacOSX(video::E_DRIVER_TYPE driverType, - const core::dimension2d& windowSize, - u32 bits, bool fullscreen, - bool sbuffer, bool vsync, - bool antiAlias, IEventReceiver* receiver, - const char* version) - : CIrrDeviceStub(version, receiver), DriverType(driverType), stencilbuffer(sbuffer), _window(NULL), _active(true), _oglcontext(NULL), _cglcontext(NULL) -{ - struct utsname name; - NSString *path; - - #ifdef _DEBUG - setDebugName("CIrrDeviceMacOSX"); - #endif - - if (firstLaunch) - { - firstLaunch = false; - - [[NSAutoreleasePool alloc] init]; - [NSApplication sharedApplication]; - [NSApp setDelegate:[[[AppDelegate alloc] initWithDevice:this] autorelease]]; - [NSBundle loadNibNamed:@"MainMenu" owner:[NSApp delegate]]; - [NSApp finishLaunching]; - - path = [[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent]; - chdir([path cString]); - } - - uname(&name); - Operator = new COSOperator(name.version); - os::Printer::log(name.version,ELL_INFORMATION); - - initKeycodes(); - if (driverType != video::EDT_NULL) createWindow(windowSize,bits,fullscreen,vsync,stencilbuffer); - CursorControl = new CCursorControl(windowSize, this); - createDriver(driverType,windowSize,bits,fullscreen,stencilbuffer,vsync,antiAlias); - createGUIAndScene(); -} - -CIrrDeviceMacOSX::~CIrrDeviceMacOSX() -{ - closeDevice(); -} - -void CIrrDeviceMacOSX::closeDevice() -{ - if (_window != NULL) - { - [_window setIsVisible:FALSE]; - - if (_oglcontext != NULL) - { - [_oglcontext clearDrawable]; - [_oglcontext release]; - _oglcontext = NULL; - } - - [_window setReleasedWhenClosed:TRUE]; - [_window release]; - _window = NULL; - } - else - { - if (_cglcontext != NULL) - { - CGLSetCurrentContext(NULL); - CGLClearDrawable(_cglcontext); - CGLDestroyContext(_cglcontext); - } - } - - _active = FALSE; - _cglcontext = NULL; -} - -bool CIrrDeviceMacOSX::createWindow(const irr::core::dimension2d& windowSize, irr::u32 bits, bool fullscreen, bool vsync, bool stencilBuffer) -{ - int index; - CGDisplayErr error; - bool result; - NSOpenGLPixelFormat *format; - CGDirectDisplayID display; - CGLPixelFormatObj pixelFormat; - CGRect displayRect; - CGLPixelFormatAttribute fullattribs[32]; - NSOpenGLPixelFormatAttribute windowattribs[32]; - CFDictionaryRef displaymode,olddisplaymode; - long numPixelFormats,newSwapInterval; - - result = false; - display = CGMainDisplayID(); - _screenWidth = (int) CGDisplayPixelsWide(display); - _screenHeight = (int) CGDisplayPixelsHigh(display); - - if (!fullscreen) - { - _window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,windowSize.Width,windowSize.Height) styleMask:NSTitledWindowMask+NSClosableWindowMask+NSResizableWindowMask backing:NSBackingStoreBuffered defer:FALSE]; - if (_window != NULL) - { - index = 0; - windowattribs[index++] = NSOpenGLPFANoRecovery; - windowattribs[index++] = NSOpenGLPFADoubleBuffer; - windowattribs[index++] = NSOpenGLPFAAccelerated; - windowattribs[index++] = NSOpenGLPFADepthSize; - windowattribs[index++] = (NSOpenGLPixelFormatAttribute)16; - windowattribs[index++] = NSOpenGLPFAColorSize; - windowattribs[index++] = (NSOpenGLPixelFormatAttribute)bits; - - if (stencilBuffer) - { - windowattribs[index++] = NSOpenGLPFAStencilSize; - windowattribs[index++] = (NSOpenGLPixelFormatAttribute)1; - } - - windowattribs[index++] = (NSOpenGLPixelFormatAttribute)NULL; - - format = [[NSOpenGLPixelFormat alloc] initWithAttributes:windowattribs]; - if (format != NULL) - { - _oglcontext = [[NSOpenGLContext alloc] initWithFormat:format shareContext:NULL]; - [format release]; - } - - if (_oglcontext != NULL) - { - [_window center]; - [_window setDelegate:[NSApp delegate]]; - [_oglcontext setView:[_window contentView]]; - [_window setAcceptsMouseMovedEvents:TRUE]; - [_window setIsVisible:TRUE]; - [_window makeKeyAndOrderFront:nil]; - - _cglcontext = (CGLContextObj) [_oglcontext CGLContextObj]; - _width = windowSize.Width; - _height = windowSize.Height; - result = true; - } - } - } - else - { - displaymode = CGDisplayBestModeForParameters(display,bits,windowSize.Width,windowSize.Height,NULL); - if (displaymode != NULL) - { - olddisplaymode = CGDisplayCurrentMode(display); - error = CGCaptureAllDisplays(); - if (error == CGDisplayNoErr) - { - error = CGDisplaySwitchToMode(display,displaymode); - if (error == CGDisplayNoErr) - { - pixelFormat = NULL; - numPixelFormats = 0; - - index = 0; - fullattribs[index++] = kCGLPFAFullScreen; - fullattribs[index++] = kCGLPFADisplayMask; - fullattribs[index++] = (CGLPixelFormatAttribute)CGDisplayIDToOpenGLDisplayMask(display); - fullattribs[index++] = kCGLPFADoubleBuffer; - fullattribs[index++] = kCGLPFAAccelerated; - fullattribs[index++] = kCGLPFADepthSize; - fullattribs[index++] = (CGLPixelFormatAttribute)16; - fullattribs[index++] = kCGLPFAColorSize; - fullattribs[index++] = (CGLPixelFormatAttribute)bits; - - if (stencilBuffer) - { - fullattribs[index++] = kCGLPFAStencilSize; - fullattribs[index++] = (CGLPixelFormatAttribute)1; - } - - fullattribs[index++] = (CGLPixelFormatAttribute)NULL; - CGLChoosePixelFormat(fullattribs,&pixelFormat,&numPixelFormats); - - if (pixelFormat != NULL) - { - CGLCreateContext(pixelFormat,NULL,&_cglcontext); - CGLDestroyPixelFormat(pixelFormat); - } - - if (_cglcontext != NULL) - { - CGLSetFullScreen(_cglcontext); - displayRect = CGDisplayBounds(display); - _width = (int)displayRect.size.width; - _height = (int)displayRect.size.height; - result = true; - } - } - } - } - } - - if (result) - { - CGLSetCurrentContext(_cglcontext); - newSwapInterval = (vsync) ? 1 : 0; - CGLSetParameter(_cglcontext,kCGLCPSwapInterval,&newSwapInterval); - glViewport(0,0,_width,_height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - } - - return (result); -} - -void CIrrDeviceMacOSX::setResize(int width,int height) -{ - _width = width; - _height = height; - [_oglcontext update]; - getVideoDriver()->OnResize(core::dimension2d(width, height)); -} - -void CIrrDeviceMacOSX::createDriver(video::E_DRIVER_TYPE driverType,const core::dimension2d& windowSize,u32 bits,bool fullscreen,bool stencilbuffer, bool vsync, bool antiAlias) -{ - switch (driverType) - { - case video::EDT_SOFTWARE: - #ifdef _IRR_COMPILE_WITH_SOFTWARE_ - VideoDriver = video::createSoftwareDriver(windowSize, fullscreen, FileSystem, this); - #else - os::Printer::log("No Software driver support compiled in.", ELL_ERROR); - #endif - break; - - case video::EDT_BURNINGSVIDEO: - #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_ - VideoDriver = video::createSoftwareDriver2(windowSize, fullscreen, FileSystem, this); - #else - os::Printer::log("Burning's video driver was not compiled in.", ELL_ERROR); - #endif - break; - - case video::EDT_OPENGL: - #ifdef _IRR_COMPILE_WITH_OPENGL_ - VideoDriver = video::createOpenGLDriver(windowSize, this, fullscreen, stencilbuffer, FileSystem, vsync, antiAlias); - #else - os::Printer::log("No OpenGL support compiled in.", ELL_ERROR); - #endif - break; - - case video::EDT_DIRECT3D8: - case video::EDT_DIRECT3D9: - os::Printer::log("This driver is not available in OSX. Try OpenGL or Software renderer.", ELL_ERROR); - break; - - case video::EDT_NULL: - VideoDriver = video::createNullDriver(FileSystem, windowSize); - break; - - default: - os::Printer::log("Unable to create video driver of unknown type.", ELL_ERROR); - break; - } -} - -void CIrrDeviceMacOSX::flush() -{ - if (_cglcontext != NULL) - { - glFinish(); - CGLFlushDrawable(_cglcontext); - } -} - -bool CIrrDeviceMacOSX::run() -{ - NSEvent *event; - irr::SEvent ievent; - - os::Timer::tick(); - storeMouseLocation(); - - event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil inMode:NSDefaultRunLoopMode dequeue:YES]; - if (event != nil) - { - bzero(&ievent,sizeof(ievent)); - - switch([event type]) - { - case NSKeyDown: - postKeyEvent(event,ievent,true); - break; - - case NSKeyUp: - postKeyEvent(event,ievent,false); - break; - - case NSLeftMouseDown: - ievent.EventType = irr::EET_MOUSE_INPUT_EVENT; - ievent.MouseInput.Event = irr::EMIE_LMOUSE_PRESSED_DOWN; - postMouseEvent(event,ievent); - break; - - case NSLeftMouseUp: - ievent.EventType = irr::EET_MOUSE_INPUT_EVENT; - ievent.MouseInput.Event = irr::EMIE_LMOUSE_LEFT_UP; - postMouseEvent(event,ievent); - break; - - case NSMouseMoved: - case NSLeftMouseDragged: - case NSRightMouseDragged: - ievent.EventType = irr::EET_MOUSE_INPUT_EVENT; - ievent.MouseInput.Event = irr::EMIE_MOUSE_MOVED; - postMouseEvent(event,ievent); - break; - - case NSRightMouseDown: - ievent.EventType = irr::EET_MOUSE_INPUT_EVENT; - ievent.MouseInput.Event = irr::EMIE_RMOUSE_PRESSED_DOWN; - postMouseEvent(event,ievent); - break; - - case NSRightMouseUp: - ievent.EventType = irr::EET_MOUSE_INPUT_EVENT; - ievent.MouseInput.Event = irr::EMIE_RMOUSE_LEFT_UP; - postMouseEvent(event,ievent); - break; - - case NSScrollWheel: - ievent.EventType = irr::EET_MOUSE_INPUT_EVENT; - ievent.MouseInput.Event = irr::EMIE_MOUSE_WHEEL; - ievent.MouseInput.Wheel = [event deltaY]; - if (ievent.MouseInput.Wheel < 1.0f) ievent.MouseInput.Wheel *= 10.0f; - else ievent.MouseInput.Wheel *= 5.0f; - postMouseEvent(event,ievent); - break; - - default: - [NSApp sendEvent:event]; - break; - } - } - - return (![[NSApp delegate] isQuit] && _active); -} - -//! Pause the current process for the minimum time allowed only to allow other processes to execute -void CIrrDeviceMacOSX::yield() -{ - // TODO: Does this work or maybe is there a better way? - struct timespec ts = {0,0}; - nanosleep(&ts, NULL); -} - -//! Pause execution and let other processes to run for a specified amount of time. -void CIrrDeviceMacOSX::sleep(u32 timeMs, bool pauseTimer=false) -{ - // TODO: Does this work or maybe is there a better way? - - bool wasStopped = Timer ? Timer->isStopped() : true; - - struct timespec ts; - ts.tv_sec = (time_t) (timeMs / 1000); - ts.tv_nsec = (long) (timeMs % 1000) * 1000000; - - if (pauseTimer && !wasStopped) - Timer->stop(); - - nanosleep(&ts, NULL); - - if (pauseTimer && !wasStopped) - Timer->start(); -} - -void CIrrDeviceMacOSX::present(video::IImage* image, s32 windowId, core::rect* src ) -{ -} - -void CIrrDeviceMacOSX::setWindowCaption(const wchar_t* text) -{ - size_t size; - char title[1024]; - - if (_window != NULL) - { - size = wcstombs(title,text,1024); - if (size == 1024) title[1023] = 0; - [_window setTitle:[NSString stringWithCString:title length:size]]; - } -} - -bool CIrrDeviceMacOSX::isWindowActive() const -{ - return (_active); -} - -void CIrrDeviceMacOSX::postKeyEvent(void *event,irr::SEvent &ievent,bool pressed) -{ - NSString *str; - std::map::const_iterator iter; - unsigned int result,c,mkey,mchar; - const unsigned char *cStr; - BOOL skipCommand; - - str = [event characters]; - if (str != nil && [str length] > 0) - { - mkey = mchar = 0; - skipCommand = false; - c = [str characterAtIndex:0]; - - iter = _keycodes.find(c); - if (iter != _keycodes.end()) mkey = (*iter).second; - else - { - cStr = (unsigned char *)[str cStringUsingEncoding:NSWindowsCP1252StringEncoding]; - if (cStr != NULL && strlen((char*)cStr) > 0) - { - mchar = cStr[0]; - mkey = toupper(mchar); - if ([event modifierFlags] & NSCommandKeyMask) - { - if (mkey == 'C' || mkey == 'V' || mkey == 'X') - { - mchar = 0; - skipCommand = true; - } - } - } - } - - ievent.EventType = irr::EET_KEY_INPUT_EVENT; - ievent.KeyInput.Key = (irr::EKEY_CODE)mkey; - ievent.KeyInput.PressedDown = pressed; - ievent.KeyInput.Shift = ([event modifierFlags] & NSShiftKeyMask) != 0; - ievent.KeyInput.Control = ([event modifierFlags] & NSControlKeyMask) != 0; - ievent.KeyInput.Char = (irr::EKEY_CODE)mchar; - - if (skipCommand) - ievent.KeyInput.Control = true; - else if ([event modifierFlags] & NSCommandKeyMask) - [NSApp sendEvent:(NSEvent *)event]; - - postEventFromUser(ievent); - } -} - -void CIrrDeviceMacOSX::postMouseEvent(void *event,irr::SEvent &ievent) -{ - BOOL post = true; - - if (_window != NULL) - { - ievent.MouseInput.X = (int)[event locationInWindow].x; - ievent.MouseInput.Y = _height - (int)[event locationInWindow].y; - if (ievent.MouseInput.Y < 0) post = false; - } - else - { - ievent.MouseInput.X = (int)[NSEvent mouseLocation].x; - ievent.MouseInput.Y = _height - (int)[NSEvent mouseLocation].y; - } - - if (post) postEventFromUser(ievent); - [NSApp sendEvent:(NSEvent *)event]; -} - -void CIrrDeviceMacOSX::storeMouseLocation() -{ - NSPoint p; - int x,y; - - p = [NSEvent mouseLocation]; - - if (_window != NULL) - { - p = [_window convertScreenToBase:p]; - x = (int)p.x; - y = _height - (int)p.y; - } - else - { - x = (int)p.x; - y = _screenHeight - (int)p.y; - } - - ((CCursorControl *)CursorControl)->updateInternalCursorPosition(x,y); -} - -void CIrrDeviceMacOSX::setMouseLocation(int x,int y) -{ - NSPoint p; - CGPoint c; - - if (_window != NULL) - { - p.x = (float) x; - p.y = (float) (_height - y); - p = [_window convertBaseToScreen:p]; - p.y = _screenHeight - p.y; - } - else - { - p.x = (float) x; - p.y = (float) (_height - y); - } - - c.x = p.x; - c.y = p.y; - CGSetLocalEventsSuppressionInterval(0); - CGWarpMouseCursorPosition(c); -} - -void CIrrDeviceMacOSX::setCursorVisible(bool visible) -{ - CGDirectDisplayID display; - - display = CGMainDisplayID(); - if (visible) CGDisplayShowCursor(display); - else CGDisplayHideCursor(display); -} - -void CIrrDeviceMacOSX::initKeycodes() -{ - _keycodes[NSUpArrowFunctionKey] = irr::KEY_UP; - _keycodes[NSDownArrowFunctionKey] = irr::KEY_DOWN; - _keycodes[NSLeftArrowFunctionKey] = irr::KEY_LEFT; - _keycodes[NSRightArrowFunctionKey] = irr::KEY_RIGHT; - _keycodes[NSF1FunctionKey] = irr::KEY_F1; - _keycodes[NSF2FunctionKey] = irr::KEY_F2; - _keycodes[NSF3FunctionKey] = irr::KEY_F3; - _keycodes[NSF4FunctionKey] = irr::KEY_F4; - _keycodes[NSF5FunctionKey] = irr::KEY_F5; - _keycodes[NSF6FunctionKey] = irr::KEY_F6; - _keycodes[NSF7FunctionKey] = irr::KEY_F7; - _keycodes[NSF8FunctionKey] = irr::KEY_F8; - _keycodes[NSF9FunctionKey] = irr::KEY_F9; - _keycodes[NSF10FunctionKey] = irr::KEY_F10; - _keycodes[NSF11FunctionKey] = irr::KEY_F11; - _keycodes[NSF12FunctionKey] = irr::KEY_F12; - _keycodes[NSF13FunctionKey] = irr::KEY_F13; - _keycodes[NSF14FunctionKey] = irr::KEY_F14; - _keycodes[NSF15FunctionKey] = irr::KEY_F15; - _keycodes[NSF16FunctionKey] = irr::KEY_F16; - _keycodes[NSHomeFunctionKey] = irr::KEY_HOME; - _keycodes[NSEndFunctionKey] = irr::KEY_END; - _keycodes[NSInsertFunctionKey] = irr::KEY_INSERT; - _keycodes[NSDeleteFunctionKey] = irr::KEY_DELETE; - _keycodes[NSHelpFunctionKey] = irr::KEY_HELP; - _keycodes[NSSelectFunctionKey] = irr::KEY_SELECT; - _keycodes[NSPrintFunctionKey] = irr::KEY_PRINT; - _keycodes[NSExecuteFunctionKey] = irr::KEY_EXECUT; - _keycodes[NSPrintScreenFunctionKey] = irr::KEY_SNAPSHOT; - _keycodes[NSPauseFunctionKey] = irr::KEY_PAUSE; - _keycodes[NSScrollLockFunctionKey] = irr::KEY_SCROLL; - _keycodes[0x7F] = irr::KEY_BACK; - _keycodes[0x09] = irr::KEY_TAB; - _keycodes[0x0D] = irr::KEY_RETURN; - _keycodes[0x03] = irr::KEY_RETURN; - _keycodes[0x1B] = irr::KEY_ESCAPE; -} - -//! Sets if the window should be resizeable in windowed mode. - -void CIrrDeviceMacOSX::setResizeAble(bool resize) -{ - // todo: implement resize -} - - -IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(const SIrrlichtCreationParameters& param) -{ - CIrrDeviceMacOSX* dev = new CIrrDeviceMacOSX( - param.DriverType, - param.WindowSize, - param.Bits, - param.Fullscreen, - param.Stencilbuffer, - param.Vsync, - param.AntiAlias, - param.EventReceiver, - param.SDK_version_do_not_use); - - if (dev && !dev->getVideoDriver() && param.DriverType != video::EDT_NULL) - { - dev->drop(); - dev = 0; - } - - return dev; -} - -} - -#endif - +// Copyright (C) 2005-2008 Etienne Petitjean +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in Irrlicht.h + +#include "IrrCompileConfig.h" + +#ifdef _IRR_USE_OSX_DEVICE_ + +#import +#import +#import + +#include "CIrrDeviceMacOSX.h" +#include "IEventReceiver.h" +#include "irrList.h" +#include "os.h" +#include "CTimer.h" +#include "irrString.h" +#include "Keycodes.h" +#include +#include +#include "COSOperator.h" +#include "irrlicht.h" +#import +#import +#import "AppDelegate.h" + +#if defined _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ + +#include +#include +#ifdef MACOS_10_0_4 +#include +#else +/* The header was moved here in Mac OS X 10.1 */ +#include +#endif +#include +#include + +struct JoystickComponent +{ + IOHIDElementCookie cookie; // unique value which identifies element, will NOT change + long min; // reported min value possible + long max; // reported max value possible + + long minRead; //min read value + long maxRead; //max read value + + JoystickComponent() : min(0), minRead(0), max(0), maxRead(0) + { + } +}; + +struct JoystickInfo +{ + irr::core::array axisComp; + irr::core::array buttonComp; + irr::core::array hatComp; + + int hats; + int axes; + int buttons; + + int numActiveJoysticks; + + irr::SEvent persistentData; + + IOHIDDeviceInterface ** interface; + bool removed; + char joystickName[256]; + long usage; // usage page from IOUSBHID Parser.h which defines general usage + long usagePage; // usage within above page from IOUSBHID Parser.h which defines specific usage + + JoystickInfo() : hats(0), axes(0), buttons(0), interface(0), removed(false), usage(0), usagePage(0), numActiveJoysticks(0) + { + interface = NULL; + memset(joystickName, '\0', 256); + axisComp.clear(); + buttonComp.clear(); + hatComp.clear(); + + persistentData.EventType = irr::EET_JOYSTICK_INPUT_EVENT; + persistentData.JoystickEvent.POV = 65535; + persistentData.JoystickEvent.ButtonStates = 0; + } +}; +irr::core::array ActiveJoysticks; + +//helper functions for init joystick +static IOReturn closeJoystickDevice (JoystickInfo* joyInfo) +{ + IOReturn result = kIOReturnSuccess; + if (joyInfo && joyInfo->interface) { + /* close the interface */ + result = (*(joyInfo->interface))->close (joyInfo->interface); + if (kIOReturnNotOpen == result) + { + /* do nothing as device was not opened, thus can't be closed */ + } + else if (kIOReturnSuccess != result) + irr::os::Printer::log("IOHIDDeviceInterface failed to close", irr::ELL_ERROR); + /* release the interface */ + result = (*(joyInfo->interface))->Release (joyInfo->interface); + if (kIOReturnSuccess != result) + irr::os::Printer::log("IOHIDDeviceInterface failed to release", irr::ELL_ERROR); + joyInfo->interface = NULL; + } + return result; +} + +static void addComponentInfo (CFTypeRef refElement, JoystickComponent *pComponent, int numActiveJoysticks) +{ + long number; + CFTypeRef refType; + + refType = CFDictionaryGetValue ((CFDictionaryRef)refElement, CFSTR(kIOHIDElementCookieKey)); + if (refType && CFNumberGetValue ((CFNumberRef)refType, kCFNumberLongType, &number)) + pComponent->cookie = (IOHIDElementCookie) number; + refType = CFDictionaryGetValue ((CFDictionaryRef)refElement, CFSTR(kIOHIDElementMinKey)); + if (refType && CFNumberGetValue ((CFNumberRef)refType, kCFNumberLongType, &number)) + pComponent->minRead = pComponent->min = number; + refType = CFDictionaryGetValue ((CFDictionaryRef)refElement, CFSTR(kIOHIDElementMaxKey)); + if (refType && CFNumberGetValue ((CFNumberRef)refType, kCFNumberLongType, &number)) + pComponent->maxRead = pComponent->max = number; +} + +static void getJoystickComponentArrayHandler (const void * value, void * parameter); + +static void addJoystickComponent (CFTypeRef refElement, JoystickInfo* joyInfo) +{ + long elementType, usagePage, usage; + CFTypeRef refElementType = CFDictionaryGetValue ((CFDictionaryRef)refElement, CFSTR(kIOHIDElementTypeKey)); + CFTypeRef refUsagePage = CFDictionaryGetValue ((CFDictionaryRef)refElement, CFSTR(kIOHIDElementUsagePageKey)); + CFTypeRef refUsage = CFDictionaryGetValue ((CFDictionaryRef)refElement, CFSTR(kIOHIDElementUsageKey)); + + + if ((refElementType) && (CFNumberGetValue ((CFNumberRef)refElementType, kCFNumberLongType, &elementType))) + { + /* look at types of interest */ + if ((elementType == kIOHIDElementTypeInput_Misc) || (elementType == kIOHIDElementTypeInput_Button) || + (elementType == kIOHIDElementTypeInput_Axis)) + { + if (refUsagePage && CFNumberGetValue ((CFNumberRef)refUsagePage, kCFNumberLongType, &usagePage) && + refUsage && CFNumberGetValue ((CFNumberRef)refUsage, kCFNumberLongType, &usage)) + { + switch (usagePage) /* only interested in kHIDPage_GenericDesktop and kHIDPage_Button */ + { + case kHIDPage_GenericDesktop: + { + switch (usage) /* look at usage to determine function */ + { + case kHIDUsage_GD_X: + case kHIDUsage_GD_Y: + case kHIDUsage_GD_Z: + case kHIDUsage_GD_Rx: + case kHIDUsage_GD_Ry: + case kHIDUsage_GD_Rz: + case kHIDUsage_GD_Slider: + case kHIDUsage_GD_Dial: + case kHIDUsage_GD_Wheel: + { + joyInfo->axes++; + JoystickComponent newComponent; + addComponentInfo(refElement, &newComponent, joyInfo->numActiveJoysticks); + joyInfo->axisComp.push_back(newComponent); + } + break; + case kHIDUsage_GD_Hatswitch: + { + joyInfo->hats++; + JoystickComponent newComponent; + addComponentInfo(refElement, &newComponent, joyInfo->numActiveJoysticks); + joyInfo->hatComp.push_back(newComponent); + } + break; + } + } + break; + case kHIDPage_Button: + { + joyInfo->buttons++; + JoystickComponent newComponent; + addComponentInfo(refElement, &newComponent, joyInfo->numActiveJoysticks); + joyInfo->buttonComp.push_back(newComponent); + } + break; + default: + break; + } + } + } + else if (kIOHIDElementTypeCollection == elementType) { + //get elements + CFTypeRef refElementTop = CFDictionaryGetValue ((CFMutableDictionaryRef) refElement, CFSTR(kIOHIDElementKey)); + if (refElementTop) { + CFTypeID type = CFGetTypeID (refElementTop); + if (type == CFArrayGetTypeID()) { + CFRange range = {0, CFArrayGetCount ((CFArrayRef)refElementTop)}; + CFArrayApplyFunction ((CFArrayRef)refElementTop, range, getJoystickComponentArrayHandler, joyInfo); + } + } + } + } + +} + +static void getJoystickComponentArrayHandler (const void * value, void * parameter) +{ + if (CFGetTypeID (value) == CFDictionaryGetTypeID ()) + addJoystickComponent ((CFTypeRef) value, (JoystickInfo *) parameter); +} + +static void joystickTopLevelElementHandler (const void * value, void * parameter) +{ + CFTypeRef refCF = 0; + if (CFGetTypeID (value) != CFDictionaryGetTypeID ()) + return; + refCF = CFDictionaryGetValue ((CFDictionaryRef)value, CFSTR(kIOHIDElementUsagePageKey)); + if (!CFNumberGetValue ((CFNumberRef)refCF, kCFNumberLongType, &((JoystickInfo *) parameter)->usagePage)) + irr::os::Printer::log("CFNumberGetValue error retrieving JoystickInfo->usagePage", irr::ELL_ERROR); + refCF = CFDictionaryGetValue ((CFDictionaryRef)value, CFSTR(kIOHIDElementUsageKey)); + if (!CFNumberGetValue ((CFNumberRef)refCF, kCFNumberLongType, &((JoystickInfo *) parameter)->usage)) + irr::os::Printer::log("CFNumberGetValue error retrieving JoystickInfo->usage", irr::ELL_ERROR); +} + +static void getJoystickDeviceInfo (io_object_t hidDevice, CFMutableDictionaryRef hidProperties, JoystickInfo *joyInfo) +{ + CFMutableDictionaryRef usbProperties = 0; + io_registry_entry_t parent1, parent2; + + /* Mac OS X currently is not mirroring all USB properties to HID page so need to look at USB device page also + * get dictionary for usb properties: step up two levels and get CF dictionary for USB properties + */ + if ((KERN_SUCCESS == IORegistryEntryGetParentEntry (hidDevice, kIOServicePlane, &parent1)) && + (KERN_SUCCESS == IORegistryEntryGetParentEntry (parent1, kIOServicePlane, &parent2)) && + (KERN_SUCCESS == IORegistryEntryCreateCFProperties (parent2, &usbProperties, kCFAllocatorDefault, kNilOptions))) + { + if (usbProperties) + { + CFTypeRef refCF = 0; + /* get device info + * try hid dictionary first, if fail then go to usb dictionary + */ + + + /* get joystickName name */ + refCF = CFDictionaryGetValue (hidProperties, CFSTR(kIOHIDProductKey)); + if (!refCF) + refCF = CFDictionaryGetValue (usbProperties, CFSTR("USB Product Name")); + if (refCF) + { + if (!CFStringGetCString ((CFStringRef)refCF, joyInfo->joystickName, 256, CFStringGetSystemEncoding ())) + irr::os::Printer::log("CFStringGetCString error getting joyInfo->joystickName", irr::ELL_ERROR); + } + + /* get usage page and usage */ + refCF = CFDictionaryGetValue (hidProperties, CFSTR(kIOHIDPrimaryUsagePageKey)); + if (refCF) + { + if (!CFNumberGetValue ((CFNumberRef)refCF, kCFNumberLongType, &joyInfo->usagePage)) + irr::os::Printer::log("CFNumberGetValue error getting joyInfo->usagePage", irr::ELL_ERROR); + refCF = CFDictionaryGetValue (hidProperties, CFSTR(kIOHIDPrimaryUsageKey)); + if (refCF) + if (!CFNumberGetValue ((CFNumberRef)refCF, kCFNumberLongType, &joyInfo->usage)) + irr::os::Printer::log("CFNumberGetValue error getting joyInfo->usage", irr::ELL_ERROR); + } + + if (NULL == refCF) /* get top level element HID usage page or usage */ + { + /* use top level element instead */ + CFTypeRef refCFTopElement = 0; + refCFTopElement = CFDictionaryGetValue (hidProperties, CFSTR(kIOHIDElementKey)); + { + /* refCFTopElement points to an array of element dictionaries */ + CFRange range = {0, CFArrayGetCount ((CFArrayRef)refCFTopElement)}; + CFArrayApplyFunction ((CFArrayRef)refCFTopElement, range, joystickTopLevelElementHandler, joyInfo); + } + } + + CFRelease (usbProperties); + } + else + irr::os::Printer::log("IORegistryEntryCreateCFProperties failed to create usbProperties", irr::ELL_ERROR); + + if (kIOReturnSuccess != IOObjectRelease (parent2)) + irr::os::Printer::log("IOObjectRelease failed to release parent2", irr::ELL_ERROR); + if (kIOReturnSuccess != IOObjectRelease (parent1)) + irr::os::Printer::log("IOObjectRelease failed to release parent1", irr::ELL_ERROR); + } +} + +#endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ + +//------------------------------------------------------------------------------------------ +Boolean GetDictionaryBoolean(CFDictionaryRef theDict, const void* key) +{ + // get a boolean from the dictionary + Boolean value = false; + CFBooleanRef boolRef; + boolRef = (CFBooleanRef)CFDictionaryGetValue(theDict, key); + if (boolRef != NULL) + value = CFBooleanGetValue(boolRef); + return value; +} +//------------------------------------------------------------------------------------------ +long GetDictionaryLong(CFDictionaryRef theDict, const void* key) +{ + // get a long from the dictionary + long value = 0; + CFNumberRef numRef; + numRef = (CFNumberRef)CFDictionaryGetValue(theDict, key); + if (numRef != NULL) + CFNumberGetValue(numRef, kCFNumberLongType, &value); + return value; +} + +namespace irr +{ + namespace video + { + IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& param, io::IFileSystem* io, CIrrDeviceMacOSX *device); + } +} // end namespace irr + +static bool firstLaunch = true; + +namespace irr +{ +//! constructor +CIrrDeviceMacOSX::CIrrDeviceMacOSX(const SIrrlichtCreationParameters& param) + : CIrrDeviceStub(param), _window(NULL), _active(true), _oglcontext(NULL), _cglcontext(NULL) +{ + struct utsname name; + NSString *path; + + #ifdef _DEBUG + setDebugName("CIrrDeviceMacOSX"); + #endif + + if (firstLaunch) + { + firstLaunch = false; + + [[NSAutoreleasePool alloc] init]; + [NSApplication sharedApplication]; + [NSApp setDelegate:[[[AppDelegate alloc] initWithDevice:this] autorelease]]; + [NSBundle loadNibNamed:@"MainMenu" owner:[NSApp delegate]]; + [NSApp finishLaunching]; + + path = [[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent]; + chdir([path cString]); + } + + uname(&name); + Operator = new COSOperator(name.version); + os::Printer::log(name.version,ELL_INFORMATION); + + initKeycodes(); + if (CreationParams.DriverType != video::EDT_NULL) + createWindow(); + + setResizeAble(false); + + CursorControl = new CCursorControl(CreationParams.WindowSize, this); + createDriver(); + createGUIAndScene(); +} + +CIrrDeviceMacOSX::~CIrrDeviceMacOSX() +{ + SetSystemUIMode(kUIModeNormal, 0); + closeDevice(); +#if defined(_IRR_COMPILE_WITH_JOYSTICK_EVENTS_) + for(u32 joystick = 0; joystick < ActiveJoysticks.size(); ++joystick) + { + if(ActiveJoysticks[joystick].interface) + closeJoystickDevice(&ActiveJoysticks[joystick]); + } +#endif +} + +void CIrrDeviceMacOSX::closeDevice() +{ + if (_window != NULL) + { + [(NSWindow *)_window setIsVisible:FALSE]; + + if (_oglcontext != NULL) + { + [(NSOpenGLContext *)_oglcontext clearDrawable]; + [(NSOpenGLContext *)_oglcontext release]; + _oglcontext = NULL; + } + + [(NSWindow *)_window setReleasedWhenClosed:TRUE]; + [(NSWindow *)_window release]; + _window = NULL; + } + else + { + if (_cglcontext != NULL) + { + CGLSetCurrentContext(NULL); + CGLClearDrawable(_cglcontext); + CGLDestroyContext(_cglcontext); + } + } + + _active = FALSE; + _cglcontext = NULL; +} + +bool CIrrDeviceMacOSX::createWindow() +{ + int index; + CGDisplayErr error; + bool result; + NSOpenGLPixelFormat *format; + CGDirectDisplayID display; + CGLPixelFormatObj pixelFormat; + CGRect displayRect; + CGLPixelFormatAttribute fullattribs[32]; + NSOpenGLPixelFormatAttribute windowattribs[32]; + CFDictionaryRef displaymode,olddisplaymode; + GLint numPixelFormats,newSwapInterval; + int alphaSize = CreationParams.WithAlphaChannel?4:0, depthSize = CreationParams.ZBufferBits; + + if (CreationParams.WithAlphaChannel && (CreationParams.Bits == 32)) + alphaSize = 8; + + result = false; + display = CGMainDisplayID(); + _screenWidth = (int) CGDisplayPixelsWide(display); + _screenHeight = (int) CGDisplayPixelsHigh(display); + + VideoModeList.setDesktop(CreationParams.Bits,core::dimension2d(_screenWidth, _screenHeight)); + + if (!CreationParams.Fullscreen) + { + _window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,CreationParams.WindowSize.Width,CreationParams.WindowSize.Height) styleMask:NSTitledWindowMask+NSClosableWindowMask+NSResizableWindowMask backing:NSBackingStoreBuffered defer:FALSE]; + if (_window != NULL) + { + index = 0; + windowattribs[index++] = NSOpenGLPFANoRecovery; + windowattribs[index++] = NSOpenGLPFADoubleBuffer; + windowattribs[index++] = NSOpenGLPFAAccelerated; + windowattribs[index++] = NSOpenGLPFADepthSize; + windowattribs[index++] = (NSOpenGLPixelFormatAttribute)depthSize; + windowattribs[index++] = NSOpenGLPFAColorSize; + windowattribs[index++] = (NSOpenGLPixelFormatAttribute)CreationParams.Bits; + windowattribs[index++] = NSOpenGLPFAAlphaSize; + windowattribs[index++] = (NSOpenGLPixelFormatAttribute)alphaSize; + + if (CreationParams.AntiAlias) { + windowattribs[index++] = NSOpenGLPFASampleBuffers; + windowattribs[index++] = (NSOpenGLPixelFormatAttribute)1; + windowattribs[index++] = NSOpenGLPFASamples; + windowattribs[index++] = (NSOpenGLPixelFormatAttribute)2; + } + + if (CreationParams.Stencilbuffer) + { + windowattribs[index++] = NSOpenGLPFAStencilSize; + windowattribs[index++] = (NSOpenGLPixelFormatAttribute)1; + } + + windowattribs[index++] = (NSOpenGLPixelFormatAttribute)NULL; + + format = [[NSOpenGLPixelFormat alloc] initWithAttributes:windowattribs]; + if (format != NULL) + { + _oglcontext = [[NSOpenGLContext alloc] initWithFormat:format shareContext:NULL]; + [format release]; + } + + if (_oglcontext != NULL) + { + [(NSWindow *)_window center]; + [(NSWindow *)_window setDelegate:[NSApp delegate]]; + [(NSOpenGLContext *)_oglcontext setView:[(NSWindow *)_window contentView]]; + [(NSWindow *)_window setAcceptsMouseMovedEvents:TRUE]; + [(NSWindow *)_window setIsVisible:TRUE]; + [(NSWindow *)_window makeKeyAndOrderFront:nil]; + + _cglcontext = (CGLContextObj) [(NSOpenGLContext *)_oglcontext CGLContextObj]; + _width = CreationParams.WindowSize.Width; + _height = CreationParams.WindowSize.Height; + result = true; + } + } + } + else + { + displaymode = CGDisplayBestModeForParameters(display,CreationParams.Bits,CreationParams.WindowSize.Width,CreationParams.WindowSize.Height,NULL); + if (displaymode != NULL) + { + olddisplaymode = CGDisplayCurrentMode(display); + error = CGCaptureAllDisplays(); + if (error == CGDisplayNoErr) + { + error = CGDisplaySwitchToMode(display,displaymode); + if (error == CGDisplayNoErr) + { + pixelFormat = NULL; + numPixelFormats = 0; + + index = 0; + fullattribs[index++] = kCGLPFAFullScreen; + fullattribs[index++] = kCGLPFADisplayMask; + fullattribs[index++] = (CGLPixelFormatAttribute)CGDisplayIDToOpenGLDisplayMask(display); + fullattribs[index++] = kCGLPFADoubleBuffer; + fullattribs[index++] = kCGLPFAAccelerated; + fullattribs[index++] = kCGLPFADepthSize; + fullattribs[index++] = (CGLPixelFormatAttribute)depthSize; + fullattribs[index++] = kCGLPFAColorSize; + fullattribs[index++] = (CGLPixelFormatAttribute)CreationParams.Bits; + fullattribs[index++] = kCGLPFAAlphaSize; + fullattribs[index++] = (CGLPixelFormatAttribute)alphaSize; + + if (CreationParams.AntiAlias) { + fullattribs[index++] = kCGLPFASampleBuffers; + fullattribs[index++] = (CGLPixelFormatAttribute)1; + fullattribs[index++] = kCGLPFASamples; + fullattribs[index++] = (CGLPixelFormatAttribute)2; + } + + if (CreationParams.Stencilbuffer) + { + fullattribs[index++] = kCGLPFAStencilSize; + fullattribs[index++] = (CGLPixelFormatAttribute)1; + } + + fullattribs[index++] = (CGLPixelFormatAttribute)NULL; + CGLChoosePixelFormat(fullattribs,&pixelFormat,&numPixelFormats); + + if (pixelFormat != NULL) + { + CGLCreateContext(pixelFormat,NULL,&_cglcontext); + CGLDestroyPixelFormat(pixelFormat); + } + + if (_cglcontext != NULL) + { + CGLSetFullScreen(_cglcontext); + displayRect = CGDisplayBounds(display); + _width = (int)displayRect.size.width; + _height = (int)displayRect.size.height; + result = true; + } + } + } + } + } + + if (result) + { + if (_window == NULL) + SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar); + CGLSetCurrentContext(_cglcontext); + newSwapInterval = (CreationParams.Vsync) ? 1 : 0; + CGLSetParameter(_cglcontext,kCGLCPSwapInterval,&newSwapInterval); + glViewport(0,0,_width,_height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + } + + return (result); +} + +void CIrrDeviceMacOSX::setResize(int width, int height) +{ + // set new window size + _width = width; + _height = height; + + // update the size of the opengl rendering context + [(NSOpenGLContext *)_oglcontext update]; + + // resize the driver to the inner pane size + NSRect driverFrame = [(NSWindow*)_window contentRectForFrameRect:[(NSWindow*)_window frame]]; + getVideoDriver()->OnResize(core::dimension2d( (s32)driverFrame.size.width, (s32)driverFrame.size.height)); +} + +void CIrrDeviceMacOSX::createDriver() +{ + switch (CreationParams.DriverType) + { + case video::EDT_SOFTWARE: + #ifdef _IRR_COMPILE_WITH_SOFTWARE_ + VideoDriver = video::createSoftwareDriver(CreationParams.WindowSize, CreationParams.Fullscreen, FileSystem, this); + #else + os::Printer::log("No Software driver support compiled in.", ELL_ERROR); + #endif + break; + + case video::EDT_BURNINGSVIDEO: + #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_ + VideoDriver = video::createSoftwareDriver2(CreationParams.WindowSize, CreationParams.Fullscreen, FileSystem, this); + #else + os::Printer::log("Burning's video driver was not compiled in.", ELL_ERROR); + #endif + break; + + case video::EDT_OPENGL: + #ifdef _IRR_COMPILE_WITH_OPENGL_ + VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, this); + #else + os::Printer::log("No OpenGL support compiled in.", ELL_ERROR); + #endif + break; + + case video::EDT_DIRECT3D8: + case video::EDT_DIRECT3D9: + os::Printer::log("This driver is not available in OSX. Try OpenGL or Software renderer.", ELL_ERROR); + break; + + case video::EDT_NULL: + VideoDriver = video::createNullDriver(FileSystem, CreationParams.WindowSize); + break; + + default: + os::Printer::log("Unable to create video driver of unknown type.", ELL_ERROR); + break; + } +} + +void CIrrDeviceMacOSX::flush() +{ + if (_cglcontext != NULL) + { + glFinish(); + CGLFlushDrawable(_cglcontext); + } +} + +bool CIrrDeviceMacOSX::run() +{ + NSEvent *event; + irr::SEvent ievent; + + os::Timer::tick(); + storeMouseLocation(); + + event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil inMode:NSDefaultRunLoopMode dequeue:YES]; + if (event != nil) + { + bzero(&ievent,sizeof(ievent)); + + switch([(NSEvent *)event type]) + { + case NSKeyDown: + postKeyEvent(event,ievent,true); + break; + + case NSKeyUp: + postKeyEvent(event,ievent,false); + break; + + case NSLeftMouseDown: + ievent.EventType = irr::EET_MOUSE_INPUT_EVENT; + ievent.MouseInput.Event = irr::EMIE_LMOUSE_PRESSED_DOWN; + postMouseEvent(event,ievent); + break; + + case NSLeftMouseUp: + ievent.EventType = irr::EET_MOUSE_INPUT_EVENT; + ievent.MouseInput.Event = irr::EMIE_LMOUSE_LEFT_UP; + postMouseEvent(event,ievent); + break; + + case NSMouseMoved: + case NSLeftMouseDragged: + case NSRightMouseDragged: + ievent.EventType = irr::EET_MOUSE_INPUT_EVENT; + ievent.MouseInput.Event = irr::EMIE_MOUSE_MOVED; + postMouseEvent(event,ievent); + break; + + case NSRightMouseDown: + ievent.EventType = irr::EET_MOUSE_INPUT_EVENT; + ievent.MouseInput.Event = irr::EMIE_RMOUSE_PRESSED_DOWN; + postMouseEvent(event,ievent); + break; + + case NSRightMouseUp: + ievent.EventType = irr::EET_MOUSE_INPUT_EVENT; + ievent.MouseInput.Event = irr::EMIE_RMOUSE_LEFT_UP; + postMouseEvent(event,ievent); + break; + + case NSScrollWheel: + ievent.EventType = irr::EET_MOUSE_INPUT_EVENT; + ievent.MouseInput.Event = irr::EMIE_MOUSE_WHEEL; + ievent.MouseInput.Wheel = [(NSEvent *)event deltaY]; + if (ievent.MouseInput.Wheel < 1.0f) ievent.MouseInput.Wheel *= 10.0f; + else ievent.MouseInput.Wheel *= 5.0f; + postMouseEvent(event,ievent); + break; + + default: + [NSApp sendEvent:event]; + break; + } + } + + pollJoysticks(); + + return (![[NSApp delegate] isQuit] && _active); +} + +//! Pause the current process for the minimum time allowed only to allow other processes to execute +void CIrrDeviceMacOSX::yield() +{ + // TODO: Does this work or maybe is there a better way? + struct timespec ts = {0,0}; + nanosleep(&ts, NULL); +} + +//! Pause execution and let other processes to run for a specified amount of time. +void CIrrDeviceMacOSX::sleep(u32 timeMs, bool pauseTimer=false) +{ + // TODO: Does this work or maybe is there a better way? + + bool wasStopped = Timer ? Timer->isStopped() : true; + + struct timespec ts; + ts.tv_sec = (time_t) (timeMs / 1000); + ts.tv_nsec = (long) (timeMs % 1000) * 1000000; + + if (pauseTimer && !wasStopped) + Timer->stop(); + + nanosleep(&ts, NULL); + + if (pauseTimer && !wasStopped) + Timer->start(); +} + +void CIrrDeviceMacOSX::setWindowCaption(const wchar_t* text) +{ + size_t size; + char title[1024]; + + if (_window != NULL) + { + size = wcstombs(title,text,1024); + if (size == 1024) title[1023] = 0; + [(NSWindow *)_window setTitle:[NSString stringWithCString:title length:size]]; + } +} + + +bool CIrrDeviceMacOSX::isWindowActive() const +{ + return (_active); +} + + +bool CIrrDeviceMacOSX::isWindowFocused() const +{ + if (_window != NULL) + return [(NSWindow *)_window isKeyWindow]; + return false; +} + + +bool CIrrDeviceMacOSX::isWindowMinimized() const +{ + if (_window != NULL) + return [(NSWindow *)_window isMiniaturized]; + return false; +} + + +void CIrrDeviceMacOSX::postKeyEvent(void *event,irr::SEvent &ievent,bool pressed) +{ + NSString *str; + std::map::const_iterator iter; + unsigned int result,c,mkey,mchar; + const unsigned char *cStr; + BOOL skipCommand; + + str = [(NSEvent *)event characters]; + if (str != nil && [str length] > 0) + { + mkey = mchar = 0; + skipCommand = false; + c = [str characterAtIndex:0]; + + iter = _keycodes.find(c); + if (iter != _keycodes.end()) mkey = (*iter).second; + else + { + // workaround for period character + if (c == 0x2E) + { + mkey = irr::KEY_PERIOD; + mchar = '.'; + } else { + cStr = (unsigned char *)[str cStringUsingEncoding:NSWindowsCP1252StringEncoding]; + if (cStr != NULL && strlen((char*)cStr) > 0) + { + mchar = cStr[0]; + mkey = toupper(mchar); + if ([(NSEvent *)event modifierFlags] & NSCommandKeyMask) + { + if (mkey == 'C' || mkey == 'V' || mkey == 'X') + { + mchar = 0; + skipCommand = true; + } + } + } + } + } + + ievent.EventType = irr::EET_KEY_INPUT_EVENT; + ievent.KeyInput.Key = (irr::EKEY_CODE)mkey; + ievent.KeyInput.PressedDown = pressed; + ievent.KeyInput.Shift = ([(NSEvent *)event modifierFlags] & NSShiftKeyMask) != 0; + ievent.KeyInput.Control = ([(NSEvent *)event modifierFlags] & NSControlKeyMask) != 0; + ievent.KeyInput.Char = (irr::EKEY_CODE)mchar; + + if (skipCommand) + ievent.KeyInput.Control = true; + else if ([(NSEvent *)event modifierFlags] & NSCommandKeyMask) + [NSApp sendEvent:(NSEvent *)event]; + + postEventFromUser(ievent); + } +} + +void CIrrDeviceMacOSX::postMouseEvent(void *event,irr::SEvent &ievent) +{ + BOOL post = true; + + if (_window != NULL) + { + ievent.MouseInput.X = (int)[(NSEvent *)event locationInWindow].x; + ievent.MouseInput.Y = _height - (int)[(NSEvent *)event locationInWindow].y; + if (ievent.MouseInput.Y < 0) post = false; + } + else + { + ievent.MouseInput.X = (int)[NSEvent mouseLocation].x; + ievent.MouseInput.Y = _height - (int)[NSEvent mouseLocation].y; + } + + if (post) postEventFromUser(ievent); + [NSApp sendEvent:(NSEvent *)event]; +} + +void CIrrDeviceMacOSX::storeMouseLocation() +{ + NSPoint p; + int x,y; + + p = [NSEvent mouseLocation]; + + if (_window != NULL) + { + p = [(NSWindow *)_window convertScreenToBase:p]; + x = (int)p.x; + y = _height - (int)p.y; + } + else + { + x = (int)p.x; + y = (int)p.y; + y -= (_screenHeight - _height); + } + + ((CCursorControl *)CursorControl)->updateInternalCursorPosition(x,y); +} + + +void CIrrDeviceMacOSX::setMouseLocation(int x,int y) +{ + NSPoint p; + CGPoint c; + + if (_window != NULL) + { + p.x = (float) x; + p.y = (float) (_height - y); + p = [(NSWindow *)_window convertBaseToScreen:p]; + p.y = _screenHeight - p.y; + } + else + { + p.x = (float) x; + p.y = (float) y + (_screenHeight - _height); + } + + c.x = p.x; + c.y = p.y; + CGSetLocalEventsSuppressionInterval(0); + CGWarpMouseCursorPosition(c); +} + + +void CIrrDeviceMacOSX::setCursorVisible(bool visible) +{ + CGDirectDisplayID display; + + display = CGMainDisplayID(); + if (visible) + CGDisplayShowCursor(display); + else + CGDisplayHideCursor(display); +} + + +void CIrrDeviceMacOSX::initKeycodes() +{ + _keycodes[NSUpArrowFunctionKey] = irr::KEY_UP; + _keycodes[NSDownArrowFunctionKey] = irr::KEY_DOWN; + _keycodes[NSLeftArrowFunctionKey] = irr::KEY_LEFT; + _keycodes[NSRightArrowFunctionKey] = irr::KEY_RIGHT; + _keycodes[NSF1FunctionKey] = irr::KEY_F1; + _keycodes[NSF2FunctionKey] = irr::KEY_F2; + _keycodes[NSF3FunctionKey] = irr::KEY_F3; + _keycodes[NSF4FunctionKey] = irr::KEY_F4; + _keycodes[NSF5FunctionKey] = irr::KEY_F5; + _keycodes[NSF6FunctionKey] = irr::KEY_F6; + _keycodes[NSF7FunctionKey] = irr::KEY_F7; + _keycodes[NSF8FunctionKey] = irr::KEY_F8; + _keycodes[NSF9FunctionKey] = irr::KEY_F9; + _keycodes[NSF10FunctionKey] = irr::KEY_F10; + _keycodes[NSF11FunctionKey] = irr::KEY_F11; + _keycodes[NSF12FunctionKey] = irr::KEY_F12; + _keycodes[NSF13FunctionKey] = irr::KEY_F13; + _keycodes[NSF14FunctionKey] = irr::KEY_F14; + _keycodes[NSF15FunctionKey] = irr::KEY_F15; + _keycodes[NSF16FunctionKey] = irr::KEY_F16; + _keycodes[NSHomeFunctionKey] = irr::KEY_HOME; + _keycodes[NSEndFunctionKey] = irr::KEY_END; + _keycodes[NSInsertFunctionKey] = irr::KEY_INSERT; + _keycodes[NSDeleteFunctionKey] = irr::KEY_DELETE; + _keycodes[NSHelpFunctionKey] = irr::KEY_HELP; + _keycodes[NSSelectFunctionKey] = irr::KEY_SELECT; + _keycodes[NSPrintFunctionKey] = irr::KEY_PRINT; + _keycodes[NSExecuteFunctionKey] = irr::KEY_EXECUT; + _keycodes[NSPrintScreenFunctionKey] = irr::KEY_SNAPSHOT; + _keycodes[NSPauseFunctionKey] = irr::KEY_PAUSE; + _keycodes[NSScrollLockFunctionKey] = irr::KEY_SCROLL; + _keycodes[0x7F] = irr::KEY_BACK; + _keycodes[0x09] = irr::KEY_TAB; + _keycodes[0x0D] = irr::KEY_RETURN; + _keycodes[0x03] = irr::KEY_RETURN; + _keycodes[0x1B] = irr::KEY_ESCAPE; +} + + + +//! Sets if the window should be resizeable in windowed mode. +void CIrrDeviceMacOSX::setResizeAble(bool resize) +{ + // todo: Hacky method, clicking the bottom right corner freezes the window. + // We can't set the resize flag without destroying the window, so we'll set the max size to the current size + + if (!_window) + return; + + NSSize s; + + if (resize) + { + s.width = 0.0f; + s.height = 0.0f; + [(NSWindow *)_window setMinSize: s]; + s.width = float(_screenWidth); + s.height = float(_screenHeight); + [(NSWindow *)_window setMaxSize: s]; + } + else + { + s = [(NSWindow *)_window frame].size; + [(NSWindow *)_window setMinSize: s]; + [(NSWindow *)_window setMaxSize: s]; + } +} + + +bool CIrrDeviceMacOSX::present(video::IImage* surface, void* windowId, core::rect* src ) +{ + // todo: implement + return false; +} + +#if defined (_IRR_COMPILE_WITH_JOYSTICK_EVENTS_) +static void joystickRemovalCallback(void * target, + IOReturn result, + void * refcon, + void * sender) +{ + JoystickInfo *joy = (JoystickInfo *) refcon; + joy->removed = 1; +} +#endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ + + +bool CIrrDeviceMacOSX::activateJoysticks(core::array & joystickInfo) +{ +#if defined (_IRR_COMPILE_WITH_JOYSTICK_EVENTS_) + ActiveJoysticks.clear(); + joystickInfo.clear(); + + io_object_t hidObject = 0; + io_iterator_t hidIterator = 0; + IOReturn result = kIOReturnSuccess; + mach_port_t masterPort = 0; + CFMutableDictionaryRef hidDictionaryRef = NULL; + + result = IOMasterPort (bootstrap_port, &masterPort); + if (kIOReturnSuccess != result) { + os::Printer::log("initialiseJoysticks IOMasterPort failed", ELL_ERROR); + return false; + } + + hidDictionaryRef = IOServiceMatching (kIOHIDDeviceKey); + if (!hidDictionaryRef) { + os::Printer::log("initialiseJoysticks IOServiceMatching failed", ELL_ERROR); + return false; + } + result = IOServiceGetMatchingServices (masterPort, hidDictionaryRef, &hidIterator); + + if (kIOReturnSuccess != result) { + os::Printer::log("initialiseJoysticks IOServiceGetMatchingServices failed", ELL_ERROR); + return false; + } + + //no joysticks just return + if (!hidIterator) + return false; + + while ((hidObject = IOIteratorNext (hidIterator))) + { + JoystickInfo info; + + // get dictionary for HID properties + CFMutableDictionaryRef hidProperties = 0; + + kern_return_t kern_result = IORegistryEntryCreateCFProperties (hidObject, &hidProperties, kCFAllocatorDefault, kNilOptions); + if ((kern_result == KERN_SUCCESS) && hidProperties) { + HRESULT plugInResult = S_OK; + SInt32 score = 0; + IOCFPlugInInterface ** ppPlugInInterface = NULL; + result = IOCreatePlugInInterfaceForService (hidObject, kIOHIDDeviceUserClientTypeID, + kIOCFPlugInInterfaceID, &ppPlugInInterface, &score); + if (kIOReturnSuccess == result) { + plugInResult = (*ppPlugInInterface)->QueryInterface (ppPlugInInterface, + CFUUIDGetUUIDBytes (kIOHIDDeviceInterfaceID), (void **) &(info.interface)); + if (plugInResult != S_OK) + os::Printer::log("initialiseJoysticks query HID class device interface failed", ELL_ERROR); + (*ppPlugInInterface)->Release (ppPlugInInterface); + } + else + continue; + + if (info.interface != NULL) { + result = (*(info.interface))->open (info.interface, 0); + if (result == kIOReturnSuccess) { + (*(info.interface))->setRemovalCallback (info.interface, joystickRemovalCallback, &info, &info); + getJoystickDeviceInfo(hidObject, hidProperties, &info); + + //get elements + CFTypeRef refElementTop = CFDictionaryGetValue (hidProperties, CFSTR(kIOHIDElementKey)); + if (refElementTop) { + CFTypeID type = CFGetTypeID (refElementTop); + if (type == CFArrayGetTypeID()) { + CFRange range = {0, CFArrayGetCount ((CFArrayRef)refElementTop)}; + info.numActiveJoysticks = ActiveJoysticks.size(); + CFArrayApplyFunction ((CFArrayRef)refElementTop, range, getJoystickComponentArrayHandler, &info); + } + } + } else { + CFRelease (hidProperties); + os::Printer::log("initialiseJoysticks Open interface failed", ELL_ERROR); + continue; + } + + CFRelease (hidProperties); + + result = IOObjectRelease (hidObject); + + if ( (info.usagePage != kHIDPage_GenericDesktop) || + ((info.usage != kHIDUsage_GD_Joystick && + info.usage != kHIDUsage_GD_GamePad && + info.usage != kHIDUsage_GD_MultiAxisController)) ) { + closeJoystickDevice (&info); + continue; + } + + for (u32 i = 0; i < 6; i++) + info.persistentData.JoystickEvent.Axis[i] = 0; + + ActiveJoysticks.push_back(info); + + SJoystickInfo returnInfo; + returnInfo.Axes = info.axes; + //returnInfo.Hats = info.hats; + returnInfo.Buttons = info.buttons; + returnInfo.Name = info.joystickName; + returnInfo.PovHat = SJoystickInfo::POV_HAT_UNKNOWN; + + //if (info.hatComp.size()) + // returnInfo.PovHat = SJoystickInfo::POV_HAT_PRESENT; + //else + // returnInfo.PovHat = SJoystickInfo::POV_HAT_ABSENT; + + joystickInfo.push_back(returnInfo); + } + + } else + continue; + } + result = IOObjectRelease (hidIterator); + + return true; +#endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ + + return false; +} + +void CIrrDeviceMacOSX::pollJoysticks() +{ +#if defined (_IRR_COMPILE_WITH_JOYSTICK_EVENTS_) + if(0 == ActiveJoysticks.size()) + return; + + u32 joystick; + for(joystick = 0; joystick < ActiveJoysticks.size(); ++joystick) + { + if (ActiveJoysticks[joystick].removed) + continue; + + bool found = false; + ActiveJoysticks[joystick].persistentData.JoystickEvent.Joystick = joystick; + + if (ActiveJoysticks[joystick].interface) + { + for (u32 n = 0; n < ActiveJoysticks[joystick].axisComp.size(); n++) { + IOReturn result = kIOReturnSuccess; + IOHIDEventStruct hidEvent; + hidEvent.value = 0; + result = (*(ActiveJoysticks[joystick].interface))->getElementValue(ActiveJoysticks[joystick].interface, ActiveJoysticks[joystick].axisComp[n].cookie, &hidEvent); + if (kIOReturnSuccess == result) { + f32 min = -32768.0f; + f32 max = 32768.0f; + f32 deviceScale = max - min; + f32 readScale = (f32)ActiveJoysticks[joystick].axisComp[n].maxRead - (f32)ActiveJoysticks[joystick].axisComp[n].minRead; + + if (hidEvent.value < ActiveJoysticks[joystick].axisComp[n].minRead) + ActiveJoysticks[joystick].axisComp[n].minRead = hidEvent.value; + if (hidEvent.value > ActiveJoysticks[joystick].axisComp[n].maxRead) + ActiveJoysticks[joystick].axisComp[n].maxRead = hidEvent.value; + + if (readScale != 0.0f) + hidEvent.value = (int)(((f32)((f32)hidEvent.value - (f32)ActiveJoysticks[joystick].axisComp[n].minRead) * deviceScale / readScale) + min); + + if (ActiveJoysticks[joystick].persistentData.JoystickEvent.Axis[n] != (s16)hidEvent.value) + found = true; + ActiveJoysticks[joystick].persistentData.JoystickEvent.Axis[n] = (s16)hidEvent.value; + } + }//axis check + + for (u32 n = 0; n < ActiveJoysticks[joystick].buttonComp.size(); n++) { + IOReturn result = kIOReturnSuccess; + IOHIDEventStruct hidEvent; + hidEvent.value = 0; + result = (*(ActiveJoysticks[joystick].interface))->getElementValue(ActiveJoysticks[joystick].interface, ActiveJoysticks[joystick].buttonComp[n].cookie, &hidEvent); + if (kIOReturnSuccess == result) { + u32 ButtonStates = 0; + + if (hidEvent.value && !((ActiveJoysticks[joystick].persistentData.JoystickEvent.ButtonStates & (1 << n)) ? true : false) ) + found = true; + else if (!hidEvent.value && ((ActiveJoysticks[joystick].persistentData.JoystickEvent.ButtonStates & (1 << n)) ? true : false)) + found = true; + + if (hidEvent.value) + ActiveJoysticks[joystick].persistentData.JoystickEvent.ButtonStates |= (1 << n); + else + ActiveJoysticks[joystick].persistentData.JoystickEvent.ButtonStates &= ~(1 << n); + } + }//button check + //still ToDo..will be done soon :) +/* + for (u32 n = 0; n < ActiveJoysticks[joystick].hatComp.size(); n++) { + IOReturn result = kIOReturnSuccess; + IOHIDEventStruct hidEvent; + hidEvent.value = 0; + result = (*(ActiveJoysticks[joystick].interface))->getElementValue(ActiveJoysticks[joystick].interface, ActiveJoysticks[joystick].hatComp[n].cookie, &hidEvent); + if (kIOReturnSuccess == result) { + if (ActiveJoysticks[joystick].persistentData.JoystickEvent.POV != hidEvent.value) + found = true; + ActiveJoysticks[joystick].persistentData.JoystickEvent.POV = hidEvent.value; + } + }//hat check +*/ + } + + if (found) + postEventFromUser(ActiveJoysticks[joystick].persistentData); + } +#endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ +} + +video::IVideoModeList* CIrrDeviceMacOSX::getVideoModeList() +{ + if (!VideoModeList.getVideoModeCount()) + { + CGDirectDisplayID display; + display = CGMainDisplayID(); + + CFArrayRef availableModes = CGDisplayAvailableModes(display); + unsigned int numberOfAvailableModes = CFArrayGetCount(availableModes); + for (u32 i= 0; i(width, height), + bitsPerPixel); + } + } + return &VideoModeList; +} + +IRRLICHT_API IrrlichtDevice* IRRCALLCONV createDeviceEx(const SIrrlichtCreationParameters& param) +{ + CIrrDeviceMacOSX* dev = new CIrrDeviceMacOSX(param); + + if (dev && !dev->getVideoDriver() && param.DriverType != video::EDT_NULL) + { + dev->drop(); + dev = 0; + } + + return dev; +} + +} + +#endif // _IRR_USE_OSX_DEVICE_ + diff --git a/src/dep/src/irrlicht/MacOSX/DemoApp-Info.plist b/src/dep/src/irrlicht/MacOSX/DemoApp-Info.plist index e69de29..a754c7f 100644 --- a/src/dep/src/irrlicht/MacOSX/DemoApp-Info.plist +++ b/src/dep/src/irrlicht/MacOSX/DemoApp-Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.irrlicht.${EXECUTABLE_NAME} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + IRRL + CFBundleVersion + 1.0 + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/src/dep/src/irrlicht/MacOSX/MacOSX.xcodeproj/project.pbxproj b/src/dep/src/irrlicht/MacOSX/MacOSX.xcodeproj/project.pbxproj index 34d872d..8907857 100644 --- a/src/dep/src/irrlicht/MacOSX/MacOSX.xcodeproj/project.pbxproj +++ b/src/dep/src/irrlicht/MacOSX/MacOSX.xcodeproj/project.pbxproj @@ -13,6 +13,11 @@ buildPhases = ( ); dependencies = ( + 0946CCD90EC99D8C00D945A5 /* PBXTargetDependency */, + 0946CCD60EC99D8200D945A5 /* PBXTargetDependency */, + 09F649720D2CE2A1001E0599 /* PBXTargetDependency */, + 09F649450D2CE100001E0599 /* PBXTargetDependency */, + 09F649210D2CDFF0001E0599 /* PBXTargetDependency */, 4CA5CB9A0A4868B500ADB3D7 /* PBXTargetDependency */, 4CA5CB980A4868B500ADB3D7 /* PBXTargetDependency */, 4CA5CB960A4868B500ADB3D7 /* PBXTargetDependency */, @@ -33,8 +38,190 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + 09022C560EA0E97F00CD54EE /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 4C53E1650A484C2C0014E966 /* MainMenu.nib */; }; + 09022C570EA0E97F00CD54EE /* DemoApp-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4C53E38E0A4855BA0014E966 /* DemoApp-Info.plist */; }; + 09022C5B0EA0E97F00CD54EE /* libIrrlicht.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C53E24D0A4850120014E966 /* libIrrlicht.a */; }; + 09022C5C0EA0E97F00CD54EE /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C53E26D0A4850D60014E966 /* Cocoa.framework */; }; + 09022C5D0EA0E97F00CD54EE /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C53E26E0A4850D60014E966 /* OpenGL.framework */; }; + 09022C5E0EA0E97F00CD54EE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0925113D0D744ADE006784D9 /* Carbon.framework */; }; + 09022C7E0EA0EA9D00CD54EE /* CGUIAttributeEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 09022C690EA0EA9D00CD54EE /* CGUIAttributeEditor.cpp */; }; + 09022C7F0EA0EA9D00CD54EE /* CGUIEditFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 09022C6E0EA0EA9D00CD54EE /* CGUIEditFactory.cpp */; }; + 09022C800EA0EA9D00CD54EE /* CGUIEditWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 09022C700EA0EA9D00CD54EE /* CGUIEditWindow.cpp */; }; + 09022C810EA0EA9D00CD54EE /* CGUIEditWorkspace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 09022C720EA0EA9D00CD54EE /* CGUIEditWorkspace.cpp */; }; + 09022C820EA0EA9D00CD54EE /* CGUIPanel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 09022C750EA0EA9D00CD54EE /* CGUIPanel.cpp */; }; + 09022C830EA0EA9D00CD54EE /* CGUITextureCacheBrowser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 09022C790EA0EA9D00CD54EE /* CGUITextureCacheBrowser.cpp */; }; + 09022C840EA0EA9D00CD54EE /* CMemoryReadWriteFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 09022C7B0EA0EA9D00CD54EE /* CMemoryReadWriteFile.cpp */; }; + 09022C850EA0EA9D00CD54EE /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 09022C7D0EA0EA9D00CD54EE /* main.cpp */; }; + 090FBC820D31085E0076D847 /* CVolumeLightSceneNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 090FBC800D31085E0076D847 /* CVolumeLightSceneNode.cpp */; }; + 090FBC830D31085E0076D847 /* CVolumeLightSceneNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 090FBC810D31085E0076D847 /* CVolumeLightSceneNode.h */; }; + 0910B9DE0D1F5D4100D46B04 /* CBurningShader_Raster_Reference.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0910B9D90D1F5D4100D46B04 /* CBurningShader_Raster_Reference.cpp */; }; + 0910B9DF0D1F5D4100D46B04 /* CGUITable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0910B9DA0D1F5D4100D46B04 /* CGUITable.cpp */; }; + 0910B9E00D1F5D4100D46B04 /* CGUITable.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910B9DB0D1F5D4100D46B04 /* CGUITable.h */; }; + 0910B9E10D1F5D4100D46B04 /* CImageLoaderWAL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0910B9DC0D1F5D4100D46B04 /* CImageLoaderWAL.cpp */; }; + 0910B9E20D1F5D4100D46B04 /* CImageLoaderWAL.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910B9DD0D1F5D4100D46B04 /* CImageLoaderWAL.h */; }; + 0910BA240D1F64B300D46B04 /* CMeshBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910B9FD0D1F64B300D46B04 /* CMeshBuffer.h */; }; + 0910BA250D1F64B300D46B04 /* coreutil.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910B9FE0D1F64B300D46B04 /* coreutil.h */; }; + 0910BA260D1F64B300D46B04 /* ECullingTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910B9FF0D1F64B300D46B04 /* ECullingTypes.h */; }; + 0910BA270D1F64B300D46B04 /* EDebugSceneTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA000D1F64B300D46B04 /* EDebugSceneTypes.h */; }; + 0910BA280D1F64B300D46B04 /* EDriverFeatures.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA010D1F64B300D46B04 /* EDriverFeatures.h */; }; + 0910BA290D1F64B300D46B04 /* EGUIAlignment.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA020D1F64B300D46B04 /* EGUIAlignment.h */; }; + 0910BA2A0D1F64B300D46B04 /* EHardwareBufferFlags.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA030D1F64B300D46B04 /* EHardwareBufferFlags.h */; }; + 0910BA2B0D1F64B300D46B04 /* EMaterialFlags.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA040D1F64B300D46B04 /* EMaterialFlags.h */; }; + 0910BA2C0D1F64B300D46B04 /* EMaterialTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA050D1F64B300D46B04 /* EMaterialTypes.h */; }; + 0910BA2D0D1F64B300D46B04 /* EMeshWriterEnums.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA060D1F64B300D46B04 /* EMeshWriterEnums.h */; }; + 0910BA2E0D1F64B300D46B04 /* EMessageBoxFlags.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA070D1F64B300D46B04 /* EMessageBoxFlags.h */; }; + 0910BA2F0D1F64B300D46B04 /* ETerrainElements.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA080D1F64B300D46B04 /* ETerrainElements.h */; }; + 0910BA300D1F64B300D46B04 /* IAnimatedMeshMD3.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA090D1F64B300D46B04 /* IAnimatedMeshMD3.h */; }; + 0910BA310D1F64B300D46B04 /* IBoneSceneNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA0A0D1F64B300D46B04 /* IBoneSceneNode.h */; }; + 0910BA320D1F64B300D46B04 /* IGUIColorSelectDialog.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA0B0D1F64B300D46B04 /* IGUIColorSelectDialog.h */; }; + 0910BA330D1F64B300D46B04 /* IGUIElementFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA0C0D1F64B300D46B04 /* IGUIElementFactory.h */; }; + 0910BA340D1F64B300D46B04 /* IGUIFontBitmap.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA0D0D1F64B300D46B04 /* IGUIFontBitmap.h */; }; + 0910BA350D1F64B300D46B04 /* IGUISpinBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA0E0D1F64B300D46B04 /* IGUISpinBox.h */; }; + 0910BA360D1F64B300D46B04 /* IGUISpriteBank.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA0F0D1F64B300D46B04 /* IGUISpriteBank.h */; }; + 0910BA370D1F64B300D46B04 /* IGUITable.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA100D1F64B300D46B04 /* IGUITable.h */; }; + 0910BA380D1F64B300D46B04 /* IMeshWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA110D1F64B300D46B04 /* IMeshWriter.h */; }; + 0910BA390D1F64B300D46B04 /* IParticleAnimatedMeshSceneNodeEmitter.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA120D1F64B300D46B04 /* IParticleAnimatedMeshSceneNodeEmitter.h */; }; + 0910BA3A0D1F64B300D46B04 /* IParticleAttractionAffector.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA130D1F64B300D46B04 /* IParticleAttractionAffector.h */; }; + 0910BA3B0D1F64B300D46B04 /* IParticleBoxEmitter.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA140D1F64B300D46B04 /* IParticleBoxEmitter.h */; }; + 0910BA3C0D1F64B300D46B04 /* IParticleCylinderEmitter.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA150D1F64B300D46B04 /* IParticleCylinderEmitter.h */; }; + 0910BA3D0D1F64B300D46B04 /* IParticleFadeOutAffector.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA160D1F64B300D46B04 /* IParticleFadeOutAffector.h */; }; + 0910BA3E0D1F64B300D46B04 /* IParticleGravityAffector.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA170D1F64B300D46B04 /* IParticleGravityAffector.h */; }; + 0910BA3F0D1F64B300D46B04 /* IParticleMeshEmitter.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA180D1F64B300D46B04 /* IParticleMeshEmitter.h */; }; + 0910BA400D1F64B300D46B04 /* IParticleRingEmitter.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA190D1F64B300D46B04 /* IParticleRingEmitter.h */; }; + 0910BA410D1F64B300D46B04 /* IParticleRotationAffector.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA1A0D1F64B300D46B04 /* IParticleRotationAffector.h */; }; + 0910BA420D1F64B300D46B04 /* IParticleSphereEmitter.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA1B0D1F64B300D46B04 /* IParticleSphereEmitter.h */; }; + 0910BA430D1F64B300D46B04 /* IQ3Shader.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA1C0D1F64B300D46B04 /* IQ3Shader.h */; }; + 0910BA440D1F64B300D46B04 /* IReferenceCounted.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA1D0D1F64B300D46B04 /* IReferenceCounted.h */; }; + 0910BA450D1F64B300D46B04 /* irrMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA1E0D1F64B300D46B04 /* irrMap.h */; }; + 0910BA460D1F64B300D46B04 /* ISkinnedMesh.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA1F0D1F64B300D46B04 /* ISkinnedMesh.h */; }; + 0910BA470D1F64B300D46B04 /* SMaterialLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA200D1F64B300D46B04 /* SMaterialLayer.h */; }; + 0910BA480D1F64B300D46B04 /* SSharedMeshBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA210D1F64B300D46B04 /* SSharedMeshBuffer.h */; }; + 0910BA490D1F64B300D46B04 /* SSkinMeshBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA220D1F64B300D46B04 /* SSkinMeshBuffer.h */; }; + 0910BA4A0D1F64B300D46B04 /* SViewFrustum.h in Headers */ = {isa = PBXBuildFile; fileRef = 0910BA230D1F64B300D46B04 /* SViewFrustum.h */; }; + 0925113E0D744ADE006784D9 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0925113D0D744ADE006784D9 /* Carbon.framework */; }; + 0925113F0D744ADE006784D9 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0925113D0D744ADE006784D9 /* Carbon.framework */; }; + 092511400D744ADE006784D9 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0925113D0D744ADE006784D9 /* Carbon.framework */; }; + 092511410D744ADE006784D9 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0925113D0D744ADE006784D9 /* Carbon.framework */; }; + 092511420D744ADE006784D9 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0925113D0D744ADE006784D9 /* Carbon.framework */; }; + 092511430D744ADE006784D9 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0925113D0D744ADE006784D9 /* Carbon.framework */; }; + 092511440D744ADE006784D9 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0925113D0D744ADE006784D9 /* Carbon.framework */; }; + 092511450D744ADE006784D9 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0925113D0D744ADE006784D9 /* Carbon.framework */; }; + 092511460D744ADE006784D9 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0925113D0D744ADE006784D9 /* Carbon.framework */; }; + 092511470D744ADE006784D9 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0925113D0D744ADE006784D9 /* Carbon.framework */; }; + 092511480D744ADE006784D9 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0925113D0D744ADE006784D9 /* Carbon.framework */; }; + 092511490D744ADE006784D9 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0925113D0D744ADE006784D9 /* Carbon.framework */; }; + 0925114A0D744ADE006784D9 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0925113D0D744ADE006784D9 /* Carbon.framework */; }; + 0925114B0D744ADE006784D9 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0925113D0D744ADE006784D9 /* Carbon.framework */; }; + 0925114C0D744ADE006784D9 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0925113D0D744ADE006784D9 /* Carbon.framework */; }; + 0925114D0D744ADE006784D9 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0925113D0D744ADE006784D9 /* Carbon.framework */; }; + 09293C3E0ED32029003B8C9C /* png.c in Sources */ = {isa = PBXBuildFile; fileRef = 09293C2C0ED32029003B8C9C /* png.c */; }; + 09293C3F0ED32029003B8C9C /* pngerror.c in Sources */ = {isa = PBXBuildFile; fileRef = 09293C2D0ED32029003B8C9C /* pngerror.c */; }; + 09293C400ED32029003B8C9C /* pnggccrd.c in Sources */ = {isa = PBXBuildFile; fileRef = 09293C2E0ED32029003B8C9C /* pnggccrd.c */; }; + 09293C410ED32029003B8C9C /* pngget.c in Sources */ = {isa = PBXBuildFile; fileRef = 09293C2F0ED32029003B8C9C /* pngget.c */; }; + 09293C420ED32029003B8C9C /* pngmem.c in Sources */ = {isa = PBXBuildFile; fileRef = 09293C300ED32029003B8C9C /* pngmem.c */; }; + 09293C430ED32029003B8C9C /* pngpread.c in Sources */ = {isa = PBXBuildFile; fileRef = 09293C310ED32029003B8C9C /* pngpread.c */; }; + 09293C440ED32029003B8C9C /* pngread.c in Sources */ = {isa = PBXBuildFile; fileRef = 09293C320ED32029003B8C9C /* pngread.c */; }; + 09293C450ED32029003B8C9C /* pngrio.c in Sources */ = {isa = PBXBuildFile; fileRef = 09293C330ED32029003B8C9C /* pngrio.c */; }; + 09293C460ED32029003B8C9C /* pngrtran.c in Sources */ = {isa = PBXBuildFile; fileRef = 09293C340ED32029003B8C9C /* pngrtran.c */; }; + 09293C470ED32029003B8C9C /* pngrutil.c in Sources */ = {isa = PBXBuildFile; fileRef = 09293C350ED32029003B8C9C /* pngrutil.c */; }; + 09293C480ED32029003B8C9C /* pngset.c in Sources */ = {isa = PBXBuildFile; fileRef = 09293C360ED32029003B8C9C /* pngset.c */; }; + 09293C4A0ED32029003B8C9C /* pngtrans.c in Sources */ = {isa = PBXBuildFile; fileRef = 09293C380ED32029003B8C9C /* pngtrans.c */; }; + 09293C4C0ED32029003B8C9C /* pngwio.c in Sources */ = {isa = PBXBuildFile; fileRef = 09293C3A0ED32029003B8C9C /* pngwio.c */; }; + 09293C4D0ED32029003B8C9C /* pngwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = 09293C3B0ED32029003B8C9C /* pngwrite.c */; }; + 09293C4E0ED32029003B8C9C /* pngwtran.c in Sources */ = {isa = PBXBuildFile; fileRef = 09293C3C0ED32029003B8C9C /* pngwtran.c */; }; + 09293C4F0ED32029003B8C9C /* pngwutil.c in Sources */ = {isa = PBXBuildFile; fileRef = 09293C3D0ED32029003B8C9C /* pngwutil.c */; }; + 0930CE560EC39F4500D63866 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0930CE550EC39F4500D63866 /* IOKit.framework */; }; + 0930CE570EC39F4500D63866 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0930CE550EC39F4500D63866 /* IOKit.framework */; }; + 0930CE580EC39F4500D63866 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0930CE550EC39F4500D63866 /* IOKit.framework */; }; + 0930CE590EC39F4500D63866 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0930CE550EC39F4500D63866 /* IOKit.framework */; }; + 0930CE5A0EC39F4500D63866 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0930CE550EC39F4500D63866 /* IOKit.framework */; }; + 0930CE5B0EC39F4500D63866 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0930CE550EC39F4500D63866 /* IOKit.framework */; }; + 0930CE5C0EC39F4500D63866 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0930CE550EC39F4500D63866 /* IOKit.framework */; }; + 0930CE5D0EC39F4500D63866 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0930CE550EC39F4500D63866 /* IOKit.framework */; }; + 0930CE5E0EC39F4500D63866 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0930CE550EC39F4500D63866 /* IOKit.framework */; }; + 0930CE5F0EC39F4500D63866 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0930CE550EC39F4500D63866 /* IOKit.framework */; }; + 0930CE600EC39F4500D63866 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0930CE550EC39F4500D63866 /* IOKit.framework */; }; + 0930CE610EC39F4500D63866 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0930CE550EC39F4500D63866 /* IOKit.framework */; }; + 0930CE620EC39F4500D63866 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0930CE550EC39F4500D63866 /* IOKit.framework */; }; + 0930CE630EC39F4500D63866 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0930CE550EC39F4500D63866 /* IOKit.framework */; }; + 0930CE640EC39F4500D63866 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0930CE550EC39F4500D63866 /* IOKit.framework */; }; + 0930CE650EC39F4500D63866 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0930CE550EC39F4500D63866 /* IOKit.framework */; }; + 0930CE660EC39F4500D63866 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0930CE550EC39F4500D63866 /* IOKit.framework */; }; + 093973C00E0458B200E0C987 /* CSceneNodeAnimatorCameraFPS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 093973BC0E0458B200E0C987 /* CSceneNodeAnimatorCameraFPS.cpp */; }; + 093973C10E0458B200E0C987 /* CSceneNodeAnimatorCameraFPS.h in Headers */ = {isa = PBXBuildFile; fileRef = 093973BD0E0458B200E0C987 /* CSceneNodeAnimatorCameraFPS.h */; }; + 093973C20E0458B200E0C987 /* CSceneNodeAnimatorCameraMaya.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 093973BE0E0458B200E0C987 /* CSceneNodeAnimatorCameraMaya.cpp */; }; + 093973C30E0458B200E0C987 /* CSceneNodeAnimatorCameraMaya.h in Headers */ = {isa = PBXBuildFile; fileRef = 093973BF0E0458B200E0C987 /* CSceneNodeAnimatorCameraMaya.h */; }; + 0946CCA70EC99BBE00D945A5 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 4C53E1650A484C2C0014E966 /* MainMenu.nib */; }; + 0946CCA80EC99BBE00D945A5 /* DemoApp-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4C53E38E0A4855BA0014E966 /* DemoApp-Info.plist */; }; + 0946CCAC0EC99BBE00D945A5 /* libIrrlicht.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C53E24D0A4850120014E966 /* libIrrlicht.a */; }; + 0946CCAD0EC99BBE00D945A5 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C53E26D0A4850D60014E966 /* Cocoa.framework */; }; + 0946CCAE0EC99BBE00D945A5 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C53E26E0A4850D60014E966 /* OpenGL.framework */; }; + 0946CCAF0EC99BBE00D945A5 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0925113D0D744ADE006784D9 /* Carbon.framework */; }; + 0946CCB00EC99BBE00D945A5 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0930CE550EC39F4500D63866 /* IOKit.framework */; }; + 0946CCCB0EC99C6E00D945A5 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0946CCCA0EC99C6E00D945A5 /* main.cpp */; }; + 096840470D0F1A2300333EFD /* CB3DMeshFileLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0968401E0D0F1A2300333EFD /* CB3DMeshFileLoader.cpp */; }; + 096840480D0F1A2300333EFD /* CB3DMeshFileLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 0968401F0D0F1A2300333EFD /* CB3DMeshFileLoader.h */; }; + 096840490D0F1A2300333EFD /* CBoneSceneNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 096840200D0F1A2300333EFD /* CBoneSceneNode.cpp */; }; + 0968404A0D0F1A2300333EFD /* CBoneSceneNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 096840210D0F1A2300333EFD /* CBoneSceneNode.h */; }; + 0968404B0D0F1A2300333EFD /* CBSPMeshFileLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 096840220D0F1A2300333EFD /* CBSPMeshFileLoader.cpp */; }; + 0968404C0D0F1A2300333EFD /* CBSPMeshFileLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 096840230D0F1A2300333EFD /* CBSPMeshFileLoader.h */; }; + 0968404E0D0F1A2300333EFD /* CColladaMeshWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 096840250D0F1A2300333EFD /* CColladaMeshWriter.cpp */; }; + 0968404F0D0F1A2300333EFD /* CColladaMeshWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 096840260D0F1A2300333EFD /* CColladaMeshWriter.h */; }; + 096840500D0F1A2300333EFD /* CImageLoaderPPM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 096840270D0F1A2300333EFD /* CImageLoaderPPM.cpp */; }; + 096840510D0F1A2300333EFD /* CImageLoaderPPM.h in Headers */ = {isa = PBXBuildFile; fileRef = 096840280D0F1A2300333EFD /* CImageLoaderPPM.h */; }; + 096840540D0F1A2300333EFD /* CIrrMeshFileLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0968402B0D0F1A2300333EFD /* CIrrMeshFileLoader.cpp */; }; + 096840550D0F1A2300333EFD /* CIrrMeshFileLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 0968402C0D0F1A2300333EFD /* CIrrMeshFileLoader.h */; }; + 096840560D0F1A2300333EFD /* CIrrMeshWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0968402D0D0F1A2300333EFD /* CIrrMeshWriter.cpp */; }; + 096840570D0F1A2300333EFD /* CIrrMeshWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 0968402E0D0F1A2300333EFD /* CIrrMeshWriter.h */; }; + 096840580D0F1A2300333EFD /* CMD2MeshFileLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0968402F0D0F1A2300333EFD /* CMD2MeshFileLoader.cpp */; }; + 096840590D0F1A2300333EFD /* CMD2MeshFileLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 096840300D0F1A2300333EFD /* CMD2MeshFileLoader.h */; }; + 0968405A0D0F1A2300333EFD /* CMS3DMeshFileLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 096840310D0F1A2300333EFD /* CMS3DMeshFileLoader.cpp */; }; + 0968405B0D0F1A2300333EFD /* CMS3DMeshFileLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 096840320D0F1A2300333EFD /* CMS3DMeshFileLoader.h */; }; + 0968405C0D0F1A2300333EFD /* CParticleAnimatedMeshSceneNodeEmitter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 096840330D0F1A2300333EFD /* CParticleAnimatedMeshSceneNodeEmitter.cpp */; }; + 0968405D0D0F1A2300333EFD /* CParticleAnimatedMeshSceneNodeEmitter.h in Headers */ = {isa = PBXBuildFile; fileRef = 096840340D0F1A2300333EFD /* CParticleAnimatedMeshSceneNodeEmitter.h */; }; + 0968405E0D0F1A2300333EFD /* CParticleAttractionAffector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 096840350D0F1A2300333EFD /* CParticleAttractionAffector.cpp */; }; + 0968405F0D0F1A2300333EFD /* CParticleAttractionAffector.h in Headers */ = {isa = PBXBuildFile; fileRef = 096840360D0F1A2300333EFD /* CParticleAttractionAffector.h */; }; + 096840600D0F1A2300333EFD /* CParticleCylinderEmitter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 096840370D0F1A2300333EFD /* CParticleCylinderEmitter.cpp */; }; + 096840610D0F1A2300333EFD /* CParticleCylinderEmitter.h in Headers */ = {isa = PBXBuildFile; fileRef = 096840380D0F1A2300333EFD /* CParticleCylinderEmitter.h */; }; + 096840620D0F1A2300333EFD /* CParticleMeshEmitter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 096840390D0F1A2300333EFD /* CParticleMeshEmitter.cpp */; }; + 096840630D0F1A2300333EFD /* CParticleMeshEmitter.h in Headers */ = {isa = PBXBuildFile; fileRef = 0968403A0D0F1A2300333EFD /* CParticleMeshEmitter.h */; }; + 096840640D0F1A2300333EFD /* CParticleRingEmitter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0968403B0D0F1A2300333EFD /* CParticleRingEmitter.cpp */; }; + 096840650D0F1A2300333EFD /* CParticleRingEmitter.h in Headers */ = {isa = PBXBuildFile; fileRef = 0968403C0D0F1A2300333EFD /* CParticleRingEmitter.h */; }; + 096840660D0F1A2300333EFD /* CParticleRotationAffector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0968403D0D0F1A2300333EFD /* CParticleRotationAffector.cpp */; }; + 096840670D0F1A2300333EFD /* CParticleRotationAffector.h in Headers */ = {isa = PBXBuildFile; fileRef = 0968403E0D0F1A2300333EFD /* CParticleRotationAffector.h */; }; + 096840680D0F1A2300333EFD /* CParticleSphereEmitter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0968403F0D0F1A2300333EFD /* CParticleSphereEmitter.cpp */; }; + 096840690D0F1A2300333EFD /* CParticleSphereEmitter.h in Headers */ = {isa = PBXBuildFile; fileRef = 096840400D0F1A2300333EFD /* CParticleSphereEmitter.h */; }; + 0968406A0D0F1A2300333EFD /* CSkinnedMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 096840410D0F1A2300333EFD /* CSkinnedMesh.cpp */; }; + 0968406B0D0F1A2300333EFD /* CSkinnedMesh.h in Headers */ = {isa = PBXBuildFile; fileRef = 096840420D0F1A2300333EFD /* CSkinnedMesh.h */; }; + 0968406C0D0F1A2300333EFD /* CSTLMeshFileLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 096840430D0F1A2300333EFD /* CSTLMeshFileLoader.cpp */; }; + 0968406D0D0F1A2300333EFD /* CSTLMeshFileLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 096840440D0F1A2300333EFD /* CSTLMeshFileLoader.h */; }; + 0968406E0D0F1A2300333EFD /* CSTLMeshWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 096840450D0F1A2300333EFD /* CSTLMeshWriter.cpp */; }; + 0968406F0D0F1A2300333EFD /* CSTLMeshWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 096840460D0F1A2300333EFD /* CSTLMeshWriter.h */; }; + 096CC0E00ECE65B500C81DC7 /* CParticleScaleAffector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 096CC0DE0ECE65B500C81DC7 /* CParticleScaleAffector.cpp */; }; + 096CC0E10ECE65B500C81DC7 /* CParticleScaleAffector.h in Headers */ = {isa = PBXBuildFile; fileRef = 096CC0DF0ECE65B500C81DC7 /* CParticleScaleAffector.h */; }; + 096F8E3D0EA2EFBA00907EC5 /* COBJMeshWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 096F8E3B0EA2EFBA00907EC5 /* COBJMeshWriter.cpp */; }; + 096F8E3E0EA2EFBA00907EC5 /* COBJMeshWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 096F8E3C0EA2EFBA00907EC5 /* COBJMeshWriter.h */; }; + 09C638720D4F1A69000B6A18 /* CLWOMeshFileLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 09C638700D4F1A69000B6A18 /* CLWOMeshFileLoader.cpp */; }; + 09C638730D4F1A69000B6A18 /* CLWOMeshFileLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 09C638710D4F1A69000B6A18 /* CLWOMeshFileLoader.h */; }; + 09F460EB0D3223ED00D0A9B0 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 09F6492E0D2CE038001E0599 /* main.cpp */; }; + 09F648F80D2CDED9001E0599 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 4C53E1650A484C2C0014E966 /* MainMenu.nib */; }; + 09F648F90D2CDED9001E0599 /* DemoApp-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4C53E38E0A4855BA0014E966 /* DemoApp-Info.plist */; }; + 09F648FD0D2CDED9001E0599 /* libIrrlicht.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C53E24D0A4850120014E966 /* libIrrlicht.a */; }; + 09F648FE0D2CDED9001E0599 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C53E26D0A4850D60014E966 /* Cocoa.framework */; }; + 09F648FF0D2CDED9001E0599 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C53E26E0A4850D60014E966 /* OpenGL.framework */; }; + 09F6491A0D2CDF9A001E0599 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C0054710A48470500C844C2 /* main.cpp */; }; + 09F649330D2CE03E001E0599 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 4C53E1650A484C2C0014E966 /* MainMenu.nib */; }; + 09F649340D2CE03E001E0599 /* DemoApp-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4C53E38E0A4855BA0014E966 /* DemoApp-Info.plist */; }; + 09F649380D2CE03E001E0599 /* libIrrlicht.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C53E24D0A4850120014E966 /* libIrrlicht.a */; }; + 09F649390D2CE03E001E0599 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C53E26D0A4850D60014E966 /* Cocoa.framework */; }; + 09F6493A0D2CE03E001E0599 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C53E26E0A4850D60014E966 /* OpenGL.framework */; }; + 09F6495A0D2CE206001E0599 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 4C53E1650A484C2C0014E966 /* MainMenu.nib */; }; + 09F6495B0D2CE206001E0599 /* DemoApp-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4C53E38E0A4855BA0014E966 /* DemoApp-Info.plist */; }; + 09F6495F0D2CE206001E0599 /* libIrrlicht.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C53E24D0A4850120014E966 /* libIrrlicht.a */; }; + 09F649600D2CE206001E0599 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C53E26D0A4850D60014E966 /* Cocoa.framework */; }; + 09F649610D2CE206001E0599 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C53E26E0A4850D60014E966 /* OpenGL.framework */; }; + 09F649740D2CE2D0001E0599 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 09F649730D2CE2D0001E0599 /* main.cpp */; }; 4C364EA40A6C6DC2004CFBB4 /* COBJMeshFileLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C364EA20A6C6DC2004CFBB4 /* COBJMeshFileLoader.cpp */; }; - 4C43EEBC0A74A5A300F942FC /* CAnimatedMeshB3d.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C43EEBB0A74A5A300F942FC /* CAnimatedMeshB3d.cpp */; }; 4C43EEC00A74A5C800F942FC /* CPakReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C43EEBE0A74A5C800F942FC /* CPakReader.cpp */; }; 4C53E2500A48504D0014E966 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C0054770A48470500C844C2 /* main.cpp */; }; 4C53E2510A4850550014E966 /* libIrrlicht.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C53E24D0A4850120014E966 /* libIrrlicht.a */; }; @@ -78,29 +265,16 @@ 4C53E3990A4855BA0014E966 /* DemoApp-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4C53E38E0A4855BA0014E966 /* DemoApp-Info.plist */; }; 4C53E39A0A4855BA0014E966 /* DemoApp-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4C53E38E0A4855BA0014E966 /* DemoApp-Info.plist */; }; 4C53E39B0A4855BA0014E966 /* DemoApp-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4C53E38E0A4855BA0014E966 /* DemoApp-Info.plist */; }; - 4C53E3B30A4856B30014E966 /* pngrutil.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E1170A484C2A0014E966 /* pngrutil.c */; }; - 4C53E3BB0A4856B30014E966 /* pngget.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E10D0A484C2A0014E966 /* pngget.c */; }; - 4C53E3C40A4856B30014E966 /* pngrtran.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E1160A484C2A0014E966 /* pngrtran.c */; }; - 4C53E3C90A4856B30014E966 /* pngerror.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E1090A484C2A0014E966 /* pngerror.c */; }; 4C53E3CA0A4856B30014E966 /* gzio.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E17D0A484C2C0014E966 /* gzio.c */; }; - 4C53E3D70A4856B30014E966 /* pngtrans.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E11D0A484C2B0014E966 /* pngtrans.c */; }; 4C53E3D80A4856B30014E966 /* inffast.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E1800A484C2C0014E966 /* inffast.c */; }; 4C53E3DC0A4856B30014E966 /* inftrees.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E1850A484C2C0014E966 /* inftrees.c */; }; 4C53E3E40A4856B30014E966 /* uncompr.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E18D0A484C2C0014E966 /* uncompr.c */; }; - 4C53E3E90A4856B30014E966 /* pngset.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E1180A484C2A0014E966 /* pngset.c */; }; - 4C53E3EE0A4856B30014E966 /* pngrio.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E1150A484C2A0014E966 /* pngrio.c */; }; 4C53E3F30A4856B30014E966 /* compress.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E1750A484C2C0014E966 /* compress.c */; }; 4C53E3F60A4856B30014E966 /* crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E1770A484C2C0014E966 /* crc32.c */; }; 4C53E3FE0A4856B30014E966 /* zutil.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E1920A484C2C0014E966 /* zutil.c */; }; 4C53E4010A4856B30014E966 /* trees.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E18B0A484C2C0014E966 /* trees.c */; }; - 4C53E4030A4856B30014E966 /* pngwio.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E1210A484C2B0014E966 /* pngwio.c */; }; - 4C53E4040A4856B30014E966 /* pngmem.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E10E0A484C2A0014E966 /* pngmem.c */; }; 4C53E40A0A4856B30014E966 /* deflate.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E1790A484C2C0014E966 /* deflate.c */; }; - 4C53E4110A4856B30014E966 /* pngpread.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E1130A484C2A0014E966 /* pngpread.c */; }; - 4C53E4140A4856B30014E966 /* png.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E1010A484C2A0014E966 /* png.c */; }; 4C53E4150A4856B30014E966 /* adler32.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E1720A484C2C0014E966 /* adler32.c */; }; - 4C53E4160A4856B30014E966 /* pngwtran.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E1230A484C2B0014E966 /* pngwtran.c */; }; - 4C53E41A0A4856B30014E966 /* pngwutil.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E1240A484C2B0014E966 /* pngwutil.c */; }; 4C53E4280A4856B30014E966 /* CImageLoaderPNG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DF600A484C230014E966 /* CImageLoaderPNG.cpp */; }; 4C53E4290A4856B30014E966 /* CColorConverter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DEFC0A484C220014E966 /* CColorConverter.cpp */; }; 4C53E42A0A4856B30014E966 /* CSceneManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DFAB0A484C240014E966 /* CSceneManager.cpp */; }; @@ -136,7 +310,6 @@ 4C53E4490A4856B30014E966 /* CTRTextureDetailMap2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DFDC0A484C250014E966 /* CTRTextureDetailMap2.cpp */; }; 4C53E44A0A4856B30014E966 /* CTRTextureGouraudAddNoZ2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DFE40A484C250014E966 /* CTRTextureGouraudAddNoZ2.cpp */; }; 4C53E44C0A4856B30014E966 /* CTRTextureGouraudNoZ.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DFE50A484C250014E966 /* CTRTextureGouraudNoZ.cpp */; }; - 4C53E44D0A4856B30014E966 /* CXFileReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DFF60A484C250014E966 /* CXFileReader.cpp */; }; 4C53E44E0A4856B30014E966 /* CGUIScrollBar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DF4C0A484C230014E966 /* CGUIScrollBar.cpp */; }; 4C53E44F0A4856B30014E966 /* CSceneCollisionManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DFA90A484C240014E966 /* CSceneCollisionManager.cpp */; }; 4C53E4500A4856B30014E966 /* CGUICheckBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DF300A484C230014E966 /* CGUICheckBox.cpp */; }; @@ -158,7 +331,6 @@ 4C53E4600A4856B30014E966 /* CTRTextureLightMap2_Add.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DFE90A484C250014E966 /* CTRTextureLightMap2_Add.cpp */; }; 4C53E4610A4856B30014E966 /* CReadFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DFA70A484C240014E966 /* CReadFile.cpp */; }; 4C53E4620A4856B30014E966 /* COpenGLTexture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DF970A484C240014E966 /* COpenGLTexture.cpp */; }; - 4C53E4630A4856B30014E966 /* CAnimatedMeshMS3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DEEB0A484C220014E966 /* CAnimatedMeshMS3D.cpp */; }; 4C53E4640A4856B30014E966 /* COSOperator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DF990A484C240014E966 /* COSOperator.cpp */; }; 4C53E4650A4856B30014E966 /* CMemoryReadFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DF740A484C230014E966 /* CMemoryReadFile.cpp */; }; 4C53E4660A4856B30014E966 /* CColladaFileLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DEFA0A484C220014E966 /* CColladaFileLoader.cpp */; }; @@ -168,7 +340,6 @@ 4C53E46A0A4856B30014E966 /* CVideoModeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DFEE0A484C250014E966 /* CVideoModeList.cpp */; }; 4C53E46B0A4856B30014E966 /* CXMLReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DFFA0A484C250014E966 /* CXMLReader.cpp */; }; 4C53E46C0A4856B30014E966 /* COpenGLParallaxMapRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DF910A484C240014E966 /* COpenGLParallaxMapRenderer.cpp */; }; - 4C53E46D0A4856B30014E966 /* CDefaultMeshFormatLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DF1A0A484C230014E966 /* CDefaultMeshFormatLoader.cpp */; }; 4C53E46E0A4856B30014E966 /* CTRTextureGouraudNoZ2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DFE60A484C250014E966 /* CTRTextureGouraudNoZ2.cpp */; }; 4C53E46F0A4856B30014E966 /* CTRTextureGouraudWire.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DFE80A484C250014E966 /* CTRTextureGouraudWire.cpp */; }; 4C53E4700A4856B30014E966 /* CParticlePointEmitter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DFA10A484C240014E966 /* CParticlePointEmitter.cpp */; }; @@ -200,7 +371,6 @@ 4C53E48A0A4856B30014E966 /* COctTreeSceneNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DF860A484C240014E966 /* COctTreeSceneNode.cpp */; }; 4C53E48B0A4856B30014E966 /* CParticleSystemSceneNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DFA30A484C240014E966 /* CParticleSystemSceneNode.cpp */; }; 4C53E48C0A4856B30014E966 /* CTerrainSceneNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DFCA0A484C240014E966 /* CTerrainSceneNode.cpp */; }; - 4C53E48D0A4856B30014E966 /* CCameraFPSSceneNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DEF40A484C220014E966 /* CCameraFPSSceneNode.cpp */; }; 4C53E48E0A4856B30014E966 /* CGUIFont.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DF3C0A484C230014E966 /* CGUIFont.cpp */; }; 4C53E48F0A4856B30014E966 /* CParticleFadeOutAffector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DF9D0A484C240014E966 /* CParticleFadeOutAffector.cpp */; }; 4C53E4910A4856B30014E966 /* CDummyTransformationSceneNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DF220A484C230014E966 /* CDummyTransformationSceneNode.cpp */; }; @@ -229,8 +399,6 @@ 4C53E4A80A4856B30014E966 /* CLogger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DF720A484C230014E966 /* CLogger.cpp */; }; 4C53E4A90A4856B30014E966 /* CGUIInOutFader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DF400A484C230014E966 /* CGUIInOutFader.cpp */; }; 4C53E4AA0A4856B30014E966 /* CWriteFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DFF20A484C250014E966 /* CWriteFile.cpp */; }; - 4C53E4AB0A4856B30014E966 /* CXAnimationPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DFF40A484C250014E966 /* CXAnimationPlayer.cpp */; }; - 4C53E4AC0A4856B30014E966 /* CCameraMayaSceneNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DEF60A484C220014E966 /* CCameraMayaSceneNode.cpp */; }; 4C53E4AD0A4856B30014E966 /* CTRTextureGouraud.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DFDF0A484C250014E966 /* CTRTextureGouraud.cpp */; }; 4C53E4AE0A4856B30014E966 /* CTRFlat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DFD10A484C240014E966 /* CTRFlat.cpp */; }; 4C53E4AF0A4856B30014E966 /* CTerrainTriangleSelector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C53DFCC0A484C240014E966 /* CTerrainTriangleSelector.cpp */; }; @@ -254,7 +422,6 @@ 4C53E57E0A4856B30014E966 /* OSXClipboard.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E1670A484C2C0014E966 /* OSXClipboard.mm */; }; 4C53E57F0A4856B30014E966 /* CIrrDeviceMacOSX.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E15F0A484C2C0014E966 /* CIrrDeviceMacOSX.mm */; }; 4C53E5800A4856B30014E966 /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E14D0A484C2C0014E966 /* AppDelegate.mm */; }; - 4C53E62E0A485ABF0014E966 /* pngread.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E1140A484C2A0014E966 /* pngread.c */; }; 4C6DC9B70A48715A0017A6E5 /* inflate.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C6DC9B60A48715A0017A6E5 /* inflate.c */; }; 4CA25BCE0A485EAD00B4E469 /* jcapimin.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E6F10A485CD80014E966 /* jcapimin.c */; }; 4CA25BCF0A485EAD00B4E469 /* jcapistd.c in Sources */ = {isa = PBXBuildFile; fileRef = 4C53E6F20A485CD80014E966 /* jcapistd.c */; }; @@ -363,7 +530,6 @@ 4CFA7BFA0A88735A00B03626 /* CImageWriterPSD.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CFA7BE80A88735900B03626 /* CImageWriterPSD.cpp */; }; 4CFA7BFC0A88735A00B03626 /* CImageWriterTGA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CFA7BEA0A88735900B03626 /* CImageWriterTGA.cpp */; }; 4CFA7BFE0A88735A00B03626 /* CSkyDomeSceneNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CFA7BEC0A88735A00B03626 /* CSkyDomeSceneNode.cpp */; }; - 5DD480480C7D8B9100728AA9 /* pngwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = 5DD480470C7D8B9100728AA9 /* pngwrite.c */; }; 5DD4804E0C7D91DF00728AA9 /* CDepthBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5DD4804C0C7D91DF00728AA9 /* CDepthBuffer.cpp */; }; 5DD4804F0C7D91DF00728AA9 /* CDepthBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DD4804D0C7D91DF00728AA9 /* CDepthBuffer.h */; }; 5DD480520C7D936700728AA9 /* IBurningShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5DD480500C7D936700728AA9 /* IBurningShader.cpp */; }; @@ -395,6 +561,76 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 09022C540EA0E97F00CD54EE /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = D2AAC07D0554694100DB518D; + remoteInfo = MacOSX; + }; + 0946CCA50EC99BBE00D945A5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = D2AAC07D0554694100DB518D; + remoteInfo = MacOSX; + }; + 0946CCD50EC99D8200D945A5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 0946CCA30EC99BBE00D945A5; + remoteInfo = MouseAndJoystick; + }; + 0946CCD80EC99D8C00D945A5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 09022C520EA0E97F00CD54EE; + remoteInfo = GUIEditor; + }; + 09F648F60D2CDED9001E0599 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = D2AAC07D0554694100DB518D; + remoteInfo = MacOSX; + }; + 09F649200D2CDFF0001E0599 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 09F648F40D2CDED9001E0599; + remoteInfo = HelloWorld; + }; + 09F649310D2CE03E001E0599 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = D2AAC07D0554694100DB518D; + remoteInfo = MacOSX; + }; + 09F649440D2CE100001E0599 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 09F6492F0D2CE03E001E0599; + remoteInfo = LoadIrrFile; + }; + 09F649580D2CE206001E0599 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = D2AAC07D0554694100DB518D; + remoteInfo = MacOSX; + }; + 09F649710D2CE2A1001E0599 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 09F649560D2CE206001E0599; + remoteInfo = Quake3Shader; + }; 4CA5CB810A4868B500ADB3D7 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; @@ -580,6 +816,148 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 09022C620EA0E97F00CD54EE /* GUIEditor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GUIEditor.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 09022C680EA0EA9D00CD54EE /* CGUIAttribute.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CGUIAttribute.h; path = ../../../tools/GUIEditor/CGUIAttribute.h; sourceTree = SOURCE_ROOT; }; + 09022C690EA0EA9D00CD54EE /* CGUIAttributeEditor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = CGUIAttributeEditor.cpp; path = ../../../tools/GUIEditor/CGUIAttributeEditor.cpp; sourceTree = SOURCE_ROOT; }; + 09022C6A0EA0EA9D00CD54EE /* CGUIAttributeEditor.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CGUIAttributeEditor.h; path = ../../../tools/GUIEditor/CGUIAttributeEditor.h; sourceTree = SOURCE_ROOT; }; + 09022C6B0EA0EA9D00CD54EE /* CGUIBoolAttribute.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CGUIBoolAttribute.h; path = ../../../tools/GUIEditor/CGUIBoolAttribute.h; sourceTree = SOURCE_ROOT; }; + 09022C6C0EA0EA9D00CD54EE /* CGUIColorAttribute.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CGUIColorAttribute.h; path = ../../../tools/GUIEditor/CGUIColorAttribute.h; sourceTree = SOURCE_ROOT; }; + 09022C6D0EA0EA9D00CD54EE /* CGUIDummyEditorStub.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CGUIDummyEditorStub.h; path = ../../../tools/GUIEditor/CGUIDummyEditorStub.h; sourceTree = SOURCE_ROOT; }; + 09022C6E0EA0EA9D00CD54EE /* CGUIEditFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = CGUIEditFactory.cpp; path = ../../../tools/GUIEditor/CGUIEditFactory.cpp; sourceTree = SOURCE_ROOT; }; + 09022C6F0EA0EA9D00CD54EE /* CGUIEditFactory.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CGUIEditFactory.h; path = ../../../tools/GUIEditor/CGUIEditFactory.h; sourceTree = SOURCE_ROOT; }; + 09022C700EA0EA9D00CD54EE /* CGUIEditWindow.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = CGUIEditWindow.cpp; path = ../../../tools/GUIEditor/CGUIEditWindow.cpp; sourceTree = SOURCE_ROOT; }; + 09022C710EA0EA9D00CD54EE /* CGUIEditWindow.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CGUIEditWindow.h; path = ../../../tools/GUIEditor/CGUIEditWindow.h; sourceTree = SOURCE_ROOT; }; + 09022C720EA0EA9D00CD54EE /* CGUIEditWorkspace.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = CGUIEditWorkspace.cpp; path = ../../../tools/GUIEditor/CGUIEditWorkspace.cpp; sourceTree = SOURCE_ROOT; }; + 09022C730EA0EA9D00CD54EE /* CGUIEditWorkspace.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CGUIEditWorkspace.h; path = ../../../tools/GUIEditor/CGUIEditWorkspace.h; sourceTree = SOURCE_ROOT; }; + 09022C740EA0EA9D00CD54EE /* CGUIEnumAttribute.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CGUIEnumAttribute.h; path = ../../../tools/GUIEditor/CGUIEnumAttribute.h; sourceTree = SOURCE_ROOT; }; + 09022C750EA0EA9D00CD54EE /* CGUIPanel.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = CGUIPanel.cpp; path = ../../../tools/GUIEditor/CGUIPanel.cpp; sourceTree = SOURCE_ROOT; }; + 09022C760EA0EA9D00CD54EE /* CGUIPanel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CGUIPanel.h; path = ../../../tools/GUIEditor/CGUIPanel.h; sourceTree = SOURCE_ROOT; }; + 09022C770EA0EA9D00CD54EE /* CGUIStringAttribute.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CGUIStringAttribute.h; path = ../../../tools/GUIEditor/CGUIStringAttribute.h; sourceTree = SOURCE_ROOT; }; + 09022C780EA0EA9D00CD54EE /* CGUITextureAttribute.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CGUITextureAttribute.h; path = ../../../tools/GUIEditor/CGUITextureAttribute.h; sourceTree = SOURCE_ROOT; }; + 09022C790EA0EA9D00CD54EE /* CGUITextureCacheBrowser.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = CGUITextureCacheBrowser.cpp; path = ../../../tools/GUIEditor/CGUITextureCacheBrowser.cpp; sourceTree = SOURCE_ROOT; }; + 09022C7A0EA0EA9D00CD54EE /* CGUITextureCacheBrowser.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CGUITextureCacheBrowser.h; path = ../../../tools/GUIEditor/CGUITextureCacheBrowser.h; sourceTree = SOURCE_ROOT; }; + 09022C7B0EA0EA9D00CD54EE /* CMemoryReadWriteFile.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = CMemoryReadWriteFile.cpp; path = ../../../tools/GUIEditor/CMemoryReadWriteFile.cpp; sourceTree = SOURCE_ROOT; }; + 09022C7C0EA0EA9D00CD54EE /* CMemoryReadWriteFile.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CMemoryReadWriteFile.h; path = ../../../tools/GUIEditor/CMemoryReadWriteFile.h; sourceTree = SOURCE_ROOT; }; + 09022C7D0EA0EA9D00CD54EE /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = ../../../tools/GUIEditor/main.cpp; sourceTree = SOURCE_ROOT; }; + 090FBC800D31085E0076D847 /* CVolumeLightSceneNode.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CVolumeLightSceneNode.cpp; sourceTree = ""; }; + 090FBC810D31085E0076D847 /* CVolumeLightSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CVolumeLightSceneNode.h; sourceTree = ""; }; + 0910B9D90D1F5D4100D46B04 /* CBurningShader_Raster_Reference.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CBurningShader_Raster_Reference.cpp; sourceTree = ""; }; + 0910B9DA0D1F5D4100D46B04 /* CGUITable.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CGUITable.cpp; sourceTree = ""; }; + 0910B9DB0D1F5D4100D46B04 /* CGUITable.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CGUITable.h; sourceTree = ""; }; + 0910B9DC0D1F5D4100D46B04 /* CImageLoaderWAL.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CImageLoaderWAL.cpp; sourceTree = ""; }; + 0910B9DD0D1F5D4100D46B04 /* CImageLoaderWAL.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CImageLoaderWAL.h; sourceTree = ""; }; + 0910B9FD0D1F64B300D46B04 /* CMeshBuffer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CMeshBuffer.h; sourceTree = ""; }; + 0910B9FE0D1F64B300D46B04 /* coreutil.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = coreutil.h; sourceTree = ""; }; + 0910B9FF0D1F64B300D46B04 /* ECullingTypes.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ECullingTypes.h; sourceTree = ""; }; + 0910BA000D1F64B300D46B04 /* EDebugSceneTypes.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = EDebugSceneTypes.h; sourceTree = ""; }; + 0910BA010D1F64B300D46B04 /* EDriverFeatures.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = EDriverFeatures.h; sourceTree = ""; }; + 0910BA020D1F64B300D46B04 /* EGUIAlignment.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = EGUIAlignment.h; sourceTree = ""; }; + 0910BA030D1F64B300D46B04 /* EHardwareBufferFlags.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = EHardwareBufferFlags.h; sourceTree = ""; }; + 0910BA040D1F64B300D46B04 /* EMaterialFlags.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = EMaterialFlags.h; sourceTree = ""; }; + 0910BA050D1F64B300D46B04 /* EMaterialTypes.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = EMaterialTypes.h; sourceTree = ""; }; + 0910BA060D1F64B300D46B04 /* EMeshWriterEnums.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = EMeshWriterEnums.h; sourceTree = ""; }; + 0910BA070D1F64B300D46B04 /* EMessageBoxFlags.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = EMessageBoxFlags.h; sourceTree = ""; }; + 0910BA080D1F64B300D46B04 /* ETerrainElements.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ETerrainElements.h; sourceTree = ""; }; + 0910BA090D1F64B300D46B04 /* IAnimatedMeshMD3.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IAnimatedMeshMD3.h; sourceTree = ""; }; + 0910BA0A0D1F64B300D46B04 /* IBoneSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IBoneSceneNode.h; sourceTree = ""; }; + 0910BA0B0D1F64B300D46B04 /* IGUIColorSelectDialog.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IGUIColorSelectDialog.h; sourceTree = ""; }; + 0910BA0C0D1F64B300D46B04 /* IGUIElementFactory.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IGUIElementFactory.h; sourceTree = ""; }; + 0910BA0D0D1F64B300D46B04 /* IGUIFontBitmap.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IGUIFontBitmap.h; sourceTree = ""; }; + 0910BA0E0D1F64B300D46B04 /* IGUISpinBox.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IGUISpinBox.h; sourceTree = ""; }; + 0910BA0F0D1F64B300D46B04 /* IGUISpriteBank.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IGUISpriteBank.h; sourceTree = ""; }; + 0910BA100D1F64B300D46B04 /* IGUITable.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IGUITable.h; sourceTree = ""; }; + 0910BA110D1F64B300D46B04 /* IMeshWriter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IMeshWriter.h; sourceTree = ""; }; + 0910BA120D1F64B300D46B04 /* IParticleAnimatedMeshSceneNodeEmitter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IParticleAnimatedMeshSceneNodeEmitter.h; sourceTree = ""; }; + 0910BA130D1F64B300D46B04 /* IParticleAttractionAffector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IParticleAttractionAffector.h; sourceTree = ""; }; + 0910BA140D1F64B300D46B04 /* IParticleBoxEmitter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IParticleBoxEmitter.h; sourceTree = ""; }; + 0910BA150D1F64B300D46B04 /* IParticleCylinderEmitter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IParticleCylinderEmitter.h; sourceTree = ""; }; + 0910BA160D1F64B300D46B04 /* IParticleFadeOutAffector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IParticleFadeOutAffector.h; sourceTree = ""; }; + 0910BA170D1F64B300D46B04 /* IParticleGravityAffector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IParticleGravityAffector.h; sourceTree = ""; }; + 0910BA180D1F64B300D46B04 /* IParticleMeshEmitter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IParticleMeshEmitter.h; sourceTree = ""; }; + 0910BA190D1F64B300D46B04 /* IParticleRingEmitter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IParticleRingEmitter.h; sourceTree = ""; }; + 0910BA1A0D1F64B300D46B04 /* IParticleRotationAffector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IParticleRotationAffector.h; sourceTree = ""; }; + 0910BA1B0D1F64B300D46B04 /* IParticleSphereEmitter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IParticleSphereEmitter.h; sourceTree = ""; }; + 0910BA1C0D1F64B300D46B04 /* IQ3Shader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IQ3Shader.h; sourceTree = ""; }; + 0910BA1D0D1F64B300D46B04 /* IReferenceCounted.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IReferenceCounted.h; sourceTree = ""; }; + 0910BA1E0D1F64B300D46B04 /* irrMap.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = irrMap.h; sourceTree = ""; }; + 0910BA1F0D1F64B300D46B04 /* ISkinnedMesh.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ISkinnedMesh.h; sourceTree = ""; }; + 0910BA200D1F64B300D46B04 /* SMaterialLayer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SMaterialLayer.h; sourceTree = ""; }; + 0910BA210D1F64B300D46B04 /* SSharedMeshBuffer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SSharedMeshBuffer.h; sourceTree = ""; }; + 0910BA220D1F64B300D46B04 /* SSkinMeshBuffer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SSkinMeshBuffer.h; sourceTree = ""; }; + 0910BA230D1F64B300D46B04 /* SViewFrustum.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SViewFrustum.h; sourceTree = ""; }; + 0925113D0D744ADE006784D9 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; + 09293C2C0ED32029003B8C9C /* png.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = png.c; path = libpng/png.c; sourceTree = ""; }; + 09293C2D0ED32029003B8C9C /* pngerror.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngerror.c; path = libpng/pngerror.c; sourceTree = ""; }; + 09293C2E0ED32029003B8C9C /* pnggccrd.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pnggccrd.c; path = libpng/pnggccrd.c; sourceTree = ""; }; + 09293C2F0ED32029003B8C9C /* pngget.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngget.c; path = libpng/pngget.c; sourceTree = ""; }; + 09293C300ED32029003B8C9C /* pngmem.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngmem.c; path = libpng/pngmem.c; sourceTree = ""; }; + 09293C310ED32029003B8C9C /* pngpread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngpread.c; path = libpng/pngpread.c; sourceTree = ""; }; + 09293C320ED32029003B8C9C /* pngread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngread.c; path = libpng/pngread.c; sourceTree = ""; }; + 09293C330ED32029003B8C9C /* pngrio.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngrio.c; path = libpng/pngrio.c; sourceTree = ""; }; + 09293C340ED32029003B8C9C /* pngrtran.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngrtran.c; path = libpng/pngrtran.c; sourceTree = ""; }; + 09293C350ED32029003B8C9C /* pngrutil.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngrutil.c; path = libpng/pngrutil.c; sourceTree = ""; }; + 09293C360ED32029003B8C9C /* pngset.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngset.c; path = libpng/pngset.c; sourceTree = ""; }; + 09293C380ED32029003B8C9C /* pngtrans.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngtrans.c; path = libpng/pngtrans.c; sourceTree = ""; }; + 09293C3A0ED32029003B8C9C /* pngwio.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngwio.c; path = libpng/pngwio.c; sourceTree = ""; }; + 09293C3B0ED32029003B8C9C /* pngwrite.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngwrite.c; path = libpng/pngwrite.c; sourceTree = ""; }; + 09293C3C0ED32029003B8C9C /* pngwtran.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngwtran.c; path = libpng/pngwtran.c; sourceTree = ""; }; + 09293C3D0ED32029003B8C9C /* pngwutil.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngwutil.c; path = libpng/pngwutil.c; sourceTree = ""; }; + 0930CE550EC39F4500D63866 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; + 093973BC0E0458B200E0C987 /* CSceneNodeAnimatorCameraFPS.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSceneNodeAnimatorCameraFPS.cpp; sourceTree = ""; }; + 093973BD0E0458B200E0C987 /* CSceneNodeAnimatorCameraFPS.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSceneNodeAnimatorCameraFPS.h; sourceTree = ""; }; + 093973BE0E0458B200E0C987 /* CSceneNodeAnimatorCameraMaya.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSceneNodeAnimatorCameraMaya.cpp; sourceTree = ""; }; + 093973BF0E0458B200E0C987 /* CSceneNodeAnimatorCameraMaya.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSceneNodeAnimatorCameraMaya.h; sourceTree = ""; }; + 0946CCB40EC99BBE00D945A5 /* MouseAndJoystick.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = MouseAndJoystick.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 0946CCCA0EC99C6E00D945A5 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = 19.MouseAndJoystick/main.cpp; sourceTree = ""; }; + 0968401E0D0F1A2300333EFD /* CB3DMeshFileLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CB3DMeshFileLoader.cpp; sourceTree = ""; }; + 0968401F0D0F1A2300333EFD /* CB3DMeshFileLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CB3DMeshFileLoader.h; sourceTree = ""; }; + 096840200D0F1A2300333EFD /* CBoneSceneNode.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CBoneSceneNode.cpp; sourceTree = ""; }; + 096840210D0F1A2300333EFD /* CBoneSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CBoneSceneNode.h; sourceTree = ""; }; + 096840220D0F1A2300333EFD /* CBSPMeshFileLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CBSPMeshFileLoader.cpp; sourceTree = ""; }; + 096840230D0F1A2300333EFD /* CBSPMeshFileLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CBSPMeshFileLoader.h; sourceTree = ""; }; + 096840250D0F1A2300333EFD /* CColladaMeshWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CColladaMeshWriter.cpp; sourceTree = ""; }; + 096840260D0F1A2300333EFD /* CColladaMeshWriter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CColladaMeshWriter.h; sourceTree = ""; }; + 096840270D0F1A2300333EFD /* CImageLoaderPPM.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CImageLoaderPPM.cpp; sourceTree = ""; }; + 096840280D0F1A2300333EFD /* CImageLoaderPPM.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CImageLoaderPPM.h; sourceTree = ""; }; + 0968402B0D0F1A2300333EFD /* CIrrMeshFileLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CIrrMeshFileLoader.cpp; sourceTree = ""; }; + 0968402C0D0F1A2300333EFD /* CIrrMeshFileLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CIrrMeshFileLoader.h; sourceTree = ""; }; + 0968402D0D0F1A2300333EFD /* CIrrMeshWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CIrrMeshWriter.cpp; sourceTree = ""; }; + 0968402E0D0F1A2300333EFD /* CIrrMeshWriter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CIrrMeshWriter.h; sourceTree = ""; }; + 0968402F0D0F1A2300333EFD /* CMD2MeshFileLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CMD2MeshFileLoader.cpp; sourceTree = ""; }; + 096840300D0F1A2300333EFD /* CMD2MeshFileLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CMD2MeshFileLoader.h; sourceTree = ""; }; + 096840310D0F1A2300333EFD /* CMS3DMeshFileLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CMS3DMeshFileLoader.cpp; sourceTree = ""; }; + 096840320D0F1A2300333EFD /* CMS3DMeshFileLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CMS3DMeshFileLoader.h; sourceTree = ""; }; + 096840330D0F1A2300333EFD /* CParticleAnimatedMeshSceneNodeEmitter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CParticleAnimatedMeshSceneNodeEmitter.cpp; sourceTree = ""; }; + 096840340D0F1A2300333EFD /* CParticleAnimatedMeshSceneNodeEmitter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CParticleAnimatedMeshSceneNodeEmitter.h; sourceTree = ""; }; + 096840350D0F1A2300333EFD /* CParticleAttractionAffector.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CParticleAttractionAffector.cpp; sourceTree = ""; }; + 096840360D0F1A2300333EFD /* CParticleAttractionAffector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CParticleAttractionAffector.h; sourceTree = ""; }; + 096840370D0F1A2300333EFD /* CParticleCylinderEmitter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CParticleCylinderEmitter.cpp; sourceTree = ""; }; + 096840380D0F1A2300333EFD /* CParticleCylinderEmitter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CParticleCylinderEmitter.h; sourceTree = ""; }; + 096840390D0F1A2300333EFD /* CParticleMeshEmitter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CParticleMeshEmitter.cpp; sourceTree = ""; }; + 0968403A0D0F1A2300333EFD /* CParticleMeshEmitter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CParticleMeshEmitter.h; sourceTree = ""; }; + 0968403B0D0F1A2300333EFD /* CParticleRingEmitter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CParticleRingEmitter.cpp; sourceTree = ""; }; + 0968403C0D0F1A2300333EFD /* CParticleRingEmitter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CParticleRingEmitter.h; sourceTree = ""; }; + 0968403D0D0F1A2300333EFD /* CParticleRotationAffector.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CParticleRotationAffector.cpp; sourceTree = ""; }; + 0968403E0D0F1A2300333EFD /* CParticleRotationAffector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CParticleRotationAffector.h; sourceTree = ""; }; + 0968403F0D0F1A2300333EFD /* CParticleSphereEmitter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CParticleSphereEmitter.cpp; sourceTree = ""; }; + 096840400D0F1A2300333EFD /* CParticleSphereEmitter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CParticleSphereEmitter.h; sourceTree = ""; }; + 096840410D0F1A2300333EFD /* CSkinnedMesh.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSkinnedMesh.cpp; sourceTree = ""; }; + 096840420D0F1A2300333EFD /* CSkinnedMesh.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSkinnedMesh.h; sourceTree = ""; }; + 096840430D0F1A2300333EFD /* CSTLMeshFileLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSTLMeshFileLoader.cpp; sourceTree = ""; }; + 096840440D0F1A2300333EFD /* CSTLMeshFileLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSTLMeshFileLoader.h; sourceTree = ""; }; + 096840450D0F1A2300333EFD /* CSTLMeshWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSTLMeshWriter.cpp; sourceTree = ""; }; + 096840460D0F1A2300333EFD /* CSTLMeshWriter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSTLMeshWriter.h; sourceTree = ""; }; + 096CC0DE0ECE65B500C81DC7 /* CParticleScaleAffector.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CParticleScaleAffector.cpp; sourceTree = ""; }; + 096CC0DF0ECE65B500C81DC7 /* CParticleScaleAffector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CParticleScaleAffector.h; sourceTree = ""; }; + 096F8E3B0EA2EFBA00907EC5 /* COBJMeshWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = COBJMeshWriter.cpp; sourceTree = ""; }; + 096F8E3C0EA2EFBA00907EC5 /* COBJMeshWriter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = COBJMeshWriter.h; sourceTree = ""; }; + 09C638700D4F1A69000B6A18 /* CLWOMeshFileLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CLWOMeshFileLoader.cpp; sourceTree = ""; }; + 09C638710D4F1A69000B6A18 /* CLWOMeshFileLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CLWOMeshFileLoader.h; sourceTree = ""; }; + 09F649030D2CDED9001E0599 /* HelloWorld.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloWorld.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 09F6492E0D2CE038001E0599 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = 15.LoadIrrFile/main.cpp; sourceTree = ""; }; + 09F6493E0D2CE03E001E0599 /* LoadIrrFile.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LoadIrrFile.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 09F649650D2CE206001E0599 /* Quake3Shader.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Quake3Shader.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 09F649730D2CE2D0001E0599 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = 16.Quake3MapShader/main.cpp; sourceTree = ""; }; 4C0054710A48470500C844C2 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; 4C0054770A48470500C844C2 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; 4C00547D0A48470500C844C2 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; @@ -600,8 +978,6 @@ 4C0054CA0A48470500C844C2 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; 4C364EA20A6C6DC2004CFBB4 /* COBJMeshFileLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = COBJMeshFileLoader.cpp; sourceTree = ""; }; 4C364EA30A6C6DC2004CFBB4 /* COBJMeshFileLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = COBJMeshFileLoader.h; sourceTree = ""; }; - 4C43EEBB0A74A5A300F942FC /* CAnimatedMeshB3d.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 2; path = CAnimatedMeshB3d.cpp; sourceTree = ""; }; - 4C43EEBD0A74A5AB00F942FC /* CAnimatedMeshB3d.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAnimatedMeshB3d.h; sourceTree = ""; }; 4C43EEBE0A74A5C800F942FC /* CPakReader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CPakReader.cpp; sourceTree = ""; }; 4C43EEBF0A74A5C800F942FC /* CPakReader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CPakReader.h; sourceTree = ""; }; 4C53DEE60A484C220014E966 /* BuiltInFont.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; lineEnding = 2; path = BuiltInFont.h; sourceTree = ""; }; @@ -609,8 +985,6 @@ 4C53DEE80A484C220014E966 /* C3DSMeshFileLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = C3DSMeshFileLoader.h; sourceTree = ""; }; 4C53DEE90A484C220014E966 /* CAnimatedMeshMD2.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 2; path = CAnimatedMeshMD2.cpp; sourceTree = ""; }; 4C53DEEA0A484C220014E966 /* CAnimatedMeshMD2.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAnimatedMeshMD2.h; sourceTree = ""; }; - 4C53DEEB0A484C220014E966 /* CAnimatedMeshMS3D.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CAnimatedMeshMS3D.cpp; sourceTree = ""; }; - 4C53DEEC0A484C220014E966 /* CAnimatedMeshMS3D.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAnimatedMeshMS3D.h; sourceTree = ""; }; 4C53DEED0A484C220014E966 /* CAnimatedMeshSceneNode.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CAnimatedMeshSceneNode.cpp; sourceTree = ""; }; 4C53DEEE0A484C220014E966 /* CAnimatedMeshSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAnimatedMeshSceneNode.h; sourceTree = ""; }; 4C53DEEF0A484C220014E966 /* CAttributeImpl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAttributeImpl.h; sourceTree = ""; }; @@ -618,10 +992,6 @@ 4C53DEF10A484C220014E966 /* CAttributes.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAttributes.h; sourceTree = ""; }; 4C53DEF20A484C220014E966 /* CBillboardSceneNode.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CBillboardSceneNode.cpp; sourceTree = ""; }; 4C53DEF30A484C220014E966 /* CBillboardSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CBillboardSceneNode.h; sourceTree = ""; }; - 4C53DEF40A484C220014E966 /* CCameraFPSSceneNode.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CCameraFPSSceneNode.cpp; sourceTree = ""; }; - 4C53DEF50A484C220014E966 /* CCameraFPSSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CCameraFPSSceneNode.h; sourceTree = ""; }; - 4C53DEF60A484C220014E966 /* CCameraMayaSceneNode.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CCameraMayaSceneNode.cpp; sourceTree = ""; }; - 4C53DEF70A484C220014E966 /* CCameraMayaSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CCameraMayaSceneNode.h; sourceTree = ""; }; 4C53DEF80A484C220014E966 /* CCameraSceneNode.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CCameraSceneNode.cpp; sourceTree = ""; }; 4C53DEF90A484C220014E966 /* CCameraSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CCameraSceneNode.h; sourceTree = ""; }; 4C53DEFA0A484C220014E966 /* CColladaFileLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CColladaFileLoader.cpp; sourceTree = ""; }; @@ -656,8 +1026,6 @@ 4C53DF170A484C230014E966 /* CD3D9ShaderMaterialRenderer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CD3D9ShaderMaterialRenderer.h; sourceTree = ""; }; 4C53DF180A484C230014E966 /* CD3D9Texture.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CD3D9Texture.cpp; sourceTree = ""; }; 4C53DF190A484C230014E966 /* CD3D9Texture.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CD3D9Texture.h; sourceTree = ""; }; - 4C53DF1A0A484C230014E966 /* CDefaultMeshFormatLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CDefaultMeshFormatLoader.cpp; sourceTree = ""; }; - 4C53DF1B0A484C230014E966 /* CDefaultMeshFormatLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CDefaultMeshFormatLoader.h; sourceTree = ""; }; 4C53DF1C0A484C230014E966 /* CDefaultSceneNodeAnimatorFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CDefaultSceneNodeAnimatorFactory.cpp; sourceTree = ""; }; 4C53DF1D0A484C230014E966 /* CDefaultSceneNodeAnimatorFactory.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CDefaultSceneNodeAnimatorFactory.h; sourceTree = ""; }; 4C53DF1E0A484C230014E966 /* CDefaultSceneNodeFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CDefaultSceneNodeFactory.cpp; sourceTree = ""; }; @@ -757,7 +1125,6 @@ 4C53DF7E0A484C230014E966 /* CMY3DHelper.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CMY3DHelper.h; sourceTree = ""; }; 4C53DF7F0A484C230014E966 /* CMY3DMeshFileLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CMY3DMeshFileLoader.cpp; sourceTree = ""; }; 4C53DF800A484C230014E966 /* CMY3DMeshFileLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CMY3DMeshFileLoader.h; sourceTree = ""; }; - 4C53DF810A484C230014E966 /* CMY3DStuff.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CMY3DStuff.h; sourceTree = ""; }; 4C53DF820A484C240014E966 /* CNullDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CNullDriver.cpp; sourceTree = ""; }; 4C53DF830A484C240014E966 /* CNullDriver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CNullDriver.h; sourceTree = ""; }; 4C53DF840A484C240014E966 /* COCTLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = COCTLoader.cpp; sourceTree = ""; }; @@ -870,10 +1237,6 @@ 4C53DFF10A484C250014E966 /* CWaterSurfaceSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CWaterSurfaceSceneNode.h; sourceTree = ""; }; 4C53DFF20A484C250014E966 /* CWriteFile.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CWriteFile.cpp; sourceTree = ""; }; 4C53DFF30A484C250014E966 /* CWriteFile.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CWriteFile.h; sourceTree = ""; }; - 4C53DFF40A484C250014E966 /* CXAnimationPlayer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CXAnimationPlayer.cpp; sourceTree = ""; }; - 4C53DFF50A484C250014E966 /* CXAnimationPlayer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CXAnimationPlayer.h; sourceTree = ""; }; - 4C53DFF60A484C250014E966 /* CXFileReader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CXFileReader.cpp; sourceTree = ""; }; - 4C53DFF70A484C250014E966 /* CXFileReader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CXFileReader.h; sourceTree = ""; }; 4C53DFF80A484C250014E966 /* CXMeshFileLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CXMeshFileLoader.cpp; sourceTree = ""; }; 4C53DFF90A484C250014E966 /* CXMeshFileLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CXMeshFileLoader.h; sourceTree = ""; }; 4C53DFFA0A484C250014E966 /* CXMLReader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CXMLReader.cpp; sourceTree = ""; }; @@ -892,20 +1255,6 @@ 4C53E00E0A484C250014E966 /* irrXML.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = irrXML.cpp; sourceTree = ""; }; 4C53E00F0A484C250014E966 /* ITriangleRenderer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ITriangleRenderer.h; sourceTree = ""; }; 4C53E0110A484C250014E966 /* IZBuffer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IZBuffer.h; sourceTree = ""; }; - 4C53E1010A484C2A0014E966 /* png.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = png.c; sourceTree = ""; }; - 4C53E1090A484C2A0014E966 /* pngerror.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pngerror.c; sourceTree = ""; }; - 4C53E10D0A484C2A0014E966 /* pngget.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pngget.c; sourceTree = ""; }; - 4C53E10E0A484C2A0014E966 /* pngmem.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pngmem.c; sourceTree = ""; }; - 4C53E1130A484C2A0014E966 /* pngpread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pngpread.c; sourceTree = ""; }; - 4C53E1140A484C2A0014E966 /* pngread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pngread.c; sourceTree = ""; }; - 4C53E1150A484C2A0014E966 /* pngrio.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pngrio.c; sourceTree = ""; }; - 4C53E1160A484C2A0014E966 /* pngrtran.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pngrtran.c; sourceTree = ""; }; - 4C53E1170A484C2A0014E966 /* pngrutil.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pngrutil.c; sourceTree = ""; }; - 4C53E1180A484C2A0014E966 /* pngset.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pngset.c; sourceTree = ""; }; - 4C53E11D0A484C2B0014E966 /* pngtrans.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pngtrans.c; sourceTree = ""; }; - 4C53E1210A484C2B0014E966 /* pngwio.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pngwio.c; sourceTree = ""; }; - 4C53E1230A484C2B0014E966 /* pngwtran.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pngwtran.c; sourceTree = ""; }; - 4C53E1240A484C2B0014E966 /* pngwutil.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = pngwutil.c; sourceTree = ""; }; 4C53E14C0A484C2C0014E966 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 4C53E14D0A484C2C0014E966 /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = AppDelegate.mm; sourceTree = ""; }; 4C53E15E0A484C2C0014E966 /* CIrrDeviceMacOSX.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CIrrDeviceMacOSX.h; sourceTree = ""; }; @@ -932,7 +1281,7 @@ 4C53E18D0A484C2C0014E966 /* uncompr.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = uncompr.c; sourceTree = ""; }; 4C53E1920A484C2C0014E966 /* zutil.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = zutil.c; sourceTree = ""; }; 4C53E24D0A4850120014E966 /* libIrrlicht.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libIrrlicht.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 4C53E2520A4850550014E966 /* Quake3Map.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = Quake3Map.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 4C53E2520A4850550014E966 /* Quake3Map.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Quake3Map.app; sourceTree = BUILT_PRODUCTS_DIR; }; 4C53E26D0A4850D60014E966 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 4C53E26E0A4850D60014E966 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = ""; }; 4C53E38E0A4855BA0014E966 /* DemoApp-Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = "DemoApp-Info.plist"; sourceTree = ""; }; @@ -1036,11 +1385,8 @@ 4CFA7C0F0A88742800B03626 /* ESceneNodeTypes.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ESceneNodeTypes.h; sourceTree = ""; }; 4CFA7C100A88742800B03626 /* heapsort.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = heapsort.h; sourceTree = ""; }; 4CFA7C110A88742900B03626 /* IAnimatedMesh.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IAnimatedMesh.h; sourceTree = ""; }; - 4CFA7C120A88742900B03626 /* IAnimatedMeshB3d.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IAnimatedMeshB3d.h; sourceTree = ""; }; 4CFA7C130A88742900B03626 /* IAnimatedMeshMD2.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IAnimatedMeshMD2.h; sourceTree = ""; }; - 4CFA7C140A88742900B03626 /* IAnimatedMeshMS3D.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IAnimatedMeshMS3D.h; sourceTree = ""; }; 4CFA7C150A88742900B03626 /* IAnimatedMeshSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IAnimatedMeshSceneNode.h; sourceTree = ""; }; - 4CFA7C160A88742900B03626 /* IAnimatedMeshX.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IAnimatedMeshX.h; sourceTree = ""; }; 4CFA7C170A88742900B03626 /* IAttributeExchangingObject.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IAttributeExchangingObject.h; sourceTree = ""; }; 4CFA7C180A88742900B03626 /* IAttributes.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IAttributes.h; sourceTree = ""; }; 4CFA7C190A88742900B03626 /* IBillboardSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IBillboardSceneNode.h; sourceTree = ""; }; @@ -1115,7 +1461,6 @@ 4CFA7C5E0A88742900B03626 /* ITexture.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ITexture.h; sourceTree = ""; }; 4CFA7C5F0A88742900B03626 /* ITimer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ITimer.h; sourceTree = ""; }; 4CFA7C600A88742900B03626 /* ITriangleSelector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ITriangleSelector.h; sourceTree = ""; }; - 4CFA7C610A88742900B03626 /* IUnknown.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IUnknown.h; sourceTree = ""; }; 4CFA7C620A88742900B03626 /* IVideoDriver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IVideoDriver.h; sourceTree = ""; }; 4CFA7C630A88742900B03626 /* IVideoModeList.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IVideoModeList.h; sourceTree = ""; }; 4CFA7C640A88742900B03626 /* IWriteFile.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IWriteFile.h; sourceTree = ""; }; @@ -1143,11 +1488,9 @@ 4CFA7C7A0A88742900B03626 /* SMeshBufferLightMap.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SMeshBufferLightMap.h; sourceTree = ""; }; 4CFA7C7B0A88742900B03626 /* SMeshBufferTangents.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SMeshBufferTangents.h; sourceTree = ""; }; 4CFA7C7C0A88742900B03626 /* SParticle.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SParticle.h; sourceTree = ""; }; - 4CFA7C7D0A88742900B03626 /* SViewFrustrum.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SViewFrustrum.h; sourceTree = ""; }; 4CFA7C7E0A88742900B03626 /* triangle3d.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = triangle3d.h; sourceTree = ""; }; 4CFA7C7F0A88742900B03626 /* vector2d.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = vector2d.h; sourceTree = ""; }; 4CFA7C800A88742900B03626 /* vector3d.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = vector3d.h; sourceTree = ""; }; - 5DD480470C7D8B9100728AA9 /* pngwrite.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pngwrite.c; sourceTree = ""; }; 5DD4804C0C7D91DF00728AA9 /* CDepthBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CDepthBuffer.cpp; sourceTree = ""; }; 5DD4804D0C7D91DF00728AA9 /* CDepthBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDepthBuffer.h; sourceTree = ""; }; 5DD480500C7D936700728AA9 /* IBurningShader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IBurningShader.cpp; sourceTree = ""; }; @@ -1179,6 +1522,66 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 09022C5A0EA0E97F00CD54EE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 09022C5B0EA0E97F00CD54EE /* libIrrlicht.a in Frameworks */, + 09022C5C0EA0E97F00CD54EE /* Cocoa.framework in Frameworks */, + 09022C5D0EA0E97F00CD54EE /* OpenGL.framework in Frameworks */, + 09022C5E0EA0E97F00CD54EE /* Carbon.framework in Frameworks */, + 0930CE590EC39F4500D63866 /* IOKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 0946CCAB0EC99BBE00D945A5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 0946CCAC0EC99BBE00D945A5 /* libIrrlicht.a in Frameworks */, + 0946CCAD0EC99BBE00D945A5 /* Cocoa.framework in Frameworks */, + 0946CCAE0EC99BBE00D945A5 /* OpenGL.framework in Frameworks */, + 0946CCAF0EC99BBE00D945A5 /* Carbon.framework in Frameworks */, + 0946CCB00EC99BBE00D945A5 /* IOKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 09F648FC0D2CDED9001E0599 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 09F648FD0D2CDED9001E0599 /* libIrrlicht.a in Frameworks */, + 09F648FE0D2CDED9001E0599 /* Cocoa.framework in Frameworks */, + 09F648FF0D2CDED9001E0599 /* OpenGL.framework in Frameworks */, + 092511400D744ADE006784D9 /* Carbon.framework in Frameworks */, + 0930CE5C0EC39F4500D63866 /* IOKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 09F649370D2CE03E001E0599 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 09F649380D2CE03E001E0599 /* libIrrlicht.a in Frameworks */, + 09F649390D2CE03E001E0599 /* Cocoa.framework in Frameworks */, + 09F6493A0D2CE03E001E0599 /* OpenGL.framework in Frameworks */, + 0925113F0D744ADE006784D9 /* Carbon.framework in Frameworks */, + 0930CE5B0EC39F4500D63866 /* IOKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 09F6495E0D2CE206001E0599 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 09F6495F0D2CE206001E0599 /* libIrrlicht.a in Frameworks */, + 09F649600D2CE206001E0599 /* Cocoa.framework in Frameworks */, + 09F649610D2CE206001E0599 /* OpenGL.framework in Frameworks */, + 0925113E0D744ADE006784D9 /* Carbon.framework in Frameworks */, + 0930CE5A0EC39F4500D63866 /* IOKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; B81CFE08097FD9F50057C06F /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -1186,6 +1589,8 @@ 4CF146F50A486648006EBA03 /* libIrrlicht.a in Frameworks */, 4C53E2750A4850D60014E966 /* Cocoa.framework in Frameworks */, 4C53E2760A4850D60014E966 /* OpenGL.framework in Frameworks */, + 092511490D744ADE006784D9 /* Carbon.framework in Frameworks */, + 0930CE650EC39F4500D63866 /* IOKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1196,6 +1601,8 @@ 4CF1470A0A4866FA006EBA03 /* libIrrlicht.a in Frameworks */, 4C53E2770A4850D60014E966 /* Cocoa.framework in Frameworks */, 4C53E2780A4850D60014E966 /* OpenGL.framework in Frameworks */, + 092511480D744ADE006784D9 /* Carbon.framework in Frameworks */, + 0930CE640EC39F4500D63866 /* IOKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1206,6 +1613,8 @@ 4CA5CBB40A486A1600ADB3D7 /* libIrrlicht.a in Frameworks */, 4C53E27F0A4850D60014E966 /* Cocoa.framework in Frameworks */, 4C53E2800A4850D60014E966 /* OpenGL.framework in Frameworks */, + 092511440D744ADE006784D9 /* Carbon.framework in Frameworks */, + 0930CE600EC39F4500D63866 /* IOKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1216,6 +1625,8 @@ 4CA5CBB70A486A2500ADB3D7 /* libIrrlicht.a in Frameworks */, 4C53E2810A4850D60014E966 /* Cocoa.framework in Frameworks */, 4C53E2820A4850D60014E966 /* OpenGL.framework in Frameworks */, + 092511430D744ADE006784D9 /* Carbon.framework in Frameworks */, + 0930CE5F0EC39F4500D63866 /* IOKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1226,6 +1637,8 @@ 4CF147190A48676E006EBA03 /* libIrrlicht.a in Frameworks */, 4C53E2790A4850D60014E966 /* Cocoa.framework in Frameworks */, 4C53E27A0A4850D60014E966 /* OpenGL.framework in Frameworks */, + 092511470D744ADE006784D9 /* Carbon.framework in Frameworks */, + 0930CE630EC39F4500D63866 /* IOKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1236,6 +1649,8 @@ 4CA25C8D0A48628200B4E469 /* libIrrlicht.a in Frameworks */, 4C53E2730A4850D60014E966 /* Cocoa.framework in Frameworks */, 4C53E2740A4850D60014E966 /* OpenGL.framework in Frameworks */, + 0925114A0D744ADE006784D9 /* Carbon.framework in Frameworks */, + 0930CE660EC39F4500D63866 /* IOKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1246,6 +1661,8 @@ 4CA25C520A48618800B4E469 /* libIrrlicht.a in Frameworks */, 4C53E26F0A4850D60014E966 /* Cocoa.framework in Frameworks */, 4C53E2700A4850D60014E966 /* OpenGL.framework in Frameworks */, + 0925114C0D744ADE006784D9 /* Carbon.framework in Frameworks */, + 0930CE580EC39F4500D63866 /* IOKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1256,6 +1673,8 @@ 4C53E2510A4850550014E966 /* libIrrlicht.a in Frameworks */, 4C53E2870A4850D60014E966 /* Cocoa.framework in Frameworks */, 4C53E2880A4850D60014E966 /* OpenGL.framework in Frameworks */, + 0925114D0D744ADE006784D9 /* Carbon.framework in Frameworks */, + 0930CE570EC39F4500D63866 /* IOKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1266,6 +1685,8 @@ 4CA5CBB10A486A0200ADB3D7 /* libIrrlicht.a in Frameworks */, 4C53E27D0A4850D60014E966 /* Cocoa.framework in Frameworks */, 4C53E27E0A4850D60014E966 /* OpenGL.framework in Frameworks */, + 092511450D744ADE006784D9 /* Carbon.framework in Frameworks */, + 0930CE610EC39F4500D63866 /* IOKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1276,6 +1697,8 @@ 4CA25C560A4861AE00B4E469 /* libIrrlicht.a in Frameworks */, 4C53E2710A4850D60014E966 /* Cocoa.framework in Frameworks */, 4C53E2720A4850D60014E966 /* OpenGL.framework in Frameworks */, + 0925114B0D744ADE006784D9 /* Carbon.framework in Frameworks */, + 0930CE560EC39F4500D63866 /* IOKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1286,6 +1709,8 @@ 4CA5CBAF0A4869F300ADB3D7 /* libIrrlicht.a in Frameworks */, 4C53E27B0A4850D60014E966 /* Cocoa.framework in Frameworks */, 4C53E27C0A4850D60014E966 /* OpenGL.framework in Frameworks */, + 092511460D744ADE006784D9 /* Carbon.framework in Frameworks */, + 0930CE620EC39F4500D63866 /* IOKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1296,6 +1721,8 @@ 4CA5CBBA0A486A3A00ADB3D7 /* libIrrlicht.a in Frameworks */, 4C53E2830A4850D60014E966 /* Cocoa.framework in Frameworks */, 4C53E2840A4850D60014E966 /* OpenGL.framework in Frameworks */, + 092511420D744ADE006784D9 /* Carbon.framework in Frameworks */, + 0930CE5E0EC39F4500D63866 /* IOKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1306,6 +1733,8 @@ 4CA5CBBF0A486A5700ADB3D7 /* libIrrlicht.a in Frameworks */, 4C53E2850A4850D60014E966 /* Cocoa.framework in Frameworks */, 4C53E2860A4850D60014E966 /* OpenGL.framework in Frameworks */, + 092511410D744ADE006784D9 /* Carbon.framework in Frameworks */, + 0930CE5D0EC39F4500D63866 /* IOKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1322,6 +1751,7 @@ 0867D691FE84028FC02AAC07 /* MacOSX */ = { isa = PBXGroup; children = ( + 09022C660EA0EA6500CD54EE /* Tools */, 4CFA7C090A88742800B03626 /* include */, 4C53DEE50A484C220014E966 /* Irrlicht */, 4C00546D0A48470500C844C2 /* examples */, @@ -1331,6 +1761,791 @@ name = MacOSX; sourceTree = ""; }; + 09022C660EA0EA6500CD54EE /* Tools */ = { + isa = PBXGroup; + children = ( + 09022C670EA0EA7100CD54EE /* GUIEditor */, + ); + name = Tools; + sourceTree = ""; + }; + 09022C670EA0EA7100CD54EE /* GUIEditor */ = { + isa = PBXGroup; + children = ( + 09022CA40EA0EC1900CD54EE /* source */, + 09022CA30EA0EC0E00CD54EE /* include */, + ); + name = GUIEditor; + sourceTree = ""; + }; + 09022CA30EA0EC0E00CD54EE /* include */ = { + isa = PBXGroup; + children = ( + 09022C680EA0EA9D00CD54EE /* CGUIAttribute.h */, + 09022C6A0EA0EA9D00CD54EE /* CGUIAttributeEditor.h */, + 09022C6B0EA0EA9D00CD54EE /* CGUIBoolAttribute.h */, + 09022C6C0EA0EA9D00CD54EE /* CGUIColorAttribute.h */, + 09022C6D0EA0EA9D00CD54EE /* CGUIDummyEditorStub.h */, + 09022C6F0EA0EA9D00CD54EE /* CGUIEditFactory.h */, + 09022C710EA0EA9D00CD54EE /* CGUIEditWindow.h */, + 09022C730EA0EA9D00CD54EE /* CGUIEditWorkspace.h */, + 09022C740EA0EA9D00CD54EE /* CGUIEnumAttribute.h */, + 09022C760EA0EA9D00CD54EE /* CGUIPanel.h */, + 09022C770EA0EA9D00CD54EE /* CGUIStringAttribute.h */, + 09022C780EA0EA9D00CD54EE /* CGUITextureAttribute.h */, + 09022C7A0EA0EA9D00CD54EE /* CGUITextureCacheBrowser.h */, + 09022C7C0EA0EA9D00CD54EE /* CMemoryReadWriteFile.h */, + ); + name = include; + sourceTree = ""; + }; + 09022CA40EA0EC1900CD54EE /* source */ = { + isa = PBXGroup; + children = ( + 09022C690EA0EA9D00CD54EE /* CGUIAttributeEditor.cpp */, + 09022C6E0EA0EA9D00CD54EE /* CGUIEditFactory.cpp */, + 09022C700EA0EA9D00CD54EE /* CGUIEditWindow.cpp */, + 09022C720EA0EA9D00CD54EE /* CGUIEditWorkspace.cpp */, + 09022C750EA0EA9D00CD54EE /* CGUIPanel.cpp */, + 09022C790EA0EA9D00CD54EE /* CGUITextureCacheBrowser.cpp */, + 09022C7B0EA0EA9D00CD54EE /* CMemoryReadWriteFile.cpp */, + 09022C7D0EA0EA9D00CD54EE /* main.cpp */, + ); + name = source; + sourceTree = ""; + }; + 0910BA4D0D1F64D000D46B04 /* gui */ = { + isa = PBXGroup; + children = ( + 4CFA7C0D0A88742800B03626 /* EGUIElementTypes.h */, + 4CFA7C1B0A88742900B03626 /* ICursorControl.h */, + 4CFA7C210A88742900B03626 /* IGUIButton.h */, + 4CFA7C220A88742900B03626 /* IGUICheckBox.h */, + 0910BA0B0D1F64B300D46B04 /* IGUIColorSelectDialog.h */, + 4CFA7C230A88742900B03626 /* IGUIComboBox.h */, + 4CFA7C240A88742900B03626 /* IGUIContextMenu.h */, + 4CFA7C250A88742900B03626 /* IGUIEditBox.h */, + 4CFA7C260A88742900B03626 /* IGUIElement.h */, + 0910BA0C0D1F64B300D46B04 /* IGUIElementFactory.h */, + 4CFA7C270A88742900B03626 /* IGUIEnvironment.h */, + 4CFA7C280A88742900B03626 /* IGUIFileOpenDialog.h */, + 4CFA7C290A88742900B03626 /* IGUIFont.h */, + 0910BA0D0D1F64B300D46B04 /* IGUIFontBitmap.h */, + 4CFA7C2A0A88742900B03626 /* IGUIImage.h */, + 4CFA7C2B0A88742900B03626 /* IGUIInOutFader.h */, + 4CFA7C2C0A88742900B03626 /* IGUIListBox.h */, + 4CFA7C2D0A88742900B03626 /* IGUIMeshViewer.h */, + 4CFA7C2E0A88742900B03626 /* IGUIScrollBar.h */, + 4CFA7C2F0A88742900B03626 /* IGUISkin.h */, + 0910BA0E0D1F64B300D46B04 /* IGUISpinBox.h */, + 0910BA0F0D1F64B300D46B04 /* IGUISpriteBank.h */, + 4CFA7C300A88742900B03626 /* IGUIStaticText.h */, + 4CFA7C310A88742900B03626 /* IGUITabControl.h */, + 0910BA100D1F64B300D46B04 /* IGUITable.h */, + 4CFA7C320A88742900B03626 /* IGUIToolbar.h */, + 4CFA7C330A88742900B03626 /* IGUIWindow.h */, + ); + name = gui; + sourceTree = ""; + }; + 0910BA4E0D1F652100D46B04 /* core */ = { + isa = PBXGroup; + children = ( + 0910B9FE0D1F64B300D46B04 /* coreutil.h */, + 4CFA7C5F0A88742900B03626 /* ITimer.h */, + 4CFA7C670A88742900B03626 /* Keycodes.h */, + 4CFA7C750A88742900B03626 /* SKeyMap.h */, + 4CFA7C0A0A88742800B03626 /* aabbox3d.h */, + 4CFA7C0B0A88742800B03626 /* dimension2d.h */, + 4CFA7C100A88742800B03626 /* heapsort.h */, + 4CFA7C480A88742900B03626 /* irrAllocator.h */, + 4CFA7C490A88742900B03626 /* irrArray.h */, + 4CFA7C4D0A88742900B03626 /* irrList.h */, + 0910BA1E0D1F64B300D46B04 /* irrMap.h */, + 4CFA7C4E0A88742900B03626 /* irrMath.h */, + 4CFA7C4F0A88742900B03626 /* irrString.h */, + 4CFA7C680A88742900B03626 /* line2d.h */, + 4CFA7C690A88742900B03626 /* line3d.h */, + 4CFA7C6A0A88742900B03626 /* matrix4.h */, + 4CFA7C6B0A88742900B03626 /* plane3d.h */, + 4CFA7C6C0A88742900B03626 /* position2d.h */, + 4CFA7C6D0A88742900B03626 /* quaternion.h */, + 4CFA7C6E0A88742900B03626 /* rect.h */, + 4CFA7C7E0A88742900B03626 /* triangle3d.h */, + 4CFA7C7F0A88742900B03626 /* vector2d.h */, + 4CFA7C800A88742900B03626 /* vector3d.h */, + ); + name = core; + sourceTree = ""; + }; + 0910BA4F0D1F65A300D46B04 /* io */ = { + isa = PBXGroup; + children = ( + 4CFA7C170A88742900B03626 /* IAttributeExchangingObject.h */, + 4CFA7C180A88742900B03626 /* IAttributes.h */, + 4CFA7C1E0A88742900B03626 /* IFileList.h */, + 4CFA7C1F0A88742900B03626 /* IFileSystem.h */, + 4CFA7C470A88742900B03626 /* IReadFile.h */, + 4CFA7C510A88742900B03626 /* irrXML.h */, + 4CFA7C640A88742900B03626 /* IWriteFile.h */, + 4CFA7C650A88742900B03626 /* IXMLReader.h */, + 4CFA7C660A88742900B03626 /* IXMLWriter.h */, + ); + name = io; + sourceTree = ""; + }; + 0910BA500D1F660300D46B04 /* scene */ = { + isa = PBXGroup; + children = ( + 4CFA7C590A88742900B03626 /* ISceneUserDataSerializer.h */, + 0910B9FF0D1F64B300D46B04 /* ECullingTypes.h */, + 0910BA000D1F64B300D46B04 /* EDebugSceneTypes.h */, + 0910BA060D1F64B300D46B04 /* EMeshWriterEnums.h */, + 4CFA7C0E0A88742800B03626 /* ESceneNodeAnimatorTypes.h */, + 4CFA7C0F0A88742800B03626 /* ESceneNodeTypes.h */, + 4CFA7C110A88742900B03626 /* IAnimatedMesh.h */, + 4CFA7C130A88742900B03626 /* IAnimatedMeshMD2.h */, + 0910BA090D1F64B300D46B04 /* IAnimatedMeshMD3.h */, + 4CFA7C150A88742900B03626 /* IAnimatedMeshSceneNode.h */, + 4CFA7C190A88742900B03626 /* IBillboardSceneNode.h */, + 4CFA7C1A0A88742900B03626 /* ICameraSceneNode.h */, + 4CFA7C1C0A88742900B03626 /* IDummyTransformationSceneNode.h */, + 4CFA7C370A88742900B03626 /* ILightSceneNode.h */, + 4CFA7C3B0A88742900B03626 /* IMesh.h */, + 4CFA7C3C0A88742900B03626 /* IMeshBuffer.h */, + 4CFA7C3D0A88742900B03626 /* IMeshCache.h */, + 4CFA7C3E0A88742900B03626 /* IMeshLoader.h */, + 4CFA7C3F0A88742900B03626 /* IMeshManipulator.h */, + 4CFA7C400A88742900B03626 /* IMeshSceneNode.h */, + 4CFA7C410A88742900B03626 /* IMetaTriangleSelector.h */, + 4CFA7C430A88742900B03626 /* IParticleAffector.h */, + 0910BA120D1F64B300D46B04 /* IParticleAnimatedMeshSceneNodeEmitter.h */, + 0910BA130D1F64B300D46B04 /* IParticleAttractionAffector.h */, + 0910BA140D1F64B300D46B04 /* IParticleBoxEmitter.h */, + 0910BA150D1F64B300D46B04 /* IParticleCylinderEmitter.h */, + 4CFA7C440A88742900B03626 /* IParticleEmitter.h */, + 0910BA160D1F64B300D46B04 /* IParticleFadeOutAffector.h */, + 0910BA170D1F64B300D46B04 /* IParticleGravityAffector.h */, + 0910BA180D1F64B300D46B04 /* IParticleMeshEmitter.h */, + 0910BA190D1F64B300D46B04 /* IParticleRingEmitter.h */, + 0910BA1A0D1F64B300D46B04 /* IParticleRotationAffector.h */, + 0910BA1B0D1F64B300D46B04 /* IParticleSphereEmitter.h */, + 4CFA7C450A88742900B03626 /* IParticleSystemSceneNode.h */, + 4CFA7C460A88742900B03626 /* IQ3LevelMesh.h */, + 0910BA1C0D1F64B300D46B04 /* IQ3Shader.h */, + 4CFA7C520A88742900B03626 /* ISceneCollisionManager.h */, + 4CFA7C530A88742900B03626 /* ISceneManager.h */, + 4CFA7C540A88742900B03626 /* ISceneNode.h */, + 4CFA7C550A88742900B03626 /* ISceneNodeAnimator.h */, + 4CFA7C560A88742900B03626 /* ISceneNodeAnimatorCollisionResponse.h */, + 4CFA7C570A88742900B03626 /* ISceneNodeAnimatorFactory.h */, + 4CFA7C580A88742900B03626 /* ISceneNodeFactory.h */, + 4CFA7C5B0A88742900B03626 /* IShadowVolumeSceneNode.h */, + 0910BA1F0D1F64B300D46B04 /* ISkinnedMesh.h */, + 4CFA7C5C0A88742900B03626 /* ITerrainSceneNode.h */, + 4CFA7C5D0A88742900B03626 /* ITextSceneNode.h */, + 4CFA7C600A88742900B03626 /* ITriangleSelector.h */, + 4CFA7C700A88742900B03626 /* SAnimatedMesh.h */, + 4CFA7C710A88742900B03626 /* SceneParameters.h */, + 4CFA7C780A88742900B03626 /* SMesh.h */, + 4CFA7C790A88742900B03626 /* SMeshBuffer.h */, + 4CFA7C7A0A88742900B03626 /* SMeshBufferLightMap.h */, + 4CFA7C7B0A88742900B03626 /* SMeshBufferTangents.h */, + 4CFA7C7C0A88742900B03626 /* SParticle.h */, + 0910BA230D1F64B300D46B04 /* SViewFrustum.h */, + ); + name = scene; + sourceTree = ""; + }; + 0910BA800D1F6ADA00D46B04 /* video */ = { + isa = PBXGroup; + children = ( + 0910BA010D1F64B300D46B04 /* EDriverFeatures.h */, + 4CFA7C200A88742900B03626 /* IGPUProgrammingServices.h */, + 4CFA7C340A88742900B03626 /* IImage.h */, + 4CFA7C350A88742900B03626 /* IImageLoader.h */, + 4CFA7C390A88742900B03626 /* IMaterialRenderer.h */, + 4CFA7C3A0A88742900B03626 /* IMaterialRendererServices.h */, + 4CFA7C5A0A88742900B03626 /* IShaderConstantSetCallBack.h */, + 4CFA7C5E0A88742900B03626 /* ITexture.h */, + 4CFA7C620A88742900B03626 /* IVideoDriver.h */, + 4CFA7C630A88742900B03626 /* IVideoModeList.h */, + 4CFA7C6F0A88742900B03626 /* S3DVertex.h */, + 4CFA7C720A88742900B03626 /* SColor.h */, + 4CFA7C730A88742900B03626 /* SExposedVideoData.h */, + 4CFA7C760A88742900B03626 /* SLight.h */, + 4CFA7C770A88742900B03626 /* SMaterial.h */, + ); + name = video; + sourceTree = ""; + }; + 0910BA810D1F6BB800D46B04 /* gui */ = { + isa = PBXGroup; + children = ( + 4C53DEE60A484C220014E966 /* BuiltInFont.h */, + 5DD480580C7D945800728AA9 /* CDefaultGUIElementFactory.cpp */, + 5DD480590C7D945800728AA9 /* CDefaultGUIElementFactory.h */, + 4C53DF2E0A484C230014E966 /* CGUIButton.cpp */, + 4C53DF2F0A484C230014E966 /* CGUIButton.h */, + 4C53DF300A484C230014E966 /* CGUICheckBox.cpp */, + 4C53DF310A484C230014E966 /* CGUICheckBox.h */, + 5DD4805E0C7D947B00728AA9 /* CGUIColorSelectDialog.cpp */, + 5DD4805F0C7D947B00728AA9 /* CGUIColorSelectDialog.h */, + 4C53DF320A484C230014E966 /* CGUIComboBox.cpp */, + 4C53DF330A484C230014E966 /* CGUIComboBox.h */, + 4C53DF340A484C230014E966 /* CGUIContextMenu.cpp */, + 4C53DF350A484C230014E966 /* CGUIContextMenu.h */, + 4C53DF360A484C230014E966 /* CGUIEditBox.cpp */, + 4C53DF370A484C230014E966 /* CGUIEditBox.h */, + 4C53DF380A484C230014E966 /* CGUIEnvironment.cpp */, + 4C53DF390A484C230014E966 /* CGUIEnvironment.h */, + 4C53DF3A0A484C230014E966 /* CGUIFileOpenDialog.cpp */, + 4C53DF3B0A484C230014E966 /* CGUIFileOpenDialog.h */, + 4C53DF3C0A484C230014E966 /* CGUIFont.cpp */, + 4C53DF3D0A484C230014E966 /* CGUIFont.h */, + 4C53DF3E0A484C230014E966 /* CGUIImage.cpp */, + 4C53DF3F0A484C230014E966 /* CGUIImage.h */, + 4C53DF400A484C230014E966 /* CGUIInOutFader.cpp */, + 4C53DF410A484C230014E966 /* CGUIInOutFader.h */, + 4C53DF420A484C230014E966 /* CGUIListBox.cpp */, + 4C53DF430A484C230014E966 /* CGUIListBox.h */, + 4C53DF440A484C230014E966 /* CGUIMenu.cpp */, + 4C53DF450A484C230014E966 /* CGUIMenu.h */, + 4C53DF460A484C230014E966 /* CGUIMeshViewer.cpp */, + 4C53DF470A484C230014E966 /* CGUIMeshViewer.h */, + 4C53DF480A484C230014E966 /* CGUIMessageBox.cpp */, + 4C53DF490A484C230014E966 /* CGUIMessageBox.h */, + 4C53DF4A0A484C230014E966 /* CGUIModalScreen.cpp */, + 4C53DF4B0A484C230014E966 /* CGUIModalScreen.h */, + 4C53DF4C0A484C230014E966 /* CGUIScrollBar.cpp */, + 4C53DF4D0A484C230014E966 /* CGUIScrollBar.h */, + 4C53DF4E0A484C230014E966 /* CGUISkin.cpp */, + 4C53DF4F0A484C230014E966 /* CGUISkin.h */, + 5DD480600C7D947B00728AA9 /* CGUISpinBox.cpp */, + 5DD480610C7D947B00728AA9 /* CGUISpinBox.h */, + 5DD480620C7D947B00728AA9 /* CGUISpriteBank.cpp */, + 5DD480630C7D947B00728AA9 /* CGUISpriteBank.h */, + 4C53DF500A484C230014E966 /* CGUIStaticText.cpp */, + 4C53DF510A484C230014E966 /* CGUIStaticText.h */, + 4C53DF520A484C230014E966 /* CGUITabControl.cpp */, + 4C53DF530A484C230014E966 /* CGUITabControl.h */, + 0910B9DA0D1F5D4100D46B04 /* CGUITable.cpp */, + 0910B9DB0D1F5D4100D46B04 /* CGUITable.h */, + 4C53DF540A484C230014E966 /* CGUIToolBar.cpp */, + 4C53DF550A484C230014E966 /* CGUIToolBar.h */, + 4C53DF560A484C230014E966 /* CGUIWindow.cpp */, + 4C53DF570A484C230014E966 /* CGUIWindow.h */, + ); + name = gui; + sourceTree = ""; + }; + 0910BA820D1F6C3900D46B04 /* io */ = { + isa = PBXGroup; + children = ( + 4C53E0030A484C250014E966 /* CZipReader.cpp */, + 4C53E0040A484C250014E966 /* CZipReader.h */, + 4C53DEEF0A484C220014E966 /* CAttributeImpl.h */, + 4C53DEF00A484C220014E966 /* CAttributes.cpp */, + 4C53DEF10A484C220014E966 /* CAttributes.h */, + 4C53DF260A484C230014E966 /* CFileList.cpp */, + 4C53DF270A484C230014E966 /* CFileList.h */, + 4C53DF280A484C230014E966 /* CFileSystem.cpp */, + 4C53DF290A484C230014E966 /* CFileSystem.h */, + 4C53DF6E0A484C230014E966 /* CLimitReadFile.cpp */, + 4C53DF6F0A484C230014E966 /* CLimitReadFile.h */, + 4C53DF740A484C230014E966 /* CMemoryReadFile.cpp */, + 4C53DF750A484C230014E966 /* CMemoryReadFile.h */, + 4C43EEBE0A74A5C800F942FC /* CPakReader.cpp */, + 4C43EEBF0A74A5C800F942FC /* CPakReader.h */, + 4C53DFA70A484C240014E966 /* CReadFile.cpp */, + 4C53DFA80A484C240014E966 /* CReadFile.h */, + 4C53DFF20A484C250014E966 /* CWriteFile.cpp */, + 4C53DFF30A484C250014E966 /* CWriteFile.h */, + 4C53DFFA0A484C250014E966 /* CXMLReader.cpp */, + 4C53DFFB0A484C250014E966 /* CXMLReader.h */, + 4C53DFFC0A484C250014E966 /* CXMLReaderImpl.h */, + 4C53DFFD0A484C250014E966 /* CXMLWriter.cpp */, + 4C53DFFE0A484C250014E966 /* CXMLWriter.h */, + 4C53E00E0A484C250014E966 /* irrXML.cpp */, + ); + name = io; + sourceTree = ""; + }; + 0910BA830D1F6CA600D46B04 /* irr */ = { + isa = PBXGroup; + children = ( + 4C53DF660A484C230014E966 /* CIrrDeviceLinux.cpp */, + 4C53DF670A484C230014E966 /* CIrrDeviceLinux.h */, + 5DD480C40C7DA66800728AA9 /* CIrrDeviceSDL.cpp */, + 5DD480C30C7DA66800728AA9 /* CIrrDeviceSDL.h */, + 4C53DF680A484C230014E966 /* CIrrDeviceStub.cpp */, + 4C53DF690A484C230014E966 /* CIrrDeviceStub.h */, + 4C53DF6A0A484C230014E966 /* CIrrDeviceWin32.cpp */, + 4C53DF6B0A484C230014E966 /* CIrrDeviceWin32.h */, + 4C53DF720A484C230014E966 /* CLogger.cpp */, + 4C53DF730A484C230014E966 /* CLogger.h */, + 4C53DF990A484C240014E966 /* COSOperator.cpp */, + 4C53DF9A0A484C240014E966 /* COSOperator.h */, + 4C53DFD00A484C240014E966 /* CTimer.h */, + 4C53E00A0A484C250014E966 /* Irrlicht.cpp */, + 4C53E16A0A484C2C0014E966 /* os.cpp */, + 4C53E16B0A484C2C0014E966 /* os.h */, + ); + name = irr; + sourceTree = ""; + }; + 0910BA840D1F6D0200D46B04 /* scene */ = { + isa = PBXGroup; + children = ( + 0910BA850D1F6D0A00D46B04 /* animators */, + 0910BA860D1F6D2600D46B04 /* collision */, + 0910BA870D1F6D7500D46B04 /* loaders */, + 0910BA880D1F6F1600D46B04 /* particleSystem */, + 0910BA890D1F6F6600D46B04 /* sceneNodes */, + 0910BA8A0D1F70B800D46B04 /* writers */, + 4C53DF1D0A484C230014E966 /* CDefaultSceneNodeAnimatorFactory.h */, + 4C53DF1E0A484C230014E966 /* CDefaultSceneNodeFactory.cpp */, + 4C53DF1F0A484C230014E966 /* CDefaultSceneNodeFactory.h */, + 4C53DF2C0A484C230014E966 /* CGeometryCreator.cpp */, + 4C53DF2D0A484C230014E966 /* CGeometryCreator.h */, + 4C53DF760A484C230014E966 /* CMeshCache.cpp */, + 4C53DF770A484C230014E966 /* CMeshCache.h */, + 4C53DF780A484C230014E966 /* CMeshManipulator.cpp */, + 4C53DF790A484C230014E966 /* CMeshManipulator.h */, + 4C53DFAB0A484C240014E966 /* CSceneManager.cpp */, + 4C53DFAC0A484C240014E966 /* CSceneManager.h */, + 4C53E1690A484C2C0014E966 /* OctTree.h */, + ); + name = scene; + sourceTree = ""; + }; + 0910BA850D1F6D0A00D46B04 /* animators */ = { + isa = PBXGroup; + children = ( + 4C53DFAD0A484C240014E966 /* CSceneNodeAnimatorCollisionResponse.cpp */, + 4C53DFAE0A484C240014E966 /* CSceneNodeAnimatorCollisionResponse.h */, + 4C53DFAF0A484C240014E966 /* CSceneNodeAnimatorDelete.cpp */, + 4C53DFB00A484C240014E966 /* CSceneNodeAnimatorDelete.h */, + 4C53DFB10A484C240014E966 /* CSceneNodeAnimatorFlyCircle.cpp */, + 4C53DFB20A484C240014E966 /* CSceneNodeAnimatorFlyCircle.h */, + 4C53DFB30A484C240014E966 /* CSceneNodeAnimatorFlyStraight.cpp */, + 4C53DFB40A484C240014E966 /* CSceneNodeAnimatorFlyStraight.h */, + 4C53DFB50A484C240014E966 /* CSceneNodeAnimatorFollowSpline.cpp */, + 4C53DFB60A484C240014E966 /* CSceneNodeAnimatorFollowSpline.h */, + 4C53DFB70A484C240014E966 /* CSceneNodeAnimatorRotation.cpp */, + 4C53DFB80A484C240014E966 /* CSceneNodeAnimatorRotation.h */, + 4C53DFB90A484C240014E966 /* CSceneNodeAnimatorTexture.cpp */, + 4C53DFBA0A484C240014E966 /* CSceneNodeAnimatorTexture.h */, + ); + name = animators; + sourceTree = ""; + }; + 0910BA860D1F6D2600D46B04 /* collision */ = { + isa = PBXGroup; + children = ( + 4C53DF7C0A484C230014E966 /* CMetaTriangleSelector.cpp */, + 4C53DF7D0A484C230014E966 /* CMetaTriangleSelector.h */, + 4C53DFA90A484C240014E966 /* CSceneCollisionManager.cpp */, + 4C53DFAA0A484C240014E966 /* CSceneCollisionManager.h */, + 4C53DFCC0A484C240014E966 /* CTerrainTriangleSelector.cpp */, + 4C53DFD80A484C240014E966 /* CTriangleBBSelector.cpp */, + 4C53DFD90A484C250014E966 /* CTriangleBBSelector.h */, + 4C53DFDA0A484C250014E966 /* CTriangleSelector.cpp */, + 4C53DFDB0A484C250014E966 /* CTriangleSelector.h */, + ); + name = collision; + sourceTree = ""; + }; + 0910BA870D1F6D7500D46B04 /* loaders */ = { + isa = PBXGroup; + children = ( + 09C638700D4F1A69000B6A18 /* CLWOMeshFileLoader.cpp */, + 09C638710D4F1A69000B6A18 /* CLWOMeshFileLoader.h */, + 4C53DEE70A484C220014E966 /* C3DSMeshFileLoader.cpp */, + 4C53DEE80A484C220014E966 /* C3DSMeshFileLoader.h */, + 4C53DEE90A484C220014E966 /* CAnimatedMeshMD2.cpp */, + 4C53DEEA0A484C220014E966 /* CAnimatedMeshMD2.h */, + 5DD480560C7D945800728AA9 /* CAnimatedMeshMD3.cpp */, + 5DD480570C7D945800728AA9 /* CAnimatedMeshMD3.h */, + 0968401E0D0F1A2300333EFD /* CB3DMeshFileLoader.cpp */, + 0968401F0D0F1A2300333EFD /* CB3DMeshFileLoader.h */, + 4C53DEFA0A484C220014E966 /* CColladaFileLoader.cpp */, + 4C53DEFB0A484C220014E966 /* CColladaFileLoader.h */, + 4C53DEFE0A484C220014E966 /* CCSMLoader.cpp */, + 4C53DEFF0A484C220014E966 /* CCSMLoader.h */, + 4C53DF200A484C230014E966 /* CDMFLoader.cpp */, + 4C53DF210A484C230014E966 /* CDMFLoader.h */, + 0968402B0D0F1A2300333EFD /* CIrrMeshFileLoader.cpp */, + 0968402C0D0F1A2300333EFD /* CIrrMeshFileLoader.h */, + 4C53DF700A484C230014E966 /* CLMTSMeshFileLoader.cpp */, + 4C53DF710A484C230014E966 /* CLMTSMeshFileLoader.h */, + 0968402F0D0F1A2300333EFD /* CMD2MeshFileLoader.cpp */, + 096840300D0F1A2300333EFD /* CMD2MeshFileLoader.h */, + 5DD480C60C7DA66800728AA9 /* CMD3MeshFileLoader.cpp */, + 5DD480C20C7DA66800728AA9 /* CMD3MeshFileLoader.h */, + 096840310D0F1A2300333EFD /* CMS3DMeshFileLoader.cpp */, + 096840320D0F1A2300333EFD /* CMS3DMeshFileLoader.h */, + 4C53DF7E0A484C230014E966 /* CMY3DHelper.h */, + 4C53DF7F0A484C230014E966 /* CMY3DMeshFileLoader.cpp */, + 4C53DF800A484C230014E966 /* CMY3DMeshFileLoader.h */, + 4C364EA20A6C6DC2004CFBB4 /* COBJMeshFileLoader.cpp */, + 4C364EA30A6C6DC2004CFBB4 /* COBJMeshFileLoader.h */, + 4C53DF840A484C240014E966 /* COCTLoader.cpp */, + 4C53DF850A484C240014E966 /* COCTLoader.h */, + 4C53DF8A0A484C240014E966 /* COgreMeshFileLoader.cpp */, + 4C53DF8B0A484C240014E966 /* COgreMeshFileLoader.h */, + 4C53DFA50A484C240014E966 /* CQ3LevelMesh.cpp */, + 4C53DFA60A484C240014E966 /* CQ3LevelMesh.h */, + 096840410D0F1A2300333EFD /* CSkinnedMesh.cpp */, + 096840420D0F1A2300333EFD /* CSkinnedMesh.h */, + 096840430D0F1A2300333EFD /* CSTLMeshFileLoader.cpp */, + 096840440D0F1A2300333EFD /* CSTLMeshFileLoader.h */, + 4C53DFF80A484C250014E966 /* CXMeshFileLoader.cpp */, + 4C53DFF90A484C250014E966 /* CXMeshFileLoader.h */, + 4C53E0050A484C250014E966 /* dmfsupport.h */, + ); + name = loaders; + sourceTree = ""; + }; + 0910BA880D1F6F1600D46B04 /* particleSystem */ = { + isa = PBXGroup; + children = ( + 096CC0DE0ECE65B500C81DC7 /* CParticleScaleAffector.cpp */, + 096CC0DF0ECE65B500C81DC7 /* CParticleScaleAffector.h */, + 096840330D0F1A2300333EFD /* CParticleAnimatedMeshSceneNodeEmitter.cpp */, + 096840340D0F1A2300333EFD /* CParticleAnimatedMeshSceneNodeEmitter.h */, + 096840350D0F1A2300333EFD /* CParticleAttractionAffector.cpp */, + 096840360D0F1A2300333EFD /* CParticleAttractionAffector.h */, + 4C53DF9B0A484C240014E966 /* CParticleBoxEmitter.cpp */, + 4C53DF9C0A484C240014E966 /* CParticleBoxEmitter.h */, + 096840370D0F1A2300333EFD /* CParticleCylinderEmitter.cpp */, + 096840380D0F1A2300333EFD /* CParticleCylinderEmitter.h */, + 4C53DF9D0A484C240014E966 /* CParticleFadeOutAffector.cpp */, + 4C53DF9E0A484C240014E966 /* CParticleFadeOutAffector.h */, + 4C53DF9F0A484C240014E966 /* CParticleGravityAffector.cpp */, + 4C53DFA00A484C240014E966 /* CParticleGravityAffector.h */, + 096840390D0F1A2300333EFD /* CParticleMeshEmitter.cpp */, + 0968403A0D0F1A2300333EFD /* CParticleMeshEmitter.h */, + 4C53DFA10A484C240014E966 /* CParticlePointEmitter.cpp */, + 4C53DFA20A484C240014E966 /* CParticlePointEmitter.h */, + 0968403B0D0F1A2300333EFD /* CParticleRingEmitter.cpp */, + 0968403C0D0F1A2300333EFD /* CParticleRingEmitter.h */, + 0968403D0D0F1A2300333EFD /* CParticleRotationAffector.cpp */, + 0968403E0D0F1A2300333EFD /* CParticleRotationAffector.h */, + 0968403F0D0F1A2300333EFD /* CParticleSphereEmitter.cpp */, + 096840400D0F1A2300333EFD /* CParticleSphereEmitter.h */, + 4C53DFA30A484C240014E966 /* CParticleSystemSceneNode.cpp */, + 4C53DFA40A484C240014E966 /* CParticleSystemSceneNode.h */, + ); + name = particleSystem; + sourceTree = ""; + }; + 0910BA890D1F6F6600D46B04 /* sceneNodes */ = { + isa = PBXGroup; + children = ( + 093973BC0E0458B200E0C987 /* CSceneNodeAnimatorCameraFPS.cpp */, + 093973BD0E0458B200E0C987 /* CSceneNodeAnimatorCameraFPS.h */, + 093973BE0E0458B200E0C987 /* CSceneNodeAnimatorCameraMaya.cpp */, + 093973BF0E0458B200E0C987 /* CSceneNodeAnimatorCameraMaya.h */, + 4C53DEED0A484C220014E966 /* CAnimatedMeshSceneNode.cpp */, + 4C53DEEE0A484C220014E966 /* CAnimatedMeshSceneNode.h */, + 4C53DEF20A484C220014E966 /* CBillboardSceneNode.cpp */, + 4C53DEF30A484C220014E966 /* CBillboardSceneNode.h */, + 096840200D0F1A2300333EFD /* CBoneSceneNode.cpp */, + 096840210D0F1A2300333EFD /* CBoneSceneNode.h */, + 4C53DEF80A484C220014E966 /* CCameraSceneNode.cpp */, + 4C53DEF90A484C220014E966 /* CCameraSceneNode.h */, + 4C53DF000A484C220014E966 /* CCubeSceneNode.cpp */, + 4C53DF010A484C220014E966 /* CCubeSceneNode.h */, + 4C53DF220A484C230014E966 /* CDummyTransformationSceneNode.cpp */, + 4C53DF230A484C230014E966 /* CDummyTransformationSceneNode.h */, + 4C53DF240A484C230014E966 /* CEmptySceneNode.cpp */, + 4C53DF250A484C230014E966 /* CEmptySceneNode.h */, + 4C53DF6C0A484C230014E966 /* CLightSceneNode.cpp */, + 4C53DF6D0A484C230014E966 /* CLightSceneNode.h */, + 4C53DF7A0A484C230014E966 /* CMeshSceneNode.cpp */, + 4C53DF7B0A484C230014E966 /* CMeshSceneNode.h */, + 4C53DF860A484C240014E966 /* COctTreeSceneNode.cpp */, + 4C53DF870A484C240014E966 /* COctTreeSceneNode.h */, + 5DD4806A0C7D94AC00728AA9 /* CQuake3ShaderSceneNode.cpp */, + 5DD4806B0C7D94AC00728AA9 /* CQuake3ShaderSceneNode.h */, + 4C53DFBB0A484C240014E966 /* CShadowVolumeSceneNode.cpp */, + 4C53DFBC0A484C240014E966 /* CShadowVolumeSceneNode.h */, + 4C53DFBD0A484C240014E966 /* CSkyBoxSceneNode.cpp */, + 4C53DFBE0A484C240014E966 /* CSkyBoxSceneNode.h */, + 4CFA7BEC0A88735A00B03626 /* CSkyDomeSceneNode.cpp */, + 4CFA7BED0A88735A00B03626 /* CSkyDomeSceneNode.h */, + 4CC36B0D0A6B61DB0076C4B2 /* CSphereSceneNode.cpp */, + 4CC36B0E0A6B61DB0076C4B2 /* CSphereSceneNode.h */, + 4C53DFCA0A484C240014E966 /* CTerrainSceneNode.cpp */, + 4C53DFCB0A484C240014E966 /* CTerrainSceneNode.h */, + 4C53DFCE0A484C240014E966 /* CTextSceneNode.cpp */, + 4C53DFCF0A484C240014E966 /* CTextSceneNode.h */, + 090FBC800D31085E0076D847 /* CVolumeLightSceneNode.cpp */, + 090FBC810D31085E0076D847 /* CVolumeLightSceneNode.h */, + 4C53DFF00A484C250014E966 /* CWaterSurfaceSceneNode.cpp */, + 4C53DFF10A484C250014E966 /* CWaterSurfaceSceneNode.h */, + ); + name = sceneNodes; + sourceTree = ""; + }; + 0910BA8A0D1F70B800D46B04 /* writers */ = { + isa = PBXGroup; + children = ( + 096F8E3B0EA2EFBA00907EC5 /* COBJMeshWriter.cpp */, + 096F8E3C0EA2EFBA00907EC5 /* COBJMeshWriter.h */, + 096840250D0F1A2300333EFD /* CColladaMeshWriter.cpp */, + 096840260D0F1A2300333EFD /* CColladaMeshWriter.h */, + 0968402D0D0F1A2300333EFD /* CIrrMeshWriter.cpp */, + 0968402E0D0F1A2300333EFD /* CIrrMeshWriter.h */, + 096840450D0F1A2300333EFD /* CSTLMeshWriter.cpp */, + 096840460D0F1A2300333EFD /* CSTLMeshWriter.h */, + ); + name = writers; + sourceTree = ""; + }; + 0910BA8B0D1F71D600D46B04 /* video */ = { + isa = PBXGroup; + children = ( + 0910BA8C0D1F729400D46B04 /* Burning Video */, + 0910BA8D0D1F72DB00D46B04 /* Direct3D8 */, + 0910BA8E0D1F72FB00D46B04 /* Direct3D9 */, + 0910BA8F0D1F731900D46B04 /* Null */, + 0910BA910D1F738100D46B04 /* OpenGL */, + 0910BA920D1F73CC00D46B04 /* Software */, + 4C53DFEE0A484C250014E966 /* CVideoModeList.cpp */, + 4C53DFEF0A484C250014E966 /* CVideoModeList.h */, + ); + name = video; + sourceTree = ""; + }; + 0910BA8C0D1F729400D46B04 /* Burning Video */ = { + isa = PBXGroup; + children = ( + 4C53E16D0A484C2C0014E966 /* S4DVertex.h */, + 4C53E16E0A484C2C0014E966 /* SoftwareDriver2_compile_config.h */, + 4C53E16F0A484C2C0014E966 /* SoftwareDriver2_helper.h */, + 5DD4804C0C7D91DF00728AA9 /* CDepthBuffer.cpp */, + 0910B9D90D1F5D4100D46B04 /* CBurningShader_Raster_Reference.cpp */, + 5DD480500C7D936700728AA9 /* IBurningShader.cpp */, + 5DD480510C7D936700728AA9 /* IBurningShader.h */, + 5DD4804D0C7D91DF00728AA9 /* CDepthBuffer.h */, + 4C53DFC20A484C240014E966 /* CSoftwareDriver2.cpp */, + 4C53DFC30A484C240014E966 /* CSoftwareDriver2.h */, + 4C53DFC60A484C240014E966 /* CSoftwareTexture2.cpp */, + 4C53DFC70A484C240014E966 /* CSoftwareTexture2.h */, + ); + name = "Burning Video"; + sourceTree = ""; + }; + 0910BA8D0D1F72DB00D46B04 /* Direct3D8 */ = { + isa = PBXGroup; + children = ( + 4C53DF020A484C220014E966 /* CD3D8Driver.cpp */, + 4C53DF030A484C220014E966 /* CD3D8Driver.h */, + 4C53DF040A484C220014E966 /* CD3D8MaterialRenderer.h */, + 4C53DF050A484C220014E966 /* CD3D8NormalMapRenderer.cpp */, + 4C53DF060A484C220014E966 /* CD3D8NormalMapRenderer.h */, + 4C53DF070A484C230014E966 /* CD3D8ParallaxMapRenderer.cpp */, + 4C53DF080A484C230014E966 /* CD3D8ParallaxMapRenderer.h */, + 4C53DF090A484C230014E966 /* CD3D8ShaderMaterialRenderer.cpp */, + 4C53DF0A0A484C230014E966 /* CD3D8ShaderMaterialRenderer.h */, + 4C53DF0B0A484C230014E966 /* CD3D8Texture.cpp */, + 4C53DF0C0A484C230014E966 /* CD3D8Texture.h */, + ); + name = Direct3D8; + sourceTree = ""; + }; + 0910BA8E0D1F72FB00D46B04 /* Direct3D9 */ = { + isa = PBXGroup; + children = ( + 4C53DF0D0A484C230014E966 /* CD3D9Driver.cpp */, + 4C53DF0E0A484C230014E966 /* CD3D9Driver.h */, + 4C53DF0F0A484C230014E966 /* CD3D9HLSLMaterialRenderer.cpp */, + 4C53DF100A484C230014E966 /* CD3D9HLSLMaterialRenderer.h */, + 4C53DF110A484C230014E966 /* CD3D9MaterialRenderer.h */, + 4C53DF120A484C230014E966 /* CD3D9NormalMapRenderer.cpp */, + 4C53DF130A484C230014E966 /* CD3D9NormalMapRenderer.h */, + 4C53DF140A484C230014E966 /* CD3D9ParallaxMapRenderer.cpp */, + 4C53DF150A484C230014E966 /* CD3D9ParallaxMapRenderer.h */, + 4C53DF160A484C230014E966 /* CD3D9ShaderMaterialRenderer.cpp */, + 4C53DF170A484C230014E966 /* CD3D9ShaderMaterialRenderer.h */, + 4C53DF180A484C230014E966 /* CD3D9Texture.cpp */, + 4C53DF190A484C230014E966 /* CD3D9Texture.h */, + ); + name = Direct3D9; + sourceTree = ""; + }; + 0910BA8F0D1F731900D46B04 /* Null */ = { + isa = PBXGroup; + children = ( + 0910BA900D1F733100D46B04 /* writer */, + 096840270D0F1A2300333EFD /* CImageLoaderPPM.cpp */, + 096840280D0F1A2300333EFD /* CImageLoaderPPM.h */, + 4CFA7BDC0A88735900B03626 /* CImageLoaderBMP.cpp */, + 4CFA7BDD0A88735900B03626 /* CImageLoaderBMP.h */, + 4C53DEFC0A484C220014E966 /* CColorConverter.cpp */, + 4C53DEFD0A484C220014E966 /* CColorConverter.h */, + 4C53DF2A0A484C230014E966 /* CFPSCounter.cpp */, + 4C53DF2B0A484C230014E966 /* CFPSCounter.h */, + 4C53DF580A484C230014E966 /* CImage.cpp */, + 4C53DF590A484C230014E966 /* CImage.h */, + 4C53DF5C0A484C230014E966 /* CImageLoaderJPG.cpp */, + 4C53DF5D0A484C230014E966 /* CImageLoaderJPG.h */, + 4C53DF5E0A484C230014E966 /* CImageLoaderPCX.cpp */, + 4C53DF5F0A484C230014E966 /* CImageLoaderPCX.h */, + 4C53DF600A484C230014E966 /* CImageLoaderPNG.cpp */, + 4C53DF610A484C230014E966 /* CImageLoaderPNG.h */, + 4C53DF620A484C230014E966 /* CImageLoaderPSD.cpp */, + 4C53DF630A484C230014E966 /* CImageLoaderPSD.h */, + 4C53DF640A484C230014E966 /* CImageLoaderTGA.cpp */, + 4C53DF650A484C230014E966 /* CImageLoaderTGA.h */, + 4C53DF820A484C240014E966 /* CNullDriver.cpp */, + 4C53DF830A484C240014E966 /* CNullDriver.h */, + 4C53E0090A484C250014E966 /* IImagePresenter.h */, + 0910B9DC0D1F5D4100D46B04 /* CImageLoaderWAL.cpp */, + 0910B9DD0D1F5D4100D46B04 /* CImageLoaderWAL.h */, + ); + name = Null; + sourceTree = ""; + }; + 0910BA900D1F733100D46B04 /* writer */ = { + isa = PBXGroup; + children = ( + 4CFA7BDE0A88735900B03626 /* CImageWriterBMP.cpp */, + 4CFA7BDF0A88735900B03626 /* CImageWriterBMP.h */, + 4CFA7BE00A88735900B03626 /* CImageWriterJPG.cpp */, + 4CFA7BE10A88735900B03626 /* CImageWriterJPG.h */, + 4CFA7BE20A88735900B03626 /* CImageWriterPCX.cpp */, + 4CFA7BE30A88735900B03626 /* CImageWriterPCX.h */, + 4CFA7BE40A88735900B03626 /* CImageWriterPNG.cpp */, + 4CFA7BE50A88735900B03626 /* CImageWriterPNG.h */, + 4CFA7BE60A88735900B03626 /* CImageWriterPPM.cpp */, + 4CFA7BE70A88735900B03626 /* CImageWriterPPM.h */, + 4CFA7BE80A88735900B03626 /* CImageWriterPSD.cpp */, + 4CFA7BE90A88735900B03626 /* CImageWriterPSD.h */, + 4CFA7BEA0A88735900B03626 /* CImageWriterTGA.cpp */, + 4CFA7BEB0A88735900B03626 /* CImageWriterTGA.h */, + ); + name = writer; + sourceTree = ""; + }; + 0910BA910D1F738100D46B04 /* OpenGL */ = { + isa = PBXGroup; + children = ( + 5DD480C10C7DA66800728AA9 /* COpenGLExtensionHandler.h */, + 5DD480C50C7DA66800728AA9 /* COpenGLExtensionHandler.cpp */, + 4C53DF8C0A484C240014E966 /* COpenGLDriver.cpp */, + 4C53DF8D0A484C240014E966 /* COpenGLDriver.h */, + 4C53DF8E0A484C240014E966 /* COpenGLMaterialRenderer.h */, + 4C53DF8F0A484C240014E966 /* COpenGLNormalMapRenderer.cpp */, + 4C53DF900A484C240014E966 /* COpenGLNormalMapRenderer.h */, + 4C53DF910A484C240014E966 /* COpenGLParallaxMapRenderer.cpp */, + 4C53DF920A484C240014E966 /* COpenGLParallaxMapRenderer.h */, + 4C53DF930A484C240014E966 /* COpenGLShaderMaterialRenderer.cpp */, + 4C53DF940A484C240014E966 /* COpenGLShaderMaterialRenderer.h */, + 4C53DF950A484C240014E966 /* COpenGLSLMaterialRenderer.cpp */, + 4C53DF960A484C240014E966 /* COpenGLSLMaterialRenderer.h */, + 4C53DF970A484C240014E966 /* COpenGLTexture.cpp */, + 4C53DF980A484C240014E966 /* COpenGLTexture.h */, + ); + name = OpenGL; + sourceTree = ""; + }; + 0910BA920D1F73CC00D46B04 /* Software */ = { + isa = PBXGroup; + children = ( + 4C53DFBF0A484C240014E966 /* CSoftware2MaterialRenderer.h */, + 4C53DFC00A484C240014E966 /* CSoftwareDriver.cpp */, + 4C53DFC10A484C240014E966 /* CSoftwareDriver.h */, + 4C53DFC40A484C240014E966 /* CSoftwareTexture.cpp */, + 4C53DFC50A484C240014E966 /* CSoftwareTexture.h */, + 4C53DFFF0A484C250014E966 /* CZBuffer.cpp */, + 4C53E0000A484C250014E966 /* CZBuffer.h */, + 5DD480540C7D93AB00728AA9 /* IDepthBuffer.h */, + 4C53E00F0A484C250014E966 /* ITriangleRenderer.h */, + 5DD4806C0C7D94AC00728AA9 /* CTRTextureBlend.cpp */, + 5DD4806D0C7D94AC00728AA9 /* CTRTextureGouraudAlpha.cpp */, + 5DD4806E0C7D94AC00728AA9 /* CTRTextureGouraudAlphaNoZ.cpp */, + 5DD4806F0C7D94AC00728AA9 /* CTRTextureLightMapGouraud2_M4.cpp */, + 4C53E0110A484C250014E966 /* IZBuffer.h */, + 4C53E16C0A484C2C0014E966 /* S2DVertex.h */, + 4C53DFD10A484C240014E966 /* CTRFlat.cpp */, + 4C53DFD20A484C240014E966 /* CTRFlatWire.cpp */, + 4C53DFD30A484C240014E966 /* CTRGouraud.cpp */, + 4C53DFD40A484C240014E966 /* CTRGouraud2.cpp */, + 4C53DFD50A484C240014E966 /* CTRGouraudAlpha2.cpp */, + 4C53DFD60A484C240014E966 /* CTRGouraudAlphaNoZ2.cpp */, + 4C53DFD70A484C240014E966 /* CTRGouraudWire.cpp */, + 4C53DFDC0A484C250014E966 /* CTRTextureDetailMap2.cpp */, + 4C53DFDD0A484C250014E966 /* CTRTextureFlat.cpp */, + 4C53DFDE0A484C250014E966 /* CTRTextureFlatWire.cpp */, + 4C53DFDF0A484C250014E966 /* CTRTextureGouraud.cpp */, + 4C53DFE00A484C250014E966 /* CTRTextureGouraud.h */, + 4C53DFE10A484C250014E966 /* CTRTextureGouraud2.cpp */, + 4C53DFE20A484C250014E966 /* CTRTextureGouraudAdd.cpp */, + 4C53DFE30A484C250014E966 /* CTRTextureGouraudAdd2.cpp */, + 4C53DFE40A484C250014E966 /* CTRTextureGouraudAddNoZ2.cpp */, + 4C53DFE50A484C250014E966 /* CTRTextureGouraudNoZ.cpp */, + 4C53DFE60A484C250014E966 /* CTRTextureGouraudNoZ2.cpp */, + 4C53DFE70A484C250014E966 /* CTRTextureGouraudVertexAlpha2.cpp */, + 4C53DFE80A484C250014E966 /* CTRTextureGouraudWire.cpp */, + 4C53DFE90A484C250014E966 /* CTRTextureLightMap2_Add.cpp */, + 4C53DFEA0A484C250014E966 /* CTRTextureLightMap2_M1.cpp */, + 4C53DFEB0A484C250014E966 /* CTRTextureLightMap2_M2.cpp */, + 4C53DFEC0A484C250014E966 /* CTRTextureLightMap2_M4.cpp */, + 4C53DFED0A484C250014E966 /* CTRTextureWire2.cpp */, + ); + name = Software; + sourceTree = ""; + }; + 09293C2B0ED31FF8003B8C9C /* libpng */ = { + isa = PBXGroup; + children = ( + 09293C2C0ED32029003B8C9C /* png.c */, + 09293C2D0ED32029003B8C9C /* pngerror.c */, + 09293C2E0ED32029003B8C9C /* pnggccrd.c */, + 09293C2F0ED32029003B8C9C /* pngget.c */, + 09293C300ED32029003B8C9C /* pngmem.c */, + 09293C310ED32029003B8C9C /* pngpread.c */, + 09293C320ED32029003B8C9C /* pngread.c */, + 09293C330ED32029003B8C9C /* pngrio.c */, + 09293C340ED32029003B8C9C /* pngrtran.c */, + 09293C350ED32029003B8C9C /* pngrutil.c */, + 09293C360ED32029003B8C9C /* pngset.c */, + 09293C380ED32029003B8C9C /* pngtrans.c */, + 09293C3A0ED32029003B8C9C /* pngwio.c */, + 09293C3B0ED32029003B8C9C /* pngwrite.c */, + 09293C3C0ED32029003B8C9C /* pngwtran.c */, + 09293C3D0ED32029003B8C9C /* pngwutil.c */, + ); + name = libpng; + sourceTree = ""; + }; + 0946CC980EC99B8B00D945A5 /* 19.MouseAndJoystick */ = { + isa = PBXGroup; + children = ( + 0946CCCA0EC99C6E00D945A5 /* main.cpp */, + ); + name = 19.MouseAndJoystick; + sourceTree = ""; + }; + 09F6492D0D2CE017001E0599 /* 15.LoadIrrFile */ = { + isa = PBXGroup; + children = ( + 09F6492E0D2CE038001E0599 /* main.cpp */, + ); + name = 15.LoadIrrFile; + sourceTree = ""; + }; + 09F649530D2CE1EB001E0599 /* 16.Quake3Shader */ = { + isa = PBXGroup; + children = ( + 09F649730D2CE2D0001E0599 /* main.cpp */, + ); + name = 16.Quake3Shader; + sourceTree = ""; + }; 4C00546D0A48470500C844C2 /* examples */ = { isa = PBXGroup; children = ( @@ -1347,6 +2562,9 @@ 4C0054AD0A48470500C844C2 /* 11.PerPixelLighting */, 4C0054B30A48470500C844C2 /* 12.TerrainRendering */, 4C0054B90A48470500C844C2 /* 13.RenderToTexture */, + 09F6492D0D2CE017001E0599 /* 15.LoadIrrFile */, + 09F649530D2CE1EB001E0599 /* 16.Quake3Shader */, + 0946CC980EC99B8B00D945A5 /* 19.MouseAndJoystick */, 4C0054C40A48470500C844C2 /* Demo */, ); name = examples; @@ -1472,10 +2690,10 @@ 4C53DEE50A484C220014E966 /* Irrlicht */ = { isa = PBXGroup; children = ( + 09293C2B0ED31FF8003B8C9C /* libpng */, 4C6DC9960A486B110017A6E5 /* Engine */, 4C53E14A0A484C2C0014E966 /* MacOSX */, 4C53E0130A484C250014E966 /* jpeglib */, - 4C53E0A80A484C280014E966 /* libpng */, 4C53E1710A484C2C0014E966 /* zlib */, ); name = Irrlicht; @@ -1548,28 +2766,6 @@ path = jpeglib; sourceTree = ""; }; - 4C53E0A80A484C280014E966 /* libpng */ = { - isa = PBXGroup; - children = ( - 5DD480470C7D8B9100728AA9 /* pngwrite.c */, - 4C53E1010A484C2A0014E966 /* png.c */, - 4C53E1090A484C2A0014E966 /* pngerror.c */, - 4C53E10D0A484C2A0014E966 /* pngget.c */, - 4C53E10E0A484C2A0014E966 /* pngmem.c */, - 4C53E1130A484C2A0014E966 /* pngpread.c */, - 4C53E1140A484C2A0014E966 /* pngread.c */, - 4C53E1150A484C2A0014E966 /* pngrio.c */, - 4C53E1160A484C2A0014E966 /* pngrtran.c */, - 4C53E1170A484C2A0014E966 /* pngrutil.c */, - 4C53E1180A484C2A0014E966 /* pngset.c */, - 4C53E11D0A484C2B0014E966 /* pngtrans.c */, - 4C53E1210A484C2B0014E966 /* pngwio.c */, - 4C53E1230A484C2B0014E966 /* pngwtran.c */, - 4C53E1240A484C2B0014E966 /* pngwutil.c */, - ); - path = libpng; - sourceTree = ""; - }; 4C53E14A0A484C2C0014E966 /* MacOSX */ = { isa = PBXGroup; children = ( @@ -1639,6 +2835,8 @@ 4C53E24C0A484FED0014E966 /* Products */ = { isa = PBXGroup; children = ( + 0946CCB40EC99BBE00D945A5 /* MouseAndJoystick.app */, + 09022C620EA0E97F00CD54EE /* GUIEditor.app */, 4C53E24D0A4850120014E966 /* libIrrlicht.a */, 4C53E2520A4850550014E966 /* Quake3Map.app */, 4CA25B980A485D9800B4E469 /* CustomSceneNode.app */, @@ -1653,6 +2851,9 @@ 4CA25B9C0A485D9800B4E469 /* RenderToTexture.app */, 4CA25BAA0A485D9800B4E469 /* TerrainRendering.app */, 4CA25BA20A485D9800B4E469 /* Demo.app */, + 09F6493E0D2CE03E001E0599 /* LoadIrrFile.app */, + 09F649650D2CE206001E0599 /* Quake3Shader.app */, + 09F649030D2CDED9001E0599 /* HelloWorld.app */, ); name = Products; sourceTree = ""; @@ -1660,6 +2861,8 @@ 4C53E2540A48505D0014E966 /* Libraries */ = { isa = PBXGroup; children = ( + 0930CE550EC39F4500D63866 /* IOKit.framework */, + 0925113D0D744ADE006784D9 /* Carbon.framework */, 4C53E26D0A4850D60014E966 /* Cocoa.framework */, 4C53E26E0A4850D60014E966 /* OpenGL.framework */, ); @@ -1669,355 +2872,19 @@ 4C6DC9960A486B110017A6E5 /* Engine */ = { isa = PBXGroup; children = ( - 5DD480C10C7DA66800728AA9 /* COpenGLExtensionHandler.h */, - 5DD480C20C7DA66800728AA9 /* CMD3MeshFileLoader.h */, - 5DD480C30C7DA66800728AA9 /* CIrrDeviceSDL.h */, - 5DD480C40C7DA66800728AA9 /* CIrrDeviceSDL.cpp */, - 5DD480C50C7DA66800728AA9 /* COpenGLExtensionHandler.cpp */, - 5DD480C60C7DA66800728AA9 /* CMD3MeshFileLoader.cpp */, - 5DD480500C7D936700728AA9 /* IBurningShader.cpp */, - 5DD480510C7D936700728AA9 /* IBurningShader.h */, - 5DD4804C0C7D91DF00728AA9 /* CDepthBuffer.cpp */, - 5DD4804D0C7D91DF00728AA9 /* CDepthBuffer.h */, - 4CFA7BDC0A88735900B03626 /* CImageLoaderBMP.cpp */, - 4CFA7BDD0A88735900B03626 /* CImageLoaderBMP.h */, - 4CFA7BDE0A88735900B03626 /* CImageWriterBMP.cpp */, - 4CFA7BDF0A88735900B03626 /* CImageWriterBMP.h */, - 4CFA7BE00A88735900B03626 /* CImageWriterJPG.cpp */, - 4CFA7BE10A88735900B03626 /* CImageWriterJPG.h */, - 4CFA7BE20A88735900B03626 /* CImageWriterPCX.cpp */, - 4CFA7BE30A88735900B03626 /* CImageWriterPCX.h */, - 4CFA7BE40A88735900B03626 /* CImageWriterPNG.cpp */, - 4CFA7BE50A88735900B03626 /* CImageWriterPNG.h */, - 4CFA7BE60A88735900B03626 /* CImageWriterPPM.cpp */, - 4CFA7BE70A88735900B03626 /* CImageWriterPPM.h */, - 4CFA7BE80A88735900B03626 /* CImageWriterPSD.cpp */, - 4CFA7BE90A88735900B03626 /* CImageWriterPSD.h */, - 4CFA7BEA0A88735900B03626 /* CImageWriterTGA.cpp */, - 4CFA7BEB0A88735900B03626 /* CImageWriterTGA.h */, - 4CFA7BEC0A88735A00B03626 /* CSkyDomeSceneNode.cpp */, - 4CFA7BED0A88735A00B03626 /* CSkyDomeSceneNode.h */, - 4C43EEBE0A74A5C800F942FC /* CPakReader.cpp */, - 4C43EEBF0A74A5C800F942FC /* CPakReader.h */, - 4C43EEBD0A74A5AB00F942FC /* CAnimatedMeshB3d.h */, - 4C43EEBB0A74A5A300F942FC /* CAnimatedMeshB3d.cpp */, - 4C364EA20A6C6DC2004CFBB4 /* COBJMeshFileLoader.cpp */, - 4C364EA30A6C6DC2004CFBB4 /* COBJMeshFileLoader.h */, - 4CC36B0D0A6B61DB0076C4B2 /* CSphereSceneNode.cpp */, - 4CC36B0E0A6B61DB0076C4B2 /* CSphereSceneNode.h */, - 4C53DEE60A484C220014E966 /* BuiltInFont.h */, - 4C53DEE70A484C220014E966 /* C3DSMeshFileLoader.cpp */, - 4C53DEE80A484C220014E966 /* C3DSMeshFileLoader.h */, - 4C53DEE90A484C220014E966 /* CAnimatedMeshMD2.cpp */, - 4C53DEEA0A484C220014E966 /* CAnimatedMeshMD2.h */, - 4C53DEEB0A484C220014E966 /* CAnimatedMeshMS3D.cpp */, - 4C53DEEC0A484C220014E966 /* CAnimatedMeshMS3D.h */, - 4C53DEED0A484C220014E966 /* CAnimatedMeshSceneNode.cpp */, - 4C53DEEE0A484C220014E966 /* CAnimatedMeshSceneNode.h */, - 4C53DEEF0A484C220014E966 /* CAttributeImpl.h */, - 4C53DEF00A484C220014E966 /* CAttributes.cpp */, - 4C53DEF10A484C220014E966 /* CAttributes.h */, - 4C53DEF20A484C220014E966 /* CBillboardSceneNode.cpp */, - 4C53DEF30A484C220014E966 /* CBillboardSceneNode.h */, - 4C53DEF40A484C220014E966 /* CCameraFPSSceneNode.cpp */, - 4C53DEF50A484C220014E966 /* CCameraFPSSceneNode.h */, - 4C53DEF60A484C220014E966 /* CCameraMayaSceneNode.cpp */, - 4C53DEF70A484C220014E966 /* CCameraMayaSceneNode.h */, - 4C53DEF80A484C220014E966 /* CCameraSceneNode.cpp */, - 4C53DEF90A484C220014E966 /* CCameraSceneNode.h */, - 4C53DEFA0A484C220014E966 /* CColladaFileLoader.cpp */, - 4C53DEFB0A484C220014E966 /* CColladaFileLoader.h */, - 4C53DEFC0A484C220014E966 /* CColorConverter.cpp */, - 4C53DEFD0A484C220014E966 /* CColorConverter.h */, - 4C53DEFE0A484C220014E966 /* CCSMLoader.cpp */, - 4C53DEFF0A484C220014E966 /* CCSMLoader.h */, - 4C53DF000A484C220014E966 /* CCubeSceneNode.cpp */, - 4C53DF010A484C220014E966 /* CCubeSceneNode.h */, - 4C53DF020A484C220014E966 /* CD3D8Driver.cpp */, - 4C53DF030A484C220014E966 /* CD3D8Driver.h */, - 4C53DF040A484C220014E966 /* CD3D8MaterialRenderer.h */, - 4C53DF050A484C220014E966 /* CD3D8NormalMapRenderer.cpp */, - 4C53DF060A484C220014E966 /* CD3D8NormalMapRenderer.h */, - 4C53DF070A484C230014E966 /* CD3D8ParallaxMapRenderer.cpp */, - 4C53DF080A484C230014E966 /* CD3D8ParallaxMapRenderer.h */, - 4C53DF090A484C230014E966 /* CD3D8ShaderMaterialRenderer.cpp */, - 4C53DF0A0A484C230014E966 /* CD3D8ShaderMaterialRenderer.h */, - 4C53DF0B0A484C230014E966 /* CD3D8Texture.cpp */, - 4C53DF0C0A484C230014E966 /* CD3D8Texture.h */, - 4C53DF0D0A484C230014E966 /* CD3D9Driver.cpp */, - 4C53DF0E0A484C230014E966 /* CD3D9Driver.h */, - 4C53DF0F0A484C230014E966 /* CD3D9HLSLMaterialRenderer.cpp */, - 4C53DF100A484C230014E966 /* CD3D9HLSLMaterialRenderer.h */, - 4C53DF110A484C230014E966 /* CD3D9MaterialRenderer.h */, - 4C53DF120A484C230014E966 /* CD3D9NormalMapRenderer.cpp */, - 4C53DF130A484C230014E966 /* CD3D9NormalMapRenderer.h */, - 4C53DF140A484C230014E966 /* CD3D9ParallaxMapRenderer.cpp */, - 4C53DF150A484C230014E966 /* CD3D9ParallaxMapRenderer.h */, - 4C53DF160A484C230014E966 /* CD3D9ShaderMaterialRenderer.cpp */, - 4C53DF170A484C230014E966 /* CD3D9ShaderMaterialRenderer.h */, - 4C53DF180A484C230014E966 /* CD3D9Texture.cpp */, - 4C53DF190A484C230014E966 /* CD3D9Texture.h */, - 4C53DF1A0A484C230014E966 /* CDefaultMeshFormatLoader.cpp */, - 4C53DF1B0A484C230014E966 /* CDefaultMeshFormatLoader.h */, + 0910BA810D1F6BB800D46B04 /* gui */, + 0910BA820D1F6C3900D46B04 /* io */, + 0910BA830D1F6CA600D46B04 /* irr */, + 0910BA840D1F6D0200D46B04 /* scene */, + 0910BA8B0D1F71D600D46B04 /* video */, + 096840220D0F1A2300333EFD /* CBSPMeshFileLoader.cpp */, + 096840230D0F1A2300333EFD /* CBSPMeshFileLoader.h */, 4C53DF1C0A484C230014E966 /* CDefaultSceneNodeAnimatorFactory.cpp */, - 4C53DF1D0A484C230014E966 /* CDefaultSceneNodeAnimatorFactory.h */, - 4C53DF1E0A484C230014E966 /* CDefaultSceneNodeFactory.cpp */, - 4C53DF1F0A484C230014E966 /* CDefaultSceneNodeFactory.h */, - 4C53DF200A484C230014E966 /* CDMFLoader.cpp */, - 4C53DF210A484C230014E966 /* CDMFLoader.h */, - 4C53DF220A484C230014E966 /* CDummyTransformationSceneNode.cpp */, - 4C53DF230A484C230014E966 /* CDummyTransformationSceneNode.h */, - 4C53DF240A484C230014E966 /* CEmptySceneNode.cpp */, - 4C53DF250A484C230014E966 /* CEmptySceneNode.h */, - 4C53DF260A484C230014E966 /* CFileList.cpp */, - 4C53DF270A484C230014E966 /* CFileList.h */, - 4C53DF280A484C230014E966 /* CFileSystem.cpp */, - 4C53DF290A484C230014E966 /* CFileSystem.h */, - 4C53DF2A0A484C230014E966 /* CFPSCounter.cpp */, - 4C53DF2B0A484C230014E966 /* CFPSCounter.h */, - 4C53DF2C0A484C230014E966 /* CGeometryCreator.cpp */, - 4C53DF2D0A484C230014E966 /* CGeometryCreator.h */, - 4C53DF2E0A484C230014E966 /* CGUIButton.cpp */, - 4C53DF2F0A484C230014E966 /* CGUIButton.h */, - 4C53DF300A484C230014E966 /* CGUICheckBox.cpp */, - 4C53DF310A484C230014E966 /* CGUICheckBox.h */, - 4C53DF320A484C230014E966 /* CGUIComboBox.cpp */, - 4C53DF330A484C230014E966 /* CGUIComboBox.h */, - 4C53DF340A484C230014E966 /* CGUIContextMenu.cpp */, - 4C53DF350A484C230014E966 /* CGUIContextMenu.h */, - 4C53DF360A484C230014E966 /* CGUIEditBox.cpp */, - 4C53DF370A484C230014E966 /* CGUIEditBox.h */, - 4C53DF380A484C230014E966 /* CGUIEnvironment.cpp */, - 4C53DF390A484C230014E966 /* CGUIEnvironment.h */, - 4C53DF3A0A484C230014E966 /* CGUIFileOpenDialog.cpp */, - 4C53DF3B0A484C230014E966 /* CGUIFileOpenDialog.h */, - 4C53DF3C0A484C230014E966 /* CGUIFont.cpp */, - 4C53DF3D0A484C230014E966 /* CGUIFont.h */, - 4C53DF3E0A484C230014E966 /* CGUIImage.cpp */, - 4C53DF3F0A484C230014E966 /* CGUIImage.h */, - 4C53DF400A484C230014E966 /* CGUIInOutFader.cpp */, - 4C53DF410A484C230014E966 /* CGUIInOutFader.h */, - 4C53DF420A484C230014E966 /* CGUIListBox.cpp */, - 4C53DF430A484C230014E966 /* CGUIListBox.h */, - 4C53DF440A484C230014E966 /* CGUIMenu.cpp */, - 4C53DF450A484C230014E966 /* CGUIMenu.h */, - 4C53DF460A484C230014E966 /* CGUIMeshViewer.cpp */, - 4C53DF470A484C230014E966 /* CGUIMeshViewer.h */, - 4C53DF480A484C230014E966 /* CGUIMessageBox.cpp */, - 4C53DF490A484C230014E966 /* CGUIMessageBox.h */, - 4C53DF4A0A484C230014E966 /* CGUIModalScreen.cpp */, - 4C53DF4B0A484C230014E966 /* CGUIModalScreen.h */, - 4C53DF4C0A484C230014E966 /* CGUIScrollBar.cpp */, - 4C53DF4D0A484C230014E966 /* CGUIScrollBar.h */, - 4C53DF4E0A484C230014E966 /* CGUISkin.cpp */, - 4C53DF4F0A484C230014E966 /* CGUISkin.h */, - 4C53DF500A484C230014E966 /* CGUIStaticText.cpp */, - 4C53DF510A484C230014E966 /* CGUIStaticText.h */, - 4C53DF520A484C230014E966 /* CGUITabControl.cpp */, - 4C53DF530A484C230014E966 /* CGUITabControl.h */, - 4C53DF540A484C230014E966 /* CGUIToolBar.cpp */, - 4C53DF550A484C230014E966 /* CGUIToolBar.h */, - 4C53DF560A484C230014E966 /* CGUIWindow.cpp */, - 4C53DF570A484C230014E966 /* CGUIWindow.h */, - 4C53DF580A484C230014E966 /* CImage.cpp */, - 4C53DF590A484C230014E966 /* CImage.h */, - 4C53DF5C0A484C230014E966 /* CImageLoaderJPG.cpp */, - 4C53DF5D0A484C230014E966 /* CImageLoaderJPG.h */, - 4C53DF5E0A484C230014E966 /* CImageLoaderPCX.cpp */, - 4C53DF5F0A484C230014E966 /* CImageLoaderPCX.h */, - 4C53DF600A484C230014E966 /* CImageLoaderPNG.cpp */, - 4C53DF610A484C230014E966 /* CImageLoaderPNG.h */, - 4C53DF620A484C230014E966 /* CImageLoaderPSD.cpp */, - 4C53DF630A484C230014E966 /* CImageLoaderPSD.h */, - 4C53DF640A484C230014E966 /* CImageLoaderTGA.cpp */, - 4C53DF650A484C230014E966 /* CImageLoaderTGA.h */, - 4C53DF660A484C230014E966 /* CIrrDeviceLinux.cpp */, - 4C53DF670A484C230014E966 /* CIrrDeviceLinux.h */, - 4C53DF680A484C230014E966 /* CIrrDeviceStub.cpp */, - 4C53DF690A484C230014E966 /* CIrrDeviceStub.h */, - 4C53DF6A0A484C230014E966 /* CIrrDeviceWin32.cpp */, - 4C53DF6B0A484C230014E966 /* CIrrDeviceWin32.h */, - 4C53DF6C0A484C230014E966 /* CLightSceneNode.cpp */, - 4C53DF6D0A484C230014E966 /* CLightSceneNode.h */, - 4C53DF6E0A484C230014E966 /* CLimitReadFile.cpp */, - 4C53DF6F0A484C230014E966 /* CLimitReadFile.h */, - 4C53DF700A484C230014E966 /* CLMTSMeshFileLoader.cpp */, - 4C53DF710A484C230014E966 /* CLMTSMeshFileLoader.h */, - 4C53DF720A484C230014E966 /* CLogger.cpp */, - 4C53DF730A484C230014E966 /* CLogger.h */, - 4C53DF740A484C230014E966 /* CMemoryReadFile.cpp */, - 4C53DF750A484C230014E966 /* CMemoryReadFile.h */, - 4C53DF760A484C230014E966 /* CMeshCache.cpp */, - 4C53DF770A484C230014E966 /* CMeshCache.h */, - 4C53DF780A484C230014E966 /* CMeshManipulator.cpp */, - 4C53DF790A484C230014E966 /* CMeshManipulator.h */, - 4C53DF7A0A484C230014E966 /* CMeshSceneNode.cpp */, - 4C53DF7B0A484C230014E966 /* CMeshSceneNode.h */, - 4C53DF7C0A484C230014E966 /* CMetaTriangleSelector.cpp */, - 4C53DF7D0A484C230014E966 /* CMetaTriangleSelector.h */, - 4C53DF7E0A484C230014E966 /* CMY3DHelper.h */, - 4C53DF7F0A484C230014E966 /* CMY3DMeshFileLoader.cpp */, - 4C53DF800A484C230014E966 /* CMY3DMeshFileLoader.h */, - 4C53DF810A484C230014E966 /* CMY3DStuff.h */, - 4C53DF820A484C240014E966 /* CNullDriver.cpp */, - 4C53DF830A484C240014E966 /* CNullDriver.h */, - 4C53DF840A484C240014E966 /* COCTLoader.cpp */, - 4C53DF850A484C240014E966 /* COCTLoader.h */, - 4C53DF860A484C240014E966 /* COctTreeSceneNode.cpp */, - 4C53DF870A484C240014E966 /* COctTreeSceneNode.h */, 4C53DF880A484C240014E966 /* COctTreeTriangleSelector.cpp */, 4C53DF890A484C240014E966 /* COctTreeTriangleSelector.h */, - 4C53DF8A0A484C240014E966 /* COgreMeshFileLoader.cpp */, - 4C53DF8B0A484C240014E966 /* COgreMeshFileLoader.h */, - 4C53DF8C0A484C240014E966 /* COpenGLDriver.cpp */, - 4C53DF8D0A484C240014E966 /* COpenGLDriver.h */, - 4C53DF8E0A484C240014E966 /* COpenGLMaterialRenderer.h */, - 4C53DF8F0A484C240014E966 /* COpenGLNormalMapRenderer.cpp */, - 4C53DF900A484C240014E966 /* COpenGLNormalMapRenderer.h */, - 4C53DF910A484C240014E966 /* COpenGLParallaxMapRenderer.cpp */, - 4C53DF920A484C240014E966 /* COpenGLParallaxMapRenderer.h */, - 4C53DF930A484C240014E966 /* COpenGLShaderMaterialRenderer.cpp */, - 4C53DF940A484C240014E966 /* COpenGLShaderMaterialRenderer.h */, - 4C53DF950A484C240014E966 /* COpenGLSLMaterialRenderer.cpp */, - 4C53DF960A484C240014E966 /* COpenGLSLMaterialRenderer.h */, - 4C53DF970A484C240014E966 /* COpenGLTexture.cpp */, - 4C53DF980A484C240014E966 /* COpenGLTexture.h */, - 4C53DF990A484C240014E966 /* COSOperator.cpp */, - 4C53DF9A0A484C240014E966 /* COSOperator.h */, - 4C53DF9B0A484C240014E966 /* CParticleBoxEmitter.cpp */, - 4C53DF9C0A484C240014E966 /* CParticleBoxEmitter.h */, - 4C53DF9D0A484C240014E966 /* CParticleFadeOutAffector.cpp */, - 4C53DF9E0A484C240014E966 /* CParticleFadeOutAffector.h */, - 4C53DF9F0A484C240014E966 /* CParticleGravityAffector.cpp */, - 4C53DFA00A484C240014E966 /* CParticleGravityAffector.h */, - 4C53DFA10A484C240014E966 /* CParticlePointEmitter.cpp */, - 4C53DFA20A484C240014E966 /* CParticlePointEmitter.h */, - 4C53DFA30A484C240014E966 /* CParticleSystemSceneNode.cpp */, - 4C53DFA40A484C240014E966 /* CParticleSystemSceneNode.h */, - 4C53DFA50A484C240014E966 /* CQ3LevelMesh.cpp */, - 4C53DFA60A484C240014E966 /* CQ3LevelMesh.h */, - 4C53DFA70A484C240014E966 /* CReadFile.cpp */, - 4C53DFA80A484C240014E966 /* CReadFile.h */, - 4C53DFA90A484C240014E966 /* CSceneCollisionManager.cpp */, - 4C53DFAA0A484C240014E966 /* CSceneCollisionManager.h */, - 4C53DFAB0A484C240014E966 /* CSceneManager.cpp */, - 4C53DFAC0A484C240014E966 /* CSceneManager.h */, - 4C53DFAD0A484C240014E966 /* CSceneNodeAnimatorCollisionResponse.cpp */, - 4C53DFAE0A484C240014E966 /* CSceneNodeAnimatorCollisionResponse.h */, - 4C53DFAF0A484C240014E966 /* CSceneNodeAnimatorDelete.cpp */, - 4C53DFB00A484C240014E966 /* CSceneNodeAnimatorDelete.h */, - 4C53DFB10A484C240014E966 /* CSceneNodeAnimatorFlyCircle.cpp */, - 4C53DFB20A484C240014E966 /* CSceneNodeAnimatorFlyCircle.h */, - 4C53DFB30A484C240014E966 /* CSceneNodeAnimatorFlyStraight.cpp */, - 4C53DFB40A484C240014E966 /* CSceneNodeAnimatorFlyStraight.h */, - 4C53DFB50A484C240014E966 /* CSceneNodeAnimatorFollowSpline.cpp */, - 4C53DFB60A484C240014E966 /* CSceneNodeAnimatorFollowSpline.h */, - 4C53DFB70A484C240014E966 /* CSceneNodeAnimatorRotation.cpp */, - 4C53DFB80A484C240014E966 /* CSceneNodeAnimatorRotation.h */, - 4C53DFB90A484C240014E966 /* CSceneNodeAnimatorTexture.cpp */, - 4C53DFBA0A484C240014E966 /* CSceneNodeAnimatorTexture.h */, - 4C53DFBB0A484C240014E966 /* CShadowVolumeSceneNode.cpp */, - 4C53DFBC0A484C240014E966 /* CShadowVolumeSceneNode.h */, - 4C53DFBD0A484C240014E966 /* CSkyBoxSceneNode.cpp */, - 4C53DFBE0A484C240014E966 /* CSkyBoxSceneNode.h */, - 4C53DFBF0A484C240014E966 /* CSoftware2MaterialRenderer.h */, - 4C53DFC00A484C240014E966 /* CSoftwareDriver.cpp */, - 4C53DFC10A484C240014E966 /* CSoftwareDriver.h */, - 4C53DFC20A484C240014E966 /* CSoftwareDriver2.cpp */, - 4C53DFC30A484C240014E966 /* CSoftwareDriver2.h */, - 4C53DFC40A484C240014E966 /* CSoftwareTexture.cpp */, - 4C53DFC50A484C240014E966 /* CSoftwareTexture.h */, - 4C53DFC60A484C240014E966 /* CSoftwareTexture2.cpp */, - 4C53DFC70A484C240014E966 /* CSoftwareTexture2.h */, - 4C53DFCA0A484C240014E966 /* CTerrainSceneNode.cpp */, - 4C53DFCB0A484C240014E966 /* CTerrainSceneNode.h */, - 4C53DFCC0A484C240014E966 /* CTerrainTriangleSelector.cpp */, 4C53DFCD0A484C240014E966 /* CTerrainTriangleSelector.h */, - 4C53DFCE0A484C240014E966 /* CTextSceneNode.cpp */, - 4C53DFCF0A484C240014E966 /* CTextSceneNode.h */, - 4C53DFD00A484C240014E966 /* CTimer.h */, - 4C53DFD10A484C240014E966 /* CTRFlat.cpp */, - 4C53DFD20A484C240014E966 /* CTRFlatWire.cpp */, - 4C53DFD30A484C240014E966 /* CTRGouraud.cpp */, - 4C53DFD40A484C240014E966 /* CTRGouraud2.cpp */, - 4C53DFD50A484C240014E966 /* CTRGouraudAlpha2.cpp */, - 4C53DFD60A484C240014E966 /* CTRGouraudAlphaNoZ2.cpp */, - 4C53DFD70A484C240014E966 /* CTRGouraudWire.cpp */, - 4C53DFD80A484C240014E966 /* CTriangleBBSelector.cpp */, - 4C53DFD90A484C250014E966 /* CTriangleBBSelector.h */, - 4C53DFDA0A484C250014E966 /* CTriangleSelector.cpp */, - 4C53DFDB0A484C250014E966 /* CTriangleSelector.h */, - 4C53DFDC0A484C250014E966 /* CTRTextureDetailMap2.cpp */, - 4C53DFDD0A484C250014E966 /* CTRTextureFlat.cpp */, - 4C53DFDE0A484C250014E966 /* CTRTextureFlatWire.cpp */, - 4C53DFDF0A484C250014E966 /* CTRTextureGouraud.cpp */, - 4C53DFE00A484C250014E966 /* CTRTextureGouraud.h */, - 4C53DFE10A484C250014E966 /* CTRTextureGouraud2.cpp */, - 4C53DFE20A484C250014E966 /* CTRTextureGouraudAdd.cpp */, - 4C53DFE30A484C250014E966 /* CTRTextureGouraudAdd2.cpp */, - 4C53DFE40A484C250014E966 /* CTRTextureGouraudAddNoZ2.cpp */, - 4C53DFE50A484C250014E966 /* CTRTextureGouraudNoZ.cpp */, - 4C53DFE60A484C250014E966 /* CTRTextureGouraudNoZ2.cpp */, - 4C53DFE70A484C250014E966 /* CTRTextureGouraudVertexAlpha2.cpp */, - 4C53DFE80A484C250014E966 /* CTRTextureGouraudWire.cpp */, - 4C53DFE90A484C250014E966 /* CTRTextureLightMap2_Add.cpp */, - 4C53DFEA0A484C250014E966 /* CTRTextureLightMap2_M1.cpp */, - 4C53DFEB0A484C250014E966 /* CTRTextureLightMap2_M2.cpp */, - 4C53DFEC0A484C250014E966 /* CTRTextureLightMap2_M4.cpp */, - 4C53DFED0A484C250014E966 /* CTRTextureWire2.cpp */, - 4C53DFEE0A484C250014E966 /* CVideoModeList.cpp */, - 4C53DFEF0A484C250014E966 /* CVideoModeList.h */, - 4C53DFF00A484C250014E966 /* CWaterSurfaceSceneNode.cpp */, - 4C53DFF10A484C250014E966 /* CWaterSurfaceSceneNode.h */, - 4C53DFF20A484C250014E966 /* CWriteFile.cpp */, - 4C53DFF30A484C250014E966 /* CWriteFile.h */, - 4C53DFF40A484C250014E966 /* CXAnimationPlayer.cpp */, - 4C53DFF50A484C250014E966 /* CXAnimationPlayer.h */, - 4C53DFF60A484C250014E966 /* CXFileReader.cpp */, - 4C53DFF70A484C250014E966 /* CXFileReader.h */, - 4C53DFF80A484C250014E966 /* CXMeshFileLoader.cpp */, - 4C53DFF90A484C250014E966 /* CXMeshFileLoader.h */, - 4C53DFFA0A484C250014E966 /* CXMLReader.cpp */, - 4C53DFFB0A484C250014E966 /* CXMLReader.h */, - 4C53DFFC0A484C250014E966 /* CXMLReaderImpl.h */, - 4C53DFFD0A484C250014E966 /* CXMLWriter.cpp */, - 4C53DFFE0A484C250014E966 /* CXMLWriter.h */, - 4C53DFFF0A484C250014E966 /* CZBuffer.cpp */, - 4C53E0000A484C250014E966 /* CZBuffer.h */, - 4C53E0030A484C250014E966 /* CZipReader.cpp */, - 4C53E0040A484C250014E966 /* CZipReader.h */, - 4C53E0050A484C250014E966 /* dmfsupport.h */, 4C53E0070A484C250014E966 /* glext.h */, - 5DD480540C7D93AB00728AA9 /* IDepthBuffer.h */, - 4C53E0090A484C250014E966 /* IImagePresenter.h */, - 4C53E00A0A484C250014E966 /* Irrlicht.cpp */, - 4C53E00E0A484C250014E966 /* irrXML.cpp */, - 4C53E00F0A484C250014E966 /* ITriangleRenderer.h */, - 5DD4806A0C7D94AC00728AA9 /* CQuake3ShaderSceneNode.cpp */, - 5DD4806B0C7D94AC00728AA9 /* CQuake3ShaderSceneNode.h */, - 5DD4806C0C7D94AC00728AA9 /* CTRTextureBlend.cpp */, - 5DD4806D0C7D94AC00728AA9 /* CTRTextureGouraudAlpha.cpp */, - 5DD4806E0C7D94AC00728AA9 /* CTRTextureGouraudAlphaNoZ.cpp */, - 5DD4806F0C7D94AC00728AA9 /* CTRTextureLightMapGouraud2_M4.cpp */, 5DD480700C7D94AC00728AA9 /* glxext.h */, - 5DD4805E0C7D947B00728AA9 /* CGUIColorSelectDialog.cpp */, - 5DD4805F0C7D947B00728AA9 /* CGUIColorSelectDialog.h */, - 5DD480600C7D947B00728AA9 /* CGUISpinBox.cpp */, - 5DD480610C7D947B00728AA9 /* CGUISpinBox.h */, - 5DD480620C7D947B00728AA9 /* CGUISpriteBank.cpp */, - 5DD480630C7D947B00728AA9 /* CGUISpriteBank.h */, - 5DD480560C7D945800728AA9 /* CAnimatedMeshMD3.cpp */, - 5DD480570C7D945800728AA9 /* CAnimatedMeshMD3.h */, - 5DD480580C7D945800728AA9 /* CDefaultGUIElementFactory.cpp */, - 5DD480590C7D945800728AA9 /* CDefaultGUIElementFactory.h */, - 4C53E0110A484C250014E966 /* IZBuffer.h */, - 4C53E1690A484C2C0014E966 /* OctTree.h */, - 4C53E16A0A484C2C0014E966 /* os.cpp */, - 4C53E16B0A484C2C0014E966 /* os.h */, - 4C53E16C0A484C2C0014E966 /* S2DVertex.h */, - 4C53E16D0A484C2C0014E966 /* S4DVertex.h */, - 4C53E16E0A484C2C0014E966 /* SoftwareDriver2_compile_config.h */, - 4C53E16F0A484C2C0014E966 /* SoftwareDriver2_helper.h */, ); name = Engine; sourceTree = ""; @@ -2025,125 +2892,34 @@ 4CFA7C090A88742800B03626 /* include */ = { isa = PBXGroup; children = ( - 4CFA7C0A0A88742800B03626 /* aabbox3d.h */, - 4CFA7C0B0A88742800B03626 /* dimension2d.h */, + 0910BA4E0D1F652100D46B04 /* core */, + 0910BA4D0D1F64D000D46B04 /* gui */, + 0910BA4F0D1F65A300D46B04 /* io */, + 0910BA500D1F660300D46B04 /* scene */, + 0910BA800D1F6ADA00D46B04 /* video */, + 0910B9FD0D1F64B300D46B04 /* CMeshBuffer.h */, + 0910BA020D1F64B300D46B04 /* EGUIAlignment.h */, + 0910BA030D1F64B300D46B04 /* EHardwareBufferFlags.h */, + 0910BA040D1F64B300D46B04 /* EMaterialFlags.h */, + 0910BA050D1F64B300D46B04 /* EMaterialTypes.h */, + 0910BA070D1F64B300D46B04 /* EMessageBoxFlags.h */, + 0910BA080D1F64B300D46B04 /* ETerrainElements.h */, + 0910BA0A0D1F64B300D46B04 /* IBoneSceneNode.h */, + 0910BA110D1F64B300D46B04 /* IMeshWriter.h */, + 0910BA1D0D1F64B300D46B04 /* IReferenceCounted.h */, + 0910BA200D1F64B300D46B04 /* SMaterialLayer.h */, + 0910BA210D1F64B300D46B04 /* SSharedMeshBuffer.h */, + 0910BA220D1F64B300D46B04 /* SSkinMeshBuffer.h */, 4CFA7C0C0A88742800B03626 /* EDriverTypes.h */, - 4CFA7C0D0A88742800B03626 /* EGUIElementTypes.h */, - 4CFA7C0E0A88742800B03626 /* ESceneNodeAnimatorTypes.h */, - 4CFA7C0F0A88742800B03626 /* ESceneNodeTypes.h */, - 4CFA7C100A88742800B03626 /* heapsort.h */, - 4CFA7C110A88742900B03626 /* IAnimatedMesh.h */, - 4CFA7C120A88742900B03626 /* IAnimatedMeshB3d.h */, - 4CFA7C130A88742900B03626 /* IAnimatedMeshMD2.h */, - 4CFA7C140A88742900B03626 /* IAnimatedMeshMS3D.h */, - 4CFA7C150A88742900B03626 /* IAnimatedMeshSceneNode.h */, - 4CFA7C160A88742900B03626 /* IAnimatedMeshX.h */, - 4CFA7C170A88742900B03626 /* IAttributeExchangingObject.h */, - 4CFA7C180A88742900B03626 /* IAttributes.h */, - 4CFA7C190A88742900B03626 /* IBillboardSceneNode.h */, - 4CFA7C1A0A88742900B03626 /* ICameraSceneNode.h */, - 4CFA7C1B0A88742900B03626 /* ICursorControl.h */, - 4CFA7C1C0A88742900B03626 /* IDummyTransformationSceneNode.h */, 4CFA7C1D0A88742900B03626 /* IEventReceiver.h */, - 4CFA7C1E0A88742900B03626 /* IFileList.h */, - 4CFA7C1F0A88742900B03626 /* IFileSystem.h */, - 4CFA7C200A88742900B03626 /* IGPUProgrammingServices.h */, - 4CFA7C210A88742900B03626 /* IGUIButton.h */, - 4CFA7C220A88742900B03626 /* IGUICheckBox.h */, - 4CFA7C230A88742900B03626 /* IGUIComboBox.h */, - 4CFA7C240A88742900B03626 /* IGUIContextMenu.h */, - 4CFA7C250A88742900B03626 /* IGUIEditBox.h */, - 4CFA7C260A88742900B03626 /* IGUIElement.h */, - 4CFA7C270A88742900B03626 /* IGUIEnvironment.h */, - 4CFA7C280A88742900B03626 /* IGUIFileOpenDialog.h */, - 4CFA7C290A88742900B03626 /* IGUIFont.h */, - 4CFA7C2A0A88742900B03626 /* IGUIImage.h */, - 4CFA7C2B0A88742900B03626 /* IGUIInOutFader.h */, - 4CFA7C2C0A88742900B03626 /* IGUIListBox.h */, - 4CFA7C2D0A88742900B03626 /* IGUIMeshViewer.h */, - 4CFA7C2E0A88742900B03626 /* IGUIScrollBar.h */, - 4CFA7C2F0A88742900B03626 /* IGUISkin.h */, - 4CFA7C300A88742900B03626 /* IGUIStaticText.h */, - 4CFA7C310A88742900B03626 /* IGUITabControl.h */, - 4CFA7C320A88742900B03626 /* IGUIToolbar.h */, - 4CFA7C330A88742900B03626 /* IGUIWindow.h */, - 4CFA7C340A88742900B03626 /* IImage.h */, - 4CFA7C350A88742900B03626 /* IImageLoader.h */, 4CFA7C360A88742900B03626 /* IImageWriter.h */, - 4CFA7C370A88742900B03626 /* ILightSceneNode.h */, 4CFA7C380A88742900B03626 /* ILogger.h */, - 4CFA7C390A88742900B03626 /* IMaterialRenderer.h */, - 4CFA7C3A0A88742900B03626 /* IMaterialRendererServices.h */, - 4CFA7C3B0A88742900B03626 /* IMesh.h */, - 4CFA7C3C0A88742900B03626 /* IMeshBuffer.h */, - 4CFA7C3D0A88742900B03626 /* IMeshCache.h */, - 4CFA7C3E0A88742900B03626 /* IMeshLoader.h */, - 4CFA7C3F0A88742900B03626 /* IMeshManipulator.h */, - 4CFA7C400A88742900B03626 /* IMeshSceneNode.h */, - 4CFA7C410A88742900B03626 /* IMetaTriangleSelector.h */, 4CFA7C420A88742900B03626 /* IOSOperator.h */, - 4CFA7C430A88742900B03626 /* IParticleAffector.h */, - 4CFA7C440A88742900B03626 /* IParticleEmitter.h */, - 4CFA7C450A88742900B03626 /* IParticleSystemSceneNode.h */, - 4CFA7C460A88742900B03626 /* IQ3LevelMesh.h */, - 4CFA7C470A88742900B03626 /* IReadFile.h */, - 4CFA7C480A88742900B03626 /* irrAllocator.h */, - 4CFA7C490A88742900B03626 /* irrArray.h */, 4CFA7C4A0A88742900B03626 /* IrrCompileConfig.h */, 4CFA7C4B0A88742900B03626 /* irrlicht.h */, 4CFA7C4C0A88742900B03626 /* IrrlichtDevice.h */, - 4CFA7C4D0A88742900B03626 /* irrList.h */, - 4CFA7C4E0A88742900B03626 /* irrMath.h */, - 4CFA7C4F0A88742900B03626 /* irrString.h */, 4CFA7C500A88742900B03626 /* irrTypes.h */, - 4CFA7C510A88742900B03626 /* irrXML.h */, - 4CFA7C520A88742900B03626 /* ISceneCollisionManager.h */, - 4CFA7C530A88742900B03626 /* ISceneManager.h */, - 4CFA7C540A88742900B03626 /* ISceneNode.h */, - 4CFA7C550A88742900B03626 /* ISceneNodeAnimator.h */, - 4CFA7C560A88742900B03626 /* ISceneNodeAnimatorCollisionResponse.h */, - 4CFA7C570A88742900B03626 /* ISceneNodeAnimatorFactory.h */, - 4CFA7C580A88742900B03626 /* ISceneNodeFactory.h */, - 4CFA7C590A88742900B03626 /* ISceneUserDataSerializer.h */, - 4CFA7C5A0A88742900B03626 /* IShaderConstantSetCallBack.h */, - 4CFA7C5B0A88742900B03626 /* IShadowVolumeSceneNode.h */, - 4CFA7C5C0A88742900B03626 /* ITerrainSceneNode.h */, - 4CFA7C5D0A88742900B03626 /* ITextSceneNode.h */, - 4CFA7C5E0A88742900B03626 /* ITexture.h */, - 4CFA7C5F0A88742900B03626 /* ITimer.h */, - 4CFA7C600A88742900B03626 /* ITriangleSelector.h */, - 4CFA7C610A88742900B03626 /* IUnknown.h */, - 4CFA7C620A88742900B03626 /* IVideoDriver.h */, - 4CFA7C630A88742900B03626 /* IVideoModeList.h */, - 4CFA7C640A88742900B03626 /* IWriteFile.h */, - 4CFA7C650A88742900B03626 /* IXMLReader.h */, - 4CFA7C660A88742900B03626 /* IXMLWriter.h */, - 4CFA7C670A88742900B03626 /* Keycodes.h */, - 4CFA7C680A88742900B03626 /* line2d.h */, - 4CFA7C690A88742900B03626 /* line3d.h */, - 4CFA7C6A0A88742900B03626 /* matrix4.h */, - 4CFA7C6B0A88742900B03626 /* plane3d.h */, - 4CFA7C6C0A88742900B03626 /* position2d.h */, - 4CFA7C6D0A88742900B03626 /* quaternion.h */, - 4CFA7C6E0A88742900B03626 /* rect.h */, - 4CFA7C6F0A88742900B03626 /* S3DVertex.h */, - 4CFA7C700A88742900B03626 /* SAnimatedMesh.h */, - 4CFA7C710A88742900B03626 /* SceneParameters.h */, - 4CFA7C720A88742900B03626 /* SColor.h */, - 4CFA7C730A88742900B03626 /* SExposedVideoData.h */, 4CFA7C740A88742900B03626 /* SIrrCreationParameters.h */, - 4CFA7C750A88742900B03626 /* SKeyMap.h */, - 4CFA7C760A88742900B03626 /* SLight.h */, - 4CFA7C770A88742900B03626 /* SMaterial.h */, - 4CFA7C780A88742900B03626 /* SMesh.h */, - 4CFA7C790A88742900B03626 /* SMeshBuffer.h */, - 4CFA7C7A0A88742900B03626 /* SMeshBufferLightMap.h */, - 4CFA7C7B0A88742900B03626 /* SMeshBufferTangents.h */, - 4CFA7C7C0A88742900B03626 /* SParticle.h */, - 4CFA7C7D0A88742900B03626 /* SViewFrustrum.h */, - 4CFA7C7E0A88742900B03626 /* triangle3d.h */, - 4CFA7C7F0A88742900B03626 /* vector2d.h */, - 4CFA7C800A88742900B03626 /* vector3d.h */, ); name = include; path = ../../../include; @@ -2169,12 +2945,168 @@ 5DD480C70C7DA66800728AA9 /* COpenGLExtensionHandler.h in Headers */, 5DD480C80C7DA66800728AA9 /* CMD3MeshFileLoader.h in Headers */, 5DD480C90C7DA66800728AA9 /* CIrrDeviceSDL.h in Headers */, + 096840480D0F1A2300333EFD /* CB3DMeshFileLoader.h in Headers */, + 0968404A0D0F1A2300333EFD /* CBoneSceneNode.h in Headers */, + 0968404C0D0F1A2300333EFD /* CBSPMeshFileLoader.h in Headers */, + 0968404F0D0F1A2300333EFD /* CColladaMeshWriter.h in Headers */, + 096840510D0F1A2300333EFD /* CImageLoaderPPM.h in Headers */, + 096840550D0F1A2300333EFD /* CIrrMeshFileLoader.h in Headers */, + 096840570D0F1A2300333EFD /* CIrrMeshWriter.h in Headers */, + 096840590D0F1A2300333EFD /* CMD2MeshFileLoader.h in Headers */, + 0968405B0D0F1A2300333EFD /* CMS3DMeshFileLoader.h in Headers */, + 0968405D0D0F1A2300333EFD /* CParticleAnimatedMeshSceneNodeEmitter.h in Headers */, + 0968405F0D0F1A2300333EFD /* CParticleAttractionAffector.h in Headers */, + 096840610D0F1A2300333EFD /* CParticleCylinderEmitter.h in Headers */, + 096840630D0F1A2300333EFD /* CParticleMeshEmitter.h in Headers */, + 096840650D0F1A2300333EFD /* CParticleRingEmitter.h in Headers */, + 096840670D0F1A2300333EFD /* CParticleRotationAffector.h in Headers */, + 096840690D0F1A2300333EFD /* CParticleSphereEmitter.h in Headers */, + 0968406B0D0F1A2300333EFD /* CSkinnedMesh.h in Headers */, + 0968406D0D0F1A2300333EFD /* CSTLMeshFileLoader.h in Headers */, + 0968406F0D0F1A2300333EFD /* CSTLMeshWriter.h in Headers */, + 0910B9E00D1F5D4100D46B04 /* CGUITable.h in Headers */, + 0910B9E20D1F5D4100D46B04 /* CImageLoaderWAL.h in Headers */, + 0910BA240D1F64B300D46B04 /* CMeshBuffer.h in Headers */, + 0910BA250D1F64B300D46B04 /* coreutil.h in Headers */, + 0910BA260D1F64B300D46B04 /* ECullingTypes.h in Headers */, + 0910BA270D1F64B300D46B04 /* EDebugSceneTypes.h in Headers */, + 0910BA280D1F64B300D46B04 /* EDriverFeatures.h in Headers */, + 0910BA290D1F64B300D46B04 /* EGUIAlignment.h in Headers */, + 0910BA2A0D1F64B300D46B04 /* EHardwareBufferFlags.h in Headers */, + 0910BA2B0D1F64B300D46B04 /* EMaterialFlags.h in Headers */, + 0910BA2C0D1F64B300D46B04 /* EMaterialTypes.h in Headers */, + 0910BA2D0D1F64B300D46B04 /* EMeshWriterEnums.h in Headers */, + 0910BA2E0D1F64B300D46B04 /* EMessageBoxFlags.h in Headers */, + 0910BA2F0D1F64B300D46B04 /* ETerrainElements.h in Headers */, + 0910BA300D1F64B300D46B04 /* IAnimatedMeshMD3.h in Headers */, + 0910BA310D1F64B300D46B04 /* IBoneSceneNode.h in Headers */, + 0910BA320D1F64B300D46B04 /* IGUIColorSelectDialog.h in Headers */, + 0910BA330D1F64B300D46B04 /* IGUIElementFactory.h in Headers */, + 0910BA340D1F64B300D46B04 /* IGUIFontBitmap.h in Headers */, + 0910BA350D1F64B300D46B04 /* IGUISpinBox.h in Headers */, + 0910BA360D1F64B300D46B04 /* IGUISpriteBank.h in Headers */, + 0910BA370D1F64B300D46B04 /* IGUITable.h in Headers */, + 0910BA380D1F64B300D46B04 /* IMeshWriter.h in Headers */, + 0910BA390D1F64B300D46B04 /* IParticleAnimatedMeshSceneNodeEmitter.h in Headers */, + 0910BA3A0D1F64B300D46B04 /* IParticleAttractionAffector.h in Headers */, + 0910BA3B0D1F64B300D46B04 /* IParticleBoxEmitter.h in Headers */, + 0910BA3C0D1F64B300D46B04 /* IParticleCylinderEmitter.h in Headers */, + 0910BA3D0D1F64B300D46B04 /* IParticleFadeOutAffector.h in Headers */, + 0910BA3E0D1F64B300D46B04 /* IParticleGravityAffector.h in Headers */, + 0910BA3F0D1F64B300D46B04 /* IParticleMeshEmitter.h in Headers */, + 0910BA400D1F64B300D46B04 /* IParticleRingEmitter.h in Headers */, + 0910BA410D1F64B300D46B04 /* IParticleRotationAffector.h in Headers */, + 0910BA420D1F64B300D46B04 /* IParticleSphereEmitter.h in Headers */, + 0910BA430D1F64B300D46B04 /* IQ3Shader.h in Headers */, + 0910BA440D1F64B300D46B04 /* IReferenceCounted.h in Headers */, + 0910BA450D1F64B300D46B04 /* irrMap.h in Headers */, + 0910BA460D1F64B300D46B04 /* ISkinnedMesh.h in Headers */, + 0910BA470D1F64B300D46B04 /* SMaterialLayer.h in Headers */, + 0910BA480D1F64B300D46B04 /* SSharedMeshBuffer.h in Headers */, + 0910BA490D1F64B300D46B04 /* SSkinMeshBuffer.h in Headers */, + 0910BA4A0D1F64B300D46B04 /* SViewFrustum.h in Headers */, + 090FBC830D31085E0076D847 /* CVolumeLightSceneNode.h in Headers */, + 09C638730D4F1A69000B6A18 /* CLWOMeshFileLoader.h in Headers */, + 093973C10E0458B200E0C987 /* CSceneNodeAnimatorCameraFPS.h in Headers */, + 093973C30E0458B200E0C987 /* CSceneNodeAnimatorCameraMaya.h in Headers */, + 096F8E3E0EA2EFBA00907EC5 /* COBJMeshWriter.h in Headers */, + 096CC0E10ECE65B500C81DC7 /* CParticleScaleAffector.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ + 09022C520EA0E97F00CD54EE /* GUIEditor */ = { + isa = PBXNativeTarget; + buildConfigurationList = 09022C5F0EA0E97F00CD54EE /* Build configuration list for PBXNativeTarget "GUIEditor" */; + buildPhases = ( + 09022C550EA0E97F00CD54EE /* Resources */, + 09022C580EA0E97F00CD54EE /* Sources */, + 09022C5A0EA0E97F00CD54EE /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 09022C530EA0E97F00CD54EE /* PBXTargetDependency */, + ); + name = GUIEditor; + productName = DemoApp; + productReference = 09022C620EA0E97F00CD54EE /* GUIEditor.app */; + productType = "com.apple.product-type.application"; + }; + 0946CCA30EC99BBE00D945A5 /* MouseAndJoystick */ = { + isa = PBXNativeTarget; + buildConfigurationList = 0946CCB10EC99BBE00D945A5 /* Build configuration list for PBXNativeTarget "MouseAndJoystick" */; + buildPhases = ( + 0946CCA60EC99BBE00D945A5 /* Resources */, + 0946CCA90EC99BBE00D945A5 /* Sources */, + 0946CCAB0EC99BBE00D945A5 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 0946CCA40EC99BBE00D945A5 /* PBXTargetDependency */, + ); + name = MouseAndJoystick; + productName = DemoApp; + productReference = 0946CCB40EC99BBE00D945A5 /* MouseAndJoystick.app */; + productType = "com.apple.product-type.application"; + }; + 09F648F40D2CDED9001E0599 /* HelloWorld */ = { + isa = PBXNativeTarget; + buildConfigurationList = 09F649000D2CDED9001E0599 /* Build configuration list for PBXNativeTarget "HelloWorld" */; + buildPhases = ( + 09F648F70D2CDED9001E0599 /* Resources */, + 09F648FA0D2CDED9001E0599 /* Sources */, + 09F648FC0D2CDED9001E0599 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 09F648F50D2CDED9001E0599 /* PBXTargetDependency */, + ); + name = HelloWorld; + productName = DemoApp; + productReference = 09F649030D2CDED9001E0599 /* HelloWorld.app */; + productType = "com.apple.product-type.application"; + }; + 09F6492F0D2CE03E001E0599 /* LoadIrrFile */ = { + isa = PBXNativeTarget; + buildConfigurationList = 09F6493B0D2CE03E001E0599 /* Build configuration list for PBXNativeTarget "LoadIrrFile" */; + buildPhases = ( + 09F649320D2CE03E001E0599 /* Resources */, + 09F649350D2CE03E001E0599 /* Sources */, + 09F649370D2CE03E001E0599 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 09F649300D2CE03E001E0599 /* PBXTargetDependency */, + ); + name = LoadIrrFile; + productName = DemoApp; + productReference = 09F6493E0D2CE03E001E0599 /* LoadIrrFile.app */; + productType = "com.apple.product-type.application"; + }; + 09F649560D2CE206001E0599 /* Quake3Shader */ = { + isa = PBXNativeTarget; + buildConfigurationList = 09F649620D2CE206001E0599 /* Build configuration list for PBXNativeTarget "Quake3Shader" */; + buildPhases = ( + 09F649590D2CE206001E0599 /* Resources */, + 09F6495C0D2CE206001E0599 /* Sources */, + 09F6495E0D2CE206001E0599 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 09F649570D2CE206001E0599 /* PBXTargetDependency */, + ); + name = Quake3Shader; + productName = DemoApp; + productReference = 09F649650D2CE206001E0599 /* Quake3Shader.app */; + productType = "com.apple.product-type.application"; + }; B81CFDFE097FD9F50057C06F /* 2DGraphics */ = { isa = PBXNativeTarget; buildConfigurationList = B81CFE0C097FD9F50057C06F /* Build configuration list for PBXNativeTarget "2DGraphics" */; @@ -2452,11 +3384,61 @@ B81CFFAF097FE5F80057C06F /* RenderToTexture */, B8DEF35C0950229200FDEA7E /* Demo */, B81CFFC6097FE9980057C06F /* All */, + 09F648F40D2CDED9001E0599 /* HelloWorld */, + 09F6492F0D2CE03E001E0599 /* LoadIrrFile */, + 09F649560D2CE206001E0599 /* Quake3Shader */, + 09022C520EA0E97F00CD54EE /* GUIEditor */, + 0946CCA30EC99BBE00D945A5 /* MouseAndJoystick */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 09022C550EA0E97F00CD54EE /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 09022C560EA0E97F00CD54EE /* MainMenu.nib in Resources */, + 09022C570EA0E97F00CD54EE /* DemoApp-Info.plist in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 0946CCA60EC99BBE00D945A5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0946CCA70EC99BBE00D945A5 /* MainMenu.nib in Resources */, + 0946CCA80EC99BBE00D945A5 /* DemoApp-Info.plist in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 09F648F70D2CDED9001E0599 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 09F648F80D2CDED9001E0599 /* MainMenu.nib in Resources */, + 09F648F90D2CDED9001E0599 /* DemoApp-Info.plist in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 09F649320D2CE03E001E0599 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 09F649330D2CE03E001E0599 /* MainMenu.nib in Resources */, + 09F649340D2CE03E001E0599 /* DemoApp-Info.plist in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 09F649590D2CE206001E0599 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 09F6495A0D2CE206001E0599 /* MainMenu.nib in Resources */, + 09F6495B0D2CE206001E0599 /* DemoApp-Info.plist in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; B81CFE01097FD9F50057C06F /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -2577,6 +3559,53 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 09022C580EA0E97F00CD54EE /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 09022C7E0EA0EA9D00CD54EE /* CGUIAttributeEditor.cpp in Sources */, + 09022C7F0EA0EA9D00CD54EE /* CGUIEditFactory.cpp in Sources */, + 09022C800EA0EA9D00CD54EE /* CGUIEditWindow.cpp in Sources */, + 09022C810EA0EA9D00CD54EE /* CGUIEditWorkspace.cpp in Sources */, + 09022C820EA0EA9D00CD54EE /* CGUIPanel.cpp in Sources */, + 09022C830EA0EA9D00CD54EE /* CGUITextureCacheBrowser.cpp in Sources */, + 09022C840EA0EA9D00CD54EE /* CMemoryReadWriteFile.cpp in Sources */, + 09022C850EA0EA9D00CD54EE /* main.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 0946CCA90EC99BBE00D945A5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0946CCCB0EC99C6E00D945A5 /* main.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 09F648FA0D2CDED9001E0599 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 09F6491A0D2CDF9A001E0599 /* main.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 09F649350D2CE03E001E0599 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 09F460EB0D3223ED00D0A9B0 /* main.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 09F6495C0D2CE206001E0599 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 09F649740D2CE2D0001E0599 /* main.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; B81CFE03097FD9F50057C06F /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -2746,29 +3775,16 @@ 4CA25C1A0A485EAD00B4E469 /* wrppm.c in Sources */, 4CA25C1B0A485EAD00B4E469 /* wrrle.c in Sources */, 4CA25C1C0A485EAD00B4E469 /* wrtarga.c in Sources */, - 4C53E3B30A4856B30014E966 /* pngrutil.c in Sources */, - 4C53E3BB0A4856B30014E966 /* pngget.c in Sources */, - 4C53E3C40A4856B30014E966 /* pngrtran.c in Sources */, - 4C53E3C90A4856B30014E966 /* pngerror.c in Sources */, 4C53E3CA0A4856B30014E966 /* gzio.c in Sources */, - 4C53E3D70A4856B30014E966 /* pngtrans.c in Sources */, 4C53E3D80A4856B30014E966 /* inffast.c in Sources */, 4C53E3DC0A4856B30014E966 /* inftrees.c in Sources */, 4C53E3E40A4856B30014E966 /* uncompr.c in Sources */, - 4C53E3E90A4856B30014E966 /* pngset.c in Sources */, - 4C53E3EE0A4856B30014E966 /* pngrio.c in Sources */, 4C53E3F30A4856B30014E966 /* compress.c in Sources */, 4C53E3F60A4856B30014E966 /* crc32.c in Sources */, 4C53E3FE0A4856B30014E966 /* zutil.c in Sources */, 4C53E4010A4856B30014E966 /* trees.c in Sources */, - 4C53E4030A4856B30014E966 /* pngwio.c in Sources */, - 4C53E4040A4856B30014E966 /* pngmem.c in Sources */, 4C53E40A0A4856B30014E966 /* deflate.c in Sources */, - 4C53E4110A4856B30014E966 /* pngpread.c in Sources */, - 4C53E4140A4856B30014E966 /* png.c in Sources */, 4C53E4150A4856B30014E966 /* adler32.c in Sources */, - 4C53E4160A4856B30014E966 /* pngwtran.c in Sources */, - 4C53E41A0A4856B30014E966 /* pngwutil.c in Sources */, 4C53E4280A4856B30014E966 /* CImageLoaderPNG.cpp in Sources */, 4C53E4290A4856B30014E966 /* CColorConverter.cpp in Sources */, 4C53E42A0A4856B30014E966 /* CSceneManager.cpp in Sources */, @@ -2804,7 +3820,6 @@ 4C53E4490A4856B30014E966 /* CTRTextureDetailMap2.cpp in Sources */, 4C53E44A0A4856B30014E966 /* CTRTextureGouraudAddNoZ2.cpp in Sources */, 4C53E44C0A4856B30014E966 /* CTRTextureGouraudNoZ.cpp in Sources */, - 4C53E44D0A4856B30014E966 /* CXFileReader.cpp in Sources */, 4C53E44E0A4856B30014E966 /* CGUIScrollBar.cpp in Sources */, 4C53E44F0A4856B30014E966 /* CSceneCollisionManager.cpp in Sources */, 4C53E4500A4856B30014E966 /* CGUICheckBox.cpp in Sources */, @@ -2826,7 +3841,6 @@ 4C53E4600A4856B30014E966 /* CTRTextureLightMap2_Add.cpp in Sources */, 4C53E4610A4856B30014E966 /* CReadFile.cpp in Sources */, 4C53E4620A4856B30014E966 /* COpenGLTexture.cpp in Sources */, - 4C53E4630A4856B30014E966 /* CAnimatedMeshMS3D.cpp in Sources */, 4C53E4640A4856B30014E966 /* COSOperator.cpp in Sources */, 4C53E4650A4856B30014E966 /* CMemoryReadFile.cpp in Sources */, 4C53E4660A4856B30014E966 /* CColladaFileLoader.cpp in Sources */, @@ -2836,7 +3850,6 @@ 4C53E46A0A4856B30014E966 /* CVideoModeList.cpp in Sources */, 4C53E46B0A4856B30014E966 /* CXMLReader.cpp in Sources */, 4C53E46C0A4856B30014E966 /* COpenGLParallaxMapRenderer.cpp in Sources */, - 4C53E46D0A4856B30014E966 /* CDefaultMeshFormatLoader.cpp in Sources */, 4C53E46E0A4856B30014E966 /* CTRTextureGouraudNoZ2.cpp in Sources */, 4C53E46F0A4856B30014E966 /* CTRTextureGouraudWire.cpp in Sources */, 4C53E4700A4856B30014E966 /* CParticlePointEmitter.cpp in Sources */, @@ -2868,7 +3881,6 @@ 4C53E48A0A4856B30014E966 /* COctTreeSceneNode.cpp in Sources */, 4C53E48B0A4856B30014E966 /* CParticleSystemSceneNode.cpp in Sources */, 4C53E48C0A4856B30014E966 /* CTerrainSceneNode.cpp in Sources */, - 4C53E48D0A4856B30014E966 /* CCameraFPSSceneNode.cpp in Sources */, 4C53E48E0A4856B30014E966 /* CGUIFont.cpp in Sources */, 4C53E48F0A4856B30014E966 /* CParticleFadeOutAffector.cpp in Sources */, 4C53E4910A4856B30014E966 /* CDummyTransformationSceneNode.cpp in Sources */, @@ -2897,8 +3909,6 @@ 4C53E4A80A4856B30014E966 /* CLogger.cpp in Sources */, 4C53E4A90A4856B30014E966 /* CGUIInOutFader.cpp in Sources */, 4C53E4AA0A4856B30014E966 /* CWriteFile.cpp in Sources */, - 4C53E4AB0A4856B30014E966 /* CXAnimationPlayer.cpp in Sources */, - 4C53E4AC0A4856B30014E966 /* CCameraMayaSceneNode.cpp in Sources */, 4C53E4AD0A4856B30014E966 /* CTRTextureGouraud.cpp in Sources */, 4C53E4AE0A4856B30014E966 /* CTRFlat.cpp in Sources */, 4C53E4AF0A4856B30014E966 /* CTerrainTriangleSelector.cpp in Sources */, @@ -2922,11 +3932,9 @@ 4C53E57E0A4856B30014E966 /* OSXClipboard.mm in Sources */, 4C53E57F0A4856B30014E966 /* CIrrDeviceMacOSX.mm in Sources */, 4C53E5800A4856B30014E966 /* AppDelegate.mm in Sources */, - 4C53E62E0A485ABF0014E966 /* pngread.c in Sources */, 4C6DC9B70A48715A0017A6E5 /* inflate.c in Sources */, 4CC36B0F0A6B61DB0076C4B2 /* CSphereSceneNode.cpp in Sources */, 4C364EA40A6C6DC2004CFBB4 /* COBJMeshFileLoader.cpp in Sources */, - 4C43EEBC0A74A5A300F942FC /* CAnimatedMeshB3d.cpp in Sources */, 4C43EEC00A74A5C800F942FC /* CPakReader.cpp in Sources */, 4CFA7BEE0A88735A00B03626 /* CImageLoaderBMP.cpp in Sources */, 4CFA7BF00A88735A00B03626 /* CImageWriterBMP.cpp in Sources */, @@ -2937,7 +3945,6 @@ 4CFA7BFA0A88735A00B03626 /* CImageWriterPSD.cpp in Sources */, 4CFA7BFC0A88735A00B03626 /* CImageWriterTGA.cpp in Sources */, 4CFA7BFE0A88735A00B03626 /* CSkyDomeSceneNode.cpp in Sources */, - 5DD480480C7D8B9100728AA9 /* pngwrite.c in Sources */, 5DD4804E0C7D91DF00728AA9 /* CDepthBuffer.cpp in Sources */, 5DD480520C7D936700728AA9 /* IBurningShader.cpp in Sources */, 5DD4805A0C7D945800728AA9 /* CAnimatedMeshMD3.cpp in Sources */, @@ -2953,12 +3960,106 @@ 5DD480CA0C7DA66800728AA9 /* CIrrDeviceSDL.cpp in Sources */, 5DD480CB0C7DA66800728AA9 /* COpenGLExtensionHandler.cpp in Sources */, 5DD480CC0C7DA66800728AA9 /* CMD3MeshFileLoader.cpp in Sources */, + 096840470D0F1A2300333EFD /* CB3DMeshFileLoader.cpp in Sources */, + 096840490D0F1A2300333EFD /* CBoneSceneNode.cpp in Sources */, + 0968404B0D0F1A2300333EFD /* CBSPMeshFileLoader.cpp in Sources */, + 0968404E0D0F1A2300333EFD /* CColladaMeshWriter.cpp in Sources */, + 096840500D0F1A2300333EFD /* CImageLoaderPPM.cpp in Sources */, + 096840540D0F1A2300333EFD /* CIrrMeshFileLoader.cpp in Sources */, + 096840560D0F1A2300333EFD /* CIrrMeshWriter.cpp in Sources */, + 096840580D0F1A2300333EFD /* CMD2MeshFileLoader.cpp in Sources */, + 0968405A0D0F1A2300333EFD /* CMS3DMeshFileLoader.cpp in Sources */, + 0968405C0D0F1A2300333EFD /* CParticleAnimatedMeshSceneNodeEmitter.cpp in Sources */, + 0968405E0D0F1A2300333EFD /* CParticleAttractionAffector.cpp in Sources */, + 096840600D0F1A2300333EFD /* CParticleCylinderEmitter.cpp in Sources */, + 096840620D0F1A2300333EFD /* CParticleMeshEmitter.cpp in Sources */, + 096840640D0F1A2300333EFD /* CParticleRingEmitter.cpp in Sources */, + 096840660D0F1A2300333EFD /* CParticleRotationAffector.cpp in Sources */, + 096840680D0F1A2300333EFD /* CParticleSphereEmitter.cpp in Sources */, + 0968406A0D0F1A2300333EFD /* CSkinnedMesh.cpp in Sources */, + 0968406C0D0F1A2300333EFD /* CSTLMeshFileLoader.cpp in Sources */, + 0968406E0D0F1A2300333EFD /* CSTLMeshWriter.cpp in Sources */, + 0910B9DE0D1F5D4100D46B04 /* CBurningShader_Raster_Reference.cpp in Sources */, + 0910B9DF0D1F5D4100D46B04 /* CGUITable.cpp in Sources */, + 0910B9E10D1F5D4100D46B04 /* CImageLoaderWAL.cpp in Sources */, + 090FBC820D31085E0076D847 /* CVolumeLightSceneNode.cpp in Sources */, + 09C638720D4F1A69000B6A18 /* CLWOMeshFileLoader.cpp in Sources */, + 093973C00E0458B200E0C987 /* CSceneNodeAnimatorCameraFPS.cpp in Sources */, + 093973C20E0458B200E0C987 /* CSceneNodeAnimatorCameraMaya.cpp in Sources */, + 096F8E3D0EA2EFBA00907EC5 /* COBJMeshWriter.cpp in Sources */, + 096CC0E00ECE65B500C81DC7 /* CParticleScaleAffector.cpp in Sources */, + 09293C3E0ED32029003B8C9C /* png.c in Sources */, + 09293C3F0ED32029003B8C9C /* pngerror.c in Sources */, + 09293C400ED32029003B8C9C /* pnggccrd.c in Sources */, + 09293C410ED32029003B8C9C /* pngget.c in Sources */, + 09293C420ED32029003B8C9C /* pngmem.c in Sources */, + 09293C430ED32029003B8C9C /* pngpread.c in Sources */, + 09293C440ED32029003B8C9C /* pngread.c in Sources */, + 09293C450ED32029003B8C9C /* pngrio.c in Sources */, + 09293C460ED32029003B8C9C /* pngrtran.c in Sources */, + 09293C470ED32029003B8C9C /* pngrutil.c in Sources */, + 09293C480ED32029003B8C9C /* pngset.c in Sources */, + 09293C4A0ED32029003B8C9C /* pngtrans.c in Sources */, + 09293C4C0ED32029003B8C9C /* pngwio.c in Sources */, + 09293C4D0ED32029003B8C9C /* pngwrite.c in Sources */, + 09293C4E0ED32029003B8C9C /* pngwtran.c in Sources */, + 09293C4F0ED32029003B8C9C /* pngwutil.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + 09022C530EA0E97F00CD54EE /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D2AAC07D0554694100DB518D /* libIrrlicht.a */; + targetProxy = 09022C540EA0E97F00CD54EE /* PBXContainerItemProxy */; + }; + 0946CCA40EC99BBE00D945A5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D2AAC07D0554694100DB518D /* libIrrlicht.a */; + targetProxy = 0946CCA50EC99BBE00D945A5 /* PBXContainerItemProxy */; + }; + 0946CCD60EC99D8200D945A5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 0946CCA30EC99BBE00D945A5 /* MouseAndJoystick */; + targetProxy = 0946CCD50EC99D8200D945A5 /* PBXContainerItemProxy */; + }; + 0946CCD90EC99D8C00D945A5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 09022C520EA0E97F00CD54EE /* GUIEditor */; + targetProxy = 0946CCD80EC99D8C00D945A5 /* PBXContainerItemProxy */; + }; + 09F648F50D2CDED9001E0599 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D2AAC07D0554694100DB518D /* libIrrlicht.a */; + targetProxy = 09F648F60D2CDED9001E0599 /* PBXContainerItemProxy */; + }; + 09F649210D2CDFF0001E0599 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 09F648F40D2CDED9001E0599 /* HelloWorld */; + targetProxy = 09F649200D2CDFF0001E0599 /* PBXContainerItemProxy */; + }; + 09F649300D2CE03E001E0599 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D2AAC07D0554694100DB518D /* libIrrlicht.a */; + targetProxy = 09F649310D2CE03E001E0599 /* PBXContainerItemProxy */; + }; + 09F649450D2CE100001E0599 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 09F6492F0D2CE03E001E0599 /* LoadIrrFile */; + targetProxy = 09F649440D2CE100001E0599 /* PBXContainerItemProxy */; + }; + 09F649570D2CE206001E0599 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D2AAC07D0554694100DB518D /* libIrrlicht.a */; + targetProxy = 09F649580D2CE206001E0599 /* PBXContainerItemProxy */; + }; + 09F649720D2CE2A1001E0599 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 09F649560D2CE206001E0599 /* Quake3Shader */; + targetProxy = 09F649710D2CE2A1001E0599 /* PBXContainerItemProxy */; + }; 4CA5CB820A4868B500ADB3D7 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = B8DEF35C0950229200FDEA7E /* Demo */; @@ -3092,6 +4193,349 @@ /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ + 09022C600EA0E97F00CD54EE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + DEPLOYMENT_LOCATION = YES; + DSTROOT = ../../../bin/MacOSX; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + INFOPLIST_FILE = "DemoApp-Info.plist"; + INSTALL_PATH = /; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_1)", + ); + LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/build/Debug\""; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = GUIEditor_dbg; + WRAPPER_EXTENSION = app; + ZERO_LINK = YES; + }; + name = Debug; + }; + 09022C610EA0E97F00CD54EE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DEAD_CODE_STRIPPING = YES; + DEPLOYMENT_LOCATION = YES; + DEPLOYMENT_POSTPROCESSING = YES; + DSTROOT = ../../../bin/MacOSX; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + INFOPLIST_FILE = "DemoApp-Info.plist"; + INSTALL_PATH = /; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_1)", + ); + LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/build/Debug\""; + ONLY_LINK_ESSENTIAL_SYMBOLS = YES; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = GUIEditor; + SEPARATE_STRIP = YES; + STRIP_INSTALLED_PRODUCT = YES; + WRAPPER_EXTENSION = app; + ZERO_LINK = NO; + }; + name = Release; + }; + 0946CCB20EC99BBE00D945A5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + ppc, + i386, + ); + COPY_PHASE_STRIP = NO; + DEPLOYMENT_LOCATION = YES; + DSTROOT = ../../../bin/MacOSX; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + INFOPLIST_FILE = "DemoApp-Info.plist"; + INSTALL_PATH = /; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = MouseAndJoystick_dbg; + WRAPPER_EXTENSION = app; + ZERO_LINK = YES; + }; + name = Debug; + }; + 0946CCB30EC99BBE00D945A5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + ppc, + i386, + ); + COPY_PHASE_STRIP = YES; + DEAD_CODE_STRIPPING = YES; + DEPLOYMENT_LOCATION = YES; + DEPLOYMENT_POSTPROCESSING = YES; + DSTROOT = ../../../bin/MacOSX; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + INFOPLIST_FILE = "DemoApp-Info.plist"; + INSTALL_PATH = /; + ONLY_LINK_ESSENTIAL_SYMBOLS = YES; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = MouseAndJoystick; + SEPARATE_STRIP = YES; + STRIP_INSTALLED_PRODUCT = YES; + WRAPPER_EXTENSION = app; + ZERO_LINK = NO; + }; + name = Release; + }; + 09F649010D2CDED9001E0599 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + DEPLOYMENT_LOCATION = YES; + DSTROOT = ../../../bin/MacOSX; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + INFOPLIST_FILE = "DemoApp-Info.plist"; + INSTALL_PATH = /; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_1)", + ); + LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/build/Debug\""; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = HelloWorld_dbg; + WRAPPER_EXTENSION = app; + ZERO_LINK = YES; + }; + name = Debug; + }; + 09F649020D2CDED9001E0599 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DEAD_CODE_STRIPPING = YES; + DEPLOYMENT_LOCATION = YES; + DEPLOYMENT_POSTPROCESSING = YES; + DSTROOT = ../../../bin/MacOSX; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + INFOPLIST_FILE = "DemoApp-Info.plist"; + INSTALL_PATH = /; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_1)", + ); + LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/build/Debug\""; + ONLY_LINK_ESSENTIAL_SYMBOLS = YES; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = HelloWorld; + SEPARATE_STRIP = YES; + STRIP_INSTALLED_PRODUCT = YES; + WRAPPER_EXTENSION = app; + ZERO_LINK = NO; + }; + name = Release; + }; + 09F6493C0D2CE03E001E0599 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + DEPLOYMENT_LOCATION = YES; + DSTROOT = ../../../bin/MacOSX; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + INFOPLIST_FILE = "DemoApp-Info.plist"; + INSTALL_PATH = /; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_1)", + ); + LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/build/Debug\""; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = LoadIrrFile_dbg; + WRAPPER_EXTENSION = app; + ZERO_LINK = YES; + }; + name = Debug; + }; + 09F6493D0D2CE03E001E0599 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DEAD_CODE_STRIPPING = YES; + DEPLOYMENT_LOCATION = YES; + DEPLOYMENT_POSTPROCESSING = YES; + DSTROOT = ../../../bin/MacOSX; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + INFOPLIST_FILE = "DemoApp-Info.plist"; + INSTALL_PATH = /; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_1)", + ); + LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/build/Debug\""; + ONLY_LINK_ESSENTIAL_SYMBOLS = YES; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = LoadIrrFile; + SEPARATE_STRIP = YES; + STRIP_INSTALLED_PRODUCT = YES; + WRAPPER_EXTENSION = app; + ZERO_LINK = NO; + }; + name = Release; + }; + 09F649630D2CE206001E0599 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + DEPLOYMENT_LOCATION = YES; + DSTROOT = ../../../bin/MacOSX; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + INFOPLIST_FILE = "DemoApp-Info.plist"; + INSTALL_PATH = /; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_1)", + ); + LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/build/Debug\""; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = Quake3Shader_dbg; + WRAPPER_EXTENSION = app; + ZERO_LINK = YES; + }; + name = Debug; + }; + 09F649640D2CE206001E0599 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DEAD_CODE_STRIPPING = YES; + DEPLOYMENT_LOCATION = YES; + DEPLOYMENT_POSTPROCESSING = YES; + DSTROOT = ../../../bin/MacOSX; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + INFOPLIST_FILE = "DemoApp-Info.plist"; + INSTALL_PATH = /; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_1)", + ); + LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/build/Debug\""; + ONLY_LINK_ESSENTIAL_SYMBOLS = YES; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = Quake3Shader; + SEPARATE_STRIP = YES; + STRIP_INSTALLED_PRODUCT = YES; + WRAPPER_EXTENSION = app; + ZERO_LINK = NO; + }; + name = Release; + }; 1DEB921F08733DC00010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -3174,6 +4618,8 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; + DEPLOYMENT_LOCATION = YES; + DSTROOT = ../../../bin/MacOSX; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -3182,7 +4628,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; INFOPLIST_FILE = "DemoApp-Info.plist"; - INSTALL_PATH = "$(HOME)/Applications"; + INSTALL_PATH = /; OTHER_LDFLAGS = ( "-framework", Foundation, @@ -3190,7 +4636,7 @@ AppKit, ); PREBINDING = NO; - PRODUCT_NAME = 2DGraphics; + PRODUCT_NAME = 2DGraphics_dbg; WRAPPER_EXTENSION = app; ZERO_LINK = YES; }; @@ -3231,6 +4677,8 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; + DEPLOYMENT_LOCATION = YES; + DSTROOT = ../../../bin/MacOSX; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -3239,7 +4687,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; INFOPLIST_FILE = "DemoApp-Info.plist"; - INSTALL_PATH = "$(HOME)/Applications"; + INSTALL_PATH = /; OTHER_LDFLAGS = ( "-framework", Foundation, @@ -3247,7 +4695,7 @@ AppKit, ); PREBINDING = NO; - PRODUCT_NAME = Collision; + PRODUCT_NAME = Collision_dbg; WRAPPER_EXTENSION = app; ZERO_LINK = YES; }; @@ -3288,6 +4736,8 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; + DEPLOYMENT_LOCATION = YES; + DSTROOT = ../../../bin/MacOSX; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -3296,7 +4746,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; INFOPLIST_FILE = "DemoApp-Info.plist"; - INSTALL_PATH = "$(HOME)/Applications"; + INSTALL_PATH = /; OTHER_LDFLAGS = ( "-framework", Foundation, @@ -3304,7 +4754,7 @@ AppKit, ); PREBINDING = NO; - PRODUCT_NAME = PerPixelLighting; + PRODUCT_NAME = PerPixelLighting_dbg; WRAPPER_EXTENSION = app; ZERO_LINK = YES; }; @@ -3346,6 +4796,8 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; + DEPLOYMENT_LOCATION = YES; + DSTROOT = ../../../bin/MacOSX; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -3354,7 +4806,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; INFOPLIST_FILE = "DemoApp-Info.plist"; - INSTALL_PATH = "$(HOME)/Applications"; + INSTALL_PATH = /; OTHER_LDFLAGS = ( "-framework", Foundation, @@ -3362,7 +4814,7 @@ AppKit, ); PREBINDING = NO; - PRODUCT_NAME = TerrainRendering; + PRODUCT_NAME = TerrainRendering_dbg; WRAPPER_EXTENSION = app; ZERO_LINK = YES; }; @@ -3403,6 +4855,8 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; + DEPLOYMENT_LOCATION = YES; + DSTROOT = ../../../bin/MacOSX; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -3411,7 +4865,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; INFOPLIST_FILE = "DemoApp-Info.plist"; - INSTALL_PATH = "$(HOME)/Applications"; + INSTALL_PATH = /; OTHER_LDFLAGS = ( "-framework", Foundation, @@ -3419,7 +4873,7 @@ AppKit, ); PREBINDING = NO; - PRODUCT_NAME = SpecialFx; + PRODUCT_NAME = SpecialFx_dbg; WRAPPER_EXTENSION = app; ZERO_LINK = YES; }; @@ -3460,6 +4914,8 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; + DEPLOYMENT_LOCATION = YES; + DSTROOT = ../../../bin/MacOSX; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -3468,7 +4924,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; INFOPLIST_FILE = "DemoApp-Info.plist"; - INSTALL_PATH = "$(HOME)/Applications"; + INSTALL_PATH = /; OTHER_LDFLAGS = ( "-framework", Foundation, @@ -3476,7 +4932,7 @@ AppKit, ); PREBINDING = NO; - PRODUCT_NAME = UserInterface; + PRODUCT_NAME = UserInterface_dbg; WRAPPER_EXTENSION = app; ZERO_LINK = YES; }; @@ -3517,6 +4973,8 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; + DEPLOYMENT_LOCATION = YES; + DSTROOT = ../../../bin/MacOSX; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -3525,7 +4983,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; INFOPLIST_FILE = "DemoApp-Info.plist"; - INSTALL_PATH = "$(HOME)/Applications"; + INSTALL_PATH = /; OTHER_LDFLAGS = ( "-framework", Foundation, @@ -3533,7 +4991,7 @@ AppKit, ); PREBINDING = NO; - PRODUCT_NAME = CustomSceneNode; + PRODUCT_NAME = CustomSceneNode_dbg; WRAPPER_EXTENSION = app; ZERO_LINK = YES; }; @@ -3574,6 +5032,8 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; + DEPLOYMENT_LOCATION = YES; + DSTROOT = ../../../bin/MacOSX; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -3582,7 +5042,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; INFOPLIST_FILE = "DemoApp-Info.plist"; - INSTALL_PATH = "$(HOME)/Applications"; + INSTALL_PATH = /; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(LIBRARY_SEARCH_PATHS_QUOTED_1)", @@ -3595,7 +5055,7 @@ AppKit, ); PREBINDING = NO; - PRODUCT_NAME = Quake3Map; + PRODUCT_NAME = Quake3Map_dbg; WRAPPER_EXTENSION = app; ZERO_LINK = YES; }; @@ -3641,6 +5101,8 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; + DEPLOYMENT_LOCATION = YES; + DSTROOT = ../../../bin/MacOSX; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -3649,7 +5111,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; INFOPLIST_FILE = "DemoApp-Info.plist"; - INSTALL_PATH = "$(HOME)/Applications"; + INSTALL_PATH = /; OTHER_LDFLAGS = ( "-framework", Foundation, @@ -3657,7 +5119,7 @@ AppKit, ); PREBINDING = NO; - PRODUCT_NAME = Shaders; + PRODUCT_NAME = Shaders_dbg; WRAPPER_EXTENSION = app; ZERO_LINK = YES; }; @@ -3702,6 +5164,8 @@ i386, ); COPY_PHASE_STRIP = NO; + DEPLOYMENT_LOCATION = YES; + DSTROOT = ../../../bin/MacOSX; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -3710,7 +5174,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; INFOPLIST_FILE = "DemoApp-Info.plist"; - INSTALL_PATH = "$(HOME)/Applications"; + INSTALL_PATH = /; OTHER_LDFLAGS = ( "-framework", Foundation, @@ -3718,7 +5182,7 @@ AppKit, ); PREBINDING = NO; - PRODUCT_NAME = Movement; + PRODUCT_NAME = Movement_dbg; WRAPPER_EXTENSION = app; ZERO_LINK = YES; }; @@ -3763,6 +5227,8 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; + DEPLOYMENT_LOCATION = YES; + DSTROOT = ../../../bin/MacOSX; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -3771,7 +5237,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; INFOPLIST_FILE = "DemoApp-Info.plist"; - INSTALL_PATH = "$(HOME)/Applications"; + INSTALL_PATH = /; OTHER_LDFLAGS = ( "-framework", Foundation, @@ -3779,7 +5245,7 @@ AppKit, ); PREBINDING = NO; - PRODUCT_NAME = MeshViewer; + PRODUCT_NAME = MeshViewer_dbg; WRAPPER_EXTENSION = app; ZERO_LINK = YES; }; @@ -3820,6 +5286,8 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; + DEPLOYMENT_LOCATION = YES; + DSTROOT = ../../../bin/MacOSX; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -3828,7 +5296,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; INFOPLIST_FILE = "DemoApp-Info.plist"; - INSTALL_PATH = "$(HOME)/Applications"; + INSTALL_PATH = /; OTHER_LDFLAGS = ( "-framework", Foundation, @@ -3836,7 +5304,7 @@ AppKit, ); PREBINDING = NO; - PRODUCT_NAME = RenderToTexture; + PRODUCT_NAME = RenderToTexture_dbg; WRAPPER_EXTENSION = app; ZERO_LINK = YES; }; @@ -3899,6 +5367,8 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; + DEPLOYMENT_LOCATION = YES; + DSTROOT = ../../../bin/MacOSX; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -3907,7 +5377,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; INFOPLIST_FILE = "DemoApp-Info.plist"; - INSTALL_PATH = "$(HOME)/Applications"; + INSTALL_PATH = /; OTHER_LDFLAGS = ( "-framework", Foundation, @@ -3915,7 +5385,7 @@ AppKit, ); PREBINDING = NO; - PRODUCT_NAME = Demo; + PRODUCT_NAME = Demo_dbg; WRAPPER_EXTENSION = app; ZERO_LINK = YES; }; @@ -3955,6 +5425,51 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 09022C5F0EA0E97F00CD54EE /* Build configuration list for PBXNativeTarget "GUIEditor" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 09022C600EA0E97F00CD54EE /* Debug */, + 09022C610EA0E97F00CD54EE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 0946CCB10EC99BBE00D945A5 /* Build configuration list for PBXNativeTarget "MouseAndJoystick" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0946CCB20EC99BBE00D945A5 /* Debug */, + 0946CCB30EC99BBE00D945A5 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 09F649000D2CDED9001E0599 /* Build configuration list for PBXNativeTarget "HelloWorld" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 09F649010D2CDED9001E0599 /* Debug */, + 09F649020D2CDED9001E0599 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 09F6493B0D2CE03E001E0599 /* Build configuration list for PBXNativeTarget "LoadIrrFile" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 09F6493C0D2CE03E001E0599 /* Debug */, + 09F6493D0D2CE03E001E0599 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 09F649620D2CE206001E0599 /* Build configuration list for PBXNativeTarget "Quake3Shader" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 09F649630D2CE206001E0599 /* Debug */, + 09F649640D2CE206001E0599 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "libIrrlicht.a" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/src/dep/src/irrlicht/MacOSX/MacOSX_Prefix.pch b/src/dep/src/irrlicht/MacOSX/MacOSX_Prefix.pch index e69de29..b3ea109 100644 --- a/src/dep/src/irrlicht/MacOSX/MacOSX_Prefix.pch +++ b/src/dep/src/irrlicht/MacOSX/MacOSX_Prefix.pch @@ -0,0 +1,5 @@ +// +// Prefix header for all source files of the 'MacOSX' target in the 'MacOSX' project. +// + +#include diff --git a/src/dep/src/irrlicht/MacOSX/MainMenu.nib/classes.nib b/src/dep/src/irrlicht/MacOSX/MainMenu.nib/classes.nib index e69de29..b9b4b09 100644 --- a/src/dep/src/irrlicht/MacOSX/MainMenu.nib/classes.nib +++ b/src/dep/src/irrlicht/MacOSX/MainMenu.nib/classes.nib @@ -0,0 +1,4 @@ +{ + IBClasses = ({CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }); + IBVersion = 1; +} \ No newline at end of file diff --git a/src/dep/src/irrlicht/MacOSX/MainMenu.nib/info.nib b/src/dep/src/irrlicht/MacOSX/MainMenu.nib/info.nib index e69de29..d4de41f 100644 --- a/src/dep/src/irrlicht/MacOSX/MainMenu.nib/info.nib +++ b/src/dep/src/irrlicht/MacOSX/MainMenu.nib/info.nib @@ -0,0 +1,17 @@ + + + + + IBDocumentLocation + 195 413 356 240 0 0 1680 1028 + IBEditorPositions + + 29 + 62 343 338 44 0 0 1680 1028 + + IBFramework Version + 443.0 + IBSystem Version + 8F46 + + diff --git a/src/dep/src/irrlicht/MacOSX/OSXClipboard.h b/src/dep/src/irrlicht/MacOSX/OSXClipboard.h index 3c2d24f..0bd2618 100644 --- a/src/dep/src/irrlicht/MacOSX/OSXClipboard.h +++ b/src/dep/src/irrlicht/MacOSX/OSXClipboard.h @@ -1,4 +1,4 @@ -// Copyright (C) 2005 Etienne Petitjean +// Copyright (C) 2005-2008 Etienne Petitjean // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in Irrlicht.h diff --git a/src/dep/src/irrlicht/MacOSX/OSXClipboard.mm b/src/dep/src/irrlicht/MacOSX/OSXClipboard.mm index a1c8d9d..1308134 100644 --- a/src/dep/src/irrlicht/MacOSX/OSXClipboard.mm +++ b/src/dep/src/irrlicht/MacOSX/OSXClipboard.mm @@ -1,4 +1,4 @@ -// Copyright (C) 2005 Etienne Petitjean +// Copyright (C) 2005-2008 Etienne Petitjean // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in Irrlicht.h diff --git a/src/dep/src/irrlicht/OctTree.h b/src/dep/src/irrlicht/OctTree.h index fa46347..6a18693 100644 --- a/src/dep/src/irrlicht/OctTree.h +++ b/src/dep/src/irrlicht/OctTree.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/S2DVertex.h b/src/dep/src/irrlicht/S2DVertex.h index 79b2cab..40f55a1 100644 --- a/src/dep/src/irrlicht/S2DVertex.h +++ b/src/dep/src/irrlicht/S2DVertex.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/S4DVertex.h b/src/dep/src/irrlicht/S4DVertex.h index 0b5482a..12f0973 100644 --- a/src/dep/src/irrlicht/S4DVertex.h +++ b/src/dep/src/irrlicht/S4DVertex.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/SConstruct b/src/dep/src/irrlicht/SConstruct new file mode 100644 index 0000000..457a1b1 --- /dev/null +++ b/src/dep/src/irrlicht/SConstruct @@ -0,0 +1,90 @@ +import os +import sys + +USE_GCC = 1; +NDEBUG = 1; +PROFILE = 1; + +APPLICATION_NAME = 'Irrlicht'; +LIBRARIES = ['gdi32', 'opengl32', 'd3dx9d', 'winmm']; +if USE_GCC==1 and PROFILE==1: + LIBRARIES += ['gmon']; + +CXXINCS = ['../../include/', 'zlib/', 'jpeglib/', 'libpng/']; + +if USE_GCC==0: + env = Environment(ENV = { + 'PATH': os.environ['PATH'] + }, CPPPATH=CXXINCS); +else: + env = Environment(ENV = { + 'PATH': os.environ['PATH'] + }, tools = ['mingw'], CPPPATH=CXXINCS); + +IRRMESHLOADER = ['CBSPMeshFileLoader.cpp', 'CMD2MeshFileLoader.cpp', 'CMD3MeshFileLoader.cpp', 'CMS3DMeshFileLoader.cpp', 'CB3DMeshFileLoader.cpp', 'C3DSMeshFileLoader.cpp', 'COgreMeshFileLoader.cpp', 'COBJMeshFileLoader.cpp', 'CColladaFileLoader.cpp', 'CCSMLoader.cpp', 'CDMFLoader.cpp', 'CLMTSMeshFileLoader.cpp', 'CMY3DMeshFileLoader.cpp', 'COCTLoader.cpp', 'CXMeshFileLoader.cpp', 'CIrrMeshFileLoader.cpp', 'CSTLMeshFileLoader.cpp', 'CLWOMeshFileLoader.cpp']; + +IRRMESHWRITER = ['CColladaMeshWriter.cpp', 'CIrrMeshWriter.cpp', 'COBJMeshWriter.cpp', 'CSTLMeshWriter.cpp']; + +IRRMESHOBJ = IRRMESHLOADER + IRRMESHWRITER + ['CSkinnedMesh.cpp', 'CBoneSceneNode.cpp', 'CMeshSceneNode.cpp', 'CAnimatedMeshSceneNode.cpp', 'CAnimatedMeshMD2.cpp', 'CAnimatedMeshMD3.cpp', 'CQ3LevelMesh.cpp', 'CQuake3ShaderSceneNode.cpp']; + +IRROBJ = ['CBillboardSceneNode.cpp', 'CCameraSceneNode.cpp', 'CDummyTransformationSceneNode.cpp', 'CEmptySceneNode.cpp', 'CGeometryCreator.cpp', 'CLightSceneNode.cpp', 'CMeshManipulator.cpp', 'CMetaTriangleSelector.cpp', 'COctTreeSceneNode.cpp', 'COctTreeTriangleSelector.cpp', 'CSceneCollisionManager.cpp', 'CSceneManager.cpp', 'CShadowVolumeSceneNode.cpp', 'CSkyBoxSceneNode.cpp', 'CSkyDomeSceneNode.cpp', 'CTerrainSceneNode.cpp', 'CTerrainTriangleSelector.cpp', 'CVolumeLightSceneNode.cpp', 'CCubeSceneNode.cpp', 'CSphereSceneNode.cpp', 'CTextSceneNode.cpp', 'CTriangleBBSelector.cpp', 'CTriangleSelector.cpp', 'CWaterSurfaceSceneNode.cpp', 'CMeshCache.cpp', 'CDefaultSceneNodeAnimatorFactory.cpp', 'CDefaultSceneNodeFactory.cpp']; + +IRRPARTICLEOBJ = ['CParticleAnimatedMeshSceneNodeEmitter.cpp', 'CParticleBoxEmitter.cpp', 'CParticleCylinderEmitter.cpp', 'CParticleMeshEmitter.cpp', 'CParticlePointEmitter.cpp', 'CParticleRingEmitter.cpp', 'CParticleSphereEmitter.cpp', 'CParticleAttractionAffector.cpp', 'CParticleFadeOutAffector.cpp', 'CParticleGravityAffector.cpp', 'CParticleRotationAffector.cpp', 'CParticleSystemSceneNode.cpp', 'CParticleScaleAffector.cpp']; + +IRRANIMOBJ = ['CSceneNodeAnimatorCameraFPS.cpp', 'CSceneNodeAnimatorCameraMaya.cpp', 'CSceneNodeAnimatorCollisionResponse.cpp', 'CSceneNodeAnimatorDelete.cpp', 'CSceneNodeAnimatorFlyCircle.cpp', 'CSceneNodeAnimatorFlyStraight.cpp', 'CSceneNodeAnimatorFollowSpline.cpp', 'CSceneNodeAnimatorRotation.cpp', 'CSceneNodeAnimatorTexture.cpp']; + +IRRDRVROBJ = ['CNullDriver.cpp', 'COpenGLDriver.cpp', 'COpenGLNormalMapRenderer.cpp', 'COpenGLParallaxMapRenderer.cpp', 'COpenGLShaderMaterialRenderer.cpp', 'COpenGLTexture.cpp', 'COpenGLSLMaterialRenderer.cpp', 'COpenGLExtensionHandler.cpp', 'CD3D8Driver.cpp', 'CD3D8NormalMapRenderer.cpp', 'CD3D8ParallaxMapRenderer.cpp', 'CD3D8ShaderMaterialRenderer.cpp', 'CD3D8Texture.cpp', 'CD3D9Driver.cpp', 'CD3D9HLSLMaterialRenderer.cpp', 'CD3D9NormalMapRenderer.cpp', 'CD3D9ParallaxMapRenderer.cpp', 'CD3D9ShaderMaterialRenderer.cpp', 'CD3D9Texture.cpp']; + +IRRIMAGEOBJ = ['CColorConverter.cpp', 'CImage.cpp', 'CImageLoaderBMP.cpp', 'CImageLoaderJPG.cpp', 'CImageLoaderPCX.cpp', 'CImageLoaderPNG.cpp', 'CImageLoaderPSD.cpp', 'CImageLoaderTGA.cpp', 'CImageLoaderPPM.cpp', 'CImageLoaderWAL.cpp', 'CImageWriterBMP.cpp', 'CImageWriterJPG.cpp', 'CImageWriterPCX.cpp', 'CImageWriterPNG.cpp', 'CImageWriterPPM.cpp', 'CImageWriterPSD.cpp', 'CImageWriterTGA.cpp']; + +IRRVIDEOOBJ = ['CVideoModeList.cpp', 'CFPSCounter.cpp'] + IRRDRVROBJ + IRRIMAGEOBJ; + +IRRSWRENDEROBJ = ['CSoftwareDriver.cpp', 'CSoftwareTexture.cpp', 'CTRFlat.cpp', 'CTRFlatWire.cpp', 'CTRGouraud.cpp', 'CTRGouraudWire.cpp', 'CTRTextureFlat.cpp', 'CTRTextureFlatWire.cpp', 'CTRTextureGouraud.cpp', 'CTRTextureGouraudAdd.cpp', 'CTRTextureGouraudNoZ.cpp', 'CTRTextureGouraudWire.cpp', 'CZBuffer.cpp', 'CTRTextureGouraudVertexAlpha2.cpp', 'CTRTextureGouraudNoZ2.cpp', 'CTRTextureLightMap2_M2.cpp', 'CTRTextureLightMap2_M4.cpp', 'CTRTextureLightMap2_M1.cpp', 'CSoftwareDriver2.cpp', 'CSoftwareTexture2.cpp', 'CTRTextureGouraud2.cpp', 'CTRGouraud2.cpp', 'CTRGouraudAlpha2.cpp', 'CTRGouraudAlphaNoZ2.cpp', 'CTRTextureDetailMap2.cpp', 'CTRTextureGouraudAdd2.cpp', 'CTRTextureGouraudAddNoZ2.cpp', 'CTRTextureWire2.cpp', 'CTRTextureLightMap2_Add.cpp', 'CTRTextureLightMapGouraud2_M4.cpp', 'IBurningShader.cpp', 'CTRTextureBlend.cpp', 'CTRTextureGouraudAlpha.cpp', 'CTRTextureGouraudAlphaNoZ.cpp', 'CDepthBuffer.cpp', 'CBurningShader_Raster_Reference.cpp']; + +IRRIOOBJ = ['CFileList.cpp', 'CFileSystem.cpp', 'CLimitReadFile.cpp', 'CMemoryReadFile.cpp', 'CReadFile.cpp', 'CWriteFile.cpp', 'CXMLReader.cpp', 'CXMLWriter.cpp', 'CZipReader.cpp', 'CPakReader.cpp', 'irrXML.cpp', 'CAttributes.cpp']; + +IRROTHEROBJ = ['CIrrDeviceSDL.cpp', 'CIrrDeviceLinux.cpp', 'CIrrDeviceStub.cpp', 'CIrrDeviceWin32.cpp', 'CLogger.cpp', 'COSOperator.cpp', 'Irrlicht.cpp', 'os.cpp']; + +IRRGUIOBJ = ['CGUIButton.cpp', 'CGUICheckBox.cpp', 'CGUIComboBox.cpp', 'CGUIContextMenu.cpp', 'CGUIEditBox.cpp', 'CGUIEnvironment.cpp', 'CGUIFileOpenDialog.cpp', 'CGUIFont.cpp', 'CGUIImage.cpp', 'CGUIInOutFader.cpp', 'CGUIListBox.cpp', 'CGUIMenu.cpp', 'CGUIMeshViewer.cpp', 'CGUIMessageBox.cpp', 'CGUIModalScreen.cpp', 'CGUIScrollBar.cpp', 'CGUISpinBox.cpp', 'CGUISkin.cpp', 'CGUIStaticText.cpp', 'CGUITabControl.cpp', 'CGUITable.cpp', 'CGUIToolBar.cpp', 'CGUIWindow.cpp', 'CGUIColorSelectDialog.cpp', 'CDefaultGUIElementFactory.cpp', 'CGUISpriteBank.cpp']; + +ZLIB_PREFIX = 'zlib/'; +ZLIBNAMES = ['adler32.c', 'compress.c', 'crc32.c', 'deflate.c', 'inffast.c', 'inflate.c', 'inftrees.c', 'trees.c', 'uncompr.c', 'zutil.c']; +ZLIBOBJ = []; +for fileName in ZLIBNAMES: + ZLIBOBJ += [ZLIB_PREFIX + fileName]; + +JPEGLIB_PREFIX = 'jpeglib/'; +JPEGLIBNAMES = ['jcapimin.c', 'jcapistd.c', 'jccoefct.c', 'jccolor.c', 'jcdctmgr.c', 'jchuff.c', 'jcinit.c', 'jcmainct.c', 'jcmarker.c', 'jcmaster.c', 'jcomapi.c', 'jcparam.c', 'jcphuff.c', 'jcprepct.c', 'jcsample.c', 'jctrans.c', 'jdapimin.c', 'jdapistd.c', 'jdatadst.c', 'jdatasrc.c', 'jdcoefct.c', 'jdcolor.c', 'jddctmgr.c', 'jdhuff.c', 'jdinput.c', 'jdmainct.c', 'jdmarker.c', 'jdmaster.c', 'jdmerge.c', 'jdphuff.c', 'jdpostct.c', 'jdsample.c', 'jdtrans.c', 'jerror.c', 'jfdctflt.c', 'jfdctfst.c', 'jfdctint.c', 'jidctflt.c', 'jidctfst.c', 'jidctint.c', 'jidctred.c', 'jmemmgr.c', 'jmemnobs.c', 'jquant1.c', 'jquant2.c', 'jutils.c']; +JPEGLIBOBJ = []; +for fileName in JPEGLIBNAMES: + JPEGLIBOBJ += [JPEGLIB_PREFIX + fileName]; + +LIBPNG_PREFIX = 'libpng/'; +LIBPNGNAMES = ['png.c', 'pngerror.c', 'pngget.c', 'pngmem.c', 'pngpread.c', 'pngread.c', 'pngrio.c', 'pngrtran.c', 'pngrutil.c', 'pngset.c', 'pngtrans.c', 'pngwio.c', 'pngwrite.c', 'pngwtran.c', 'pngwutil.c']; +LIBPNGOBJ = []; +for fileName in LIBPNGNAMES: + LIBPNGOBJ += [LIBPNG_PREFIX + fileName]; + +# Next variable is for additional scene nodes etc. of customized Irrlicht versions +EXTRAOBJ = []; + +LINKOBJ = IRRMESHOBJ + IRROBJ + IRRPARTICLEOBJ + IRRANIMOBJ + IRRVIDEOOBJ + IRRSWRENDEROBJ + IRRIOOBJ + IRROTHEROBJ + IRRGUIOBJ + ZLIBOBJ + JPEGLIBOBJ + LIBPNGOBJ + EXTRAOBJ; + +env.Append(LIBS = LIBRARIES, LIBPATH = CXXINCS); + +CXXFLAGS = ['-Wall']; +if NDEBUG: + CXXFLAGS += ['-g', '-D_DEBUG']; +else: + CXXFLAGS += ['-fexpensive-optimizations', '-O3']; + +if PROFILE: + CXXFLAGS += ['-pg']; + +CXXFLAGS += ['-DPNG_NO_MMX_CODE', '-DPNG_NO_MNG_FEATURES', '-DIRRLICHT_EXPORTS=1', '-D_IRR_STATIC_LIB_']; +if USE_GCC: + CXXFLAGS += ['-D__GNUWIN32__=1']; + +env.Append(CCFLAGS = CXXFLAGS); + +IrrlichtLibrary = env.SharedLibrary("Irrlicht.dll", LINKOBJ); diff --git a/src/dep/src/irrlicht/SoftwareDriver2_compile_config.h b/src/dep/src/irrlicht/SoftwareDriver2_compile_config.h index f15eed5..f1e517a 100644 --- a/src/dep/src/irrlicht/SoftwareDriver2_compile_config.h +++ b/src/dep/src/irrlicht/SoftwareDriver2_compile_config.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/SoftwareDriver2_helper.h b/src/dep/src/irrlicht/SoftwareDriver2_helper.h index 313a986..17826fc 100644 --- a/src/dep/src/irrlicht/SoftwareDriver2_helper.h +++ b/src/dep/src/irrlicht/SoftwareDriver2_helper.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt / Thomas Alten +// Copyright (C) 2002-2008 Nikolaus Gebhardt / Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/dmfsupport.h b/src/dep/src/irrlicht/dmfsupport.h index 14a732e..3b3bc08 100644 --- a/src/dep/src/irrlicht/dmfsupport.h +++ b/src/dep/src/irrlicht/dmfsupport.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h // diff --git a/src/dep/src/irrlicht/irrXML.cpp b/src/dep/src/irrlicht/irrXML.cpp index 17522cb..dce703f 100644 --- a/src/dep/src/irrlicht/irrXML.cpp +++ b/src/dep/src/irrlicht/irrXML.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine" and the "irrXML" project. // For conditions of distribution and use, see copyright notice in irrlicht.h and/or irrXML.h @@ -83,96 +83,72 @@ private: //! Creates an instance of an UFT-8 or ASCII character xml parser. IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(const char* filename) { - return createIrrXMLReader(new CFileReadCallBack(filename), true); + return createIrrXMLReader(new CFileReadCallBack(filename)); } //! Creates an instance of an UFT-8 or ASCII character xml parser. IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(FILE* file) { - return createIrrXMLReader(new CFileReadCallBack(file), true); + return createIrrXMLReader(new CFileReadCallBack(file)); } //! Creates an instance of an UFT-8 or ASCII character xml parser. -IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(IFileReadCallBack* callback, - bool deleteCallback) +IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(IFileReadCallBack* callback) { if (callback && (callback->getSize() >= 0)) - { - return new CXMLReaderImpl(callback, deleteCallback); - } + return new CXMLReaderImpl(callback, false); else - { - if(callback && deleteCallback) - delete callback; - return 0; - } } //! Creates an instance of an UTF-16 xml parser. IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(const char* filename) { - return createIrrXMLReaderUTF16(new CFileReadCallBack(filename), true); + return createIrrXMLReaderUTF16(new CFileReadCallBack(filename)); } //! Creates an instance of an UTF-16 xml parser. IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(FILE* file) { - return createIrrXMLReaderUTF16(new CFileReadCallBack(file), true); + return createIrrXMLReaderUTF16(new CFileReadCallBack(file)); } //! Creates an instance of an UTF-16 xml parser. -IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(IFileReadCallBack* callback, - bool deleteCallback) +IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(IFileReadCallBack* callback) { if (callback && (callback->getSize() >= 0)) - { - return new CXMLReaderImpl(callback, deleteCallback); - } + return new CXMLReaderImpl(callback, false); else - { - if(callback && deleteCallback) - delete callback; - return 0; - } } //! Creates an instance of an UTF-32 xml parser. IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(const char* filename) { - return createIrrXMLReaderUTF32(new CFileReadCallBack(filename), true); + return createIrrXMLReaderUTF32(new CFileReadCallBack(filename)); } //! Creates an instance of an UTF-32 xml parser. IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(FILE* file) { - return createIrrXMLReaderUTF32(new CFileReadCallBack(file), true); + return createIrrXMLReaderUTF32(new CFileReadCallBack(file)); } //! Creates an instance of an UTF-32 xml parser. -IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(IFileReadCallBack* callback, - bool deleteCallback) +IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(IFileReadCallBack* callback) { if (callback && (callback->getSize() >= 0)) - { - return new CXMLReaderImpl(callback, deleteCallback); - } + return new CXMLReaderImpl(callback, false); else - { - if(callback && deleteCallback) - delete callback; - return 0; - } } diff --git a/src/dep/src/irrlicht/jpeglib/README b/src/dep/src/irrlicht/jpeglib/README index e69de29..911d0e8 100644 --- a/src/dep/src/irrlicht/jpeglib/README +++ b/src/dep/src/irrlicht/jpeglib/README @@ -0,0 +1,385 @@ +The Independent JPEG Group's JPEG software +========================================== + +README for release 6b of 27-Mar-1998 +==================================== + +This distribution contains the sixth public release of the Independent JPEG +Group's free JPEG software. You are welcome to redistribute this software and +to use it for any purpose, subject to the conditions under LEGAL ISSUES, below. + +Serious users of this software (particularly those incorporating it into +larger programs) should contact IJG at jpeg-info@uunet.uu.net to be added to +our electronic mailing list. Mailing list members are notified of updates +and have a chance to participate in technical discussions, etc. + +This software is the work of Tom Lane, Philip Gladstone, Jim Boucher, +Lee Crocker, Julian Minguillon, Luis Ortiz, George Phillips, Davide Rossi, +Guido Vollbeding, Ge' Weijers, and other members of the Independent JPEG +Group. + +IJG is not affiliated with the official ISO JPEG standards committee. + + +DOCUMENTATION ROADMAP +===================== + +This file contains the following sections: + +OVERVIEW General description of JPEG and the IJG software. +LEGAL ISSUES Copyright, lack of warranty, terms of distribution. +REFERENCES Where to learn more about JPEG. +ARCHIVE LOCATIONS Where to find newer versions of this software. +RELATED SOFTWARE Other stuff you should get. +FILE FORMAT WARS Software *not* to get. +TO DO Plans for future IJG releases. + +Other documentation files in the distribution are: + +User documentation: + install.doc How to configure and install the IJG software. + usage.doc Usage instructions for cjpeg, djpeg, jpegtran, + rdjpgcom, and wrjpgcom. + *.1 Unix-style man pages for programs (same info as usage.doc). + wizard.doc Advanced usage instructions for JPEG wizards only. + change.log Version-to-version change highlights. +Programmer and internal documentation: + libjpeg.doc How to use the JPEG library in your own programs. + example.c Sample code for calling the JPEG library. + structure.doc Overview of the JPEG library's internal structure. + filelist.doc Road map of IJG files. + coderules.doc Coding style rules --- please read if you contribute code. + +Please read at least the files install.doc and usage.doc. Useful information +can also be found in the JPEG FAQ (Frequently Asked Questions) article. See +ARCHIVE LOCATIONS below to find out where to obtain the FAQ article. + +If you want to understand how the JPEG code works, we suggest reading one or +more of the REFERENCES, then looking at the documentation files (in roughly +the order listed) before diving into the code. + + +OVERVIEW +======== + +This package contains C software to implement JPEG image compression and +decompression. JPEG (pronounced "jay-peg") is a standardized compression +method for full-color and gray-scale images. JPEG is intended for compressing +"real-world" scenes; line drawings, cartoons and other non-realistic images +are not its strong suit. JPEG is lossy, meaning that the output image is not +exactly identical to the input image. Hence you must not use JPEG if you +have to have identical output bits. However, on typical photographic images, +very good compression levels can be obtained with no visible change, and +remarkably high compression levels are possible if you can tolerate a +low-quality image. For more details, see the references, or just experiment +with various compression settings. + +This software implements JPEG baseline, extended-sequential, and progressive +compression processes. Provision is made for supporting all variants of these +processes, although some uncommon parameter settings aren't implemented yet. +For legal reasons, we are not distributing code for the arithmetic-coding +variants of JPEG; see LEGAL ISSUES. We have made no provision for supporting +the hierarchical or lossless processes defined in the standard. + +We provide a set of library routines for reading and writing JPEG image files, +plus two sample applications "cjpeg" and "djpeg", which use the library to +perform conversion between JPEG and some other popular image file formats. +The library is intended to be reused in other applications. + +In order to support file conversion and viewing software, we have included +considerable functionality beyond the bare JPEG coding/decoding capability; +for example, the color quantization modules are not strictly part of JPEG +decoding, but they are essential for output to colormapped file formats or +colormapped displays. These extra functions can be compiled out of the +library if not required for a particular application. We have also included +"jpegtran", a utility for lossless transcoding between different JPEG +processes, and "rdjpgcom" and "wrjpgcom", two simple applications for +inserting and extracting textual comments in JFIF files. + +The emphasis in designing this software has been on achieving portability and +flexibility, while also making it fast enough to be useful. In particular, +the software is not intended to be read as a tutorial on JPEG. (See the +REFERENCES section for introductory material.) Rather, it is intended to +be reliable, portable, industrial-strength code. We do not claim to have +achieved that goal in every aspect of the software, but we strive for it. + +We welcome the use of this software as a component of commercial products. +No royalty is required, but we do ask for an acknowledgement in product +documentation, as described under LEGAL ISSUES. + + +LEGAL ISSUES +============ + +In plain English: + +1. We don't promise that this software works. (But if you find any bugs, + please let us know!) +2. You can use this software for whatever you want. You don't have to pay us. +3. You may not pretend that you wrote this software. If you use it in a + program, you must acknowledge somewhere in your documentation that + you've used the IJG code. + +In legalese: + +The authors make NO WARRANTY or representation, either express or implied, +with respect to this software, its quality, accuracy, merchantability, or +fitness for a particular purpose. This software is provided "AS IS", and you, +its user, assume the entire risk as to its quality and accuracy. + +This software is copyright (C) 1991-1998, Thomas G. Lane. +All Rights Reserved except as specified below. + +Permission is hereby granted to use, copy, modify, and distribute this +software (or portions thereof) for any purpose, without fee, subject to these +conditions: +(1) If any part of the source code for this software is distributed, then this +README file must be included, with this copyright and no-warranty notice +unaltered; and any additions, deletions, or changes to the original files +must be clearly indicated in accompanying documentation. +(2) If only executable code is distributed, then the accompanying +documentation must state that "this software is based in part on the work of +the Independent JPEG Group". +(3) Permission for use of this software is granted only if the user accepts +full responsibility for any undesirable consequences; the authors accept +NO LIABILITY for damages of any kind. + +These conditions apply to any software derived from or based on the IJG code, +not just to the unmodified library. If you use our work, you ought to +acknowledge us. + +Permission is NOT granted for the use of any IJG author's name or company name +in advertising or publicity relating to this software or products derived from +it. This software may be referred to only as "the Independent JPEG Group's +software". + +We specifically permit and encourage the use of this software as the basis of +commercial products, provided that all warranty or liability claims are +assumed by the product vendor. + + +ansi2knr.c is included in this distribution by permission of L. Peter Deutsch, +sole proprietor of its copyright holder, Aladdin Enterprises of Menlo Park, CA. +ansi2knr.c is NOT covered by the above copyright and conditions, but instead +by the usual distribution terms of the Free Software Foundation; principally, +that you must include source code if you redistribute it. (See the file +ansi2knr.c for full details.) However, since ansi2knr.c is not needed as part +of any program generated from the IJG code, this does not limit you more than +the foregoing paragraphs do. + +The Unix configuration script "configure" was produced with GNU Autoconf. +It is copyright by the Free Software Foundation but is freely distributable. +The same holds for its supporting scripts (config.guess, config.sub, +ltconfig, ltmain.sh). Another support script, install-sh, is copyright +by M.I.T. but is also freely distributable. + +It appears that the arithmetic coding option of the JPEG spec is covered by +patents owned by IBM, AT&T, and Mitsubishi. Hence arithmetic coding cannot +legally be used without obtaining one or more licenses. For this reason, +support for arithmetic coding has been removed from the free JPEG software. +(Since arithmetic coding provides only a marginal gain over the unpatented +Huffman mode, it is unlikely that very many implementations will support it.) +So far as we are aware, there are no patent restrictions on the remaining +code. + +The IJG distribution formerly included code to read and write GIF files. +To avoid entanglement with the Unisys LZW patent, GIF reading support has +been removed altogether, and the GIF writer has been simplified to produce +"uncompressed GIFs". This technique does not use the LZW algorithm; the +resulting GIF files are larger than usual, but are readable by all standard +GIF decoders. + +We are required to state that + "The Graphics Interchange Format(c) is the Copyright property of + CompuServe Incorporated. GIF(sm) is a Service Mark property of + CompuServe Incorporated." + + +REFERENCES +========== + +We highly recommend reading one or more of these references before trying to +understand the innards of the JPEG software. + +The best short technical introduction to the JPEG compression algorithm is + Wallace, Gregory K. "The JPEG Still Picture Compression Standard", + Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44. +(Adjacent articles in that issue discuss MPEG motion picture compression, +applications of JPEG, and related topics.) If you don't have the CACM issue +handy, a PostScript file containing a revised version of Wallace's article is +available at ftp://ftp.uu.net/graphics/jpeg/wallace.ps.gz. The file (actually +a preprint for an article that appeared in IEEE Trans. Consumer Electronics) +omits the sample images that appeared in CACM, but it includes corrections +and some added material. Note: the Wallace article is copyright ACM and IEEE, +and it may not be used for commercial purposes. + +A somewhat less technical, more leisurely introduction to JPEG can be found in +"The Data Compression Book" by Mark Nelson and Jean-loup Gailly, published by +M&T Books (New York), 2nd ed. 1996, ISBN 1-55851-434-1. This book provides +good explanations and example C code for a multitude of compression methods +including JPEG. It is an excellent source if you are comfortable reading C +code but don't know much about data compression in general. The book's JPEG +sample code is far from industrial-strength, but when you are ready to look +at a full implementation, you've got one here... + +The best full description of JPEG is the textbook "JPEG Still Image Data +Compression Standard" by William B. Pennebaker and Joan L. Mitchell, published +by Van Nostrand Reinhold, 1993, ISBN 0-442-01272-1. Price US$59.95, 638 pp. +The book includes the complete text of the ISO JPEG standards (DIS 10918-1 +and draft DIS 10918-2). This is by far the most complete exposition of JPEG +in existence, and we highly recommend it. + +The JPEG standard itself is not available electronically; you must order a +paper copy through ISO or ITU. (Unless you feel a need to own a certified +official copy, we recommend buying the Pennebaker and Mitchell book instead; +it's much cheaper and includes a great deal of useful explanatory material.) +In the USA, copies of the standard may be ordered from ANSI Sales at (212) +642-4900, or from Global Engineering Documents at (800) 854-7179. (ANSI +doesn't take credit card orders, but Global does.) It's not cheap: as of +1992, ANSI was charging $95 for Part 1 and $47 for Part 2, plus 7% +shipping/handling. The standard is divided into two parts, Part 1 being the +actual specification, while Part 2 covers compliance testing methods. Part 1 +is titled "Digital Compression and Coding of Continuous-tone Still Images, +Part 1: Requirements and guidelines" and has document numbers ISO/IEC IS +10918-1, ITU-T T.81. Part 2 is titled "Digital Compression and Coding of +Continuous-tone Still Images, Part 2: Compliance testing" and has document +numbers ISO/IEC IS 10918-2, ITU-T T.83. + +Some extensions to the original JPEG standard are defined in JPEG Part 3, +a newer ISO standard numbered ISO/IEC IS 10918-3 and ITU-T T.84. IJG +currently does not support any Part 3 extensions. + +The JPEG standard does not specify all details of an interchangeable file +format. For the omitted details we follow the "JFIF" conventions, revision +1.02. A copy of the JFIF spec is available from: + Literature Department + C-Cube Microsystems, Inc. + 1778 McCarthy Blvd. + Milpitas, CA 95035 + phone (408) 944-6300, fax (408) 944-6314 +A PostScript version of this document is available by FTP at +ftp://ftp.uu.net/graphics/jpeg/jfif.ps.gz. There is also a plain text +version at ftp://ftp.uu.net/graphics/jpeg/jfif.txt.gz, but it is missing +the figures. + +The TIFF 6.0 file format specification can be obtained by FTP from +ftp://ftp.sgi.com/graphics/tiff/TIFF6.ps.gz. The JPEG incorporation scheme +found in the TIFF 6.0 spec of 3-June-92 has a number of serious problems. +IJG does not recommend use of the TIFF 6.0 design (TIFF Compression tag 6). +Instead, we recommend the JPEG design proposed by TIFF Technical Note #2 +(Compression tag 7). Copies of this Note can be obtained from ftp.sgi.com or +from ftp://ftp.uu.net/graphics/jpeg/. It is expected that the next revision +of the TIFF spec will replace the 6.0 JPEG design with the Note's design. +Although IJG's own code does not support TIFF/JPEG, the free libtiff library +uses our library to implement TIFF/JPEG per the Note. libtiff is available +from ftp://ftp.sgi.com/graphics/tiff/. + + +ARCHIVE LOCATIONS +================= + +The "official" archive site for this software is ftp.uu.net (Internet +address 192.48.96.9). The most recent released version can always be found +there in directory graphics/jpeg. This particular version will be archived +as ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz. If you don't have +direct Internet access, UUNET's archives are also available via UUCP; contact +help@uunet.uu.net for information on retrieving files that way. + +Numerous Internet sites maintain copies of the UUNET files. However, only +ftp.uu.net is guaranteed to have the latest official version. + +You can also obtain this software in DOS-compatible "zip" archive format from +the SimTel archives (ftp://ftp.simtel.net/pub/simtelnet/msdos/graphics/), or +on CompuServe in the Graphics Support forum (GO CIS:GRAPHSUP), library 12 +"JPEG Tools". Again, these versions may sometimes lag behind the ftp.uu.net +release. + +The JPEG FAQ (Frequently Asked Questions) article is a useful source of +general information about JPEG. It is updated constantly and therefore is +not included in this distribution. The FAQ is posted every two weeks to +Usenet newsgroups comp.graphics.misc, news.answers, and other groups. +It is available on the World Wide Web at http://www.faqs.org/faqs/jpeg-faq/ +and other news.answers archive sites, including the official news.answers +archive at rtfm.mit.edu: ftp://rtfm.mit.edu/pub/usenet/news.answers/jpeg-faq/. +If you don't have Web or FTP access, send e-mail to mail-server@rtfm.mit.edu +with body + send usenet/news.answers/jpeg-faq/part1 + send usenet/news.answers/jpeg-faq/part2 + + +RELATED SOFTWARE +================ + +Numerous viewing and image manipulation programs now support JPEG. (Quite a +few of them use this library to do so.) The JPEG FAQ described above lists +some of the more popular free and shareware viewers, and tells where to +obtain them on Internet. + +If you are on a Unix machine, we highly recommend Jef Poskanzer's free +PBMPLUS software, which provides many useful operations on PPM-format image +files. In particular, it can convert PPM images to and from a wide range of +other formats, thus making cjpeg/djpeg considerably more useful. The latest +version is distributed by the NetPBM group, and is available from numerous +sites, notably ftp://wuarchive.wustl.edu/graphics/graphics/packages/NetPBM/. +Unfortunately PBMPLUS/NETPBM is not nearly as portable as the IJG software is; +you are likely to have difficulty making it work on any non-Unix machine. + +A different free JPEG implementation, written by the PVRG group at Stanford, +is available from ftp://havefun.stanford.edu/pub/jpeg/. This program +is designed for research and experimentation rather than production use; +it is slower, harder to use, and less portable than the IJG code, but it +is easier to read and modify. Also, the PVRG code supports lossless JPEG, +which we do not. (On the other hand, it doesn't do progressive JPEG.) + + +FILE FORMAT WARS +================ + +Some JPEG programs produce files that are not compatible with our library. +The root of the problem is that the ISO JPEG committee failed to specify a +concrete file format. Some vendors "filled in the blanks" on their own, +creating proprietary formats that no one else could read. (For example, none +of the early commercial JPEG implementations for the Macintosh were able to +exchange compressed files.) + +The file format we have adopted is called JFIF (see REFERENCES). This format +has been agreed to by a number of major commercial JPEG vendors, and it has +become the de facto standard. JFIF is a minimal or "low end" representation. +We recommend the use of TIFF/JPEG (TIFF revision 6.0 as modified by TIFF +Technical Note #2) for "high end" applications that need to record a lot of +additional data about an image. TIFF/JPEG is fairly new and not yet widely +supported, unfortunately. + +The upcoming JPEG Part 3 standard defines a file format called SPIFF. +SPIFF is interoperable with JFIF, in the sense that most JFIF decoders should +be able to read the most common variant of SPIFF. SPIFF has some technical +advantages over JFIF, but its major claim to fame is simply that it is an +official standard rather than an informal one. At this point it is unclear +whether SPIFF will supersede JFIF or whether JFIF will remain the de-facto +standard. IJG intends to support SPIFF once the standard is frozen, but we +have not decided whether it should become our default output format or not. +(In any case, our decoder will remain capable of reading JFIF indefinitely.) + +Various proprietary file formats incorporating JPEG compression also exist. +We have little or no sympathy for the existence of these formats. Indeed, +one of the original reasons for developing this free software was to help +force convergence on common, open format standards for JPEG files. Don't +use a proprietary file format! + + +TO DO +===== + +The major thrust for v7 will probably be improvement of visual quality. +The current method for scaling the quantization tables is known not to be +very good at low Q values. We also intend to investigate block boundary +smoothing, "poor man's variable quantization", and other means of improving +quality-vs-file-size performance without sacrificing compatibility. + +In future versions, we are considering supporting some of the upcoming JPEG +Part 3 extensions --- principally, variable quantization and the SPIFF file +format. + +As always, speeding things up is of great interest. + +Please send bug reports, offers of help, etc. to jpeg-info@uunet.uu.net. diff --git a/src/dep/src/irrlicht/jpeglib/configure b/src/dep/src/irrlicht/jpeglib/configure index e69de29..d3239e7 100644 --- a/src/dep/src/irrlicht/jpeglib/configure +++ b/src/dep/src/irrlicht/jpeglib/configure @@ -0,0 +1,2011 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --enable-shared build shared library using GNU libtool" +ac_help="$ac_help + --enable-static build static library using GNU libtool" +ac_help="$ac_help + --enable-maxmem[=N] enable use of temp files, set max mem usage to N MB" +ac_help="$ac_help +" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *=*) + varname=`echo "$ac_option"|sed -e 's/=.*//'` + # Reject names that aren't valid shell variable names. + if test -n "`echo $varname| sed 's/[a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $varname: invalid shell variable name" 1>&2; exit 1; } + fi + val="`echo "$ac_option"|sed 's/[^=]*=//'`" + test -n "$verbose" && echo " setting shell variable $varname to $val" + eval "$varname='$val'" + eval "export $varname" ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=jcmaster.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:538: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:567: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:615: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:649: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:654: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + test "${CFLAGS+set}" = set || CFLAGS="-O2" +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-O" +fi + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:681: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:702: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:719: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +echo $ac_n "checking for function prototypes""... $ac_c" 1>&6 +echo "configure:742: checking for function prototypes" >&5 +if eval "test \"`echo '$''{'ijg_cv_have_prototypes'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ijg_cv_have_prototypes=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ijg_cv_have_prototypes=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ijg_cv_have_prototypes" 1>&6 +if test $ijg_cv_have_prototypes = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_PROTOTYPES +EOF + +else + echo Your compiler does not seem to know about function prototypes. + echo Perhaps it needs a special switch to enable ANSI C mode. + echo If so, we recommend running configure like this: + echo " ./configure CC='cc -switch'" + echo where -switch is the proper switch. +fi +ac_safe=`echo "stddef.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for stddef.h""... $ac_c" 1>&6 +echo "configure:792: checking for stddef.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:802: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_STDDEF_H +EOF + +else + echo "$ac_t""no" 1>&6 +fi + +ac_safe=`echo "stdlib.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for stdlib.h""... $ac_c" 1>&6 +echo "configure:828: checking for stdlib.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:838: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_STDLIB_H +EOF + +else + echo "$ac_t""no" 1>&6 +fi + +ac_safe=`echo "string.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for string.h""... $ac_c" 1>&6 +echo "configure:864: checking for string.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:874: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +cat >> confdefs.h <<\EOF +#define NEED_BSD_STRINGS +EOF + +fi + +echo $ac_n "checking for size_t""... $ac_c" 1>&6 +echo "configure:900: checking for size_t" >&5 +cat > conftest.$ac_ext < +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#include +#ifdef NEED_BSD_STRINGS +#include +#else +#include +#endif +typedef size_t my_size_t; + +int main() { + my_size_t foovar; +; return 0; } +EOF +if { (eval echo configure:923: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ijg_size_t_ok=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ijg_size_t_ok="not ANSI, perhaps it is in sys/types.h" +fi +rm -f conftest* +echo "$ac_t""$ijg_size_t_ok" 1>&6 +if test "$ijg_size_t_ok" != yes; then +ac_safe=`echo "sys/types.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for sys/types.h""... $ac_c" 1>&6 +echo "configure:937: checking for sys/types.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:947: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define NEED_SYS_TYPES_H +EOF + +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "size_t" >/dev/null 2>&1; then + rm -rf conftest* + ijg_size_t_ok="size_t is in sys/types.h" +else + rm -rf conftest* + ijg_size_t_ok=no +fi +rm -f conftest* + +else + echo "$ac_t""no" 1>&6 +ijg_size_t_ok=no +fi + +echo "$ac_t""$ijg_size_t_ok" 1>&6 +if test "$ijg_size_t_ok" = no; then + echo Type size_t is not defined in any of the usual places. + echo Try putting '"typedef unsigned int size_t;"' in jconfig.h. +fi +fi +echo $ac_n "checking for type unsigned char""... $ac_c" 1>&6 +echo "configure:994: checking for type unsigned char" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +cat >> confdefs.h <<\EOF +#define HAVE_UNSIGNED_CHAR +EOF + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* +echo $ac_n "checking for type unsigned short""... $ac_c" 1>&6 +echo "configure:1018: checking for type unsigned short" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +cat >> confdefs.h <<\EOF +#define HAVE_UNSIGNED_SHORT +EOF + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* +echo $ac_n "checking for type void""... $ac_c" 1>&6 +echo "configure:1042: checking for type void" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +cat >> confdefs.h <<\EOF +#define void char +EOF + +fi +rm -f conftest* + +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:1088: checking for working const" >&5 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } +EOF +if { (eval echo configure:1142: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_const=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_const=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF + +fi + +echo $ac_n "checking for inline""... $ac_c" 1>&6 +echo "configure:1163: checking for inline" >&5 +ijg_cv_inline="" +cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ijg_cv_inline="__inline__" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ijg_cv_inline="__inline" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ijg_cv_inline="inline" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* +echo "$ac_t""$ijg_cv_inline" 1>&6 +cat >> confdefs.h <&6 +echo "configure:1224: checking for broken incomplete types" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + echo "$ac_t""ok" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""broken" 1>&6 +cat >> confdefs.h <<\EOF +#define INCOMPLETE_TYPES_BROKEN +EOF + +fi +rm -f conftest* +echo $ac_n "checking for short external names""... $ac_c" 1>&6 +echo "configure:1248: checking for short external names" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + echo "$ac_t""ok" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""short" 1>&6 +cat >> confdefs.h <<\EOF +#define NEED_SHORT_EXTERNAL_NAMES +EOF + +fi +rm -f conftest* +echo $ac_n "checking to see if char is signed""... $ac_c" 1>&6 +echo "configure:1275: checking to see if char is signed" >&5 +if test "$cross_compiling" = yes; then + echo Assuming that char is signed on target machine. +echo If it is unsigned, this will be a little bit inefficient. + +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + echo "$ac_t""no" 1>&6 +cat >> confdefs.h <<\EOF +#define CHAR_IS_UNSIGNED +EOF + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + echo "$ac_t""yes" 1>&6 +fi +rm -fr conftest* +fi + +echo $ac_n "checking to see if right shift is signed""... $ac_c" 1>&6 +echo "configure:1323: checking to see if right shift is signed" >&5 +if test "$cross_compiling" = yes; then + echo "$ac_t""Assuming that right shift is signed on target machine." 1>&6 +else + cat > conftest.$ac_ext <> 4; + + if (res == -0x7F7E80CL) { /* expected result for signed shift */ + return 1; /* right shift is signed */ + } + /* see if unsigned-shift hack will fix it. */ + /* we can't just test exact value since it depends on width of long... */ + res |= (~0L) << (32-4); + if (res == -0x7F7E80CL) { /* expected result now? */ + return 0; /* right shift is unsigned */ + } + printf("Right shift isn't acting as I expect it to.\n"); + printf("I fear the JPEG software will not work at all.\n\n"); + return 0; /* try it with unsigned anyway */ +} +main() { + exit(is_shifting_signed(-0x7F7E80B1L)); +} +EOF +if { (eval echo configure:1358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + echo "$ac_t""no" 1>&6 +cat >> confdefs.h <<\EOF +#define RIGHT_SHIFT_IS_UNSIGNED +EOF + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + echo "$ac_t""yes" 1>&6 +fi +rm -fr conftest* +fi + +echo $ac_n "checking to see if fopen accepts b spec""... $ac_c" 1>&6 +echo "configure:1375: checking to see if fopen accepts b spec" >&5 +if test "$cross_compiling" = yes; then + echo "$ac_t""Assuming that it does." 1>&6 +else + cat > conftest.$ac_ext < +main() { + if (fopen("conftestdata", "wb") != NULL) + exit(0); + exit(1); +} +EOF +if { (eval echo configure:1390: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + echo "$ac_t""no" 1>&6 +cat >> confdefs.h <<\EOF +#define DONT_USE_B_MODE +EOF + +fi +rm -fr conftest* +fi + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:1436: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + for ac_prog in ginstall installbsd scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + # OSF/1 installbsd also uses dspmsg, but is usable. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1488: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +# Decide whether to use libtool, +# and if so whether to build shared, static, or both flavors of library. +LTSHARED="no" +# Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + LTSHARED="$enableval" +fi + +LTSTATIC="no" +# Check whether --enable-static or --disable-static was given. +if test "${enable_static+set}" = set; then + enableval="$enable_static" + LTSTATIC="$enableval" +fi + +if test "x$LTSHARED" != xno -o "x$LTSTATIC" != xno; then + USELIBTOOL="yes" + LIBTOOL="./libtool" + O="lo" + A="la" + LN='$(LIBTOOL) --mode=link $(CC)' + INSTALL_LIB='$(LIBTOOL) --mode=install ${INSTALL}' + INSTALL_PROGRAM="\$(LIBTOOL) --mode=install $INSTALL_PROGRAM" +else + USELIBTOOL="no" + LIBTOOL="" + O="o" + A="a" + LN='$(CC)' + INSTALL_LIB="$INSTALL_DATA" +fi + + + + + + +# Configure libtool if needed. +if test $USELIBTOOL = yes; then + disable_shared= + disable_static= + if test "x$LTSHARED" = xno; then + disable_shared="--disable-shared" + fi + if test "x$LTSTATIC" = xno; then + disable_static="--disable-static" + fi + $srcdir/ltconfig $disable_shared $disable_static $srcdir/ltmain.sh +fi + +# Select memory manager depending on user input. +# If no "-enable-maxmem", use jmemnobs +MEMORYMGR='jmemnobs.$(O)' +MAXMEM="no" +# Check whether --enable-maxmem or --disable-maxmem was given. +if test "${enable_maxmem+set}" = set; then + enableval="$enable_maxmem" + MAXMEM="$enableval" +fi + +# support --with-maxmem for backwards compatibility with IJG V5. +# Check whether --with-maxmem or --without-maxmem was given. +if test "${with_maxmem+set}" = set; then + withval="$with_maxmem" + MAXMEM="$withval" +fi + +if test "x$MAXMEM" = xyes; then + MAXMEM=1 +fi +if test "x$MAXMEM" != xno; then + if test -n "`echo $MAXMEM | sed 's/[0-9]//g'`"; then + { echo "configure: error: non-numeric argument to --enable-maxmem" 1>&2; exit 1; } + fi + DEFAULTMAXMEM=`expr $MAXMEM \* 1048576` +cat >> confdefs.h <&6 +echo "configure:1596: checking for 'tmpfile()'" >&5 +cat > conftest.$ac_ext < +int main() { + FILE * tfile = tmpfile(); +; return 0; } +EOF +if { (eval echo configure:1605: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +MEMORYMGR='jmemansi.$(O)' +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +MEMORYMGR='jmemname.$(O)' +cat >> confdefs.h <<\EOF +#define NEED_SIGNAL_CATCHER +EOF + +echo $ac_n "checking for 'mktemp()'""... $ac_c" 1>&6 +echo "configure:1620: checking for 'mktemp()'" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +cat >> confdefs.h <<\EOF +#define NO_MKTEMP +EOF + +fi +rm -f conftest* +fi +rm -f conftest* +fi + + +# Extract the library version ID from jpeglib.h. +echo $ac_n "checking libjpeg version number""... $ac_c" 1>&6 +echo "configure:1650: checking libjpeg version number" >&5 +JPEG_LIB_VERSION=`sed -e '/^#define JPEG_LIB_VERSION/!d' -e 's/^[^0-9]*\([0-9][0-9]*\).*$/\1/' $srcdir/jpeglib.h` +echo "$ac_t""$JPEG_LIB_VERSION" 1>&6 + + +# Prepare to massage makefile.cfg correctly. +if test $ijg_cv_have_prototypes = yes; then + A2K_DEPS="" + COM_A2K="# " +else + A2K_DEPS="ansi2knr" + COM_A2K="" +fi + + +# ansi2knr needs -DBSD if string.h is missing +if test $ac_cv_header_string_h = no; then + ANSI2KNRFLAGS="-DBSD" +else + ANSI2KNRFLAGS="" +fi + +# Substitutions to enable or disable libtool-related stuff +if test $USELIBTOOL = yes -a $ijg_cv_have_prototypes = yes; then + COM_LT="" +else + COM_LT="# " +fi + +if test "x$LTSHARED" != xno; then + FORCE_INSTALL_LIB="install-lib" +else + FORCE_INSTALL_LIB="" +fi + +# Set up -I directives +if test "x$srcdir" = x.; then + INCLUDEFLAGS='-I$(srcdir)' +else + INCLUDEFLAGS='-I. -I$(srcdir)' +fi + +trap '' 1 2 15 + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile:makefile.cfg jconfig.h:jconfig.cfg" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@CC@%$CC%g +s%@CPP@%$CPP%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@RANLIB@%$RANLIB%g +s%@LIBTOOL@%$LIBTOOL%g +s%@O@%$O%g +s%@A@%$A%g +s%@LN@%$LN%g +s%@INSTALL_LIB@%$INSTALL_LIB%g +s%@MEMORYMGR@%$MEMORYMGR%g +s%@JPEG_LIB_VERSION@%$JPEG_LIB_VERSION%g +s%@A2K_DEPS@%$A2K_DEPS%g +s%@COM_A2K@%$COM_A2K%g +s%@ANSI2KNRFLAGS@%$ANSI2KNRFLAGS%g +s%@COM_LT@%$COM_LT%g +s%@FORCE_INSTALL_LIB@%$FORCE_INSTALL_LIB%g +s%@INCLUDEFLAGS@%$INCLUDEFLAGS%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/src/dep/src/irrlicht/jpeglib/install-sh b/src/dep/src/irrlicht/jpeglib/install-sh index e69de29..082fd7c 100644 --- a/src/dep/src/irrlicht/jpeglib/install-sh +++ b/src/dep/src/irrlicht/jpeglib/install-sh @@ -0,0 +1,250 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/src/dep/src/irrlicht/jpeglib/jconfig.h b/src/dep/src/irrlicht/jpeglib/jconfig.h index 2f4da14..7e276e8 100644 --- a/src/dep/src/irrlicht/jpeglib/jconfig.h +++ b/src/dep/src/irrlicht/jpeglib/jconfig.h @@ -30,11 +30,11 @@ typedef unsigned char boolean; #ifdef JPEG_CJPEG_DJPEG -#define BMP_SUPPORTED /* BMP image file format */ -#define GIF_SUPPORTED /* GIF image file format */ -#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ +#undef BMP_SUPPORTED /* BMP image file format */ +#undef GIF_SUPPORTED /* GIF image file format */ +#undef PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ #undef RLE_SUPPORTED /* Utah RLE image file format */ -#define TARGA_SUPPORTED /* Targa image file format */ +#undef TARGA_SUPPORTED /* Targa image file format */ #define TWO_FILE_COMMANDLINE /* optional */ #define USE_SETMODE /* Microsoft has setmode() */ @@ -42,4 +42,8 @@ typedef unsigned char boolean; #undef DONT_USE_B_MODE #undef PROGRESS_REPORT /* optional */ +#if defined(_WIN32_WCE) + #undef USE_SETMODE +#endif + #endif /* JPEG_CJPEG_DJPEG */ diff --git a/src/dep/src/irrlicht/jpeglib/jdinput.c b/src/dep/src/irrlicht/jpeglib/jdinput.c index 2d5c747..3bd6ebe 100644 --- a/src/dep/src/irrlicht/jpeglib/jdinput.c +++ b/src/dep/src/irrlicht/jpeglib/jdinput.c @@ -263,7 +263,7 @@ start_input_pass (j_decompress_ptr cinfo) /* * Finish up after inputting a compressed-data scan. - * This is called by the coefficient controller after it's read all + * This is called by the coefficient controller after it has read all * the expected data of the scan. */ diff --git a/src/dep/src/irrlicht/jpeglib/jdmarker.c b/src/dep/src/irrlicht/jpeglib/jdmarker.c index 9811761..30182bb 100644 --- a/src/dep/src/irrlicht/jpeglib/jdmarker.c +++ b/src/dep/src/irrlicht/jpeglib/jdmarker.c @@ -182,7 +182,7 @@ typedef my_marker_reader * my_marker_ptr; * source manager's shoulders. If we are saving the marker's contents * into memory, we use a slightly different convention: when forced to * suspend, the marker processor updates the restart point to the end of - * what it's consumed (ie, the end of the buffer) before returning FALSE. + * what its consumed (ie, the end of the buffer) before returning FALSE. * On resumption, cinfo->unread_marker still contains the marker code, * but the data source will point to the next chunk of marker data. * The marker processor must retain internal state to deal with this. diff --git a/src/dep/src/irrlicht/jpeglib/jmorecfg.h b/src/dep/src/irrlicht/jpeglib/jmorecfg.h index c856e22..2a9a345 100644 --- a/src/dep/src/irrlicht/jpeglib/jmorecfg.h +++ b/src/dep/src/irrlicht/jpeglib/jmorecfg.h @@ -158,7 +158,7 @@ typedef short INT16; /* INT32 must hold at least signed 32-bit values. */ #ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ -typedef long INT32; +typedef int INT32; #endif /* Datatype used for image dimensions. The JPEG standard only supports diff --git a/src/dep/src/irrlicht/jpeglib/ltconfig b/src/dep/src/irrlicht/jpeglib/ltconfig index e69de29..679dd73 100644 --- a/src/dep/src/irrlicht/jpeglib/ltconfig +++ b/src/dep/src/irrlicht/jpeglib/ltconfig @@ -0,0 +1,1512 @@ +#! /bin/sh + +# ltconfig - Create a system-specific libtool. +# Copyright (C) 1996-1998 Free Software Foundation, Inc. +# Gordon Matzigkeit , 1996 +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A lot of this script is taken from autoconf-2.10. + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi + +echo=echo +if test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then : +else + # The Solaris and AIX default echo program unquotes backslashes. + # This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # So, we emulate echo with printf '%s\n' + echo="printf %s\\n" + if test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then : + else + # Oops. We have no working printf. Try to find a not-so-buggy echo. + echo=echo + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" + for dir in $PATH /usr/ucb; do + if test -f $dir/echo && test "X`$dir/echo '\t'`" = 'X\t'; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + fi +fi + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# The name of this program. +progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'` + +# Constants: +PROGRAM=ltconfig +PACKAGE=libtool +VERSION=1.2 +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS 1>&5' +rm="rm -f" + +help="Try \`$progname --help' for more information." + +# Global variables: +can_build_shared=yes +enable_shared=yes +# All known linkers require a `.a' archive for static linking. +enable_static=yes +ltmain= +silent= +srcdir= +ac_config_guess= +ac_config_sub= +host= +nonopt= +verify_host=yes +with_gcc=no +with_gnu_ld=no + +old_AR="$AR" +old_CC="$CC" +old_CFLAGS="$CFLAGS" +old_CPPFLAGS="$CPPFLAGS" +old_LD="$LD" +old_LN_S="$LN_S" +old_NM="$NM" +old_RANLIB="$RANLIB" + +# Parse the command line options. +args= +prev= +for option +do + case "$option" in + -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + eval "$prev=\$option" + prev= + continue + fi + + case "$option" in + --help) cat <&2 + echo "$help" 1>&2 + exit 1 + ;; + + *) + if test -z "$ltmain"; then + ltmain="$option" + elif test -z "$host"; then +# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1 +# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then +# echo "$progname: warning \`$option' is not a valid host type" 1>&2 +# fi + host="$option" + else + echo "$progname: too many arguments" 1>&2 + echo "$help" 1>&2 + exit 1 + fi ;; + esac +done + +if test -z "$ltmain"; then + echo "$progname: you must specify a LTMAIN file" 1>&2 + echo "$help" 1>&2 + exit 1 +fi + +if test -f "$ltmain"; then : +else + echo "$progname: \`$ltmain' does not exist" 1>&2 + echo "$help" 1>&2 + exit 1 +fi + +# Quote any args containing shell metacharacters. +ltconfig_args= +for arg +do + case "$arg" in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ltconfig_args="$ltconfig_args '$arg'" ;; + *) ltconfig_args="$ltconfig_args $arg" ;; + esac +done + +# A relevant subset of AC_INIT. + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 5 compiler messages saved in config.log +# 6 checking for... messages and results +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>>./config.log + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LANG+set}" = set; then LANG=C; export LANG; fi + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + +if test -z "$srcdir"; then + # Assume the source directory is the same one as the path to ltmain.sh. + srcdir=`$echo "$ltmain" | $Xsed -e 's%/[^/]*$%%'` + test "$srcdir" = "$ltmain" && srcdir=. +fi + +trap "$rm conftest*; exit 1" 1 2 15 +if test "$verify_host" = yes; then + # Check for config.guess and config.sub. + ac_aux_dir= + for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/config.guess; then + ac_aux_dir=$ac_dir + break + fi + done + if test -z "$ac_aux_dir"; then + echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2 + echo "$help" 1>&2 + exit 1 + fi + ac_config_guess=$ac_aux_dir/config.guess + ac_config_sub=$ac_aux_dir/config.sub + + # Make sure we can run config.sub. + if $ac_config_sub sun4 >/dev/null 2>&1; then : + else + echo "$progname: cannot run $ac_config_sub" 1>&2 + echo "$help" 1>&2 + exit 1 + fi + + echo $ac_n "checking host system type""... $ac_c" 1>&6 + + host_alias=$host + case "$host_alias" in + "") + if host_alias=`$ac_config_guess`; then : + else + echo "$progname: cannot guess host type; you must specify one" 1>&2 + echo "$help" 1>&2 + exit 1 + fi ;; + esac + host=`$ac_config_sub $host_alias` + echo "$ac_t$host" 1>&6 + + # Make sure the host verified. + test -z "$host" && exit 1 + +elif test -z "$host"; then + echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2 + echo "$help" 1>&2 + exit 1 +else + host_alias=$host +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case "$host_os" in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +case "$host_os" in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "${COLLECT_NAMES+set}" != set; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR cru $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +# Set a sane default for `AR'. +test -z "$AR" && AR=ar + +# If RANLIB is not set, then run the test. +if test "${RANLIB+set}" != "set"; then + result=no + + echo $ac_n "checking for ranlib... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/ranlib; then + RANLIB="ranlib" + result="ranlib" + break + fi + done + IFS="$save_ifs" + + echo "$ac_t$result" 1>&6 +fi + +if test -n "$RANLIB"; then + old_archive_cmds="$old_archive_cmds;\$RANLIB \$oldlib" + old_postinstall_cmds="\$RANLIB \$oldlib;$old_postinstall_cmds" +fi + +# Check to see if we are using GCC. +if test "$with_gcc" != yes || test -z "$CC"; then + # If CC is not set, then try to find GCC or a usable CC. + if test -z "$CC"; then + echo $ac_n "checking for gcc... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" + for dir in $PATH; do + IFS="$save_ifs" + test -z "$dir" && dir=. + if test -f $dir/gcc; then + CC="gcc" + break + fi + done + IFS="$save_ifs" + + if test -n "$CC"; then + echo "$ac_t$CC" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + fi + + # Not "gcc", so try "cc", rejecting "/usr/ucb/cc". + if test -z "$CC"; then + echo $ac_n "checking for cc... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" + cc_rejected=no + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/cc; then + if test "$dir/cc" = "/usr/ucb/cc"; then + cc_rejected=yes + continue + fi + CC="cc" + break + fi + done + IFS="$save_ifs" + if test $cc_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same name, so the bogon will be chosen + # first if we set CC to just the name; use the full file name. + shift + set dummy "$dir/cc" "$@" + shift + CC="$@" + fi + fi + + if test -n "$CC"; then + echo "$ac_t$CC" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + + if test -z "$CC"; then + echo "$progname: error: no acceptable cc found in \$PATH" 1>&2 + exit 1 + fi + fi + + # Now see if the compiler is really GCC. + with_gcc=no + echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6 + echo "$progname:424: checking whether we are using GNU C" >&5 + + $rm conftest.c + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + with_gcc=yes + fi + $rm conftest.c + echo "$ac_t$with_gcc" 1>&6 +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="$2" + +echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 +pic_flag= +special_shlib_compile_flags= +wl= +link_static_flag= +no_builtin_flag= + +if test "$with_gcc" = yes; then + wl='-Wl,' + link_static_flag='-static' + no_builtin_flag=' -fno-builtin' + + case "$host_os" in + aix3* | aix4* | irix5* | irix6* | osf3* | osf4*) + # PIC is the default for these OSes. + ;; + os2*) + # We can build DLLs from non-PIC. + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + pic_flag='-m68020 -resident32 -malways-restore-a4' + ;; + *) + pic_flag='-fPIC' + ;; + esac +else + # PORTME Check for PIC flags for the system compiler. + case "$host_os" in + aix3* | aix4*) + # All AIX code is PIC. + link_static_flag='-bnso -bI:/lib/syscalls.exp' + ;; + + hpux9* | hpux10*) + # Is there a better link_static_flag that works with the bundled CC? + wl='-Wl,' + link_static_flag="${wl}-a ${wl}archive" + pic_flag='+Z' + ;; + + irix5* | irix6*) + wl='-Wl,' + link_static_flag='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + os2*) + # We can build DLLs from non-PIC. + ;; + + osf3* | osf4*) + # All OSF/1 code is PIC. + wl='-Wl,' + link_static_flag='-non_shared' + ;; + + sco3.2v5*) + pic_flag='-Kpic' + link_static_flag='-dn' + special_shlib_compile_flags='-belf' + ;; + + solaris2*) + pic_flag='-KPIC' + link_static_flag='-Bstatic' + wl='-Wl,' + ;; + + sunos4*) + pic_flag='-PIC' + link_static_flag='-Bstatic' + wl='-Qoption ld ' + ;; + + sysv4.2uw2*) + pic_flag='-KPIC' + link_static_flag='-Bstatic' + wl='-Wl,' + ;; + + uts4*) + pic_flag='-pic' + link_static_flag='-Bstatic' + ;; + + *) + can_build_shared=no + ;; + esac +fi + +if test -n "$pic_flag"; then + echo "$ac_t$pic_flag" 1>&6 + + # Check to make sure the pic_flag actually works. + echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6 + $rm conftest* + echo > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $pic_flag -DPIC" + echo "$progname:547: checking if $compiler PIC flag $pic_flag works" >&5 + if { (eval echo $progname:548: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + # On HP-UX, both CC and GCC only warn that PIC is supported... then they + # create non-PIC objects. So, if there were any warnings, we assume that + # PIC is not supported. + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + can_build_shared=no + pic_flag= + else + echo "$ac_t"yes 1>&6 + pic_flag=" $pic_flag" + fi + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + can_build_shared=no + pic_flag= + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* +else + echo "$ac_t"none 1>&6 +fi + +# Check for any special shared library compilation flags. +if test -n "$special_shlib_compile_flags"; then + echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2 + if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then : + else + echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2 + can_build_shared=no + fi +fi + +echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6 +$rm conftest* +echo 'main(){return(0);}' > conftest.c +save_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS $link_static_flag" +echo "$progname:591: checking if $compiler static flag $link_static_flag works" >&5 +if { (eval echo $progname:592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + echo "$ac_t$link_static_flag" 1>&6 +else + echo "$ac_t"none 1>&6 + link_static_flag= +fi +LDFLAGS="$save_LDFLAGS" +$rm conftest* + +if test -z "$LN_S"; then + # Check to see if we can use ln -s, or we need hard links. + echo $ac_n "checking whether ln -s works... $ac_c" 1>&6 + $rm conftestdata + if ln -s X conftestdata 2>/dev/null; then + $rm conftestdata + LN_S="ln -s" + else + LN_S=ln + fi + if test "$LN_S" = "ln -s"; then + echo "$ac_t"yes 1>&6 + else + echo "$ac_t"no 1>&6 + fi +fi + +# Make sure LD is an absolute path. +if test -z "$LD"; then + ac_prog=ld + if test "$with_gcc" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6 + echo "$progname:624: checking for ld used by GCC" >&5 + ac_prog=`($CC -print-prog-name=ld) 2>&5` + case "$ac_prog" in + # Accept absolute paths. + /* | [A-Za-z]:\\*) + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we are not using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac + elif test "$with_gnu_ld" = yes; then + echo $ac_n "checking for GNU ld... $ac_c" 1>&6 + echo "$progname:642: checking for GNU ld" >&5 + else + echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 + echo "$progname:645: checking for non-GNU ld" >&5 + fi + + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog"; then + LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" + fi + + if test -n "$LD"; then + echo "$ac_t$LD" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + + if test -z "$LD"; then + echo "$progname: error: no acceptable ld found in \$PATH" 1>&2 + exit 1 + fi +fi + +# Check to see if it really is or is not GNU ld. +echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6 +# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + with_gnu_ld=yes +else + with_gnu_ld=no +fi +echo "$ac_t$with_gnu_ld" 1>&6 + +# See if the linker supports building shared libraries. +echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6 + +allow_undefined_flag= +no_undefined_flag= +archive_cmds= +old_archive_from_new_cmds= +export_dynamic_flag_spec= +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= + +case "$host_os" in +amigaos* | sunos4*) + # On these operating systems, we should treat GNU ld like the system ld. + gnu_ld_acts_native=yes + ;; +*) + gnu_ld_acts_native=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes && test "$gnu_ld_acts_native" != yes; then + + # See if GNU ld supports shared libraries. + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared ${wl}-soname $wl$soname -o $lib$libobjs' + runpath_var=LD_RUN_PATH + ld_shlibs=yes + else + ld_shlibs=no + fi + + if test "$ld_shlibs" = yes; then + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case "$host_os" in + aix3*) + allow_undefined_flag=unsupported + archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\'' > $lib.exp;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE;$AR cru $lib $objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$with_gcc" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4*) + allow_undefined_flag=unsupported + archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\'' > $lib.exp;$CC -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry;$AR cru $lib $objdir/$soname' + hardcode_direct=yes + hardcode_minus_L=yes + ;; + + amigaos*) + archive_cmds='$rm $objdir/a2ixlibrary.data;$echo "#define NAME $libname" > $objdir/a2ixlibrary.data;$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data;$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data;$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data;$AR cru $lib$libobjs;$RANLIB $lib;(cd $objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib$libobjs /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib$libobjs' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3, at last, uses gcc -shared to do shared libraries. + freebsd3*) + archive_cmds='$CC -shared -o $lib$libobjs' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + archive_cmds='$rm $objdir/$soname;$LD -b +s +b $install_libdir -o $objdir/$soname$libobjs;mv $objdir/$soname $lib' + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10*) + archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib$libobjs' + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6*) + archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + ;; + + netbsd*) + # Tested with NetBSD 1.2 ld + archive_cmds='$LD -Bshareable -o $lib$libobjs' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + openbsd*) + archive_cmds='$LD -Bshareable -o $lib$libobjs' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def;$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def;$echo DATA >> $objdir/$libname.def;$echo " SINGLE NONSHARED" >> $objdir/$libname.def;$echo EXPORTS >> $objdir/$libname.def;emxexp$libobjs >> $objdir/$libname.def;$CC -Zdll -Zcrtdll -o $lib$libobjs $objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def' + ;; + + osf3* | osf4*) + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} -o $lib -soname $soname -set_version $verstring$libobjs$deplibs' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -o $lib$libobjs' + hardcode_direct=yes + ;; + + solaris2*) + no_undefined_flag=' -z text' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib$libobjs' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + + # Solaris 2 before 2.5 hardcodes -L paths. + case "$host_os" in + solaris2.[0-4]*) + hardcode_minus_L=yes + ;; + esac + ;; + + sunos4*) + if test "$with_gcc" = yes; then + archive_cmds='$CC -shared -o $lib$libobjs' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs' + fi + + if test "$with_gnu_ld" = yes; then + export_dynamic_flag_spec='${wl}-export-dynamic' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib$libobjs' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=no + hardcode_minus_L=no + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + can_build_shared=no + ;; + esac +fi +echo "$ac_t$ld_shlibs" 1>&6 + +if test -z "$NM"; then + echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6 + case "$NM" in + /* | [A-Za-z]:\\*) ;; # Let the user override the test with a path. + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/nm; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + NM="$ac_dir/nm -B" + elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + NM="$ac_dir/nm -p" + else + NM="$ac_dir/nm" + fi + break + fi + done + IFS="$ac_save_ifs" + test -z "$NM" && NM=nm + ;; + esac + echo "$ac_t$NM" 1>&6 +fi + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6 + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRSTU]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \1' + +# Define system-specific variables. +case "$host_os" in +aix*) + symcode='[BCDTU]' + ;; +irix*) + # Cannot use undefined symbols on IRIX because inlined functions mess us up. + symcode='[BCDEGRST]' + ;; +solaris2*) + symcode='[BDTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[ABCDGISTUW]' +fi + +# Write the raw and C identifiers. +global_symbol_pipe="sed -n -e 's/^.* $symcode $sympat$/$symxfrm/p'" + +# Check to see that the pipe works correctly. +pipe_works=no +$rm conftest* +cat > conftest.c <&5 +if { (eval echo $progname:972: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.o; then + # Now try to grab the symbols. + nlist=conftest.nm + if { echo "$progname:975: eval \"$NM conftest.o | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.o | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then + + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + wcout=`wc "$nlist" 2>/dev/null` + count=`$echo "X$wcout" | $Xsed -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'` + (test "$count" -ge 0) 2>/dev/null || count=-1 + else + rm -f "$nlist"T + count=-1 + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.c +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + sed 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> conftest.c + + cat <> conftest.c +#if defined (__STDC__) && __STDC__ +# define __ptr_t void * +#else +# define __ptr_t char * +#endif + +/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */ +int dld_preloaded_symbol_count = $count; + +/* The mapping between symbol names and symbols. */ +struct { + char *name; + __ptr_t address; +} +dld_preloaded_symbols[] = +{ +EOF + sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> conftest.c + cat <<\EOF >> conftest.c + {0, (__ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.o conftestm.o + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS='conftestm.o' + CFLAGS="$CFLAGS$no_builtin_flag" + if { (eval echo $progname:1033: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + pipe_works=yes + else + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 + fi + LIBS="$save_LIBS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $global_symbol_pipe" >&5 + fi +else + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 +fi +$rm conftest* + +# Do not use the global_symbol_pipe unless it works. +echo "$ac_t$pipe_works" 1>&6 +test "$pipe_works" = yes || global_symbol_pipe= + +# Check hardcoding attributes. +echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && \ + test "$hardcode_minus_L" != no && \ + test "$hardcode_shlibpath_var" != no; then + + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +elif test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ + test "$hardcode_shlibpath_var" != yes; then + # We cannot hardcode anything. + hardcode_action=unsupported +else + # We can only hardcode existing directories. + hardcode_action=relink +fi +echo "$ac_t$hardcode_action" 1>&6 +test "$hardcode_action" = unsupported && can_build_shared=no + + +reload_flag= +reload_cmds='$LD$reload_flag -o $output$reload_objs' +echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6 +# PORTME Some linker may need a different reload flag. +reload_flag='-r' +echo "$ac_t$reload_flag" +test -n "$reload_flag" && reload_flag=" $reload_flag" + +# PORTME Fill in your ld.so characteristics +library_names_spec= +libname_spec='lib$name' +soname_spec= +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +version_type=none +dynamic_linker="$host_os ld.so" + +echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 +case "$host_os" in +aix3* | aix4*) + version_type=linux + library_names_spec='${libname}${release}.so.$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so.$major' + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +freebsd2* | freebsd3*) + version_type=sunos + library_names_spec='${libname}${release}.so.$versuffix $libname.so' + finish_cmds='PATH="$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +gnu*) + version_type=sunos + library_names_spec='${libname}${release}.so.$versuffix' + shlibpath_var=LD_LIBRARY_PATH + ;; + +hpux9* | hpux10*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + dynamic_linker="$host_os dld.sl" + version_type=sunos + shlibpath_var=SHLIB_PATH + library_names_spec='${libname}${release}.sl.$versuffix ${libname}${release}.sl.$major $libname.sl' + soname_spec='${libname}${release}.sl.$major' + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6*) + version_type=osf + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so.$versuffix $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux-gnu*) + version_type=linux + library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so' + soname_spec='${libname}${release}.so.$major' + finish_cmds='PATH="$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + + if test -f /lib/ld.so.1; then + dynamic_linker='GNU ld.so' + else + # Only the GNU ld.so supports shared libraries on MkLinux. + case "$host_cpu" in + powerpc*) dynamic_linker=no ;; + *) dynamic_linker='Linux ld.so' ;; + esac + fi + ;; + +netbsd* | openbsd*) + version_type=sunos + library_names_spec='${libname}${release}.so.$versuffix' + finish_cmds='PATH="$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +os2*) + libname_spec='$name' + library_names_spec='$libname.dll $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4*) + version_type=osf + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so.$versuffix $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}.so.$major' + library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris2*) + version_type=linux + library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so' + soname_spec='${libname}${release}.so.$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}.so.$versuffix' + finish_cmds='PATH="$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +sysv4.2uw2*) + version_type=linux + library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so' + soname_spec='${libname}${release}.so.$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so' + soname_spec='${libname}${release}.so.$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$ac_t$dynamic_linker" +test "$dynamic_linker" = no && can_build_shared=no + +# Report the final consequences. +echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 + +echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds;\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; +esac + +echo "$ac_t$enable_shared" 1>&6 + +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes + +echo "checking whether to build static libraries... $enable_static" 1>&6 + +echo $ac_n "checking for objdir... $ac_c" 1>&6 +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +echo "$ac_t$objdir" 1>&6 + +# Copy echo and quote the copy, instead of the original, because it is +# used later. +ltecho="$echo" + +# Now quote all the things that may contain metacharacters. +for var in ltecho old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \ + old_LN_S AR CC LD LN_S NM reload_flag reload_cmds wl pic_flag \ + link_static_flag no_builtin_flag export_dynamic_flag_spec \ + libname_spec library_names_spec soname_spec RANLIB \ + old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds postinstall_cmds postuninstall_cmds \ + allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe \ + hardcode_libdir_flag_spec hardcode_libdir_separator; do + + case "$var" in + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | archive_cmds | \ + postinstall_cmds | postuninstall_cmds | finish_cmds) + # Double-quote double-evaled strings. + eval "$var=\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\"\`" + ;; + *) + eval "$var=\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`" + ;; + esac +done + +ofile=libtool +trap "$rm $ofile; exit 1" 1 2 15 +echo creating $ofile +$rm $ofile +cat < $ofile +#! /bin/sh + +# libtool - Provide generalized library-building support services. +# Generated automatically by $PROGRAM - GNU $PACKAGE $VERSION +# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. +# +# Copyright (C) 1996-1998 Free Software Foundation, Inc. +# Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This program was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# CC="$old_CC" CFLAGS="$old_CFLAGS" CPPFLAGS="$old_CPPFLAGS" \\ +# LD="$old_LD" NM="$old_NM" RANLIB="$old_RANLIB" LN_S="$old_LN_S" \\ +# $0$ltconfig_args +# +# Compiler and other test output produced by $progname, useful for +# debugging $progname, is in ./config.log if it exists. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "\${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi + +# An echo program that does not interpret backslashes. +echo="$ltecho" + +# The version of $progname that generated this script. +LTCONFIG_VERSION="$VERSION" + +# Shell to use when invoking shell scripts. +SHELL=${CONFIG_SHELL-/bin/sh} + +# Whether or not to build libtool libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build old-style libraries. +build_old_libs=$enable_static + +# The host system. +host_alias="$host_alias" +host="$host" + +# The archiver. +AR="$AR" + +# The default C compiler. +CC="$CC" + +# The linker used to build libraries. +LD="$LD" + +# Whether we need hard or soft links. +LN_S="$LN_S" + +# A BSD-compatible nm program. +NM="$NM" + +# The name of the directory that contains temporary libtool files. +objdir="$objdir" + +# How to create reloadable object files. +reload_flag="$reload_flag" +reload_cmds="$reload_cmds" + +# How to pass a linker flag through the compiler. +wl="$wl" + +# Additional compiler flags for building library objects. +pic_flag="$pic_flag" + +# Compiler flag to prevent dynamic linking. +link_static_flag="$link_static_flag" + +# Compiler flag to turn off builtin functions. +no_builtin_flag="$no_builtin_flag" + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec="$export_dynamic_flag_spec" + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec="$libname_spec" + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec="$library_names_spec" + +# The coded name of the library, if different from the real name. +soname_spec="$soname_spec" + +# Commands used to build and install an old-style archive. +RANLIB="$RANLIB" +old_archive_cmds="$old_archive_cmds" +old_postinstall_cmds="$old_postinstall_cmds" +old_postuninstall_cmds="$old_postuninstall_cmds" + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds="$old_archive_from_new_cmds" + +# Commands used to build and install a shared archive. +archive_cmds="$archive_cmds" +postinstall_cmds="$postinstall_cmds" +postuninstall_cmds="$postuninstall_cmds" + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag="$allow_undefined_flag" + +# Flag that forces no undefined symbols. +no_undefined_flag="$no_undefined_flag" + +# Commands used to finish a libtool library installation in a directory. +finish_cmds="$finish_cmds" + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval="$finish_eval" + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe="$global_symbol_pipe" + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec="$hardcode_libdir_flag_spec" + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator="$hardcode_libdir_separator" + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +EOF + +case "$host_os" in +aix3*) + cat <<\EOF >> $ofile +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "${COLLECT_NAMES+set}" != set; then + COLLECT_NAMES= + export COLLECT_NAMES +fi + +EOF + ;; +esac + +# Append the ltmain.sh script. +cat "$ltmain" >> $ofile || (rm -f $ofile; exit 1) + +chmod +x $ofile +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/src/dep/src/irrlicht/libpng/ANNOUNCE b/src/dep/src/irrlicht/libpng/ANNOUNCE index 561a5e2..f6c38f3 100644 --- a/src/dep/src/irrlicht/libpng/ANNOUNCE +++ b/src/dep/src/irrlicht/libpng/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.2.18 - May 15, 2007 +Libpng 1.2.32 - September 18, 2008 This is a public release of libpng, intended for use in production codes. @@ -8,38 +8,45 @@ Files available for download: Source files with LF line endings (for Unix/Linux) and with a "configure" script - libpng-1.2.18.tar.gz - libpng-1.2.18.tar.bz2 + libpng-1.2.32.tar.gz + libpng-1.2.32.tar.lzma + (Get the lzma codec from ). + libpng-1.2.32.tar.bz2 Source files with LF line endings (for Unix/Linux) without the "configure" script - libpng-1.2.18-no-config.tar.gz - libpng-1.2.18-no-config.tar.bz2 + libpng-1.2.32-no-config.tar.gz + libpng-1.2.32-no-config.tar.lzma + libpng-1.2.32-no-config.tar.bz2 Source files with CRLF line endings (for Windows), without the "configure" script - lpng1218.zip - lpng1218.tar.bz2 + lpng1232.zip + lpng1232.7z + lpng1232.tar.bz2 Project files - libpng-1.2.18-project-netware.zip - libpng-1.2.18-project-wince.zip + libpng-1.2.32-project-netware.zip + libpng-1.2.32-project-wince.zip Other information: - libpng-1.2.18-README.txt - libpng-1.2.18-KNOWNBUGS.txt - libpng-1.2.18-LICENSE.txt - libpng-1.2.18-Y2K-compliance.txt + libpng-1.2.32-README.txt + libpng-1.2.32-KNOWNBUGS.txt + libpng-1.2.32-LICENSE.txt + libpng-1.2.32-Y2K-compliance.txt + libpng-1.2.32-[previous version]-diff.txt -Changes since the last public release (1.2.17): +Changes since the last public release (1.2.31): -version 1.2.18 [May 15, 2007] +version 1.2.32 [September 18, 2008] - Reverted the recent change to symbol-handling in configure script + Shortened tIME_string to 29 bytes in pngtest.c + Fixed off-by-one error introduced in png_push_read_zTXt() function in + libpng-1.2.30/pngpread.c (Harald van Dijk) Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/src/dep/src/irrlicht/libpng/CHANGES b/src/dep/src/irrlicht/libpng/CHANGES index e3f4f68..9b0f904 100644 --- a/src/dep/src/irrlicht/libpng/CHANGES +++ b/src/dep/src/irrlicht/libpng/CHANGES @@ -1480,7 +1480,7 @@ version 1.2.9beta5 [March 4, 2006] Restored scripts/makefile.elf which was inadvertently deleted. version 1.2.9beta6 [March 6, 2006] - Fixed typo (18) in configuration files. + Fixed typo (RELEASE) in configuration files. version 1.2.9beta7 [March 7, 2006] Removed libpng.vers and libpng.sym from libpng12_la_SOURCES in Makefile.am @@ -1669,7 +1669,7 @@ version 1.2.15rc2 [December 21, 2006] Added scripts/makefile.nommx version 1.2.15rc3 [December 25, 2006] - Fixed shared library numbering error that was intruduced in 1.2.15beta6. + Fixed shared library numbering error that was introduced in 1.2.15beta6. version 1.2.15rc4 [December 27, 2006] Fixed handling of rgb_to_gray when png_ptr->color.gray isn't set. @@ -1677,7 +1677,7 @@ version 1.2.15rc4 [December 27, 2006] version 1.2.15rc5 [December 31, 2006] Revised handling of rgb_to_gray. -version 1.2.15 [January 5, 2007] +version 1.0.23, 1.2.15 [January 5, 2007] Added some (unsigned long) typecasts in pngtest.c to avoid printing errors. version 1.2.16beta1 [January 6, 2007] @@ -1686,7 +1686,7 @@ version 1.2.16beta1 [January 6, 2007] version 1.2.16beta2 [January 16, 2007] Revised scripts/CMakeLists.txt -version 1.2.16 [January 31, 2007] +version 1.0.24, 1.2.16 [January 31, 2007] No changes. version 1.2.17beta1 [March 6, 2007] @@ -1723,12 +1723,530 @@ version 1.2.17rc4 [May 10, 2007] version 1.0.25 [May 15, 2007] version 1.2.17 [May 15, 2007] Added "png_ptr->num_trans=0" before error return in png_handle_tRNS, - to eliminate a vulnerability (CVE-2007-2554, CERT VU#684664) + to eliminate a vulnerability (CVE-2007-2445, CERT VU#684664) version 1.0.26 [May 15, 2007] version 1.2.18 [May 15, 2007] Reverted the libpng-1.2.17rc3 change to symbol-handling in configure script +version 1.2.19beta1 [May 18, 2007] + Changed "const static" to "static PNG_CONST" everywhere, mostly undoing + change of libpng-1.2.17beta2. Changed other "const" to "PNG_CONST" + Changed some handling of unused parameters, to avoid compiler warnings. + "if (unused == NULL) return;" becomes "unused = unused". + +version 1.2.19beta2 [May 18, 2007] + Only use the valid bits of tRNS value in png_do_expand() (Brian Cartier) + +version 1.2.19beta3 [May 19, 2007] + Add some "png_byte" typecasts in png_check_keyword() and write new_key + instead of key in zTXt chunk (Kevin Ryde). + +version 1.2.19beta4 [May 21, 2007] + Add png_snprintf() function and use it in place of sprint() for improved + defense against buffer overflows. + +version 1.2.19beta5 [May 21, 2007] + Fixed png_handle_tRNS() to only use the valid bits of tRNS value. + Changed handling of more unused parameters, to avoid compiler warnings. + Removed some PNG_CONST in pngwutil.c to avoid compiler warnings. + +version 1.2.19beta6 [May 22, 2007] + Added some #ifdef PNG_MMX_CODE_SUPPORTED where needed in pngvcrd.c + Added a special "_MSC_VER" case that defines png_snprintf to _snprintf + +version 1.2.19beta7 [May 22, 2007] + Squelched png_squelch_warnings() in pnggccrd.c and added an + #ifdef PNG_MMX_CODE_SUPPORTED block around the declarations that caused + the warnings that png_squelch_warnings was squelching. + +version 1.2.19beta8 [May 22, 2007] + Removed __MMX__ from test in pngconf.h. + +version 1.2.19beta9 [May 23, 2007] + Made png_squelch_warnings() available via PNG_SQUELCH_WARNINGS macro. + Revised png_squelch_warnings() so it might work. + Updated makefile.sgcc and makefile.solaris; added makefile.solaris-x86. + +version 1.2.19beta10 [May 24, 2007] + Resquelched png_squelch_warnings(), use "__attribute__((used))" instead. + +version 1.2.19beta11 [May 28, 2007] + Return 0 from png_get_sPLT() and png_get_unknown_chunks() if png_ptr is NULL; + changed three remaining instances of png_strcpy() to png_strncpy() (David + Hill). + Make test for NULL row_buf at the beginning of png_do_read_transformations + unconditional. + +version 1.2.19beta12 [May 28, 2007] + Revised pnggccrd.c. + +version 1.2.19beta13 [June 14, 2007] + Prefer PNG_USE_PNGVCRD when _MSC_VER is defined in pngconf.h + +version 1.2.19beta14 [June 16, 2007] + Fix bug with handling of 16-bit transparency, introduced in 1.2.19beta2 + +version 1.2.19beta15 [June 17, 2007] + Revised pnggccrd.c. + +version 1.2.19beta16 [June 18, 2007] + Revised pnggccrd.c again. + Updated contrib/gregbook. + Changed '#include "pnggccrd.c"' to 'include "$srcdir/pnggccrd.c"' + in configure.ac + +version 1.2.19beta17 [June 19, 2007] + Revised many of the makefiles, to set -DPNG_NO_MMX_CODE where needed + and to not use -O3 unless -DPNG_NO_MMX_CODE is also set. + +version 1.2.19beta18 [June 23, 2007] + Replaced some C++ style comments with C style comments in pnggccrd.c. + Copied optimized C code from pnggccrd.c to pngrutil.c, removed dependency + on pnggccrd.o from many makefiles. + Added sl and dylib to list of extensions be installed by Makefile.am + +version 1.2.19beta19 [June 28, 2007] + Fixed testing PNG_RGB_TO_GRAY_ERR & PNG_RGB_TO_GRAY_WARN in pngrtran.c + More cleanup of pnggccrd.c and pngvcrd.c + +version 1.2.19beta20 [June 29, 2007] + Rebuilt Makefile.in and configure using libtool-1.5.24. + Fixed typo in pnggccrd.c + +version 1.2.19beta21 [June 30, 2007] + More revision of pnggccrd.c + Added "test" target to Makefile.in and Makefile.am + +version 1.2.19beta22 [July 3, 2007] + Added info about pngrutil/pnggccrd/pngvcrd to png_get_header_version() + Fix type definition of dummy_value_a, b in pnggccrd.c + +version 1.2.19beta23 [July 10, 2007] + Revert change to type definition of dummy_value_a, b in pnggccrd.c + Make sure __PIC__ is defined in pnggccrd.c when PIC is defined. + Require gcc-4.1 or better to use PNG_HAVE_MMX_FILTER_ROW on x86_64 platforms + +version 1.2.19beta24 [July 14, 2007] + Added PNG_NO_READ_FILTER, PNG_NO_WRITE_FILTER, PNG_NO_WARNING macros. + Added contrib/pngminim to demonstrate building minimal encoder and decoder + +version 1.2.19beta25 [July 15, 2007] + Removed the new PNG_NO_READ_FILTER macro since it would make the library + unable to read valid PNG files, and filtering is at the heart of the + PNG format. + +version 1.2.19beta26 [July 16, 2007] + Changed "png_free(str)" to "png_free(png_ptr,str)" in pngrutil.c WinCE + code (Yves Piguet). This bug was introduced in libpng-1.2.14. + Updated scripts/CMakeLists.txt + Relocated a misplaced #endif in pnggccrd.c + +version 1.2.19beta27 [July 17, 2007] + Fixed incorrect stride and number of bytes copied (was 4 instead of + 6 bytes) in the cleanup loop of pnggccrd.c and pngvcrd.c for handling + the end of 48-bit interlaced rows (Glenn R-P). + +version 1.2.19beta28 [July 19, 2007] + Removed requirement for gcc-4.1 or better to use PNG_HAVE_MMX_FILTER_ROW + on x86_64 platforms + Added png_warning() in pngrutil.c for short iCCP, iTXt, sPLT, or zTXT chunks. + Revised pngtest.c so warnings are displayed regardless of PNG_NO_STDIO. + +version 1.2.19beta29 [July 20, 2007] + Fix typo in pnggccrd.c (%%eax should be %%ax in secondloop48) + +version 1.2.19beta30 [July 26, 2007] + Revised pnggccrd.c + +version 1.2.19beta31 [July 27, 2007] + Fix typos in pnggccrd.c + +version 1.0.27rc1 and 1.2.19rc1 [July 31, 2007] + Disable PNG_MMX_CODE_SUPPORTED when PNG_ASSEMBLER_CODE_SUPPORTED is off. + Enable PNG_MMX_READ_FILTER_* by default, except when gcc-3.x is being + used (they were inadvertently disabled in libpng-1.2.19beta23). + Fix some debugging statements in pnggccrd.c and pngrutil.c + Added information about disabling the MMX code in libpng documentation. + +version 1.0.27rc2 and 1.2.19rc2 [August 4, 2007] + Removed some "#if 0" blocks. + Made a global struct local in pngvcrd.c to make it thread safe. + Issue a png_error() if application attempts to transform a row tht + has not been initialized. + +version 1.0.27rc3 and 1.2.19rc3 [August 9, 2007] + Slightly revised pngvcrd.c + +version 1.0.27rc4 and 1.2.19rc4 [August 9, 2007] + Revised pnggccrd.c debugging change of rc1, which was broken. + Revised scripts/CMakeLists.txt + Change default to PNG_NO_GLOBAL_ARRAYS for MSVC. + Turn off PNG_FLAG_ROW_INIT flag when setting transforms that expand pixels. + +version 1.0.27rc5 and 1.2.19rc5 [August 10, 2007] + Fix typo (missing '"') in pnggccrd.c + Revise handling of png_strtod in recent versions of WINCE + +version 1.0.27rc6 and 1.2.19rc6 [August 15, 2007] + Fix typo (missing ',') in contrib/gregbook/readpng2.c + Undid row initialization error exit added to rc2 and rc4. + +version 1.0.27 and 1.2.19 [August 18, 2007] + Conditionally restored row initialization error exit. + +version 1.2.20beta01 [August 19, 2007] + Fixed problem with compiling pnggccrd.c on Intel-Apple platforms. + Changed png_malloc() to png_malloc_warn() in png_set_sPLT(). + Added PNG_NO_ERROR_TEXT feature, with demo in contrib/pngminim + Removed define PNG_WARN_UNINITIALIZED_ROW 1 /* 0: warning; 1: error */ + because it caused some trouble. + +version 1.2.20beta02 [August 20, 2007] + Avoid compiling pnggccrd.c on Intel-Apple platforms. + +version 1.2.20beta03 [August 20, 2007] + Added "/D PNG_NO_MMX_CODE" to the non-mmx builds of projects/visualc6 + and visualc71. + +version 1.2.20beta04 [August 21, 2007] + Revised pngvcrd.c for improved efficiency (Steve Snyder). + +version 1.2.20rc1 [August 23, 2007] + Revised pngconf.h to set PNG_NO_MMX_CODE for gcc-3.x compilers. + +version 1.2.20rc2 [August 27, 2007] + Revised scripts/CMakeLists.txt + Revised #ifdefs to ensure one and only one of pnggccrd.c, pngvcrd.c, + or part of pngrutil.c is selected. + +version 1.2.20rc3 [August 30, 2007] + Remove a little more code in pngwutil.c when PNG_NO_WRITE_FILTER is selected. + Added /D _CRT_SECURE_NO_WARNINGS to visual6c and visualc71 projects. + Compile png_mmx_support() in png.c even when PNG_NO_MMX_CODE is defined. + Restored a "superfluous" #ifdef that was removed from 1.2.20rc2 pnggccrd.c, + breaking the png_mmx_support() function. + +version 1.2.20rc4 [September 1, 2007] + Removed Intel contributions (MMX, Optimized C). + +version 1.2.20rc5 [September 2, 2007] + Restored configure and Makefile.in to rc3 and put a snippet of code in + pnggccrd.c, to ensure configure makes the same PNG_NO_MMX_CODE selection + +version 1.2.20rc6 [September 2, 2007] + Fixed bugs in scripts/CMakeLists.txt + Removed pngvcrd.c references from msvc projects. + +version 1.0.28 and 1.2.20 [September 8, 2007] + Removed "(NO READ SUPPORT)" from png_get_header_version() string. + +version 1.2.21beta1 [September 14, 2007] + Fixed various mistakes reported by George Cook and Jeff Phillips: + logical vs bitwise NOT in pngrtran.c, bug introduced in 1.2.19rc2 + 16-bit cheap transparency expansion, bug introduced in 1.2.19beta2 + errors with sizeof(unknown_chunk.name), bugs introduced in 1.2.19beta11 + <= compare with unsigned var in pngset.c, should be ==. + +version 1.2.21beta2 [September 18, 2007] + Removed some extraneous typecasts. + +version 1.2.21rc1 [September 25, 2007] + Fixed potential out-of-bounds reads in png_handle_pCAL() and + png_handle_ztXt() ("flayer" results reported by Tavis Ormandy). + +version 1.2.21rc2 [September 26, 2007] + Fixed potential out-of-bounds reads in png_handle_sCAL(), + png_handle_iTXt(), and png_push_read_tEXt(). + Remove some PNG_CONST declarations from pngwutil.c to avoid compiler warnings + Revised makefiles to update paths in libpng.pc properly. + +version 1.2.21rc3 [September 27, 2007] + Revised makefiles to update "Libs" in libpng.pc properly. + +version 1.0.29 and 1.2.21rc3 [October 4, 2007] + No changes. + +version 1.2.22beta1 [October 4, 2007] + Again, fixed logical vs bitwise NOT in pngrtran.c, bug introduced + in 1.2.19rc2 + +version 1.2.22beta2 [October 5, 2007] + Fixed string length error in pngset.c (caused crashes while decoding iCCP) + Add terminating NULL after each instance of png_strncpy(). + +version 1.2.22beta3 [October 6, 2007] + Fix two off-by-one terminating NULL after png_strncpy(). + +version 1.2.22beta4 [October 7, 2007] + Changed some 0 to '\0'. + +version 1.0.30rc1 and 1.2.22rc1 [October 8, 2007] + No changes. + +version 1.0.30 and 1.2.22 [October 13, 2007] + No changes. + +version 1.2.23beta01 [October 15, 2007] + Reduced number of invocations of png_strlen() in pngset.c. + Changed [azAZ09_] to [_abcde...89] in Makefile.am for better localization. + +version 1.2.23beta02 [October 16, 2007] + Eliminated png_strncpy() and png_strcpy() (Pierre Poissinger) + Changed $AN to $(AN) in Makefile.am. + +version 1.2.23beta03 [October 16, 2007] + Fixed off-by-one error in pngset.c + Restore statement to set last character of buffer to \0 in pngerror.c + +version 1.2.23beta04 [October 23, 2007] + Reject attempt to set all-zero cHRM values. + +version 1.2.23beta05 [October 26, 2007] + Add missing quotes in projects/visualc6, lost in version 1.2.20rc3 + +version 1.2.23rc01 [November 2, 2007] + No changes. + +version 1.2.23 [November 6, 2007] + No changes. + +version 1.2.24beta01 [November 19, 2007] + Moved misplaced test for malloc failure in png_set_sPLT(). This bug was + introduced in libpng-1.2.20beta01. + Ifdef out avg_row etc from png.h and pngwrite.c when PNG_NO_WRITE_FILTER + Do not use png_ptr->free_fn and png_ptr->mem_fn in png_destroy_read_struct() + when png_ptr is NULL (Marshall Clow). + Updated handling of symbol prefixes in Makefile.am and configure.ac (Mike + Frysinger). + +version 1.2.24beta02 [November 30, 2007] + Removed a useless test and fixed incorrect test in png_set_cHRM_fixed() + (David Hill). + +version 1.2.24rc01 [December 7, 2007] + No changes. + +version 1.2.24 [December 14, 2007] + Make sure not to redefine _BSD_SOURCE in pngconf.h + Revised gather.sh and makefile.std in contrib/pngminim to avoid compiling + unused files. + +version 1.2.25beta01 [January 7, 2008] + Fixed bug with unknown chunk handling, introduced in version 1.2.17rc2 + +version 1.2.25beta02 [January 10, 2008] + Prevent gamma from being applied twice. + +version 1.2.25rc01 [January 17, 2008] + No changes. + +version 1.2.25beta03 [January 22, 2008] + Fixed some continue-after-malloc-failure errors in pngset.c (David Hill) + Check for info_ptr == NULL in png_read_info() and png_process_data(). + Check for possible use of NULL user_png_ver[] in png_create_read_struct(). + Change "if (swidth == NULL)" to "if (sheight == NULL)" in png_handle_sCAL + (bug introduced in libpng-1.2.4/1.0.13). + Return from png_destroy_read_struct() if png_ptr_ptr is NULL. + Fix overflow of "msg" in png_decompress_chunk(). + +version 1.2.25beta04 [January 26, 2008] + Work around Coverity bug report by slightly refactoring + png_read_push_finish_row() + +version 1.2.25beta05 [January 31, 2008] + Added libpng-1.2.25beta05.tar.lzma to distribution. Get the lzma codec + from . + Added lp1225b05.7z to distribution. Get the 7-zip decoder from + from . + Fixed some broken links in the README file. + +version 1.2.25beta06 [February 6, 2008] + Refactored png_read_push_finish_row() again, trying to satisfy Coverity. + Fixed potential NULL dereference of png_ptr in png_destroy_write_struct(); + clarified potential NULL dereference of png_ptr in png_destroy_read_struct(); + fixed potential NULL dereference of info_ptr in png_handle_bKGD(); + fixed potential NULL dereference of user_png_ver[] in + png_create_write_struct_2(). (Coverity) + +version 1.2.25rc02 [February 10, 2008] + Reset png_ptr->pass in png_read_push_finish_row() before break. + Changed "pass" from png_byte to int. + +version 1.2.25 and 1.0.31 [February 18, 2008] + No changes. + +version 1.2.26beta01 [February 21, 2008] + Added missing "(" in pngmem.c. Bug introduced in libpng-1.2.2/1.0.13 + +version 1.2.26beta02 [March 12, 2008] + Refined error message returned from deflateInit2 in pngwutil.c + Check IHDR length in png_push_read_chunk() before saving it. + +version 1.2.26beta03 [March 16, 2008] + Revised contrib/gregbook to handle premature end-of-file and file + read errors correctly. + +version 1.2.26beta04 [March 18, 2008] + Free png_ptr->big_row_buf and png_ptr->prev_row before allocating + new copies in png_read_start_row(). Bug introduced in libpng-1.2.22. + +version 1.2.26beta05 [March 19, 2008] + Removed extra png_free() added in libpng-1.2.26beta04. + +version 1.2.26beta06 [March 19, 2008] + Avoid reallocating big_row_buf and prev_row when the size does not increase. + +version 1.2.26rc01 [March 26, 2008] + Ifdef out some code that is unused when interlacing is not supported. + +versions 1.0.32 and 1.2.26 [April 2, 2008] + No changes. + +version 1.2.27beta01 [April 12, 2008] + Fixed bug (introduced in libpng-1.0.5h) with handling zero-length + unknown chunks. + Added more information about png_set_keep_unknown_chunks() to the + documentation. + Reject tRNS chunk with out-of-range samples instead of masking off + the invalid high bits as done in since libpng-1.2.19beta5. + +version 1.2.27beta02 [April 13, 2008] + Revised documentation about unknown chunk and user chunk handling. + Keep tRNS chunk with out-of-range samples and issue a png_warning(). + +version 1.2.27beta03 [April 14, 2008] + Added check for NULL ptr in TURBOC version of png_free_default(). + Removed several unnecessary checks for NULL before calling png_free(). + Revised png_set_tRNS() so that calling it twice removes and invalidates + the previous call. + Revised pngtest to check for out-of-range tRNS samples. + +version 1.2.27beta04 [April 18, 2008] + Added AC_LIBTOOL_WIN32_DLL to configure.ac + Rebuilt Makefile.in, aclocal.m4, and configure with autoconf-2.62 + +version 1.2.27beta05 [April 19, 2008] + Added MAINTAINERCLEANFILES variable to Makefile.am + +version 1.2.27beta06 [April 21, 2008] + Avoid changing color_type from GRAY to RGB by + png_set_expand_gray_1_2_4_to_8(). + +version 1.2.27rc01 [April 23, 2008] + Fix broken URL for rfc2083 in png.5 and libpng-*.txt + +version 1.0.33 and 1.2.27 [April 30, 2008] + No changes. + +version 1.0.34 and 1.2.28 [April 30, 2008] + Rebuilt Makefile.in, aclocal.m4, and configure with autoconf-2.61 + due to backward incompatibilities. + Removed a stray object file from contrib/gregbook + +version 1.2.29beta01 [May 1, 2008] + Removed some stray *.diff and *.orig files + +version 1.2.29beta02 [May 1, 2008] + Reverted Makefile.in, aclocal.m4, and configure to the libpng-1.2.26 + versions. + +version 1.2.29beta03 [May 2, 2008] + Added --force to autogen libtoolize options and --force-missing to + automake options. + Changed $(ECHO) to echo in Makefile.am and Makefile.in + Updated all configure files to autoconf-2.62 + #ifdef out pnggcrd.c code if using MSC_VER + +version 1.2.29rc01 [May 4, 2008] + No changes. + +version 1.0.35 and 1.2.29 [May 8, 2008] + No changes. + +version 1.0.37 [May 9, 2008] + Updated Makefile.in and configure (omitted version 1.0.36). + +version 1.2.30beta01 [May 29, 2008] + Updated libpng.pc-configure.in and libpng-config.in per debian bug reports. + +version 1.2.30beta02 [June 25, 2008] + Restored png_flush(png_ptr) at the end of png_write_end(), that was + removed from libpng-1.0.9beta03. + +version 1.2.30beta03 [July 6, 2008] + Merged some cosmetic whitespace changes from libpng-1.4.0beta19. + Inline call of png_get_uint_32() in png_get_uint_31(), as in 1.4.0beta19. + Added demo of decoding vpAg and sTER chunks to pngtest.c, from 1.4.0beta19. + Changed PNGMAJ from 0 to 12 in makefile.darwin, which does not like 0. + Added new private function png_read_chunk_header() from 1.4.0beta19. + Merge reading of chunk length and chunk type into a single 8-byte read. + Merge writing of chunk length and chunk type into a single 8-byte write. + +version 1.2.30beta04 [July 10, 2008] + Merged more cosmetic whitespace changes from libpng-1.4.0beta19. + +version 1.0.38rc01, 1.2.30rc01 [September 18, 2008] + No changes. + +version 1.0.38rc02, 1.2.30rc02 [July 21, 2008] + Moved local array "chunkdata" from pngrutil.c to the png_struct, so + it will be freed by png_read_destroy() in case of a read error (Kurt + Christensen). + +version 1.0.38rc03, 1.2.30rc03 [July 21, 2008] + Changed "purpose" and "buffer" to png_ptr->chunkdata to avoid memory leaking. + +version 1.0.38rc04, 1.2.30rc04 [July 22, 2008] + Changed "chunkdata = NULL" to "png_ptr->chunkdata = NULL" several places in + png_decompress_chunk(). + +version 1.0.38rc05, 1.2.30rc05 [July 25, 2008] + Changed all remaining "chunkdata" to "png_ptr->chunkdata" in + png_decompress_chunk() and remove chunkdata from parameter list. + Put a call to png_check_chunk_name() in png_read_chunk_header(). + Revised png_check_chunk_name() to reject a name with a lowercase 3rd byte. + Removed two calls to png_check_chunk_name() occuring later in the process. + +version 1.0.38rc06, 1.2.30rc06 [July 29, 2008] + Added a call to png_check_chunk_name() in pngpread.c + Reverted png_check_chunk_name() to accept a name with a lowercase 3rd byte. + +version 1.0.38r07, 1.2.30r07 [August 2, 2008] + Changed "-Wall" to "-W -Wall" in the CFLAGS in all makefiles (Cosmin Truta) + Declared png_ptr "volatile" in pngread.c and pngwrite.c to avoid warnings. + Added code in pngset.c to quiet compiler warnings. + Updated contrib/visupng/cexcept.h to version 2.0.1 + Relocated a misplaced "#endif /* PNG_NO_WRITE_FILTER */" in pngwutil.c + +version 1.0.38r08, 1.2.30r08 [August 2, 2008] + Enclose "volatile" declarations in #ifdef PNG_SETJMP_SUPPORTED (Cosmin). + +version 1.0.38, 1.2.30 [August 14, 2008] + No changes. + +version 1.2.31rc01 [August 19, 2008] + Removed extra crc check at the end of png_handle_cHRM(). Bug introduced + in libpng-1.2.30beta03 (Heiko Nitzsche). + +version 1.2.31rc02 [August 19, 2008] + Added PNG_WRITE_FLUSH_SUPPORTED block around new png_flush() call. + +version 1.2.31rc03 [August 19, 2008] + Added PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED block, off by default, around + new png_flush(). + +version 1.0.39, 1.2.31 [August 21, 2008] + No changes. + +version 1.2.32beta01 [September 6, 2008] + Shortened tIME_string to 29 bytes in pngtest.c + Fixed off-by-one error introduced in png_push_read_zTXt() function in + libpng-1.2.30beta04/pngpread.c (Harald van Dijk) + +version 1.0.40, 1.2.32[September 18, 2008] + No changes. + Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-implement diff --git a/src/dep/src/irrlicht/libpng/INSTALL b/src/dep/src/irrlicht/libpng/INSTALL index cd0583c..2cd7d71 100644 --- a/src/dep/src/irrlicht/libpng/INSTALL +++ b/src/dep/src/irrlicht/libpng/INSTALL @@ -1,5 +1,5 @@ -Installing libpng version 1.2.18 - May 15, 2007 +Installing libpng version 1.2.32 - September 18, 2008 On Unix/Linux and similar systems, you can simply type @@ -44,7 +44,7 @@ to have access to the zlib.h and zconf.h include files that correspond to the version of zlib that's installed. You can rename the directories that you downloaded (they -might be called "libpng-1.2.18" or "lpng109" and "zlib-1.2.1" +might be called "libpng-1.2.32" or "lpng109" and "zlib-1.2.1" or "zlib121") so that you have directories called "zlib" and "libpng". Your directory structure should look like this: @@ -101,15 +101,9 @@ include CMakeLists.txt => "cmake" script makefile.std => Generic UNIX makefile (cc, creates static libpng.a) makefile.elf => Linux/ELF makefile symbol versioning, - gcc, creates libpng12.so.0.1.2.18) + gcc, creates libpng12.so.0.1.2.32) makefile.linux => Linux/ELF makefile - (gcc, creates libpng12.so.0.1.2.18) - makefile.gcmmx => Linux/ELF makefile - (gcc, creates libpng12.so.0.1.2.18, - uses assembler code tuned for Intel MMX platform) - makefile.nommx => Linux/ELF makefile - (gcc, creates libpng12.so.0.1.2.18 - does not use Intel MMX assembler code) + (gcc, creates libpng12.so.0.1.2.32) makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.knr => Archaic UNIX Makefile that converts files with ansi2knr (Requires ansi2knr.c from @@ -131,12 +125,14 @@ include makefile.openbsd => OpenBSD makefile makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib) makefile.sggcc => Silicon Graphics (gcc, - creates libpng12.so.0.1.2.18) + creates libpng12.so.0.1.2.32) makefile.sunos => Sun makefile makefile.solaris => Solaris 2.X makefile (gcc, - creates libpng12.so.0.1.2.18) + creates libpng12.so.0.1.2.32) + makefile.solaris-x86 => Solaris/intelMMX 2.X makefile (gcc, + creates libpng12.so.0.1.2.32) makefile.so9 => Solaris 9 makefile (gcc, - creates libpng12.so.0.1.2.18) + creates libpng12.so.0.1.2.32) makefile.32sunu => Sun Ultra 32-bit makefile makefile.64sunu => Sun Ultra 64-bit makefile makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc @@ -152,10 +148,7 @@ include makefile.tc3 => Turbo C 3.0 makefile makefile.dj2 => DJGPP 2 makefile makefile.msc => Microsoft C makefile - makefile.vcawin32 => makefile for Microsoft Visual C++ 5.0 and later (uses - assembler code tuned for Intel MMX platform) - makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and later (does - not use assembler code) + makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and later makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def) pngos2.def => OS/2 module definition file used by makefile.os2 makefile.watcom => Watcom 10a+ Makefile, 32-bit flat memory model diff --git a/src/dep/src/irrlicht/libpng/KNOWNBUG b/src/dep/src/irrlicht/libpng/KNOWNBUG index 975f67a..d635555 100644 --- a/src/dep/src/irrlicht/libpng/KNOWNBUG +++ b/src/dep/src/irrlicht/libpng/KNOWNBUG @@ -1,28 +1,22 @@ -Known bugs in libpng version 1.2.18 +Known bugs in libpng version 1.2.32 -1. April 22, 2001: pnggccrd.c has been reported to crash on NetBSD when - reading interlaced PNG files, when assembler code is enabled but running - on a non-MMX i386 platform. - - STATUS: Under investigation. The change to pnggccrd.c in libpng-1.2.1 - fixed a problem under FreeBSD but not the problem with NetBSD, which - still fails as of libpng-1.2.2rc1. - -2. February 23, 2006: The custom makefiles don't build libpng with -lz. +1. February 23, 2006: The custom makefiles don't build libpng with -lz. STATUS: This is a subject of debate. The change will probably be made - as a part of a major overhaul of the makefiles in libpng version 1.3.0. + as a part of a major overhaul of the makefiles in libpng version 1.4.0. -3. February 24, 2006: The Makefile generated by the "configure" script +2. February 24, 2006: The Makefile generated by the "configure" script fails to install symbolic links libpng12.so => libpng12.so.0.1.2.9betaN that are generated by the custom makefiles. - STATUS: For now, system library builders should use the custom makefiles. +3. September 4, 2007: There is a report that pngtest crashes on MacOS 10. -4. March 2007: Building 1.2.16 with PNG_ASSEMBLER_CODE_SUPPORTED; - PNG_MMX_CODE_SUPPORTED results in multiple definitions of png_combine_row, - png_do_read_interlace, and png_read_filter_row + STATUS: workarounds are + 1) Compile without optimization (crashes are observed with + -arch i386 and -O2 or -O3, using gcc-4.0.1). + 2) Compile pngtest.c with PNG_DEBUG defined (the bug goes away if + you try to look at it). + 3) Ignore the crash. The library itself seems to be OK. - STATUS: Investigating. diff --git a/src/dep/src/irrlicht/libpng/LICENSE b/src/dep/src/irrlicht/libpng/LICENSE index 09bcaf9..c03cc94 100644 --- a/src/dep/src/irrlicht/libpng/LICENSE +++ b/src/dep/src/irrlicht/libpng/LICENSE @@ -8,8 +8,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: If you modify libpng you may insert additional notices immediately following this sentence. -libpng versions 1.2.6, August 15, 2004, through 1.2.18, May 15, 2007, are -Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are +libpng versions 1.2.6, August 15, 2004, through 1.2.32, September 18, 2008, are +Copyright (c) 2004, 2006-2008 Glenn Randers-Pehrson, and are distributed according to the same disclaimer and license as libpng-1.2.5 with the following individual added to the list of Contributing Authors @@ -106,4 +106,4 @@ certification mark of the Open Source Initiative. Glenn Randers-Pehrson glennrp at users.sourceforge.net -May 15, 2007 +September 18, 2008 diff --git a/src/dep/src/irrlicht/libpng/README b/src/dep/src/irrlicht/libpng/README index 1316076..ee306ee 100644 --- a/src/dep/src/irrlicht/libpng/README +++ b/src/dep/src/irrlicht/libpng/README @@ -1,11 +1,15 @@ -README for libpng version 1.2.18 - May 15, 2007 (shared library 12.0) +README for libpng version 1.2.32 - September 18, 2008 (shared library 12.0) See the note about version numbers near the top of png.h See INSTALL for instructions on how to install libpng. -Libpng comes in several distribution formats. Get libpng-*.tar.gz -or libpng-*.tar.bz2 if you want UNIX-style line endings in the text -files, or lpng*.zip if you want DOS-style line endings. +Libpng comes in several distribution formats. Get libpng-*.tar.gz, +libpng-*.tar.lzma, or libpng-*.tar.bz2 if you want UNIX-style line +endings in the text files, or lpng*.7z or lpng*.zip if you want DOS-style +line endings. You can get UNIX-style line endings from the *.zip file +by using "unzip -a" but there seems to be no simple way to recover +UNIX-style line endings from the *.7z file. The *.tar.lzma file is +recommended for *NIX users instead. Version 0.89 was the first official release of libpng. Don't let the fact that it's the first release fool you. The libpng library has been in @@ -54,7 +58,7 @@ to set different actions based on whether the CRC error occurred in a critical or an ancillary chunk. The changes made to the library, and bugs fixed are based on discussions -on the PNG-implement mailing list +on the png-mng-implement mailing list and not on material submitted privately to Guy, Andreas, or Glenn. They will forward any good suggestions to the list. @@ -77,12 +81,12 @@ compression library that is useful for more things than just PNG files. You can use zlib as a drop-in replacement for fread() and fwrite() if you are so inclined. -zlib should be available at the same place that libpng is, or at. -ftp://ftp.info-zip.org/pub/infozip/zlib +zlib should be available at the same place that libpng is, or at +ftp://ftp.simplesystems.org/pub/png/src/ You may also want a copy of the PNG specification. It is available as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find -these at http://www.libpng.org/pub/png/documents/ +these at http://www.libpng.org/pub/png/pngdocs.html This code is currently being archived at libpng.sf.net in the [DOWNLOAD] area, and on CompuServe, Lib 20 (PNG SUPPORT) @@ -110,14 +114,14 @@ to subscribe) or to glennrp at users.sourceforge.net You can't reach Guy, the original libpng author, at the addresses given in previous versions of this document. He and Andreas will read mail -addressed to the png-implement list, however. +addressed to the png-mng-implement list, however. Please do not send general questions about PNG. Send them to -the (png-list at ccrc.wustl.edu, subscription required, write to -majordomo at ccrc.wustl.edu with "subscribe png-list" in your message). +the (png-mng-misc at lists.sourceforge.net, subscription required, visit +https://lists.sourceforge.net/lists/listinfo/png-mng-implement to subscribe) On the other hand, please do not send libpng questions to that address, send them to me -or to the png-implement list. I'll +or to the png-mng-implement list. I'll get them in the end anyway. If you have a question about something in the PNG specification that is related to using libpng, send it to me. Send me any questions that start with "I was using libpng, @@ -125,7 +129,7 @@ and ...". If in doubt, send questions to me. I'll bounce them to others, if necessary. Please do not send suggestions on how to change PNG. We have -been discussing PNG for nine years now, and it is official and +been discussing PNG for twelve years now, and it is official and finished. If you have suggestions for libpng, however, I'll gladly listen. Even if your suggestion is not used immediately, it may be used later. @@ -140,6 +144,7 @@ Files in this distribution: TODO => Things not implemented in the current library Y2KINFO => Statement of Y2K compliance example.c => Example code for using libpng functions + libpng-*-*-diff.txt => Diff from previous release libpng.3 => manual page for libpng (includes libpng.txt) libpng.txt => Description of libpng and its functions libpngpf.3 => manual page for libpng's private functions @@ -147,7 +152,6 @@ Files in this distribution: png.c => Basic interface functions common to library png.h => Library function and interface declarations pngconf.h => System specific library configuration - pngasmrd.h => Header file for assembler-coded functions pngerror.c => Error/warning message I/O functions pngget.c => Functions for retrieving info from struct pngmem.c => Memory handling functions @@ -190,11 +194,11 @@ Files in this distribution: descrip.mms => VMS makefile for MMS or MMK makefile.std => Generic UNIX makefile (cc, creates static libpng.a) makefile.elf => Linux/ELF makefile symbol versioning, - gcc, creates libpng12.so.0.1.2.18) + gcc, creates libpng12.so.0.1.2.32) makefile.linux => Linux/ELF makefile - (gcc, creates libpng12.so.0.1.2.18) + (gcc, creates libpng12.so.0.1.2.32) makefile.gcmmx => Linux/ELF makefile - (gcc, creates libpng12.so.0.1.2.18, + (gcc, creates libpng12.so.0.1.2.32, uses assembler code tuned for Intel MMX platform) makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.knr => Archaic UNIX Makefile that converts files with @@ -216,12 +220,12 @@ Files in this distribution: makefile.openbsd => OpenBSD makefile makefile.sgi => Silicon Graphics IRIX (cc, creates static lib) makefile.sggcc => Silicon Graphics - (gcc, creates libpng12.so.0.1.2.18) + (gcc, creates libpng12.so.0.1.2.32) makefile.sunos => Sun makefile makefile.solaris => Solaris 2.X makefile - (gcc, creates libpng12.so.0.1.2.18) + (gcc, creates libpng12.so.0.1.2.32) makefile.so9 => Solaris 9 makefile - (gcc, creates libpng12.so.0.1.2.18) + (gcc, creates libpng12.so.0.1.2.32) makefile.32sunu => Sun Ultra 32-bit makefile makefile.64sunu => Sun Ultra 64-bit makefile makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc @@ -256,7 +260,7 @@ Good luck, and happy coding. -Andreas Eric Dilger (former maintainer, 1996-1997) Internet: adilger at enel.ucalgary.ca - Web: http://www-mddsp.enel.ucalgary.ca/People/adilger/ + Web: http://members.shaw.ca/adilger/ -Guy Eric Schalnat (original author and former maintainer, 1995-1996) (formerly of Group 42, Inc) diff --git a/src/dep/src/irrlicht/libpng/Y2KINFO b/src/dep/src/irrlicht/libpng/Y2KINFO index a299123..4f5579e 100644 --- a/src/dep/src/irrlicht/libpng/Y2KINFO +++ b/src/dep/src/irrlicht/libpng/Y2KINFO @@ -1,13 +1,13 @@ Y2K compliance in libpng: ========================= - May 15, 2007 + September 18, 2008 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. This is your unofficial assurance that libpng from version 0.71 and - upward through 1.2.18 are Y2K compliant. It is my belief that earlier + upward through 1.2.32 are Y2K compliant. It is my belief that earlier versions were also Y2K compliant. Libpng only has three year fields. One is a 2-byte unsigned integer diff --git a/src/dep/src/irrlicht/libpng/configure b/src/dep/src/irrlicht/libpng/configure index 0766c27..da3d7ee 100644 --- a/src/dep/src/irrlicht/libpng/configure +++ b/src/dep/src/irrlicht/libpng/configure @@ -1,13 +1,13 @@ #!/bin/sh echo " There is no \"configure\" script in this distribution of - libpng-1.2.18. + libpng-1.2.32. Instead, please copy the appropriate makefile for your system from the \"scripts\" directory. Read the INSTALL file for more details. Update, July 2004: you can get a \"configure\" based distribution from the libpng distribution sites. Download the file - libpng-1.2.18.tar.gz or libpng-1.2.18.tar.bz2 + libpng-1.2.32.tar.gz, libpng-1.2.32.tar.lzma, or libpng-1.2.32.tar.bz2 " diff --git a/src/dep/src/irrlicht/libpng/contrib/gregbook/LICENSE b/src/dep/src/irrlicht/libpng/contrib/gregbook/LICENSE index f47b7c4..40a0c8e 100644 --- a/src/dep/src/irrlicht/libpng/contrib/gregbook/LICENSE +++ b/src/dep/src/irrlicht/libpng/contrib/gregbook/LICENSE @@ -1,12 +1,19 @@ --------------------------------------------------------------------------- - Copyright (c) 1998-2001 Greg Roelofs. All rights reserved. + Copyright (c) 1998-2008 Greg Roelofs. All rights reserved. This software is provided "as is," without warranty of any kind, express or implied. In no event shall the author or contributors be held liable for any damages arising in any way from the use of this software. + The contents of this file are DUAL-LICENSED. You may modify and/or + redistribute this software according to the terms of one of the + following two licenses (at your option): + + + LICENSE 1 ("BSD-like with advertising clause"): + Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: @@ -23,4 +30,21 @@ and contributors for the book, "PNG: The Definitive Guide," published by O'Reilly and Associates. + + LICENSE 2 (GNU GPL v2 or later): + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + --------------------------------------------------------------------------- diff --git a/src/dep/src/irrlicht/libpng/contrib/gregbook/Makefile.unx b/src/dep/src/irrlicht/libpng/contrib/gregbook/Makefile.unx index 3d055d2..3a5ff4b 100644 --- a/src/dep/src/irrlicht/libpng/contrib/gregbook/Makefile.unx +++ b/src/dep/src/irrlicht/libpng/contrib/gregbook/Makefile.unx @@ -1,73 +1,92 @@ # Sample makefile for rpng-x / rpng2-x / wpng using gcc and make. # Greg Roelofs -# Last modified: 7 March 2002 +# Last modified: 2 June 2007 # # The programs built by this makefile are described in the book, # "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and -# Associates, 1999). Go buy a copy, eh? Buy some for friends -# and family, too. (Not that this is a blatant plug or anything.) +# Associates, 1999). Go buy a copy, eh? Well, OK, it's not +# generally for sale anymore, but it's the thought that counts, +# right? (Hint: http://www.libpng.org/pub/png/book/ ) # # Invoke this makefile from a shell prompt in the usual way; for example: # # make -f Makefile.unx # # This makefile assumes libpng and zlib have already been built or downloaded -# and are both installed in /usr/local/{include,lib} (as indicated by the -# PNG* and Z* macros below). Edit as appropriate--choose only ONE each of -# the PNGINC, PNGLIB, ZINC and ZLIB lines. +# and are installed in /usr/local/{include,lib} or as otherwise indicated by +# the PNG* and Z* macros below. Edit as appropriate--choose only ONE each of +# the PNGINC, PNGLIBd, PNGLIBs, ZINC, ZLIBd and ZLIBs lines. # -# This makefile builds statically linked executables (against libpng and zlib, -# that is), but that can be changed by uncommenting the appropriate PNGLIB and -# ZLIB lines. +# This makefile builds both dynamically and statically linked executables +# (against libpng and zlib, that is), but that can be changed by modifying +# the "EXES =" line. (You need only one set, but for testing it can be handy +# to have both.) # macros -------------------------------------------------------------------- -PNGINC = -I/usr/local/include/libpng12 -#PNGLIB = -L/usr/local/lib -lpng12 # dynamically linked against libpng -PNGLIB = /usr/local/lib/libpng12.a # statically linked against libpng +#PNGDIR = /usr/local/lib +#PNGINC = -I/usr/local/include/libpng12 +#PNGLIBd = -L$(PNGDIR) -lpng12 # dynamically linked, installed libpng +#PNGLIBs = $(PNGDIR)/libpng12.a # statically linked, installed libpng # or: -#PNGINC = -I../libpng -#PNGLIB = -L../libpng -lpng -#PNGLIB = ../libpng/libpng.a +PNGDIR = ../..# this one is for libpng-x.y.z/contrib/gregbook builds +#PNGDIR = ../libpng +PNGINC = -I$(PNGDIR) +PNGLIBd = -Wl,-rpath,$(PNGDIR) -L$(PNGDIR) -lpng12 # dynamically linked +PNGLIBs = $(PNGDIR)/libpng.a # statically linked, local libpng +ZDIR = /usr/local/lib +#ZDIR = /usr/lib64 ZINC = -I/usr/local/include -#ZLIB = -L/usr/local/lib -lz # dynamically linked against zlib -ZLIB = /usr/local/lib/libz.a # statically linked against zlib -#ZINC = -I../zlib -#ZLIB = -L../zlib -lz -#ZLIB = ../zlib/libz.a +ZLIBd = -L$(ZDIR) -lz # dynamically linked against zlib +ZLIBs = $(ZDIR)/libz.a # statically linked against zlib +# or: +#ZDIR = ../zlib +#ZINC = -I$(ZDIR) +#ZLIBd = -Wl,-rpath,$(ZDIR) -L$(ZDIR) -lz # -rpath allows in-place testing +#ZLIBs = $(ZDIR)/libz.a #XINC = -I/usr/include # old-style, stock X distributions -#XLIB = -L/usr/lib/X11 -lX11 +#XLIB = -L/usr/lib/X11 -lX11 # (including SGI IRIX) #XINC = -I/usr/openwin/include # Sun workstations (OpenWindows) #XLIB = -L/usr/openwin/lib -lX11 -XINC = -I/usr/X11R6/include # new X distributions (XFree86, etc.) +XINC = -I/usr/X11R6/include # new X distributions (X.org, etc.) XLIB = -L/usr/X11R6/lib -lX11 +#XLIB = -L/usr/X11R6/lib64 -lX11 # e.g., Red Hat on AMD64 INCS = $(PNGINC) $(ZINC) $(XINC) -RLIBS = $(PNGLIB) $(ZLIB) $(XLIB) -lm -WLIBS = $(PNGLIB) $(ZLIB) +RLIBSd = $(PNGLIBd) $(ZLIBd) $(XLIB) -lm +RLIBSs = $(PNGLIBs) $(ZLIBs) $(XLIB) -lm +WLIBSd = $(PNGLIBd) $(ZLIBd) -lm +WLIBSs = $(PNGLIBs) $(ZLIBs) CC = gcc LD = gcc RM = rm -f -CFLAGS = -O -Wall $(INCS) +CFLAGS = -O -Wall $(INCS) -DFEATURE_LOOP # [note that -Wall is a gcc-specific compilation flag ("most warnings on")] # [-ansi, -pedantic and -W can also be used] LDFLAGS = O = .o E = -RPNG = rpng-x -RPNG2 = rpng2-x -WPNG = wpng +RPNG = rpng-x +RPNG2 = rpng2-x +WPNG = wpng + +RPNGs = $(RPNG)-static +RPNG2s = $(RPNG2)-static +WPNGs = $(WPNG)-static ROBJS = $(RPNG)$(O) readpng$(O) ROBJS2 = $(RPNG2)$(O) readpng2$(O) WOBJS = $(WPNG)$(O) writepng$(O) -EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E) +STATIC_EXES = $(RPNGs)$(E) $(RPNG2s)$(E) $(WPNGs)$(E) +DYNAMIC_EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E) + +EXES = $(STATIC_EXES) $(DYNAMIC_EXES) # implicit make rules ------------------------------------------------------- @@ -80,14 +99,23 @@ EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E) all: $(EXES) +$(RPNGs)$(E): $(ROBJS) + $(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBSs) + $(RPNG)$(E): $(ROBJS) - $(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBS) + $(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBSd) + +$(RPNG2s)$(E): $(ROBJS2) + $(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBSs) $(RPNG2)$(E): $(ROBJS2) - $(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBS) + $(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBSd) + +$(WPNGs)$(E): $(WOBJS) + $(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBSs) $(WPNG)$(E): $(WOBJS) - $(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBS) + $(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBSd) $(RPNG)$(O): $(RPNG).c readpng.h $(RPNG2)$(O): $(RPNG2).c readpng2.h diff --git a/src/dep/src/irrlicht/libpng/contrib/gregbook/Makefile.w32 b/src/dep/src/irrlicht/libpng/contrib/gregbook/Makefile.w32 index ceb6a51..f131f96 100644 --- a/src/dep/src/irrlicht/libpng/contrib/gregbook/Makefile.w32 +++ b/src/dep/src/irrlicht/libpng/contrib/gregbook/Makefile.w32 @@ -1,11 +1,12 @@ # Sample makefile for rpng-win / rpng2-win / wpng using MSVC and NMAKE. # Greg Roelofs -# Last modified: 16 February 1999 +# Last modified: 2 June 2007 # # The programs built by this makefile are described in the book, # "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and -# Associates, 1999). Go buy a copy, eh? Buy some for friends -# and family, too. (Not that this is a blatant plug or anything.) +# Associates, 1999). Go buy a copy, eh? Well, OK, it's not +# generally for sale anymore, but it's the thought that counts, +# right? (Hint: http://www.libpng.org/pub/png/book/ ) # # Invoke this makefile from a DOS prompt window via: # @@ -53,7 +54,7 @@ CC = cl LD = link RM = del CFLAGS = -nologo -O -W3 $(INCS) $(cvars) -# [note that -Wall is an MSVC-specific compilation flag ("all warnings on")] +# [note that -W3 is an MSVC-specific compilation flag ("all warnings on")] # [see %devstudio%\vc\include\win32.mak for cvars macro definition] O = .obj E = .exe diff --git a/src/dep/src/irrlicht/libpng/contrib/gregbook/README b/src/dep/src/irrlicht/libpng/contrib/gregbook/README index d083c76..a5072b4 100644 --- a/src/dep/src/irrlicht/libpng/contrib/gregbook/README +++ b/src/dep/src/irrlicht/libpng/contrib/gregbook/README @@ -22,7 +22,8 @@ below. Files: README this file - LICENSE terms of distribution and reuse (BSD-like) + LICENSE terms of distribution and reuse (BSD-like or GNU GPL) + COPYING GNU General Public License (GPL) Makefile.unx Unix makefile Makefile.w32 Windows (MSVC) makefile @@ -54,15 +55,15 @@ mation and links to the latest version of the source code, and Chapters 13-15 of the book for detailed discussion of the three programs. Greg Roelofs -newt@pobox.com -30 June 2001 +http://pobox.com/~newt/greg_contact.html +16 March 2008 BUILD INSTRUCTIONS - Prerequisites (in order of compilation): - - zlib http://www.gzip.org/zlib/ + - zlib http://zlib.net/ - libpng http://www.libpng.org/pub/png/libpng.html - pngbook http://www.libpng.org/pub/png/book/sources.html @@ -150,9 +151,9 @@ BUILD INSTRUCTIONS To run the programs, they probably first need to be set up as "foreign symbols," with "disk" and "dir" set appropriately: - $ rpng == "$disk:[dir]rpng-x.exe" + $ rpng == "$disk:[dir]rpng-x.exe" $ rpng2 == "$disk:[dir]rpng2-x.exe" - $ wpng == "$disk:[dir]wpng.exe" + $ wpng == "$disk:[dir]wpng.exe" All three will print a basic usage screen when run without any command- line arguments; see the book for more details. Note that the options @@ -176,7 +177,7 @@ RUNNING THE PROGRAMS: (VERY) BRIEF INTRO wpng is a purely command-line image converter from binary PBMPLUS/NetPBM format (.pgm or .ppm) to PNG; for example, - wpng -time < toucan.ppm > toucan.png + wpng -time < toucan-notrans.ppm > toucan-notrans.png would convert the specified PPM file (using redirection) to PNG, auto- matically setting the PNG modification-time chunk. diff --git a/src/dep/src/irrlicht/libpng/contrib/gregbook/readpng.c b/src/dep/src/irrlicht/libpng/contrib/gregbook/readpng.c index 35d49e9..c459120 100644 --- a/src/dep/src/irrlicht/libpng/contrib/gregbook/readpng.c +++ b/src/dep/src/irrlicht/libpng/contrib/gregbook/readpng.c @@ -4,13 +4,20 @@ --------------------------------------------------------------------------- - Copyright (c) 1998-2000 Greg Roelofs. All rights reserved. + Copyright (c) 1998-2007 Greg Roelofs. All rights reserved. This software is provided "as is," without warranty of any kind, express or implied. In no event shall the author or contributors be held liable for any damages arising in any way from the use of this software. + The contents of this file are DUAL-LICENSED. You may modify and/or + redistribute this software according to the terms of one of the + following two licenses (at your option): + + + LICENSE 1 ("BSD-like with advertising clause"): + Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: @@ -27,6 +34,23 @@ and contributors for the book, "PNG: The Definitive Guide," published by O'Reilly and Associates. + + LICENSE 2 (GNU GPL v2 or later): + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ---------------------------------------------------------------------------*/ #include diff --git a/src/dep/src/irrlicht/libpng/contrib/gregbook/readpng.h b/src/dep/src/irrlicht/libpng/contrib/gregbook/readpng.h index 6e378de..ec6b483 100644 --- a/src/dep/src/irrlicht/libpng/contrib/gregbook/readpng.h +++ b/src/dep/src/irrlicht/libpng/contrib/gregbook/readpng.h @@ -4,13 +4,20 @@ --------------------------------------------------------------------------- - Copyright (c) 1998-2000 Greg Roelofs. All rights reserved. + Copyright (c) 1998-2007 Greg Roelofs. All rights reserved. This software is provided "as is," without warranty of any kind, express or implied. In no event shall the author or contributors be held liable for any damages arising in any way from the use of this software. + The contents of this file are DUAL-LICENSED. You may modify and/or + redistribute this software according to the terms of one of the + following two licenses (at your option): + + + LICENSE 1 ("BSD-like with advertising clause"): + Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: @@ -27,6 +34,23 @@ and contributors for the book, "PNG: The Definitive Guide," published by O'Reilly and Associates. + + LICENSE 2 (GNU GPL v2 or later): + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ---------------------------------------------------------------------------*/ #ifndef TRUE diff --git a/src/dep/src/irrlicht/libpng/contrib/gregbook/readpng2.c b/src/dep/src/irrlicht/libpng/contrib/gregbook/readpng2.c index 2f723be..22dddcd 100644 --- a/src/dep/src/irrlicht/libpng/contrib/gregbook/readpng2.c +++ b/src/dep/src/irrlicht/libpng/contrib/gregbook/readpng2.c @@ -4,19 +4,20 @@ --------------------------------------------------------------------------- - Changelog: - - 1.01: initial public release - - 1.02: added code to skip unused chunks (GR-P) - - --------------------------------------------------------------------------- - - Copyright (c) 1998-2002 Greg Roelofs. All rights reserved. + Copyright (c) 1998-2007 Greg Roelofs. All rights reserved. This software is provided "as is," without warranty of any kind, express or implied. In no event shall the author or contributors be held liable for any damages arising in any way from the use of this software. + The contents of this file are DUAL-LICENSED. You may modify and/or + redistribute this software according to the terms of one of the + following two licenses (at your option): + + + LICENSE 1 ("BSD-like with advertising clause"): + Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: @@ -33,6 +34,23 @@ and contributors for the book, "PNG: The Definitive Guide," published by O'Reilly and Associates. + + LICENSE 2 (GNU GPL v2 or later): + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ---------------------------------------------------------------------------*/ @@ -56,7 +74,7 @@ static void readpng2_error_handler(png_structp png_ptr, png_const_charp msg); void readpng2_version_info(void) { #if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \ - (defined(__i386__) || defined(_M_IX86)) && \ + (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \ defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200) /* * WARNING: This preprocessor approach means that the following code @@ -79,7 +97,12 @@ void readpng2_version_info(void) "with MMX support\n (%s version).", PNG_LIBPNG_VER_STRING, png_libpng_ver, compilerID == 1? "MSVC++" : (compilerID == 2? "GNU C" : "unknown")); - fprintf(stderr, " Processor %s MMX instructions.\n", + fprintf(stderr, " Processor (x86%s) %s MMX instructions.\n", +#if defined(__x86_64__) + "_64", +#else + "", +#endif mmxsupport? "supports" : "does not support"); if (mmxsupport > 0) { int num_optims = 0; @@ -179,40 +202,38 @@ int readpng2_init(mainprog_info *mainprog_ptr) return 2; } - /* prepare the reader to ignore all recognized chunks whose data isn't - * going to be used, i.e., all chunks recognized by libpng except for - * IHDR, PLTE, IDAT, IEND, tRNS, bKGD, gAMA, and sRGB : */ -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) +#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED + /* prepare the reader to ignore all recognized chunks whose data won't be + * used, i.e., all chunks recognized by libpng except for IHDR, PLTE, IDAT, + * IEND, tRNS, bKGD, gAMA, and sRGB (small performance improvement) */ { -#ifndef HANDLE_CHUNK_NEVER -/* prior to libpng-1.2.5, this macro was internal, so we define it here. */ -# define HANDLE_CHUNK_NEVER 1 -#endif - /* these byte strings were copied from png.h. - * If a future libpng version recognizes more chunks, add them - * to this list. If a future version of readpng2.c recognizes - * more chunks, delete them from this list. */ - png_byte png_chunk_types_to_ignore[]= - { 99, 72, 82, 77, '\0', /* cHRM */ - 104, 73, 83, 84, '\0', /* hIST */ - 105, 67, 67, 80, '\0', /* iCCP */ - 105, 84, 88, 116, '\0', /* iTXt */ - 111, 70, 70, 115, '\0', /* oFFs */ - 112, 67, 65, 76, '\0', /* pCAL */ - 115, 67, 65, 76, '\0', /* sCAL */ - 112, 72, 89, 115, '\0', /* pHYs */ - 115, 66, 73, 84, '\0', /* sBIT */ - 115, 80, 76, 84, '\0', /* sPLT */ - 116, 69, 88, 116, '\0', /* tEXt */ - 116, 73, 77, 69, '\0', /* tIME */ - 122, 84, 88, 116, '\0'}; /* zTXt */ -#define NUM_PNG_CHUNK_TYPES_TO_IGNORE 13 + /* These byte strings were copied from png.h. If a future libpng + * version recognizes more chunks, add them to this list. If a + * future version of readpng2.c recognizes more chunks, delete them + * from this list. */ + static const png_byte chunks_to_ignore[] = { + 99, 72, 82, 77, '\0', /* cHRM */ + 104, 73, 83, 84, '\0', /* hIST */ + 105, 67, 67, 80, '\0', /* iCCP */ + 105, 84, 88, 116, '\0', /* iTXt */ + 111, 70, 70, 115, '\0', /* oFFs */ + 112, 67, 65, 76, '\0', /* pCAL */ + 112, 72, 89, 115, '\0', /* pHYs */ + 115, 66, 73, 84, '\0', /* sBIT */ + 115, 67, 65, 76, '\0', /* sCAL */ + 115, 80, 76, 84, '\0', /* sPLT */ + 115, 84, 69, 82, '\0', /* sTER */ + 116, 69, 88, 116, '\0', /* tEXt */ + 116, 73, 77, 69, '\0', /* tIME */ + 122, 84, 88, 116, '\0' /* zTXt */ + }; - png_set_keep_unknown_chunks(png_ptr, HANDLE_CHUNK_NEVER, - png_chunk_types_to_ignore, NUM_PNG_CHUNK_TYPES_TO_IGNORE); + png_set_keep_unknown_chunks(png_ptr, 1 /* PNG_HANDLE_CHUNK_NEVER */, + chunks_to_ignore, sizeof(chunks_to_ignore)/5); } -#endif +#endif /* PNG_UNKNOWN_CHUNKS_SUPPORTED */ + /* instead of doing png_init_io() here, now we set up our callback * functions for progressive decoding */ @@ -237,7 +258,7 @@ int readpng2_init(mainprog_info *mainprog_ptr) * png_set_asm_flags (png_ptr, flags); */ -#if (defined(__i386__) || defined(_M_IX86)) && \ +#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \ defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200) /* * WARNING: This preprocessor approach means that the following code diff --git a/src/dep/src/irrlicht/libpng/contrib/gregbook/readpng2.h b/src/dep/src/irrlicht/libpng/contrib/gregbook/readpng2.h index 2ed70d4..a5f32e5 100644 --- a/src/dep/src/irrlicht/libpng/contrib/gregbook/readpng2.h +++ b/src/dep/src/irrlicht/libpng/contrib/gregbook/readpng2.h @@ -4,13 +4,20 @@ --------------------------------------------------------------------------- - Copyright (c) 1998-2001 Greg Roelofs. All rights reserved. + Copyright (c) 1998-2008 Greg Roelofs. All rights reserved. This software is provided "as is," without warranty of any kind, express or implied. In no event shall the author or contributors be held liable for any damages arising in any way from the use of this software. + The contents of this file are DUAL-LICENSED. You may modify and/or + redistribute this software according to the terms of one of the + following two licenses (at your option): + + + LICENSE 1 ("BSD-like with advertising clause"): + Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: @@ -27,6 +34,23 @@ and contributors for the book, "PNG: The Definitive Guide," published by O'Reilly and Associates. + + LICENSE 2 (GNU GPL v2 or later): + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ---------------------------------------------------------------------------*/ #ifndef TRUE @@ -45,6 +69,12 @@ # define Trace(x) ; #endif +enum rpng2_states { + kPreInit = 0, + kWindowInit, + kDone +}; + typedef unsigned char uch; typedef unsigned short ush; typedef unsigned long ulg; @@ -66,12 +96,12 @@ typedef struct _mainprog_info { int rowbytes; int channels; int need_bgcolor; -#if (defined(__i386__) || defined(_M_IX86)) +#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) int nommxfilters; int nommxcombine; int nommxinterlace; #endif - int done; + int state; uch bg_red; uch bg_green; uch bg_blue; diff --git a/src/dep/src/irrlicht/libpng/contrib/gregbook/readppm.c b/src/dep/src/irrlicht/libpng/contrib/gregbook/readppm.c new file mode 100644 index 0000000..1ba2092 --- /dev/null +++ b/src/dep/src/irrlicht/libpng/contrib/gregbook/readppm.c @@ -0,0 +1,179 @@ +/*--------------------------------------------------------------------------- + + rpng - simple PNG display program readppm.c + + --------------------------------------------------------------------------- + + This is a special-purpose replacement for readpng.c that allows binary + PPM files to be used in place of PNG images. + + --------------------------------------------------------------------------- + + Copyright (c) 1998-2007 Greg Roelofs. All rights reserved. + + This software is provided "as is," without warranty of any kind, + express or implied. In no event shall the author or contributors + be held liable for any damages arising in any way from the use of + this software. + + The contents of this file are DUAL-LICENSED. You may modify and/or + redistribute this software according to the terms of one of the + following two licenses (at your option): + + + LICENSE 1 ("BSD-like with advertising clause"): + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute + it freely, subject to the following restrictions: + + 1. Redistributions of source code must retain the above copyright + notice, disclaimer, and this list of conditions. + 2. Redistributions in binary form must reproduce the above copyright + notice, disclaimer, and this list of conditions in the documenta- + tion and/or other materials provided with the distribution. + 3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + + This product includes software developed by Greg Roelofs + and contributors for the book, "PNG: The Definitive Guide," + published by O'Reilly and Associates. + + + LICENSE 2 (GNU GPL v2 or later): + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + ---------------------------------------------------------------------------*/ + +#include +#include + +#include "readpng.h" /* typedefs, common macros, public prototypes */ + + +ulg width, height; +int bit_depth, color_type, channels; +uch *image_data = NULL; +FILE *saved_infile; + + +void readpng_version_info() +{ + fprintf(stderr, " Compiled without libpng, zlib or PBMPLUS/NetPBM.\n"); +} + + +/* return value = 0 for success, 1 for bad sig, 2 for bad IHDR, 4 for no mem */ + +int readpng_init(FILE *infile, ulg *pWidth, ulg *pHeight) +{ + static uch ppmline[256]; + int maxval; + + + saved_infile = infile; + + fgets(ppmline, 256, infile); + if (ppmline[0] != 'P' || ppmline[1] != '6') { + fprintf(stderr, "ERROR: not a PPM file\n"); + return 1; + } + /* possible color types: P5 = grayscale (0), P6 = RGB (2), P8 = RGBA (6) */ + if (ppmline[1] == '6') { + color_type = 2; + channels = 3; + } else if (ppmline[1] == '8') { + color_type = 6; + channels = 4; + } else /* if (ppmline[1] == '5') */ { + color_type = 0; + channels = 1; + } + + do { + fgets(ppmline, 256, infile); + } while (ppmline[0] == '#'); + sscanf(ppmline, "%lu %lu", &width, &height); + + do { + fgets(ppmline, 256, infile); + } while (ppmline[0] == '#'); + sscanf(ppmline, "%d", &maxval); + if (maxval != 255) { + fprintf(stderr, "ERROR: maxval = %d\n", maxval); + return 2; + } + bit_depth = 8; + + *pWidth = width; + *pHeight = height; + + return 0; +} + + + + +/* returns 0 if succeeds, 1 if fails due to no bKGD chunk, 2 if libpng error; + * scales values to 8-bit if necessary */ + +int readpng_get_bgcolor(uch *red, uch *green, uch *blue) +{ + return 1; +} + + + + +/* display_exponent == LUT_exponent * CRT_exponent */ + +uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes) +{ + ulg rowbytes; + + + /* expand palette images to RGB, low-bit-depth grayscale images to 8 bits, + * transparency chunks to full alpha channel; strip 16-bit-per-sample + * images to 8 bits per sample; and convert grayscale to RGB[A] */ + + /* GRR WARNING: grayscale needs to be expanded and channels reset! */ + + *pRowbytes = rowbytes = channels*width; + *pChannels = channels; + + if ((image_data = (uch *)malloc(rowbytes*height)) == NULL) { + return NULL; + } + + Trace((stderr, "readpng_get_image: rowbytes = %ld, height = %ld\n", rowbytes, height)); + + + /* now we can go ahead and just read the whole image */ + + fread(image_data, 1L, rowbytes*height, saved_infile); + + + return image_data; +} + + +void readpng_cleanup(int free_image_data) +{ + if (free_image_data && image_data) { + free(image_data); + image_data = NULL; + } +} diff --git a/src/dep/src/irrlicht/libpng/contrib/gregbook/rpng-win.c b/src/dep/src/irrlicht/libpng/contrib/gregbook/rpng-win.c index b35e3ab..5d3eb89 100644 --- a/src/dep/src/irrlicht/libpng/contrib/gregbook/rpng-win.c +++ b/src/dep/src/irrlicht/libpng/contrib/gregbook/rpng-win.c @@ -22,16 +22,25 @@ - 1.02: added extra set of parentheses to png_jmpbuf() macro; fixed command-line parsing bug - 1.10: enabled "message window"/console (thanks to David Geldreich) + - 2.00: dual-licensed (added GNU GPL) + - 2.01: fixed improper display of usage screen on PNG error(s) --------------------------------------------------------------------------- - Copyright (c) 1998-2001 Greg Roelofs. All rights reserved. + Copyright (c) 1998-2008 Greg Roelofs. All rights reserved. This software is provided "as is," without warranty of any kind, express or implied. In no event shall the author or contributors be held liable for any damages arising in any way from the use of this software. + The contents of this file are DUAL-LICENSED. You may modify and/or + redistribute this software according to the terms of one of the + following two licenses (at your option): + + + LICENSE 1 ("BSD-like with advertising clause"): + Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: @@ -48,11 +57,28 @@ and contributors for the book, "PNG: The Definitive Guide," published by O'Reilly and Associates. + + LICENSE 2 (GNU GPL v2 or later): + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ---------------------------------------------------------------------------*/ #define PROGNAME "rpng-win" #define LONGNAME "Simple PNG Viewer for Windows" -#define VERSION "1.20 of 28 May 2001" +#define VERSION "2.01 of 16 March 2008" #include #include @@ -85,10 +111,9 @@ static void rpng_win_cleanup(void); LRESULT CALLBACK rpng_win_wndproc(HWND, UINT, WPARAM, LPARAM); -static char titlebar[1024], *window_name = titlebar; +static char titlebar[1024]; static char *progname = PROGNAME; static char *appname = LONGNAME; -static char *icon_name = PROGNAME; /* GRR: not (yet) used */ static char *filename; static FILE *infile; @@ -247,40 +272,11 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode) } } - if (!filename) { + if (!filename) ++error; - } else if (!(infile = fopen(filename, "rb"))) { - fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename); - ++error; - } else { - if ((rc = readpng_init(infile, &image_width, &image_height)) != 0) { - switch (rc) { - case 1: - fprintf(stderr, PROGNAME - ": [%s] is not a PNG file: incorrect signature\n", - filename); - break; - case 2: - fprintf(stderr, PROGNAME - ": [%s] has bad IHDR (libpng longjmp)\n", - filename); - break; - case 4: - fprintf(stderr, PROGNAME ": insufficient memory\n"); - break; - default: - fprintf(stderr, PROGNAME - ": unknown readpng_init() error\n"); - break; - } - ++error; - } - if (error) - fclose(infile); - } - /* usage screen */ + /* print usage screen if any errors up to this point */ if (error) { int ch; @@ -303,6 +299,47 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode) ch = _getch(); while (ch != 'q' && ch != 'Q' && ch != 0x1B); exit(1); + } + + + if (!(infile = fopen(filename, "rb"))) { + fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename); + ++error; + } else { + if ((rc = readpng_init(infile, &image_width, &image_height)) != 0) { + switch (rc) { + case 1: + fprintf(stderr, PROGNAME + ": [%s] is not a PNG file: incorrect signature\n", + filename); + break; + case 2: + fprintf(stderr, PROGNAME + ": [%s] has bad IHDR (libpng longjmp)\n", filename); + break; + case 4: + fprintf(stderr, PROGNAME ": insufficient memory\n"); + break; + default: + fprintf(stderr, PROGNAME + ": unknown readpng_init() error\n"); + break; + } + ++error; + } + if (error) + fclose(infile); + } + + + if (error) { + int ch; + + fprintf(stderr, PROGNAME ": aborting.\n"); + do + ch = _getch(); + while (ch != 'q' && ch != 'Q' && ch != 0x1B); + exit(2); } else { fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname); fprintf(stderr, @@ -325,9 +362,14 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode) * check for one in the PNG file--if not, the initialized values of 0 * (black) will be used */ - if (have_bg) - sscanf(bgstr+1, "%2x%2x%2x", &bg_red, &bg_green, &bg_blue); - else if (readpng_get_bgcolor(&bg_red, &bg_green, &bg_blue) > 1) { + if (have_bg) { + unsigned r, g, b; /* this approach quiets compiler warnings */ + + sscanf(bgstr+1, "%2x%2x%2x", &r, &g, &b); + bg_red = (uch)r; + bg_green = (uch)g; + bg_blue = (uch)b; + } else if (readpng_get_bgcolor(&bg_red, &bg_green, &bg_blue) > 1) { readpng_cleanup(TRUE); fprintf(stderr, PROGNAME ": libpng error while checking for background color\n"); diff --git a/src/dep/src/irrlicht/libpng/contrib/gregbook/rpng-x.c b/src/dep/src/irrlicht/libpng/contrib/gregbook/rpng-x.c index 0623397..325d718 100644 --- a/src/dep/src/irrlicht/libpng/contrib/gregbook/rpng-x.c +++ b/src/dep/src/irrlicht/libpng/contrib/gregbook/rpng-x.c @@ -9,7 +9,7 @@ by Martin Zinser under OpenVMS; may work under OS/2 with some tweaking). to do: - - 8-bit support + - 8-bit (colormapped) X support - use %.1023s to simplify truncation of title-bar string? --------------------------------------------------------------------------- @@ -21,18 +21,28 @@ - 1.10: added support for non-default visuals; fixed X pixel-conversion - 1.11: added extra set of parentheses to png_jmpbuf() macro; fixed command-line parsing bug - - 1.12: fixed small X memory leak (thanks to Francois Petitjean) - - 1.13: fixed XFreeGC() crash bug + - 1.12: fixed some small X memory leaks (thanks to François Petitjean) + - 1.13: fixed XFreeGC() crash bug (thanks to Patrick Welche) + - 1.14: added support for X resources (thanks to Gerhard Niklasch) + - 2.00: dual-licensed (added GNU GPL) + - 2.01: fixed improper display of usage screen on PNG error(s) --------------------------------------------------------------------------- - Copyright (c) 1998-2001 Greg Roelofs. All rights reserved. + Copyright (c) 1998-2008 Greg Roelofs. All rights reserved. This software is provided "as is," without warranty of any kind, express or implied. In no event shall the author or contributors be held liable for any damages arising in any way from the use of this software. + The contents of this file are DUAL-LICENSED. You may modify and/or + redistribute this software according to the terms of one of the + following two licenses (at your option): + + + LICENSE 1 ("BSD-like with advertising clause"): + Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: @@ -49,11 +59,30 @@ and contributors for the book, "PNG: The Definitive Guide," published by O'Reilly and Associates. + + LICENSE 2 (GNU GPL v2 or later): + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ---------------------------------------------------------------------------*/ #define PROGNAME "rpng-x" #define LONGNAME "Simple PNG Viewer for X" -#define VERSION "1.13 of 16 August 2001" +#define VERSION "2.01 of 16 March 2008" +#define RESNAME "rpng" /* our X resource application name */ +#define RESCLASS "Rpng" /* our X resource class name */ #include #include @@ -91,6 +120,8 @@ static int rpng_x_msb(ulg u32val); static char titlebar[1024], *window_name = titlebar; static char *appname = LONGNAME; static char *icon_name = PROGNAME; +static char *res_name = RESNAME; +static char *res_class = RESCLASS; static char *filename; static FILE *infile; @@ -235,9 +266,33 @@ int main(int argc, char **argv) } } - if (!filename) { + if (!filename) ++error; - } else if (!(infile = fopen(filename, "rb"))) { + + + /* print usage screen if any errors up to this point */ + + if (error) { + fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname); + readpng_version_info(); + fprintf(stderr, "\n" + "Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg] file.png\n" + " xdpy\tname of the target X display (e.g., ``hostname:0'')\n" + " exp \ttransfer-function exponent (``gamma'') of the display\n" + "\t\t system in floating-point format (e.g., ``%.1f''); equal\n" + "\t\t to the product of the lookup-table exponent (varies)\n" + "\t\t and the CRT exponent (usually 2.2); must be positive\n" + " bg \tdesired background color in 7-character hex RGB format\n" + "\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n" + "\t\t used with transparent images\n" + "\nPress Q, Esc or mouse button 1 (within image window, after image\n" + "is displayed) to quit.\n" + "\n", PROGNAME, default_display_exponent); + exit(1); + } + + + if (!(infile = fopen(filename, "rb"))) { fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename); ++error; } else { @@ -250,8 +305,7 @@ int main(int argc, char **argv) break; case 2: fprintf(stderr, PROGNAME - ": [%s] has bad IHDR (libpng longjmp)\n", - filename); + ": [%s] has bad IHDR (libpng longjmp)\n", filename); break; case 4: fprintf(stderr, PROGNAME ": insufficient memory\n"); @@ -276,25 +330,9 @@ int main(int argc, char **argv) } - /* usage screen */ - if (error) { - fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname); - readpng_version_info(); - fprintf(stderr, "\n" - "Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg] file.png\n" - " xdpy\tname of the target X display (e.g., ``hostname:0'')\n" - " exp \ttransfer-function exponent (``gamma'') of the display\n" - "\t\t system in floating-point format (e.g., ``%.1f''); equal\n" - "\t\t to the product of the lookup-table exponent (varies)\n" - "\t\t and the CRT exponent (usually 2.2); must be positive\n" - " bg \tdesired background color in 7-character hex RGB format\n" - "\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n" - "\t\t used with transparent images\n" - "\nPress Q, Esc or mouse button 1 (within image window, after image\n" - "is displayed) to quit.\n" - "\n", PROGNAME, default_display_exponent); - exit(1); + fprintf(stderr, PROGNAME ": aborting.\n"); + exit(2); } @@ -399,11 +437,12 @@ static int rpng_x_create_window(void) XEvent e; XGCValues gcvalues; XSetWindowAttributes attr; - XSizeHints *size_hints; XTextProperty windowName, *pWindowName = &windowName; XTextProperty iconName, *pIconName = &iconName; XVisualInfo visual_info; + XSizeHints *size_hints; XWMHints *wm_hints; + XClassHint *class_hints; screen = DefaultScreen(display); @@ -526,7 +565,7 @@ static int rpng_x_create_window(void) if (!XStringListToTextProperty(&icon_name, 1, pIconName)) pIconName = NULL; - /* OK if either hints allocation fails; XSetWMProperties() allows NULLs */ + /* OK if any hints allocation fails; XSetWMProperties() allows NULLs */ if ((size_hints = XAllocSizeHints()) != NULL) { /* window will not be resizable */ @@ -542,8 +581,13 @@ static int rpng_x_create_window(void) wm_hints->flags = StateHint | InputHint /* | IconPixmapHint */ ; } + if ((class_hints = XAllocClassHint()) != NULL) { + class_hints->res_name = res_name; + class_hints->res_class = res_class; + } + XSetWMProperties(display, window, pWindowName, pIconName, NULL, 0, - size_hints, wm_hints, NULL); + size_hints, wm_hints, class_hints); /* various properties and hints no longer needed; free memory */ if (pWindowName) @@ -554,6 +598,8 @@ static int rpng_x_create_window(void) XFree(size_hints); if (wm_hints) XFree(wm_hints); + if (class_hints) + XFree(class_hints); XMapWindow(display, window); diff --git a/src/dep/src/irrlicht/libpng/contrib/gregbook/rpng2-win.c b/src/dep/src/irrlicht/libpng/contrib/gregbook/rpng2-win.c index 46f2191..38d3ff1 100644 --- a/src/dep/src/irrlicht/libpng/contrib/gregbook/rpng2-win.c +++ b/src/dep/src/irrlicht/libpng/contrib/gregbook/rpng2-win.c @@ -10,7 +10,7 @@ tweaking (or maybe not). Thanks to Adam Costello and Pieter S. van der Meulen for the "diamond" and "radial waves" patterns, respectively. - to do: + to do (someday, maybe): - handle quoted command-line args (especially filenames with spaces) - finish resizable checkerboard-gradient (sizes 4-128?) - use %.1023s to simplify truncation of title-bar string? @@ -27,16 +27,28 @@ - 1.10: enabled "message window"/console (thanks to David Geldreich) - 1.20: added runtime MMX-enabling/disabling and new -mmx* options - 1.21: made minor tweak to usage screen to fit within 25-line console + - 1.22: added AMD64/EM64T support (__x86_64__) + - 2.00: dual-licensed (added GNU GPL) + - 2.01: fixed 64-bit typo in readpng2.c + - 2.02: fixed improper display of usage screen on PNG error(s); fixed + unexpected-EOF and file-read-error cases --------------------------------------------------------------------------- - Copyright (c) 1998-2001 Greg Roelofs. All rights reserved. + Copyright (c) 1998-2008 Greg Roelofs. All rights reserved. This software is provided "as is," without warranty of any kind, express or implied. In no event shall the author or contributors be held liable for any damages arising in any way from the use of this software. + The contents of this file are DUAL-LICENSED. You may modify and/or + redistribute this software according to the terms of one of the + following two licenses (at your option): + + + LICENSE 1 ("BSD-like with advertising clause"): + Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: @@ -53,11 +65,28 @@ and contributors for the book, "PNG: The Definitive Guide," published by O'Reilly and Associates. + + LICENSE 2 (GNU GPL v2 or later): + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ---------------------------------------------------------------------------*/ #define PROGNAME "rpng2-win" #define LONGNAME "Progressive PNG Viewer for Windows" -#define VERSION "1.21 of 29 June 2001" +#define VERSION "2.02 of 16 March 2008" #include #include @@ -119,10 +148,9 @@ static void rpng2_win_cleanup(void); LRESULT CALLBACK rpng2_win_wndproc(HWND, UINT, WPARAM, LPARAM); -static char titlebar[1024], *window_name = titlebar; +static char titlebar[1024]; static char *progname = PROGNAME; static char *appname = LONGNAME; -static char *icon_name = PROGNAME; /* GRR: not (yet) used */ static char *filename; static FILE *infile; @@ -367,7 +395,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode) } } else if (!strncmp(*argv, "-timing", 2)) { timing = TRUE; -#if (defined(__i386__) || defined(_M_IX86)) +#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) } else if (!strncmp(*argv, "-nommxfilters", 7)) { rpng2_info.nommxfilters = TRUE; } else if (!strncmp(*argv, "-nommxcombine", 7)) { @@ -389,9 +417,54 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode) } } - if (!filename) { + if (!filename) ++error; - } else if (!(infile = fopen(filename, "rb"))) { + + + /* print usage screen if any errors up to this point */ + + if (error) { + int ch; + + fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname); + readpng2_version_info(); + fprintf(stderr, "\n" + "Usage: %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]\n" +#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) + " %*s [[-nommxfilters] [-nommxcombine] [-nommxinterlace] | -nommx]\n" +#endif + " %*s file.png\n\n" + " exp \ttransfer-function exponent (``gamma'') of the display\n" + "\t\t system in floating-point format (e.g., ``%.1f''); equal\n" + "\t\t to the product of the lookup-table exponent (varies)\n" + "\t\t and the CRT exponent (usually 2.2); must be positive\n" + " bg \tdesired background color in 7-character hex RGB format\n" + "\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n" + "\t\t used with transparent images; overrides -bgpat option\n" + " pat \tdesired background pattern number (1-%d); used with\n" + "\t\t transparent images; overrides -bgcolor option\n" + " -timing\tenables delay for every block read, to simulate modem\n" + "\t\t download of image (~36 Kbps)\n" +#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) + " -nommx*\tdisable optimized MMX routines for decoding row filters,\n" + "\t\t combining rows, and expanding interlacing, respectively\n" +#endif + "\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n" + "Press Q or Esc to quit this usage screen. ", + PROGNAME, +#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) + (int)strlen(PROGNAME), " ", +#endif + (int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat); + fflush(stderr); + do + ch = _getch(); + while (ch != 'q' && ch != 'Q' && ch != 0x1B); + exit(1); + } + + + if (!(infile = fopen(filename, "rb"))) { fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename); ++error; } else { @@ -405,8 +478,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode) switch (rc) { case 2: fprintf(stderr, PROGNAME - ": [%s] has bad IHDR (libpng longjmp)\n", - filename); + ": [%s] has bad IHDR (libpng longjmp)\n", filename); break; case 4: fprintf(stderr, PROGNAME ": insufficient memory\n"); @@ -423,46 +495,14 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode) } - /* usage screen */ - if (error) { int ch; - fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname); - readpng2_version_info(); - fprintf(stderr, "\n" - "Usage: %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]\n" -#if (defined(__i386__) || defined(_M_IX86)) - " %*s [[-nommxfilters] [-nommxcombine] [-nommxinterlace] | -nommx]\n" -#endif - " %*s file.png\n\n" - " exp \ttransfer-function exponent (``gamma'') of the display\n" - "\t\t system in floating-point format (e.g., ``%.1f''); equal\n" - "\t\t to the product of the lookup-table exponent (varies)\n" - "\t\t and the CRT exponent (usually 2.2); must be positive\n" - " bg \tdesired background color in 7-character hex RGB format\n" - "\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n" - "\t\t used with transparent images; overrides -bgpat option\n" - " pat \tdesired background pattern number (1-%d); used with\n" - "\t\t transparent images; overrides -bgcolor option\n" - " -timing\tenables delay for every block read, to simulate modem\n" - "\t\t download of image (~36 Kbps)\n" -#if (defined(__i386__) || defined(_M_IX86)) - " -nommx*\tdisable optimized MMX routines for decoding row filters,\n" - "\t\t combining rows, and expanding interlacing, respectively\n" -#endif - "\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n" - "Press Q or Esc to quit this usage screen. ", - PROGNAME, -#if (defined(__i386__) || defined(_M_IX86)) - strlen(PROGNAME), " ", -#endif - strlen(PROGNAME), " ", default_display_exponent, num_bgpat); - fflush(stderr); + fprintf(stderr, PROGNAME ": aborting.\n"); do ch = _getch(); while (ch != 'q' && ch != 'Q' && ch != 0x1B); - exit(1); + exit(2); } else { fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname); fprintf(stderr, @@ -494,7 +534,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode) } else rpng2_info.need_bgcolor = TRUE; - rpng2_info.done = FALSE; + rpng2_info.state = kPreInit; rpng2_info.mainprog_init = rpng2_win_init; rpng2_info.mainprog_display_row = rpng2_win_display_row; rpng2_info.mainprog_finish_display = rpng2_win_finish_display; @@ -514,10 +554,27 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode) if (readpng2_decode_data(&rpng2_info, inbuf, incount)) ++error; Trace((stderr, "done with readpng2_decode_data()\n")) - if (error || feof(infile) || rpng2_info.done) + + if (error || incount != INBUFSIZE || rpng2_info.state == kDone) { + if (rpng2_info.state == kDone) { + Trace((stderr, "done decoding PNG image\n")) + } else if (ferror(infile)) { + fprintf(stderr, PROGNAME + ": error while reading PNG image file\n"); + exit(3); + } else if (feof(infile)) { + fprintf(stderr, PROGNAME ": end of file reached " + "(unexpectedly) while reading PNG image file\n"); + exit(3); + } else /* if (error) */ { + // will print error message below + } break; + } + if (timing) Sleep(1000L); + incount = fread(inbuf, 1, INBUFSIZE, infile); } @@ -564,7 +621,7 @@ static void rpng2_win_init() ulg rowbytes = rpng2_info.rowbytes; Trace((stderr, "beginning rpng2_win_init()\n")) - Trace((stderr, " rowbytes = %ld\n", rpng2_info.rowbytes)) + Trace((stderr, " rowbytes = %d\n", rpng2_info.rowbytes)) Trace((stderr, " width = %ld\n", rpng2_info.width)) Trace((stderr, " height = %ld\n", rpng2_info.height)) @@ -594,6 +651,8 @@ static void rpng2_win_init() readpng2_cleanup(&rpng2_info); return; } + + rpng2_info.state = kWindowInit; } @@ -1089,7 +1148,7 @@ static void rpng2_win_finish_display() * we have nothing to do here except set a flag and let the user know * that the image is done */ - rpng2_info.done = TRUE; + rpng2_info.state = kDone; printf( "Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n"); fflush(stdout); diff --git a/src/dep/src/irrlicht/libpng/contrib/gregbook/rpng2-x.c b/src/dep/src/irrlicht/libpng/contrib/gregbook/rpng2-x.c index 2e30bd1..b50a77b 100644 --- a/src/dep/src/irrlicht/libpng/contrib/gregbook/rpng2-x.c +++ b/src/dep/src/irrlicht/libpng/contrib/gregbook/rpng2-x.c @@ -12,8 +12,9 @@ Thanks to Adam Costello and Pieter S. van der Meulen for the "diamond" and "radial waves" patterns, respectively. - to do: - - 8-bit support + to do (someday, maybe): + - fix expose/redraw code: don't draw entire row if only part exposed + - 8-bit (colormapped) X support - finish resizable checkerboard-gradient (sizes 4-128?) - use %.1023s to simplify truncation of title-bar string? @@ -26,18 +27,36 @@ - 1.11: added -usleep option for demos; fixed command-line parsing bug - 1.12: added -pause option for demos and testing - 1.20: added runtime MMX-enabling/disabling and new -mmx* options - - 1.21: fixed small X memory leak (thanks to Francois Petitjean) - - 1.22: fixed XFreeGC() crash bug + - 1.21: fixed some small X memory leaks (thanks to François Petitjean) + - 1.22: fixed XFreeGC() crash bug (thanks to Patrick Welche) + - 1.23: added -bgpat 0 mode (std white/gray checkerboard, 8x8 squares) + - 1.30: added -loop option for -bgpat (ifdef FEATURE_LOOP); fixed bpp = + 24; added support for X resources (thanks to Gerhard Niklasch) + - 1.31: added code to skip unused chunks (thanks to Glenn Randers-Pehrson) + - 1.32: added AMD64/EM64T support (__x86_64__); added basic expose/redraw + handling + - 2.00: dual-licensed (added GNU GPL) + - 2.01: fixed 64-bit typo in readpng2.c; fixed -pause usage description + - 2.02: fixed improper display of usage screen on PNG error(s); fixed + unexpected-EOF and file-read-error cases; fixed Trace() cut-and- + paste bugs --------------------------------------------------------------------------- - Copyright (c) 1998-2001 Greg Roelofs. All rights reserved. + Copyright (c) 1998-2008 Greg Roelofs. All rights reserved. This software is provided "as is," without warranty of any kind, express or implied. In no event shall the author or contributors be held liable for any damages arising in any way from the use of this software. + The contents of this file are DUAL-LICENSED. You may modify and/or + redistribute this software according to the terms of one of the + following two licenses (at your option): + + + LICENSE 1 ("BSD-like with advertising clause"): + Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: @@ -54,14 +73,34 @@ and contributors for the book, "PNG: The Definitive Guide," published by O'Reilly and Associates. + + LICENSE 2 (GNU GPL v2 or later): + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ---------------------------------------------------------------------------*/ #define PROGNAME "rpng2-x" #define LONGNAME "Progressive PNG Viewer for X" -#define VERSION "1.22 of 16 August 2001" +#define VERSION "2.02 of 16 March 2008" +#define RESNAME "rpng2" /* our X resource application name */ +#define RESCLASS "Rpng" /* our X resource class name */ #include #include +#include #include #include /* for jmpbuf declaration in readpng2.h */ #include @@ -88,6 +127,12 @@ #define CLIP8P(c) MAX(0,(MIN((c),255))) /* 8-bit pos. integer (uch) */ #define ROUNDF(f) ((int)(f + 0.5)) +#define QUIT(e,k) ((e.type == ButtonPress && e.xbutton.button == Button1) || \ + (e.type == KeyPress && /* v--- or 1 for shifted keys */ \ + ((k = XLookupKeysym(&e.xkey, 0)) == XK_q || k == XK_Escape))) + +#define NO_24BIT_MASKS /* undef case not fully written--only for redisplay() */ + #define rgb1_max bg_freq #define rgb1_min bg_gray #define rgb2_max bg_bsat @@ -117,18 +162,26 @@ * overhead) */ /* local prototypes */ -static void rpng2_x_init(void); -static int rpng2_x_create_window(void); -static int rpng2_x_load_bg_image(void); -static void rpng2_x_display_row(ulg row); -static void rpng2_x_finish_display(void); -static void rpng2_x_cleanup(void); -static int rpng2_x_msb(ulg u32val); +static void rpng2_x_init (void); +static int rpng2_x_create_window (void); +static int rpng2_x_load_bg_image (void); +static void rpng2_x_display_row (ulg row); +static void rpng2_x_finish_display (void); +static void rpng2_x_redisplay_image (ulg startcol, ulg startrow, + ulg width, ulg height); +#ifdef FEATURE_LOOP +static void rpng2_x_reload_bg_image (void); +static int is_number (char *p); +#endif +static void rpng2_x_cleanup (void); +static int rpng2_x_msb (ulg u32val); static char titlebar[1024], *window_name = titlebar; static char *appname = LONGNAME; static char *icon_name = PROGNAME; +static char *res_name = RESNAME; +static char *res_class = RESCLASS; static char *filename; static FILE *infile; @@ -139,7 +192,7 @@ static int incount; static int pat = 6; /* must be less than num_bgpat */ static int bg_image = 0; -static int bgscale = 16; +static int bgscale, bgscale_default = 16; static ulg bg_rowbytes; static uch *bg_data; @@ -165,7 +218,8 @@ static struct rgb_color { {255, 127, 0}, /* 12: orange */ {192, 96, 0}, /* 13: darker orange */ { 24, 60, 0}, /* 14: dark green-yellow */ - { 85, 125, 200} /* 15: ice blue */ + { 85, 125, 200}, /* 15: ice blue */ + {192, 192, 192} /* 16: Netscape/Mosaic gray */ }; /* not used for now, but should be for error-checking: static int num_rgb = sizeof(rgb) / sizeof(struct rgb_color); @@ -193,6 +247,7 @@ static struct background_pattern { int rgb1_max, rgb1_min; /* or bg_freq, bg_gray */ int rgb2_max, rgb2_min; /* or bg_bsat, bg_brot (both scaled by 10)*/ } bg[] = { + {0, 1,1, 16,16}, /* checkered: white vs. light gray (basic) */ {0+8, 2,0, 1,15}, /* checkered: tan/black vs. white/ice blue */ {0+24, 2,0, 1,0}, /* checkered: tan/black vs. white/black */ {0+8, 4,5, 0,2}, /* checkered: gold/yellow vs. black/tan */ @@ -244,6 +299,10 @@ int main(int argc, char **argv) int error = 0; int timing = FALSE; int have_bg = FALSE; +#ifdef FEATURE_LOOP + int loop = FALSE; + long loop_interval = -1; /* seconds (100,000 max) */ +#endif double LUT_exponent; /* just the lookup table */ double CRT_exponent = 2.2; /* just the monitor */ double default_display_exponent; /* whole display system */ @@ -344,13 +403,12 @@ int main(int argc, char **argv) if (!*++argv) ++error; else { - pat = atoi(*argv) - 1; - if (pat < 0 || pat >= num_bgpat) - ++error; - else { + pat = atoi(*argv); + if (pat >= 0 && pat < num_bgpat) { bg_image = TRUE; have_bg = FALSE; - } + } else + ++error; } } else if (!strncmp(*argv, "-usleep", 2)) { if (!*++argv) @@ -363,7 +421,21 @@ int main(int argc, char **argv) pause_after_pass = TRUE; } else if (!strncmp(*argv, "-timing", 2)) { timing = TRUE; -#if (defined(__i386__) || defined(_M_IX86)) +#ifdef FEATURE_LOOP + } else if (!strncmp(*argv, "-loop", 2)) { + loop = TRUE; + if (!argv[1] || !is_number(argv[1])) + loop_interval = 2; + else { + ++argv; + loop_interval = atol(*argv); + if (loop_interval < 0) + loop_interval = 2; + else if (loop_interval > 100000) /* bit more than one day */ + loop_interval = 100000; + } +#endif +#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) } else if (!strncmp(*argv, "-nommxfilters", 7)) { rpng2_info.nommxfilters = TRUE; } else if (!strncmp(*argv, "-nommxcombine", 7)) { @@ -385,9 +457,61 @@ int main(int argc, char **argv) } } - if (!filename) { + if (!filename) ++error; - } else if (!(infile = fopen(filename, "rb"))) { + + + /* print usage screen if any errors up to this point */ + + if (error) { + fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname); + readpng2_version_info(); + fprintf(stderr, "\n" + "Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg | -bgpat pat]\n" +#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) + " %*s [[-nommxfilters] [-nommxcombine] [-nommxinterlace] | -nommx]\n" +#endif +#ifdef FEATURE_LOOP + " %*s [-usleep dur | -timing] [-pause] [-loop [sec]] file.png\n\n" +#else + " %*s [-usleep dur | -timing] [-pause] file.png\n\n" +#endif + " xdpy\tname of the target X display (e.g., ``hostname:0'')\n" + " exp \ttransfer-function exponent (``gamma'') of the display\n" + "\t\t system in floating-point format (e.g., ``%.1f''); equal\n" + "\t\t to the product of the lookup-table exponent (varies)\n" + "\t\t and the CRT exponent (usually 2.2); must be positive\n" + " bg \tdesired background color in 7-character hex RGB format\n" + "\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n" + "\t\t used with transparent images; overrides -bgpat\n" + " pat \tdesired background pattern number (0-%d); used with\n" + "\t\t transparent images; overrides -bgcolor\n" +#ifdef FEATURE_LOOP + " -loop\tloops through background images after initial display\n" + "\t\t is complete (depends on -bgpat)\n" + " sec \tseconds to display each background image (default = 2)\n" +#endif +#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) + " -nommx*\tdisable optimized MMX routines for decoding row filters,\n" + "\t\t combining rows, and expanding interlacing, respectively\n" +#endif + " dur \tduration in microseconds to wait after displaying each\n" + "\t\t row (for demo purposes)\n" + " -timing\tenables delay for every block read, to simulate modem\n" + "\t\t download of image (~36 Kbps)\n" + " -pause\tpauses after displaying each pass until mouse clicked\n" + "\nPress Q, Esc or mouse button 1 (within image window, after image\n" + "is displayed) to quit.\n" + "\n", PROGNAME, +#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) + (int)strlen(PROGNAME), " ", +#endif + (int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat-1); + exit(1); + } + + + if (!(infile = fopen(filename, "rb"))) { fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename); ++error; } else { @@ -401,8 +525,7 @@ int main(int argc, char **argv) switch (rc) { case 2: fprintf(stderr, PROGNAME - ": [%s] has bad IHDR (libpng longjmp)\n", - filename); + ": [%s] has bad IHDR (libpng longjmp)\n", filename); break; case 4: fprintf(stderr, PROGNAME ": insufficient memory\n"); @@ -414,6 +537,7 @@ int main(int argc, char **argv) } ++error; } else { + Trace((stderr, "about to call XOpenDisplay()\n")) display = XOpenDisplay(displayname); if (!display) { readpng2_cleanup(&rpng2_info); @@ -427,44 +551,9 @@ int main(int argc, char **argv) } - /* usage screen */ - if (error) { - fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname); - readpng2_version_info(); - fprintf(stderr, "\n" - "Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg | -bgpat pat]\n" -#if (defined(__i386__) || defined(_M_IX86)) - " %*s [[-nommxfilters] [-nommxcombine] [-nommxinterlace] | -nommx]\n" -#endif - " %*s [-usleep dur | -timing] [-pause] file.png\n\n" - " xdpy\tname of the target X display (e.g., ``hostname:0'')\n" - " exp \ttransfer-function exponent (``gamma'') of the display\n" - "\t\t system in floating-point format (e.g., ``%.1f''); equal\n" - "\t\t to the product of the lookup-table exponent (varies)\n" - "\t\t and the CRT exponent (usually 2.2); must be positive\n" - " bg \tdesired background color in 7-character hex RGB format\n" - "\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n" - "\t\t used with transparent images; overrides -bgpat\n" - " pat \tdesired background pattern number (1-%d); used with\n" - "\t\t transparent images; overrides -bgcolor\n" -#if (defined(__i386__) || defined(_M_IX86)) - " -nommx*\tdisable optimized MMX routines for decoding row filters,\n" - "\t\t combining rows, and expanding interlacing, respectively\n" -#endif - " dur \tduration in microseconds to wait after displaying each\n" - "\t\t row (for demo purposes)\n" - " -timing\tenables delay for every block read, to simulate modem\n" - "\t\t download of image (~36 Kbps)\n" - " -pause\tpauses after displaying each pass until key pressed\n" - "\nPress Q, Esc or mouse button 1 (within image window, after image\n" - "is displayed) to quit.\n" - "\n", PROGNAME, -#if (defined(__i386__) || defined(_M_IX86)) - strlen(PROGNAME), " ", -#endif - strlen(PROGNAME), " ", default_display_exponent, num_bgpat); - exit(1); + fprintf(stderr, PROGNAME ": aborting.\n"); + exit(2); } @@ -490,7 +579,7 @@ int main(int argc, char **argv) } else rpng2_info.need_bgcolor = TRUE; - rpng2_info.done = FALSE; + rpng2_info.state = kPreInit; rpng2_info.mainprog_init = rpng2_x_init; rpng2_info.mainprog_display_row = rpng2_x_display_row; rpng2_info.mainprog_finish_display = rpng2_x_finish_display; @@ -510,10 +599,27 @@ int main(int argc, char **argv) if (readpng2_decode_data(&rpng2_info, inbuf, incount)) ++error; Trace((stderr, "done with readpng2_decode_data()\n")) - if (error || feof(infile) || rpng2_info.done) + + if (error || incount != INBUFSIZE || rpng2_info.state == kDone) { + if (rpng2_info.state == kDone) { + Trace((stderr, "done decoding PNG image\n")) + } else if (ferror(infile)) { + fprintf(stderr, PROGNAME + ": error while reading PNG image file\n"); + exit(3); + } else if (feof(infile)) { + fprintf(stderr, PROGNAME ": end of file reached " + "(unexpectedly) while reading PNG image file\n"); + exit(3); + } else /* if (error) */ { + // will print error message below + } break; + } + if (timing) sleep(1); + incount = fread(inbuf, 1, INBUFSIZE, infile); } @@ -530,13 +636,119 @@ int main(int argc, char **argv) } +#ifdef FEATURE_LOOP + + if (loop && bg_image) { + Trace((stderr, "entering -loop loop (FEATURE_LOOP)\n")) + for (;;) { + int i, use_sleep; + struct timeval now, then; + + /* get current time and add loop_interval to get target time */ + if (gettimeofday(&then, NULL) == 0) { + then.tv_sec += loop_interval; + use_sleep = FALSE; + } else + use_sleep = TRUE; + + /* do quick check for a quit event but don't wait for it */ + /* GRR BUG: should also check for Expose events and redraw... */ + if (XCheckMaskEvent(display, KeyPressMask | ButtonPressMask, &e)) + if (QUIT(e,k)) + break; + + /* generate next background image */ + if (++pat >= num_bgpat) + pat = 0; + rpng2_x_reload_bg_image(); + + /* wait for timeout, using whatever means are available */ + if (use_sleep || gettimeofday(&now, NULL) != 0) { + for (i = loop_interval; i > 0; --i) { + sleep(1); + /* GRR BUG: also need to check for Expose (and redraw!) */ + if (XCheckMaskEvent(display, KeyPressMask | ButtonPressMask, + &e) && QUIT(e,k)) + break; + } + } else { + /* Y2038 BUG! */ + if (now.tv_sec < then.tv_sec || + (now.tv_sec == then.tv_sec && now.tv_usec < then.tv_usec)) + { + int quit = FALSE; + long seconds_to_go = then.tv_sec - now.tv_sec; + long usleep_usec; + + /* basically chew up most of remaining loop-interval with + * calls to sleep(1) interleaved with checks for quit + * events, but also recalc time-to-go periodically; when + * done, clean up any remaining time with usleep() call + * (could also use SIGALRM, but signals are a pain...) */ + while (seconds_to_go-- > 1) { + int seconds_done = 0; + + for (i = seconds_to_go; i > 0 && !quit; --i) { + sleep(1); + /* GRR BUG: need to check for Expose and redraw */ + if (XCheckMaskEvent(display, KeyPressMask | + ButtonPressMask, &e) && QUIT(e,k)) + quit = TRUE; + if (++seconds_done > 1000) + break; /* time to redo seconds_to_go meas. */ + } + if (quit) + break; + + /* OK, more than 1000 seconds since last check: + * correct the time-to-go measurement for drift */ + if (gettimeofday(&now, NULL) == 0) { + if (now.tv_sec >= then.tv_sec) + break; + seconds_to_go = then.tv_sec - now.tv_sec; + } else + ++seconds_to_go; /* restore what we subtracted */ + } + if (quit) + break; /* breaks outer do-loop, skips redisplay */ + + /* since difference between "now" and "then" is already + * eaten up to within a couple of seconds, don't need to + * worry about overflow--but might have overshot (neg.) */ + if (gettimeofday(&now, NULL) == 0) { + usleep_usec = 1000000L*(then.tv_sec - now.tv_sec) + + then.tv_usec - now.tv_usec; + if (usleep_usec > 0) + usleep((ulg)usleep_usec); + } + } + } + + /* composite image against new background and display (note that + * we do not take into account the time spent doing this...) */ + rpng2_x_redisplay_image (0, 0, rpng2_info.width, rpng2_info.height); + } + + } else /* FALL THROUGH and do the normal thing */ + +#endif /* FEATURE_LOOP */ + /* wait for the user to tell us when to quit */ - do - XNextEvent(display, &e); - while (!(e.type == ButtonPress && e.xbutton.button == Button1) && - !(e.type == KeyPress && /* v--- or 1 for shifted keys */ - ((k = XLookupKeysym(&e.xkey, 0)) == XK_q || k == XK_Escape) )); + if (rpng2_info.state >= kWindowInit) { + Trace((stderr, "entering final wait-for-quit-event loop\n")) + do { + XNextEvent(display, &e); + if (e.type == Expose) { + XExposeEvent *ex = (XExposeEvent *)&e; + rpng2_x_redisplay_image (ex->x, ex->y, ex->width, ex->height); + } + } while (!QUIT(e,k)); + } else { + fprintf(stderr, PROGNAME ": init callback never called: probable " + "libpng error while decoding PNG metadata\n"); + exit(4); + } /* we're done: clean up all image and X resources and go away */ @@ -561,7 +773,7 @@ static void rpng2_x_init(void) ulg rowbytes = rpng2_info.rowbytes; Trace((stderr, "beginning rpng2_x_init()\n")) - Trace((stderr, " rowbytes = %ld\n", rpng2_info.rowbytes)) + Trace((stderr, " rowbytes = %d\n", rpng2_info.rowbytes)) Trace((stderr, " width = %ld\n", rpng2_info.width)) Trace((stderr, " height = %ld\n", rpng2_info.height)) @@ -594,11 +806,12 @@ static void rpng2_x_init(void) * If we/it segfault instead, seems like a libpng bug... */ /* we're here via libpng callback, so if window fails, clean and bail */ -printf("readpng2_cleanup.\n"); readpng2_cleanup(&rpng2_info); rpng2_x_cleanup(); exit(2); } + + rpng2_info.state = kWindowInit; } @@ -619,11 +832,12 @@ static int rpng2_x_create_window(void) XEvent e; XGCValues gcvalues; XSetWindowAttributes attr; - XSizeHints *size_hints; XTextProperty windowName, *pWindowName = &windowName; XTextProperty iconName, *pIconName = &iconName; XVisualInfo visual_info; + XSizeHints *size_hints; XWMHints *wm_hints; + XClassHint *class_hints; Trace((stderr, "beginning rpng2_x_create_window()\n")) @@ -746,8 +960,13 @@ static int rpng2_x_create_window(void) wm_hints->flags = StateHint | InputHint /* | IconPixmapHint */ ; } + if ((class_hints = XAllocClassHint()) != NULL) { + class_hints->res_name = res_name; + class_hints->res_class = res_class; + } + XSetWMProperties(display, window, pWindowName, pIconName, NULL, 0, - size_hints, wm_hints, NULL); + size_hints, wm_hints, class_hints); /* various properties and hints no longer needed; free memory */ if (pWindowName) @@ -758,6 +977,8 @@ static int rpng2_x_create_window(void) XFree(size_hints); if (wm_hints) XFree(wm_hints); + if (class_hints) + XFree(class_hints); XMapWindow(display, window); @@ -855,7 +1076,7 @@ static int rpng2_x_load_bg_image(void) uch r1, r2, g1, g2, b1, b2; uch r1_inv, r2_inv, g1_inv, g2_inv, b1_inv, b2_inv; int k, hmax, max; - int xidx, yidx, yidx_max = (bgscale-1); + int xidx, yidx, yidx_max; int even_odd_vert, even_odd_horiz, even_odd; int invert_gradient2 = (bg[pat].type & 0x08); int invert_column; @@ -877,6 +1098,9 @@ static int rpng2_x_load_bg_image(void) return 1; } + bgscale = (pat == 0)? 8 : bgscale_default; + yidx_max = bgscale - 1; + /*--------------------------------------------------------------------------- Vertical gradients (ramps) in NxN squares, alternating direction and colors (N == bgscale). @@ -1068,23 +1292,40 @@ static int rpng2_x_load_bg_image(void) if (depth == 24 || depth == 32) { ulg red, green, blue; + int bpp = ximage->bits_per_pixel; for (row = 0; row < rpng2_info.height; ++row) { src = bg_data + row*bg_rowbytes; dest = ximage->data + row*ximage_rowbytes; - for (i = rpng2_info.width; i > 0; --i) { - red = *src++; - green = *src++; - blue = *src++; - pixel = (red << RShift) | - (green << GShift) | - (blue << BShift); - /* recall that we set ximage->byte_order = MSBFirst above */ - /* GRR BUG: this assumes bpp == 32, but may be 24: */ - *dest++ = (char)((pixel >> 24) & 0xff); - *dest++ = (char)((pixel >> 16) & 0xff); - *dest++ = (char)((pixel >> 8) & 0xff); - *dest++ = (char)( pixel & 0xff); + if (bpp == 32) { /* slightly optimized version */ + for (i = rpng2_info.width; i > 0; --i) { + red = *src++; + green = *src++; + blue = *src++; + pixel = (red << RShift) | + (green << GShift) | + (blue << BShift); + /* recall that we set ximage->byte_order = MSBFirst above */ + *dest++ = (char)((pixel >> 24) & 0xff); + *dest++ = (char)((pixel >> 16) & 0xff); + *dest++ = (char)((pixel >> 8) & 0xff); + *dest++ = (char)( pixel & 0xff); + } + } else { + for (i = rpng2_info.width; i > 0; --i) { + red = *src++; + green = *src++; + blue = *src++; + pixel = (red << RShift) | + (green << GShift) | + (blue << BShift); + /* recall that we set ximage->byte_order = MSBFirst above */ + /* GRR BUG? this assumes bpp == 24 & bits are packed low */ + /* (probably need to use RShift, RMask, etc.) */ + *dest++ = (char)((pixel >> 16) & 0xff); + *dest++ = (char)((pixel >> 8) & 0xff); + *dest++ = (char)( pixel & 0xff); + } } } @@ -1155,10 +1396,7 @@ static void rpng2_x_display_row(ulg row) PROGNAME, prevpass + 1); do XNextEvent(display, &e); - while (!(e.type == ButtonPress && e.xbutton.button == Button1) - && !(e.type == KeyPress && - ((k = XLookupKeysym(&e.xkey, 0)) == XK_q - || k == XK_Escape) )) ; + while (!QUIT(e,k)); } fprintf(stderr, "%s: pass %d of 7\r", PROGNAME, rpng2_info.pass + 1); fflush(stderr); @@ -1179,6 +1417,7 @@ static void rpng2_x_display_row(ulg row) if (depth == 24 || depth == 32) { ulg red, green, blue; + int bpp = ximage->bits_per_pixel; src = rpng2_info.image_data + row*rpng2_info.rowbytes; if (bg_image) @@ -1193,11 +1432,18 @@ static void rpng2_x_display_row(ulg row) (green << GShift) | (blue << BShift); /* recall that we set ximage->byte_order = MSBFirst above */ - /* GRR BUG: this assumes bpp == 32, but may be 24: */ - *dest++ = (char)((pixel >> 24) & 0xff); - *dest++ = (char)((pixel >> 16) & 0xff); - *dest++ = (char)((pixel >> 8) & 0xff); - *dest++ = (char)( pixel & 0xff); + if (bpp == 32) { + *dest++ = (char)((pixel >> 24) & 0xff); + *dest++ = (char)((pixel >> 16) & 0xff); + *dest++ = (char)((pixel >> 8) & 0xff); + *dest++ = (char)( pixel & 0xff); + } else { + /* GRR BUG? this assumes bpp == 24 & bits are packed low */ + /* (probably need to use RShift, RMask, etc.) */ + *dest++ = (char)((pixel >> 16) & 0xff); + *dest++ = (char)((pixel >> 8) & 0xff); + *dest++ = (char)( pixel & 0xff); + } } } else /* if (rpng2_info.channels == 4) */ { for (i = rpng2_info.width; i > 0; --i) { @@ -1230,11 +1476,18 @@ static void rpng2_x_display_row(ulg row) (green << GShift) | (blue << BShift); /* recall that we set ximage->byte_order = MSBFirst above */ - /* GRR BUG: this assumes bpp == 32, but may be 24: */ - *dest++ = (char)((pixel >> 24) & 0xff); - *dest++ = (char)((pixel >> 16) & 0xff); - *dest++ = (char)((pixel >> 8) & 0xff); - *dest++ = (char)( pixel & 0xff); + if (bpp == 32) { + *dest++ = (char)((pixel >> 24) & 0xff); + *dest++ = (char)((pixel >> 16) & 0xff); + *dest++ = (char)((pixel >> 8) & 0xff); + *dest++ = (char)( pixel & 0xff); + } else { + /* GRR BUG? this assumes bpp == 24 & bits are packed low */ + /* (probably need to use RShift, RMask, etc.) */ + *dest++ = (char)((pixel >> 16) & 0xff); + *dest++ = (char)((pixel >> 8) & 0xff); + *dest++ = (char)( pixel & 0xff); + } } } @@ -1342,7 +1595,7 @@ static void rpng2_x_finish_display(void) * have nothing to do here except set a flag and let the user know that * the image is done */ - rpng2_info.done = TRUE; + rpng2_info.state = kDone; printf( "Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n"); fflush(stdout); @@ -1352,6 +1605,472 @@ static void rpng2_x_finish_display(void) +static void rpng2_x_redisplay_image(ulg startcol, ulg startrow, + ulg width, ulg height) +{ + uch bg_red = rpng2_info.bg_red; + uch bg_green = rpng2_info.bg_green; + uch bg_blue = rpng2_info.bg_blue; + uch *src, *src2=NULL; + char *dest; + uch r, g, b, a; + ulg i, row, lastrow = 0; + ulg pixel; + int ximage_rowbytes = ximage->bytes_per_line; + + + Trace((stderr, "beginning display loop (image_channels == %d)\n", + rpng2_info.channels)) + Trace((stderr, " (width = %ld, rowbytes = %d, ximage_rowbytes = %d)\n", + rpng2_info.width, rpng2_info.rowbytes, ximage_rowbytes)) + Trace((stderr, " (bpp = %d)\n", ximage->bits_per_pixel)) + Trace((stderr, " (byte_order = %s)\n", ximage->byte_order == MSBFirst? + "MSBFirst" : (ximage->byte_order == LSBFirst? "LSBFirst" : "unknown"))) + +/*--------------------------------------------------------------------------- + Aside from the use of the rpng2_info struct and of src2 (for background + image), this routine is identical to rpng_x_display_image() in the non- + progressive version of the program--for the simple reason that redisplay + of the image against a new background happens after the image is fully + decoded and therefore is, by definition, non-progressive. + ---------------------------------------------------------------------------*/ + + if (depth == 24 || depth == 32) { + ulg red, green, blue; + int bpp = ximage->bits_per_pixel; + + for (lastrow = row = startrow; row < startrow+height; ++row) { + src = rpng2_info.image_data + row*rpng2_info.rowbytes; + if (bg_image) + src2 = bg_data + row*bg_rowbytes; + dest = ximage->data + row*ximage_rowbytes; + if (rpng2_info.channels == 3) { + for (i = rpng2_info.width; i > 0; --i) { + red = *src++; + green = *src++; + blue = *src++; +#ifdef NO_24BIT_MASKS + pixel = (red << RShift) | + (green << GShift) | + (blue << BShift); + /* recall that we set ximage->byte_order = MSBFirst above */ + if (bpp == 32) { + *dest++ = (char)((pixel >> 24) & 0xff); + *dest++ = (char)((pixel >> 16) & 0xff); + *dest++ = (char)((pixel >> 8) & 0xff); + *dest++ = (char)( pixel & 0xff); + } else { + /* this assumes bpp == 24 & bits are packed low */ + /* (probably need to use RShift, RMask, etc.) */ + *dest++ = (char)((pixel >> 16) & 0xff); + *dest++ = (char)((pixel >> 8) & 0xff); + *dest++ = (char)( pixel & 0xff); + } +#else + red = (RShift < 0)? red << (-RShift) : red >> RShift; + green = (GShift < 0)? green << (-GShift) : green >> GShift; + blue = (BShift < 0)? blue << (-BShift) : blue >> BShift; + pixel = (red & RMask) | (green & GMask) | (blue & BMask); + /* recall that we set ximage->byte_order = MSBFirst above */ + if (bpp == 32) { + *dest++ = (char)((pixel >> 24) & 0xff); + *dest++ = (char)((pixel >> 16) & 0xff); + *dest++ = (char)((pixel >> 8) & 0xff); + *dest++ = (char)( pixel & 0xff); + } else { + /* GRR BUG */ + /* this assumes bpp == 24 & bits are packed low */ + /* (probably need to use RShift/RMask/etc. here, too) */ + *dest++ = (char)((pixel >> 16) & 0xff); + *dest++ = (char)((pixel >> 8) & 0xff); + *dest++ = (char)( pixel & 0xff); + } +#endif + } + + } else /* if (rpng2_info.channels == 4) */ { + for (i = rpng2_info.width; i > 0; --i) { + r = *src++; + g = *src++; + b = *src++; + a = *src++; + if (bg_image) { + bg_red = *src2++; + bg_green = *src2++; + bg_blue = *src2++; + } + if (a == 255) { + red = r; + green = g; + blue = b; + } else if (a == 0) { + red = bg_red; + green = bg_green; + blue = bg_blue; + } else { + /* this macro (from png.h) composites the foreground + * and background values and puts the result into the + * first argument */ + alpha_composite(red, r, a, bg_red); + alpha_composite(green, g, a, bg_green); + alpha_composite(blue, b, a, bg_blue); + } +#ifdef NO_24BIT_MASKS + pixel = (red << RShift) | + (green << GShift) | + (blue << BShift); + /* recall that we set ximage->byte_order = MSBFirst above */ + if (bpp == 32) { + *dest++ = (char)((pixel >> 24) & 0xff); + *dest++ = (char)((pixel >> 16) & 0xff); + *dest++ = (char)((pixel >> 8) & 0xff); + *dest++ = (char)( pixel & 0xff); + } else { + /* this assumes bpp == 24 & bits are packed low */ + /* (probably need to use RShift, RMask, etc.) */ + *dest++ = (char)((pixel >> 16) & 0xff); + *dest++ = (char)((pixel >> 8) & 0xff); + *dest++ = (char)( pixel & 0xff); + } +#else + red = (RShift < 0)? red << (-RShift) : red >> RShift; + green = (GShift < 0)? green << (-GShift) : green >> GShift; + blue = (BShift < 0)? blue << (-BShift) : blue >> BShift; + pixel = (red & RMask) | (green & GMask) | (blue & BMask); + /* recall that we set ximage->byte_order = MSBFirst above */ + if (bpp == 32) { + *dest++ = (char)((pixel >> 24) & 0xff); + *dest++ = (char)((pixel >> 16) & 0xff); + *dest++ = (char)((pixel >> 8) & 0xff); + *dest++ = (char)( pixel & 0xff); + } else { + /* GRR BUG */ + /* this assumes bpp == 24 & bits are packed low */ + /* (probably need to use RShift/RMask/etc. here, too) */ + *dest++ = (char)((pixel >> 16) & 0xff); + *dest++ = (char)((pixel >> 8) & 0xff); + *dest++ = (char)( pixel & 0xff); + } +#endif + } + } + /* display after every 16 lines */ + if (((row+1) & 0xf) == 0) { + XPutImage(display, window, gc, ximage, 0, (int)lastrow, 0, + (int)lastrow, rpng2_info.width, 16); + XFlush(display); + lastrow = row + 1; + } + } + + } else if (depth == 16) { + ush red, green, blue; + + for (lastrow = row = startrow; row < startrow+height; ++row) { + src = rpng2_info.row_pointers[row]; + if (bg_image) + src2 = bg_data + row*bg_rowbytes; + dest = ximage->data + row*ximage_rowbytes; + if (rpng2_info.channels == 3) { + for (i = rpng2_info.width; i > 0; --i) { + red = ((ush)(*src) << 8); + ++src; + green = ((ush)(*src) << 8); + ++src; + blue = ((ush)(*src) << 8); + ++src; + pixel = ((red >> RShift) & RMask) | + ((green >> GShift) & GMask) | + ((blue >> BShift) & BMask); + /* recall that we set ximage->byte_order = MSBFirst above */ + *dest++ = (char)((pixel >> 8) & 0xff); + *dest++ = (char)( pixel & 0xff); + } + } else /* if (rpng2_info.channels == 4) */ { + for (i = rpng2_info.width; i > 0; --i) { + r = *src++; + g = *src++; + b = *src++; + a = *src++; + if (bg_image) { + bg_red = *src2++; + bg_green = *src2++; + bg_blue = *src2++; + } + if (a == 255) { + red = ((ush)r << 8); + green = ((ush)g << 8); + blue = ((ush)b << 8); + } else if (a == 0) { + red = ((ush)bg_red << 8); + green = ((ush)bg_green << 8); + blue = ((ush)bg_blue << 8); + } else { + /* this macro (from png.h) composites the foreground + * and background values and puts the result back into + * the first argument (== fg byte here: safe) */ + alpha_composite(r, r, a, bg_red); + alpha_composite(g, g, a, bg_green); + alpha_composite(b, b, a, bg_blue); + red = ((ush)r << 8); + green = ((ush)g << 8); + blue = ((ush)b << 8); + } + pixel = ((red >> RShift) & RMask) | + ((green >> GShift) & GMask) | + ((blue >> BShift) & BMask); + /* recall that we set ximage->byte_order = MSBFirst above */ + *dest++ = (char)((pixel >> 8) & 0xff); + *dest++ = (char)( pixel & 0xff); + } + } + /* display after every 16 lines */ + if (((row+1) & 0xf) == 0) { + XPutImage(display, window, gc, ximage, 0, (int)lastrow, 0, + (int)lastrow, rpng2_info.width, 16); + XFlush(display); + lastrow = row + 1; + } + } + + } else /* depth == 8 */ { + + /* GRR: add 8-bit support */ + + } + + Trace((stderr, "calling final XPutImage()\n")) + if (lastrow < startrow+height) { + XPutImage(display, window, gc, ximage, 0, (int)lastrow, 0, + (int)lastrow, rpng2_info.width, rpng2_info.height-lastrow); + XFlush(display); + } + +} /* end function rpng2_x_redisplay_image() */ + + + + + +#ifdef FEATURE_LOOP + +static void rpng2_x_reload_bg_image(void) +{ + char *dest; + uch r1, r2, g1, g2, b1, b2; + uch r1_inv, r2_inv, g1_inv, g2_inv, b1_inv, b2_inv; + int k, hmax, max; + int xidx, yidx, yidx_max; + int even_odd_vert, even_odd_horiz, even_odd; + int invert_gradient2 = (bg[pat].type & 0x08); + int invert_column; + ulg i, row; + + + bgscale = (pat == 0)? 8 : bgscale_default; + yidx_max = bgscale - 1; + +/*--------------------------------------------------------------------------- + Vertical gradients (ramps) in NxN squares, alternating direction and + colors (N == bgscale). + ---------------------------------------------------------------------------*/ + + if ((bg[pat].type & 0x07) == 0) { + uch r1_min = rgb[bg[pat].rgb1_min].r; + uch g1_min = rgb[bg[pat].rgb1_min].g; + uch b1_min = rgb[bg[pat].rgb1_min].b; + uch r2_min = rgb[bg[pat].rgb2_min].r; + uch g2_min = rgb[bg[pat].rgb2_min].g; + uch b2_min = rgb[bg[pat].rgb2_min].b; + int r1_diff = rgb[bg[pat].rgb1_max].r - r1_min; + int g1_diff = rgb[bg[pat].rgb1_max].g - g1_min; + int b1_diff = rgb[bg[pat].rgb1_max].b - b1_min; + int r2_diff = rgb[bg[pat].rgb2_max].r - r2_min; + int g2_diff = rgb[bg[pat].rgb2_max].g - g2_min; + int b2_diff = rgb[bg[pat].rgb2_max].b - b2_min; + + for (row = 0; row < rpng2_info.height; ++row) { + yidx = (int)(row % bgscale); + even_odd_vert = (int)((row / bgscale) & 1); + + r1 = r1_min + (r1_diff * yidx) / yidx_max; + g1 = g1_min + (g1_diff * yidx) / yidx_max; + b1 = b1_min + (b1_diff * yidx) / yidx_max; + r1_inv = r1_min + (r1_diff * (yidx_max-yidx)) / yidx_max; + g1_inv = g1_min + (g1_diff * (yidx_max-yidx)) / yidx_max; + b1_inv = b1_min + (b1_diff * (yidx_max-yidx)) / yidx_max; + + r2 = r2_min + (r2_diff * yidx) / yidx_max; + g2 = g2_min + (g2_diff * yidx) / yidx_max; + b2 = b2_min + (b2_diff * yidx) / yidx_max; + r2_inv = r2_min + (r2_diff * (yidx_max-yidx)) / yidx_max; + g2_inv = g2_min + (g2_diff * (yidx_max-yidx)) / yidx_max; + b2_inv = b2_min + (b2_diff * (yidx_max-yidx)) / yidx_max; + + dest = (char *)bg_data + row*bg_rowbytes; + for (i = 0; i < rpng2_info.width; ++i) { + even_odd_horiz = (int)((i / bgscale) & 1); + even_odd = even_odd_vert ^ even_odd_horiz; + invert_column = + (even_odd_horiz && (bg[pat].type & 0x10)); + if (even_odd == 0) { /* gradient #1 */ + if (invert_column) { + *dest++ = r1_inv; + *dest++ = g1_inv; + *dest++ = b1_inv; + } else { + *dest++ = r1; + *dest++ = g1; + *dest++ = b1; + } + } else { /* gradient #2 */ + if ((invert_column && invert_gradient2) || + (!invert_column && !invert_gradient2)) + { + *dest++ = r2; /* not inverted or */ + *dest++ = g2; /* doubly inverted */ + *dest++ = b2; + } else { + *dest++ = r2_inv; + *dest++ = g2_inv; /* singly inverted */ + *dest++ = b2_inv; + } + } + } + } + +/*--------------------------------------------------------------------------- + Soft gradient-diamonds with scale = bgscale. Code contributed by Adam + M. Costello. + ---------------------------------------------------------------------------*/ + + } else if ((bg[pat].type & 0x07) == 1) { + + hmax = (bgscale-1)/2; /* half the max weight of a color */ + max = 2*hmax; /* the max weight of a color */ + + r1 = rgb[bg[pat].rgb1_max].r; + g1 = rgb[bg[pat].rgb1_max].g; + b1 = rgb[bg[pat].rgb1_max].b; + r2 = rgb[bg[pat].rgb2_max].r; + g2 = rgb[bg[pat].rgb2_max].g; + b2 = rgb[bg[pat].rgb2_max].b; + + for (row = 0; row < rpng2_info.height; ++row) { + yidx = (int)(row % bgscale); + if (yidx > hmax) + yidx = bgscale-1 - yidx; + dest = (char *)bg_data + row*bg_rowbytes; + for (i = 0; i < rpng2_info.width; ++i) { + xidx = (int)(i % bgscale); + if (xidx > hmax) + xidx = bgscale-1 - xidx; + k = xidx + yidx; + *dest++ = (k*r1 + (max-k)*r2) / max; + *dest++ = (k*g1 + (max-k)*g2) / max; + *dest++ = (k*b1 + (max-k)*b2) / max; + } + } + +/*--------------------------------------------------------------------------- + Radial "starburst" with azimuthal sinusoids; [eventually number of sinu- + soids will equal bgscale?]. This one is slow but very cool. Code con- + tributed by Pieter S. van der Meulen (originally in Smalltalk). + ---------------------------------------------------------------------------*/ + + } else if ((bg[pat].type & 0x07) == 2) { + uch ch; + int ii, x, y, hw, hh, grayspot; + double freq, rotate, saturate, gray, intensity; + double angle=0.0, aoffset=0.0, maxDist, dist; + double red=0.0, green=0.0, blue=0.0, hue, s, v, f, p, q, t; + + hh = (int)(rpng2_info.height / 2); + hw = (int)(rpng2_info.width / 2); + + /* variables for radial waves: + * aoffset: number of degrees to rotate hue [CURRENTLY NOT USED] + * freq: number of color beams originating from the center + * grayspot: size of the graying center area (anti-alias) + * rotate: rotation of the beams as a function of radius + * saturate: saturation of beams' shape azimuthally + */ + angle = CLIP(angle, 0.0, 360.0); + grayspot = CLIP(bg[pat].bg_gray, 1, (hh + hw)); + freq = MAX((double)bg[pat].bg_freq, 0.0); + saturate = (double)bg[pat].bg_bsat * 0.1; + rotate = (double)bg[pat].bg_brot * 0.1; + gray = 0.0; + intensity = 0.0; + maxDist = (double)((hw*hw) + (hh*hh)); + + for (row = 0; row < rpng2_info.height; ++row) { + y = (int)(row - hh); + dest = (char *)bg_data + row*bg_rowbytes; + for (i = 0; i < rpng2_info.width; ++i) { + x = (int)(i - hw); + angle = (x == 0)? PI_2 : atan((double)y / (double)x); + gray = (double)MAX(ABS(y), ABS(x)) / grayspot; + gray = MIN(1.0, gray); + dist = (double)((x*x) + (y*y)) / maxDist; + intensity = cos((angle+(rotate*dist*PI)) * freq) * + gray * saturate; + intensity = (MAX(MIN(intensity,1.0),-1.0) + 1.0) * 0.5; + hue = (angle + PI) * INV_PI_360 + aoffset; + s = gray * ((double)(ABS(x)+ABS(y)) / (double)(hw + hh)); + s = MIN(MAX(s,0.0), 1.0); + v = MIN(MAX(intensity,0.0), 1.0); + + if (s == 0.0) { + ch = (uch)(v * 255.0); + *dest++ = ch; + *dest++ = ch; + *dest++ = ch; + } else { + if ((hue < 0.0) || (hue >= 360.0)) + hue -= (((int)(hue / 360.0)) * 360.0); + hue /= 60.0; + ii = (int)hue; + f = hue - (double)ii; + p = (1.0 - s) * v; + q = (1.0 - (s * f)) * v; + t = (1.0 - (s * (1.0 - f))) * v; + if (ii == 0) { red = v; green = t; blue = p; } + else if (ii == 1) { red = q; green = v; blue = p; } + else if (ii == 2) { red = p; green = v; blue = t; } + else if (ii == 3) { red = p; green = q; blue = v; } + else if (ii == 4) { red = t; green = p; blue = v; } + else if (ii == 5) { red = v; green = p; blue = q; } + *dest++ = (uch)(red * 255.0); + *dest++ = (uch)(green * 255.0); + *dest++ = (uch)(blue * 255.0); + } + } + } + } + +} /* end function rpng2_x_reload_bg_image() */ + + + + + +static int is_number(char *p) +{ + while (*p) { + if (!isdigit(*p)) + return FALSE; + ++p; + } + return TRUE; +} + +#endif /* FEATURE_LOOP */ + + + + + static void rpng2_x_cleanup(void) { if (bg_image && bg_data) { diff --git a/src/dep/src/irrlicht/libpng/contrib/gregbook/wpng.c b/src/dep/src/irrlicht/libpng/contrib/gregbook/wpng.c index 7aaee11..30372a3 100644 --- a/src/dep/src/irrlicht/libpng/contrib/gregbook/wpng.c +++ b/src/dep/src/irrlicht/libpng/contrib/gregbook/wpng.c @@ -5,8 +5,10 @@ This program converts certain NetPBM binary files (grayscale and RGB, maxval = 255) to PNG. Non-interlaced PNGs are written progressively; interlaced PNGs are read and written in one memory-intensive blast. + Thanks to Jean-loup Gailly for providing the necessary trick to read - interactive text from the keyboard while stdin is redirected. + interactive text from the keyboard while stdin is redirected. Thanks + to Cosmin Truta for Cygwin fixes. NOTE: includes provisional support for PNM type "8" (portable alphamap) images, presumed to be a 32-bit interleaved RGBA format; no pro- @@ -24,16 +26,32 @@ - 1.02: modified to allow abbreviated options - 1.03: removed extraneous character from usage screen; fixed bug in command-line parsing + - 1.04: fixed DOS/OS2/Win32 detection, including partial Cygwin fix + (see http://home.att.net/~perlspinr/diffs/GregBook_cygwin.diff) + - 2.00: dual-licensed (added GNU GPL) + + [REPORTED BUG (win32 only): "contrib/gregbook/wpng.c - cmd line + dose not work! In order to do something useful I needed to redirect + both input and output, with cygwin and with bcc32 as well. Under + Linux, the same wpng appears to work fine. I don't know what is + the problem."] --------------------------------------------------------------------------- - Copyright (c) 1998-2000 Greg Roelofs. All rights reserved. + Copyright (c) 1998-2007 Greg Roelofs. All rights reserved. This software is provided "as is," without warranty of any kind, express or implied. In no event shall the author or contributors be held liable for any damages arising in any way from the use of this software. + The contents of this file are DUAL-LICENSED. You may modify and/or + redistribute this software according to the terms of one of the + following two licenses (at your option): + + + LICENSE 1 ("BSD-like with advertising clause"): + Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: @@ -50,16 +68,35 @@ and contributors for the book, "PNG: The Definitive Guide," published by O'Reilly and Associates. + + LICENSE 2 (GNU GPL v2 or later): + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ---------------------------------------------------------------------------*/ #define PROGNAME "wpng" -#define VERSION "1.03 of 19 March 2000" +#define VERSION "2.00 of 2 June 2007" #define APPNAME "Simple PGM/PPM/PAM to PNG Converter" #if defined(__MSDOS__) || defined(__OS2__) # define DOS_OS2_W32 -#elif defined(_WIN32) || defined(__WIN32__) -# define DOS_OS2_W32 +#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) +# ifndef __GNUC__ /* treat Win32 native ports of gcc as Unix environments */ +# define DOS_OS2_W32 +# endif #endif #include diff --git a/src/dep/src/irrlicht/libpng/contrib/gregbook/writepng.c b/src/dep/src/irrlicht/libpng/contrib/gregbook/writepng.c index 7e1e436..f0630aa 100644 --- a/src/dep/src/irrlicht/libpng/contrib/gregbook/writepng.c +++ b/src/dep/src/irrlicht/libpng/contrib/gregbook/writepng.c @@ -4,13 +4,20 @@ --------------------------------------------------------------------------- - Copyright (c) 1998-2000 Greg Roelofs. All rights reserved. + Copyright (c) 1998-2007 Greg Roelofs. All rights reserved. This software is provided "as is," without warranty of any kind, express or implied. In no event shall the author or contributors be held liable for any damages arising in any way from the use of this software. + The contents of this file are DUAL-LICENSED. You may modify and/or + redistribute this software according to the terms of one of the + following two licenses (at your option): + + + LICENSE 1 ("BSD-like with advertising clause"): + Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: @@ -27,6 +34,23 @@ and contributors for the book, "PNG: The Definitive Guide," published by O'Reilly and Associates. + + LICENSE 2 (GNU GPL v2 or later): + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ---------------------------------------------------------------------------*/ diff --git a/src/dep/src/irrlicht/libpng/contrib/gregbook/writepng.h b/src/dep/src/irrlicht/libpng/contrib/gregbook/writepng.h index 26d7117..904e4fb 100644 --- a/src/dep/src/irrlicht/libpng/contrib/gregbook/writepng.h +++ b/src/dep/src/irrlicht/libpng/contrib/gregbook/writepng.h @@ -4,13 +4,20 @@ --------------------------------------------------------------------------- - Copyright (c) 1998-2000 Greg Roelofs. All rights reserved. + Copyright (c) 1998-2007 Greg Roelofs. All rights reserved. This software is provided "as is," without warranty of any kind, express or implied. In no event shall the author or contributors be held liable for any damages arising in any way from the use of this software. + The contents of this file are DUAL-LICENSED. You may modify and/or + redistribute this software according to the terms of one of the + following two licenses (at your option): + + + LICENSE 1 ("BSD-like with advertising clause"): + Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: @@ -27,6 +34,23 @@ and contributors for the book, "PNG: The Definitive Guide," published by O'Reilly and Associates. + + LICENSE 2 (GNU GPL v2 or later): + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ---------------------------------------------------------------------------*/ #ifndef TRUE diff --git a/src/dep/src/irrlicht/libpng/contrib/pngminim/decoder/README b/src/dep/src/irrlicht/libpng/contrib/pngminim/decoder/README new file mode 100644 index 0000000..c5531db --- /dev/null +++ b/src/dep/src/irrlicht/libpng/contrib/pngminim/decoder/README @@ -0,0 +1,6 @@ +This demonstrates the use of PNG_USER_CONFIG and pngusr.h + +To build a minimal read-only decoder, run + gather.sh # to collect needed files from pngminus, libpng, and zlib + make -f makefile.std + diff --git a/src/dep/src/irrlicht/libpng/contrib/pngminim/decoder/gather.sh b/src/dep/src/irrlicht/libpng/contrib/pngminim/decoder/gather.sh new file mode 100644 index 0000000..58de927 --- /dev/null +++ b/src/dep/src/irrlicht/libpng/contrib/pngminim/decoder/gather.sh @@ -0,0 +1,8 @@ +cp ../../pngminus/png2pnm.c pngm2pnm.c +cp ../../../*.h . +cp ../../../*.c . +rm example.c pnggccrd.c pngvcrd.c pngtest.c pngpread.c +# change the following 2 lines if zlib is somewhere else +cp ../../../../zlib/*.h . +cp ../../../../zlib/*.c . +rm minigzip.c example.c compress.c deflate.c diff --git a/src/dep/src/irrlicht/libpng/contrib/pngminim/decoder/makefile.std b/src/dep/src/irrlicht/libpng/contrib/pngminim/decoder/makefile.std new file mode 100644 index 0000000..3e1189d --- /dev/null +++ b/src/dep/src/irrlicht/libpng/contrib/pngminim/decoder/makefile.std @@ -0,0 +1,44 @@ +# Makefile for PngMinus (pngm2pnm) +# Linux / Unix + +#CC=cc +CC=gcc +LD=$(CC) + +RM=rm -f + +CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP \ + -DdeflateParams\(a,b,c\)=Z_OK -I. -O1 + +C=.c +O=.o +L=.a +E= + +ZOBJS = adler32$(O) crc32$(O) gzio$(O) \ + infback$(O) inffast$(O) inflate$(O) inftrees$(O) \ + trees$(O) uncompr$(O) zutil$(O) + +OBJS = pngm2pnm$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \ + pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \ + pngset$(O) pngtrans$(O) $(ZOBJS) + +# implicit make rules ------------------------------------------------------- + +.c$(O): png.h pngconf.h pngusr.h zlib.h + $(CC) -c $(CFLAGS) $< + +# dependencies + +all: pngm2pnm$(E) + +pngm2pnm$(E): $(OBJS) + $(LD) -o pngm2pnm$(E) $(OBJS) + strip pngm2pnm$(E) + +clean: + $(RM) pngm2pnm$(O) + $(RM) pngm2pnm$(E) + $(RM) $(OBJS) + +# End of makefile for pngm2pnm diff --git a/src/dep/src/irrlicht/libpng/contrib/pngminim/decoder/pngusr.h b/src/dep/src/irrlicht/libpng/contrib/pngminim/decoder/pngusr.h new file mode 100644 index 0000000..afa2807 --- /dev/null +++ b/src/dep/src/irrlicht/libpng/contrib/pngminim/decoder/pngusr.h @@ -0,0 +1,67 @@ +/* minrdpngconf.h: headers to make a minimal png-read-only library + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 2007 Glenn Randers-Pehrson + * Derived from pngcrush.h, Copyright 1998-2007, Glenn Randers-Pehrson + */ + +#ifndef MINRDPNGCONF_H +#define MINRDPNGCONF_H + +#define PNG_NO_GLOBAL_ARRAYS + +#define PNG_NO_WARNINGS +#define png_warning(s1,s2) "" +#define png_chunk_warning(s1,s2) "" +#define PNG_NO_ERROR_TEXT +#define png_error(s1,s2) png_err(s1) +#define png_chunk_error(s1,s2) png_err(s1) + +#define PNG_NO_ASSEMBLER_CODE +#define PNG_NO_OPTIMIZED_CODE +#define PNG_NO_READ_GAMMA +#define PNG_NO_READ_BACKGROUND +#define PNG_NO_READ_DITHER +#define PNG_NO_READ_INVERT +#define PNG_NO_READ_SHIFT +#define PNG_NO_READ_PACK +#define PNG_NO_READ_PACKSWAP +#define PNG_NO_READ_FILLER +#define PNG_NO_READ_SWAP_ALPHA +#define PNG_NO_READ_INVERT_ALPHA +#define PNG_NO_READ_RGB_TO_GRAY +#define PNG_NO_READ_USER_TRANSFORM +#define PNG_NO_READ_bKGD +#define PNG_NO_READ_cHRM +#define PNG_NO_READ_gAMA +#define PNG_NO_READ_hIST +#define PNG_NO_READ_iCCP +#define PNG_NO_READ_pCAL +#define PNG_NO_READ_pHYs +#define PNG_NO_READ_sBIT +#define PNG_NO_READ_sCAL +#define PNG_NO_READ_sPLT +#define PNG_NO_READ_TEXT +#define PNG_NO_READ_tIME +#define PNG_NO_READ_UNKNOWN_CHUNKS +#define PNG_NO_READ_USER_CHUNKS +#define PNG_NO_READ_EMPTY_PLTE +#define PNG_NO_READ_OPT_PLTE +#define PNG_NO_READ_STRIP_ALPHA +#define PNG_NO_READ_oFFs +#define PNG_NO_WARN_UNINITIALIZED_ROW + +#define PNG_NO_WRITE_SUPPORTED + +#define PNG_NO_INFO_IMAGE +#define PNG_NO_USER_MEM +#define PNG_NO_FIXED_POINT_SUPPORTED +#define PNG_NO_MNG_FEATURES +#define PNG_NO_USER_TRANSFORM_PTR +#define PNG_NO_HANDLE_AS_UNKNOWN +#define PNG_NO_CONSOLE_IO +#define PNG_NO_ZALLOC_ZERO +#define PNG_NO_ERROR_NUMBERS +#define PNG_NO_EASY_ACCESS +#define PNG_NO_PROGRESSIVE_READ + +#endif /* MINRDPNGCONF_H */ diff --git a/src/dep/src/irrlicht/libpng/contrib/pngminim/encoder/README b/src/dep/src/irrlicht/libpng/contrib/pngminim/encoder/README new file mode 100644 index 0000000..c90c44a --- /dev/null +++ b/src/dep/src/irrlicht/libpng/contrib/pngminim/encoder/README @@ -0,0 +1,6 @@ +This demonstrates the use of PNG_USER_CONFIG and pngusr.h + +To build a minimal write-only encoder, run + gather.sh # to collect needed files from pngminus, libpng, and zlib + make -f makefile.std + diff --git a/src/dep/src/irrlicht/libpng/contrib/pngminim/encoder/dummy_inflate.c b/src/dep/src/irrlicht/libpng/contrib/pngminim/encoder/dummy_inflate.c new file mode 100644 index 0000000..5d711e7 --- /dev/null +++ b/src/dep/src/irrlicht/libpng/contrib/pngminim/encoder/dummy_inflate.c @@ -0,0 +1,27 @@ +#include "zlib.h" + +int ZEXPORT inflate(strm, flush) +z_streamp strm; +int flush; +{ return Z_OK ; } + +int ZEXPORT inflateReset(strm) +z_streamp strm; +{ return Z_OK ; } + +int ZEXPORT inflateEnd(strm) +z_streamp strm; +{ return Z_STREAM_ERROR ; } + +int ZEXPORT inflateInit_(strm, version, stream_size) +z_streamp strm; +const char *version; +int stream_size; +{ return Z_OK ; } + +int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) +z_streamp strm; +int windowBits; +const char *version; +int stream_size; +{ return Z_STREAM_ERROR ; } diff --git a/src/dep/src/irrlicht/libpng/contrib/pngminim/encoder/gather.sh b/src/dep/src/irrlicht/libpng/contrib/pngminim/encoder/gather.sh new file mode 100644 index 0000000..8081f12 --- /dev/null +++ b/src/dep/src/irrlicht/libpng/contrib/pngminim/encoder/gather.sh @@ -0,0 +1,9 @@ +cp ../../pngminus/pnm2png.c pnm2pngm.c +cp ../../../*.h . +cp ../../../*.c . +rm example.c pnggccrd.c pngvcrd.c pngtest.c pngr*.c +# Change the next 2 lines if zlib is somewhere else. +cp ../../../../zlib/*.h . +cp ../../../../zlib/*.c . +rm inf*.[ch] +rm minigzip.c example.c diff --git a/src/dep/src/irrlicht/libpng/contrib/pngminim/encoder/makefile.std b/src/dep/src/irrlicht/libpng/contrib/pngminim/encoder/makefile.std new file mode 100644 index 0000000..0ca0c8b --- /dev/null +++ b/src/dep/src/irrlicht/libpng/contrib/pngminim/encoder/makefile.std @@ -0,0 +1,43 @@ +# Makefile for PngMinus (pnm2pngm) +# Linux / Unix + +#CC=cc +CC=gcc +LD=$(CC) + +RM=rm -f + +CFLAGS=-DPNG_USER_CONFIG -DNO_GZIP -I. -O1 + +C=.c +O=.o +L=.a +E= + +ZOBJS = adler32$(O) compress$(O) crc32$(O) deflate$(O) gzio$(O) \ + dummy_inflate$(O) \ + trees$(O) uncompr$(O) zutil$(O) + +OBJS = pnm2pngm$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \ + pngset$(O) pngtrans$(O) pngwio$(O) pngwrite$(O) \ + pngwtran$(O) pngwutil$(O) $(ZOBJS) + +# implicit make rules ------------------------------------------------------- + +.c$(O): png.h pngconf.h pngusr.h zlib.h + $(CC) -c $(CFLAGS) $< + +# dependencies + +all: pnm2pngm$(E) + +pnm2pngm$(E): $(OBJS) + $(LD) -o pnm2pngm$(E) $(OBJS) + strip pnm2pngm$(E) + +clean: + $(RM) pnm2pngm$(O) + $(RM) pnm2pngm$(E) + $(RM) $(OBJS) + +# End of makefile for pnm2pngm diff --git a/src/dep/src/irrlicht/libpng/contrib/pngminim/encoder/pngusr.h b/src/dep/src/irrlicht/libpng/contrib/pngminim/encoder/pngusr.h new file mode 100644 index 0000000..bfa7d36 --- /dev/null +++ b/src/dep/src/irrlicht/libpng/contrib/pngminim/encoder/pngusr.h @@ -0,0 +1,66 @@ +/* minwrpngconf.h: headers to make a minimal png-write-only library + * For conditions of distribution and use, see copyright notice in png.h + * Copyright (c) 2007 Glenn Randers-Pehrson + * Derived from pngcrush.h, Copyright 1998-2007, Glenn Randers-Pehrson + */ + +#ifndef MINWRPNGCONF_H +#define MINWRPNGCONF_H + +#define PNG_NO_GLOBAL_ARRAYS + +#define PNG_NO_READ_SUPPORTED + +#define PNG_NO_WARNINGS +#define png_warning(s1,s2) "" +#define png_chunk_warning(s1,s2) "" +#define PNG_NO_ERROR_TEXT +#define png_error(s1,s2) png_err(s1) +#define png_chunk_error(s1,s2) png_err(s1) + +#define PNG_NO_WRITE_BACKGROUND +#define PNG_NO_WRITE_GAMMA +#define PNG_NO_WRITE_DITHER +#define PNG_NO_WRITE_INVERT +#define PNG_NO_WRITE_SHIFT +#define PNG_NO_WRITE_PACK +#define PNG_NO_WRITE_PACKSWAP +#define PNG_NO_WRITE_FILLER +#define PNG_NO_WRITE_SWAP_ALPHA +#define PNG_NO_WRITE_INVERT_ALPHA +#define PNG_NO_WRITE_RGB_TO_GRAY +#define PNG_NO_WRITE_USER_TRANSFORM +#define PNG_NO_WRITE_bKGD +#define PNG_NO_WRITE_cHRM +#define PNG_NO_WRITE_gAMA +#define PNG_NO_WRITE_sRGB +#define PNG_NO_WRITE_hIST +#define PNG_NO_WRITE_iCCP +#define PNG_NO_WRITE_oFFs +#define PNG_NO_WRITE_pCAL +#define PNG_NO_WRITE_pHYs +#define PNG_NO_WRITE_sBIT +#define PNG_NO_WRITE_sCAL +#define PNG_NO_WRITE_sPLT +#define PNG_NO_WRITE_TEXT +#define PNG_NO_WRITE_tIME +#define PNG_NO_WRITE_UNKNOWN_CHUNKS +#define PNG_NO_WRITE_USER_CHUNKS +#define PNG_NO_WRITE_EMPTY_PLTE +#define PNG_NO_WRITE_OPT_PLTE +#define PNG_NO_WRITE_FILTER +#define PNG_NO_WRITE_WEIGHTED_FILTER +#define PNG_NO_WRITE_INTERLACING_SUPPORTED + +#define PNG_NO_INFO_IMAGE +#define PNG_NO_USER_MEM +#define PNG_NO_FIXED_POINT_SUPPORTED +#define PNG_NO_MNG_FEATURES +#define PNG_NO_USER_TRANSFORM_PTR +#define PNG_NO_HANDLE_AS_UNKNOWN +#define PNG_NO_CONSOLE_IO +#define PNG_NO_ZALLOC_ZERO +#define PNG_NO_ERROR_NUMBERS +#define PNG_NO_EASY_ACCESS + +#endif /* MINWRPNGCONF_H */ diff --git a/src/dep/src/irrlicht/libpng/contrib/visupng/cexcept.h b/src/dep/src/irrlicht/libpng/contrib/visupng/cexcept.h index a1a4f83..83c8bfe 100644 --- a/src/dep/src/irrlicht/libpng/contrib/visupng/cexcept.h +++ b/src/dep/src/irrlicht/libpng/contrib/visupng/cexcept.h @@ -1,25 +1,30 @@ /*=== -cexcept.h 2.0.0 (2001-Jul-12-Thu) -Adam M. Costello +cexcept.h 2.0.1 (2008-Jul-19-Sat) +http://www.nicemice.net/cexcept/ +Adam M. Costello +http://www.nicemice.net/amc/ An interface for exception-handling in ANSI C (C89 and subsequent ISO -standards), developed jointly with Cosmin Truta . +standards), developed jointly with Cosmin Truta. - Copyright (c) 2001 Adam M. Costello and Cosmin Truta. Everyone - is hereby granted permission to do whatever they like with this - file, provided that if they modify it they take reasonable steps to - avoid confusing or misleading people about the authors, version, - and terms of use of the derived file. The copyright holders make - no guarantees regarding this file, and are not responsible for any - damage resulting from its use. + Copyright (c) 2000-2008 Adam M. Costello and Cosmin Truta. + This software may be modified only if its author and version + information is updated accurately, and may be redistributed + only if accompanied by this unaltered notice. Subject to those + restrictions, permission is granted to anyone to do anything + with this software. The copyright holders make no guarantees + regarding this software, and are not responsible for any damage + resulting from its use. -Only user-defined exceptions are supported, not "real" exceptions like -division by zero or memory segmentation violations. +The cexcept interface is not compatible with and cannot interact +with system exceptions (like division by zero or memory segmentation +violation), compiler-generated exceptions (like C++ exceptions), or +other exception-handling interfaces. -If this interface is used by multiple .c files, they shouldn't include +When using this interface across multiple .c files, do not include this header file directly. Instead, create a wrapper header file that includes this header file and then invokes the define_exception_type -macro (see below), and let your .c files include that header file. +macro (see below). The .c files should then include that header file. The interface consists of one type, one well-known name, and six macros. @@ -164,7 +169,7 @@ Throw expression; be compatible with the type passed to define_exception_type(). The exception must be caught, otherwise the program may crash. - Slight limitation: If the expression is a comma-expression it must + Slight limitation: If the expression is a comma-expression, it must be enclosed in parentheses. @@ -209,11 +214,11 @@ struct exception_context { \ exception__prev = the_exception_context->penv; \ the_exception_context->penv = &exception__env; \ if (setjmp(exception__env) == 0) { \ - if (&exception__prev) + do #define exception__catch(action) \ - else { } \ - the_exception_context->caught = 0; \ + while (the_exception_context->caught = 0, \ + the_exception_context->caught); \ } \ else { \ the_exception_context->caught = 1; \ @@ -226,14 +231,14 @@ struct exception_context { \ #define Catch(e) exception__catch(((e) = the_exception_context->v.etmp, 0)) #define Catch_anonymous exception__catch(0) -/* Try ends with if(), and Catch begins and ends with else. This */ -/* ensures that the Try/Catch syntax is really the same as the */ -/* if/else syntax. */ +/* Try ends with do, and Catch begins with while(0) and ends with */ +/* else, to ensure that Try/Catch syntax is similar to if/else */ +/* syntax. */ /* */ -/* We use &exception__prev instead of 1 to appease compilers that */ -/* warn about constant expressions inside if(). Most compilers */ -/* should still recognize that &exception__prev is never zero and */ -/* avoid generating test code. */ +/* The 0 in while(0) is expressed as x=0,x in order to appease */ +/* compilers that warn about constant expressions inside while(). */ +/* Most compilers should still recognize that the condition is always */ +/* false and avoid generating code for it. */ #define Throw \ for (;; longjmp(*the_exception_context->penv, 1)) \ diff --git a/src/dep/src/irrlicht/libpng/example.c b/src/dep/src/irrlicht/libpng/example.c index e40059c..3086f22 100644 --- a/src/dep/src/irrlicht/libpng/example.c +++ b/src/dep/src/irrlicht/libpng/example.c @@ -2,823 +2,9 @@ #if 0 /* in case someone actually tries to compile this */ /* example.c - an example of using libpng - * Last changed in libpng 1.2.35 [February 14, 2009] + * Last changed in libpng 1.2.32 [September 18, 2008] * This file has been placed in the public domain by the authors. - * Maintained 1998-2009 Glenn Randers-Pehrson - * Maintained 1996, 1997 Andreas Dilger) - * Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - */ - -/* This is an example of how to use libpng to read and write PNG files. - * The file libpng.txt is much more verbose then this. If you have not - * read it, do so first. This was designed to be a starting point of an - * implementation. This is not officially part of libpng, is hereby placed - * in the public domain, and therefore does not require a copyright notice. - * - * This file does not currently compile, because it is missing certain - * parts, like allocating memory to hold an image. You will have to - * supply these parts to get it to compile. For an example of a minimal - * working PNG reader/writer, see pngtest.c, included in this distribution; - * see also the programs in the contrib directory. - */ - -#include "png.h" - - /* The png_jmpbuf() macro, used in error handling, became available in - * libpng version 1.0.6. If you want to be able to run your code with older - * versions of libpng, you must define the macro yourself (but only if it - * is not already defined by libpng!). - */ - -#ifndef png_jmpbuf -# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf) -#endif - -/* Check to see if a file is a PNG file using png_sig_cmp(). png_sig_cmp() - * returns zero if the image is a PNG and nonzero if it isn't a PNG. - * - * The function check_if_png() shown here, but not used, returns nonzero (true) - * if the file can be opened and is a PNG, 0 (false) otherwise. - * - * If this call is successful, and you are going to keep the file open, - * you should call png_set_sig_bytes(png_ptr, PNG_BYTES_TO_CHECK); once - * you have created the png_ptr, so that libpng knows your application - * has read that many bytes from the start of the file. Make sure you - * don't call png_set_sig_bytes() with more than 8 bytes read or give it - * an incorrect number of bytes read, or you will either have read too - * many bytes (your fault), or you are telling libpng to read the wrong - * number of magic bytes (also your fault). - * - * Many applications already read the first 2 or 4 bytes from the start - * of the image to determine the file type, so it would be easiest just - * to pass the bytes to png_sig_cmp() or even skip that if you know - * you have a PNG file, and call png_set_sig_bytes(). - */ -#define PNG_BYTES_TO_CHECK 4 -int check_if_png(char *file_name, FILE **fp) -{ - char buf[PNG_BYTES_TO_CHECK]; - - /* Open the prospective PNG file. */ - if ((*fp = fopen(file_name, "rb")) == NULL) - return 0; - - /* Read in some of the signature bytes */ - if (fread(buf, 1, PNG_BYTES_TO_CHECK, *fp) != PNG_BYTES_TO_CHECK) - return 0; - - /* Compare the first PNG_BYTES_TO_CHECK bytes of the signature. - Return nonzero (true) if they match */ - - return(!png_sig_cmp(buf, (png_size_t)0, PNG_BYTES_TO_CHECK)); -} - -/* Read a PNG file. You may want to return an error code if the read - * fails (depending upon the failure). There are two "prototypes" given - * here - one where we are given the filename, and we need to open the - * file, and the other where we are given an open file (possibly with - * some or all of the magic bytes read - see comments above). - */ -#ifdef open_file /* prototype 1 */ -void read_png(char *file_name) /* We need to open the file */ -{ - png_structp png_ptr; - png_infop info_ptr; - unsigned int sig_read = 0; - png_uint_32 width, height; - int bit_depth, color_type, interlace_type; - FILE *fp; - - if ((fp = fopen(file_name, "rb")) == NULL) - return (ERROR); -#else no_open_file /* prototype 2 */ -void read_png(FILE *fp, unsigned int sig_read) /* file is already open */ -{ - png_structp png_ptr; - png_infop info_ptr; - png_uint_32 width, height; - int bit_depth, color_type, interlace_type; -#endif no_open_file /* only use one prototype! */ - - /* Create and initialize the png_struct with the desired error handler - * functions. If you want to use the default stderr and longjump method, - * you can supply NULL for the last three parameters. We also supply the - * the compiler header file version, so that we know if the application - * was compiled with a compatible version of the library. REQUIRED - */ - png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, - png_voidp user_error_ptr, user_error_fn, user_warning_fn); - - if (png_ptr == NULL) - { - fclose(fp); - return (ERROR); - } - - /* Allocate/initialize the memory for image information. REQUIRED. */ - info_ptr = png_create_info_struct(png_ptr); - if (info_ptr == NULL) - { - fclose(fp); - png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL); - return (ERROR); - } - - /* Set error handling if you are using the setjmp/longjmp method (this is - * the normal method of doing things with libpng). REQUIRED unless you - * set up your own error handlers in the png_create_read_struct() earlier. - */ - - if (setjmp(png_jmpbuf(png_ptr))) - { - /* Free all of the memory associated with the png_ptr and info_ptr */ - png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL); - fclose(fp); - /* If we get here, we had a problem reading the file */ - return (ERROR); - } - - /* One of the following I/O initialization methods is REQUIRED */ -#ifdef streams /* PNG file I/O method 1 */ - /* Set up the input control if you are using standard C streams */ - png_init_io(png_ptr, fp); - -#else no_streams /* PNG file I/O method 2 */ - /* If you are using replacement read functions, instead of calling - * png_init_io() here you would call: - */ - png_set_read_fn(png_ptr, (void *)user_io_ptr, user_read_fn); - /* where user_io_ptr is a structure you want available to the callbacks */ -#endif no_streams /* Use only one I/O method! */ - - /* If we have already read some of the signature */ - png_set_sig_bytes(png_ptr, sig_read); - -#ifdef hilevel - /* - * If you have enough memory to read in the entire image at once, - * and you need to specify only transforms that can be controlled - * with one of the PNG_TRANSFORM_* bits (this presently excludes - * dithering, filling, setting background, and doing gamma - * adjustment), then you can read the entire image (including - * pixels) into the info structure with this call: - */ - png_read_png(png_ptr, info_ptr, png_transforms, png_voidp_NULL); -#else - /* OK, you're doing it the hard way, with the lower-level functions */ - - /* The call to png_read_info() gives us all of the information from the - * PNG file before the first IDAT (image data chunk). REQUIRED - */ - png_read_info(png_ptr, info_ptr); - - png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, - &interlace_type, int_p_NULL, int_p_NULL); - -/* Set up the data transformations you want. Note that these are all - * optional. Only call them if you want/need them. Many of the - * transformations only work on specific types of images, and many - * are mutually exclusive. - */ - - /* tell libpng to strip 16 bit/color files down to 8 bits/color */ - png_set_strip_16(png_ptr); - - /* Strip alpha bytes from the input data without combining with the - * background (not recommended). - */ - png_set_strip_alpha(png_ptr); - - /* Extract multiple pixels with bit depths of 1, 2, and 4 from a single - * byte into separate bytes (useful for paletted and grayscale images). - */ - png_set_packing(png_ptr); - - /* Change the order of packed pixels to least significant bit first - * (not useful if you are using png_set_packing). */ - png_set_packswap(png_ptr); - - /* Expand paletted colors into true RGB triplets */ - if (color_type == PNG_COLOR_TYPE_PALETTE) - png_set_palette_to_rgb(png_ptr); - - /* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */ - if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) - png_set_expand_gray_1_2_4_to_8(png_ptr); - - /* Expand paletted or RGB images with transparency to full alpha channels - * so the data will be available as RGBA quartets. - */ - if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) - png_set_tRNS_to_alpha(png_ptr); - - /* Set the background color to draw transparent and alpha images over. - * It is possible to set the red, green, and blue components directly - * for paletted images instead of supplying a palette index. Note that - * even if the PNG file supplies a background, you are not required to - * use it - you should use the (solid) application background if it has one. - */ - - png_color_16 my_background, *image_background; - - if (png_get_bKGD(png_ptr, info_ptr, &image_background)) - png_set_background(png_ptr, image_background, - PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); - else - png_set_background(png_ptr, &my_background, - PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); - - /* Some suggestions as to how to get a screen gamma value */ - - /* Note that screen gamma is the display_exponent, which includes - * the CRT_exponent and any correction for viewing conditions */ - if (/* We have a user-defined screen gamma value */) - { - screen_gamma = user-defined screen_gamma; - } - /* This is one way that applications share the same screen gamma value */ - else if ((gamma_str = getenv("SCREEN_GAMMA")) != NULL) - { - screen_gamma = atof(gamma_str); - } - /* If we don't have another value */ - else - { - screen_gamma = 2.2; /* A good guess for a PC monitors in a dimly - lit room */ - screen_gamma = 1.7 or 1.0; /* A good guess for Mac systems */ - } - - /* Tell libpng to handle the gamma conversion for you. The final call - * is a good guess for PC generated images, but it should be configurable - * by the user at run time by the user. It is strongly suggested that - * your application support gamma correction. - */ - - int intent; - - if (png_get_sRGB(png_ptr, info_ptr, &intent)) - png_set_gamma(png_ptr, screen_gamma, 0.45455); - else - { - double image_gamma; - if (png_get_gAMA(png_ptr, info_ptr, &image_gamma)) - png_set_gamma(png_ptr, screen_gamma, image_gamma); - else - png_set_gamma(png_ptr, screen_gamma, 0.45455); - } - - /* Dither RGB files down to 8 bit palette or reduce palettes - * to the number of colors available on your screen. - */ - if (color_type & PNG_COLOR_MASK_COLOR) - { - int num_palette; - png_colorp palette; - - /* This reduces the image to the application supplied palette */ - if (/* we have our own palette */) - { - /* An array of colors to which the image should be dithered */ - png_color std_color_cube[MAX_SCREEN_COLORS]; - - png_set_dither(png_ptr, std_color_cube, MAX_SCREEN_COLORS, - MAX_SCREEN_COLORS, png_uint_16p_NULL, 0); - } - /* This reduces the image to the palette supplied in the file */ - else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette)) - { - png_uint_16p histogram = NULL; - - png_get_hIST(png_ptr, info_ptr, &histogram); - - png_set_dither(png_ptr, palette, num_palette, - max_screen_colors, histogram, 0); - } - } - - /* invert monochrome files to have 0 as white and 1 as black */ - png_set_invert_mono(png_ptr); - - /* If you want to shift the pixel values from the range [0,255] or - * [0,65535] to the original [0,7] or [0,31], or whatever range the - * colors were originally in: - */ - if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT)) - { - png_color_8p sig_bit; - - png_get_sBIT(png_ptr, info_ptr, &sig_bit); - png_set_shift(png_ptr, sig_bit); - } - - /* flip the RGB pixels to BGR (or RGBA to BGRA) */ - if (color_type & PNG_COLOR_MASK_COLOR) - png_set_bgr(png_ptr); - - /* swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */ - png_set_swap_alpha(png_ptr); - - /* swap bytes of 16 bit files to least significant byte first */ - png_set_swap(png_ptr); - - /* Add filler (or alpha) byte (before/after each RGB triplet) */ - png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER); - - /* Turn on interlace handling. REQUIRED if you are not using - * png_read_image(). To see how to handle interlacing passes, - * see the png_read_row() method below: - */ - number_passes = png_set_interlace_handling(png_ptr); - - /* Optional call to gamma correct and add the background to the palette - * and update info structure. REQUIRED if you are expecting libpng to - * update the palette for you (ie you selected such a transform above). - */ - png_read_update_info(png_ptr, info_ptr); - - /* Allocate the memory to hold the image using the fields of info_ptr. */ - - /* The easiest way to read the image: */ - png_bytep row_pointers[height]; - - /* Clear the pointer array */ - for (row = 0; row < height; row++) - row_pointers[row] = NULL; - - for (row = 0; row < height; row++) - row_pointers[row] = png_malloc(png_ptr, png_get_rowbytes(png_ptr, - info_ptr)); - - /* Now it's time to read the image. One of these methods is REQUIRED */ -#ifdef entire /* Read the entire image in one go */ - png_read_image(png_ptr, row_pointers); - -#else no_entire /* Read the image one or more scanlines at a time */ - /* The other way to read images - deal with interlacing: */ - - for (pass = 0; pass < number_passes; pass++) - { -#ifdef single /* Read the image a single row at a time */ - for (y = 0; y < height; y++) - { - png_read_rows(png_ptr, &row_pointers[y], png_bytepp_NULL, 1); - } - -#else no_single /* Read the image several rows at a time */ - for (y = 0; y < height; y += number_of_rows) - { -#ifdef sparkle /* Read the image using the "sparkle" effect. */ - png_read_rows(png_ptr, &row_pointers[y], png_bytepp_NULL, - number_of_rows); -#else no_sparkle /* Read the image using the "rectangle" effect */ - png_read_rows(png_ptr, png_bytepp_NULL, &row_pointers[y], - number_of_rows); -#endif no_sparkle /* use only one of these two methods */ - } - - /* if you want to display the image after every pass, do - so here */ -#endif no_single /* use only one of these two methods */ - } -#endif no_entire /* use only one of these two methods */ - - /* read rest of file, and get additional chunks in info_ptr - REQUIRED */ - png_read_end(png_ptr, info_ptr); -#endif hilevel - - /* At this point you have read the entire image */ - - /* clean up after the read, and free any memory allocated - REQUIRED */ - png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL); - - /* close the file */ - fclose(fp); - - /* that's it */ - return (OK); -} - -/* progressively read a file */ - -int -initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr) -{ - /* Create and initialize the png_struct with the desired error handler - * functions. If you want to use the default stderr and longjump method, - * you can supply NULL for the last three parameters. We also check that - * the library version is compatible in case we are using dynamically - * linked libraries. - */ - *png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, - png_voidp user_error_ptr, user_error_fn, user_warning_fn); - - if (*png_ptr == NULL) - { - *info_ptr = NULL; - return (ERROR); - } - - *info_ptr = png_create_info_struct(png_ptr); - - if (*info_ptr == NULL) - { - png_destroy_read_struct(png_ptr, info_ptr, png_infopp_NULL); - return (ERROR); - } - - if (setjmp(png_jmpbuf((*png_ptr)))) - { - png_destroy_read_struct(png_ptr, info_ptr, png_infopp_NULL); - return (ERROR); - } - - /* This one's new. You will need to provide all three - * function callbacks, even if you aren't using them all. - * If you aren't using all functions, you can specify NULL - * parameters. Even when all three functions are NULL, - * you need to call png_set_progressive_read_fn(). - * These functions shouldn't be dependent on global or - * static variables if you are decoding several images - * simultaneously. You should store stream specific data - * in a separate struct, given as the second parameter, - * and retrieve the pointer from inside the callbacks using - * the function png_get_progressive_ptr(png_ptr). - */ - png_set_progressive_read_fn(*png_ptr, (void *)stream_data, - info_callback, row_callback, end_callback); - - return (OK); -} - -int -process_data(png_structp *png_ptr, png_infop *info_ptr, - png_bytep buffer, png_uint_32 length) -{ - if (setjmp(png_jmpbuf((*png_ptr)))) - { - /* Free the png_ptr and info_ptr memory on error */ - png_destroy_read_struct(png_ptr, info_ptr, png_infopp_NULL); - return (ERROR); - } - - /* This one's new also. Simply give it chunks of data as - * they arrive from the data stream (in order, of course). - * On Segmented machines, don't give it any more than 64K. - * The library seems to run fine with sizes of 4K, although - * you can give it much less if necessary (I assume you can - * give it chunks of 1 byte, but I haven't tried with less - * than 256 bytes yet). When this function returns, you may - * want to display any rows that were generated in the row - * callback, if you aren't already displaying them there. - */ - png_process_data(*png_ptr, *info_ptr, buffer, length); - return (OK); -} - -info_callback(png_structp png_ptr, png_infop info) -{ -/* do any setup here, including setting any of the transformations - * mentioned in the Reading PNG files section. For now, you _must_ - * call either png_start_read_image() or png_read_update_info() - * after all the transformations are set (even if you don't set - * any). You may start getting rows before png_process_data() - * returns, so this is your last chance to prepare for that. - */ -} - -row_callback(png_structp png_ptr, png_bytep new_row, - png_uint_32 row_num, int pass) -{ -/* - * This function is called for every row in the image. If the - * image is interlaced, and you turned on the interlace handler, - * this function will be called for every row in every pass. - * - * In this function you will receive a pointer to new row data from - * libpng called new_row that is to replace a corresponding row (of - * the same data format) in a buffer allocated by your application. - * - * The new row data pointer new_row may be NULL, indicating there is - * no new data to be replaced (in cases of interlace loading). - * - * If new_row is not NULL then you need to call - * png_progressive_combine_row() to replace the corresponding row as - * shown below: - */ - /* Check if row_num is in bounds. */ - if ((row_num >= 0) && (row_num < height)) - { - /* Get pointer to corresponding row in our - * PNG read buffer. - */ - png_bytep old_row = ((png_bytep *)our_data)[row_num]; - - /* If both rows are allocated then copy the new row - * data to the corresponding row data. - */ - if ((old_row != NULL) && (new_row != NULL)) - png_progressive_combine_row(png_ptr, old_row, new_row); - } -/* - * The rows and passes are called in order, so you don't really - * need the row_num and pass, but I'm supplying them because it - * may make your life easier. - * - * For the non-NULL rows of interlaced images, you must call - * png_progressive_combine_row() passing in the new row and the - * old row, as demonstrated above. You can call this function for - * NULL rows (it will just return) and for non-interlaced images - * (it just does the png_memcpy for you) if it will make the code - * easier. Thus, you can just do this for all cases: - */ - - png_progressive_combine_row(png_ptr, old_row, new_row); - -/* where old_row is what was displayed for previous rows. Note - * that the first pass (pass == 0 really) will completely cover - * the old row, so the rows do not have to be initialized. After - * the first pass (and only for interlaced images), you will have - * to pass the current row as new_row, and the function will combine - * the old row and the new row. - */ -} - -end_callback(png_structp png_ptr, png_infop info) -{ -/* this function is called when the whole image has been read, - * including any chunks after the image (up to and including - * the IEND). You will usually have the same info chunk as you - * had in the header, although some data may have been added - * to the comments and time fields. - * - * Most people won't do much here, perhaps setting a flag that - * marks the image as finished. - */ -} - -/* write a png file */ -void write_png(char *file_name /* , ... other image information ... */) -{ - FILE *fp; - png_structp png_ptr; - png_infop info_ptr; - png_colorp palette; - - /* open the file */ - fp = fopen(file_name, "wb"); - if (fp == NULL) - return (ERROR); - - /* Create and initialize the png_struct with the desired error handler - * functions. If you want to use the default stderr and longjump method, - * you can supply NULL for the last three parameters. We also check that - * the library version is compatible with the one used at compile time, - * in case we are using dynamically linked libraries. REQUIRED. - */ - png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, - png_voidp user_error_ptr, user_error_fn, user_warning_fn); - - if (png_ptr == NULL) - { - fclose(fp); - return (ERROR); - } - - /* Allocate/initialize the image information data. REQUIRED */ - info_ptr = png_create_info_struct(png_ptr); - if (info_ptr == NULL) - { - fclose(fp); - png_destroy_write_struct(&png_ptr, png_infopp_NULL); - return (ERROR); - } - - /* Set error handling. REQUIRED if you aren't supplying your own - * error handling functions in the png_create_write_struct() call. - */ - if (setjmp(png_jmpbuf(png_ptr))) - { - /* If we get here, we had a problem reading the file */ - fclose(fp); - png_destroy_write_struct(&png_ptr, &info_ptr); - return (ERROR); - } - - /* One of the following I/O initialization functions is REQUIRED */ -#ifdef streams /* I/O initialization method 1 */ - /* set up the output control if you are using standard C streams */ - png_init_io(png_ptr, fp); -#else no_streams /* I/O initialization method 2 */ - /* If you are using replacement write functions, instead of calling - * png_init_io() here you would call */ - png_set_write_fn(png_ptr, (void *)user_io_ptr, user_write_fn, - user_IO_flush_function); - /* where user_io_ptr is a structure you want available to the callbacks */ -#endif no_streams /* only use one initialization method */ - -#ifdef hilevel - /* This is the easy way. Use it if you already have all the - * image info living info in the structure. You could "|" many - * PNG_TRANSFORM flags into the png_transforms integer here. - */ - png_write_png(png_ptr, info_ptr, png_transforms, png_voidp_NULL); -#else - /* This is the hard way */ - - /* Set the image information here. Width and height are up to 2^31, - * bit_depth is one of 1, 2, 4, 8, or 16, but valid values also depend on - * the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY, - * PNG_COLOR_TYPE_GRAY_ALPHA, PNG_COLOR_TYPE_PALETTE, PNG_COLOR_TYPE_RGB, - * or PNG_COLOR_TYPE_RGB_ALPHA. interlace is either PNG_INTERLACE_NONE or - * PNG_INTERLACE_ADAM7, and the compression_type and filter_type MUST - * currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE. REQUIRED - */ - png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, PNG_COLOR_TYPE_???, - PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); - - /* set the palette if there is one. REQUIRED for indexed-color images */ - palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH - * png_sizeof(png_color)); - /* ... set palette colors ... */ - png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH); - /* You must not free palette here, because png_set_PLTE only makes a link to - the palette that you malloced. Wait until you are about to destroy - the png structure. */ - - /* optional significant bit chunk */ - /* if we are dealing with a grayscale image then */ - sig_bit.gray = true_bit_depth; - /* otherwise, if we are dealing with a color image then */ - sig_bit.red = true_red_bit_depth; - sig_bit.green = true_green_bit_depth; - sig_bit.blue = true_blue_bit_depth; - /* if the image has an alpha channel then */ - sig_bit.alpha = true_alpha_bit_depth; - png_set_sBIT(png_ptr, info_ptr, sig_bit); - - - /* Optional gamma chunk is strongly suggested if you have any guess - * as to the correct gamma of the image. - */ - png_set_gAMA(png_ptr, info_ptr, gamma); - - /* Optionally write comments into the image */ - text_ptr[0].key = "Title"; - text_ptr[0].text = "Mona Lisa"; - text_ptr[0].compression = PNG_TEXT_COMPRESSION_NONE; - text_ptr[1].key = "Author"; - text_ptr[1].text = "Leonardo DaVinci"; - text_ptr[1].compression = PNG_TEXT_COMPRESSION_NONE; - text_ptr[2].key = "Description"; - text_ptr[2].text = ""; - text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt; -#ifdef PNG_iTXt_SUPPORTED - text_ptr[0].lang = NULL; - text_ptr[1].lang = NULL; - text_ptr[2].lang = NULL; -#endif - png_set_text(png_ptr, info_ptr, text_ptr, 3); - - /* other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs, */ - /* note that if sRGB is present the gAMA and cHRM chunks must be ignored - * on read and must be written in accordance with the sRGB profile */ - - /* Write the file header information. REQUIRED */ - png_write_info(png_ptr, info_ptr); - - /* If you want, you can write the info in two steps, in case you need to - * write your private chunk ahead of PLTE: - * - * png_write_info_before_PLTE(write_ptr, write_info_ptr); - * write_my_chunk(); - * png_write_info(png_ptr, info_ptr); - * - * However, given the level of known- and unknown-chunk support in 1.1.0 - * and up, this should no longer be necessary. - */ - - /* Once we write out the header, the compression type on the text - * chunks gets changed to PNG_TEXT_COMPRESSION_NONE_WR or - * PNG_TEXT_COMPRESSION_zTXt_WR, so it doesn't get written out again - * at the end. - */ - - /* set up the transformations you want. Note that these are - * all optional. Only call them if you want them. - */ - - /* invert monochrome pixels */ - png_set_invert_mono(png_ptr); - - /* Shift the pixels up to a legal bit depth and fill in - * as appropriate to correctly scale the image. - */ - png_set_shift(png_ptr, &sig_bit); - - /* pack pixels into bytes */ - png_set_packing(png_ptr); - - /* swap location of alpha bytes from ARGB to RGBA */ - png_set_swap_alpha(png_ptr); - - /* Get rid of filler (OR ALPHA) bytes, pack XRGB/RGBX/ARGB/RGBA into - * RGB (4 channels -> 3 channels). The second parameter is not used. - */ - png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE); - - /* flip BGR pixels to RGB */ - png_set_bgr(png_ptr); - - /* swap bytes of 16-bit files to most significant byte first */ - png_set_swap(png_ptr); - - /* swap bits of 1, 2, 4 bit packed pixel formats */ - png_set_packswap(png_ptr); - - /* turn on interlace handling if you are not using png_write_image() */ - if (interlacing) - number_passes = png_set_interlace_handling(png_ptr); - else - number_passes = 1; - - /* The easiest way to write the image (you may have a different memory - * layout, however, so choose what fits your needs best). You need to - * use the first method if you aren't handling interlacing yourself. - */ - png_uint_32 k, height, width; - png_byte image[height][width*bytes_per_pixel]; - png_bytep row_pointers[height]; - - if (height > PNG_UINT_32_MAX/png_sizeof(png_bytep)) - png_error (png_ptr, "Image is too tall to process in memory"); - - for (k = 0; k < height; k++) - row_pointers[k] = image + k*width*bytes_per_pixel; - - /* One of the following output methods is REQUIRED */ -#ifdef entire /* write out the entire image data in one call */ - png_write_image(png_ptr, row_pointers); - - /* the other way to write the image - deal with interlacing */ - -#else no_entire /* write out the image data by one or more scanlines */ - /* The number of passes is either 1 for non-interlaced images, - * or 7 for interlaced images. - */ - for (pass = 0; pass < number_passes; pass++) - { - /* Write a few rows at a time. */ - png_write_rows(png_ptr, &row_pointers[first_row], number_of_rows); - - /* If you are only writing one row at a time, this works */ - for (y = 0; y < height; y++) - png_write_rows(png_ptr, &row_pointers[y], 1); - } -#endif no_entire /* use only one output method */ - - /* You can write optional chunks like tEXt, zTXt, and tIME at the end - * as well. Shouldn't be necessary in 1.1.0 and up as all the public - * chunks are supported and you can use png_set_unknown_chunks() to - * register unknown chunks into the info structure to be written out. - */ - - /* It is REQUIRED to call this to finish writing the rest of the file */ - png_write_end(png_ptr, info_ptr); -#endif hilevel - - /* If you png_malloced a palette, free it here (don't free info_ptr->palette, - as recommended in versions 1.0.5m and earlier of this example; if - libpng mallocs info_ptr->palette, libpng will free it). If you - allocated it with malloc() instead of png_malloc(), use free() instead - of png_free(). */ - png_free(png_ptr, palette); - palette = NULL; - - /* Similarly, if you png_malloced any data that you passed in with - png_set_something(), such as a hist or trans array, free it here, - when you can be sure that libpng is through with it. */ - png_free(png_ptr, trans); - trans = NULL; - - /* clean up after the write, and free any memory allocated */ - png_destroy_write_struct(&png_ptr, &info_ptr); - - /* close the file */ - fclose(fp); - - /* that's it */ - return (OK); -} - -#endif /* if 0 */ - -#if 0 /* in case someone actually tries to compile this */ - -/* example.c - an example of using libpng - * Last changed in libpng 1.2.1 December 7, 2001. - * This file has been placed in the public domain by the authors. - * Maintained 1998-2007 Glenn Randers-Pehrson + * Maintained 1998-2008 Glenn Randers-Pehrson * Maintained 1996, 1997 Andreas Dilger) * Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) */ @@ -1319,7 +505,7 @@ row_callback(png_structp png_ptr, png_bytep new_row, * shown below: */ /* Check if row_num is in bounds. */ - if((row_num >= 0) && (row_num < height)) + if ((row_num >= 0) && (row_num < height)) { /* Get pointer to corresponding row in our * PNG read buffer. @@ -1329,7 +515,7 @@ row_callback(png_structp png_ptr, png_bytep new_row, /* If both rows are allocated then copy the new row * data to the corresponding row data. */ - if((old_row != NULL) && (new_row != NULL)) + if ((old_row != NULL) && (new_row != NULL)) png_progressive_combine_row(png_ptr, old_row, new_row); } /* @@ -1422,7 +608,7 @@ void write_png(char *file_name /* , ... other image information ... */) /* set up the output control if you are using standard C streams */ png_init_io(png_ptr, fp); #else no_streams /* I/O initialization method 2 */ - /* If you are using replacement read functions, instead of calling + /* If you are using replacement write functions, instead of calling * png_init_io() here you would call */ png_set_write_fn(png_ptr, (void *)user_io_ptr, user_write_fn, user_IO_flush_function); @@ -1451,7 +637,7 @@ void write_png(char *file_name /* , ... other image information ... */) /* set the palette if there is one. REQUIRED for indexed-color images */ palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH - * png_sizeof (png_color)); + * png_sizeof(png_color)); /* ... set palette colors ... */ png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH); /* You must not free palette here, because png_set_PLTE only makes a link to @@ -1607,13 +793,13 @@ void write_png(char *file_name /* , ... other image information ... */) allocated it with malloc() instead of png_malloc(), use free() instead of png_free(). */ png_free(png_ptr, palette); - palette=NULL; + palette = NULL; /* Similarly, if you png_malloced any data that you passed in with png_set_something(), such as a hist or trans array, free it here, when you can be sure that libpng is through with it. */ png_free(png_ptr, trans); - trans=NULL; + trans = NULL; /* clean up after the write, and free any memory allocated */ png_destroy_write_struct(&png_ptr, &info_ptr); diff --git a/src/dep/src/irrlicht/libpng/libpng.3 b/src/dep/src/irrlicht/libpng/libpng.3 index c22e6c2..e0dd939 100644 --- a/src/dep/src/irrlicht/libpng/libpng.3 +++ b/src/dep/src/irrlicht/libpng/libpng.3 @@ -1,6 +1,6 @@ -.TH LIBPNG 3 "February 14, 2009" +.TH LIBPNG 3 "September 18, 2008" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.2.35 +libpng \- Portable Network Graphics (PNG) Reference Library 1.2.32 .SH SYNOPSIS \fI\fB @@ -821,7 +821,7 @@ Following is a copy of the libpng.txt file that accompanies libpng. .SH LIBPNG.TXT libpng.txt - A description on how to use and modify libpng - libpng version 1.2.35 - February 14, 2009 + libpng version 1.2.32 - September 18, 2008 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2008 Glenn Randers-Pehrson @@ -830,7 +830,7 @@ libpng.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.2.35 - February 14, 2009 + libpng versions 0.97, January 1998, through 1.2.32 - September 18, 2008 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2008 Glenn Randers-Pehrson @@ -1168,9 +1168,8 @@ If you need to retrieve the limits that are being applied, use Now you get to set the way the library processes unknown chunks in the input PNG stream. Both known and unknown chunks will be read. Normal behavior is that known chunks will be parsed into information in -various info_ptr members while unknown chunks will be discarded. This -behavior can be wasteful if your application will never use some known -chunk types. To change this, you can call: +various info_ptr members while unknown chunks will be discarded. To change +this, you can call: png_set_keep_unknown_chunks(png_ptr, keep, chunk_list, num_chunks); @@ -1293,8 +1292,6 @@ row_pointers prior to calling png_read_png() with "Image is too wide to process in memory"); row_pointers = png_malloc(png_ptr, height*png_sizeof(png_bytep)); - for (int i=0; i\fP - -\fBpng_uint_32 png_access_version_number \fI(void\fP\fB);\fP - -\fBint png_check_sig (png_bytep \fP\fIsig\fP\fB, int \fInum\fP\fB);\fP - -\fBvoid png_chunk_error (png_structp \fP\fIpng_ptr\fP\fB, png_const_charp \fIerror\fP\fB);\fP - -\fBvoid png_chunk_warning (png_structp \fP\fIpng_ptr\fP\fB, png_const_charp \fImessage\fP\fB);\fP - -\fBvoid png_convert_from_struct_tm (png_timep \fP\fIptime\fP\fB, struct tm FAR * \fIttime\fP\fB);\fP - -\fBvoid png_convert_from_time_t (png_timep \fP\fIptime\fP\fB, time_t \fIttime\fP\fB);\fP - -\fBpng_charp png_convert_to_rfc1123 (png_structp \fP\fIpng_ptr\fP\fB, png_timep \fIptime\fP\fB);\fP - -\fBpng_infop png_create_info_struct (png_structp \fIpng_ptr\fP\fB);\fP - -\fBpng_structp png_create_read_struct (png_const_charp \fP\fIuser_png_ver\fP\fB, png_voidp \fP\fIerror_ptr\fP\fB, png_error_ptr \fP\fIerror_fn\fP\fB, png_error_ptr \fIwarn_fn\fP\fB);\fP - -\fBpng_structp png_create_read_struct_2(png_const_charp \fP\fIuser_png_ver\fP\fB, png_voidp \fP\fIerror_ptr\fP\fB, png_error_ptr \fP\fIerror_fn\fP\fB, png_error_ptr \fP\fIwarn_fn\fP\fB, png_voidp \fP\fImem_ptr\fP\fB, png_malloc_ptr \fP\fImalloc_fn\fP\fB, png_free_ptr \fIfree_fn\fP\fB);\fP - -\fBpng_structp png_create_write_struct (png_const_charp \fP\fIuser_png_ver\fP\fB, png_voidp \fP\fIerror_ptr\fP\fB, png_error_ptr \fP\fIerror_fn\fP\fB, png_error_ptr \fIwarn_fn\fP\fB);\fP - -\fBpng_structp png_create_write_struct_2(png_const_charp \fP\fIuser_png_ver\fP\fB, png_voidp \fP\fIerror_ptr\fP\fB, png_error_ptr \fP\fIerror_fn\fP\fB, png_error_ptr \fP\fIwarn_fn\fP\fB, png_voidp \fP\fImem_ptr\fP\fB, png_malloc_ptr \fP\fImalloc_fn\fP\fB, png_free_ptr \fIfree_fn\fP\fB);\fP - -\fBint png_debug(int \fP\fIlevel\fP\fB, png_const_charp \fImessage\fP\fB);\fP - -\fBint png_debug1(int \fP\fIlevel\fP\fB, png_const_charp \fP\fImessage\fP\fB, \fIp1\fP\fB);\fP - -\fBint png_debug2(int \fP\fIlevel\fP\fB, png_const_charp \fP\fImessage\fP\fB, \fP\fIp1\fP\fB, \fIp2\fP\fB);\fP - -\fBvoid png_destroy_info_struct (png_structp \fP\fIpng_ptr\fP\fB, png_infopp \fIinfo_ptr_ptr\fP\fB);\fP - -\fBvoid png_destroy_read_struct (png_structpp \fP\fIpng_ptr_ptr\fP\fB, png_infopp \fP\fIinfo_ptr_ptr\fP\fB, png_infopp \fIend_info_ptr_ptr\fP\fB);\fP - -\fBvoid png_destroy_write_struct (png_structpp \fP\fIpng_ptr_ptr\fP\fB, png_infopp \fIinfo_ptr_ptr\fP\fB);\fP - -\fBvoid png_error (png_structp \fP\fIpng_ptr\fP\fB, png_const_charp \fIerror\fP\fB);\fP - -\fBvoid png_free (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fIptr\fP\fB);\fP - -\fBvoid png_free_chunk_list (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_free_default(png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fIptr\fP\fB);\fP - -\fBvoid png_free_data (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, int \fInum\fP\fB);\fP - -\fBpng_byte png_get_bit_depth (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBpng_uint_32 png_get_bKGD (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_color_16p \fI*background\fP\fB);\fP - -\fBpng_byte png_get_channels (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBpng_uint_32 png_get_cHRM (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, double \fP\fI*white_x\fP\fB, double \fP\fI*white_y\fP\fB, double \fP\fI*red_x\fP\fB, double \fP\fI*red_y\fP\fB, double \fP\fI*green_x\fP\fB, double \fP\fI*green_y\fP\fB, double \fP\fI*blue_x\fP\fB, double \fI*blue_y\fP\fB);\fP - -\fBpng_uint_32 png_get_cHRM_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fI*white_x\fP\fB, png_uint_32 \fP\fI*white_y\fP\fB, png_uint_32 \fP\fI*red_x\fP\fB, png_uint_32 \fP\fI*red_y\fP\fB, png_uint_32 \fP\fI*green_x\fP\fB, png_uint_32 \fP\fI*green_y\fP\fB, png_uint_32 \fP\fI*blue_x\fP\fB, png_uint_32 \fI*blue_y\fP\fB);\fP - -\fBpng_byte png_get_color_type (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBpng_byte png_get_compression_type (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBpng_byte png_get_copyright (png_structp \fIpng_ptr\fP\fB);\fP - -\fBpng_voidp png_get_error_ptr (png_structp \fIpng_ptr\fP\fB);\fP - -\fBpng_byte png_get_filter_type (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBpng_uint_32 png_get_gAMA (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, double \fI*file_gamma\fP\fB);\fP - -\fBpng_uint_32 png_get_gAMA_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fI*int_file_gamma\fP\fB);\fP - -\fBpng_byte png_get_header_ver (png_structp \fIpng_ptr\fP\fB);\fP - -\fBpng_byte png_get_header_version (png_structp \fIpng_ptr\fP\fB);\fP - -\fBpng_uint_32 png_get_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_16p \fI*hist\fP\fB);\fP - -\fBpng_uint_32 png_get_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_charpp \fP\fIname\fP\fB, int \fP\fI*compression_type\fP\fB, png_charpp \fP\fIprofile\fP\fB, png_uint_32 \fI*proflen\fP\fB);\fP - -\fBpng_uint_32 png_get_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fI*width\fP\fB, png_uint_32 \fP\fI*height\fP\fB, int \fP\fI*bit_depth\fP\fB, int \fP\fI*color_type\fP\fB, int \fP\fI*interlace_type\fP\fB, int \fP\fI*compression_type\fP\fB, int \fI*filter_type\fP\fB);\fP - -\fBpng_uint_32 png_get_image_height (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBpng_uint_32 png_get_image_width (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fB#if !defined(PNG_1_0_X) png_int_32 png_get_int_32 (png_bytep buf); \fI#endif - -\fBpng_byte png_get_interlace_type (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBpng_voidp png_get_io_ptr (png_structp \fIpng_ptr\fP\fB);\fP - -\fBpng_byte png_get_libpng_ver (png_structp \fIpng_ptr\fP\fB);\fP - -\fBpng_voidp png_get_mem_ptr(png_structp \fIpng_ptr\fP\fB);\fP - -\fBpng_uint_32 png_get_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fI*offset_x\fP\fB, png_uint_32 \fP\fI*offset_y\fP\fB, int \fI*unit_type\fP\fB);\fP - -\fBpng_uint_32 png_get_pCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_charp \fP\fI*purpose\fP\fB, png_int_32 \fP\fI*X0\fP\fB, png_int_32 \fP\fI*X1\fP\fB, int \fP\fI*type\fP\fB, int \fP\fI*nparams\fP\fB, png_charp \fP\fI*units\fP\fB, png_charpp \fI*params\fP\fB);\fP - -\fBpng_uint_32 png_get_pHYs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fI*res_x\fP\fB, png_uint_32 \fP\fI*res_y\fP\fB, int \fI*unit_type\fP\fB);\fP - -\fBfloat png_get_pixel_aspect_ratio (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBpng_uint_32 png_get_pixels_per_meter (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBpng_voidp png_get_progressive_ptr (png_structp \fIpng_ptr\fP\fB);\fP - -\fBpng_uint_32 png_get_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_colorp \fP\fI*palette\fP\fB, int \fI*num_palette\fP\fB);\fP - -\fBpng_byte png_get_rgb_to_gray_status (png_structp png_ptr) png_uint_32 png_get_rowbytes (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBpng_bytepp png_get_rows (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBpng_uint_32 png_get_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_color_8p \fI*sig_bit\fP\fB);\fP - -\fBpng_bytep png_get_signature (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBpng_uint_32 png_get_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_spalette_p \fI*splt_ptr\fP\fB);\fP - -\fBpng_uint_32 png_get_sRGB (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, int \fI*intent\fP\fB);\fP - -\fBpng_uint_32 png_get_text (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_textp \fP\fI*text_ptr\fP\fB, int \fI*num_text\fP\fB);\fP - -\fBpng_uint_32 png_get_tIME (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_timep \fI*mod_time\fP\fB);\fP - -\fBpng_uint_32 png_get_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fP\fI*trans\fP\fB, int \fP\fI*num_trans\fP\fB, png_color_16p \fI*trans_values\fP\fB);\fP - -\fB#if !defined(PNG_1_0_X) png_uint_16 png_get_uint_16 (png_bytep \fIbuf\fP\fB);\fP - -\fBpng_uint_32 png_get_uint_31 (png_bytep \fIbuf\fP\fB);\fP - -\fBpng_uint_32 png_get_uint_32 (png_bytep buf); \fI#endif - -\fBpng_uint_32 png_get_unknown_chunks (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_unknown_chunkpp \fIunknowns\fP\fB);\fP - -\fBpng_voidp png_get_user_chunk_ptr (png_structp \fIpng_ptr\fP\fB);\fP - -\fBpng_uint_32 png_get_user_height_max( png_structp \fIpng_ptr\fP\fB);\fP - -\fBpng_voidp png_get_user_transform_ptr (png_structp \fIpng_ptr\fP\fB);\fP - -\fBpng_uint_32 png_get_user_width_max (png_structp \fIpng_ptr\fP\fB);\fP - -\fBpng_uint_32 png_get_valid (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIflag\fP\fB);\fP - -\fBpng_int_32 png_get_x_offset_microns (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBpng_int_32 png_get_x_offset_pixels (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBpng_uint_32 png_get_x_pixels_per_meter (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBpng_int_32 png_get_y_offset_microns (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBpng_int_32 png_get_y_offset_pixels (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBpng_uint_32 png_get_y_pixels_per_meter (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBpng_uint_32 png_get_compression_buffer_size (png_structp \fIpng_ptr\fP\fB);\fP - -\fBint png_handle_as_unknown (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIchunk_name\fP\fB);\fP - -\fBvoid png_init_io (png_structp \fP\fIpng_ptr\fP\fB, FILE \fI*fp\fP\fB);\fP - -\fBDEPRECATED: void png_info_init (png_infop \fIinfo_ptr\fP\fB);\fP - -\fBDEPRECATED: void png_info_init_2 (png_infopp \fP\fIptr_ptr\fP\fB, png_size_t \fIpng_info_struct_size\fP\fB);\fP - -\fBpng_voidp png_malloc (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIsize\fP\fB);\fP - -\fBpng_voidp png_malloc_default(png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIsize\fP\fB);\fP - -\fBvoidp png_memcpy (png_voidp \fP\fIs1\fP\fB, png_voidp \fP\fIs2\fP\fB, png_size_t \fIsize\fP\fB);\fP - -\fBpng_voidp png_memcpy_check (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIs1\fP\fB, png_voidp \fP\fIs2\fP\fB, png_uint_32 \fIsize\fP\fB);\fP - -\fBvoidp png_memset (png_voidp \fP\fIs1\fP\fB, int \fP\fIvalue\fP\fB, png_size_t \fIsize\fP\fB);\fP - -\fBpng_voidp png_memset_check (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIs1\fP\fB, int \fP\fIvalue\fP\fB, png_uint_32 \fIsize\fP\fB);\fP - -\fBDEPRECATED: void png_permit_empty_plte (png_structp \fP\fIpng_ptr\fP\fB, int \fIempty_plte_permitted\fP\fB);\fP - -\fBvoid png_process_data (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_size\fP\fB);\fP - -\fBvoid png_progressive_combine_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIold_row\fP\fB, png_bytep \fInew_row\fP\fB);\fP - -\fBvoid png_read_destroy (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_infop \fIend_info_ptr\fP\fB);\fP - -\fBvoid png_read_end (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBvoid png_read_image (png_structp \fP\fIpng_ptr\fP\fB, png_bytepp \fIimage\fP\fB);\fP - -\fBDEPRECATED: void png_read_init (png_structp \fIpng_ptr\fP\fB);\fP - -\fBDEPRECATED: void png_read_init_2 (png_structpp \fP\fIptr_ptr\fP\fB, png_const_charp \fP\fIuser_png_ver\fP\fB, png_size_t \fP\fIpng_struct_size\fP\fB, png_size_t \fIpng_info_size\fP\fB);\fP - -\fBvoid png_read_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBvoid png_read_png (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, int \fP\fItransforms\fP\fB, png_voidp \fIparams\fP\fB);\fP - -\fBvoid png_read_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fIdisplay_row\fP\fB);\fP - -\fBvoid png_read_rows (png_structp \fP\fIpng_ptr\fP\fB, png_bytepp \fP\fIrow\fP\fB, png_bytepp \fP\fIdisplay_row\fP\fB, png_uint_32 \fInum_rows\fP\fB);\fP - -\fBvoid png_read_update_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fB#if !defined(PNG_1_0_X) png_save_int_32 (png_bytep \fP\fIbuf\fP\fB, png_int_32 \fIi\fP\fB);\fP - -\fBvoid png_save_uint_16 (png_bytep \fP\fIbuf\fP\fB, unsigned int \fIi\fP\fB);\fP - -\fBvoid png_save_uint_32 (png_bytep \fP\fIbuf\fP\fB, png_uint_32 \fIi\fP\fB);\fP - -\fBvoid png_set_add_alpha (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIfiller\fP\fB, int flags); \fI#endif - -\fBvoid png_set_background (png_structp \fP\fIpng_ptr\fP\fB, png_color_16p \fP\fIbackground_color\fP\fB, int \fP\fIbackground_gamma_code\fP\fB, int \fP\fIneed_expand\fP\fB, double \fIbackground_gamma\fP\fB);\fP - -\fBvoid png_set_bgr (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_set_bKGD (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_color_16p \fIbackground\fP\fB);\fP - -\fBvoid png_set_cHRM (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, double \fP\fIwhite_x\fP\fB, double \fP\fIwhite_y\fP\fB, double \fP\fIred_x\fP\fB, double \fP\fIred_y\fP\fB, double \fP\fIgreen_x\fP\fB, double \fP\fIgreen_y\fP\fB, double \fP\fIblue_x\fP\fB, double \fIblue_y\fP\fB);\fP - -\fBvoid png_set_cHRM_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fIwhite_x\fP\fB, png_uint_32 \fP\fIwhite_y\fP\fB, png_uint_32 \fP\fIred_x\fP\fB, png_uint_32 \fP\fIred_y\fP\fB, png_uint_32 \fP\fIgreen_x\fP\fB, png_uint_32 \fP\fIgreen_y\fP\fB, png_uint_32 \fP\fIblue_x\fP\fB, png_uint_32 \fIblue_y\fP\fB);\fP - -\fBvoid png_set_compression_level (png_structp \fP\fIpng_ptr\fP\fB, int \fIlevel\fP\fB);\fP - -\fBvoid png_set_compression_mem_level (png_structp \fP\fIpng_ptr\fP\fB, int \fImem_level\fP\fB);\fP - -\fBvoid png_set_compression_method (png_structp \fP\fIpng_ptr\fP\fB, int \fImethod\fP\fB);\fP - -\fBvoid png_set_compression_strategy (png_structp \fP\fIpng_ptr\fP\fB, int \fIstrategy\fP\fB);\fP - -\fBvoid png_set_compression_window_bits (png_structp \fP\fIpng_ptr\fP\fB, int \fIwindow_bits\fP\fB);\fP - -\fBvoid png_set_crc_action (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcrit_action\fP\fB, int \fIancil_action\fP\fB);\fP - -\fBvoid png_set_dither (png_structp \fP\fIpng_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, int \fP\fInum_palette\fP\fB, int \fP\fImaximum_colors\fP\fB, png_uint_16p \fP\fIhistogram\fP\fB, int \fIfull_dither\fP\fB);\fP - -\fBvoid png_set_error_fn (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIerror_ptr\fP\fB, png_error_ptr \fP\fIerror_fn\fP\fB, png_error_ptr \fIwarning_fn\fP\fB);\fP - -\fBvoid png_set_expand (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_set_expand_gray_1_2_4_to_8(png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_set_filler (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIfiller\fP\fB, int \fIflags\fP\fB);\fP - -\fBvoid png_set_filter (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fImethod\fP\fB, int \fIfilters\fP\fB);\fP - -\fBvoid png_set_filter_heuristics (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIheuristic_method\fP\fB, int \fP\fInum_weights\fP\fB, png_doublep \fP\fIfilter_weights\fP\fB, png_doublep \fIfilter_costs\fP\fB);\fP - -\fBvoid png_set_flush (png_structp \fP\fIpng_ptr\fP\fB, int \fInrows\fP\fB);\fP - -\fBvoid png_set_gamma (png_structp \fP\fIpng_ptr\fP\fB, double \fP\fIscreen_gamma\fP\fB, double \fIdefault_file_gamma\fP\fB);\fP - -\fBvoid png_set_gAMA (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, double \fIfile_gamma\fP\fB);\fP - -\fBvoid png_set_gAMA_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIfile_gamma\fP\fB);\fP - -\fBvoid png_set_gray_1_2_4_to_8(png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_set_gray_to_rgb (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_set_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_16p \fIhist\fP\fB);\fP - -\fBvoid png_set_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_charp \fP\fIname\fP\fB, int \fP\fIcompression_type\fP\fB, png_charp \fP\fIprofile\fP\fB, png_uint_32 \fIproflen\fP\fB);\fP - -\fBint png_set_interlace_handling (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_set_invalid (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, int \fImask\fP\fB);\fP - -\fBvoid png_set_invert_alpha (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_set_invert_mono (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_set_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fIwidth\fP\fB, png_uint_32 \fP\fIheight\fP\fB, int \fP\fIbit_depth\fP\fB, int \fP\fIcolor_type\fP\fB, int \fP\fIinterlace_type\fP\fB, int \fP\fIcompression_type\fP\fB, int \fIfilter_type\fP\fB);\fP - -\fBvoid png_set_keep_unknown_chunks (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIkeep\fP\fB, png_bytep \fP\fIchunk_list\fP\fB, int \fInum_chunks\fP\fB);\fP - -\fBvoid png_set_mem_fn(png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fImem_ptr\fP\fB, png_malloc_ptr \fP\fImalloc_fn\fP\fB, png_free_ptr \fIfree_fn\fP\fB);\fP - -\fBvoid png_set_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fIoffset_x\fP\fB, png_uint_32 \fP\fIoffset_y\fP\fB, int \fIunit_type\fP\fB);\fP - -\fBvoid png_set_packing (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_set_packswap (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_set_palette_to_rgb(png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_set_pCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_charp \fP\fIpurpose\fP\fB, png_int_32 \fP\fIX0\fP\fB, png_int_32 \fP\fIX1\fP\fB, int \fP\fItype\fP\fB, int \fP\fInparams\fP\fB, png_charp \fP\fIunits\fP\fB, png_charpp \fIparams\fP\fB);\fP - -\fBvoid png_set_pHYs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fP\fIres_x\fP\fB, png_uint_32 \fP\fIres_y\fP\fB, int \fIunit_type\fP\fB);\fP - -\fBvoid png_set_progressive_read_fn (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIprogressive_ptr\fP\fB, png_progressive_info_ptr \fP\fIinfo_fn\fP\fB, png_progressive_row_ptr \fP\fIrow_fn\fP\fB, png_progressive_end_ptr \fIend_fn\fP\fB);\fP - -\fBvoid png_set_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, int \fInum_palette\fP\fB);\fP - -\fBvoid png_set_read_fn (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIio_ptr\fP\fB, png_rw_ptr \fIread_data_fn\fP\fB);\fP - -\fBvoid png_set_read_status_fn (png_structp \fP\fIpng_ptr\fP\fB, png_read_status_ptr \fIread_row_fn\fP\fB);\fP - -\fBvoid png_set_read_user_transform_fn (png_structp \fP\fIpng_ptr\fP\fB, png_user_transform_ptr \fIread_user_transform_fn\fP\fB);\fP - -\fBvoid png_set_rgb_to_gray (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIerror_action\fP\fB, double \fP\fIred\fP\fB, double \fIgreen\fP\fB);\fP - -\fBvoid png_set_rgb_to_gray_fixed (png_structp \fP\fIpng_ptr\fP\fB, int error_action png_fixed_point \fP\fIred\fP\fB, png_fixed_point \fIgreen\fP\fB);\fP - -\fBvoid png_set_rows (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytepp \fIrow_pointers\fP\fB);\fP - -\fBvoid png_set_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_color_8p \fIsig_bit\fP\fB);\fP - -\fBvoid png_set_sCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_charp \fP\fIunit\fP\fB, double \fP\fIwidth\fP\fB, double \fIheight\fP\fB);\fP - -\fBvoid png_set_shift (png_structp \fP\fIpng_ptr\fP\fB, png_color_8p \fItrue_bits\fP\fB);\fP - -\fBvoid png_set_sig_bytes (png_structp \fP\fIpng_ptr\fP\fB, int \fInum_bytes\fP\fB);\fP - -\fBvoid png_set_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_spalette_p \fP\fIsplt_ptr\fP\fB, int \fInum_spalettes\fP\fB);\fP - -\fBvoid png_set_sRGB (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, int \fIintent\fP\fB);\fP - -\fBvoid png_set_sRGB_gAMA_and_cHRM (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, int \fIintent\fP\fB);\fP - -\fBvoid png_set_strip_16 (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_set_strip_alpha (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_set_swap (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_set_swap_alpha (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_set_text (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_textp \fP\fItext_ptr\fP\fB, int \fInum_text\fP\fB);\fP - -\fBvoid png_set_tIME (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_timep \fImod_time\fP\fB);\fP - -\fBvoid png_set_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fP\fItrans\fP\fB, int \fP\fInum_trans\fP\fB, png_color_16p \fItrans_values\fP\fB);\fP - -\fBvoid png_set_tRNS_to_alpha(png_structp \fIpng_ptr\fP\fB);\fP - -\fBpng_uint_32 png_set_unknown_chunks (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_unknown_chunkp \fP\fIunknowns\fP\fB, int \fP\fInum\fP\fB, int \fIlocation\fP\fB);\fP - -\fBvoid png_set_unknown_chunk_location(png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, int \fP\fIchunk\fP\fB, int \fIlocation\fP\fB);\fP - -\fBvoid png_set_read_user_chunk_fn (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIuser_chunk_ptr\fP\fB, png_user_chunk_ptr \fIread_user_chunk_fn\fP\fB);\fP - -\fBvoid png_set_user_limits (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIuser_width_max\fP\fB, png_uint_32 \fIuser_height_max\fP\fB);\fP - -\fBvoid png_set_user_transform_info (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIuser_transform_ptr\fP\fB, int \fP\fIuser_transform_depth\fP\fB, int \fIuser_transform_channels\fP\fB);\fP - -\fBvoid png_set_write_fn (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIio_ptr\fP\fB, png_rw_ptr \fP\fIwrite_data_fn\fP\fB, png_flush_ptr \fIoutput_flush_fn\fP\fB);\fP - -\fBvoid png_set_write_status_fn (png_structp \fP\fIpng_ptr\fP\fB, png_write_status_ptr \fIwrite_row_fn\fP\fB);\fP - -\fBvoid png_set_write_user_transform_fn (png_structp \fP\fIpng_ptr\fP\fB, png_user_transform_ptr \fIwrite_user_transform_fn\fP\fB);\fP - -\fBvoid png_set_compression_buffer_size(png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIsize\fP\fB);\fP - -\fBint png_sig_cmp (png_bytep \fP\fIsig\fP\fB, png_size_t \fP\fIstart\fP\fB, png_size_t \fInum_to_check\fP\fB);\fP - -\fBvoid png_start_read_image (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_warning (png_structp \fP\fIpng_ptr\fP\fB, png_const_charp \fImessage\fP\fB);\fP - -\fBvoid png_write_chunk (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIchunk_name\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP - -\fBvoid png_write_chunk_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP - -\fBvoid png_write_chunk_end (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_write_chunk_start (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIchunk_name\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_write_destroy (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_write_end (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBvoid png_write_flush (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_write_image (png_structp \fP\fIpng_ptr\fP\fB, png_bytepp \fIimage\fP\fB);\fP - -\fBDEPRECATED: void png_write_init (png_structp \fIpng_ptr\fP\fB);\fP - -\fBDEPRECATED: void png_write_init_2 (png_structpp \fP\fIptr_ptr\fP\fB, png_const_charp \fP\fIuser_png_ver\fP\fB, png_size_t \fP\fIpng_struct_size\fP\fB, png_size_t \fIpng_info_size\fP\fB);\fP - -\fBvoid png_write_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBvoid png_write_info_before_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBvoid png_write_png (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, int \fP\fItransforms\fP\fB, png_voidp \fIparams\fP\fB);\fP - -\fBvoid png_write_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIrow\fP\fB);\fP - -\fBvoid png_write_rows (png_structp \fP\fIpng_ptr\fP\fB, png_bytepp \fP\fIrow\fP\fB, png_uint_32 \fInum_rows\fP\fB);\fP - -\fBvoidpf png_zalloc (voidpf \fP\fIpng_ptr\fP\fB, uInt \fP\fIitems\fP\fB, uInt \fIsize\fP\fB);\fP - -\fBvoid png_zfree (voidpf \fP\fIpng_ptr\fP\fB, voidpf \fIptr\fP\fB);\fP - -.SH DESCRIPTION -The -.I libpng -library supports encoding, decoding, and various manipulations of -the Portable Network Graphics (PNG) format image files. It uses the -.IR zlib(3) -compression library. -Following is a copy of the libpng.txt file that accompanies libpng. -.SH LIBPNG.TXT -libpng.txt - A description on how to use and modify libpng - - libpng version 1.2.18 - May 15, 2007 - Updated and distributed by Glenn Randers-Pehrson - - Copyright (c) 1998-2007 Glenn Randers-Pehrson - For conditions of distribution and use, see copyright - notice in png.h. - - based on: - - libpng 1.0 beta 6 version 0.96 May 28, 1997 - Updated and distributed by Andreas Dilger - Copyright (c) 1996, 1997 Andreas Dilger - - libpng 1.0 beta 2 - version 0.88 January 26, 1996 - For conditions of distribution and use, see copyright - notice in png.h. Copyright (c) 1995, 1996 Guy Eric - Schalnat, Group 42, Inc. - - Updated/rewritten per request in the libpng FAQ - Copyright (c) 1995, 1996 Frank J. T. Wojcik - December 18, 1995 & January 20, 1996 - -.SH I. Introduction - -This file describes how to use and modify the PNG reference library -(known as libpng) for your own use. There are five sections to this -file: introduction, structures, reading, writing, and modification and -configuration notes for various special platforms. In addition to this -file, example.c is a good starting point for using the library, as -it is heavily commented and should include everything most people -will need. We assume that libpng is already installed; see the -INSTALL file for instructions on how to install libpng. - -For examples of libpng usage, see the files "example.c", "pngtest.c", -and the files in the "contrib" directory, all of which are included in the -libpng distribution. - -Libpng was written as a companion to the PNG specification, as a way -of reducing the amount of time and effort it takes to support the PNG -file format in application programs. - -The PNG specification (second edition), November 2003, is available as -a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2003 (E)) at - - -The PNG-1.0 specification is available -as RFC 2083 and as a -W3C Recommendation . Some -additional chunks are described in the special-purpose public chunks -documents at . - -Other information -about PNG, and the latest version of libpng, can be found at the PNG home -page, . - -Most users will not have to modify the library significantly; advanced -users may want to modify it more. All attempts were made to make it as -complete as possible, while keeping the code easy to understand. -Currently, this library only supports C. Support for other languages -is being considered. - -Libpng has been designed to handle multiple sessions at one time, -to be easily modifiable, to be portable to the vast majority of -machines (ANSI, K&R, 16-, 32-, and 64-bit) available, and to be easy -to use. The ultimate goal of libpng is to promote the acceptance of -the PNG file format in whatever way possible. While there is still -work to be done (see the TODO file), libpng should cover the -majority of the needs of its users. - -Libpng uses zlib for its compression and decompression of PNG files. -Further information about zlib, and the latest version of zlib, can -be found at the zlib home page, . -The zlib compression utility is a general purpose utility that is -useful for more than PNG files, and can be used without libpng. -See the documentation delivered with zlib for more details. -You can usually find the source files for the zlib utility wherever you -find the libpng source files. - -Libpng is thread safe, provided the threads are using different -instances of the structures. Each thread should have its own -png_struct and png_info instances, and thus its own image. -Libpng does not protect itself against two threads using the -same instance of a structure. Note: thread safety may be defeated -by use of some of the MMX assembler code in pnggccrd.c, which is only -compiled when the user defines PNG_THREAD_UNSAFE_OK. - -.SH II. Structures - -There are two main structures that are important to libpng, png_struct -and png_info. The first, png_struct, is an internal structure that -will not, for the most part, be used by a user except as the first -variable passed to every libpng function call. - -The png_info structure is designed to provide information about the -PNG file. At one time, the fields of png_info were intended to be -directly accessible to the user. However, this tended to cause problems -with applications using dynamically loaded libraries, and as a result -a set of interface functions for png_info (the png_get_*() and png_set_*() -functions) was developed. The fields of png_info are still available for -older applications, but it is suggested that applications use the new -interfaces if at all possible. - -Applications that do make direct access to the members of png_struct (except -for png_ptr->jmpbuf) must be recompiled whenever the library is updated, -and applications that make direct access to the members of png_info must -be recompiled if they were compiled or loaded with libpng version 1.0.6, -in which the members were in a different order. In version 1.0.7, the -members of the png_info structure reverted to the old order, as they were -in versions 0.97c through 1.0.5. Starting with version 2.0.0, both -structures are going to be hidden, and the contents of the structures will -only be accessible through the png_get/png_set functions. - -The png.h header file is an invaluable reference for programming with libpng. -And while I'm on the topic, make sure you include the libpng header file: - -#include - -.SH III. Reading - -We'll now walk you through the possible functions to call when reading -in a PNG file sequentially, briefly explaining the syntax and purpose -of each one. See example.c and png.h for more detail. While -progressive reading is covered in the next section, you will still -need some of the functions discussed in this section to read a PNG -file. - -.SS Setup - -You will want to do the I/O initialization(*) before you get into libpng, -so if it doesn't work, you don't have much to undo. Of course, you -will also want to insure that you are, in fact, dealing with a PNG -file. Libpng provides a simple check to see if a file is a PNG file. -To use it, pass in the first 1 to 8 bytes of the file to the function -png_sig_cmp(), and it will return 0 if the bytes match the corresponding -bytes of the PNG signature, or nonzero otherwise. Of course, the more bytes -you pass in, the greater the accuracy of the prediction. - -If you are intending to keep the file pointer open for use in libpng, -you must ensure you don't read more than 8 bytes from the beginning -of the file, and you also have to make a call to png_set_sig_bytes_read() -with the number of bytes you read from the beginning. Libpng will -then only check the bytes (if any) that your program didn't read. - -(*): If you are not using the standard I/O functions, you will need -to replace them with custom functions. See the discussion under -Customizing libpng. - - - FILE *fp = fopen(file_name, "rb"); - if (!fp) - { - return (ERROR); - } - fread(header, 1, number, fp); - is_png = !png_sig_cmp(header, 0, number); - if (!is_png) - { - return (NOT_PNG); - } - - -Next, png_struct and png_info need to be allocated and initialized. In -order to ensure that the size of these structures is correct even with a -dynamically linked libpng, there are functions to initialize and -allocate the structures. We also pass the library version, optional -pointers to error handling functions, and a pointer to a data struct for -use by the error functions, if necessary (the pointer and functions can -be NULL if the default error handlers are to be used). See the section -on Changes to Libpng below regarding the old initialization functions. -The structure allocation functions quietly return NULL if they fail to -create the structure, so your application should check for that. - - png_structp png_ptr = png_create_read_struct - (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr, - user_error_fn, user_warning_fn); - if (!png_ptr) - return (ERROR); - - png_infop info_ptr = png_create_info_struct(png_ptr); - if (!info_ptr) - { - png_destroy_read_struct(&png_ptr, - (png_infopp)NULL, (png_infopp)NULL); - return (ERROR); - } - - png_infop end_info = png_create_info_struct(png_ptr); - if (!end_info) - { - png_destroy_read_struct(&png_ptr, &info_ptr, - (png_infopp)NULL); - return (ERROR); - } - -If you want to use your own memory allocation routines, -define PNG_USER_MEM_SUPPORTED and use -png_create_read_struct_2() instead of png_create_read_struct(): - - png_structp png_ptr = png_create_read_struct_2 - (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr, - user_error_fn, user_warning_fn, (png_voidp) - user_mem_ptr, user_malloc_fn, user_free_fn); - -The error handling routines passed to png_create_read_struct() -and the memory alloc/free routines passed to png_create_struct_2() -are only necessary if you are not using the libpng supplied error -handling and memory alloc/free functions. - -When libpng encounters an error, it expects to longjmp back -to your routine. Therefore, you will need to call setjmp and pass -your png_jmpbuf(png_ptr). If you read the file from different -routines, you will need to update the jmpbuf field every time you enter -a new routine that will call a png_*() function. - -See your documentation of setjmp/longjmp for your compiler for more -information on setjmp/longjmp. See the discussion on libpng error -handling in the Customizing Libpng section below for more information -on the libpng error handling. If an error occurs, and libpng longjmp's -back to your setjmp, you will want to call png_destroy_read_struct() to -free any memory. - - if (setjmp(png_jmpbuf(png_ptr))) - { - png_destroy_read_struct(&png_ptr, &info_ptr, - &end_info); - fclose(fp); - return (ERROR); - } - -If you would rather avoid the complexity of setjmp/longjmp issues, -you can compile libpng with PNG_SETJMP_NOT_SUPPORTED, in which case -errors will result in a call to PNG_ABORT() which defaults to abort(). - -Now you need to set up the input code. The default for libpng is to -use the C function fread(). If you use this, you will need to pass a -valid FILE * in the function png_init_io(). Be sure that the file is -opened in binary mode. If you wish to handle reading data in another -way, you need not call the png_init_io() function, but you must then -implement the libpng I/O methods discussed in the Customizing Libpng -section below. - - png_init_io(png_ptr, fp); - -If you had previously opened the file and read any of the signature from -the beginning in order to see if this was a PNG file, you need to let -libpng know that there are some bytes missing from the start of the file. - - png_set_sig_bytes(png_ptr, number); - -.SS Setting up callback code - -You can set up a callback function to handle any unknown chunks in the -input stream. You must supply the function - - read_chunk_callback(png_ptr ptr, - png_unknown_chunkp chunk); - { - /* The unknown chunk structure contains your - chunk data: */ - png_byte name[5]; - png_byte *data; - png_size_t size; - /* Note that libpng has already taken care of - the CRC handling */ - - /* put your code here. Return one of the - following: */ - - return (-n); /* chunk had an error */ - return (0); /* did not recognize */ - return (n); /* success */ - } - -(You can give your function another name that you like instead of -"read_chunk_callback") - -To inform libpng about your function, use - - png_set_read_user_chunk_fn(png_ptr, user_chunk_ptr, - read_chunk_callback); - -This names not only the callback function, but also a user pointer that -you can retrieve with - - png_get_user_chunk_ptr(png_ptr); - -At this point, you can set up a callback function that will be -called after each row has been read, which you can use to control -a progress meter or the like. It's demonstrated in pngtest.c. -You must supply a function - - void read_row_callback(png_ptr ptr, png_uint_32 row, - int pass); - { - /* put your code here */ - } - -(You can give it another name that you like instead of "read_row_callback") - -To inform libpng about your function, use - - png_set_read_status_fn(png_ptr, read_row_callback); - -.SS Width and height limits - -The PNG specification allows the width and height of an image to be as -large as 2^31-1 (0x7fffffff), or about 2.147 billion rows and columns. -Since very few applications really need to process such large images, -we have imposed an arbitrary 1-million limit on rows and columns. -Larger images will be rejected immediately with a png_error() call. If -you wish to override this limit, you can use - - png_set_user_limits(png_ptr, width_max, height_max); - -to set your own limits, or use width_max = height_max = 0x7fffffffL -to allow all valid dimensions (libpng may reject some very large images -anyway because of potential buffer overflow conditions). - -You should put this statement after you create the PNG structure and -before calling png_read_info(), png_read_png(), or png_process_data(). -If you need to retrieve the limits that are being applied, use - - width_max = png_get_user_width_max(png_ptr); - height_max = png_get_user_height_max(png_ptr); - -.SS Unknown-chunk handling - -Now you get to set the way the library processes unknown chunks in the -input PNG stream. Both known and unknown chunks will be read. Normal -behavior is that known chunks will be parsed into information in -various info_ptr members; unknown chunks will be discarded. To change -this, you can call: - - png_set_keep_unknown_chunks(png_ptr, keep, - chunk_list, num_chunks); - keep - 0: do not handle as unknown - 1: do not keep - 2: keep only if safe-to-copy - 3: keep even if unsafe-to-copy - You can use these definitions: - PNG_HANDLE_CHUNK_AS_DEFAULT 0 - PNG_HANDLE_CHUNK_NEVER 1 - PNG_HANDLE_CHUNK_IF_SAFE 2 - PNG_HANDLE_CHUNK_ALWAYS 3 - chunk_list - list of chunks affected (a byte string, - five bytes per chunk, NULL or '\0' if - num_chunks is 0) - num_chunks - number of chunks affected; if 0, all - unknown chunks are affected. If nonzero, - only the chunks in the list are affected - -Unknown chunks declared in this way will be saved as raw data onto a -list of png_unknown_chunk structures. If a chunk that is normally -known to libpng is named in the list, it will be handled as unknown, -according to the "keep" directive. If a chunk is named in successive -instances of png_set_keep_unknown_chunks(), the final instance will -take precedence. The IHDR and IEND chunks should not be named in -chunk_list; if they are, libpng will process them normally anyway. - -.SS The high-level read interface - -At this point there are two ways to proceed; through the high-level -read interface, or through a sequence of low-level read operations. -You can use the high-level interface if (a) you are willing to read -the entire image into memory, and (b) the input transformations -you want to do are limited to the following set: - - PNG_TRANSFORM_IDENTITY No transformation - PNG_TRANSFORM_STRIP_16 Strip 16-bit samples to - 8 bits - PNG_TRANSFORM_STRIP_ALPHA Discard the alpha channel - PNG_TRANSFORM_PACKING Expand 1, 2 and 4-bit - samples to bytes - PNG_TRANSFORM_PACKSWAP Change order of packed - pixels to LSB first - PNG_TRANSFORM_EXPAND Perform set_expand() - PNG_TRANSFORM_INVERT_MONO Invert monochrome images - PNG_TRANSFORM_SHIFT Normalize pixels to the - sBIT depth - PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA - to BGRA - PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA - to AG - PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity - to transparency - PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples - -(This excludes setting a background color, doing gamma transformation, -dithering, and setting filler.) If this is the case, simply do this: - - png_read_png(png_ptr, info_ptr, png_transforms, NULL) - -where png_transforms is an integer containing the bitwise OR of -some set of transformation flags. This call is equivalent to png_read_info(), -followed the set of transformations indicated by the transform mask, -then png_read_image(), and finally png_read_end(). - -(The final parameter of this call is not yet used. Someday it might point -to transformation parameters required by some future input transform.) - -You must use png_transforms and not call any png_set_transform() functions -when you use png_read_png(). - -After you have called png_read_png(), you can retrieve the image data -with - - row_pointers = png_get_rows(png_ptr, info_ptr); - -where row_pointers is an array of pointers to the pixel data for each row: - - png_bytep row_pointers[height]; - -If you know your image size and pixel size ahead of time, you can allocate -row_pointers prior to calling png_read_png() with - - if (height > PNG_UINT_32_MAX/png_sizeof(png_byte)) - png_error (png_ptr, - "Image is too tall to process in memory"); - if (width > PNG_UINT_32_MAX/pixel_size) - png_error (png_ptr, - "Image is too wide to process in memory"); - row_pointers = png_malloc(png_ptr, - height*png_sizeof(png_bytep)); - for (int i=0; i) and -png_get_(png_ptr, info_ptr, ...) functions return non-zero if the -data has been read, or zero if it is missing. The parameters to the -png_get_ are set directly if they are simple data types, or a pointer -into the info_ptr is returned for any complex types. - - png_get_PLTE(png_ptr, info_ptr, &palette, - &num_palette); - palette - the palette for the file - (array of png_color) - num_palette - number of entries in the palette - - png_get_gAMA(png_ptr, info_ptr, &gamma); - gamma - the gamma the file is written - at (PNG_INFO_gAMA) - - png_get_sRGB(png_ptr, info_ptr, &srgb_intent); - srgb_intent - the rendering intent (PNG_INFO_sRGB) - The presence of the sRGB chunk - means that the pixel data is in the - sRGB color space. This chunk also - implies specific values of gAMA and - cHRM. - - png_get_iCCP(png_ptr, info_ptr, &name, - &compression_type, &profile, &proflen); - name - The profile name. - compression - The compression type; always - PNG_COMPRESSION_TYPE_BASE for PNG 1.0. - You may give NULL to this argument to - ignore it. - profile - International Color Consortium color - profile data. May contain NULs. - proflen - length of profile data in bytes. - - png_get_sBIT(png_ptr, info_ptr, &sig_bit); - sig_bit - the number of significant bits for - (PNG_INFO_sBIT) each of the gray, - red, green, and blue channels, - whichever are appropriate for the - given color type (png_color_16) - - png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, - &trans_values); - trans - array of transparent entries for - palette (PNG_INFO_tRNS) - trans_values - graylevel or color sample values of - the single transparent color for - non-paletted images (PNG_INFO_tRNS) - num_trans - number of transparent entries - (PNG_INFO_tRNS) - - png_get_hIST(png_ptr, info_ptr, &hist); - (PNG_INFO_hIST) - hist - histogram of palette (array of - png_uint_16) - - png_get_tIME(png_ptr, info_ptr, &mod_time); - mod_time - time image was last modified - (PNG_VALID_tIME) - - png_get_bKGD(png_ptr, info_ptr, &background); - background - background color (PNG_VALID_bKGD) - valid 16-bit red, green and blue - values, regardless of color_type - - num_comments = png_get_text(png_ptr, info_ptr, - &text_ptr, &num_text); - num_comments - number of comments - text_ptr - array of png_text holding image - comments - text_ptr[i].compression - type of compression used - on "text" PNG_TEXT_COMPRESSION_NONE - PNG_TEXT_COMPRESSION_zTXt - PNG_ITXT_COMPRESSION_NONE - PNG_ITXT_COMPRESSION_zTXt - text_ptr[i].key - keyword for comment. Must contain - 1-79 characters. - text_ptr[i].text - text comments for current - keyword. Can be empty. - text_ptr[i].text_length - length of text string, - after decompression, 0 for iTXt - text_ptr[i].itxt_length - length of itxt string, - after decompression, 0 for tEXt/zTXt - text_ptr[i].lang - language of comment (empty - string for unknown). - text_ptr[i].lang_key - keyword in UTF-8 - (empty string for unknown). - num_text - number of comments (same as - num_comments; you can put NULL here - to avoid the duplication) - Note while png_set_text() will accept text, language, - and translated keywords that can be NULL pointers, the - structure returned by png_get_text will always contain - regular zero-terminated C strings. They might be - empty strings but they will never be NULL pointers. - - num_spalettes = png_get_sPLT(png_ptr, info_ptr, - &palette_ptr); - palette_ptr - array of palette structures holding - contents of one or more sPLT chunks - read. - num_spalettes - number of sPLT chunks read. - - png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y, - &unit_type); - offset_x - positive offset from the left edge - of the screen - offset_y - positive offset from the top edge - of the screen - unit_type - PNG_OFFSET_PIXEL, PNG_OFFSET_MICROMETER - - png_get_pHYs(png_ptr, info_ptr, &res_x, &res_y, - &unit_type); - res_x - pixels/unit physical resolution in - x direction - res_y - pixels/unit physical resolution in - x direction - unit_type - PNG_RESOLUTION_UNKNOWN, - PNG_RESOLUTION_METER - - png_get_sCAL(png_ptr, info_ptr, &unit, &width, - &height) - unit - physical scale units (an integer) - width - width of a pixel in physical scale units - height - height of a pixel in physical scale units - (width and height are doubles) - - png_get_sCAL_s(png_ptr, info_ptr, &unit, &width, - &height) - unit - physical scale units (an integer) - width - width of a pixel in physical scale units - height - height of a pixel in physical scale units - (width and height are strings like "2.54") - - num_unknown_chunks = png_get_unknown_chunks(png_ptr, - info_ptr, &unknowns) - unknowns - array of png_unknown_chunk - structures holding unknown chunks - unknowns[i].name - name of unknown chunk - unknowns[i].data - data of unknown chunk - unknowns[i].size - size of unknown chunk's data - unknowns[i].location - position of chunk in file - - The value of "i" corresponds to the order in which the - chunks were read from the PNG file or inserted with the - png_set_unknown_chunks() function. - -The data from the pHYs chunk can be retrieved in several convenient -forms: - - res_x = png_get_x_pixels_per_meter(png_ptr, - info_ptr) - res_y = png_get_y_pixels_per_meter(png_ptr, - info_ptr) - res_x_and_y = png_get_pixels_per_meter(png_ptr, - info_ptr) - res_x = png_get_x_pixels_per_inch(png_ptr, - info_ptr) - res_y = png_get_y_pixels_per_inch(png_ptr, - info_ptr) - res_x_and_y = png_get_pixels_per_inch(png_ptr, - info_ptr) - aspect_ratio = png_get_pixel_aspect_ratio(png_ptr, - info_ptr) - - (Each of these returns 0 [signifying "unknown"] if - the data is not present or if res_x is 0; - res_x_and_y is 0 if res_x != res_y) - -The data from the oFFs chunk can be retrieved in several convenient -forms: - - x_offset = png_get_x_offset_microns(png_ptr, info_ptr); - y_offset = png_get_y_offset_microns(png_ptr, info_ptr); - x_offset = png_get_x_offset_inches(png_ptr, info_ptr); - y_offset = png_get_y_offset_inches(png_ptr, info_ptr); - - (Each of these returns 0 [signifying "unknown" if both - x and y are 0] if the data is not present or if the - chunk is present but the unit is the pixel) - -For more information, see the png_info definition in png.h and the -PNG specification for chunk contents. Be careful with trusting -rowbytes, as some of the transformations could increase the space -needed to hold a row (expand, filler, gray_to_rgb, etc.). -See png_read_update_info(), below. - -A quick word about text_ptr and num_text. PNG stores comments in -keyword/text pairs, one pair per chunk, with no limit on the number -of text chunks, and a 2^31 byte limit on their size. While there are -suggested keywords, there is no requirement to restrict the use to these -strings. It is strongly suggested that keywords and text be sensible -to humans (that's the point), so don't use abbreviations. Non-printing -symbols are not allowed. See the PNG specification for more details. -There is also no requirement to have text after the keyword. - -Keywords should be limited to 79 Latin-1 characters without leading or -trailing spaces, but non-consecutive spaces are allowed within the -keyword. It is possible to have the same keyword any number of times. -The text_ptr is an array of png_text structures, each holding a -pointer to a language string, a pointer to a keyword and a pointer to -a text string. The text string, language code, and translated -keyword may be empty or NULL pointers. The keyword/text -pairs are put into the array in the order that they are received. -However, some or all of the text chunks may be after the image, so, to -make sure you have read all the text chunks, don't mess with these -until after you read the stuff after the image. This will be -mentioned again below in the discussion that goes with png_read_end(). - -.SS Input transformations - -After you've read the header information, you can set up the library -to handle any special transformations of the image data. The various -ways to transform the data will be described in the order that they -should occur. This is important, as some of these change the color -type and/or bit depth of the data, and some others only work on -certain color types and bit depths. Even though each transformation -checks to see if it has data that it can do something with, you should -make sure to only enable a transformation if it will be valid for the -data. For example, don't swap red and blue on grayscale data. - -The colors used for the background and transparency values should be -supplied in the same format/depth as the current image data. They -are stored in the same format/depth as the image data in a bKGD or tRNS -chunk, so this is what libpng expects for this data. The colors are -transformed to keep in sync with the image data when an application -calls the png_read_update_info() routine (see below). - -Data will be decoded into the supplied row buffers packed into bytes -unless the library has been told to transform it into another format. -For example, 4 bit/pixel paletted or grayscale data will be returned -2 pixels/byte with the leftmost pixel in the high-order bits of the -byte, unless png_set_packing() is called. 8-bit RGB data will be stored -in RGB RGB RGB format unless png_set_filler() or png_set_add_alpha() -is called to insert filler bytes, either before or after each RGB triplet. -16-bit RGB data will be returned RRGGBB RRGGBB, with the most significant -byte of the color value first, unless png_set_strip_16() is called to -transform it to regular RGB RGB triplets, or png_set_filler() or -png_set_add alpha() is called to insert filler bytes, either before or -after each RRGGBB triplet. Similarly, 8-bit or 16-bit grayscale data can -be modified with -png_set_filler(), png_set_add_alpha(), or png_set_strip_16(). - -The following code transforms grayscale images of less than 8 to 8 bits, -changes paletted images to RGB, and adds a full alpha channel if there is -transparency information in a tRNS chunk. This is most useful on -grayscale images with bit depths of 2 or 4 or if there is a multiple-image -viewing application that wishes to treat all images in the same way. - - if (color_type == PNG_COLOR_TYPE_PALETTE) - png_set_palette_to_rgb(png_ptr); - - if (color_type == PNG_COLOR_TYPE_GRAY && - bit_depth < 8) png_set_expand_gray_1_2_4_to_8(png_ptr); - - if (png_get_valid(png_ptr, info_ptr, - PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr); - -These three functions are actually aliases for png_set_expand(), added -in libpng version 1.0.4, with the function names expanded to improve code -readability. In some future version they may actually do different -things. - -As of libpng version 1.2.9, png_set_expand_gray_1_2_4_to_8() was -added. It expands the sample depth without changing tRNS to alpha. -At the same time, png_set_gray_1_2_4_to_8() was deprecated, and it -will be removed from a future version. - -PNG can have files with 16 bits per channel. If you only can handle -8 bits per channel, this will strip the pixels down to 8 bit. - - if (bit_depth == 16) - png_set_strip_16(png_ptr); - -If, for some reason, you don't need the alpha channel on an image, -and you want to remove it rather than combining it with the background -(but the image author certainly had in mind that you *would* combine -it with the background, so that's what you should probably do): - - if (color_type & PNG_COLOR_MASK_ALPHA) - png_set_strip_alpha(png_ptr); - -In PNG files, the alpha channel in an image -is the level of opacity. If you need the alpha channel in an image to -be the level of transparency instead of opacity, you can invert the -alpha channel (or the tRNS chunk data) after it's read, so that 0 is -fully opaque and 255 (in 8-bit or paletted images) or 65535 (in 16-bit -images) is fully transparent, with - - png_set_invert_alpha(png_ptr); - -PNG files pack pixels of bit depths 1, 2, and 4 into bytes as small as -they can, resulting in, for example, 8 pixels per byte for 1 bit -files. This code expands to 1 pixel per byte without changing the -values of the pixels: - - if (bit_depth < 8) - png_set_packing(png_ptr); - -PNG files have possible bit depths of 1, 2, 4, 8, and 16. All pixels -stored in a PNG image have been "scaled" or "shifted" up to the next -higher possible bit depth (e.g. from 5 bits/sample in the range [0,31] to -8 bits/sample in the range [0, 255]). However, it is also possible to -convert the PNG pixel data back to the original bit depth of the image. -This call reduces the pixels back down to the original bit depth: - - png_color_8p sig_bit; - - if (png_get_sBIT(png_ptr, info_ptr, &sig_bit)) - png_set_shift(png_ptr, sig_bit); - -PNG files store 3-color pixels in red, green, blue order. This code -changes the storage of the pixels to blue, green, red: - - if (color_type == PNG_COLOR_TYPE_RGB || - color_type == PNG_COLOR_TYPE_RGB_ALPHA) - png_set_bgr(png_ptr); - -PNG files store RGB pixels packed into 3 or 6 bytes. This code expands them -into 4 or 8 bytes for windowing systems that need them in this format: - - if (color_type == PNG_COLOR_TYPE_RGB) - png_set_filler(png_ptr, filler, PNG_FILLER_BEFORE); - -where "filler" is the 8 or 16-bit number to fill with, and the location is -either PNG_FILLER_BEFORE or PNG_FILLER_AFTER, depending upon whether -you want the filler before the RGB or after. This transformation -does not affect images that already have full alpha channels. To add an -opaque alpha channel, use filler=0xff or 0xffff and PNG_FILLER_AFTER which -will generate RGBA pixels. - -Note that png_set_filler() does not change the color type. If you want -to do that, you can add a true alpha channel with - - if (color_type == PNG_COLOR_TYPE_RGB || - color_type == PNG_COLOR_TYPE_GRAY) - png_set_add_alpha(png_ptr, filler, PNG_FILLER_AFTER); - -where "filler" contains the alpha value to assign to each pixel. -This function was added in libpng-1.2.7. - -If you are reading an image with an alpha channel, and you need the -data as ARGB instead of the normal PNG format RGBA: - - if (color_type == PNG_COLOR_TYPE_RGB_ALPHA) - png_set_swap_alpha(png_ptr); - -For some uses, you may want a grayscale image to be represented as -RGB. This code will do that conversion: - - if (color_type == PNG_COLOR_TYPE_GRAY || - color_type == PNG_COLOR_TYPE_GRAY_ALPHA) - png_set_gray_to_rgb(png_ptr); - -Conversely, you can convert an RGB or RGBA image to grayscale or grayscale -with alpha. - - if (color_type == PNG_COLOR_TYPE_RGB || - color_type == PNG_COLOR_TYPE_RGB_ALPHA) - png_set_rgb_to_gray_fixed(png_ptr, error_action, - int red_weight, int green_weight); - - error_action = 1: silently do the conversion - error_action = 2: issue a warning if the original - image has any pixel where - red != green or red != blue - error_action = 3: issue an error and abort the - conversion if the original - image has any pixel where - red != green or red != blue - - red_weight: weight of red component times 100000 - green_weight: weight of green component times 100000 - If either weight is negative, default - weights (21268, 71514) are used. - -If you have set error_action = 1 or 2, you can -later check whether the image really was gray, after processing -the image rows, with the png_get_rgb_to_gray_status(png_ptr) function. -It will return a png_byte that is zero if the image was gray or -1 if there were any non-gray pixels. bKGD and sBIT data -will be silently converted to grayscale, using the green channel -data, regardless of the error_action setting. - -With red_weight+green_weight<=100000, -the normalized graylevel is computed: - - int rw = red_weight * 65536; - int gw = green_weight * 65536; - int bw = 65536 - (rw + gw); - gray = (rw*red + gw*green + bw*blue)/65536; - -The default values approximate those recommended in the Charles -Poynton's Color FAQ, -Copyright (c) 1998-01-04 Charles Poynton - - Y = 0.212671 * R + 0.715160 * G + 0.072169 * B - -Libpng approximates this with - - Y = 0.21268 * R + 0.7151 * G + 0.07217 * B - -which can be expressed with integers as - - Y = (6969 * R + 23434 * G + 2365 * B)/32768 - -The calculation is done in a linear colorspace, if the image gamma -is known. - -If you have a grayscale and you are using png_set_expand_depth(), -png_set_expand(), or png_set_gray_to_rgb to change to truecolor or to -a higher bit-depth, you must either supply the background color as a gray -value at the original file bit-depth (need_expand = 1) or else supply the -background color as an RGB triplet at the final, expanded bit depth -(need_expand = 0). Similarly, if you are reading a paletted image, you -must either supply the background color as a palette index (need_expand = 1) -or as an RGB triplet that may or may not be in the palette (need_expand = 0). - - png_color_16 my_background; - png_color_16p image_background; - - if (png_get_bKGD(png_ptr, info_ptr, &image_background)) - png_set_background(png_ptr, image_background, - PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); - else - png_set_background(png_ptr, &my_background, - PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); - -The png_set_background() function tells libpng to composite images -with alpha or simple transparency against the supplied background -color. If the PNG file contains a bKGD chunk (PNG_INFO_bKGD valid), -you may use this color, or supply another color more suitable for -the current display (e.g., the background color from a web page). You -need to tell libpng whether the color is in the gamma space of the -display (PNG_BACKGROUND_GAMMA_SCREEN for colors you supply), the file -(PNG_BACKGROUND_GAMMA_FILE for colors from the bKGD chunk), or one -that is neither of these gammas (PNG_BACKGROUND_GAMMA_UNIQUE - I don't -know why anyone would use this, but it's here). - -To properly display PNG images on any kind of system, the application needs -to know what the display gamma is. Ideally, the user will know this, and -the application will allow them to set it. One method of allowing the user -to set the display gamma separately for each system is to check for a -SCREEN_GAMMA or DISPLAY_GAMMA environment variable, which will hopefully be -correctly set. - -Note that display_gamma is the overall gamma correction required to produce -pleasing results, which depends on the lighting conditions in the surrounding -environment. In a dim or brightly lit room, no compensation other than -the physical gamma exponent of the monitor is needed, while in a dark room -a slightly smaller exponent is better. - - double gamma, screen_gamma; - - if (/* We have a user-defined screen - gamma value */) - { - screen_gamma = user_defined_screen_gamma; - } - /* One way that applications can share the same - screen gamma value */ - else if ((gamma_str = getenv("SCREEN_GAMMA")) - != NULL) - { - screen_gamma = (double)atof(gamma_str); - } - /* If we don't have another value */ - else - { - screen_gamma = 2.2; /* A good guess for a - PC monitor in a bright office or a dim room */ - screen_gamma = 2.0; /* A good guess for a - PC monitor in a dark room */ - screen_gamma = 1.7 or 1.0; /* A good - guess for Mac systems */ - } - -The png_set_gamma() function handles gamma transformations of the data. -Pass both the file gamma and the current screen_gamma. If the file does -not have a gamma value, you can pass one anyway if you have an idea what -it is (usually 0.45455 is a good guess for GIF images on PCs). Note -that file gammas are inverted from screen gammas. See the discussions -on gamma in the PNG specification for an excellent description of what -gamma is, and why all applications should support it. It is strongly -recommended that PNG viewers support gamma correction. - - if (png_get_gAMA(png_ptr, info_ptr, &gamma)) - png_set_gamma(png_ptr, screen_gamma, gamma); - else - png_set_gamma(png_ptr, screen_gamma, 0.45455); - -If you need to reduce an RGB file to a paletted file, or if a paletted -file has more entries then will fit on your screen, png_set_dither() -will do that. Note that this is a simple match dither that merely -finds the closest color available. This should work fairly well with -optimized palettes, and fairly badly with linear color cubes. If you -pass a palette that is larger then maximum_colors, the file will -reduce the number of colors in the palette so it will fit into -maximum_colors. If there is a histogram, it will use it to make -more intelligent choices when reducing the palette. If there is no -histogram, it may not do as good a job. - - if (color_type & PNG_COLOR_MASK_COLOR) - { - if (png_get_valid(png_ptr, info_ptr, - PNG_INFO_PLTE)) - { - png_uint_16p histogram = NULL; - - png_get_hIST(png_ptr, info_ptr, - &histogram); - png_set_dither(png_ptr, palette, num_palette, - max_screen_colors, histogram, 1); - } - else - { - png_color std_color_cube[MAX_SCREEN_COLORS] = - { ... colors ... }; - - png_set_dither(png_ptr, std_color_cube, - MAX_SCREEN_COLORS, MAX_SCREEN_COLORS, - NULL,0); - } - } - -PNG files describe monochrome as black being zero and white being one. -The following code will reverse this (make black be one and white be -zero): - - if (bit_depth == 1 && color_type == PNG_COLOR_TYPE_GRAY) - png_set_invert_mono(png_ptr); - -This function can also be used to invert grayscale and gray-alpha images: - - if (color_type == PNG_COLOR_TYPE_GRAY || - color_type == PNG_COLOR_TYPE_GRAY_ALPHA) - png_set_invert_mono(png_ptr); - -PNG files store 16 bit pixels in network byte order (big-endian, -ie. most significant bits first). This code changes the storage to the -other way (little-endian, i.e. least significant bits first, the -way PCs store them): - - if (bit_depth == 16) - png_set_swap(png_ptr); - -If you are using packed-pixel images (1, 2, or 4 bits/pixel), and you -need to change the order the pixels are packed into bytes, you can use: - - if (bit_depth < 8) - png_set_packswap(png_ptr); - -Finally, you can write your own transformation function if none of -the existing ones meets your needs. This is done by setting a callback -with - - png_set_read_user_transform_fn(png_ptr, - read_transform_fn); - -You must supply the function - - void read_transform_fn(png_ptr ptr, row_info_ptr - row_info, png_bytep data) - -See pngtest.c for a working example. Your function will be called -after all of the other transformations have been processed. - -You can also set up a pointer to a user structure for use by your -callback function, and you can inform libpng that your transform -function will change the number of channels or bit depth with the -function - - png_set_user_transform_info(png_ptr, user_ptr, - user_depth, user_channels); - -The user's application, not libpng, is responsible for allocating and -freeing any memory required for the user structure. - -You can retrieve the pointer via the function -png_get_user_transform_ptr(). For example: - - voidp read_user_transform_ptr = - png_get_user_transform_ptr(png_ptr); - -The last thing to handle is interlacing; this is covered in detail below, -but you must call the function here if you want libpng to handle expansion -of the interlaced image. - - number_of_passes = png_set_interlace_handling(png_ptr); - -After setting the transformations, libpng can update your png_info -structure to reflect any transformations you've requested with this -call. This is most useful to update the info structure's rowbytes -field so you can use it to allocate your image memory. This function -will also update your palette with the correct screen_gamma and -background if these have been given with the calls above. - - png_read_update_info(png_ptr, info_ptr); - -After you call png_read_update_info(), you can allocate any -memory you need to hold the image. The row data is simply -raw byte data for all forms of images. As the actual allocation -varies among applications, no example will be given. If you -are allocating one large chunk, you will need to build an -array of pointers to each row, as it will be needed for some -of the functions below. - -.SS Reading image data - -After you've allocated memory, you can read the image data. -The simplest way to do this is in one function call. If you are -allocating enough memory to hold the whole image, you can just -call png_read_image() and libpng will read in all the image data -and put it in the memory area supplied. You will need to pass in -an array of pointers to each row. - -This function automatically handles interlacing, so you don't need -to call png_set_interlace_handling() or call this function multiple -times, or any of that other stuff necessary with png_read_rows(). - - png_read_image(png_ptr, row_pointers); - -where row_pointers is: - - png_bytep row_pointers[height]; - -You can point to void or char or whatever you use for pixels. - -If you don't want to read in the whole image at once, you can -use png_read_rows() instead. If there is no interlacing (check -interlace_type == PNG_INTERLACE_NONE), this is simple: - - png_read_rows(png_ptr, row_pointers, NULL, - number_of_rows); - -where row_pointers is the same as in the png_read_image() call. - -If you are doing this just one row at a time, you can do this with -a single row_pointer instead of an array of row_pointers: - - png_bytep row_pointer = row; - png_read_row(png_ptr, row_pointer, NULL); - -If the file is interlaced (interlace_type != 0 in the IHDR chunk), things -get somewhat harder. The only current (PNG Specification version 1.2) -interlacing type for PNG is (interlace_type == PNG_INTERLACE_ADAM7) -is a somewhat complicated 2D interlace scheme, known as Adam7, that -breaks down an image into seven smaller images of varying size, based -on an 8x8 grid. - -libpng can fill out those images or it can give them to you "as is". -If you want them filled out, there are two ways to do that. The one -mentioned in the PNG specification is to expand each pixel to cover -those pixels that have not been read yet (the "rectangle" method). -This results in a blocky image for the first pass, which gradually -smooths out as more pixels are read. The other method is the "sparkle" -method, where pixels are drawn only in their final locations, with the -rest of the image remaining whatever colors they were initialized to -before the start of the read. The first method usually looks better, -but tends to be slower, as there are more pixels to put in the rows. - -If you don't want libpng to handle the interlacing details, just call -png_read_rows() seven times to read in all seven images. Each of the -images is a valid image by itself, or they can all be combined on an -8x8 grid to form a single image (although if you intend to combine them -you would be far better off using the libpng interlace handling). - -The first pass will return an image 1/8 as wide as the entire image -(every 8th column starting in column 0) and 1/8 as high as the original -(every 8th row starting in row 0), the second will be 1/8 as wide -(starting in column 4) and 1/8 as high (also starting in row 0). The -third pass will be 1/4 as wide (every 4th pixel starting in column 0) and -1/8 as high (every 8th row starting in row 4), and the fourth pass will -be 1/4 as wide and 1/4 as high (every 4th column starting in column 2, -and every 4th row starting in row 0). The fifth pass will return an -image 1/2 as wide, and 1/4 as high (starting at column 0 and row 2), -while the sixth pass will be 1/2 as wide and 1/2 as high as the original -(starting in column 1 and row 0). The seventh and final pass will be as -wide as the original, and 1/2 as high, containing all of the odd -numbered scanlines. Phew! - -If you want libpng to expand the images, call this before calling -png_start_read_image() or png_read_update_info(): - - if (interlace_type == PNG_INTERLACE_ADAM7) - number_of_passes - = png_set_interlace_handling(png_ptr); - -This will return the number of passes needed. Currently, this -is seven, but may change if another interlace type is added. -This function can be called even if the file is not interlaced, -where it will return one pass. - -If you are not going to display the image after each pass, but are -going to wait until the entire image is read in, use the sparkle -effect. This effect is faster and the end result of either method -is exactly the same. If you are planning on displaying the image -after each pass, the "rectangle" effect is generally considered the -better looking one. - -If you only want the "sparkle" effect, just call png_read_rows() as -normal, with the third parameter NULL. Make sure you make pass over -the image number_of_passes times, and you don't change the data in the -rows between calls. You can change the locations of the data, just -not the data. Each pass only writes the pixels appropriate for that -pass, and assumes the data from previous passes is still valid. - - png_read_rows(png_ptr, row_pointers, NULL, - number_of_rows); - -If you only want the first effect (the rectangles), do the same as -before except pass the row buffer in the third parameter, and leave -the second parameter NULL. - - png_read_rows(png_ptr, NULL, row_pointers, - number_of_rows); - -.SS Finishing a sequential read - -After you are finished reading the image through the -low-level interface, you can finish reading the file. If you are -interested in comments or time, which may be stored either before or -after the image data, you should pass the separate png_info struct if -you want to keep the comments from before and after the image -separate. If you are not interested, you can pass NULL. - - png_read_end(png_ptr, end_info); - -When you are done, you can free all memory allocated by libpng like this: - - png_destroy_read_struct(&png_ptr, &info_ptr, - &end_info); - -It is also possible to individually free the info_ptr members that -point to libpng-allocated storage with the following function: - - png_free_data(png_ptr, info_ptr, mask, seq) - mask - identifies data to be freed, a mask - containing the bitwise OR of one or - more of - PNG_FREE_PLTE, PNG_FREE_TRNS, - PNG_FREE_HIST, PNG_FREE_ICCP, - PNG_FREE_PCAL, PNG_FREE_ROWS, - PNG_FREE_SCAL, PNG_FREE_SPLT, - PNG_FREE_TEXT, PNG_FREE_UNKN, - or simply PNG_FREE_ALL - seq - sequence number of item to be freed - (-1 for all items) - -This function may be safely called when the relevant storage has -already been freed, or has not yet been allocated, or was allocated -by the user and not by libpng, and will in those -cases do nothing. The "seq" parameter is ignored if only one item -of the selected data type, such as PLTE, is allowed. If "seq" is not --1, and multiple items are allowed for the data type identified in -the mask, such as text or sPLT, only the n'th item in the structure -is freed, where n is "seq". - -The default behavior is only to free data that was allocated internally -by libpng. This can be changed, so that libpng will not free the data, -or so that it will free data that was allocated by the user with png_malloc() -or png_zalloc() and passed in via a png_set_*() function, with - - png_data_freer(png_ptr, info_ptr, freer, mask) - mask - which data elements are affected - same choices as in png_free_data() - freer - one of - PNG_DESTROY_WILL_FREE_DATA - PNG_SET_WILL_FREE_DATA - PNG_USER_WILL_FREE_DATA - -This function only affects data that has already been allocated. -You can call this function after reading the PNG data but before calling -any png_set_*() functions, to control whether the user or the png_set_*() -function is responsible for freeing any existing data that might be present, -and again after the png_set_*() functions to control whether the user -or png_destroy_*() is supposed to free the data. When the user assumes -responsibility for libpng-allocated data, the application must use -png_free() to free it, and when the user transfers responsibility to libpng -for data that the user has allocated, the user must have used png_malloc() -or png_zalloc() to allocate it. - -If you allocated your row_pointers in a single block, as suggested above in -the description of the high level read interface, you must not transfer -responsibility for freeing it to the png_set_rows or png_read_destroy function, -because they would also try to free the individual row_pointers[i]. - -If you allocated text_ptr.text, text_ptr.lang, and text_ptr.translated_keyword -separately, do not transfer responsibility for freeing text_ptr to libpng, -because when libpng fills a png_text structure it combines these members with -the key member, and png_free_data() will free only text_ptr.key. Similarly, -if you transfer responsibility for free'ing text_ptr from libpng to your -application, your application must not separately free those members. - -The png_free_data() function will turn off the "valid" flag for anything -it frees. If you need to turn the flag off for a chunk that was freed by your -application instead of by libpng, you can use - - png_set_invalid(png_ptr, info_ptr, mask); - mask - identifies the chunks to be made invalid, - containing the bitwise OR of one or - more of - PNG_INFO_gAMA, PNG_INFO_sBIT, - PNG_INFO_cHRM, PNG_INFO_PLTE, - PNG_INFO_tRNS, PNG_INFO_bKGD, - PNG_INFO_hIST, PNG_INFO_pHYs, - PNG_INFO_oFFs, PNG_INFO_tIME, - PNG_INFO_pCAL, PNG_INFO_sRGB, - PNG_INFO_iCCP, PNG_INFO_sPLT, - PNG_INFO_sCAL, PNG_INFO_IDAT - -For a more compact example of reading a PNG image, see the file example.c. - -.SS Reading PNG files progressively - -The progressive reader is slightly different then the non-progressive -reader. Instead of calling png_read_info(), png_read_rows(), and -png_read_end(), you make one call to png_process_data(), which calls -callbacks when it has the info, a row, or the end of the image. You -set up these callbacks with png_set_progressive_read_fn(). You don't -have to worry about the input/output functions of libpng, as you are -giving the library the data directly in png_process_data(). I will -assume that you have read the section on reading PNG files above, -so I will only highlight the differences (although I will show -all of the code). - -png_structp png_ptr; -png_infop info_ptr; - - /* An example code fragment of how you would - initialize the progressive reader in your - application. */ - int - initialize_png_reader() - { - png_ptr = png_create_read_struct - (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr, - user_error_fn, user_warning_fn); - if (!png_ptr) - return (ERROR); - info_ptr = png_create_info_struct(png_ptr); - if (!info_ptr) - { - png_destroy_read_struct(&png_ptr, (png_infopp)NULL, - (png_infopp)NULL); - return (ERROR); - } - - if (setjmp(png_jmpbuf(png_ptr))) - { - png_destroy_read_struct(&png_ptr, &info_ptr, - (png_infopp)NULL); - return (ERROR); - } - - /* This one's new. You can provide functions - to be called when the header info is valid, - when each row is completed, and when the image - is finished. If you aren't using all functions, - you can specify NULL parameters. Even when all - three functions are NULL, you need to call - png_set_progressive_read_fn(). You can use - any struct as the user_ptr (cast to a void pointer - for the function call), and retrieve the pointer - from inside the callbacks using the function - - png_get_progressive_ptr(png_ptr); - - which will return a void pointer, which you have - to cast appropriately. - */ - png_set_progressive_read_fn(png_ptr, (void *)user_ptr, - info_callback, row_callback, end_callback); - - return 0; - } - - /* A code fragment that you call as you receive blocks - of data */ - int - process_data(png_bytep buffer, png_uint_32 length) - { - if (setjmp(png_jmpbuf(png_ptr))) - { - png_destroy_read_struct(&png_ptr, &info_ptr, - (png_infopp)NULL); - return (ERROR); - } - - /* This one's new also. Simply give it a chunk - of data from the file stream (in order, of - course). On machines with segmented memory - models machines, don't give it any more than - 64K. The library seems to run fine with sizes - of 4K. Although you can give it much less if - necessary (I assume you can give it chunks of - 1 byte, I haven't tried less then 256 bytes - yet). When this function returns, you may - want to display any rows that were generated - in the row callback if you don't already do - so there. - */ - png_process_data(png_ptr, info_ptr, buffer, length); - return 0; - } - - /* This function is called (as set by - png_set_progressive_read_fn() above) when enough data - has been supplied so all of the header has been - read. - */ - void - info_callback(png_structp png_ptr, png_infop info) - { - /* Do any setup here, including setting any of - the transformations mentioned in the Reading - PNG files section. For now, you _must_ call - either png_start_read_image() or - png_read_update_info() after all the - transformations are set (even if you don't set - any). You may start getting rows before - png_process_data() returns, so this is your - last chance to prepare for that. - */ - } - - /* This function is called when each row of image - data is complete */ - void - row_callback(png_structp png_ptr, png_bytep new_row, - png_uint_32 row_num, int pass) - { - /* If the image is interlaced, and you turned - on the interlace handler, this function will - be called for every row in every pass. Some - of these rows will not be changed from the - previous pass. When the row is not changed, - the new_row variable will be NULL. The rows - and passes are called in order, so you don't - really need the row_num and pass, but I'm - supplying them because it may make your life - easier. - - For the non-NULL rows of interlaced images, - you must call png_progressive_combine_row() - passing in the row and the old row. You can - call this function for NULL rows (it will just - return) and for non-interlaced images (it just - does the memcpy for you) if it will make the - code easier. Thus, you can just do this for - all cases: - */ - - png_progressive_combine_row(png_ptr, old_row, - new_row); - - /* where old_row is what was displayed for - previously for the row. Note that the first - pass (pass == 0, really) will completely cover - the old row, so the rows do not have to be - initialized. After the first pass (and only - for interlaced images), you will have to pass - the current row, and the function will combine - the old row and the new row. - */ - } - - void - end_callback(png_structp png_ptr, png_infop info) - { - /* This function is called after the whole image - has been read, including any chunks after the - image (up to and including the IEND). You - will usually have the same info chunk as you - had in the header, although some data may have - been added to the comments and time fields. - - Most people won't do much here, perhaps setting - a flag that marks the image as finished. - */ - } - - - -.SH IV. Writing - -Much of this is very similar to reading. However, everything of -importance is repeated here, so you won't have to constantly look -back up in the reading section to understand writing. - -.SS Setup - -You will want to do the I/O initialization before you get into libpng, -so if it doesn't work, you don't have anything to undo. If you are not -using the standard I/O functions, you will need to replace them with -custom writing functions. See the discussion under Customizing libpng. - - FILE *fp = fopen(file_name, "wb"); - if (!fp) - { - return (ERROR); - } - -Next, png_struct and png_info need to be allocated and initialized. -As these can be both relatively large, you may not want to store these -on the stack, unless you have stack space to spare. Of course, you -will want to check if they return NULL. If you are also reading, -you won't want to name your read structure and your write structure -both "png_ptr"; you can call them anything you like, such as -"read_ptr" and "write_ptr". Look at pngtest.c, for example. - - png_structp png_ptr = png_create_write_struct - (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr, - user_error_fn, user_warning_fn); - if (!png_ptr) - return (ERROR); - - png_infop info_ptr = png_create_info_struct(png_ptr); - if (!info_ptr) - { - png_destroy_write_struct(&png_ptr, - (png_infopp)NULL); - return (ERROR); - } - -If you want to use your own memory allocation routines, -define PNG_USER_MEM_SUPPORTED and use -png_create_write_struct_2() instead of png_create_write_struct(): - - png_structp png_ptr = png_create_write_struct_2 - (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr, - user_error_fn, user_warning_fn, (png_voidp) - user_mem_ptr, user_malloc_fn, user_free_fn); - -After you have these structures, you will need to set up the -error handling. When libpng encounters an error, it expects to -longjmp() back to your routine. Therefore, you will need to call -setjmp() and pass the png_jmpbuf(png_ptr). If you -write the file from different routines, you will need to update -the png_jmpbuf(png_ptr) every time you enter a new routine that will -call a png_*() function. See your documentation of setjmp/longjmp -for your compiler for more information on setjmp/longjmp. See -the discussion on libpng error handling in the Customizing Libpng -section below for more information on the libpng error handling. - - if (setjmp(png_jmpbuf(png_ptr))) - { - png_destroy_write_struct(&png_ptr, &info_ptr); - fclose(fp); - return (ERROR); - } - ... - return; - -If you would rather avoid the complexity of setjmp/longjmp issues, -you can compile libpng with PNG_SETJMP_NOT_SUPPORTED, in which case -errors will result in a call to PNG_ABORT() which defaults to abort(). - -Now you need to set up the output code. The default for libpng is to -use the C function fwrite(). If you use this, you will need to pass a -valid FILE * in the function png_init_io(). Be sure that the file is -opened in binary mode. Again, if you wish to handle writing data in -another way, see the discussion on libpng I/O handling in the Customizing -Libpng section below. - - png_init_io(png_ptr, fp); - -If you are embedding your PNG into a datastream such as MNG, and don't -want libpng to write the 8-byte signature, or if you have already -written the signature in your application, use - - png_set_sig_bytes(png_ptr, 8); - -to inform libpng that it should not write a signature. - -.SS Write callbacks - -At this point, you can set up a callback function that will be -called after each row has been written, which you can use to control -a progress meter or the like. It's demonstrated in pngtest.c. -You must supply a function - - void write_row_callback(png_ptr, png_uint_32 row, - int pass); - { - /* put your code here */ - } - -(You can give it another name that you like instead of "write_row_callback") - -To inform libpng about your function, use - - png_set_write_status_fn(png_ptr, write_row_callback); - -You now have the option of modifying how the compression library will -run. The following functions are mainly for testing, but may be useful -in some cases, like if you need to write PNG files extremely fast and -are willing to give up some compression, or if you want to get the -maximum possible compression at the expense of slower writing. If you -have no special needs in this area, let the library do what it wants by -not calling this function at all, as it has been tuned to deliver a good -speed/compression ratio. The second parameter to png_set_filter() is -the filter method, for which the only valid values are 0 (as of the -July 1999 PNG specification, version 1.2) or 64 (if you are writing -a PNG datastream that is to be embedded in a MNG datastream). The third -parameter is a flag that indicates which filter type(s) are to be tested -for each scanline. See the PNG specification for details on the specific filter -types. - - - /* turn on or off filtering, and/or choose - specific filters. You can use either a single - PNG_FILTER_VALUE_NAME or the bitwise OR of one - or more PNG_FILTER_NAME masks. */ - png_set_filter(png_ptr, 0, - PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE | - PNG_FILTER_SUB | PNG_FILTER_VALUE_SUB | - PNG_FILTER_UP | PNG_FILTER_VALUE_UP | - PNG_FILTER_AVE | PNG_FILTER_VALUE_AVE | - PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH| - PNG_ALL_FILTERS); - -If an application -wants to start and stop using particular filters during compression, -it should start out with all of the filters (to ensure that the previous -row of pixels will be stored in case it's needed later), and then add -and remove them after the start of compression. - -If you are writing a PNG datastream that is to be embedded in a MNG -datastream, the second parameter can be either 0 or 64. - -The png_set_compression_*() functions interface to the zlib compression -library, and should mostly be ignored unless you really know what you are -doing. The only generally useful call is png_set_compression_level() -which changes how much time zlib spends on trying to compress the image -data. See the Compression Library (zlib.h and algorithm.txt, distributed -with zlib) for details on the compression levels. - - /* set the zlib compression level */ - png_set_compression_level(png_ptr, - Z_BEST_COMPRESSION); - - /* set other zlib parameters */ - png_set_compression_mem_level(png_ptr, 8); - png_set_compression_strategy(png_ptr, - Z_DEFAULT_STRATEGY); - png_set_compression_window_bits(png_ptr, 15); - png_set_compression_method(png_ptr, 8); - png_set_compression_buffer_size(png_ptr, 8192) - -extern PNG_EXPORT(void,png_set_zbuf_size) - -.SS Setting the contents of info for output - -You now need to fill in the png_info structure with all the data you -wish to write before the actual image. Note that the only thing you -are allowed to write after the image is the text chunks and the time -chunk (as of PNG Specification 1.2, anyway). See png_write_end() and -the latest PNG specification for more information on that. If you -wish to write them before the image, fill them in now, and flag that -data as being valid. If you want to wait until after the data, don't -fill them until png_write_end(). For all the fields in png_info and -their data types, see png.h. For explanations of what the fields -contain, see the PNG specification. - -Some of the more important parts of the png_info are: - - png_set_IHDR(png_ptr, info_ptr, width, height, - bit_depth, color_type, interlace_type, - compression_type, filter_method) - width - holds the width of the image - in pixels (up to 2^31). - height - holds the height of the image - in pixels (up to 2^31). - bit_depth - holds the bit depth of one of the - image channels. - (valid values are 1, 2, 4, 8, 16 - and depend also on the - color_type. See also significant - bits (sBIT) below). - color_type - describes which color/alpha - channels are present. - PNG_COLOR_TYPE_GRAY - (bit depths 1, 2, 4, 8, 16) - PNG_COLOR_TYPE_GRAY_ALPHA - (bit depths 8, 16) - PNG_COLOR_TYPE_PALETTE - (bit depths 1, 2, 4, 8) - PNG_COLOR_TYPE_RGB - (bit_depths 8, 16) - PNG_COLOR_TYPE_RGB_ALPHA - (bit_depths 8, 16) - - PNG_COLOR_MASK_PALETTE - PNG_COLOR_MASK_COLOR - PNG_COLOR_MASK_ALPHA - - interlace_type - PNG_INTERLACE_NONE or - PNG_INTERLACE_ADAM7 - compression_type - (must be - PNG_COMPRESSION_TYPE_DEFAULT) - filter_method - (must be PNG_FILTER_TYPE_DEFAULT - or, if you are writing a PNG to - be embedded in a MNG datastream, - can also be - PNG_INTRAPIXEL_DIFFERENCING) - - png_set_PLTE(png_ptr, info_ptr, palette, - num_palette); - palette - the palette for the file - (array of png_color) - num_palette - number of entries in the palette - - png_set_gAMA(png_ptr, info_ptr, gamma); - gamma - the gamma the image was created - at (PNG_INFO_gAMA) - - png_set_sRGB(png_ptr, info_ptr, srgb_intent); - srgb_intent - the rendering intent - (PNG_INFO_sRGB) The presence of - the sRGB chunk means that the pixel - data is in the sRGB color space. - This chunk also implies specific - values of gAMA and cHRM. Rendering - intent is the CSS-1 property that - has been defined by the International - Color Consortium - (http://www.color.org). - It can be one of - PNG_sRGB_INTENT_SATURATION, - PNG_sRGB_INTENT_PERCEPTUAL, - PNG_sRGB_INTENT_ABSOLUTE, or - PNG_sRGB_INTENT_RELATIVE. - - - png_set_sRGB_gAMA_and_cHRM(png_ptr, info_ptr, - srgb_intent); - srgb_intent - the rendering intent - (PNG_INFO_sRGB) The presence of the - sRGB chunk means that the pixel - data is in the sRGB color space. - This function also causes gAMA and - cHRM chunks with the specific values - that are consistent with sRGB to be - written. - - png_set_iCCP(png_ptr, info_ptr, name, compression_type, - profile, proflen); - name - The profile name. - compression - The compression type; always - PNG_COMPRESSION_TYPE_BASE for PNG 1.0. - You may give NULL to this argument to - ignore it. - profile - International Color Consortium color - profile data. May contain NULs. - proflen - length of profile data in bytes. - - png_set_sBIT(png_ptr, info_ptr, sig_bit); - sig_bit - the number of significant bits for - (PNG_INFO_sBIT) each of the gray, red, - green, and blue channels, whichever are - appropriate for the given color type - (png_color_16) - - png_set_tRNS(png_ptr, info_ptr, trans, num_trans, - trans_values); - trans - array of transparent entries for - palette (PNG_INFO_tRNS) - trans_values - graylevel or color sample values of - the single transparent color for - non-paletted images (PNG_INFO_tRNS) - num_trans - number of transparent entries - (PNG_INFO_tRNS) - - png_set_hIST(png_ptr, info_ptr, hist); - (PNG_INFO_hIST) - hist - histogram of palette (array of - png_uint_16) - - png_set_tIME(png_ptr, info_ptr, mod_time); - mod_time - time image was last modified - (PNG_VALID_tIME) - - png_set_bKGD(png_ptr, info_ptr, background); - background - background color (PNG_VALID_bKGD) - - png_set_text(png_ptr, info_ptr, text_ptr, num_text); - text_ptr - array of png_text holding image - comments - text_ptr[i].compression - type of compression used - on "text" PNG_TEXT_COMPRESSION_NONE - PNG_TEXT_COMPRESSION_zTXt - PNG_ITXT_COMPRESSION_NONE - PNG_ITXT_COMPRESSION_zTXt - text_ptr[i].key - keyword for comment. Must contain - 1-79 characters. - text_ptr[i].text - text comments for current - keyword. Can be NULL or empty. - text_ptr[i].text_length - length of text string, - after decompression, 0 for iTXt - text_ptr[i].itxt_length - length of itxt string, - after decompression, 0 for tEXt/zTXt - text_ptr[i].lang - language of comment (NULL or - empty for unknown). - text_ptr[i].translated_keyword - keyword in UTF-8 (NULL - or empty for unknown). - num_text - number of comments - - png_set_sPLT(png_ptr, info_ptr, &palette_ptr, - num_spalettes); - palette_ptr - array of png_sPLT_struct structures - to be added to the list of palettes - in the info structure. - num_spalettes - number of palette structures to be - added. - - png_set_oFFs(png_ptr, info_ptr, offset_x, offset_y, - unit_type); - offset_x - positive offset from the left - edge of the screen - offset_y - positive offset from the top - edge of the screen - unit_type - PNG_OFFSET_PIXEL, PNG_OFFSET_MICROMETER - - png_set_pHYs(png_ptr, info_ptr, res_x, res_y, - unit_type); - res_x - pixels/unit physical resolution - in x direction - res_y - pixels/unit physical resolution - in y direction - unit_type - PNG_RESOLUTION_UNKNOWN, - PNG_RESOLUTION_METER - - png_set_sCAL(png_ptr, info_ptr, unit, width, height) - unit - physical scale units (an integer) - width - width of a pixel in physical scale units - height - height of a pixel in physical scale units - (width and height are doubles) - - png_set_sCAL_s(png_ptr, info_ptr, unit, width, height) - unit - physical scale units (an integer) - width - width of a pixel in physical scale units - height - height of a pixel in physical scale units - (width and height are strings like "2.54") - - png_set_unknown_chunks(png_ptr, info_ptr, &unknowns, - num_unknowns) - unknowns - array of png_unknown_chunk - structures holding unknown chunks - unknowns[i].name - name of unknown chunk - unknowns[i].data - data of unknown chunk - unknowns[i].size - size of unknown chunk's data - unknowns[i].location - position to write chunk in file - 0: do not write chunk - PNG_HAVE_IHDR: before PLTE - PNG_HAVE_PLTE: before IDAT - PNG_AFTER_IDAT: after IDAT - -The "location" member is set automatically according to -what part of the output file has already been written. -You can change its value after calling png_set_unknown_chunks() -as demonstrated in pngtest.c. Within each of the "locations", -the chunks are sequenced according to their position in the -structure (that is, the value of "i", which is the order in which -the chunk was either read from the input file or defined with -png_set_unknown_chunks). - -A quick word about text and num_text. text is an array of png_text -structures. num_text is the number of valid structures in the array. -Each png_text structure holds a language code, a keyword, a text value, -and a compression type. - -The compression types have the same valid numbers as the compression -types of the image data. Currently, the only valid number is zero. -However, you can store text either compressed or uncompressed, unlike -images, which always have to be compressed. So if you don't want the -text compressed, set the compression type to PNG_TEXT_COMPRESSION_NONE. -Because tEXt and zTXt chunks don't have a language field, if you -specify PNG_TEXT_COMPRESSION_NONE or PNG_TEXT_COMPRESSION_zTXt -any language code or translated keyword will not be written out. - -Until text gets around 1000 bytes, it is not worth compressing it. -After the text has been written out to the file, the compression type -is set to PNG_TEXT_COMPRESSION_NONE_WR or PNG_TEXT_COMPRESSION_zTXt_WR, -so that it isn't written out again at the end (in case you are calling -png_write_end() with the same struct. - -The keywords that are given in the PNG Specification are: - - Title Short (one line) title or - caption for image - Author Name of image's creator - Description Description of image (possibly long) - Copyright Copyright notice - Creation Time Time of original image creation - (usually RFC 1123 format, see below) - Software Software used to create the image - Disclaimer Legal disclaimer - Warning Warning of nature of content - Source Device used to create the image - Comment Miscellaneous comment; conversion - from other image format - -The keyword-text pairs work like this. Keywords should be short -simple descriptions of what the comment is about. Some typical -keywords are found in the PNG specification, as is some recommendations -on keywords. You can repeat keywords in a file. You can even write -some text before the image and some after. For example, you may want -to put a description of the image before the image, but leave the -disclaimer until after, so viewers working over modem connections -don't have to wait for the disclaimer to go over the modem before -they start seeing the image. Finally, keywords should be full -words, not abbreviations. Keywords and text are in the ISO 8859-1 -(Latin-1) character set (a superset of regular ASCII) and can not -contain NUL characters, and should not contain control or other -unprintable characters. To make the comments widely readable, stick -with basic ASCII, and avoid machine specific character set extensions -like the IBM-PC character set. The keyword must be present, but -you can leave off the text string on non-compressed pairs. -Compressed pairs must have a text string, as only the text string -is compressed anyway, so the compression would be meaningless. - -PNG supports modification time via the png_time structure. Two -conversion routines are provided, png_convert_from_time_t() for -time_t and png_convert_from_struct_tm() for struct tm. The -time_t routine uses gmtime(). You don't have to use either of -these, but if you wish to fill in the png_time structure directly, -you should provide the time in universal time (GMT) if possible -instead of your local time. Note that the year number is the full -year (e.g. 1998, rather than 98 - PNG is year 2000 compliant!), and -that months start with 1. - -If you want to store the time of the original image creation, you should -use a plain tEXt chunk with the "Creation Time" keyword. This is -necessary because the "creation time" of a PNG image is somewhat vague, -depending on whether you mean the PNG file, the time the image was -created in a non-PNG format, a still photo from which the image was -scanned, or possibly the subject matter itself. In order to facilitate -machine-readable dates, it is recommended that the "Creation Time" -tEXt chunk use RFC 1123 format dates (e.g. "22 May 1997 18:07:10 GMT"), -although this isn't a requirement. Unlike the tIME chunk, the -"Creation Time" tEXt chunk is not expected to be automatically changed -by the software. To facilitate the use of RFC 1123 dates, a function -png_convert_to_rfc1123(png_timep) is provided to convert from PNG -time to an RFC 1123 format string. - -.SS Writing unknown chunks - -You can use the png_set_unknown_chunks function to queue up chunks -for writing. You give it a chunk name, raw data, and a size; that's -all there is to it. The chunks will be written by the next following -png_write_info_before_PLTE, png_write_info, or png_write_end function. -Any chunks previously read into the info structure's unknown-chunk -list will also be written out in a sequence that satisfies the PNG -specification's ordering rules. - -.SS The high-level write interface - -At this point there are two ways to proceed; through the high-level -write interface, or through a sequence of low-level write operations. -You can use the high-level interface if your image data is present -in the info structure. All defined output -transformations are permitted, enabled by the following masks. - - PNG_TRANSFORM_IDENTITY No transformation - PNG_TRANSFORM_PACKING Pack 1, 2 and 4-bit samples - PNG_TRANSFORM_PACKSWAP Change order of packed - pixels to LSB first - PNG_TRANSFORM_INVERT_MONO Invert monochrome images - PNG_TRANSFORM_SHIFT Normalize pixels to the - sBIT depth - PNG_TRANSFORM_BGR Flip RGB to BGR, RGBA - to BGRA - PNG_TRANSFORM_SWAP_ALPHA Flip RGBA to ARGB or GA - to AG - PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity - to transparency - PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples - PNG_TRANSFORM_STRIP_FILLER Strip out filler bytes. - -If you have valid image data in the info structure (you can use -png_set_rows() to put image data in the info structure), simply do this: - - png_write_png(png_ptr, info_ptr, png_transforms, NULL) - -where png_transforms is an integer containing the bitwise OR of some set of -transformation flags. This call is equivalent to png_write_info(), -followed the set of transformations indicated by the transform mask, -then png_write_image(), and finally png_write_end(). - -(The final parameter of this call is not yet used. Someday it might point -to transformation parameters required by some future output transform.) - -You must use png_transforms and not call any png_set_transform() functions -when you use png_write_png(). - -.SS The low-level write interface - -If you are going the low-level route instead, you are now ready to -write all the file information up to the actual image data. You do -this with a call to png_write_info(). - - png_write_info(png_ptr, info_ptr); - -Note that there is one transformation you may need to do before -png_write_info(). In PNG files, the alpha channel in an image is the -level of opacity. If your data is supplied as a level of -transparency, you can invert the alpha channel before you write it, so -that 0 is fully transparent and 255 (in 8-bit or paletted images) or -65535 (in 16-bit images) is fully opaque, with - - png_set_invert_alpha(png_ptr); - -This must appear before png_write_info() instead of later with the -other transformations because in the case of paletted images the tRNS -chunk data has to be inverted before the tRNS chunk is written. If -your image is not a paletted image, the tRNS data (which in such cases -represents a single color to be rendered as transparent) won't need to -be changed, and you can safely do this transformation after your -png_write_info() call. - -If you need to write a private chunk that you want to appear before -the PLTE chunk when PLTE is present, you can write the PNG info in -two steps, and insert code to write your own chunk between them: - - png_write_info_before_PLTE(png_ptr, info_ptr); - png_set_unknown_chunks(png_ptr, info_ptr, ...); - png_write_info(png_ptr, info_ptr); - -After you've written the file information, you can set up the library -to handle any special transformations of the image data. The various -ways to transform the data will be described in the order that they -should occur. This is important, as some of these change the color -type and/or bit depth of the data, and some others only work on -certain color types and bit depths. Even though each transformation -checks to see if it has data that it can do something with, you should -make sure to only enable a transformation if it will be valid for the -data. For example, don't swap red and blue on grayscale data. - -PNG files store RGB pixels packed into 3 or 6 bytes. This code tells -the library to strip input data that has 4 or 8 bytes per pixel down -to 3 or 6 bytes (or strip 2 or 4-byte grayscale+filler data to 1 or 2 -bytes per pixel). - - png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE); - -where the 0 is unused, and the location is either PNG_FILLER_BEFORE or -PNG_FILLER_AFTER, depending upon whether the filler byte in the pixel -is stored XRGB or RGBX. - -PNG files pack pixels of bit depths 1, 2, and 4 into bytes as small as -they can, resulting in, for example, 8 pixels per byte for 1 bit files. -If the data is supplied at 1 pixel per byte, use this code, which will -correctly pack the pixels into a single byte: - - png_set_packing(png_ptr); - -PNG files reduce possible bit depths to 1, 2, 4, 8, and 16. If your -data is of another bit depth, you can write an sBIT chunk into the -file so that decoders can recover the original data if desired. - - /* Set the true bit depth of the image data */ - if (color_type & PNG_COLOR_MASK_COLOR) - { - sig_bit.red = true_bit_depth; - sig_bit.green = true_bit_depth; - sig_bit.blue = true_bit_depth; - } - else - { - sig_bit.gray = true_bit_depth; - } - if (color_type & PNG_COLOR_MASK_ALPHA) - { - sig_bit.alpha = true_bit_depth; - } - - png_set_sBIT(png_ptr, info_ptr, &sig_bit); - -If the data is stored in the row buffer in a bit depth other than -one supported by PNG (e.g. 3 bit data in the range 0-7 for a 4-bit PNG), -this will scale the values to appear to be the correct bit depth as -is required by PNG. - - png_set_shift(png_ptr, &sig_bit); - -PNG files store 16 bit pixels in network byte order (big-endian, -ie. most significant bits first). This code would be used if they are -supplied the other way (little-endian, i.e. least significant bits -first, the way PCs store them): - - if (bit_depth > 8) - png_set_swap(png_ptr); - -If you are using packed-pixel images (1, 2, or 4 bits/pixel), and you -need to change the order the pixels are packed into bytes, you can use: - - if (bit_depth < 8) - png_set_packswap(png_ptr); - -PNG files store 3 color pixels in red, green, blue order. This code -would be used if they are supplied as blue, green, red: - - png_set_bgr(png_ptr); - -PNG files describe monochrome as black being zero and white being -one. This code would be used if the pixels are supplied with this reversed -(black being one and white being zero): - - png_set_invert_mono(png_ptr); - -Finally, you can write your own transformation function if none of -the existing ones meets your needs. This is done by setting a callback -with - - png_set_write_user_transform_fn(png_ptr, - write_transform_fn); - -You must supply the function - - void write_transform_fn(png_ptr ptr, row_info_ptr - row_info, png_bytep data) - -See pngtest.c for a working example. Your function will be called -before any of the other transformations are processed. - -You can also set up a pointer to a user structure for use by your -callback function. - - png_set_user_transform_info(png_ptr, user_ptr, 0, 0); - -The user_channels and user_depth parameters of this function are ignored -when writing; you can set them to zero as shown. - -You can retrieve the pointer via the function png_get_user_transform_ptr(). -For example: - - voidp write_user_transform_ptr = - png_get_user_transform_ptr(png_ptr); - -It is possible to have libpng flush any pending output, either manually, -or automatically after a certain number of lines have been written. To -flush the output stream a single time call: - - png_write_flush(png_ptr); - -and to have libpng flush the output stream periodically after a certain -number of scanlines have been written, call: - - png_set_flush(png_ptr, nrows); - -Note that the distance between rows is from the last time png_write_flush() -was called, or the first row of the image if it has never been called. -So if you write 50 lines, and then png_set_flush 25, it will flush the -output on the next scanline, and every 25 lines thereafter, unless -png_write_flush() is called before 25 more lines have been written. -If nrows is too small (less than about 10 lines for a 640 pixel wide -RGB image) the image compression may decrease noticeably (although this -may be acceptable for real-time applications). Infrequent flushing will -only degrade the compression performance by a few percent over images -that do not use flushing. - -.SS Writing the image data - -That's it for the transformations. Now you can write the image data. -The simplest way to do this is in one function call. If you have the -whole image in memory, you can just call png_write_image() and libpng -will write the image. You will need to pass in an array of pointers to -each row. This function automatically handles interlacing, so you don't -need to call png_set_interlace_handling() or call this function multiple -times, or any of that other stuff necessary with png_write_rows(). - - png_write_image(png_ptr, row_pointers); - -where row_pointers is: - - png_byte *row_pointers[height]; - -You can point to void or char or whatever you use for pixels. - -If you don't want to write the whole image at once, you can -use png_write_rows() instead. If the file is not interlaced, -this is simple: - - png_write_rows(png_ptr, row_pointers, - number_of_rows); - -row_pointers is the same as in the png_write_image() call. - -If you are just writing one row at a time, you can do this with -a single row_pointer instead of an array of row_pointers: - - png_bytep row_pointer = row; - - png_write_row(png_ptr, row_pointer); - -When the file is interlaced, things can get a good deal more -complicated. The only currently (as of the PNG Specification -version 1.2, dated July 1999) defined interlacing scheme for PNG files -is the "Adam7" interlace scheme, that breaks down an -image into seven smaller images of varying size. libpng will build -these images for you, or you can do them yourself. If you want to -build them yourself, see the PNG specification for details of which -pixels to write when. - -If you don't want libpng to handle the interlacing details, just -use png_set_interlace_handling() and call png_write_rows() the -correct number of times to write all seven sub-images. - -If you want libpng to build the sub-images, call this before you start -writing any rows: - - number_of_passes = - png_set_interlace_handling(png_ptr); - -This will return the number of passes needed. Currently, this -is seven, but may change if another interlace type is added. - -Then write the complete image number_of_passes times. - - png_write_rows(png_ptr, row_pointers, - number_of_rows); - -As some of these rows are not used, and thus return immediately, -you may want to read about interlacing in the PNG specification, -and only update the rows that are actually used. - -.SS Finishing a sequential write - -After you are finished writing the image, you should finish writing -the file. If you are interested in writing comments or time, you should -pass an appropriately filled png_info pointer. If you are not interested, -you can pass NULL. - - png_write_end(png_ptr, info_ptr); - -When you are done, you can free all memory used by libpng like this: - - png_destroy_write_struct(&png_ptr, &info_ptr); - -It is also possible to individually free the info_ptr members that -point to libpng-allocated storage with the following function: - - png_free_data(png_ptr, info_ptr, mask, seq) - mask - identifies data to be freed, a mask - containing the bitwise OR of one or - more of - PNG_FREE_PLTE, PNG_FREE_TRNS, - PNG_FREE_HIST, PNG_FREE_ICCP, - PNG_FREE_PCAL, PNG_FREE_ROWS, - PNG_FREE_SCAL, PNG_FREE_SPLT, - PNG_FREE_TEXT, PNG_FREE_UNKN, - or simply PNG_FREE_ALL - seq - sequence number of item to be freed - (-1 for all items) - -This function may be safely called when the relevant storage has -already been freed, or has not yet been allocated, or was allocated -by the user and not by libpng, and will in those -cases do nothing. The "seq" parameter is ignored if only one item -of the selected data type, such as PLTE, is allowed. If "seq" is not --1, and multiple items are allowed for the data type identified in -the mask, such as text or sPLT, only the n'th item in the structure -is freed, where n is "seq". - -If you allocated data such as a palette that you passed -in to libpng with png_set_*, you must not free it until just before the call to -png_destroy_write_struct(). - -The default behavior is only to free data that was allocated internally -by libpng. This can be changed, so that libpng will not free the data, -or so that it will free data that was allocated by the user with png_malloc() -or png_zalloc() and passed in via a png_set_*() function, with - - png_data_freer(png_ptr, info_ptr, freer, mask) - mask - which data elements are affected - same choices as in png_free_data() - freer - one of - PNG_DESTROY_WILL_FREE_DATA - PNG_SET_WILL_FREE_DATA - PNG_USER_WILL_FREE_DATA - -For example, to transfer responsibility for some data from a read structure -to a write structure, you could use - - png_data_freer(read_ptr, read_info_ptr, - PNG_USER_WILL_FREE_DATA, - PNG_FREE_PLTE|PNG_FREE_tRNS|PNG_FREE_hIST) - png_data_freer(write_ptr, write_info_ptr, - PNG_DESTROY_WILL_FREE_DATA, - PNG_FREE_PLTE|PNG_FREE_tRNS|PNG_FREE_hIST) - -thereby briefly reassigning responsibility for freeing to the user but -immediately afterwards reassigning it once more to the write_destroy -function. Having done this, it would then be safe to destroy the read -structure and continue to use the PLTE, tRNS, and hIST data in the write -structure. - -This function only affects data that has already been allocated. -You can call this function before calling after the png_set_*() functions -to control whether the user or png_destroy_*() is supposed to free the data. -When the user assumes responsibility for libpng-allocated data, the -application must use -png_free() to free it, and when the user transfers responsibility to libpng -for data that the user has allocated, the user must have used png_malloc() -or png_zalloc() to allocate it. - -If you allocated text_ptr.text, text_ptr.lang, and text_ptr.translated_keyword -separately, do not transfer responsibility for freeing text_ptr to libpng, -because when libpng fills a png_text structure it combines these members with -the key member, and png_free_data() will free only text_ptr.key. Similarly, -if you transfer responsibility for free'ing text_ptr from libpng to your -application, your application must not separately free those members. -For a more compact example of writing a PNG image, see the file example.c. - -.SH V. Modifying/Customizing libpng: - -There are three issues here. The first is changing how libpng does -standard things like memory allocation, input/output, and error handling. -The second deals with more complicated things like adding new chunks, -adding new transformations, and generally changing how libpng works. -Both of those are compile-time issues; that is, they are generally -determined at the time the code is written, and there is rarely a need -to provide the user with a means of changing them. The third is a -run-time issue: choosing between and/or tuning one or more alternate -versions of computationally intensive routines; specifically, optimized -assembly-language (and therefore compiler- and platform-dependent) -versions. - -Memory allocation, input/output, and error handling - -All of the memory allocation, input/output, and error handling in libpng -goes through callbacks that are user-settable. The default routines are -in pngmem.c, pngrio.c, pngwio.c, and pngerror.c, respectively. To change -these functions, call the appropriate png_set_*_fn() function. - -Memory allocation is done through the functions png_malloc() -and png_free(). These currently just call the standard C functions. If -your pointers can't access more then 64K at a time, you will want to set -MAXSEG_64K in zlib.h. Since it is unlikely that the method of handling -memory allocation on a platform will change between applications, these -functions must be modified in the library at compile time. If you prefer -to use a different method of allocating and freeing data, you can use -png_create_read_struct_2() or png_create_write_struct_2() to register -your own functions as described above. -These functions also provide a void pointer that can be retrieved via - - mem_ptr=png_get_mem_ptr(png_ptr); - -Your replacement memory functions must have prototypes as follows: - - png_voidp malloc_fn(png_structp png_ptr, - png_size_t size); - void free_fn(png_structp png_ptr, png_voidp ptr); - -Your malloc_fn() must return NULL in case of failure. The png_malloc() -function will normally call png_error() if it receives a NULL from the -system memory allocator or from your replacement malloc_fn(). - -Input/Output in libpng is done through png_read() and png_write(), -which currently just call fread() and fwrite(). The FILE * is stored in -png_struct and is initialized via png_init_io(). If you wish to change -the method of I/O, the library supplies callbacks that you can set -through the function png_set_read_fn() and png_set_write_fn() at run -time, instead of calling the png_init_io() function. These functions -also provide a void pointer that can be retrieved via the function -png_get_io_ptr(). For example: - - png_set_read_fn(png_structp read_ptr, - voidp read_io_ptr, png_rw_ptr read_data_fn) - - png_set_write_fn(png_structp write_ptr, - voidp write_io_ptr, png_rw_ptr write_data_fn, - png_flush_ptr output_flush_fn); - - voidp read_io_ptr = png_get_io_ptr(read_ptr); - voidp write_io_ptr = png_get_io_ptr(write_ptr); - -The replacement I/O functions must have prototypes as follows: - - void user_read_data(png_structp png_ptr, - png_bytep data, png_size_t length); - void user_write_data(png_structp png_ptr, - png_bytep data, png_size_t length); - void user_flush_data(png_structp png_ptr); - -Supplying NULL for the read, write, or flush functions sets them back -to using the default C stream functions. It is an error to read from -a write stream, and vice versa. - -Error handling in libpng is done through png_error() and png_warning(). -Errors handled through png_error() are fatal, meaning that png_error() -should never return to its caller. Currently, this is handled via -setjmp() and longjmp() (unless you have compiled libpng with -PNG_SETJMP_NOT_SUPPORTED, in which case it is handled via PNG_ABORT()), -but you could change this to do things like exit() if you should wish. - -On non-fatal errors, png_warning() is called -to print a warning message, and then control returns to the calling code. -By default png_error() and png_warning() print a message on stderr via -fprintf() unless the library is compiled with PNG_NO_CONSOLE_IO defined -(because you don't want the messages) or PNG_NO_STDIO defined (because -fprintf() isn't available). If you wish to change the behavior of the error -functions, you will need to set up your own message callbacks. These -functions are normally supplied at the time that the png_struct is created. -It is also possible to redirect errors and warnings to your own replacement -functions after png_create_*_struct() has been called by calling: - - png_set_error_fn(png_structp png_ptr, - png_voidp error_ptr, png_error_ptr error_fn, - png_error_ptr warning_fn); - - png_voidp error_ptr = png_get_error_ptr(png_ptr); - -If NULL is supplied for either error_fn or warning_fn, then the libpng -default function will be used, calling fprintf() and/or longjmp() if a -problem is encountered. The replacement error functions should have -parameters as follows: - - void user_error_fn(png_structp png_ptr, - png_const_charp error_msg); - void user_warning_fn(png_structp png_ptr, - png_const_charp warning_msg); - -The motivation behind using setjmp() and longjmp() is the C++ throw and -catch exception handling methods. This makes the code much easier to write, -as there is no need to check every return code of every function call. -However, there are some uncertainties about the status of local variables -after a longjmp, so the user may want to be careful about doing anything after -setjmp returns non-zero besides returning itself. Consult your compiler -documentation for more details. For an alternative approach, you may wish -to use the "cexcept" facility (see http://cexcept.sourceforge.net). - -.SS Custom chunks - -If you need to read or write custom chunks, you may need to get deeper -into the libpng code. The library now has mechanisms for storing -and writing chunks of unknown type; you can even declare callbacks -for custom chunks. However, this may not be good enough if the -library code itself needs to know about interactions between your -chunk and existing `intrinsic' chunks. - -If you need to write a new intrinsic chunk, first read the PNG -specification. Acquire a first level of -understanding of how it works. Pay particular attention to the -sections that describe chunk names, and look at how other chunks were -designed, so you can do things similarly. Second, check out the -sections of libpng that read and write chunks. Try to find a chunk -that is similar to yours and use it as a template. More details can -be found in the comments inside the code. It is best to handle unknown -chunks in a generic method, via callback functions, instead of by -modifying libpng functions. - -If you wish to write your own transformation for the data, look through -the part of the code that does the transformations, and check out some of -the simpler ones to get an idea of how they work. Try to find a similar -transformation to the one you want to add and copy off of it. More details -can be found in the comments inside the code itself. - -.SS Configuring for 16 bit platforms - -You will want to look into zconf.h to tell zlib (and thus libpng) that -it cannot allocate more then 64K at a time. Even if you can, the memory -won't be accessible. So limit zlib and libpng to 64K by defining MAXSEG_64K. - -.SS Configuring for DOS - -For DOS users who only have access to the lower 640K, you will -have to limit zlib's memory usage via a png_set_compression_mem_level() -call. See zlib.h or zconf.h in the zlib library for more information. - -.SS Configuring for Medium Model - -Libpng's support for medium model has been tested on most of the popular -compilers. Make sure MAXSEG_64K gets defined, USE_FAR_KEYWORD gets -defined, and FAR gets defined to far in pngconf.h, and you should be -all set. Everything in the library (except for zlib's structure) is -expecting far data. You must use the typedefs with the p or pp on -the end for pointers (or at least look at them and be careful). Make -note that the rows of data are defined as png_bytepp, which is an -unsigned char far * far *. - -.SS Configuring for gui/windowing platforms: - -You will need to write new error and warning functions that use the GUI -interface, as described previously, and set them to be the error and -warning functions at the time that png_create_*_struct() is called, -in order to have them available during the structure initialization. -They can be changed later via png_set_error_fn(). On some compilers, -you may also have to change the memory allocators (png_malloc, etc.). - -.SS Configuring for compiler xxx: - -All includes for libpng are in pngconf.h. If you need to add/change/delete -an include, this is the place to do it. The includes that are not -needed outside libpng are protected by the PNG_INTERNAL definition, -which is only defined for those routines inside libpng itself. The -files in libpng proper only include png.h, which includes pngconf.h. - -.SS Configuring zlib: - -There are special functions to configure the compression. Perhaps the -most useful one changes the compression level, which currently uses -input compression values in the range 0 - 9. The library normally -uses the default compression level (Z_DEFAULT_COMPRESSION = 6). Tests -have shown that for a large majority of images, compression values in -the range 3-6 compress nearly as well as higher levels, and do so much -faster. For online applications it may be desirable to have maximum speed -(Z_BEST_SPEED = 1). With versions of zlib after v0.99, you can also -specify no compression (Z_NO_COMPRESSION = 0), but this would create -files larger than just storing the raw bitmap. You can specify the -compression level by calling: - - png_set_compression_level(png_ptr, level); - -Another useful one is to reduce the memory level used by the library. -The memory level defaults to 8, but it can be lowered if you are -short on memory (running DOS, for example, where you only have 640K). -Note that the memory level does have an effect on compression; among -other things, lower levels will result in sections of incompressible -data being emitted in smaller stored blocks, with a correspondingly -larger relative overhead of up to 15% in the worst case. - - png_set_compression_mem_level(png_ptr, level); - -The other functions are for configuring zlib. They are not recommended -for normal use and may result in writing an invalid PNG file. See -zlib.h for more information on what these mean. - - png_set_compression_strategy(png_ptr, - strategy); - png_set_compression_window_bits(png_ptr, - window_bits); - png_set_compression_method(png_ptr, method); - png_set_compression_buffer_size(png_ptr, size); - -.SS Controlling row filtering - -If you want to control whether libpng uses filtering or not, which -filters are used, and how it goes about picking row filters, you -can call one of these functions. The selection and configuration -of row filters can have a significant impact on the size and -encoding speed and a somewhat lesser impact on the decoding speed -of an image. Filtering is enabled by default for RGB and grayscale -images (with and without alpha), but not for paletted images nor -for any images with bit depths less than 8 bits/pixel. - -The 'method' parameter sets the main filtering method, which is -currently only '0' in the PNG 1.2 specification. The 'filters' -parameter sets which filter(s), if any, should be used for each -scanline. Possible values are PNG_ALL_FILTERS and PNG_NO_FILTERS -to turn filtering on and off, respectively. - -Individual filter types are PNG_FILTER_NONE, PNG_FILTER_SUB, -PNG_FILTER_UP, PNG_FILTER_AVG, PNG_FILTER_PAETH, which can be bitwise -ORed together with '|' to specify one or more filters to use. -These filters are described in more detail in the PNG specification. -If you intend to change the filter type during the course of writing -the image, you should start with flags set for all of the filters -you intend to use so that libpng can initialize its internal -structures appropriately for all of the filter types. (Note that this -means the first row must always be adaptively filtered, because libpng -currently does not allocate the filter buffers until png_write_row() -is called for the first time.) - - filters = PNG_FILTER_NONE | PNG_FILTER_SUB - PNG_FILTER_UP | PNG_FILTER_AVE | - PNG_FILTER_PAETH | PNG_ALL_FILTERS; - - png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE, - filters); - The second parameter can also be - PNG_INTRAPIXEL_DIFFERENCING if you are - writing a PNG to be embedded in a MNG - datastream. This parameter must be the - same as the value of filter_method used - in png_set_IHDR(). - -It is also possible to influence how libpng chooses from among the -available filters. This is done in one or both of two ways - by -telling it how important it is to keep the same filter for successive -rows, and by telling it the relative computational costs of the filters. - - double weights[3] = {1.5, 1.3, 1.1}, - costs[PNG_FILTER_VALUE_LAST] = - {1.0, 1.3, 1.3, 1.5, 1.7}; - - png_set_filter_heuristics(png_ptr, - PNG_FILTER_HEURISTIC_WEIGHTED, 3, - weights, costs); - -The weights are multiplying factors that indicate to libpng that the -row filter should be the same for successive rows unless another row filter -is that many times better than the previous filter. In the above example, -if the previous 3 filters were SUB, SUB, NONE, the SUB filter could have a -"sum of absolute differences" 1.5 x 1.3 times higher than other filters -and still be chosen, while the NONE filter could have a sum 1.1 times -higher than other filters and still be chosen. Unspecified weights are -taken to be 1.0, and the specified weights should probably be declining -like those above in order to emphasize recent filters over older filters. - -The filter costs specify for each filter type a relative decoding cost -to be considered when selecting row filters. This means that filters -with higher costs are less likely to be chosen over filters with lower -costs, unless their "sum of absolute differences" is that much smaller. -The costs do not necessarily reflect the exact computational speeds of -the various filters, since this would unduly influence the final image -size. - -Note that the numbers above were invented purely for this example and -are given only to help explain the function usage. Little testing has -been done to find optimum values for either the costs or the weights. - -.SS Removing unwanted object code - -There are a bunch of #define's in pngconf.h that control what parts of -libpng are compiled. All the defines end in _SUPPORTED. If you are -never going to use a capability, you can change the #define to #undef -before recompiling libpng and save yourself code and data space, or -you can turn off individual capabilities with defines that begin with -PNG_NO_. - -You can also turn all of the transforms and ancillary chunk capabilities -off en masse with compiler directives that define -PNG_NO_READ[or WRITE]_TRANSFORMS, or PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS, -or all four, -along with directives to turn on any of the capabilities that you do -want. The PNG_NO_READ[or WRITE]_TRANSFORMS directives disable -the extra transformations but still leave the library fully capable of reading -and writing PNG files with all known public chunks -Use of the PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS directive -produces a library that is incapable of reading or writing ancillary chunks. -If you are not using the progressive reading capability, you can -turn that off with PNG_NO_PROGRESSIVE_READ (don't confuse -this with the INTERLACING capability, which you'll still have). - -All the reading and writing specific code are in separate files, so the -linker should only grab the files it needs. However, if you want to -make sure, or if you are building a stand alone library, all the -reading files start with pngr and all the writing files start with -pngw. The files that don't match either (like png.c, pngtrans.c, etc.) -are used for both reading and writing, and always need to be included. -The progressive reader is in pngpread.c - -If you are creating or distributing a dynamically linked library (a .so -or DLL file), you should not remove or disable any parts of the library, -as this will cause applications linked with different versions of the -library to fail if they call functions not available in your library. -The size of the library itself should not be an issue, because only -those sections that are actually used will be loaded into memory. - -.SS Requesting debug printout - -The macro definition PNG_DEBUG can be used to request debugging -printout. Set it to an integer value in the range 0 to 3. Higher -numbers result in increasing amounts of debugging information. The -information is printed to the "stderr" file, unless another file -name is specified in the PNG_DEBUG_FILE macro definition. - -When PNG_DEBUG > 0, the following functions (macros) become available: - - png_debug(level, message) - png_debug1(level, message, p1) - png_debug2(level, message, p1, p2) - -in which "level" is compared to PNG_DEBUG to decide whether to print -the message, "message" is the formatted string to be printed, -and p1 and p2 are parameters that are to be embedded in the string -according to printf-style formatting directives. For example, - - png_debug1(2, "foo=%d\n", foo); - -is expanded to - - if(PNG_DEBUG > 2) - fprintf(PNG_DEBUG_FILE, "foo=%d\n", foo); - -When PNG_DEBUG is defined but is zero, the macros aren't defined, but you -can still use PNG_DEBUG to control your own debugging: - - #ifdef PNG_DEBUG - fprintf(stderr, ... - #endif - -When PNG_DEBUG = 1, the macros are defined, but only png_debug statements -having level = 0 will be printed. There aren't any such statements in -this version of libpng, but if you insert some they will be printed. - -.SH VI. Runtime optimization - -A new feature in libpng 1.2.0 is the ability to dynamically switch between -standard and optimized versions of some routines. Currently these are -limited to three computationally intensive tasks when reading PNG files: -decoding row filters, expanding interlacing, and combining interlaced or -transparent row data with previous row data. Currently the optimized -versions are available only for x86 (Intel, AMD, etc.) platforms with -MMX support, though this may change in future versions. (For example, -the non-MMX assembler optimizations for zlib might become similarly -runtime-selectable in future releases, in which case libpng could be -extended to support them. Alternatively, the compile-time choice of -floating-point versus integer routines for gamma correction might become -runtime-selectable.) - -Because such optimizations tend to be very platform- and compiler-dependent, -both in how they are written and in how they perform, the new runtime code -in libpng has been written to allow programs to query, enable, and disable -either specific optimizations or all such optimizations. For example, to -enable all possible optimizations (bearing in mind that some "optimizations" -may actually run more slowly in rare cases): - - #if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200) - png_uint_32 mask, flags; - - flags = png_get_asm_flags(png_ptr); - mask = png_get_asm_flagmask(PNG_SELECT_READ | PNG_SELECT_WRITE); - png_set_asm_flags(png_ptr, flags | mask); - #endif - -To enable only optimizations relevant to reading PNGs, use PNG_SELECT_READ -by itself when calling png_get_asm_flagmask(); similarly for optimizing -only writing. To disable all optimizations: - - #if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200) - flags = png_get_asm_flags(png_ptr); - mask = png_get_asm_flagmask(PNG_SELECT_READ | PNG_SELECT_WRITE); - png_set_asm_flags(png_ptr, flags & ~mask); - #endif - -To enable or disable only MMX-related features, use png_get_mmx_flagmask() -in place of png_get_asm_flagmask(). The mmx version takes one additional -parameter: - - #if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200) - int selection = PNG_SELECT_READ | PNG_SELECT_WRITE; - int compilerID; - - mask = png_get_mmx_flagmask(selection, &compilerID); - #endif - -On return, compilerID will indicate which version of the MMX assembler -optimizations was compiled. Currently two flavors exist: Microsoft -Visual C++ (compilerID == 1) and GNU C (a.k.a. gcc/gas, compilerID == 2). -On non-x86 platforms or on systems compiled without MMX optimizations, a -value of -1 is used. - -Note that both png_get_asm_flagmask() and png_get_mmx_flagmask() return -all valid, settable optimization bits for the version of the library that's -currently in use. In the case of shared (dynamically linked) libraries, -this may include optimizations that did not exist at the time the code was -written and compiled. It is also possible, of course, to enable only known, -specific optimizations; for example: - - #if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200) - flags = PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \ - | PNG_ASM_FLAG_MMX_READ_INTERLACE \ - | PNG_ASM_FLAG_MMX_READ_FILTER_SUB \ - | PNG_ASM_FLAG_MMX_READ_FILTER_UP \ - | PNG_ASM_FLAG_MMX_READ_FILTER_AVG \ - | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ; - png_set_asm_flags(png_ptr, flags); - #endif - -This method would enable only the MMX read-optimizations available at the -time of libpng 1.2.0's release, regardless of whether a later version of -the DLL were actually being used. (Also note that these functions did not -exist in versions older than 1.2.0, so any attempt to run a dynamically -linked app on such an older version would fail.) - -To determine whether the processor supports MMX instructions at all, use -the png_mmx_support() function: - - #if defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200) - mmxsupport = png_mmx_support(); - #endif - -It returns -1 if MMX support is not compiled into libpng, 0 if MMX code -is compiled but MMX is not supported by the processor, or 1 if MMX support -is fully available. Note that png_mmx_support(), png_get_mmx_flagmask(), -and png_get_asm_flagmask() all may be called without allocating and ini- -tializing any PNG structures (for example, as part of a usage screen or -"about" box). - -The following code can be used to prevent an application from using the -thread_unsafe features, even if libpng was built with PNG_THREAD_UNSAFE_OK -defined: - -#if defined(PNG_USE_PNGGCCRD) && defined(PNG_ASSEMBLER_CODE_SUPPORTED) \ - && defined(PNG_THREAD_UNSAFE_OK) - /* Disable thread-unsafe features of pnggccrd */ - if (png_access_version_number() >= 10200) - { - png_uint_32 mmx_disable_mask = 0; - png_uint_32 asm_flags; - - mmx_disable_mask |= ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \ - | PNG_ASM_FLAG_MMX_READ_FILTER_SUB \ - | PNG_ASM_FLAG_MMX_READ_FILTER_AVG \ - | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ); - asm_flags = png_get_asm_flags(png_ptr); - png_set_asm_flags(png_ptr, asm_flags & ~mmx_disable_mask); - } -#endif - -For more extensive examples of runtime querying, enabling and disabling -of optimized features, see contrib/gregbook/readpng2.c in the libpng -source-code distribution. - -.SH VII. MNG support - -The MNG specification (available at http://www.libpng.org/pub/mng) allows -certain extensions to PNG for PNG images that are embedded in MNG datastreams. -Libpng can support some of these extensions. To enable them, use the -png_permit_mng_features() function: - - feature_set = png_permit_mng_features(png_ptr, mask) - mask is a png_uint_32 containing the bitwise OR of the - features you want to enable. These include - PNG_FLAG_MNG_EMPTY_PLTE - PNG_FLAG_MNG_FILTER_64 - PNG_ALL_MNG_FEATURES - feature_set is a png_uint_32 that is the bitwise AND of - your mask with the set of MNG features that is - supported by the version of libpng that you are using. - -It is an error to use this function when reading or writing a standalone -PNG file with the PNG 8-byte signature. The PNG datastream must be wrapped -in a MNG datastream. As a minimum, it must have the MNG 8-byte signature -and the MHDR and MEND chunks. Libpng does not provide support for these -or any other MNG chunks; your application must provide its own support for -them. You may wish to consider using libmng (available at -http://www.libmng.com) instead. - -.SH VIII. Changes to Libpng from version 0.88 - -It should be noted that versions of libpng later than 0.96 are not -distributed by the original libpng author, Guy Schalnat, nor by -Andreas Dilger, who had taken over from Guy during 1996 and 1997, and -distributed versions 0.89 through 0.96, but rather by another member -of the original PNG Group, Glenn Randers-Pehrson. Guy and Andreas are -still alive and well, but they have moved on to other things. - -The old libpng functions png_read_init(), png_write_init(), -png_info_init(), png_read_destroy(), and png_write_destroy() have been -moved to PNG_INTERNAL in version 0.95 to discourage their use. These -functions will be removed from libpng version 2.0.0. - -The preferred method of creating and initializing the libpng structures is -via the png_create_read_struct(), png_create_write_struct(), and -png_create_info_struct() because they isolate the size of the structures -from the application, allow version error checking, and also allow the -use of custom error handling routines during the initialization, which -the old functions do not. The functions png_read_destroy() and -png_write_destroy() do not actually free the memory that libpng -allocated for these structs, but just reset the data structures, so they -can be used instead of png_destroy_read_struct() and -png_destroy_write_struct() if you feel there is too much system overhead -allocating and freeing the png_struct for each image read. - -Setting the error callbacks via png_set_message_fn() before -png_read_init() as was suggested in libpng-0.88 is no longer supported -because this caused applications that do not use custom error functions -to fail if the png_ptr was not initialized to zero. It is still possible -to set the error callbacks AFTER png_read_init(), or to change them with -png_set_error_fn(), which is essentially the same function, but with a new -name to force compilation errors with applications that try to use the old -method. - -Starting with version 1.0.7, you can find out which version of the library -you are using at run-time: - - png_uint_32 libpng_vn = png_access_version_number(); - -The number libpng_vn is constructed from the major version, minor -version with leading zero, and release number with leading zero, -(e.g., libpng_vn for version 1.0.7 is 10007). - -You can also check which version of png.h you used when compiling your -application: - - png_uint_32 application_vn = PNG_LIBPNG_VER; - -.SH IX. Y2K Compliance in libpng - -May 15, 2007 - -Since the PNG Development group is an ad-hoc body, we can't make -an official declaration. - -This is your unofficial assurance that libpng from version 0.71 and -upward through 1.2.18 are Y2K compliant. It is my belief that earlier -versions were also Y2K compliant. - -Libpng only has three year fields. One is a 2-byte unsigned integer that -will hold years up to 65535. The other two hold the date in text -format, and will hold years up to 9999. - -The integer is - "png_uint_16 year" in png_time_struct. - -The strings are - "png_charp time_buffer" in png_struct and - "near_time_buffer", which is a local character string in png.c. - -There are seven time-related functions: - - png_convert_to_rfc_1123() in png.c - (formerly png_convert_to_rfc_1152() in error) - png_convert_from_struct_tm() in pngwrite.c, called - in pngwrite.c - png_convert_from_time_t() in pngwrite.c - png_get_tIME() in pngget.c - png_handle_tIME() in pngrutil.c, called in pngread.c - png_set_tIME() in pngset.c - png_write_tIME() in pngwutil.c, called in pngwrite.c - -All appear to handle dates properly in a Y2K environment. The -png_convert_from_time_t() function calls gmtime() to convert from system -clock time, which returns (year - 1900), which we properly convert to -the full 4-digit year. There is a possibility that applications using -libpng are not passing 4-digit years into the png_convert_to_rfc_1123() -function, or that they are incorrectly passing only a 2-digit year -instead of "year - 1900" into the png_convert_from_struct_tm() function, -but this is not under our control. The libpng documentation has always -stated that it works with 4-digit years, and the APIs have been -documented as such. - -The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned -integer to hold the year, and can hold years as large as 65535. - -zlib, upon which libpng depends, is also Y2K compliant. It contains -no date-related code. - - - Glenn Randers-Pehrson - libpng maintainer - PNG Development Group - -.SH NOTE - -Note about libpng version numbers: - -Due to various miscommunications, unforeseen code incompatibilities -and occasional factors outside the authors' control, version numbering -on the library has not always been consistent and straightforward. -The following table summarizes matters since version 0.89c, which was -the first widely used release: - - source png.h png.h shared-lib - version string int version - ------- ------ ----- ---------- - 0.89c ("beta 3") 0.89 89 1.0.89 - 0.90 ("beta 4") 0.90 90 0.90 - 0.95 ("beta 5") 0.95 95 0.95 - 0.96 ("beta 6") 0.96 96 0.96 - 0.97b ("beta 7") 1.00.97 97 1.0.1 - 0.97c 0.97 97 2.0.97 - 0.98 0.98 98 2.0.98 - 0.99 0.99 98 2.0.99 - 0.99a-m 0.99 99 2.0.99 - 1.00 1.00 100 2.1.0 - 1.0.0 1.0.0 100 2.1.0 - 1.0.0 (from here on, the 100 2.1.0 - 1.0.1 png.h string is 10001 2.1.0 - 1.0.1a-e identical to the 10002 from here on, the - 1.0.2 source version) 10002 shared library is 2.V - 1.0.2a-b 10003 where V is the source - 1.0.1 10001 code version except as - 1.0.1a-e 10002 2.1.0.1a-e noted. - 1.0.2 10002 2.1.0.2 - 1.0.2a-b 10003 2.1.0.2a-b - 1.0.3 10003 2.1.0.3 - 1.0.3a-d 10004 2.1.0.3a-d - 1.0.4 10004 2.1.0.4 - 1.0.4a-f 10005 2.1.0.4a-f - 1.0.5 (+ 2 patches) 10005 2.1.0.5 - 1.0.5a-d 10006 2.1.0.5a-d - 1.0.5e-r 10100 2.1.0.5e-r - 1.0.5s-v 10006 2.1.0.5s-v - 1.0.6 (+ 3 patches) 10006 2.1.0.6 - 1.0.6d-g 10007 2.1.0.6d-g - 1.0.6h 10007 10.6h - 1.0.6i 10007 10.6i - 1.0.6j 10007 2.1.0.6j - 1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 - 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 - 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 - 1.0.7 1 10007 2.1.0.7 - 1.0.8beta1-4 1 10008 2.1.0.8beta1-4 - 1.0.8rc1 1 10008 2.1.0.8rc1 - 1.0.8 1 10008 2.1.0.8 - 1.0.9beta1-6 1 10009 2.1.0.9beta1-6 - 1.0.9rc1 1 10009 2.1.0.9rc1 - 1.0.9beta7-10 1 10009 2.1.0.9beta7-10 - 1.0.9rc2 1 10009 2.1.0.9rc2 - 1.0.9 1 10009 2.1.0.9 - 1.0.10beta1 1 10010 2.1.0.10beta1 - 1.0.10rc1 1 10010 2.1.0.10rc1 - 1.0.10 1 10010 2.1.0.10 - 1.0.11beta1-3 1 10011 2.1.0.11beta1-3 - 1.0.11rc1 1 10011 2.1.0.11rc1 - 1.0.11 1 10011 2.1.0.11 - 1.0.12beta1-2 2 10012 2.1.0.12beta1-2 - 1.0.12rc1 2 10012 2.1.0.12rc1 - 1.0.12 2 10012 2.1.0.12 - 1.1.0a-f - 10100 2.1.1.0a-f abandoned - 1.2.0beta1-2 2 10200 2.1.2.0beta1-2 - 1.2.0beta3-5 3 10200 3.1.2.0beta3-5 - 1.2.0rc1 3 10200 3.1.2.0rc1 - 1.2.0 3 10200 3.1.2.0 - 1.2.1beta-4 3 10201 3.1.2.1beta1-4 - 1.2.1rc1-2 3 10201 3.1.2.1rc1-2 - 1.2.1 3 10201 3.1.2.1 - 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6 - 1.0.13beta1 10 10013 10.so.0.1.0.13beta1 - 1.0.13rc1 10 10013 10.so.0.1.0.13rc1 - 1.2.2rc1 12 10202 12.so.0.1.2.2rc1 - 1.0.13 10 10013 10.so.0.1.0.13 - 1.2.2 12 10202 12.so.0.1.2.2 - 1.2.3rc1-6 12 10203 12.so.0.1.2.3rc1-6 - 1.2.3 12 10203 12.so.0.1.2.3 - 1.2.4beta1-3 13 10204 12.so.0.1.2.4beta1-3 - 1.2.4rc1 13 10204 12.so.0.1.2.4rc1 - 1.0.14 10 10014 10.so.0.1.0.14 - 1.2.4 13 10204 12.so.0.1.2.4 - 1.2.5beta1-2 13 10205 12.so.0.1.2.5beta1-2 - 1.0.15rc1 10 10015 10.so.0.1.0.15rc1 - 1.0.15 10 10015 10.so.0.1.0.15 - 1.2.5 13 10205 12.so.0.1.2.5 - 1.2.6beta1-4 13 10206 12.so.0.1.2.6beta1-4 - 1.2.6rc1-5 13 10206 12.so.0.1.2.6rc1-5 - 1.0.16 10 10016 10.so.0.1.0.16 - 1.2.6 13 10206 12.so.0.1.2.6 - 1.2.7beta1-2 13 10207 12.so.0.1.2.7beta1-2 - 1.0.17rc1 10 10017 10.so.0.1.0.17rc1 - 1.2.7rc1 13 10207 12.so.0.1.2.7rc1 - 1.0.17 10 10017 10.so.0.1.0.17 - 1.2.7 13 10207 12.so.0.1.2.7 - 1.2.8beta1-5 13 10208 12.so.0.1.2.8beta1-5 - 1.0.18rc1-5 10 10018 10.so.0.1.0.18rc1-5 - 1.2.8rc1-5 13 10208 12.so.0.1.2.8rc1-5 - 1.0.18 10 10018 10.so.0.1.0.18 - 1.2.8 13 10208 12.so.0.1.2.8 - 1.2.9beta1-3 13 10209 12.so.0.1.2.9beta1-3 - 1.2.9beta4-11 13 10209 12.so.0.9[.0] - 1.2.9rc1 13 10209 12.so.0.9[.0] - 1.2.9 13 10209 12.so.0.9[.0] - 1.2.10beta1-8 13 10210 12.so.0.10[.0] - 1.2.10rc1-3 13 10210 12.so.0.10[.0] - 1.2.10 13 10210 12.so.0.10[.0] - 1.2.11beta1-4 13 10211 12.so.0.11[.0] - 1.0.19rc1-5 10 10019 10.so.0.19[.0] - 1.2.11rc1-5 13 10211 12.so.0.11[.0] - 1.0.19 10 10019 10.so.0.19[.0] - 1.2.11 13 10211 12.so.0.11[.0] - 1.0.20 10 10020 10.so.0.20[.0] - 1.2.12 13 10212 12.so.0.12[.0] - 1.2.13beta1 13 10213 12.so.0.13[.0] - 1.0.21 10 10021 10.so.0.21[.0] - 1.2.13 13 10213 12.so.0.13[.0] - 1.2.14beta1-2 13 10214 12.so.0.14[.0] - 1.0.22rc1 10 10022 10.so.0.22[.0] - 1.2.14rc1 13 10214 12.so.0.14[.0] - 1.2.15beta1-6 13 10215 12.so.0.15[.0] - 1.0.23rc1-5 10 10023 10.so.0.23[.0] - 1.2.15rc1-5 13 10215 12.so.0.15[.0] - 1.0.23 10 10023 10.so.0.23[.0] - 1.2.15 13 10215 12.so.0.15[.0] - 1.2.16beta1-2 13 10216 12.so.0.16[.0] - 1.2.16rc1 13 10216 12.so.0.16[.0] - 1.0.24 10 10024 10.so.0.24[.0] - 1.2.16 13 10216 12.so.0.16[.0] - 1.2.17beta1-2 13 10217 12.so.0.17[.0] - 1.0.25rc1 10 10025 10.so.0.25[.0] - 1.2.17rc1-3 13 10217 12.so.0.17[.0] - 1.0.25 10 10025 10.so.0.25[.0] - 1.2.17 13 10217 12.so.0.17[.0] - 1.0.26 10 10026 10.so.0.26[.0] - 1.2.18 13 10218 12.so.0.18[.0] - -Henceforth the source version will match the shared-library minor -and patch numbers; the shared-library major version number will be -used for changes in backward compatibility, as it is intended. The -PNG_PNGLIB_VER macro, which is not used within libpng but is available -for applications, is an unsigned integer of the form xyyzz corresponding -to the source version x.y.z (leading zeros in y and z). Beta versions -were given the previous public release number plus a letter, until -version 1.0.6j; from then on they were given the upcoming public -release number plus "betaNN" or "rcN". - -.SH "SEE ALSO" -libpngpf(3), png(5) -.LP -.IR libpng : -.IP -http://libpng.sourceforge.net (follow the [DOWNLOAD] link) -http://www.libpng.org/pub/png - -.LP -.IR zlib : -.IP -(generally) at the same location as -.I libpng -or at -.br -ftp://ftp.info-zip.org/pub/infozip/zlib - -.LP -.IR PNG specification: RFC 2083 -.IP -(generally) at the same location as -.I libpng -or at -.br -ftp://ds.internic.net/rfc/rfc2083.txt -.br -or (as a W3C Recommendation) at -.br -http://www.w3.org/TR/REC-png.html - -.LP -In the case of any inconsistency between the PNG specification -and this library, the specification takes precedence. - -.SH AUTHORS -This man page: Glenn Randers-Pehrson - - -The contributing authors would like to thank all those who helped -with testing, bug fixes, and patience. This wouldn't have been -possible without all of you. - -Thanks to Frank J. T. Wojcik for helping with the documentation. - -Libpng version 1.2.18 - May 15, 2007: -Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. -Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net). - -Supported by the PNG development group -.br -png-mng-implement at lists.sf.net -(subscription required; visit -png-mng-implement at lists.sourceforge.net (subscription required; visit -https://lists.sourceforge.net/lists/listinfo/png-mng-implement -to subscribe). - -.SH COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: - -(This copy of the libpng notices is provided for your convenience. In case of -any discrepancy between this copy and the notices in the file png.h that is -included in the libpng distribution, the latter shall prevail.) - -If you modify libpng you may insert additional notices immediately following -this sentence. - -libpng versions 1.2.6, August 15, 2004, through 1.2.18, May 15, 2007, are -Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are -distributed according to the same disclaimer and license as libpng-1.2.5 -with the following individual added to the list of Contributing Authors - - Cosmin Truta - -libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are -Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are -distributed according to the same disclaimer and license as libpng-1.0.6 -with the following individuals added to the list of Contributing Authors - - Simon-Pierre Cadieux - Eric S. Raymond - Gilles Vollant - -and with the following additions to the disclaimer: - - There is no warranty against interference with your - enjoyment of the library or against infringement. - There is no warranty that our efforts or the library - will fulfill any of your particular purposes or needs. - This library is provided with all faults, and the entire - risk of satisfactory quality, performance, accuracy, and - effort is with the user. - -libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are -Copyright (c) 1998, 1999 Glenn Randers-Pehrson -Distributed according to the same disclaimer and license as libpng-0.96, -with the following individuals added to the list of Contributing Authors: - - Tom Lane - Glenn Randers-Pehrson - Willem van Schaik - -libpng versions 0.89, June 1996, through 0.96, May 1997, are -Copyright (c) 1996, 1997 Andreas Dilger -Distributed according to the same disclaimer and license as libpng-0.88, -with the following individuals added to the list of Contributing Authors: - - John Bowler - Kevin Bracey - Sam Bushell - Magnus Holmgren - Greg Roelofs - Tom Tanner - -libpng versions 0.5, May 1995, through 0.88, January 1996, are -Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. - -For the purposes of this copyright and license, "Contributing Authors" -is defined as the following set of individuals: - - Andreas Dilger - Dave Martindale - Guy Eric Schalnat - Paul Schmidt - Tim Wegner - -The PNG Reference Library is supplied "AS IS". The Contributing Authors -and Group 42, Inc. disclaim all warranties, expressed or implied, -including, without limitation, the warranties of merchantability and of -fitness for any purpose. The Contributing Authors and Group 42, Inc. -assume no liability for direct, indirect, incidental, special, exemplary, -or consequential damages, which may result from the use of the PNG -Reference Library, even if advised of the possibility of such damage. - -Permission is hereby granted to use, copy, modify, and distribute this -source code, or portions hereof, for any purpose, without fee, subject -to the following restrictions: - -1. The origin of this source code must not be misrepresented. - -2. Altered versions must be plainly marked as such and - must not be misrepresented as being the original source. - -3. This Copyright notice may not be removed or altered from - any source or altered source distribution. - -The Contributing Authors and Group 42, Inc. specifically permit, without -fee, and encourage the use of this source code as a component to -supporting the PNG file format in commercial products. If you use this -source code in a product, acknowledgment is not required but would be -appreciated. - - -A "png_get_copyright" function is available, for convenient use in "about" -boxes and the like: - - printf("%s",png_get_copyright(NULL)); - -Also, the PNG logo (in PNG format, of course) is supplied in the -files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31). - -Libpng is OSI Certified Open Source Software. OSI Certified Open Source is a -certification mark of the Open Source Initiative. - -Glenn Randers-Pehrson -glennrp at users.sourceforge.net -May 15, 2007 +September 18, 2008 .\" end of man page diff --git a/src/dep/src/irrlicht/libpng/libpngpf.3 b/src/dep/src/irrlicht/libpng/libpngpf.3 index 28b021a..376ad7e 100644 --- a/src/dep/src/irrlicht/libpng/libpngpf.3 +++ b/src/dep/src/irrlicht/libpng/libpngpf.3 @@ -1,6 +1,6 @@ -.TH LIBPNGPF 3 "February 14, 2009" +.TH LIBPNGPF 3 "September 18, 2008" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.2.35 +libpng \- Portable Network Graphics (PNG) Reference Library 1.2.32 (private functions) .SH SYNOPSIS \fB#include \fP @@ -788,277 +788,3 @@ See png.h for more information on these functions. .IR libpng(3) ", " png(5) .SH AUTHOR Glenn Randers-Pehrson -.TH LIBPNGPF 3 "May 15, 2007" -.SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.2.18 -(private functions) -.SH SYNOPSIS -\fB#include \fP - -\fBvoid png_build_gamma_table (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_build_grayscale_palette (int \fP\fIbit_depth\fP\fB, png_colorp \fIpalette\fP\fB);\fP - -\fBvoid png_calculate_crc (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIptr\fP\fB, png_size_t \fIlength\fP\fB);\fP - -\fBvoid png_check_chunk_name (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIchunk_name\fP\fB);\fP - -\fBpng_size_t png_check_keyword (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charpp \fInew_key\fP\fB);\fP - -\fBvoid png_combine_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fImask\fP\fB);\fP - -\fBvoid png_correct_palette (png_structp \fP\fIpng_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, int \fInum_palette\fP\fB);\fP - -\fBint png_crc_error (png_structp \fIpng_ptr\fP\fB);\fP - -\fBint png_crc_finish (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIskip\fP\fB);\fP - -\fBvoid png_crc_read (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuf\fP\fB, png_size_t \fIlength\fP\fB);\fP - -\fBpng_voidp png_create_struct (int \fItype\fP\fB);\fP - -\fBpng_voidp png_create_struct_2 (int \fP\fItype\fP\fB, png_malloc_ptr \fP\fImalloc_fn\fP\fB, png_voidp \fImem_ptr\fP\fB);\fP - -\fBpng_charp png_decompress_chunk (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcomp_type\fP\fB, png_charp \fP\fIchunkdata\fP\fB, png_size_t \fP\fIchunklength\fP\fB, png_size_t \fP\fIprefix_length\fP\fB, png_size_t \fI*data_length\fP\fB);\fP - -\fBvoid png_destroy_struct (png_voidp \fIstruct_ptr\fP\fB);\fP - -\fBvoid png_destroy_struct_2 (png_voidp \fP\fIstruct_ptr\fP\fB, png_free_ptr \fP\fIfree_fn\fP\fB, png_voidp \fImem_ptr\fP\fB);\fP - -\fBvoid png_do_background (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fP\fItrans_values\fP\fB, png_color_16p \fP\fIbackground\fP\fB, png_color_16p \fP\fIbackground_1\fP\fB, png_bytep \fP\fIgamma_table\fP\fB, png_bytep \fP\fIgamma_from_1\fP\fB, png_bytep \fP\fIgamma_to_1\fP\fB, png_uint_16pp \fP\fIgamma_16\fP\fB, png_uint_16pp \fP\fIgamma_16_from_1\fP\fB, png_uint_16pp \fP\fIgamma_16_to_1\fP\fB, int \fIgamma_shift\fP\fB);\fP - -\fBvoid png_do_bgr (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP - -\fBvoid png_do_chop (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP - -\fBvoid png_do_dither (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIpalette_lookup\fP\fB, png_bytep \fIdither_lookup\fP\fB);\fP - -\fBvoid png_do_expand (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fItrans_value\fP\fB);\fP - -\fBvoid png_do_expand_palette (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_colorp \fP\fIpalette\fP\fB, png_bytep \fP\fItrans\fP\fB, int \fInum_trans\fP\fB);\fP - -\fBvoid png_do_gamma (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIgamma_table\fP\fB, png_uint_16pp \fP\fIgamma_16_table\fP\fB, int \fIgamma_shift\fP\fB);\fP - -\fBvoid png_do_gray_to_rgb (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP - -\fBvoid png_do_invert (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP - -\fBvoid png_do_pack (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fIbit_depth\fP\fB);\fP - -\fBvoid png_do_packswap (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP - -\fBvoid png_do_read_filler (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fP\fIfiller\fP\fB, png_uint_32 \fIflags\fP\fB);\fP - -\fBvoid png_do_read_interlace (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fP\fIpass\fP\fB, png_uint_32 \fItransformations\fP\fB);\fP - -\fBvoid png_do_read_invert_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP - -\fBvoid png_do_read_swap_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP - -\fBvoid png_do_read_transformations (png_structp \fIpng_ptr\fP\fB);\fP - -\fBint png_do_rgb_to_gray (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP - -\fBvoid png_do_shift (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_8p \fIbit_depth\fP\fB);\fP - -\fBvoid png_do_strip_filler (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fIflags\fP\fB);\fP - -\fBvoid png_do_swap (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP - -\fBvoid png_do_unpack (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP - -\fBvoid png_do_unshift (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_8p \fIsig_bits\fP\fB);\fP - -\fBvoid png_do_write_interlace (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fIpass\fP\fB);\fP - -\fBvoid png_do_write_invert_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP - -\fBvoid png_do_write_swap_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP - -\fBvoid png_do_write_transformations (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid *png_far_to_near (png_structp png_ptr,png_voidp \fP\fIptr\fP\fB, int \fIcheck\fP\fB);\fP - -\fBvoid png_flush (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_handle_bKGD (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_handle_cHRM (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_handle_gAMA (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_handle_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_handle_IEND (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_handle_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_handle_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_handle_iTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_handle_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_handle_pCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_handle_pHYs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_handle_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_handle_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_handle_sCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_handle_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_handle_sRGB (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_handle_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_handle_tIME (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_handle_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_handle_unknown (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_handle_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_info_destroy (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBvoid png_init_mmx_flags (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_init_read_transformations (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_process_IDAT_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_length\fP\fB);\fP - -\fBvoid png_process_some_data (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBvoid png_push_check_crc (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_push_crc_finish (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_push_crc_skip (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_push_fill_buffer (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIlength\fP\fB);\fP - -\fBvoid png_push_handle_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_push_handle_unknown (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_push_handle_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP - -\fBvoid png_push_have_end (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBvoid png_push_have_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBvoid png_push_have_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIrow\fP\fB);\fP - -\fBvoid png_push_process_row (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_push_read_chunk (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBvoid png_push_read_end (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBvoid png_push_read_IDAT (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_push_read_sig (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBvoid png_push_read_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBvoid png_push_read_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBvoid png_push_restore_buffer (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_length\fP\fB);\fP - -\fBvoid png_push_save_buffer (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_read_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP - -\fBvoid png_read_filter_row (png_structp \fP\fIpng_ptr\fP\fB, png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIprev_row\fP\fB, int \fIfilter\fP\fB);\fP - -\fBvoid png_read_finish_row (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_read_push_finish_row (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_read_start_row (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_read_transform_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP - -\fBvoid png_reset_crc (png_structp \fIpng_ptr\fP\fB);\fP - -\fBint png_set_text_2 (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_textp \fP\fItext_ptr\fP\fB, int \fInum_text\fP\fB);\fP - -\fBvoid png_write_cHRM (png_structp \fP\fIpng_ptr\fP\fB, double \fP\fIwhite_x\fP\fB, double \fP\fIwhite_y\fP\fB, double \fP\fIred_x\fP\fB, double \fP\fIred_y\fP\fB, double \fP\fIgreen_x\fP\fB, double \fP\fIgreen_y\fP\fB, double \fP\fIblue_x\fP\fB, double \fIblue_y\fP\fB);\fP - -\fBvoid png_write_cHRM_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwhite_x\fP\fB, png_uint_32 \fP\fIwhite_y\fP\fB, png_uint_32 \fP\fIred_x\fP\fB, png_uint_32 \fP\fIred_y\fP\fB, png_uint_32 \fP\fIgreen_x\fP\fB, png_uint_32 \fP\fIgreen_y\fP\fB, png_uint_32 \fP\fIblue_x\fP\fB, png_uint_32 \fIblue_y\fP\fB);\fP - -\fBvoid png_write_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP - -\fBvoid png_write_filtered_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIfiltered_row\fP\fB);\fP - -\fBvoid png_write_find_filter (png_structp \fP\fIpng_ptr\fP\fB, png_row_infop \fIrow_info\fP\fB);\fP - -\fBvoid png_write_finish_row (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_write_gAMA (png_structp \fP\fIpng_ptr\fP\fB, double \fIfile_gamma\fP\fB);\fP - -\fBvoid png_write_gAMA_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIint_file_gamma\fP\fB);\fP - -\fBvoid png_write_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_uint_16p \fP\fIhist\fP\fB, int \fInum_hist\fP\fB);\fP - -\fBvoid png_write_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIname\fP\fB, int \fP\fIcompression_type\fP\fB, png_charp \fP\fIprofile\fP\fB, int \fIproflen\fP\fB);\fP - -\fBvoid png_write_IDAT (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP - -\fBvoid png_write_IEND (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_write_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwidth\fP\fB, png_uint_32 \fP\fIheight\fP\fB, int \fP\fIbit_depth\fP\fB, int \fP\fIcolor_type\fP\fB, int \fP\fIcompression_type\fP\fB, int \fP\fIfilter_type\fP\fB, int \fIinterlace_type\fP\fB);\fP - -\fBvoid png_write_iTXt (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcompression\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fIlang\fP\fB, png_charp \fP\fItranslated_key\fP\fB, png_charp \fItext\fP\fB);\fP - -\fBvoid png_write_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIx_offset\fP\fB, png_uint_32 \fP\fIy_offset\fP\fB, int \fIunit_type\fP\fB);\fP - -\fBvoid png_write_pCAL (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIpurpose\fP\fB, png_int_32 \fP\fIX0\fP\fB, png_int_32 \fP\fIX1\fP\fB, int \fP\fItype\fP\fB, int \fP\fInparams\fP\fB, png_charp \fP\fIunits\fP\fB, png_charpp \fIparams\fP\fB);\fP - -\fBvoid png_write_pHYs (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIx_pixels_per_unit\fP\fB, png_uint_32 \fP\fIy_pixels_per_unit\fP\fB, int \fIunit_type\fP\fB);\fP - -\fBvoid png_write_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, png_uint_32 \fInum_pal\fP\fB);\fP - -\fBvoid png_write_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_color_8p \fP\fIsbit\fP\fB, int \fIcolor_type\fP\fB);\fP - -\fBvoid png_write_sCAL (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIunit\fP\fB, double \fP\fIwidth\fP\fB, double \fIheight\fP\fB);\fP - -\fBvoid png_write_sCAL_s (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIunit\fP\fB, png_charp \fP\fIwidth\fP\fB, png_charp \fIheight\fP\fB);\fP - -\fBvoid png_write_sig (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_write_sRGB (png_structp \fP\fIpng_ptr\fP\fB, int \fIintent\fP\fB);\fP - -\fBvoid png_write_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_spalette_p \fIpalette\fP\fB);\fP - -\fBvoid png_write_start_row (png_structp \fIpng_ptr\fP\fB);\fP - -\fBvoid png_write_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fItext\fP\fB, png_size_t \fItext_len\fP\fB);\fP - -\fBvoid png_write_tIME (png_structp \fP\fIpng_ptr\fP\fB, png_timep \fImod_time\fP\fB);\fP - -\fBvoid png_write_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fItrans\fP\fB, png_color_16p \fP\fIvalues\fP\fB, int \fP\fInumber\fP\fB, int \fIcolor_type\fP\fB);\fP - -\fBvoid png_write_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fItext\fP\fB, png_size_t \fP\fItext_len\fP\fB, int \fIcompression\fP\fB);\fP - -\fBvoidpf png_zalloc (voidpf \fP\fIpng_ptr\fP\fB, uInt \fP\fIitems\fP\fB, uInt \fIsize\fP\fB);\fP - -\fBvoid png_zfree (voidpf \fP\fIpng_ptr\fP\fB, voidpf \fIptr\fP\fB);\fP - -\fI\fB - -.SH DESCRIPTION -The functions listed above are used privately by libpng -and are not recommended for use by applications. They are -not "exported" to applications using shared libraries. They -are listed alphabetically here as an aid to libpng maintainers. -See png.h for more information on these functions. - -.SH SEE ALSO -libpng(3), png(5) -.SH AUTHOR -Glenn Randers-Pehrson diff --git a/src/dep/src/irrlicht/libpng/png.5 b/src/dep/src/irrlicht/libpng/png.5 index ce87741..670b5b4 100644 --- a/src/dep/src/irrlicht/libpng/png.5 +++ b/src/dep/src/irrlicht/libpng/png.5 @@ -1,4 +1,4 @@ -.TH PNG 5 "February 14, 2009" +.TH PNG 5 "September 18, 2008" .SH NAME png \- Portable Network Graphics (PNG) format .SH DESCRIPTION @@ -72,77 +72,3 @@ Technology. See the specification for conditions of use and distribution. .LP .\" end of man page -.TH PNG 5 "May 15, 2007" -.SH NAME -png \- Portable Network Graphics (PNG) format -.SH DESCRIPTION -PNG (Portable Network Graphics) is an extensible file format for the -lossless, portable, well-compressed storage of raster images. PNG provides -a patent-free replacement for GIF and can also replace many -common uses of TIFF. Indexed-color, grayscale, and truecolor images are -supported, plus an optional alpha channel. Sample depths range from -1 to 16 bits. -.br - -PNG is designed to work well in online viewing applications, such as the -World Wide Web, so it is fully streamable with a progressive display -option. PNG is robust, providing both full file integrity checking and -fast, simple detection of common transmission errors. Also, PNG can store -gamma and chromaticity data for improved color matching on heterogeneous -platforms. - -.SH "SEE ALSO" -.IR libpng(3), zlib(3), deflate(5), and zlib(5) -.LP -PNG specification (second edition), November 2003: -.IP -.br - 8) png_error(png_ptr, "Too many bytes for PNG signature."); @@ -240,7 +240,7 @@ png_create_info_struct(png_structp png_ptr) { png_infop info_ptr; - png_debug(1, "in png_create_info_struct"); + png_debug(1, "in png_create_info_struct\n"); if (png_ptr == NULL) return (NULL); #ifdef PNG_USER_MEM_SUPPORTED info_ptr = (png_infop)png_create_struct_2(PNG_STRUCT_INFO, @@ -265,7 +265,7 @@ png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr) png_infop info_ptr = NULL; if (png_ptr == NULL) return; - png_debug(1, "in png_destroy_info_struct"); + png_debug(1, "in png_destroy_info_struct\n"); if (info_ptr_ptr != NULL) info_ptr = *info_ptr_ptr; @@ -304,7 +304,7 @@ png_info_init_3(png_infopp ptr_ptr, png_size_t png_info_struct_size) if (info_ptr == NULL) return; - png_debug(1, "in png_info_init_3"); + png_debug(1, "in png_info_init_3\n"); if (png_sizeof(png_info) > png_info_struct_size) { @@ -322,7 +322,7 @@ void PNGAPI png_data_freer(png_structp png_ptr, png_infop info_ptr, int freer, png_uint_32 mask) { - png_debug(1, "in png_data_freer"); + png_debug(1, "in png_data_freer\n"); if (png_ptr == NULL || info_ptr == NULL) return; if (freer == PNG_DESTROY_WILL_FREE_DATA) @@ -339,7 +339,7 @@ void PNGAPI png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask, int num) { - png_debug(1, "in png_free_data"); + png_debug(1, "in png_free_data\n"); if (png_ptr == NULL || info_ptr == NULL) return; @@ -593,7 +593,7 @@ if (mask & PNG_FREE_ROWS) void /* PRIVATE */ png_info_destroy(png_structp png_ptr, png_infop info_ptr) { - png_debug(1, "in png_info_destroy"); + png_debug(1, "in png_info_destroy\n"); png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); @@ -632,7 +632,7 @@ png_get_io_ptr(png_structp png_ptr) void PNGAPI png_init_io(png_structp png_ptr, png_FILE_p fp) { - png_debug(1, "in png_init_io"); + png_debug(1, "in png_init_io\n"); if (png_ptr == NULL) return; png_ptr->io_ptr = (png_voidp)fp; } @@ -694,7 +694,7 @@ png_charp PNGAPI png_get_copyright(png_structp png_ptr) { png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */ - return ((png_charp) "\n libpng version 1.2.35 - February 14, 2009\n\ + return ((png_charp) "\n libpng version 1.2.32 - September 18, 2008\n\ Copyright (c) 1998-2008 Glenn Randers-Pehrson\n\ Copyright (c) 1996-1997 Andreas Dilger\n\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n"); @@ -784,979 +784,6 @@ png_mmx_support(void) #endif /* PNG_1_0_X */ #endif /* PNG_READ_SUPPORTED && PNG_ASSEMBLER_CODE_SUPPORTED */ -#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) -#ifdef PNG_SIZE_T -/* Added at libpng version 1.2.6 */ - PNG_EXTERN png_size_t PNGAPI png_convert_size PNGARG((size_t size)); -png_size_t PNGAPI -png_convert_size(size_t size) -{ - if (size > (png_size_t)-1) - PNG_ABORT(); /* We haven't got access to png_ptr, so no png_error() */ - return ((png_size_t)size); -} -#endif /* PNG_SIZE_T */ - -/* Added at libpng version 1.2.34 and 1.4.0 (moved from pngset.c) */ -#if defined(PNG_cHRM_SUPPORTED) -#if !defined(PNG_NO_CHECK_cHRM) -/* - Multiply two 32-bit numbers, V1 and V2, using 32-bit - arithmetic, to produce a 64 bit result in the HI/LO words. - - A B - x C D - ------ - AD || BD -AC || CB || 0 - - where A and B are the high and low 16-bit words of V1, - C and D are the 16-bit words of V2, AD is the product of - A and D, and X || Y is (X << 16) + Y. -*/ - -void png_64bit_product (long v1, long v2, unsigned long *hi_product, - unsigned long *lo_product) -{ - int a, b, c, d; - long lo, hi, x, y; - - a = (v1 >> 16) & 0xffff; - b = v1 & 0xffff; - c = (v2 >> 16) & 0xffff; - d = v2 & 0xffff; - - lo = b * d; /* BD */ - x = a * d + c * b; /* AD + CB */ - y = ((lo >> 16) & 0xffff) + x; - - lo = (lo & 0xffff) | ((y & 0xffff) << 16); - hi = (y >> 16) & 0xffff; - - hi += a * c; /* AC */ - - *hi_product = (unsigned long)hi; - *lo_product = (unsigned long)lo; -} -int /* private */ -png_check_cHRM_fixed(png_structp png_ptr, - png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x, - png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y, - png_fixed_point blue_x, png_fixed_point blue_y) -{ - int ret = 1; - unsigned long xy_hi,xy_lo,yx_hi,yx_lo; - - png_debug(1, "in function png_check_cHRM_fixed"); - if (png_ptr == NULL) - return 0; - - if (white_x < 0 || white_y <= 0 || - red_x < 0 || red_y < 0 || - green_x < 0 || green_y < 0 || - blue_x < 0 || blue_y < 0) - { - png_warning(png_ptr, - "Ignoring attempt to set negative chromaticity value"); - ret = 0; - } - if (white_x > (png_fixed_point) PNG_UINT_31_MAX || - white_y > (png_fixed_point) PNG_UINT_31_MAX || - red_x > (png_fixed_point) PNG_UINT_31_MAX || - red_y > (png_fixed_point) PNG_UINT_31_MAX || - green_x > (png_fixed_point) PNG_UINT_31_MAX || - green_y > (png_fixed_point) PNG_UINT_31_MAX || - blue_x > (png_fixed_point) PNG_UINT_31_MAX || - blue_y > (png_fixed_point) PNG_UINT_31_MAX ) - { - png_warning(png_ptr, - "Ignoring attempt to set chromaticity value exceeding 21474.83"); - ret = 0; - } - if (white_x > 100000L - white_y) - { - png_warning(png_ptr, "Invalid cHRM white point"); - ret = 0; - } - if (red_x > 100000L - red_y) - { - png_warning(png_ptr, "Invalid cHRM red point"); - ret = 0; - } - if (green_x > 100000L - green_y) - { - png_warning(png_ptr, "Invalid cHRM green point"); - ret = 0; - } - if (blue_x > 100000L - blue_y) - { - png_warning(png_ptr, "Invalid cHRM blue point"); - ret = 0; - } - - png_64bit_product(green_x - red_x, blue_y - red_y, &xy_hi, &xy_lo); - png_64bit_product(green_y - red_y, blue_x - red_x, &yx_hi, &yx_lo); - - if (xy_hi == yx_hi && xy_lo == yx_lo) - { - png_warning(png_ptr, - "Ignoring attempt to set cHRM RGB triangle with zero area"); - ret = 0; - } - - return ret; -} -#endif /* NO_PNG_CHECK_cHRM */ -#endif /* PNG_cHRM_SUPPORTED */ -#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ - -/* png.c - location for general purpose libpng functions - * - * Last changed in libpng 1.2.17 May 15, 2007 - * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - */ - -#define PNG_INTERNAL -#define PNG_NO_EXTERN -#include "png.h" - -/* Generate a compiler error if there is an old png.h in the search path. */ -typedef version_1_2_18 Your_png_h_is_not_version_1_2_18; - -/* Version information for C files. This had better match the version - * string defined in png.h. */ - -#ifdef PNG_USE_GLOBAL_ARRAYS -/* png_libpng_ver was changed to a function in version 1.0.5c */ -const char png_libpng_ver[18] = PNG_LIBPNG_VER_STRING; - -#ifdef PNG_READ_SUPPORTED - -/* png_sig was changed to a function in version 1.0.5c */ -/* Place to hold the signature string for a PNG file. */ -const png_byte FARDATA png_sig[8] = {137, 80, 78, 71, 13, 10, 26, 10}; -#endif /* PNG_READ_SUPPORTED */ - -/* Invoke global declarations for constant strings for known chunk types */ -PNG_IHDR; -PNG_IDAT; -PNG_IEND; -PNG_PLTE; -PNG_bKGD; -PNG_cHRM; -PNG_gAMA; -PNG_hIST; -PNG_iCCP; -PNG_iTXt; -PNG_oFFs; -PNG_pCAL; -PNG_sCAL; -PNG_pHYs; -PNG_sBIT; -PNG_sPLT; -PNG_sRGB; -PNG_tEXt; -PNG_tIME; -PNG_tRNS; -PNG_zTXt; - -#ifdef PNG_READ_SUPPORTED -/* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ - -/* start of interlace block */ -const int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; - -/* offset to next interlace block */ -const int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; - -/* start of interlace block in the y direction */ -const int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1}; - -/* offset to next interlace block in the y direction */ -const int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2}; - -/* width of interlace block (used in assembler routines only) */ -#ifdef PNG_HAVE_MMX_COMBINE_ROW -const int FARDATA png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; -#endif - -/* Height of interlace block. This is not currently used - if you need - * it, uncomment it here and in png.h -const int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1}; -*/ - -/* Mask to determine which pixels are valid in a pass */ -const int FARDATA png_pass_mask[] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff}; - -/* Mask to determine which pixels to overwrite while displaying */ -const int FARDATA png_pass_dsp_mask[] - = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff}; - -#endif /* PNG_READ_SUPPORTED */ -#endif /* PNG_USE_GLOBAL_ARRAYS */ - -/* Tells libpng that we have already handled the first "num_bytes" bytes - * of the PNG file signature. If the PNG data is embedded into another - * stream we can set num_bytes = 8 so that libpng will not attempt to read - * or write any of the magic bytes before it starts on the IHDR. - */ - -#ifdef PNG_READ_SUPPORTED -void PNGAPI -png_set_sig_bytes(png_structp png_ptr, int num_bytes) -{ - if(png_ptr == NULL) return; - png_debug(1, "in png_set_sig_bytes\n"); - if (num_bytes > 8) - png_error(png_ptr, "Too many bytes for PNG signature."); - - png_ptr->sig_bytes = (png_byte)(num_bytes < 0 ? 0 : num_bytes); -} - -/* Checks whether the supplied bytes match the PNG signature. We allow - * checking less than the full 8-byte signature so that those apps that - * already read the first few bytes of a file to determine the file type - * can simply check the remaining bytes for extra assurance. Returns - * an integer less than, equal to, or greater than zero if sig is found, - * respectively, to be less than, to match, or be greater than the correct - * PNG signature (this is the same behaviour as strcmp, memcmp, etc). - */ -int PNGAPI -png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check) -{ - png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10}; - if (num_to_check > 8) - num_to_check = 8; - else if (num_to_check < 1) - return (-1); - - if (start > 7) - return (-1); - - if (start + num_to_check > 8) - num_to_check = 8 - start; - - return ((int)(png_memcmp(&sig[start], &png_signature[start], num_to_check))); -} - -#if defined(PNG_1_0_X) || defined(PNG_1_2_X) -/* (Obsolete) function to check signature bytes. It does not allow one - * to check a partial signature. This function might be removed in the - * future - use png_sig_cmp(). Returns true (nonzero) if the file is a PNG. - */ -int PNGAPI -png_check_sig(png_bytep sig, int num) -{ - return ((int)!png_sig_cmp(sig, (png_size_t)0, (png_size_t)num)); -} -#endif -#endif /* PNG_READ_SUPPORTED */ - -#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) -/* Function to allocate memory for zlib and clear it to 0. */ -#ifdef PNG_1_0_X -voidpf PNGAPI -#else -voidpf /* private */ -#endif -png_zalloc(voidpf png_ptr, uInt items, uInt size) -{ - png_voidp ptr; - png_structp p=(png_structp)png_ptr; - png_uint_32 save_flags=p->flags; - png_uint_32 num_bytes; - - if(png_ptr == NULL) return (NULL); - if (items > PNG_UINT_32_MAX/size) - { - png_warning (p, "Potential overflow in png_zalloc()"); - return (NULL); - } - num_bytes = (png_uint_32)items * size; - - p->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK; - ptr = (png_voidp)png_malloc((png_structp)png_ptr, num_bytes); - p->flags=save_flags; - -#if defined(PNG_1_0_X) && !defined(PNG_NO_ZALLOC_ZERO) - if (ptr == NULL) - return ((voidpf)ptr); - - if (num_bytes > (png_uint_32)0x8000L) - { - png_memset(ptr, 0, (png_size_t)0x8000L); - png_memset((png_bytep)ptr + (png_size_t)0x8000L, 0, - (png_size_t)(num_bytes - (png_uint_32)0x8000L)); - } - else - { - png_memset(ptr, 0, (png_size_t)num_bytes); - } -#endif - return ((voidpf)ptr); -} - -/* function to free memory for zlib */ -#ifdef PNG_1_0_X -void PNGAPI -#else -void /* private */ -#endif -png_zfree(voidpf png_ptr, voidpf ptr) -{ - png_free((png_structp)png_ptr, (png_voidp)ptr); -} - -/* Reset the CRC variable to 32 bits of 1's. Care must be taken - * in case CRC is > 32 bits to leave the top bits 0. - */ -void /* PRIVATE */ -png_reset_crc(png_structp png_ptr) -{ - png_ptr->crc = crc32(0, Z_NULL, 0); -} - -/* Calculate the CRC over a section of data. We can only pass as - * much data to this routine as the largest single buffer size. We - * also check that this data will actually be used before going to the - * trouble of calculating it. - */ -void /* PRIVATE */ -png_calculate_crc(png_structp png_ptr, png_bytep ptr, png_size_t length) -{ - int need_crc = 1; - - if (png_ptr->chunk_name[0] & 0x20) /* ancillary */ - { - if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_MASK) == - (PNG_FLAG_CRC_ANCILLARY_USE | PNG_FLAG_CRC_ANCILLARY_NOWARN)) - need_crc = 0; - } - else /* critical */ - { - if (png_ptr->flags & PNG_FLAG_CRC_CRITICAL_IGNORE) - need_crc = 0; - } - - if (need_crc) - png_ptr->crc = crc32(png_ptr->crc, ptr, (uInt)length); -} - -/* Allocate the memory for an info_struct for the application. We don't - * really need the png_ptr, but it could potentially be useful in the - * future. This should be used in favour of malloc(png_sizeof(png_info)) - * and png_info_init() so that applications that want to use a shared - * libpng don't have to be recompiled if png_info changes size. - */ -png_infop PNGAPI -png_create_info_struct(png_structp png_ptr) -{ - png_infop info_ptr; - - png_debug(1, "in png_create_info_struct\n"); - if(png_ptr == NULL) return (NULL); -#ifdef PNG_USER_MEM_SUPPORTED - info_ptr = (png_infop)png_create_struct_2(PNG_STRUCT_INFO, - png_ptr->malloc_fn, png_ptr->mem_ptr); -#else - info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO); -#endif - if (info_ptr != NULL) - png_info_init_3(&info_ptr, png_sizeof(png_info)); - - return (info_ptr); -} - -/* This function frees the memory associated with a single info struct. - * Normally, one would use either png_destroy_read_struct() or - * png_destroy_write_struct() to free an info struct, but this may be - * useful for some applications. - */ -void PNGAPI -png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr) -{ - png_infop info_ptr = NULL; - if(png_ptr == NULL) return; - - png_debug(1, "in png_destroy_info_struct\n"); - if (info_ptr_ptr != NULL) - info_ptr = *info_ptr_ptr; - - if (info_ptr != NULL) - { - png_info_destroy(png_ptr, info_ptr); - -#ifdef PNG_USER_MEM_SUPPORTED - png_destroy_struct_2((png_voidp)info_ptr, png_ptr->free_fn, - png_ptr->mem_ptr); -#else - png_destroy_struct((png_voidp)info_ptr); -#endif - *info_ptr_ptr = NULL; - } -} - -/* Initialize the info structure. This is now an internal function (0.89) - * and applications using it are urged to use png_create_info_struct() - * instead. - */ -#if defined(PNG_1_0_X) || defined(PNG_1_2_X) -#undef png_info_init -void PNGAPI -png_info_init(png_infop info_ptr) -{ - /* We only come here via pre-1.0.12-compiled applications */ - png_info_init_3(&info_ptr, 0); -} -#endif - -void PNGAPI -png_info_init_3(png_infopp ptr_ptr, png_size_t png_info_struct_size) -{ - png_infop info_ptr = *ptr_ptr; - - if(info_ptr == NULL) return; - - png_debug(1, "in png_info_init_3\n"); - - if(png_sizeof(png_info) > png_info_struct_size) - { - png_destroy_struct(info_ptr); - info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO); - *ptr_ptr = info_ptr; - } - - /* set everything to 0 */ - png_memset(info_ptr, 0, png_sizeof (png_info)); -} - -#ifdef PNG_FREE_ME_SUPPORTED -void PNGAPI -png_data_freer(png_structp png_ptr, png_infop info_ptr, - int freer, png_uint_32 mask) -{ - png_debug(1, "in png_data_freer\n"); - if (png_ptr == NULL || info_ptr == NULL) - return; - if(freer == PNG_DESTROY_WILL_FREE_DATA) - info_ptr->free_me |= mask; - else if(freer == PNG_USER_WILL_FREE_DATA) - info_ptr->free_me &= ~mask; - else - png_warning(png_ptr, - "Unknown freer parameter in png_data_freer."); -} -#endif - -void PNGAPI -png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask, - int num) -{ - png_debug(1, "in png_free_data\n"); - if (png_ptr == NULL || info_ptr == NULL) - return; - -#if defined(PNG_TEXT_SUPPORTED) -/* free text item num or (if num == -1) all text items */ -#ifdef PNG_FREE_ME_SUPPORTED -if ((mask & PNG_FREE_TEXT) & info_ptr->free_me) -#else -if (mask & PNG_FREE_TEXT) -#endif -{ - if (num != -1) - { - if (info_ptr->text && info_ptr->text[num].key) - { - png_free(png_ptr, info_ptr->text[num].key); - info_ptr->text[num].key = NULL; - } - } - else - { - int i; - for (i = 0; i < info_ptr->num_text; i++) - png_free_data(png_ptr, info_ptr, PNG_FREE_TEXT, i); - png_free(png_ptr, info_ptr->text); - info_ptr->text = NULL; - info_ptr->num_text=0; - } -} -#endif - -#if defined(PNG_tRNS_SUPPORTED) -/* free any tRNS entry */ -#ifdef PNG_FREE_ME_SUPPORTED -if ((mask & PNG_FREE_TRNS) & info_ptr->free_me) -#else -if ((mask & PNG_FREE_TRNS) && (png_ptr->flags & PNG_FLAG_FREE_TRNS)) -#endif -{ - png_free(png_ptr, info_ptr->trans); - info_ptr->valid &= ~PNG_INFO_tRNS; -#ifndef PNG_FREE_ME_SUPPORTED - png_ptr->flags &= ~PNG_FLAG_FREE_TRNS; -#endif - info_ptr->trans = NULL; -} -#endif - -#if defined(PNG_sCAL_SUPPORTED) -/* free any sCAL entry */ -#ifdef PNG_FREE_ME_SUPPORTED -if ((mask & PNG_FREE_SCAL) & info_ptr->free_me) -#else -if (mask & PNG_FREE_SCAL) -#endif -{ -#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED) - png_free(png_ptr, info_ptr->scal_s_width); - png_free(png_ptr, info_ptr->scal_s_height); - info_ptr->scal_s_width = NULL; - info_ptr->scal_s_height = NULL; -#endif - info_ptr->valid &= ~PNG_INFO_sCAL; -} -#endif - -#if defined(PNG_pCAL_SUPPORTED) -/* free any pCAL entry */ -#ifdef PNG_FREE_ME_SUPPORTED -if ((mask & PNG_FREE_PCAL) & info_ptr->free_me) -#else -if (mask & PNG_FREE_PCAL) -#endif -{ - png_free(png_ptr, info_ptr->pcal_purpose); - png_free(png_ptr, info_ptr->pcal_units); - info_ptr->pcal_purpose = NULL; - info_ptr->pcal_units = NULL; - if (info_ptr->pcal_params != NULL) - { - int i; - for (i = 0; i < (int)info_ptr->pcal_nparams; i++) - { - png_free(png_ptr, info_ptr->pcal_params[i]); - info_ptr->pcal_params[i]=NULL; - } - png_free(png_ptr, info_ptr->pcal_params); - info_ptr->pcal_params = NULL; - } - info_ptr->valid &= ~PNG_INFO_pCAL; -} -#endif - -#if defined(PNG_iCCP_SUPPORTED) -/* free any iCCP entry */ -#ifdef PNG_FREE_ME_SUPPORTED -if ((mask & PNG_FREE_ICCP) & info_ptr->free_me) -#else -if (mask & PNG_FREE_ICCP) -#endif -{ - png_free(png_ptr, info_ptr->iccp_name); - png_free(png_ptr, info_ptr->iccp_profile); - info_ptr->iccp_name = NULL; - info_ptr->iccp_profile = NULL; - info_ptr->valid &= ~PNG_INFO_iCCP; -} -#endif - -#if defined(PNG_sPLT_SUPPORTED) -/* free a given sPLT entry, or (if num == -1) all sPLT entries */ -#ifdef PNG_FREE_ME_SUPPORTED -if ((mask & PNG_FREE_SPLT) & info_ptr->free_me) -#else -if (mask & PNG_FREE_SPLT) -#endif -{ - if (num != -1) - { - if(info_ptr->splt_palettes) - { - png_free(png_ptr, info_ptr->splt_palettes[num].name); - png_free(png_ptr, info_ptr->splt_palettes[num].entries); - info_ptr->splt_palettes[num].name = NULL; - info_ptr->splt_palettes[num].entries = NULL; - } - } - else - { - if(info_ptr->splt_palettes_num) - { - int i; - for (i = 0; i < (int)info_ptr->splt_palettes_num; i++) - png_free_data(png_ptr, info_ptr, PNG_FREE_SPLT, i); - - png_free(png_ptr, info_ptr->splt_palettes); - info_ptr->splt_palettes = NULL; - info_ptr->splt_palettes_num = 0; - } - info_ptr->valid &= ~PNG_INFO_sPLT; - } -} -#endif - -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) - if(png_ptr->unknown_chunk.data) - { - png_free(png_ptr, png_ptr->unknown_chunk.data); - png_ptr->unknown_chunk.data = NULL; - } -#ifdef PNG_FREE_ME_SUPPORTED -if ((mask & PNG_FREE_UNKN) & info_ptr->free_me) -#else -if (mask & PNG_FREE_UNKN) -#endif -{ - if (num != -1) - { - if(info_ptr->unknown_chunks) - { - png_free(png_ptr, info_ptr->unknown_chunks[num].data); - info_ptr->unknown_chunks[num].data = NULL; - } - } - else - { - int i; - - if(info_ptr->unknown_chunks_num) - { - for (i = 0; i < (int)info_ptr->unknown_chunks_num; i++) - png_free_data(png_ptr, info_ptr, PNG_FREE_UNKN, i); - - png_free(png_ptr, info_ptr->unknown_chunks); - info_ptr->unknown_chunks = NULL; - info_ptr->unknown_chunks_num = 0; - } - } -} -#endif - -#if defined(PNG_hIST_SUPPORTED) -/* free any hIST entry */ -#ifdef PNG_FREE_ME_SUPPORTED -if ((mask & PNG_FREE_HIST) & info_ptr->free_me) -#else -if ((mask & PNG_FREE_HIST) && (png_ptr->flags & PNG_FLAG_FREE_HIST)) -#endif -{ - png_free(png_ptr, info_ptr->hist); - info_ptr->hist = NULL; - info_ptr->valid &= ~PNG_INFO_hIST; -#ifndef PNG_FREE_ME_SUPPORTED - png_ptr->flags &= ~PNG_FLAG_FREE_HIST; -#endif -} -#endif - -/* free any PLTE entry that was internally allocated */ -#ifdef PNG_FREE_ME_SUPPORTED -if ((mask & PNG_FREE_PLTE) & info_ptr->free_me) -#else -if ((mask & PNG_FREE_PLTE) && (png_ptr->flags & PNG_FLAG_FREE_PLTE)) -#endif -{ - png_zfree(png_ptr, info_ptr->palette); - info_ptr->palette = NULL; - info_ptr->valid &= ~PNG_INFO_PLTE; -#ifndef PNG_FREE_ME_SUPPORTED - png_ptr->flags &= ~PNG_FLAG_FREE_PLTE; -#endif - info_ptr->num_palette = 0; -} - -#if defined(PNG_INFO_IMAGE_SUPPORTED) -/* free any image bits attached to the info structure */ -#ifdef PNG_FREE_ME_SUPPORTED -if ((mask & PNG_FREE_ROWS) & info_ptr->free_me) -#else -if (mask & PNG_FREE_ROWS) -#endif -{ - if(info_ptr->row_pointers) - { - int row; - for (row = 0; row < (int)info_ptr->height; row++) - { - png_free(png_ptr, info_ptr->row_pointers[row]); - info_ptr->row_pointers[row]=NULL; - } - png_free(png_ptr, info_ptr->row_pointers); - info_ptr->row_pointers=NULL; - } - info_ptr->valid &= ~PNG_INFO_IDAT; -} -#endif - -#ifdef PNG_FREE_ME_SUPPORTED - if(num == -1) - info_ptr->free_me &= ~mask; - else - info_ptr->free_me &= ~(mask & ~PNG_FREE_MUL); -#endif -} - -/* This is an internal routine to free any memory that the info struct is - * pointing to before re-using it or freeing the struct itself. Recall - * that png_free() checks for NULL pointers for us. - */ -void /* PRIVATE */ -png_info_destroy(png_structp png_ptr, png_infop info_ptr) -{ - png_debug(1, "in png_info_destroy\n"); - - png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); - -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) - if (png_ptr->num_chunk_list) - { - png_free(png_ptr, png_ptr->chunk_list); - png_ptr->chunk_list=NULL; - png_ptr->num_chunk_list=0; - } -#endif - - png_info_init_3(&info_ptr, png_sizeof(png_info)); -} -#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ - -/* This function returns a pointer to the io_ptr associated with the user - * functions. The application should free any memory associated with this - * pointer before png_write_destroy() or png_read_destroy() are called. - */ -png_voidp PNGAPI -png_get_io_ptr(png_structp png_ptr) -{ - if(png_ptr == NULL) return (NULL); - return (png_ptr->io_ptr); -} - -#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) -#if !defined(PNG_NO_STDIO) -/* Initialize the default input/output functions for the PNG file. If you - * use your own read or write routines, you can call either png_set_read_fn() - * or png_set_write_fn() instead of png_init_io(). If you have defined - * PNG_NO_STDIO, you must use a function of your own because "FILE *" isn't - * necessarily available. - */ -void PNGAPI -png_init_io(png_structp png_ptr, png_FILE_p fp) -{ - png_debug(1, "in png_init_io\n"); - if(png_ptr == NULL) return; - png_ptr->io_ptr = (png_voidp)fp; -} -#endif - -#if defined(PNG_TIME_RFC1123_SUPPORTED) -/* Convert the supplied time into an RFC 1123 string suitable for use in - * a "Creation Time" or other text-based time string. - */ -png_charp PNGAPI -png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime) -{ - static PNG_CONST char short_months[12][4] = - {"Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; - - if(png_ptr == NULL) return (NULL); - if (png_ptr->time_buffer == NULL) - { - png_ptr->time_buffer = (png_charp)png_malloc(png_ptr, (png_uint_32)(29* - png_sizeof(char))); - } - -#if defined(_WIN32_WCE) - { - wchar_t time_buf[29]; - wsprintf(time_buf, TEXT("%d %S %d %02d:%02d:%02d +0000"), - ptime->day % 32, short_months[(ptime->month - 1) % 12], - ptime->year, ptime->hour % 24, ptime->minute % 60, - ptime->second % 61); - WideCharToMultiByte(CP_ACP, 0, time_buf, -1, png_ptr->time_buffer, 29, - NULL, NULL); - } -#else -#ifdef USE_FAR_KEYWORD - { - char near_time_buf[29]; - sprintf(near_time_buf, "%d %s %d %02d:%02d:%02d +0000", - ptime->day % 32, short_months[(ptime->month - 1) % 12], - ptime->year, ptime->hour % 24, ptime->minute % 60, - ptime->second % 61); - png_memcpy(png_ptr->time_buffer, near_time_buf, - 29*png_sizeof(char)); - } -#else - sprintf(png_ptr->time_buffer, "%d %s %d %02d:%02d:%02d +0000", - ptime->day % 32, short_months[(ptime->month - 1) % 12], - ptime->year, ptime->hour % 24, ptime->minute % 60, - ptime->second % 61); -#endif -#endif /* _WIN32_WCE */ - return ((png_charp)png_ptr->time_buffer); -} -#endif /* PNG_TIME_RFC1123_SUPPORTED */ - -#if 0 -/* Signature string for a PNG file. */ -png_bytep PNGAPI -png_sig_bytes(void) -{ - return ((png_bytep)"\211\120\116\107\015\012\032\012"); -} -#endif -#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ - -png_charp PNGAPI -png_get_copyright(png_structp png_ptr) -{ - if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */ - return ((png_charp) "\n libpng version 1.2.18 - May 15, 2007\n\ - Copyright (c) 1998-2007 Glenn Randers-Pehrson\n\ - Copyright (c) 1996-1997 Andreas Dilger\n\ - Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n"); - return ((png_charp) ""); -} - -/* The following return the library version as a short string in the - * format 1.0.0 through 99.99.99zz. To get the version of *.h files - * used with your application, print out PNG_LIBPNG_VER_STRING, which - * is defined in png.h. - * Note: now there is no difference between png_get_libpng_ver() and - * png_get_header_ver(). Due to the version_nn_nn_nn typedef guard, - * it is guaranteed that png.c uses the correct version of png.h. - */ -png_charp PNGAPI -png_get_libpng_ver(png_structp png_ptr) -{ - /* Version of *.c files used when building libpng */ - if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */ - return ((png_charp) PNG_LIBPNG_VER_STRING); - return ((png_charp) ""); -} - -png_charp PNGAPI -png_get_header_ver(png_structp png_ptr) -{ - /* Version of *.h files used when building libpng */ - if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */ - return ((png_charp) PNG_LIBPNG_VER_STRING); - return ((png_charp) ""); -} - -png_charp PNGAPI -png_get_header_version(png_structp png_ptr) -{ - /* Returns longer string containing both version and date */ - if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */ - return ((png_charp) PNG_HEADER_VERSION_STRING); - return ((png_charp) ""); -} - -#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) -#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED -int PNGAPI -png_handle_as_unknown(png_structp png_ptr, png_bytep chunk_name) -{ - /* check chunk_name and return "keep" value if it's on the list, else 0 */ - int i; - png_bytep p; - if((png_ptr == NULL && chunk_name == NULL) || png_ptr->num_chunk_list<=0) - return 0; - p=png_ptr->chunk_list+png_ptr->num_chunk_list*5-5; - for (i = png_ptr->num_chunk_list; i; i--, p-=5) - if (!png_memcmp(chunk_name, p, 4)) - return ((int)*(p+4)); - return 0; -} -#endif - -/* This function, added to libpng-1.0.6g, is untested. */ -int PNGAPI -png_reset_zstream(png_structp png_ptr) -{ - if (png_ptr == NULL) return Z_STREAM_ERROR; - return (inflateReset(&png_ptr->zstream)); -} -#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ - -/* This function was added to libpng-1.0.7 */ -png_uint_32 PNGAPI -png_access_version_number(void) -{ - /* Version of *.c files used when building libpng */ - return((png_uint_32) PNG_LIBPNG_VER); -} - - -#if defined(PNG_READ_SUPPORTED) && defined(PNG_ASSEMBLER_CODE_SUPPORTED) -#if !defined(PNG_1_0_X) -#if defined(PNG_MMX_CODE_SUPPORTED) -/* this INTERNAL function was added to libpng 1.2.0 */ -void /* PRIVATE */ -png_init_mmx_flags (png_structp png_ptr) -{ - if(png_ptr == NULL) return; - png_ptr->mmx_rowbytes_threshold = 0; - png_ptr->mmx_bitdepth_threshold = 0; - -# if (defined(PNG_USE_PNGVCRD) || defined(PNG_USE_PNGGCCRD)) - - png_ptr->asm_flags |= PNG_ASM_FLAG_MMX_SUPPORT_COMPILED; - - if (png_mmx_support() > 0) { - png_ptr->asm_flags |= PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU -# ifdef PNG_HAVE_MMX_COMBINE_ROW - | PNG_ASM_FLAG_MMX_READ_COMBINE_ROW -# endif -# ifdef PNG_HAVE_MMX_READ_INTERLACE - | PNG_ASM_FLAG_MMX_READ_INTERLACE -# endif -# ifndef PNG_HAVE_MMX_READ_FILTER_ROW - ; -# else - | PNG_ASM_FLAG_MMX_READ_FILTER_SUB - | PNG_ASM_FLAG_MMX_READ_FILTER_UP - | PNG_ASM_FLAG_MMX_READ_FILTER_AVG - | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ; - - png_ptr->mmx_rowbytes_threshold = PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT; - png_ptr->mmx_bitdepth_threshold = PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT; -# endif - } else { - png_ptr->asm_flags &= ~( PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU - | PNG_MMX_READ_FLAGS - | PNG_MMX_WRITE_FLAGS ); - } - -# else /* !(PNGVCRD || PNGGCCRD) */ - - /* clear all MMX flags; no support is compiled in */ - png_ptr->asm_flags &= ~( PNG_MMX_FLAGS ); - -# endif /* ?(PNGVCRD || PNGGCCRD) */ -} - -#endif /* !(PNG_MMX_CODE_SUPPORTED) */ - -/* this function was added to libpng 1.2.0 */ -#if !defined(PNG_USE_PNGGCCRD) && \ - !(defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_USE_PNGVCRD)) -int PNGAPI -png_mmx_support(void) -{ - return -1; -} -#endif -#endif /* PNG_1_0_X && PNG_ASSEMBLER_CODE_SUPPORTED */ -#endif /* PNG_READ_SUPPORTED */ - #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #ifdef PNG_SIZE_T /* Added at libpng version 1.2.6 */ diff --git a/src/dep/src/irrlicht/libpng/png.h b/src/dep/src/irrlicht/libpng/png.h index cda7162..97aee53 100644 --- a/src/dep/src/irrlicht/libpng/png.h +++ b/src/dep/src/irrlicht/libpng/png.h @@ -1,14 +1,14 @@ /* png.h - header file for PNG reference library * - * libpng version 1.2.35 - February 14, 2009 - * Copyright (c) 1998-2009 Glenn Randers-Pehrson + * libpng version 1.2.32 - September 18, 2008 + * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.2.35 - February 14, 2009: Glenn + * libpng versions 0.97, January 1998, through 1.2.32 - September 18, 2008: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: @@ -207,21 +207,6 @@ * 1.2.32rc01 13 10232 12.so.0.32[.0] * 1.0.40 10 10040 10.so.0.40[.0] * 1.2.32 13 10232 12.so.0.32[.0] - * 1.2.33beta01-02 13 10233 12.so.0.33[.0] - * 1.2.33rc01-02 13 10233 12.so.0.33[.0] - * 1.0.41rc01 10 10041 10.so.0.41[.0] - * 1.2.33 13 10233 12.so.0.33[.0] - * 1.0.41 10 10041 10.so.0.41[.0] - * 1.2.34beta01-07 13 10234 12.so.0.34[.0] - * 1.0.42rc01 10 10042 10.so.0.42[.0] - * 1.2.34rc01 13 10234 12.so.0.34[.0] - * 1.0.42 10 10042 10.so.0.42[.0] - * 1.2.34 13 10234 12.so.0.34[.0] - * 1.2.35beta01-03 13 10235 12.so.0.35[.0] - * 1.0.43rc01-02 10 10043 10.so.0.43[.0] - * 1.2.35rc01-02 13 10235 12.so.0.35[.0] - * 1.0.43 10 10043 10.so.0.43[.0] - * 1.2.35 13 10235 12.so.0.35[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be @@ -251,7 +236,7 @@ * If you modify libpng you may insert additional notices immediately following * this sentence. * - * libpng versions 1.2.6, August 15, 2004, through 1.2.35, February 14, 2009, are + * libpng versions 1.2.6, August 15, 2004, through 1.2.32, September 18, 2008, are * Copyright (c) 2004, 2006-2008 Glenn Randers-Pehrson, and are * distributed according to the same disclaimer and license as libpng-1.2.5 * with the following individual added to the list of Contributing Authors: @@ -363,13 +348,13 @@ * Y2K compliance in libpng: * ========================= * - * February 14, 2009 + * September 18, 2008 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. * * This is your unofficial assurance that libpng from version 0.71 and - * upward through 1.2.35 are Y2K compliant. It is my belief that earlier + * upward through 1.2.32 are Y2K compliant. It is my belief that earlier * versions were also Y2K compliant. * * Libpng only has three year fields. One is a 2-byte unsigned integer @@ -425,9 +410,9 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.2.35" +#define PNG_LIBPNG_VER_STRING "1.2.32" #define PNG_HEADER_VERSION_STRING \ - " libpng version 1.2.35 - February 14, 2009\n" + " libpng version 1.2.32 - September 18, 2008\n" #define PNG_LIBPNG_VER_SONUM 0 #define PNG_LIBPNG_VER_DLLNUM 13 @@ -435,7 +420,7 @@ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 2 -#define PNG_LIBPNG_VER_RELEASE 35 +#define PNG_LIBPNG_VER_RELEASE 32 /* This should match the numeric part of the final component of * PNG_LIBPNG_VER_STRING, omitting any leading zero: */ @@ -463,7 +448,7 @@ * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only * version 1.0.0 was mis-numbered 100 instead of 10000). From * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */ -#define PNG_LIBPNG_VER 10235 /* 1.2.35 */ +#define PNG_LIBPNG_VER 10232 /* 1.2.32 */ #ifndef PNG_VERSION_INFO_ONLY /* include the compression library's header */ @@ -1164,10 +1149,7 @@ typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp)); #define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */ #define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */ #define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */ -#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only, deprecated */ -/* Added to libpng-1.2.34 */ -#define PNG_TRANSFORM_STRIP_FILLER_BEFORE 0x0800 /* WRITE only */ -#define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* WRITE only */ +#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only */ /* Flags for MNG supported features */ #define PNG_FLAG_MNG_EMPTY_PLTE 0x01 @@ -1487,7 +1469,7 @@ struct png_struct_def /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ -typedef png_structp version_1_2_35; +typedef png_structp version_1_2_32; typedef png_struct FAR * FAR * png_structpp; @@ -2539,80 +2521,33 @@ extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr, #if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER) #include #if (PNG_DEBUG > 1) -#ifndef _DEBUG -# define _DEBUG -#endif -#ifndef png_debug -#define png_debug(l,m) _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE) -#endif -#ifndef png_debug1 -#define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1) -#endif -#ifndef png_debug2 -#define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2) -#endif +#define png_debug(l,m) _RPT0(_CRT_WARN,m) +#define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m,p1) +#define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m,p1,p2) #endif #else /* PNG_DEBUG_FILE || !_MSC_VER */ #ifndef PNG_DEBUG_FILE #define PNG_DEBUG_FILE stderr #endif /* PNG_DEBUG_FILE */ #if (PNG_DEBUG > 1) -#ifndef png_debug -/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on - * non-ISO compilers */ -#ifdef __STDC__ #define png_debug(l,m) \ { \ int num_tabs=l; \ - fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ + fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \ } -#endif -#ifndef png_debug1 #define png_debug1(l,m,p1) \ { \ int num_tabs=l; \ - fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ + fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \ } -#endif -#ifndef png_debug2 #define png_debug2(l,m,p1,p2) \ { \ int num_tabs=l; \ - fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ + fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \ } -#endif -#else /* __STDC __ */ -#ifndef png_debug -#define png_debug(l,m) \ - int num_tabs=l; \ - char format[256]; \ - snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \ - (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \ - m,PNG_STRING_NEWLINE); \ - fprintf(PNG_DEBUG_FILE,format); -#endif -#ifndef png_debug1 -#define png_debug1(l,m,p1) \ - int num_tabs=l; \ - char format[256]; \ - snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \ - (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \ - m,PNG_STRING_NEWLINE); \ - fprintf(PNG_DEBUG_FILE,format,p1); -#endif -#ifndef png_debug2 -#define png_debug2(l,m,p1,p2) \ - int num_tabs=l; \ - char format[256]; \ - snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \ - (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \ - m,PNG_STRING_NEWLINE); \ - fprintf(PNG_DEBUG_FILE,format,p1,p2); -#endif -#endif /* __STDC __ */ #endif /* (PNG_DEBUG > 1) */ #endif /* _MSC_VER */ #endif /* (PNG_DEBUG > 0) */ @@ -3644,3538 +3579,6 @@ png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)); /* Read the chunk header (length + type name) */ PNG_EXTERN png_uint_32 png_read_chunk_header PNGARG((png_structp png_ptr)); -/* Added at libpng version 1.2.34 */ -#if defined(PNG_cHRM_SUPPORTED) -PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr, - png_fixed_point int_white_x, png_fixed_point int_white_y, - png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point - int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, - png_fixed_point int_blue_y)); -#endif - -/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */ - -#endif /* PNG_INTERNAL */ - -#ifdef __cplusplus -} -#endif - -#endif /* PNG_VERSION_INFO_ONLY */ -/* do not put anything past this line */ -#endif /* PNG_H */ - -/* png.h - header file for PNG reference library - * - * libpng version 1.2.18 - May 15, 2007 - * Copyright (c) 1998-2007 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - * - * Authors and maintainers: - * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat - * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.2.18 - May 15, 2007: Glenn - * See also "Contributing Authors", below. - * - * Note about libpng version numbers: - * - * Due to various miscommunications, unforeseen code incompatibilities - * and occasional factors outside the authors' control, version numbering - * on the library has not always been consistent and straightforward. - * The following table summarizes matters since version 0.89c, which was - * the first widely used release: - * - * source png.h png.h shared-lib - * version string int version - * ------- ------ ----- ---------- - * 0.89c "1.0 beta 3" 0.89 89 1.0.89 - * 0.90 "1.0 beta 4" 0.90 90 0.90 [should have been 2.0.90] - * 0.95 "1.0 beta 5" 0.95 95 0.95 [should have been 2.0.95] - * 0.96 "1.0 beta 6" 0.96 96 0.96 [should have been 2.0.96] - * 0.97b "1.00.97 beta 7" 1.00.97 97 1.0.1 [should have been 2.0.97] - * 0.97c 0.97 97 2.0.97 - * 0.98 0.98 98 2.0.98 - * 0.99 0.99 98 2.0.99 - * 0.99a-m 0.99 99 2.0.99 - * 1.00 1.00 100 2.1.0 [100 should be 10000] - * 1.0.0 (from here on, the 100 2.1.0 [100 should be 10000] - * 1.0.1 png.h string is 10001 2.1.0 - * 1.0.1a-e identical to the 10002 from here on, the shared library - * 1.0.2 source version) 10002 is 2.V where V is the source code - * 1.0.2a-b 10003 version, except as noted. - * 1.0.3 10003 - * 1.0.3a-d 10004 - * 1.0.4 10004 - * 1.0.4a-f 10005 - * 1.0.5 (+ 2 patches) 10005 - * 1.0.5a-d 10006 - * 1.0.5e-r 10100 (not source compatible) - * 1.0.5s-v 10006 (not binary compatible) - * 1.0.6 (+ 3 patches) 10006 (still binary incompatible) - * 1.0.6d-f 10007 (still binary incompatible) - * 1.0.6g 10007 - * 1.0.6h 10007 10.6h (testing xy.z so-numbering) - * 1.0.6i 10007 10.6i - * 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0) - * 1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 (binary compatible) - * 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible) - * 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible) - * 1.0.7 1 10007 (still compatible) - * 1.0.8beta1-4 1 10008 2.1.0.8beta1-4 - * 1.0.8rc1 1 10008 2.1.0.8rc1 - * 1.0.8 1 10008 2.1.0.8 - * 1.0.9beta1-6 1 10009 2.1.0.9beta1-6 - * 1.0.9rc1 1 10009 2.1.0.9rc1 - * 1.0.9beta7-10 1 10009 2.1.0.9beta7-10 - * 1.0.9rc2 1 10009 2.1.0.9rc2 - * 1.0.9 1 10009 2.1.0.9 - * 1.0.10beta1 1 10010 2.1.0.10beta1 - * 1.0.10rc1 1 10010 2.1.0.10rc1 - * 1.0.10 1 10010 2.1.0.10 - * 1.0.11beta1-3 1 10011 2.1.0.11beta1-3 - * 1.0.11rc1 1 10011 2.1.0.11rc1 - * 1.0.11 1 10011 2.1.0.11 - * 1.0.12beta1-2 2 10012 2.1.0.12beta1-2 - * 1.0.12rc1 2 10012 2.1.0.12rc1 - * 1.0.12 2 10012 2.1.0.12 - * 1.1.0a-f - 10100 2.1.1.0a-f (branch abandoned) - * 1.2.0beta1-2 2 10200 2.1.2.0beta1-2 - * 1.2.0beta3-5 3 10200 3.1.2.0beta3-5 - * 1.2.0rc1 3 10200 3.1.2.0rc1 - * 1.2.0 3 10200 3.1.2.0 - * 1.2.1beta1-4 3 10201 3.1.2.1beta1-4 - * 1.2.1rc1-2 3 10201 3.1.2.1rc1-2 - * 1.2.1 3 10201 3.1.2.1 - * 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6 - * 1.0.13beta1 10 10013 10.so.0.1.0.13beta1 - * 1.0.13rc1 10 10013 10.so.0.1.0.13rc1 - * 1.2.2rc1 12 10202 12.so.0.1.2.2rc1 - * 1.0.13 10 10013 10.so.0.1.0.13 - * 1.2.2 12 10202 12.so.0.1.2.2 - * 1.2.3rc1-6 12 10203 12.so.0.1.2.3rc1-6 - * 1.2.3 12 10203 12.so.0.1.2.3 - * 1.2.4beta1-3 13 10204 12.so.0.1.2.4beta1-3 - * 1.0.14rc1 13 10014 10.so.0.1.0.14rc1 - * 1.2.4rc1 13 10204 12.so.0.1.2.4rc1 - * 1.0.14 10 10014 10.so.0.1.0.14 - * 1.2.4 13 10204 12.so.0.1.2.4 - * 1.2.5beta1-2 13 10205 12.so.0.1.2.5beta1-2 - * 1.0.15rc1-3 10 10015 10.so.0.1.0.15rc1-3 - * 1.2.5rc1-3 13 10205 12.so.0.1.2.5rc1-3 - * 1.0.15 10 10015 10.so.0.1.0.15 - * 1.2.5 13 10205 12.so.0.1.2.5 - * 1.2.6beta1-4 13 10206 12.so.0.1.2.6beta1-4 - * 1.0.16 10 10016 10.so.0.1.0.16 - * 1.2.6 13 10206 12.so.0.1.2.6 - * 1.2.7beta1-2 13 10207 12.so.0.1.2.7beta1-2 - * 1.0.17rc1 10 10017 10.so.0.1.0.17rc1 - * 1.2.7rc1 13 10207 12.so.0.1.2.7rc1 - * 1.0.17 10 10017 10.so.0.1.0.17 - * 1.2.7 13 10207 12.so.0.1.2.7 - * 1.2.8beta1-5 13 10208 12.so.0.1.2.8beta1-5 - * 1.0.18rc1-5 10 10018 10.so.0.1.0.18rc1-5 - * 1.2.8rc1-5 13 10208 12.so.0.1.2.8rc1-5 - * 1.0.18 10 10018 10.so.0.1.0.18 - * 1.2.8 13 10208 12.so.0.1.2.8 - * 1.2.9beta1-3 13 10209 12.so.0.1.2.9beta1-3 - * 1.2.9beta4-11 13 10209 12.so.0.9[.0] - * 1.2.9rc1 13 10209 12.so.0.9[.0] - * 1.2.9 13 10209 12.so.0.9[.0] - * 1.2.10beta1-8 13 10210 12.so.0.10[.0] - * 1.2.10rc1-3 13 10210 12.so.0.10[.0] - * 1.2.10 13 10210 12.so.0.10[.0] - * 1.2.11beta1-4 13 10211 12.so.0.11[.0] - * 1.0.19rc1-5 10 10019 10.so.0.19[.0] - * 1.2.11rc1-5 13 10211 12.so.0.11[.0] - * 1.0.19 10 10019 10.so.0.19[.0] - * 1.2.11 13 10211 12.so.0.11[.0] - * 1.0.20 10 10020 10.so.0.20[.0] - * 1.2.12 13 10212 12.so.0.12[.0] - * 1.2.13beta1 13 10213 12.so.0.13[.0] - * 1.0.21 10 10021 10.so.0.21[.0] - * 1.2.13 13 10213 12.so.0.13[.0] - * 1.2.14beta1-2 13 10214 12.so.0.14[.0] - * 1.0.22rc1 10 10022 10.so.0.22[.0] - * 1.2.14rc1 13 10214 12.so.0.14[.0] - * 1.0.22 10 10022 10.so.0.22[.0] - * 1.2.14 13 10214 12.so.0.14[.0] - * 1.2.15beta1-6 13 10215 12.so.0.15[.0] - * 1.0.23rc1-5 10 10023 10.so.0.23[.0] - * 1.2.15rc1-5 13 10215 12.so.0.15[.0] - * 1.0.23 10 10023 10.so.0.23[.0] - * 1.2.15 13 10215 12.so.0.15[.0] - * 1.2.16beta1-2 13 10216 12.so.0.16[.0] - * 1.2.16rc1 13 10216 12.so.0.16[.0] - * 1.0.24 10 10024 10.so.0.24[.0] - * 1.2.16 13 10216 12.so.0.16[.0] - * 1.2.17beta1-2 13 10217 12.so.0.17[.0] - * 1.0.25rc1 10 10025 10.so.0.25[.0] - * 1.2.17rc1-3 13 10217 12.so.0.17[.0] - * 1.0.25 10 10025 10.so.0.25[.0] - * 1.2.17 13 10217 12.so.0.17[.0] - * 1.0.26 10 10026 10.so.0.26[.0] - * 1.2.18 13 10218 12.so.0.18[.0] - * - * Henceforth the source version will match the shared-library major - * and minor numbers; the shared-library major version number will be - * used for changes in backward compatibility, as it is intended. The - * PNG_LIBPNG_VER macro, which is not used within libpng but is available - * for applications, is an unsigned integer of the form xyyzz corresponding - * to the source version x.y.z (leading zeros in y and z). Beta versions - * were given the previous public release number plus a letter, until - * version 1.0.6j; from then on they were given the upcoming public - * release number plus "betaNN" or "rcN". - * - * Binary incompatibility exists only when applications make direct access - * to the info_ptr or png_ptr members through png.h, and the compiled - * application is loaded with a different version of the library. - * - * DLLNUM will change each time there are forward or backward changes - * in binary compatibility (e.g., when a new feature is added). - * - * See libpng.txt or libpng.3 for more information. The PNG specification - * is available as a W3C Recommendation and as an ISO Specification, - * defines should NOT be changed. - */ -#define PNG_INFO_gAMA 0x0001 -#define PNG_INFO_sBIT 0x0002 -#define PNG_INFO_cHRM 0x0004 -#define PNG_INFO_PLTE 0x0008 -#define PNG_INFO_tRNS 0x0010 -#define PNG_INFO_bKGD 0x0020 -#define PNG_INFO_hIST 0x0040 -#define PNG_INFO_pHYs 0x0080 -#define PNG_INFO_oFFs 0x0100 -#define PNG_INFO_tIME 0x0200 -#define PNG_INFO_pCAL 0x0400 -#define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */ -#define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */ -#define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */ -#define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */ -#define PNG_INFO_IDAT 0x8000L /* ESR, 1.0.6 */ - -/* This is used for the transformation routines, as some of them - * change these values for the row. It also should enable using - * the routines for other purposes. - */ -typedef struct png_row_info_struct -{ - png_uint_32 width; /* width of row */ - png_uint_32 rowbytes; /* number of bytes in row */ - png_byte color_type; /* color type of row */ - png_byte bit_depth; /* bit depth of row */ - png_byte channels; /* number of channels (1, 2, 3, or 4) */ - png_byte pixel_depth; /* bits per pixel (depth * channels) */ -} png_row_info; - -typedef png_row_info FAR * png_row_infop; -typedef png_row_info FAR * FAR * png_row_infopp; - -/* These are the function types for the I/O functions and for the functions - * that allow the user to override the default I/O functions with his or her - * own. The png_error_ptr type should match that of user-supplied warning - * and error functions, while the png_rw_ptr type should match that of the - * user read/write data functions. - */ -typedef struct png_struct_def png_struct; -typedef png_struct FAR * png_structp; - -typedef void (PNGAPI *png_error_ptr) PNGARG((png_structp, png_const_charp)); -typedef void (PNGAPI *png_rw_ptr) PNGARG((png_structp, png_bytep, png_size_t)); -typedef void (PNGAPI *png_flush_ptr) PNGARG((png_structp)); -typedef void (PNGAPI *png_read_status_ptr) PNGARG((png_structp, png_uint_32, - int)); -typedef void (PNGAPI *png_write_status_ptr) PNGARG((png_structp, png_uint_32, - int)); - -#ifdef PNG_PROGRESSIVE_READ_SUPPORTED -typedef void (PNGAPI *png_progressive_info_ptr) PNGARG((png_structp, png_infop)); -typedef void (PNGAPI *png_progressive_end_ptr) PNGARG((png_structp, png_infop)); -typedef void (PNGAPI *png_progressive_row_ptr) PNGARG((png_structp, png_bytep, - png_uint_32, int)); -#endif - -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_LEGACY_SUPPORTED) -typedef void (PNGAPI *png_user_transform_ptr) PNGARG((png_structp, - png_row_infop, png_bytep)); -#endif - -#if defined(PNG_USER_CHUNKS_SUPPORTED) -typedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp, png_unknown_chunkp)); -#endif -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) -typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp)); -#endif - -/* Transform masks for the high-level interface */ -#define PNG_TRANSFORM_IDENTITY 0x0000 /* read and write */ -#define PNG_TRANSFORM_STRIP_16 0x0001 /* read only */ -#define PNG_TRANSFORM_STRIP_ALPHA 0x0002 /* read only */ -#define PNG_TRANSFORM_PACKING 0x0004 /* read and write */ -#define PNG_TRANSFORM_PACKSWAP 0x0008 /* read and write */ -#define PNG_TRANSFORM_EXPAND 0x0010 /* read only */ -#define PNG_TRANSFORM_INVERT_MONO 0x0020 /* read and write */ -#define PNG_TRANSFORM_SHIFT 0x0040 /* read and write */ -#define PNG_TRANSFORM_BGR 0x0080 /* read and write */ -#define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */ -#define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */ -#define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */ -#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only */ - -/* Flags for MNG supported features */ -#define PNG_FLAG_MNG_EMPTY_PLTE 0x01 -#define PNG_FLAG_MNG_FILTER_64 0x04 -#define PNG_ALL_MNG_FEATURES 0x05 - -typedef png_voidp (*png_malloc_ptr) PNGARG((png_structp, png_size_t)); -typedef void (*png_free_ptr) PNGARG((png_structp, png_voidp)); - -/* The structure that holds the information to read and write PNG files. - * The only people who need to care about what is inside of this are the - * people who will be modifying the library for their own special needs. - * It should NOT be accessed directly by an application, except to store - * the jmp_buf. - */ - -struct png_struct_def -{ -#ifdef PNG_SETJMP_SUPPORTED - jmp_buf jmpbuf; /* used in png_error */ -#endif - png_error_ptr error_fn; /* function for printing errors and aborting */ - png_error_ptr warning_fn; /* function for printing warnings */ - png_voidp error_ptr; /* user supplied struct for error functions */ - png_rw_ptr write_data_fn; /* function for writing output data */ - png_rw_ptr read_data_fn; /* function for reading input data */ - png_voidp io_ptr; /* ptr to application struct for I/O functions */ - -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) - png_user_transform_ptr read_user_transform_fn; /* user read transform */ -#endif - -#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) - png_user_transform_ptr write_user_transform_fn; /* user write transform */ -#endif - -/* These were added in libpng-1.0.2 */ -#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) - png_voidp user_transform_ptr; /* user supplied struct for user transform */ - png_byte user_transform_depth; /* bit depth of user transformed pixels */ - png_byte user_transform_channels; /* channels in user transformed pixels */ -#endif -#endif - - png_uint_32 mode; /* tells us where we are in the PNG file */ - png_uint_32 flags; /* flags indicating various things to libpng */ - png_uint_32 transformations; /* which transformations to perform */ - - z_stream zstream; /* pointer to decompression structure (below) */ - png_bytep zbuf; /* buffer for zlib */ - png_size_t zbuf_size; /* size of zbuf */ - int zlib_level; /* holds zlib compression level */ - int zlib_method; /* holds zlib compression method */ - int zlib_window_bits; /* holds zlib compression window bits */ - int zlib_mem_level; /* holds zlib compression memory level */ - int zlib_strategy; /* holds zlib compression strategy */ - - png_uint_32 width; /* width of image in pixels */ - png_uint_32 height; /* height of image in pixels */ - png_uint_32 num_rows; /* number of rows in current pass */ - png_uint_32 usr_width; /* width of row at start of write */ - png_uint_32 rowbytes; /* size of row in bytes */ - png_uint_32 irowbytes; /* size of current interlaced row in bytes */ - png_uint_32 iwidth; /* width of current interlaced row in pixels */ - png_uint_32 row_number; /* current row in interlace pass */ - png_bytep prev_row; /* buffer to save previous (unfiltered) row */ - png_bytep row_buf; /* buffer to save current (unfiltered) row */ - png_bytep sub_row; /* buffer to save "sub" row when filtering */ - png_bytep up_row; /* buffer to save "up" row when filtering */ - png_bytep avg_row; /* buffer to save "avg" row when filtering */ - png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */ - png_row_info row_info; /* used for transformation routines */ - - png_uint_32 idat_size; /* current IDAT size for read */ - png_uint_32 crc; /* current chunk CRC value */ - png_colorp palette; /* palette from the input file */ - png_uint_16 num_palette; /* number of color entries in palette */ - png_uint_16 num_trans; /* number of transparency values */ - png_byte chunk_name[5]; /* null-terminated name of current chunk */ - png_byte compression; /* file compression type (always 0) */ - png_byte filter; /* file filter type (always 0) */ - png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */ - png_byte pass; /* current interlace pass (0 - 6) */ - png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */ - png_byte color_type; /* color type of file */ - png_byte bit_depth; /* bit depth of file */ - png_byte usr_bit_depth; /* bit depth of users row */ - png_byte pixel_depth; /* number of bits per pixel */ - png_byte channels; /* number of channels in file */ - png_byte usr_channels; /* channels at start of write */ - png_byte sig_bytes; /* magic bytes read/written from start of file */ - -#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) -#ifdef PNG_LEGACY_SUPPORTED - png_byte filler; /* filler byte for pixel expansion */ -#else - png_uint_16 filler; /* filler bytes for pixel expansion */ -#endif -#endif - -#if defined(PNG_bKGD_SUPPORTED) - png_byte background_gamma_type; -# ifdef PNG_FLOATING_POINT_SUPPORTED - float background_gamma; -# endif - png_color_16 background; /* background color in screen gamma space */ -#if defined(PNG_READ_GAMMA_SUPPORTED) - png_color_16 background_1; /* background normalized to gamma 1.0 */ -#endif -#endif /* PNG_bKGD_SUPPORTED */ - -#if defined(PNG_WRITE_FLUSH_SUPPORTED) - png_flush_ptr output_flush_fn;/* Function for flushing output */ - png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */ - png_uint_32 flush_rows; /* number of rows written since last flush */ -#endif - -#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) - int gamma_shift; /* number of "insignificant" bits 16-bit gamma */ -#ifdef PNG_FLOATING_POINT_SUPPORTED - float gamma; /* file gamma value */ - float screen_gamma; /* screen gamma value (display_exponent) */ -#endif -#endif - -#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) - png_bytep gamma_table; /* gamma table for 8-bit depth files */ - png_bytep gamma_from_1; /* converts from 1.0 to screen */ - png_bytep gamma_to_1; /* converts from file to 1.0 */ - png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */ - png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */ - png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */ -#endif - -#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED) - png_color_8 sig_bit; /* significant bits in each available channel */ -#endif - -#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) - png_color_8 shift; /* shift for significant bit tranformation */ -#endif - -#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \ - || defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) - png_bytep trans; /* transparency values for paletted files */ - png_color_16 trans_values; /* transparency values for non-paletted files */ -#endif - - png_read_status_ptr read_row_fn; /* called after each row is decoded */ - png_write_status_ptr write_row_fn; /* called after each row is encoded */ -#ifdef PNG_PROGRESSIVE_READ_SUPPORTED - png_progressive_info_ptr info_fn; /* called after header data fully read */ - png_progressive_row_ptr row_fn; /* called after each prog. row is decoded */ - png_progressive_end_ptr end_fn; /* called after image is complete */ - png_bytep save_buffer_ptr; /* current location in save_buffer */ - png_bytep save_buffer; /* buffer for previously read data */ - png_bytep current_buffer_ptr; /* current location in current_buffer */ - png_bytep current_buffer; /* buffer for recently used data */ - png_uint_32 push_length; /* size of current input chunk */ - png_uint_32 skip_length; /* bytes to skip in input data */ - png_size_t save_buffer_size; /* amount of data now in save_buffer */ - png_size_t save_buffer_max; /* total size of save_buffer */ - png_size_t buffer_size; /* total amount of available input data */ - png_size_t current_buffer_size; /* amount of data now in current_buffer */ - int process_mode; /* what push library is currently doing */ - int cur_palette; /* current push library palette index */ - -# if defined(PNG_TEXT_SUPPORTED) - png_size_t current_text_size; /* current size of text input data */ - png_size_t current_text_left; /* how much text left to read in input */ - png_charp current_text; /* current text chunk buffer */ - png_charp current_text_ptr; /* current location in current_text */ -# endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_TEXT_SUPPORTED */ - -#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ - -#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__) -/* for the Borland special 64K segment handler */ - png_bytepp offset_table_ptr; - png_bytep offset_table; - png_uint_16 offset_table_number; - png_uint_16 offset_table_count; - png_uint_16 offset_table_count_free; -#endif - -#if defined(PNG_READ_DITHER_SUPPORTED) - png_bytep palette_lookup; /* lookup table for dithering */ - png_bytep dither_index; /* index translation for palette files */ -#endif - -#if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_hIST_SUPPORTED) - png_uint_16p hist; /* histogram */ -#endif - -#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) - png_byte heuristic_method; /* heuristic for row filter selection */ - png_byte num_prev_filters; /* number of weights for previous rows */ - png_bytep prev_filters; /* filter type(s) of previous row(s) */ - png_uint_16p filter_weights; /* weight(s) for previous line(s) */ - png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */ - png_uint_16p filter_costs; /* relative filter calculation cost */ - png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */ -#endif - -#if defined(PNG_TIME_RFC1123_SUPPORTED) - png_charp time_buffer; /* String to hold RFC 1123 time text */ -#endif - -/* New members added in libpng-1.0.6 */ - -#ifdef PNG_FREE_ME_SUPPORTED - png_uint_32 free_me; /* flags items libpng is responsible for freeing */ -#endif - -#if defined(PNG_USER_CHUNKS_SUPPORTED) - png_voidp user_chunk_ptr; - png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */ -#endif - -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) - int num_chunk_list; - png_bytep chunk_list; -#endif - -/* New members added in libpng-1.0.3 */ -#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) - png_byte rgb_to_gray_status; - /* These were changed from png_byte in libpng-1.0.6 */ - png_uint_16 rgb_to_gray_red_coeff; - png_uint_16 rgb_to_gray_green_coeff; - png_uint_16 rgb_to_gray_blue_coeff; -#endif - -/* New member added in libpng-1.0.4 (renamed in 1.0.9) */ -#if defined(PNG_MNG_FEATURES_SUPPORTED) || \ - defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \ - defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED) -/* changed from png_byte to png_uint_32 at version 1.2.0 */ -#ifdef PNG_1_0_X - png_byte mng_features_permitted; -#else - png_uint_32 mng_features_permitted; -#endif /* PNG_1_0_X */ -#endif - -/* New member added in libpng-1.0.7 */ -#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) - png_fixed_point int_gamma; -#endif - -/* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */ -#if defined(PNG_MNG_FEATURES_SUPPORTED) - png_byte filter_type; -#endif - -#if defined(PNG_1_0_X) || (defined(PNG_DEBUG) && defined(PNG_USE_PNGGCCRD)) -/* New member added in libpng-1.0.10, ifdef'ed out in 1.2.0 */ - png_uint_32 row_buf_size; -#endif - -/* New members added in libpng-1.2.0 */ -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) -# if !defined(PNG_1_0_X) -# if defined(PNG_MMX_CODE_SUPPORTED) - png_byte mmx_bitdepth_threshold; - png_uint_32 mmx_rowbytes_threshold; -# endif - png_uint_32 asm_flags; -# endif -#endif - -/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */ -#ifdef PNG_USER_MEM_SUPPORTED - png_voidp mem_ptr; /* user supplied struct for mem functions */ - png_malloc_ptr malloc_fn; /* function for allocating memory */ - png_free_ptr free_fn; /* function for freeing memory */ -#endif - -/* New member added in libpng-1.0.13 and 1.2.0 */ - png_bytep big_row_buf; /* buffer to save current (unfiltered) row */ - -#if defined(PNG_READ_DITHER_SUPPORTED) -/* The following three members were added at version 1.0.14 and 1.2.4 */ - png_bytep dither_sort; /* working sort array */ - png_bytep index_to_palette; /* where the original index currently is */ - /* in the palette */ - png_bytep palette_to_index; /* which original index points to this */ - /* palette color */ -#endif - -/* New members added in libpng-1.0.16 and 1.2.6 */ - png_byte compression_type; - -#ifdef PNG_SET_USER_LIMITS_SUPPORTED - png_uint_32 user_width_max; - png_uint_32 user_height_max; -#endif - -/* New member added in libpng-1.0.25 and 1.2.17 */ -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) - /* storage for unknown chunk that the library doesn't recognize. */ - png_unknown_chunk unknown_chunk; -#endif -}; - - -/* This triggers a compiler error in png.c, if png.c and png.h - * do not agree upon the version number. - */ -typedef png_structp version_1_2_18; - -typedef png_struct FAR * FAR * png_structpp; - -/* Here are the function definitions most commonly used. This is not - * the place to find out how to use libpng. See libpng.txt for the - * full explanation, see example.c for the summary. This just provides - * a simple one line description of the use of each function. - */ - -/* Returns the version number of the library */ -extern PNG_EXPORT(png_uint_32,png_access_version_number) PNGARG((void)); - -/* Tell lib we have already handled the first magic bytes. - * Handling more than 8 bytes from the beginning of the file is an error. - */ -extern PNG_EXPORT(void,png_set_sig_bytes) PNGARG((png_structp png_ptr, - int num_bytes)); - -/* Check sig[start] through sig[start + num_to_check - 1] to see if it's a - * PNG file. Returns zero if the supplied bytes match the 8-byte PNG - * signature, and non-zero otherwise. Having num_to_check == 0 or - * start > 7 will always fail (ie return non-zero). - */ -extern PNG_EXPORT(int,png_sig_cmp) PNGARG((png_bytep sig, png_size_t start, - png_size_t num_to_check)); - -/* Simple signature checking function. This is the same as calling - * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n). - */ -extern PNG_EXPORT(int,png_check_sig) PNGARG((png_bytep sig, int num)); - -/* Allocate and initialize png_ptr struct for reading, and any other memory. */ -extern PNG_EXPORT(png_structp,png_create_read_struct) - PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, - png_error_ptr error_fn, png_error_ptr warn_fn)); - -/* Allocate and initialize png_ptr struct for writing, and any other memory */ -extern PNG_EXPORT(png_structp,png_create_write_struct) - PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, - png_error_ptr error_fn, png_error_ptr warn_fn)); - -#ifdef PNG_WRITE_SUPPORTED -extern PNG_EXPORT(png_uint_32,png_get_compression_buffer_size) - PNGARG((png_structp png_ptr)); -#endif - -#ifdef PNG_WRITE_SUPPORTED -extern PNG_EXPORT(void,png_set_compression_buffer_size) - PNGARG((png_structp png_ptr, png_uint_32 size)); -#endif - -/* Reset the compression stream */ -extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr)); - -/* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */ -#ifdef PNG_USER_MEM_SUPPORTED -extern PNG_EXPORT(png_structp,png_create_read_struct_2) - PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, - png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, - png_malloc_ptr malloc_fn, png_free_ptr free_fn)); -extern PNG_EXPORT(png_structp,png_create_write_struct_2) - PNGARG((png_const_charp user_png_ver, png_voidp error_ptr, - png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, - png_malloc_ptr malloc_fn, png_free_ptr free_fn)); -#endif - -/* Write a PNG chunk - size, type, (optional) data, CRC. */ -extern PNG_EXPORT(void,png_write_chunk) PNGARG((png_structp png_ptr, - png_bytep chunk_name, png_bytep data, png_size_t length)); - -/* Write the start of a PNG chunk - length and chunk name. */ -extern PNG_EXPORT(void,png_write_chunk_start) PNGARG((png_structp png_ptr, - png_bytep chunk_name, png_uint_32 length)); - -/* Write the data of a PNG chunk started with png_write_chunk_start(). */ -extern PNG_EXPORT(void,png_write_chunk_data) PNGARG((png_structp png_ptr, - png_bytep data, png_size_t length)); - -/* Finish a chunk started with png_write_chunk_start() (includes CRC). */ -extern PNG_EXPORT(void,png_write_chunk_end) PNGARG((png_structp png_ptr)); - -/* Allocate and initialize the info structure */ -extern PNG_EXPORT(png_infop,png_create_info_struct) - PNGARG((png_structp png_ptr)); - -#if defined(PNG_1_0_X) || defined (PNG_1_2_X) -/* Initialize the info structure (old interface - DEPRECATED) */ -extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr)); -#undef png_info_init -#define png_info_init(info_ptr) png_info_init_3(&info_ptr,\ - png_sizeof(png_info)); -#endif - -extern PNG_EXPORT(void,png_info_init_3) PNGARG((png_infopp info_ptr, - png_size_t png_info_struct_size)); - -/* Writes all the PNG information before the image. */ -extern PNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr, - png_infop info_ptr)); -extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr, - png_infop info_ptr)); - -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED -/* read the information before the actual image data. */ -extern PNG_EXPORT(void,png_read_info) PNGARG((png_structp png_ptr, - png_infop info_ptr)); -#endif - -#if defined(PNG_TIME_RFC1123_SUPPORTED) -extern PNG_EXPORT(png_charp,png_convert_to_rfc1123) - PNGARG((png_structp png_ptr, png_timep ptime)); -#endif - -#if !defined(_WIN32_WCE) -/* "time.h" functions are not supported on WindowsCE */ -#if defined(PNG_WRITE_tIME_SUPPORTED) -/* convert from a struct tm to png_time */ -extern PNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime, - struct tm FAR * ttime)); - -/* convert from time_t to png_time. Uses gmtime() */ -extern PNG_EXPORT(void,png_convert_from_time_t) PNGARG((png_timep ptime, - time_t ttime)); -#endif /* PNG_WRITE_tIME_SUPPORTED */ -#endif /* _WIN32_WCE */ - -#if defined(PNG_READ_EXPAND_SUPPORTED) -/* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */ -extern PNG_EXPORT(void,png_set_expand) PNGARG((png_structp png_ptr)); -#if !defined(PNG_1_0_X) -extern PNG_EXPORT(void,png_set_expand_gray_1_2_4_to_8) PNGARG((png_structp - png_ptr)); -#endif -extern PNG_EXPORT(void,png_set_palette_to_rgb) PNGARG((png_structp png_ptr)); -extern PNG_EXPORT(void,png_set_tRNS_to_alpha) PNGARG((png_structp png_ptr)); -#if defined(PNG_1_0_X) || defined (PNG_1_2_X) -/* Deprecated */ -extern PNG_EXPORT(void,png_set_gray_1_2_4_to_8) PNGARG((png_structp png_ptr)); -#endif -#endif - -#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) -/* Use blue, green, red order for pixels. */ -extern PNG_EXPORT(void,png_set_bgr) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) -/* Expand the grayscale to 24-bit RGB if necessary. */ -extern PNG_EXPORT(void,png_set_gray_to_rgb) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) -/* Reduce RGB to grayscale. */ -#ifdef PNG_FLOATING_POINT_SUPPORTED -extern PNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr, - int error_action, double red, double green )); -#endif -extern PNG_EXPORT(void,png_set_rgb_to_gray_fixed) PNGARG((png_structp png_ptr, - int error_action, png_fixed_point red, png_fixed_point green )); -extern PNG_EXPORT(png_byte,png_get_rgb_to_gray_status) PNGARG((png_structp - png_ptr)); -#endif - -extern PNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth, - png_colorp palette)); - -#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED) -extern PNG_EXPORT(void,png_set_strip_alpha) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \ - defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) -extern PNG_EXPORT(void,png_set_swap_alpha) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \ - defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) -extern PNG_EXPORT(void,png_set_invert_alpha) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) -/* Add a filler byte to 8-bit Gray or 24-bit RGB images. */ -extern PNG_EXPORT(void,png_set_filler) PNGARG((png_structp png_ptr, - png_uint_32 filler, int flags)); -/* The values of the PNG_FILLER_ defines should NOT be changed */ -#define PNG_FILLER_BEFORE 0 -#define PNG_FILLER_AFTER 1 -/* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */ -#if !defined(PNG_1_0_X) -extern PNG_EXPORT(void,png_set_add_alpha) PNGARG((png_structp png_ptr, - png_uint_32 filler, int flags)); -#endif -#endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */ - -#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) -/* Swap bytes in 16-bit depth files. */ -extern PNG_EXPORT(void,png_set_swap) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) -/* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */ -extern PNG_EXPORT(void,png_set_packing) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED) -/* Swap packing order of pixels in bytes. */ -extern PNG_EXPORT(void,png_set_packswap) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) -/* Converts files to legal bit depths. */ -extern PNG_EXPORT(void,png_set_shift) PNGARG((png_structp png_ptr, - png_color_8p true_bits)); -#endif - -#if defined(PNG_READ_INTERLACING_SUPPORTED) || \ - defined(PNG_WRITE_INTERLACING_SUPPORTED) -/* Have the code handle the interlacing. Returns the number of passes. */ -extern PNG_EXPORT(int,png_set_interlace_handling) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) -/* Invert monochrome files */ -extern PNG_EXPORT(void,png_set_invert_mono) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_BACKGROUND_SUPPORTED) -/* Handle alpha and tRNS by replacing with a background color. */ -#ifdef PNG_FLOATING_POINT_SUPPORTED -extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr, - png_color_16p background_color, int background_gamma_code, - int need_expand, double background_gamma)); -#endif -#define PNG_BACKGROUND_GAMMA_UNKNOWN 0 -#define PNG_BACKGROUND_GAMMA_SCREEN 1 -#define PNG_BACKGROUND_GAMMA_FILE 2 -#define PNG_BACKGROUND_GAMMA_UNIQUE 3 -#endif - -#if defined(PNG_READ_16_TO_8_SUPPORTED) -/* strip the second byte of information from a 16-bit depth file. */ -extern PNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_DITHER_SUPPORTED) -/* Turn on dithering, and reduce the palette to the number of colors available. */ -extern PNG_EXPORT(void,png_set_dither) PNGARG((png_structp png_ptr, - png_colorp palette, int num_palette, int maximum_colors, - png_uint_16p histogram, int full_dither)); -#endif - -#if defined(PNG_READ_GAMMA_SUPPORTED) -/* Handle gamma correction. Screen_gamma=(display_exponent) */ -#ifdef PNG_FLOATING_POINT_SUPPORTED -extern PNG_EXPORT(void,png_set_gamma) PNGARG((png_structp png_ptr, - double screen_gamma, double default_file_gamma)); -#endif -#endif - -#if defined(PNG_1_0_X) || defined (PNG_1_2_X) -#if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \ - defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED) -/* Permit or disallow empty PLTE (0: not permitted, 1: permitted) */ -/* Deprecated and will be removed. Use png_permit_mng_features() instead. */ -extern PNG_EXPORT(void,png_permit_empty_plte) PNGARG((png_structp png_ptr, - int empty_plte_permitted)); -#endif -#endif - -#if defined(PNG_WRITE_FLUSH_SUPPORTED) -/* Set how many lines between output flushes - 0 for no flushing */ -extern PNG_EXPORT(void,png_set_flush) PNGARG((png_structp png_ptr, int nrows)); -/* Flush the current PNG output buffer */ -extern PNG_EXPORT(void,png_write_flush) PNGARG((png_structp png_ptr)); -#endif - -/* optional update palette with requested transformations */ -extern PNG_EXPORT(void,png_start_read_image) PNGARG((png_structp png_ptr)); - -/* optional call to update the users info structure */ -extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr, - png_infop info_ptr)); - -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED -/* read one or more rows of image data. */ -extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr, - png_bytepp row, png_bytepp display_row, png_uint_32 num_rows)); -#endif - -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED -/* read a row of data. */ -extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr, - png_bytep row, - png_bytep display_row)); -#endif - -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED -/* read the whole image into memory at once. */ -extern PNG_EXPORT(void,png_read_image) PNGARG((png_structp png_ptr, - png_bytepp image)); -#endif - -/* write a row of image data */ -extern PNG_EXPORT(void,png_write_row) PNGARG((png_structp png_ptr, - png_bytep row)); - -/* write a few rows of image data */ -extern PNG_EXPORT(void,png_write_rows) PNGARG((png_structp png_ptr, - png_bytepp row, png_uint_32 num_rows)); - -/* write the image data */ -extern PNG_EXPORT(void,png_write_image) PNGARG((png_structp png_ptr, - png_bytepp image)); - -/* writes the end of the PNG file. */ -extern PNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr, - png_infop info_ptr)); - -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED -/* read the end of the PNG file. */ -extern PNG_EXPORT(void,png_read_end) PNGARG((png_structp png_ptr, - png_infop info_ptr)); -#endif - -/* free any memory associated with the png_info_struct */ -extern PNG_EXPORT(void,png_destroy_info_struct) PNGARG((png_structp png_ptr, - png_infopp info_ptr_ptr)); - -/* free any memory associated with the png_struct and the png_info_structs */ -extern PNG_EXPORT(void,png_destroy_read_struct) PNGARG((png_structpp - png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr)); - -/* free all memory used by the read (old method - NOT DLL EXPORTED) */ -extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr, - png_infop end_info_ptr)); - -/* free any memory associated with the png_struct and the png_info_structs */ -extern PNG_EXPORT(void,png_destroy_write_struct) - PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)); - -/* free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */ -extern void png_write_destroy PNGARG((png_structp png_ptr)); - -/* set the libpng method of handling chunk CRC errors */ -extern PNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr, - int crit_action, int ancil_action)); - -/* Values for png_set_crc_action() to say how to handle CRC errors in - * ancillary and critical chunks, and whether to use the data contained - * therein. Note that it is impossible to "discard" data in a critical - * chunk. For versions prior to 0.90, the action was always error/quit, - * whereas in version 0.90 and later, the action for CRC errors in ancillary - * chunks is warn/discard. These values should NOT be changed. - * - * value action:critical action:ancillary - */ -#define PNG_CRC_DEFAULT 0 /* error/quit warn/discard data */ -#define PNG_CRC_ERROR_QUIT 1 /* error/quit error/quit */ -#define PNG_CRC_WARN_DISCARD 2 /* (INVALID) warn/discard data */ -#define PNG_CRC_WARN_USE 3 /* warn/use data warn/use data */ -#define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */ -#define PNG_CRC_NO_CHANGE 5 /* use current value use current value */ - -/* These functions give the user control over the scan-line filtering in - * libpng and the compression methods used by zlib. These functions are - * mainly useful for testing, as the defaults should work with most users. - * Those users who are tight on memory or want faster performance at the - * expense of compression can modify them. See the compression library - * header file (zlib.h) for an explination of the compression functions. - */ - -/* set the filtering method(s) used by libpng. Currently, the only valid - * value for "method" is 0. - */ -extern PNG_EXPORT(void,png_set_filter) PNGARG((png_structp png_ptr, int method, - int filters)); - -/* Flags for png_set_filter() to say which filters to use. The flags - * are chosen so that they don't conflict with real filter types - * below, in case they are supplied instead of the #defined constants. - * These values should NOT be changed. - */ -#define PNG_NO_FILTERS 0x00 -#define PNG_FILTER_NONE 0x08 -#define PNG_FILTER_SUB 0x10 -#define PNG_FILTER_UP 0x20 -#define PNG_FILTER_AVG 0x40 -#define PNG_FILTER_PAETH 0x80 -#define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \ - PNG_FILTER_AVG | PNG_FILTER_PAETH) - -/* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now. - * These defines should NOT be changed. - */ -#define PNG_FILTER_VALUE_NONE 0 -#define PNG_FILTER_VALUE_SUB 1 -#define PNG_FILTER_VALUE_UP 2 -#define PNG_FILTER_VALUE_AVG 3 -#define PNG_FILTER_VALUE_PAETH 4 -#define PNG_FILTER_VALUE_LAST 5 - -#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* EXPERIMENTAL */ -/* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_ - * defines, either the default (minimum-sum-of-absolute-differences), or - * the experimental method (weighted-minimum-sum-of-absolute-differences). - * - * Weights are factors >= 1.0, indicating how important it is to keep the - * filter type consistent between rows. Larger numbers mean the current - * filter is that many times as likely to be the same as the "num_weights" - * previous filters. This is cumulative for each previous row with a weight. - * There needs to be "num_weights" values in "filter_weights", or it can be - * NULL if the weights aren't being specified. Weights have no influence on - * the selection of the first row filter. Well chosen weights can (in theory) - * improve the compression for a given image. - * - * Costs are factors >= 1.0 indicating the relative decoding costs of a - * filter type. Higher costs indicate more decoding expense, and are - * therefore less likely to be selected over a filter with lower computational - * costs. There needs to be a value in "filter_costs" for each valid filter - * type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't - * setting the costs. Costs try to improve the speed of decompression without - * unduly increasing the compressed image size. - * - * A negative weight or cost indicates the default value is to be used, and - * values in the range [0.0, 1.0) indicate the value is to remain unchanged. - * The default values for both weights and costs are currently 1.0, but may - * change if good general weighting/cost heuristics can be found. If both - * the weights and costs are set to 1.0, this degenerates the WEIGHTED method - * to the UNWEIGHTED method, but with added encoding time/computation. - */ -#ifdef PNG_FLOATING_POINT_SUPPORTED -extern PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr, - int heuristic_method, int num_weights, png_doublep filter_weights, - png_doublep filter_costs)); -#endif -#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ - -/* Heuristic used for row filter selection. These defines should NOT be - * changed. - */ -#define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */ -#define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */ -#define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */ -#define PNG_FILTER_HEURISTIC_LAST 3 /* Not a valid value */ - -/* Set the library compression level. Currently, valid values range from - * 0 - 9, corresponding directly to the zlib compression levels 0 - 9 - * (0 - no compression, 9 - "maximal" compression). Note that tests have - * shown that zlib compression levels 3-6 usually perform as well as level 9 - * for PNG images, and do considerably fewer caclulations. In the future, - * these values may not correspond directly to the zlib compression levels. - */ -extern PNG_EXPORT(void,png_set_compression_level) PNGARG((png_structp png_ptr, - int level)); - -extern PNG_EXPORT(void,png_set_compression_mem_level) - PNGARG((png_structp png_ptr, int mem_level)); - -extern PNG_EXPORT(void,png_set_compression_strategy) - PNGARG((png_structp png_ptr, int strategy)); - -extern PNG_EXPORT(void,png_set_compression_window_bits) - PNGARG((png_structp png_ptr, int window_bits)); - -extern PNG_EXPORT(void,png_set_compression_method) PNGARG((png_structp png_ptr, - int method)); - -/* These next functions are called for input/output, memory, and error - * handling. They are in the file pngrio.c, pngwio.c, and pngerror.c, - * and call standard C I/O routines such as fread(), fwrite(), and - * fprintf(). These functions can be made to use other I/O routines - * at run time for those applications that need to handle I/O in a - * different manner by calling png_set_???_fn(). See libpng.txt for - * more information. - */ - -#if !defined(PNG_NO_STDIO) -/* Initialize the input/output for the PNG file to the default functions. */ -extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr, png_FILE_p fp)); -#endif - -/* Replace the (error and abort), and warning functions with user - * supplied functions. If no messages are to be printed you must still - * write and use replacement functions. The replacement error_fn should - * still do a longjmp to the last setjmp location if you are using this - * method of error handling. If error_fn or warning_fn is NULL, the - * default function will be used. - */ - -extern PNG_EXPORT(void,png_set_error_fn) PNGARG((png_structp png_ptr, - png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn)); - -/* Return the user pointer associated with the error functions */ -extern PNG_EXPORT(png_voidp,png_get_error_ptr) PNGARG((png_structp png_ptr)); - -/* Replace the default data output functions with a user supplied one(s). - * If buffered output is not used, then output_flush_fn can be set to NULL. - * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time - * output_flush_fn will be ignored (and thus can be NULL). - */ -extern PNG_EXPORT(void,png_set_write_fn) PNGARG((png_structp png_ptr, - png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)); - -/* Replace the default data input function with a user supplied one. */ -extern PNG_EXPORT(void,png_set_read_fn) PNGARG((png_structp png_ptr, - png_voidp io_ptr, png_rw_ptr read_data_fn)); - -/* Return the user pointer associated with the I/O functions */ -extern PNG_EXPORT(png_voidp,png_get_io_ptr) PNGARG((png_structp png_ptr)); - -extern PNG_EXPORT(void,png_set_read_status_fn) PNGARG((png_structp png_ptr, - png_read_status_ptr read_row_fn)); - -extern PNG_EXPORT(void,png_set_write_status_fn) PNGARG((png_structp png_ptr, - png_write_status_ptr write_row_fn)); - -#ifdef PNG_USER_MEM_SUPPORTED -/* Replace the default memory allocation functions with user supplied one(s). */ -extern PNG_EXPORT(void,png_set_mem_fn) PNGARG((png_structp png_ptr, - png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn)); -/* Return the user pointer associated with the memory functions */ -extern PNG_EXPORT(png_voidp,png_get_mem_ptr) PNGARG((png_structp png_ptr)); -#endif - -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_LEGACY_SUPPORTED) -extern PNG_EXPORT(void,png_set_read_user_transform_fn) PNGARG((png_structp - png_ptr, png_user_transform_ptr read_user_transform_fn)); -#endif - -#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_LEGACY_SUPPORTED) -extern PNG_EXPORT(void,png_set_write_user_transform_fn) PNGARG((png_structp - png_ptr, png_user_transform_ptr write_user_transform_fn)); -#endif - -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_LEGACY_SUPPORTED) -extern PNG_EXPORT(void,png_set_user_transform_info) PNGARG((png_structp - png_ptr, png_voidp user_transform_ptr, int user_transform_depth, - int user_transform_channels)); -/* Return the user pointer associated with the user transform functions */ -extern PNG_EXPORT(png_voidp,png_get_user_transform_ptr) - PNGARG((png_structp png_ptr)); -#endif - -#ifdef PNG_USER_CHUNKS_SUPPORTED -extern PNG_EXPORT(void,png_set_read_user_chunk_fn) PNGARG((png_structp png_ptr, - png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn)); -extern PNG_EXPORT(png_voidp,png_get_user_chunk_ptr) PNGARG((png_structp - png_ptr)); -#endif - -#ifdef PNG_PROGRESSIVE_READ_SUPPORTED -/* Sets the function callbacks for the push reader, and a pointer to a - * user-defined structure available to the callback functions. - */ -extern PNG_EXPORT(void,png_set_progressive_read_fn) PNGARG((png_structp png_ptr, - png_voidp progressive_ptr, - png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, - png_progressive_end_ptr end_fn)); - -/* returns the user pointer associated with the push read functions */ -extern PNG_EXPORT(png_voidp,png_get_progressive_ptr) - PNGARG((png_structp png_ptr)); - -/* function to be called when data becomes available */ -extern PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_bytep buffer, png_size_t buffer_size)); - -/* function that combines rows. Not very much different than the - * png_combine_row() call. Is this even used????? - */ -extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr, - png_bytep old_row, png_bytep new_row)); -#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ - -extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr, - png_uint_32 size)); - -#if defined(PNG_1_0_X) -# define png_malloc_warn png_malloc -#else -/* Added at libpng version 1.2.4 */ -extern PNG_EXPORT(png_voidp,png_malloc_warn) PNGARG((png_structp png_ptr, - png_uint_32 size)); -#endif - -/* frees a pointer allocated by png_malloc() */ -extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr)); - -#if defined(PNG_1_0_X) -/* Function to allocate memory for zlib. */ -extern PNG_EXPORT(voidpf,png_zalloc) PNGARG((voidpf png_ptr, uInt items, - uInt size)); - -/* Function to free memory for zlib */ -extern PNG_EXPORT(void,png_zfree) PNGARG((voidpf png_ptr, voidpf ptr)); -#endif - -/* Free data that was allocated internally */ -extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_32 free_me, int num)); -#ifdef PNG_FREE_ME_SUPPORTED -/* Reassign responsibility for freeing existing data, whether allocated - * by libpng or by the application */ -extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr, - png_infop info_ptr, int freer, png_uint_32 mask)); -#endif -/* assignments for png_data_freer */ -#define PNG_DESTROY_WILL_FREE_DATA 1 -#define PNG_SET_WILL_FREE_DATA 1 -#define PNG_USER_WILL_FREE_DATA 2 -/* Flags for png_ptr->free_me and info_ptr->free_me */ -#define PNG_FREE_HIST 0x0008 -#define PNG_FREE_ICCP 0x0010 -#define PNG_FREE_SPLT 0x0020 -#define PNG_FREE_ROWS 0x0040 -#define PNG_FREE_PCAL 0x0080 -#define PNG_FREE_SCAL 0x0100 -#define PNG_FREE_UNKN 0x0200 -#define PNG_FREE_LIST 0x0400 -#define PNG_FREE_PLTE 0x1000 -#define PNG_FREE_TRNS 0x2000 -#define PNG_FREE_TEXT 0x4000 -#define PNG_FREE_ALL 0x7fff -#define PNG_FREE_MUL 0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */ - -#ifdef PNG_USER_MEM_SUPPORTED -extern PNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr, - png_uint_32 size)); -extern PNG_EXPORT(void,png_free_default) PNGARG((png_structp png_ptr, - png_voidp ptr)); -#endif - -extern PNG_EXPORT(png_voidp,png_memcpy_check) PNGARG((png_structp png_ptr, - png_voidp s1, png_voidp s2, png_uint_32 size)); - -extern PNG_EXPORT(png_voidp,png_memset_check) PNGARG((png_structp png_ptr, - png_voidp s1, int value, png_uint_32 size)); - -#if defined(USE_FAR_KEYWORD) /* memory model conversion function */ -extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr, - int check)); -#endif /* USE_FAR_KEYWORD */ - -/* Fatal error in PNG image of libpng - can't continue */ -extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr, - png_const_charp error_message)); - -/* The same, but the chunk name is prepended to the error string. */ -extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr, - png_const_charp error_message)); - -/* Non-fatal error in libpng. Can continue, but may have a problem. */ -extern PNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr, - png_const_charp warning_message)); - -/* Non-fatal error in libpng, chunk name is prepended to message. */ -extern PNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr, - png_const_charp warning_message)); - -/* The png_set_ functions are for storing values in the png_info_struct. - * Similarly, the png_get_ calls are used to read values from the - * png_info_struct, either storing the parameters in the passed variables, or - * setting pointers into the png_info_struct where the data is stored. The - * png_get_ functions return a non-zero value if the data was available - * in info_ptr, or return zero and do not change any of the parameters if the - * data was not available. - * - * These functions should be used instead of directly accessing png_info - * to avoid problems with future changes in the size and internal layout of - * png_info_struct. - */ -/* Returns "flag" if chunk data is valid in info_ptr. */ -extern PNG_EXPORT(png_uint_32,png_get_valid) PNGARG((png_structp png_ptr, -png_infop info_ptr, png_uint_32 flag)); - -/* Returns number of bytes needed to hold a transformed row. */ -extern PNG_EXPORT(png_uint_32,png_get_rowbytes) PNGARG((png_structp png_ptr, -png_infop info_ptr)); - -#if defined(PNG_INFO_IMAGE_SUPPORTED) -/* Returns row_pointers, which is an array of pointers to scanlines that was -returned from png_read_png(). */ -extern PNG_EXPORT(png_bytepp,png_get_rows) PNGARG((png_structp png_ptr, -png_infop info_ptr)); -/* Set row_pointers, which is an array of pointers to scanlines for use -by png_write_png(). */ -extern PNG_EXPORT(void,png_set_rows) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_bytepp row_pointers)); -#endif - -/* Returns number of color channels in image. */ -extern PNG_EXPORT(png_byte,png_get_channels) PNGARG((png_structp png_ptr, -png_infop info_ptr)); - -#ifdef PNG_EASY_ACCESS_SUPPORTED -/* Returns image width in pixels. */ -extern PNG_EXPORT(png_uint_32, png_get_image_width) PNGARG((png_structp -png_ptr, png_infop info_ptr)); - -/* Returns image height in pixels. */ -extern PNG_EXPORT(png_uint_32, png_get_image_height) PNGARG((png_structp -png_ptr, png_infop info_ptr)); - -/* Returns image bit_depth. */ -extern PNG_EXPORT(png_byte, png_get_bit_depth) PNGARG((png_structp -png_ptr, png_infop info_ptr)); - -/* Returns image color_type. */ -extern PNG_EXPORT(png_byte, png_get_color_type) PNGARG((png_structp -png_ptr, png_infop info_ptr)); - -/* Returns image filter_type. */ -extern PNG_EXPORT(png_byte, png_get_filter_type) PNGARG((png_structp -png_ptr, png_infop info_ptr)); - -/* Returns image interlace_type. */ -extern PNG_EXPORT(png_byte, png_get_interlace_type) PNGARG((png_structp -png_ptr, png_infop info_ptr)); - -/* Returns image compression_type. */ -extern PNG_EXPORT(png_byte, png_get_compression_type) PNGARG((png_structp -png_ptr, png_infop info_ptr)); - -/* Returns image resolution in pixels per meter, from pHYs chunk data. */ -extern PNG_EXPORT(png_uint_32, png_get_pixels_per_meter) PNGARG((png_structp -png_ptr, png_infop info_ptr)); -extern PNG_EXPORT(png_uint_32, png_get_x_pixels_per_meter) PNGARG((png_structp -png_ptr, png_infop info_ptr)); -extern PNG_EXPORT(png_uint_32, png_get_y_pixels_per_meter) PNGARG((png_structp -png_ptr, png_infop info_ptr)); - -/* Returns pixel aspect ratio, computed from pHYs chunk data. */ -#ifdef PNG_FLOATING_POINT_SUPPORTED -extern PNG_EXPORT(float, png_get_pixel_aspect_ratio) PNGARG((png_structp -png_ptr, png_infop info_ptr)); -#endif - -/* Returns image x, y offset in pixels or microns, from oFFs chunk data. */ -extern PNG_EXPORT(png_int_32, png_get_x_offset_pixels) PNGARG((png_structp -png_ptr, png_infop info_ptr)); -extern PNG_EXPORT(png_int_32, png_get_y_offset_pixels) PNGARG((png_structp -png_ptr, png_infop info_ptr)); -extern PNG_EXPORT(png_int_32, png_get_x_offset_microns) PNGARG((png_structp -png_ptr, png_infop info_ptr)); -extern PNG_EXPORT(png_int_32, png_get_y_offset_microns) PNGARG((png_structp -png_ptr, png_infop info_ptr)); - -#endif /* PNG_EASY_ACCESS_SUPPORTED */ - -/* Returns pointer to signature string read from PNG header */ -extern PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_structp png_ptr, -png_infop info_ptr)); - -#if defined(PNG_bKGD_SUPPORTED) -extern PNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_color_16p *background)); -#endif - -#if defined(PNG_bKGD_SUPPORTED) -extern PNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_color_16p background)); -#endif - -#if defined(PNG_cHRM_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED -extern PNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((png_structp png_ptr, - png_infop info_ptr, double *white_x, double *white_y, double *red_x, - double *red_y, double *green_x, double *green_y, double *blue_x, - double *blue_y)); -#endif -#ifdef PNG_FIXED_POINT_SUPPORTED -extern PNG_EXPORT(png_uint_32,png_get_cHRM_fixed) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_fixed_point *int_white_x, png_fixed_point - *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y, - png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point - *int_blue_x, png_fixed_point *int_blue_y)); -#endif -#endif - -#if defined(PNG_cHRM_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED -extern PNG_EXPORT(void,png_set_cHRM) PNGARG((png_structp png_ptr, - png_infop info_ptr, double white_x, double white_y, double red_x, - double red_y, double green_x, double green_y, double blue_x, double blue_y)); -#endif -#ifdef PNG_FIXED_POINT_SUPPORTED -extern PNG_EXPORT(void,png_set_cHRM_fixed) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_fixed_point int_white_x, png_fixed_point int_white_y, - png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point - int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, - png_fixed_point int_blue_y)); -#endif -#endif - -#if defined(PNG_gAMA_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED -extern PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_structp png_ptr, - png_infop info_ptr, double *file_gamma)); -#endif -extern PNG_EXPORT(png_uint_32,png_get_gAMA_fixed) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_fixed_point *int_file_gamma)); -#endif - -#if defined(PNG_gAMA_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED -extern PNG_EXPORT(void,png_set_gAMA) PNGARG((png_structp png_ptr, - png_infop info_ptr, double file_gamma)); -#endif -extern PNG_EXPORT(void,png_set_gAMA_fixed) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_fixed_point int_file_gamma)); -#endif - -#if defined(PNG_hIST_SUPPORTED) -extern PNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_16p *hist)); -#endif - -#if defined(PNG_hIST_SUPPORTED) -extern PNG_EXPORT(void,png_set_hIST) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_16p hist)); -#endif - -extern PNG_EXPORT(png_uint_32,png_get_IHDR) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_32 *width, png_uint_32 *height, - int *bit_depth, int *color_type, int *interlace_method, - int *compression_method, int *filter_method)); - -extern PNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, - int color_type, int interlace_method, int compression_method, - int filter_method)); - -#if defined(PNG_oFFs_SUPPORTED) -extern PNG_EXPORT(png_uint_32,png_get_oFFs) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y, - int *unit_type)); -#endif - -#if defined(PNG_oFFs_SUPPORTED) -extern PNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y, - int unit_type)); -#endif - -#if defined(PNG_pCAL_SUPPORTED) -extern PNG_EXPORT(png_uint_32,png_get_pCAL) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1, - int *type, int *nparams, png_charp *units, png_charpp *params)); -#endif - -#if defined(PNG_pCAL_SUPPORTED) -extern PNG_EXPORT(void,png_set_pCAL) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1, - int type, int nparams, png_charp units, png_charpp params)); -#endif - -#if defined(PNG_pHYs_SUPPORTED) -extern PNG_EXPORT(png_uint_32,png_get_pHYs) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)); -#endif - -#if defined(PNG_pHYs_SUPPORTED) -extern PNG_EXPORT(void,png_set_pHYs) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type)); -#endif - -extern PNG_EXPORT(png_uint_32,png_get_PLTE) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_colorp *palette, int *num_palette)); - -extern PNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_colorp palette, int num_palette)); - -#if defined(PNG_sBIT_SUPPORTED) -extern PNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_color_8p *sig_bit)); -#endif - -#if defined(PNG_sBIT_SUPPORTED) -extern PNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_color_8p sig_bit)); -#endif - -#if defined(PNG_sRGB_SUPPORTED) -extern PNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_structp png_ptr, - png_infop info_ptr, int *intent)); -#endif - -#if defined(PNG_sRGB_SUPPORTED) -extern PNG_EXPORT(void,png_set_sRGB) PNGARG((png_structp png_ptr, - png_infop info_ptr, int intent)); -extern PNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr, - png_infop info_ptr, int intent)); -#endif - -#if defined(PNG_iCCP_SUPPORTED) -extern PNG_EXPORT(png_uint_32,png_get_iCCP) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_charpp name, int *compression_type, - png_charpp profile, png_uint_32 *proflen)); - /* Note to maintainer: profile should be png_bytepp */ -#endif - -#if defined(PNG_iCCP_SUPPORTED) -extern PNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_charp name, int compression_type, - png_charp profile, png_uint_32 proflen)); - /* Note to maintainer: profile should be png_bytep */ -#endif - -#if defined(PNG_sPLT_SUPPORTED) -extern PNG_EXPORT(png_uint_32,png_get_sPLT) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_sPLT_tpp entries)); -#endif - -#if defined(PNG_sPLT_SUPPORTED) -extern PNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_sPLT_tp entries, int nentries)); -#endif - -#if defined(PNG_TEXT_SUPPORTED) -/* png_get_text also returns the number of text chunks in *num_text */ -extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_textp *text_ptr, int *num_text)); -#endif - -/* - * Note while png_set_text() will accept a structure whose text, - * language, and translated keywords are NULL pointers, the structure - * returned by png_get_text will always contain regular - * zero-terminated C strings. They might be empty strings but - * they will never be NULL pointers. - */ - -#if defined(PNG_TEXT_SUPPORTED) -extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_textp text_ptr, int num_text)); -#endif - -#if defined(PNG_tIME_SUPPORTED) -extern PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_timep *mod_time)); -#endif - -#if defined(PNG_tIME_SUPPORTED) -extern PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_timep mod_time)); -#endif - -#if defined(PNG_tRNS_SUPPORTED) -extern PNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_bytep *trans, int *num_trans, - png_color_16p *trans_values)); -#endif - -#if defined(PNG_tRNS_SUPPORTED) -extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_bytep trans, int num_trans, - png_color_16p trans_values)); -#endif - -#if defined(PNG_tRNS_SUPPORTED) -#endif - -#if defined(PNG_sCAL_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED -extern PNG_EXPORT(png_uint_32,png_get_sCAL) PNGARG((png_structp png_ptr, - png_infop info_ptr, int *unit, double *width, double *height)); -#else -#ifdef PNG_FIXED_POINT_SUPPORTED -extern PNG_EXPORT(png_uint_32,png_get_sCAL_s) PNGARG((png_structp png_ptr, - png_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheight)); -#endif -#endif -#endif /* PNG_sCAL_SUPPORTED */ - -#if defined(PNG_sCAL_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED -extern PNG_EXPORT(void,png_set_sCAL) PNGARG((png_structp png_ptr, - png_infop info_ptr, int unit, double width, double height)); -#else -#ifdef PNG_FIXED_POINT_SUPPORTED -extern PNG_EXPORT(void,png_set_sCAL_s) PNGARG((png_structp png_ptr, - png_infop info_ptr, int unit, png_charp swidth, png_charp sheight)); -#endif -#endif -#endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */ - -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) -/* provide a list of chunks and how they are to be handled, if the built-in - handling or default unknown chunk handling is not desired. Any chunks not - listed will be handled in the default manner. The IHDR and IEND chunks - must not be listed. - keep = 0: follow default behaviour - = 1: do not keep - = 2: keep only if safe-to-copy - = 3: keep even if unsafe-to-copy -*/ -extern PNG_EXPORT(void, png_set_keep_unknown_chunks) PNGARG((png_structp - png_ptr, int keep, png_bytep chunk_list, int num_chunks)); -extern PNG_EXPORT(void, png_set_unknown_chunks) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns)); -extern PNG_EXPORT(void, png_set_unknown_chunk_location) - PNGARG((png_structp png_ptr, png_infop info_ptr, int chunk, int location)); -extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp - png_ptr, png_infop info_ptr, png_unknown_chunkpp entries)); -#endif -#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED -PNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_bytep - chunk_name)); -#endif - -/* Png_free_data() will turn off the "valid" flag for anything it frees. - If you need to turn it off for a chunk that your application has freed, - you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); */ -extern PNG_EXPORT(void, png_set_invalid) PNGARG((png_structp png_ptr, - png_infop info_ptr, int mask)); - -#if defined(PNG_INFO_IMAGE_SUPPORTED) -/* The "params" pointer is currently not used and is for future expansion. */ -extern PNG_EXPORT(void, png_read_png) PNGARG((png_structp png_ptr, - png_infop info_ptr, - int transforms, - png_voidp params)); -extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr, - png_infop info_ptr, - int transforms, - png_voidp params)); -#endif - -/* Define PNG_DEBUG at compile time for debugging information. Higher - * numbers for PNG_DEBUG mean more debugging information. This has - * only been added since version 0.95 so it is not implemented throughout - * libpng yet, but more support will be added as needed. - */ -#ifdef PNG_DEBUG -#if (PNG_DEBUG > 0) -#if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER) -#include -#if (PNG_DEBUG > 1) -#define png_debug(l,m) _RPT0(_CRT_WARN,m) -#define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m,p1) -#define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m,p1,p2) -#endif -#else /* PNG_DEBUG_FILE || !_MSC_VER */ -#ifndef PNG_DEBUG_FILE -#define PNG_DEBUG_FILE stderr -#endif /* PNG_DEBUG_FILE */ -#if (PNG_DEBUG > 1) -#define png_debug(l,m) \ -{ \ - int num_tabs=l; \ - fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ - (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \ -} -#define png_debug1(l,m,p1) \ -{ \ - int num_tabs=l; \ - fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ - (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \ -} -#define png_debug2(l,m,p1,p2) \ -{ \ - int num_tabs=l; \ - fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ - (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \ -} -#endif /* (PNG_DEBUG > 1) */ -#endif /* _MSC_VER */ -#endif /* (PNG_DEBUG > 0) */ -#endif /* PNG_DEBUG */ -#ifndef png_debug -#define png_debug(l, m) -#endif -#ifndef png_debug1 -#define png_debug1(l, m, p1) -#endif -#ifndef png_debug2 -#define png_debug2(l, m, p1, p2) -#endif - -#if 0 -extern PNG_EXPORT(png_bytep,png_sig_bytes) PNGARG((void)); -#endif - -extern PNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_structp png_ptr)); -extern PNG_EXPORT(png_charp,png_get_header_ver) PNGARG((png_structp png_ptr)); -extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr)); -extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr)); - -#ifdef PNG_MNG_FEATURES_SUPPORTED -extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp - png_ptr, png_uint_32 mng_features_permitted)); -#endif - -/* For use in png_set_keep_unknown, added to version 1.2.6 */ -#define PNG_HANDLE_CHUNK_AS_DEFAULT 0 -#define PNG_HANDLE_CHUNK_NEVER 1 -#define PNG_HANDLE_CHUNK_IF_SAFE 2 -#define PNG_HANDLE_CHUNK_ALWAYS 3 - -/* Added to version 1.2.0 */ -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) -#if defined(PNG_MMX_CODE_SUPPORTED) -#define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED 0x01 /* not user-settable */ -#define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU 0x02 /* not user-settable */ -#define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW 0x04 -#define PNG_ASM_FLAG_MMX_READ_INTERLACE 0x08 -#define PNG_ASM_FLAG_MMX_READ_FILTER_SUB 0x10 -#define PNG_ASM_FLAG_MMX_READ_FILTER_UP 0x20 -#define PNG_ASM_FLAG_MMX_READ_FILTER_AVG 0x40 -#define PNG_ASM_FLAG_MMX_READ_FILTER_PAETH 0x80 -#define PNG_ASM_FLAGS_INITIALIZED 0x80000000 /* not user-settable */ - -#define PNG_MMX_READ_FLAGS ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \ - | PNG_ASM_FLAG_MMX_READ_INTERLACE \ - | PNG_ASM_FLAG_MMX_READ_FILTER_SUB \ - | PNG_ASM_FLAG_MMX_READ_FILTER_UP \ - | PNG_ASM_FLAG_MMX_READ_FILTER_AVG \ - | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ) -#define PNG_MMX_WRITE_FLAGS ( 0 ) - -#define PNG_MMX_FLAGS ( PNG_ASM_FLAG_MMX_SUPPORT_COMPILED \ - | PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU \ - | PNG_MMX_READ_FLAGS \ - | PNG_MMX_WRITE_FLAGS ) - -#define PNG_SELECT_READ 1 -#define PNG_SELECT_WRITE 2 -#endif /* PNG_MMX_CODE_SUPPORTED */ - -#if !defined(PNG_1_0_X) -/* pngget.c */ -extern PNG_EXPORT(png_uint_32,png_get_mmx_flagmask) - PNGARG((int flag_select, int *compilerID)); - -/* pngget.c */ -extern PNG_EXPORT(png_uint_32,png_get_asm_flagmask) - PNGARG((int flag_select)); - -/* pngget.c */ -extern PNG_EXPORT(png_uint_32,png_get_asm_flags) - PNGARG((png_structp png_ptr)); - -/* pngget.c */ -extern PNG_EXPORT(png_byte,png_get_mmx_bitdepth_threshold) - PNGARG((png_structp png_ptr)); - -/* pngget.c */ -extern PNG_EXPORT(png_uint_32,png_get_mmx_rowbytes_threshold) - PNGARG((png_structp png_ptr)); - -/* pngset.c */ -extern PNG_EXPORT(void,png_set_asm_flags) - PNGARG((png_structp png_ptr, png_uint_32 asm_flags)); - -/* pngset.c */ -extern PNG_EXPORT(void,png_set_mmx_thresholds) - PNGARG((png_structp png_ptr, png_byte mmx_bitdepth_threshold, - png_uint_32 mmx_rowbytes_threshold)); - -#endif /* PNG_1_0_X */ - -#if !defined(PNG_1_0_X) -/* png.c, pnggccrd.c, or pngvcrd.c */ -extern PNG_EXPORT(int,png_mmx_support) PNGARG((void)); -#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */ - -/* Strip the prepended error numbers ("#nnn ") from error and warning - * messages before passing them to the error or warning handler. */ -#ifdef PNG_ERROR_NUMBERS_SUPPORTED -extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp - png_ptr, png_uint_32 strip_mode)); -#endif - -#endif /* PNG_1_0_X */ - -/* Added at libpng-1.2.6 */ -#ifdef PNG_SET_USER_LIMITS_SUPPORTED -extern PNG_EXPORT(void,png_set_user_limits) PNGARG((png_structp - png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max)); -extern PNG_EXPORT(png_uint_32,png_get_user_width_max) PNGARG((png_structp - png_ptr)); -extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp - png_ptr)); -#endif - -/* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */ - -#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED -/* With these routines we avoid an integer divide, which will be slower on - * most machines. However, it does take more operations than the corresponding - * divide method, so it may be slower on a few RISC systems. There are two - * shifts (by 8 or 16 bits) and an addition, versus a single integer divide. - * - * Note that the rounding factors are NOT supposed to be the same! 128 and - * 32768 are correct for the NODIV code; 127 and 32767 are correct for the - * standard method. - * - * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ] - */ - - /* fg and bg should be in `gamma 1.0' space; alpha is the opacity */ - -# define png_composite(composite, fg, alpha, bg) \ - { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) * (png_uint_16)(alpha) \ - + (png_uint_16)(bg)*(png_uint_16)(255 - \ - (png_uint_16)(alpha)) + (png_uint_16)128); \ - (composite) = (png_byte)((temp + (temp >> 8)) >> 8); } - -# define png_composite_16(composite, fg, alpha, bg) \ - { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) * (png_uint_32)(alpha) \ - + (png_uint_32)(bg)*(png_uint_32)(65535L - \ - (png_uint_32)(alpha)) + (png_uint_32)32768L); \ - (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); } - -#else /* standard method using integer division */ - -# define png_composite(composite, fg, alpha, bg) \ - (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \ - (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \ - (png_uint_16)127) / 255) - -# define png_composite_16(composite, fg, alpha, bg) \ - (composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \ - (png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) + \ - (png_uint_32)32767) / (png_uint_32)65535L) - -#endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */ - -/* Inline macros to do direct reads of bytes from the input buffer. These - * require that you are using an architecture that uses PNG byte ordering - * (MSB first) and supports unaligned data storage. I think that PowerPC - * in big-endian mode and 680x0 are the only ones that will support this. - * The x86 line of processors definitely do not. The png_get_int_32() - * routine also assumes we are using two's complement format for negative - * values, which is almost certainly true. - */ -#if defined(PNG_READ_BIG_ENDIAN_SUPPORTED) -# define png_get_uint_32(buf) ( *((png_uint_32p) (buf))) -# define png_get_uint_16(buf) ( *((png_uint_16p) (buf))) -# define png_get_int_32(buf) ( *((png_int_32p) (buf))) -#else -extern PNG_EXPORT(png_uint_32,png_get_uint_32) PNGARG((png_bytep buf)); -extern PNG_EXPORT(png_uint_16,png_get_uint_16) PNGARG((png_bytep buf)); -extern PNG_EXPORT(png_int_32,png_get_int_32) PNGARG((png_bytep buf)); -#endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */ -extern PNG_EXPORT(png_uint_32,png_get_uint_31) - PNGARG((png_structp png_ptr, png_bytep buf)); -/* No png_get_int_16 -- may be added if there's a real need for it. */ - -/* Place a 32-bit number into a buffer in PNG byte order (big-endian). - */ -extern PNG_EXPORT(void,png_save_uint_32) - PNGARG((png_bytep buf, png_uint_32 i)); -extern PNG_EXPORT(void,png_save_int_32) - PNGARG((png_bytep buf, png_int_32 i)); - -/* Place a 16-bit number into a buffer in PNG byte order. - * The parameter is declared unsigned int, not png_uint_16, - * just to avoid potential problems on pre-ANSI C compilers. - */ -extern PNG_EXPORT(void,png_save_uint_16) - PNGARG((png_bytep buf, unsigned int i)); -/* No png_save_int_16 -- may be added if there's a real need for it. */ - -/* ************************************************************************* */ - -/* These next functions are used internally in the code. They generally - * shouldn't be used unless you are writing code to add or replace some - * functionality in libpng. More information about most functions can - * be found in the files where the functions are located. - */ - - -/* Various modes of operation, that are visible to applications because - * they are used for unknown chunk location. - */ -#define PNG_HAVE_IHDR 0x01 -#define PNG_HAVE_PLTE 0x02 -#define PNG_HAVE_IDAT 0x04 -#define PNG_AFTER_IDAT 0x08 /* Have complete zlib datastream */ -#define PNG_HAVE_IEND 0x10 - -#if defined(PNG_INTERNAL) - -/* More modes of operation. Note that after an init, mode is set to - * zero automatically when the structure is created. - */ -#define PNG_HAVE_gAMA 0x20 -#define PNG_HAVE_cHRM 0x40 -#define PNG_HAVE_sRGB 0x80 -#define PNG_HAVE_CHUNK_HEADER 0x100 -#define PNG_WROTE_tIME 0x200 -#define PNG_WROTE_INFO_BEFORE_PLTE 0x400 -#define PNG_BACKGROUND_IS_GRAY 0x800 -#define PNG_HAVE_PNG_SIGNATURE 0x1000 -#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */ - -/* flags for the transformations the PNG library does on the image data */ -#define PNG_BGR 0x0001 -#define PNG_INTERLACE 0x0002 -#define PNG_PACK 0x0004 -#define PNG_SHIFT 0x0008 -#define PNG_SWAP_BYTES 0x0010 -#define PNG_INVERT_MONO 0x0020 -#define PNG_DITHER 0x0040 -#define PNG_BACKGROUND 0x0080 -#define PNG_BACKGROUND_EXPAND 0x0100 - /* 0x0200 unused */ -#define PNG_16_TO_8 0x0400 -#define PNG_RGBA 0x0800 -#define PNG_EXPAND 0x1000 -#define PNG_GAMMA 0x2000 -#define PNG_GRAY_TO_RGB 0x4000 -#define PNG_FILLER 0x8000L -#define PNG_PACKSWAP 0x10000L -#define PNG_SWAP_ALPHA 0x20000L -#define PNG_STRIP_ALPHA 0x40000L -#define PNG_INVERT_ALPHA 0x80000L -#define PNG_USER_TRANSFORM 0x100000L -#define PNG_RGB_TO_GRAY_ERR 0x200000L -#define PNG_RGB_TO_GRAY_WARN 0x400000L -#define PNG_RGB_TO_GRAY 0x600000L /* two bits, RGB_TO_GRAY_ERR|WARN */ - /* 0x800000L Unused */ -#define PNG_ADD_ALPHA 0x1000000L /* Added to libpng-1.2.7 */ -#define PNG_EXPAND_tRNS 0x2000000L /* Added to libpng-1.2.9 */ - /* 0x4000000L unused */ - /* 0x8000000L unused */ - /* 0x10000000L unused */ - /* 0x20000000L unused */ - /* 0x40000000L unused */ - -/* flags for png_create_struct */ -#define PNG_STRUCT_PNG 0x0001 -#define PNG_STRUCT_INFO 0x0002 - -/* Scaling factor for filter heuristic weighting calculations */ -#define PNG_WEIGHT_SHIFT 8 -#define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT)) -#define PNG_COST_SHIFT 3 -#define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT)) - -/* flags for the png_ptr->flags rather than declaring a byte for each one */ -#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001 -#define PNG_FLAG_ZLIB_CUSTOM_LEVEL 0x0002 -#define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL 0x0004 -#define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS 0x0008 -#define PNG_FLAG_ZLIB_CUSTOM_METHOD 0x0010 -#define PNG_FLAG_ZLIB_FINISHED 0x0020 -#define PNG_FLAG_ROW_INIT 0x0040 -#define PNG_FLAG_FILLER_AFTER 0x0080 -#define PNG_FLAG_CRC_ANCILLARY_USE 0x0100 -#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200 -#define PNG_FLAG_CRC_CRITICAL_USE 0x0400 -#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800 -#define PNG_FLAG_FREE_PLTE 0x1000 -#define PNG_FLAG_FREE_TRNS 0x2000 -#define PNG_FLAG_FREE_HIST 0x4000 -#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000L -#define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000L -#define PNG_FLAG_LIBRARY_MISMATCH 0x20000L -#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000L -#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000L -#define PNG_FLAG_MALLOC_NULL_MEM_OK 0x100000L -#define PNG_FLAG_ADD_ALPHA 0x200000L /* Added to libpng-1.2.8 */ -#define PNG_FLAG_STRIP_ALPHA 0x400000L /* Added to libpng-1.2.8 */ - /* 0x800000L unused */ - /* 0x1000000L unused */ - /* 0x2000000L unused */ - /* 0x4000000L unused */ - /* 0x8000000L unused */ - /* 0x10000000L unused */ - /* 0x20000000L unused */ - /* 0x40000000L unused */ - -#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \ - PNG_FLAG_CRC_ANCILLARY_NOWARN) - -#define PNG_FLAG_CRC_CRITICAL_MASK (PNG_FLAG_CRC_CRITICAL_USE | \ - PNG_FLAG_CRC_CRITICAL_IGNORE) - -#define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \ - PNG_FLAG_CRC_CRITICAL_MASK) - -/* save typing and make code easier to understand */ - -#define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \ - abs((int)((c1).green) - (int)((c2).green)) + \ - abs((int)((c1).blue) - (int)((c2).blue))) - -/* Added to libpng-1.2.6 JB */ -#define PNG_ROWBYTES(pixel_bits, width) \ - ((pixel_bits) >= 8 ? \ - ((width) * (((png_uint_32)(pixel_bits)) >> 3)) : \ - (( ((width) * ((png_uint_32)(pixel_bits))) + 7) >> 3) ) - -/* PNG_OUT_OF_RANGE returns true if value is outside the range - ideal-delta..ideal+delta. Each argument is evaluated twice. - "ideal" and "delta" should be constants, normally simple - integers, "value" a variable. Added to libpng-1.2.6 JB */ -#define PNG_OUT_OF_RANGE(value, ideal, delta) \ - ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) ) - -/* variables declared in png.c - only it needs to define PNG_NO_EXTERN */ -#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN) -/* place to hold the signature string for a PNG file. */ -#ifdef PNG_USE_GLOBAL_ARRAYS - PNG_EXPORT_VAR (const png_byte FARDATA) png_sig[8]; -#else -#if 0 -#define png_sig png_sig_bytes(NULL) -#endif -#endif -#endif /* PNG_NO_EXTERN */ - -/* Constant strings for known chunk types. If you need to add a chunk, - * define the name here, and add an invocation of the macro in png.c and - * wherever it's needed. - */ -#define PNG_IHDR const png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'} -#define PNG_IDAT const png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'} -#define PNG_IEND const png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'} -#define PNG_PLTE const png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'} -#define PNG_bKGD const png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'} -#define PNG_cHRM const png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'} -#define PNG_gAMA const png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'} -#define PNG_hIST const png_byte png_hIST[5] = {104, 73, 83, 84, '\0'} -#define PNG_iCCP const png_byte png_iCCP[5] = {105, 67, 67, 80, '\0'} -#define PNG_iTXt const png_byte png_iTXt[5] = {105, 84, 88, 116, '\0'} -#define PNG_oFFs const png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'} -#define PNG_pCAL const png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'} -#define PNG_sCAL const png_byte png_sCAL[5] = {115, 67, 65, 76, '\0'} -#define PNG_pHYs const png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'} -#define PNG_sBIT const png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'} -#define PNG_sPLT const png_byte png_sPLT[5] = {115, 80, 76, 84, '\0'} -#define PNG_sRGB const png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'} -#define PNG_tEXt const png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'} -#define PNG_tIME const png_byte png_tIME[5] = {116, 73, 77, 69, '\0'} -#define PNG_tRNS const png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'} -#define PNG_zTXt const png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'} - -#ifdef PNG_USE_GLOBAL_ARRAYS -PNG_EXPORT_VAR (const png_byte FARDATA) png_IHDR[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_IDAT[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_IEND[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_PLTE[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_bKGD[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_cHRM[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_gAMA[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_hIST[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_iCCP[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_iTXt[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_oFFs[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_pCAL[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_sCAL[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_pHYs[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_sBIT[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_sPLT[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_sRGB[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_tEXt[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_tIME[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_tRNS[5]; -PNG_EXPORT_VAR (const png_byte FARDATA) png_zTXt[5]; -#endif /* PNG_USE_GLOBAL_ARRAYS */ - -#if defined(PNG_1_0_X) || defined (PNG_1_2_X) -/* Initialize png_ptr struct for reading, and allocate any other memory. - * (old interface - DEPRECATED - use png_create_read_struct instead). - */ -extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr)); -#undef png_read_init -#define png_read_init(png_ptr) png_read_init_3(&png_ptr, \ - PNG_LIBPNG_VER_STRING, png_sizeof(png_struct)); -#endif - -extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr, - png_const_charp user_png_ver, png_size_t png_struct_size)); -#if defined(PNG_1_0_X) || defined (PNG_1_2_X) -extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr, - png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t - png_info_size)); -#endif - -#if defined(PNG_1_0_X) || defined (PNG_1_2_X) -/* Initialize png_ptr struct for writing, and allocate any other memory. - * (old interface - DEPRECATED - use png_create_write_struct instead). - */ -extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr)); -#undef png_write_init -#define png_write_init(png_ptr) png_write_init_3(&png_ptr, \ - PNG_LIBPNG_VER_STRING, png_sizeof(png_struct)); -#endif - -extern PNG_EXPORT(void,png_write_init_3) PNGARG((png_structpp ptr_ptr, - png_const_charp user_png_ver, png_size_t png_struct_size)); -extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr, - png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t - png_info_size)); - -/* Allocate memory for an internal libpng struct */ -PNG_EXTERN png_voidp png_create_struct PNGARG((int type)); - -/* Free memory from internal libpng struct */ -PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr)); - -PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr - malloc_fn, png_voidp mem_ptr)); -PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr, - png_free_ptr free_fn, png_voidp mem_ptr)); - -/* Free any memory that info_ptr points to and reset struct. */ -PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr, - png_infop info_ptr)); - -#ifndef PNG_1_0_X -/* Function to allocate memory for zlib. */ -PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size)); - -/* Function to free memory for zlib */ -PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr)); - -#ifdef PNG_SIZE_T -/* Function to convert a sizeof an item to png_sizeof item */ - PNG_EXTERN png_size_t PNGAPI png_convert_size PNGARG((size_t size)); -#endif - -/* Next four functions are used internally as callbacks. PNGAPI is required - * but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3. */ - -PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr, - png_bytep data, png_size_t length)); - -#ifdef PNG_PROGRESSIVE_READ_SUPPORTED -PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr, - png_bytep buffer, png_size_t length)); -#endif - -PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr, - png_bytep data, png_size_t length)); - -#if defined(PNG_WRITE_FLUSH_SUPPORTED) -#if !defined(PNG_NO_STDIO) -PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr)); -#endif -#endif -#else /* PNG_1_0_X */ -#ifdef PNG_PROGRESSIVE_READ_SUPPORTED -PNG_EXTERN void png_push_fill_buffer PNGARG((png_structp png_ptr, - png_bytep buffer, png_size_t length)); -#endif -#endif /* PNG_1_0_X */ - -/* Reset the CRC variable */ -PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr)); - -/* Write the "data" buffer to whatever output you are using. */ -PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data, - png_size_t length)); - -/* Read data from whatever input you are using into the "data" buffer */ -PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data, - png_size_t length)); - -/* Read bytes into buf, and update png_ptr->crc */ -PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf, - png_size_t length)); - -/* Decompress data in a chunk that uses compression */ -#if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \ - defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) -PNG_EXTERN png_charp png_decompress_chunk PNGARG((png_structp png_ptr, - int comp_type, png_charp chunkdata, png_size_t chunklength, - png_size_t prefix_length, png_size_t *data_length)); -#endif - -/* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */ -PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip)); - -/* Read the CRC from the file and compare it to the libpng calculated CRC */ -PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr)); - -/* Calculate the CRC over a section of data. Note that we are only - * passing a maximum of 64K on systems that have this as a memory limit, - * since this is the maximum buffer size we can specify. - */ -PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr, - png_size_t length)); - -#if defined(PNG_WRITE_FLUSH_SUPPORTED) -PNG_EXTERN void png_flush PNGARG((png_structp png_ptr)); -#endif - -/* simple function to write the signature */ -PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr)); - -/* write various chunks */ - -/* Write the IHDR chunk, and update the png_struct with the necessary - * information. - */ -PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width, - png_uint_32 height, - int bit_depth, int color_type, int compression_method, int filter_method, - int interlace_method)); - -PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette, - png_uint_32 num_pal)); - -PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data, - png_size_t length)); - -PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr)); - -#if defined(PNG_WRITE_gAMA_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED -PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma)); -#endif -#ifdef PNG_FIXED_POINT_SUPPORTED -PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr, png_fixed_point - file_gamma)); -#endif -#endif - -#if defined(PNG_WRITE_sBIT_SUPPORTED) -PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit, - int color_type)); -#endif - -#if defined(PNG_WRITE_cHRM_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED -PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr, - double white_x, double white_y, - double red_x, double red_y, double green_x, double green_y, - double blue_x, double blue_y)); -#endif -#ifdef PNG_FIXED_POINT_SUPPORTED -PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr, - png_fixed_point int_white_x, png_fixed_point int_white_y, - png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point - int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, - png_fixed_point int_blue_y)); -#endif -#endif - -#if defined(PNG_WRITE_sRGB_SUPPORTED) -PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr, - int intent)); -#endif - -#if defined(PNG_WRITE_iCCP_SUPPORTED) -PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr, - png_charp name, int compression_type, - png_charp profile, int proflen)); - /* Note to maintainer: profile should be png_bytep */ -#endif - -#if defined(PNG_WRITE_sPLT_SUPPORTED) -PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr, - png_sPLT_tp palette)); -#endif - -#if defined(PNG_WRITE_tRNS_SUPPORTED) -PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans, - png_color_16p values, int number, int color_type)); -#endif - -#if defined(PNG_WRITE_bKGD_SUPPORTED) -PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr, - png_color_16p values, int color_type)); -#endif - -#if defined(PNG_WRITE_hIST_SUPPORTED) -PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist, - int num_hist)); -#endif - -#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \ - defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED) -PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr, - png_charp key, png_charpp new_key)); -#endif - -#if defined(PNG_WRITE_tEXt_SUPPORTED) -PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key, - png_charp text, png_size_t text_len)); -#endif - -#if defined(PNG_WRITE_zTXt_SUPPORTED) -PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key, - png_charp text, png_size_t text_len, int compression)); -#endif - -#if defined(PNG_WRITE_iTXt_SUPPORTED) -PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr, - int compression, png_charp key, png_charp lang, png_charp lang_key, - png_charp text)); -#endif - -#if defined(PNG_TEXT_SUPPORTED) /* Added at version 1.0.14 and 1.2.4 */ -PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr, - png_infop info_ptr, png_textp text_ptr, int num_text)); -#endif - -#if defined(PNG_WRITE_oFFs_SUPPORTED) -PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr, - png_int_32 x_offset, png_int_32 y_offset, int unit_type)); -#endif - -#if defined(PNG_WRITE_pCAL_SUPPORTED) -PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose, - png_int_32 X0, png_int_32 X1, int type, int nparams, - png_charp units, png_charpp params)); -#endif - -#if defined(PNG_WRITE_pHYs_SUPPORTED) -PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr, - png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit, - int unit_type)); -#endif - -#if defined(PNG_WRITE_tIME_SUPPORTED) -PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr, - png_timep mod_time)); -#endif - -#if defined(PNG_WRITE_sCAL_SUPPORTED) -#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO) -PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr, - int unit, double width, double height)); -#else -#ifdef PNG_FIXED_POINT_SUPPORTED -PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr, - int unit, png_charp width, png_charp height)); -#endif -#endif -#endif - -/* Called when finished processing a row of data */ -PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr)); - -/* Internal use only. Called before first row of data */ -PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr)); - -#if defined(PNG_READ_GAMMA_SUPPORTED) -PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr)); -#endif - -/* combine a row of data, dealing with alpha, etc. if requested */ -PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row, - int mask)); - -#if defined(PNG_READ_INTERLACING_SUPPORTED) -/* expand an interlaced row */ -/* OLD pre-1.0.9 interface: -PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info, - png_bytep row, int pass, png_uint_32 transformations)); - */ -PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr)); -#endif - -/* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */ - -#if defined(PNG_WRITE_INTERLACING_SUPPORTED) -/* grab pixels out of a row for an interlaced pass */ -PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info, - png_bytep row, int pass)); -#endif - -/* unfilter a row */ -PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr, - png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter)); - -/* Choose the best filter to use and filter the row data */ -PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr, - png_row_infop row_info)); - -/* Write out the filtered row. */ -PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr, - png_bytep filtered_row)); -/* finish a row while reading, dealing with interlacing passes, etc. */ -PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr)); - -/* initialize the row buffers, etc. */ -PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr)); -/* optional call to update the users info structure */ -PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr, - png_infop info_ptr)); - -/* these are the functions that do the transformations */ -#if defined(PNG_READ_FILLER_SUPPORTED) -PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info, - png_bytep row, png_uint_32 filler, png_uint_32 flags)); -#endif - -#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) -PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info, - png_bytep row)); -#endif - -#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) -PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info, - png_bytep row)); -#endif - -#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) -PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info, - png_bytep row)); -#endif - -#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) -PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info, - png_bytep row)); -#endif - -#if defined(PNG_WRITE_FILLER_SUPPORTED) || \ - defined(PNG_READ_STRIP_ALPHA_SUPPORTED) -PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info, - png_bytep row, png_uint_32 flags)); -#endif - -#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) -PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row)); -#endif - -#if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED) -PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row)); -#endif - -#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) -PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop - row_info, png_bytep row)); -#endif - -#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) -PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info, - png_bytep row)); -#endif - -#if defined(PNG_READ_PACK_SUPPORTED) -PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row)); -#endif - -#if defined(PNG_READ_SHIFT_SUPPORTED) -PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row, - png_color_8p sig_bits)); -#endif - -#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) -PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row)); -#endif - -#if defined(PNG_READ_16_TO_8_SUPPORTED) -PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row)); -#endif - -#if defined(PNG_READ_DITHER_SUPPORTED) -PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info, - png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup)); - -# if defined(PNG_CORRECT_PALETTE_SUPPORTED) -PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr, - png_colorp palette, int num_palette)); -# endif -#endif - -#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) -PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row)); -#endif - -#if defined(PNG_WRITE_PACK_SUPPORTED) -PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info, - png_bytep row, png_uint_32 bit_depth)); -#endif - -#if defined(PNG_WRITE_SHIFT_SUPPORTED) -PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row, - png_color_8p bit_depth)); -#endif - -#if defined(PNG_READ_BACKGROUND_SUPPORTED) -#if defined(PNG_READ_GAMMA_SUPPORTED) -PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row, - png_color_16p trans_values, png_color_16p background, - png_color_16p background_1, - png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1, - png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1, - png_uint_16pp gamma_16_to_1, int gamma_shift)); -#else -PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row, - png_color_16p trans_values, png_color_16p background)); -#endif -#endif - -#if defined(PNG_READ_GAMMA_SUPPORTED) -PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row, - png_bytep gamma_table, png_uint_16pp gamma_16_table, - int gamma_shift)); -#endif - -#if defined(PNG_READ_EXPAND_SUPPORTED) -PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info, - png_bytep row, png_colorp palette, png_bytep trans, int num_trans)); -PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info, - png_bytep row, png_color_16p trans_value)); -#endif - -/* The following decodes the appropriate chunks, and does error correction, - * then calls the appropriate callback for the chunk if it is valid. - */ - -/* decode the IHDR chunk */ -PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); - -#if defined(PNG_READ_bKGD_SUPPORTED) -PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_cHRM_SUPPORTED) -PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_gAMA_SUPPORTED) -PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_hIST_SUPPORTED) -PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_iCCP_SUPPORTED) -extern void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif /* PNG_READ_iCCP_SUPPORTED */ - -#if defined(PNG_READ_iTXt_SUPPORTED) -PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_oFFs_SUPPORTED) -PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_pCAL_SUPPORTED) -PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_pHYs_SUPPORTED) -PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_sBIT_SUPPORTED) -PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_sCAL_SUPPORTED) -PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_sPLT_SUPPORTED) -extern void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif /* PNG_READ_sPLT_SUPPORTED */ - -#if defined(PNG_READ_sRGB_SUPPORTED) -PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_tEXt_SUPPORTED) -PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_tIME_SUPPORTED) -PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_tRNS_SUPPORTED) -PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -#if defined(PNG_READ_zTXt_SUPPORTED) -PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr, - png_uint_32 length)); -#endif - -PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_32 length)); - -PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr, - png_bytep chunk_name)); - -/* handle the transformations for reading and writing */ -PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr)); -PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr)); - -PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr)); - -#ifdef PNG_PROGRESSIVE_READ_SUPPORTED -PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr, - png_infop info_ptr)); -PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr, - png_infop info_ptr)); -PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr)); -PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr, - png_uint_32 length)); -PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr)); -PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr)); -PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr, - png_bytep buffer, png_size_t buffer_length)); -PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr)); -PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr, - png_bytep buffer, png_size_t buffer_length)); -PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr)); -PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_32 length)); -PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr, - png_infop info_ptr)); -PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr, - png_infop info_ptr)); -PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row)); -PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr, - png_infop info_ptr)); -PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr, - png_infop info_ptr)); -PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr)); -#if defined(PNG_READ_tEXt_SUPPORTED) -PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_32 length)); -PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr, - png_infop info_ptr)); -#endif -#if defined(PNG_READ_zTXt_SUPPORTED) -PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_32 length)); -PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr, - png_infop info_ptr)); -#endif -#if defined(PNG_READ_iTXt_SUPPORTED) -PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_32 length)); -PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr, - png_infop info_ptr)); -#endif - -#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ - -#ifdef PNG_MNG_FEATURES_SUPPORTED -PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info, - png_bytep row)); -PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info, - png_bytep row)); -#endif - -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) -#if defined(PNG_MMX_CODE_SUPPORTED) -/* png.c */ /* PRIVATE */ -PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr)); -#endif -#endif - -#if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED) -PNG_EXTERN png_uint_32 png_get_pixels_per_inch PNGARG((png_structp png_ptr, -png_infop info_ptr)); - -PNG_EXTERN png_uint_32 png_get_x_pixels_per_inch PNGARG((png_structp png_ptr, -png_infop info_ptr)); - -PNG_EXTERN png_uint_32 png_get_y_pixels_per_inch PNGARG((png_structp png_ptr, -png_infop info_ptr)); - -PNG_EXTERN float png_get_x_offset_inches PNGARG((png_structp png_ptr, -png_infop info_ptr)); - -PNG_EXTERN float png_get_y_offset_inches PNGARG((png_structp png_ptr, -png_infop info_ptr)); - -#if defined(PNG_pHYs_SUPPORTED) -PNG_EXTERN png_uint_32 png_get_pHYs_dpi PNGARG((png_structp png_ptr, -png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)); -#endif /* PNG_pHYs_SUPPORTED */ -#endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */ - /* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */ #endif /* PNG_INTERNAL */ diff --git a/src/dep/src/irrlicht/libpng/pngconf.h b/src/dep/src/irrlicht/libpng/pngconf.h index 0c98995..de1e21b 100644 --- a/src/dep/src/irrlicht/libpng/pngconf.h +++ b/src/dep/src/irrlicht/libpng/pngconf.h @@ -1,9 +1,9 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.2.35 - February 14, 2009 + * libpng version 1.2.32 - September 18, 2008 * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2009 Glenn Randers-Pehrson + * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) */ @@ -233,8 +233,6 @@ # include /* Console I/O functions are not supported on WindowsCE */ # define PNG_NO_CONSOLE_IO - /* abort() may not be supported on some/all Windows CE platforms */ -# define PNG_ABORT() exit(-1) # ifdef PNG_DEBUG # undef PNG_DEBUG # endif @@ -800,12 +798,6 @@ # define PNG_USER_HEIGHT_MAX 1000000L #endif - -/* Added at libpng-1.2.34 and 1.4.0 */ -#ifndef PNG_STRING_NEWLINE -#define PNG_STRING_NEWLINE "\n" -#endif - /* These are currently experimental features, define them if you want */ /* very little testing */ @@ -1491,1486 +1483,3 @@ typedef z_stream FAR * png_zstreamp; #endif /* PNG_VERSION_INFO_ONLY */ #endif /* PNGCONF_H */ - -/* pngconf.h - machine configurable file for libpng - * - * libpng version 1.2.18 - May 15, 2007 - * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - */ - -/* Any machine specific code is near the front of this file, so if you - * are configuring libpng for a machine, you may want to read the section - * starting here down to where it starts to typedef png_color, png_text, - * and png_info. - */ - -#ifndef PNGCONF_H -#define PNGCONF_H - -#define PNG_1_2_X - -/* - * PNG_USER_CONFIG has to be defined on the compiler command line. This - * includes the resource compiler for Windows DLL configurations. - */ -#ifdef PNG_USER_CONFIG -# ifndef PNG_USER_PRIVATEBUILD -# define PNG_USER_PRIVATEBUILD -# endif -#include "pngusr.h" -#endif - -/* PNG_CONFIGURE_LIBPNG is set by the "configure" script. */ -#ifdef PNG_CONFIGURE_LIBPNG -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#endif - -/* - * Added at libpng-1.2.8 - * - * If you create a private DLL you need to define in "pngusr.h" the followings: - * #define PNG_USER_PRIVATEBUILD - * e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons." - * #define PNG_USER_DLLFNAME_POSTFIX - * e.g. // private DLL "libpng13gx.dll" - * #define PNG_USER_DLLFNAME_POSTFIX "gx" - * - * The following macros are also at your disposal if you want to complete the - * DLL VERSIONINFO structure. - * - PNG_USER_VERSIONINFO_COMMENTS - * - PNG_USER_VERSIONINFO_COMPANYNAME - * - PNG_USER_VERSIONINFO_LEGALTRADEMARKS - */ - -#ifdef __STDC__ -#ifdef SPECIALBUILD -# pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\ - are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.") -#endif - -#ifdef PRIVATEBUILD -# pragma message("PRIVATEBUILD is deprecated.\ - Use PNG_USER_PRIVATEBUILD instead.") -# define PNG_USER_PRIVATEBUILD PRIVATEBUILD -#endif -#endif /* __STDC__ */ - -#ifndef PNG_VERSION_INFO_ONLY - -/* End of material added to libpng-1.2.8 */ - -/* This is the size of the compression buffer, and thus the size of - * an IDAT chunk. Make this whatever size you feel is best for your - * machine. One of these will be allocated per png_struct. When this - * is full, it writes the data to the disk, and does some other - * calculations. Making this an extremely small size will slow - * the library down, but you may want to experiment to determine - * where it becomes significant, if you are concerned with memory - * usage. Note that zlib allocates at least 32Kb also. For readers, - * this describes the size of the buffer available to read the data in. - * Unless this gets smaller than the size of a row (compressed), - * it should not make much difference how big this is. - */ - -#ifndef PNG_ZBUF_SIZE -# define PNG_ZBUF_SIZE 8192 -#endif - -/* Enable if you want a write-only libpng */ - -#ifndef PNG_NO_READ_SUPPORTED -# define PNG_READ_SUPPORTED -#endif - -/* Enable if you want a read-only libpng */ - -#ifndef PNG_NO_WRITE_SUPPORTED -# define PNG_WRITE_SUPPORTED -#endif - -/* Enabled by default in 1.2.0. You can disable this if you don't need to - support PNGs that are embedded in MNG datastreams */ -#if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES) -# ifndef PNG_MNG_FEATURES_SUPPORTED -# define PNG_MNG_FEATURES_SUPPORTED -# endif -#endif - -#ifndef PNG_NO_FLOATING_POINT_SUPPORTED -# ifndef PNG_FLOATING_POINT_SUPPORTED -# define PNG_FLOATING_POINT_SUPPORTED -# endif -#endif - -/* If you are running on a machine where you cannot allocate more - * than 64K of memory at once, uncomment this. While libpng will not - * normally need that much memory in a chunk (unless you load up a very - * large file), zlib needs to know how big of a chunk it can use, and - * libpng thus makes sure to check any memory allocation to verify it - * will fit into memory. -#define PNG_MAX_MALLOC_64K - */ -#if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K) -# define PNG_MAX_MALLOC_64K -#endif - -/* Special munging to support doing things the 'cygwin' way: - * 'Normal' png-on-win32 defines/defaults: - * PNG_BUILD_DLL -- building dll - * PNG_USE_DLL -- building an application, linking to dll - * (no define) -- building static library, or building an - * application and linking to the static lib - * 'Cygwin' defines/defaults: - * PNG_BUILD_DLL -- (ignored) building the dll - * (no define) -- (ignored) building an application, linking to the dll - * PNG_STATIC -- (ignored) building the static lib, or building an - * application that links to the static lib. - * ALL_STATIC -- (ignored) building various static libs, or building an - * application that links to the static libs. - * Thus, - * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and - * this bit of #ifdefs will define the 'correct' config variables based on - * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but - * unnecessary. - * - * Also, the precedence order is: - * ALL_STATIC (since we can't #undef something outside our namespace) - * PNG_BUILD_DLL - * PNG_STATIC - * (nothing) == PNG_USE_DLL - * - * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent - * of auto-import in binutils, we no longer need to worry about - * __declspec(dllexport) / __declspec(dllimport) and friends. Therefore, - * we don't need to worry about PNG_STATIC or ALL_STATIC when it comes - * to __declspec() stuff. However, we DO need to worry about - * PNG_BUILD_DLL and PNG_STATIC because those change some defaults - * such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed. - */ -#if defined(__CYGWIN__) -# if defined(ALL_STATIC) -# if defined(PNG_BUILD_DLL) -# undef PNG_BUILD_DLL -# endif -# if defined(PNG_USE_DLL) -# undef PNG_USE_DLL -# endif -# if defined(PNG_DLL) -# undef PNG_DLL -# endif -# if !defined(PNG_STATIC) -# define PNG_STATIC -# endif -# else -# if defined (PNG_BUILD_DLL) -# if defined(PNG_STATIC) -# undef PNG_STATIC -# endif -# if defined(PNG_USE_DLL) -# undef PNG_USE_DLL -# endif -# if !defined(PNG_DLL) -# define PNG_DLL -# endif -# else -# if defined(PNG_STATIC) -# if defined(PNG_USE_DLL) -# undef PNG_USE_DLL -# endif -# if defined(PNG_DLL) -# undef PNG_DLL -# endif -# else -# if !defined(PNG_USE_DLL) -# define PNG_USE_DLL -# endif -# if !defined(PNG_DLL) -# define PNG_DLL -# endif -# endif -# endif -# endif -#endif - -/* This protects us against compilers that run on a windowing system - * and thus don't have or would rather us not use the stdio types: - * stdin, stdout, and stderr. The only one currently used is stderr - * in png_error() and png_warning(). #defining PNG_NO_CONSOLE_IO will - * prevent these from being compiled and used. #defining PNG_NO_STDIO - * will also prevent these, plus will prevent the entire set of stdio - * macros and functions (FILE *, printf, etc.) from being compiled and used, - * unless (PNG_DEBUG > 0) has been #defined. - * - * #define PNG_NO_CONSOLE_IO - * #define PNG_NO_STDIO - */ - -#if defined(_WIN32_WCE) -# include - /* Console I/O functions are not supported on WindowsCE */ -# define PNG_NO_CONSOLE_IO -# ifdef PNG_DEBUG -# undef PNG_DEBUG -# endif -#endif - -#ifdef PNG_BUILD_DLL -# ifndef PNG_CONSOLE_IO_SUPPORTED -# ifndef PNG_NO_CONSOLE_IO -# define PNG_NO_CONSOLE_IO -# endif -# endif -#endif - -# ifdef PNG_NO_STDIO -# ifndef PNG_NO_CONSOLE_IO -# define PNG_NO_CONSOLE_IO -# endif -# ifdef PNG_DEBUG -# if (PNG_DEBUG > 0) -# include -# endif -# endif -# else -# if !defined(_WIN32_WCE) -/* "stdio.h" functions are not supported on WindowsCE */ -# include -# endif -# endif - -/* This macro protects us against machines that don't have function - * prototypes (ie K&R style headers). If your compiler does not handle - * function prototypes, define this macro and use the included ansi2knr. - * I've always been able to use _NO_PROTO as the indicator, but you may - * need to drag the empty declaration out in front of here, or change the - * ifdef to suit your own needs. - */ -#ifndef PNGARG - -#ifdef OF /* zlib prototype munger */ -# define PNGARG(arglist) OF(arglist) -#else - -#ifdef _NO_PROTO -# define PNGARG(arglist) () -# ifndef PNG_TYPECAST_NULL -# define PNG_TYPECAST_NULL -# endif -#else -# define PNGARG(arglist) arglist -#endif /* _NO_PROTO */ - -#endif /* OF */ - -#endif /* PNGARG */ - -/* Try to determine if we are compiling on a Mac. Note that testing for - * just __MWERKS__ is not good enough, because the Codewarrior is now used - * on non-Mac platforms. - */ -#ifndef MACOS -# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \ - defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC) -# define MACOS -# endif -#endif - -/* enough people need this for various reasons to include it here */ -#if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE) -# include -#endif - -#if !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED) -# define PNG_SETJMP_SUPPORTED -#endif - -#ifdef PNG_SETJMP_SUPPORTED -/* This is an attempt to force a single setjmp behaviour on Linux. If - * the X config stuff didn't define _BSD_SOURCE we wouldn't need this. - */ - -# ifdef __linux__ -# ifdef _BSD_SOURCE -# define PNG_SAVE_BSD_SOURCE -# undef _BSD_SOURCE -# endif -# ifdef _SETJMP_H - /* If you encounter a compiler error here, see the explanation - * near the end of INSTALL. - */ - __png.h__ already includes setjmp.h; - __dont__ include it again.; -# endif -# endif /* __linux__ */ - - /* include setjmp.h for error handling */ -# include - -# ifdef __linux__ -# ifdef PNG_SAVE_BSD_SOURCE -# define _BSD_SOURCE -# undef PNG_SAVE_BSD_SOURCE -# endif -# endif /* __linux__ */ -#endif /* PNG_SETJMP_SUPPORTED */ - -#ifdef BSD -# include -#else -# include -#endif - -/* Other defines for things like memory and the like can go here. */ -#ifdef PNG_INTERNAL - -#include - -/* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which - * aren't usually used outside the library (as far as I know), so it is - * debatable if they should be exported at all. In the future, when it is - * possible to have run-time registry of chunk-handling functions, some of - * these will be made available again. -#define PNG_EXTERN extern - */ -#define PNG_EXTERN - -/* Other defines specific to compilers can go here. Try to keep - * them inside an appropriate ifdef/endif pair for portability. - */ - -#if defined(PNG_FLOATING_POINT_SUPPORTED) -# if defined(MACOS) - /* We need to check that hasn't already been included earlier - * as it seems it doesn't agree with , yet we should really use - * if possible. - */ -# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__) -# include -# endif -# else -# include -# endif -# if defined(_AMIGA) && defined(__SASC) && defined(_M68881) - /* Amiga SAS/C: We must include builtin FPU functions when compiling using - * MATH=68881 - */ -# include -# endif -#endif - -/* Codewarrior on NT has linking problems without this. */ -#if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__) -# define PNG_ALWAYS_EXTERN -#endif - -/* This provides the non-ANSI (far) memory allocation routines. */ -#if defined(__TURBOC__) && defined(__MSDOS__) -# include -# include -#endif - -/* I have no idea why is this necessary... */ -#if defined(_MSC_VER) && (defined(WIN32) || defined(_Windows) || \ - defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__)) -# include -#endif - -/* This controls how fine the dithering gets. As this allocates - * a largish chunk of memory (32K), those who are not as concerned - * with dithering quality can decrease some or all of these. - */ -#ifndef PNG_DITHER_RED_BITS -# define PNG_DITHER_RED_BITS 5 -#endif -#ifndef PNG_DITHER_GREEN_BITS -# define PNG_DITHER_GREEN_BITS 5 -#endif -#ifndef PNG_DITHER_BLUE_BITS -# define PNG_DITHER_BLUE_BITS 5 -#endif - -/* This controls how fine the gamma correction becomes when you - * are only interested in 8 bits anyway. Increasing this value - * results in more memory being used, and more pow() functions - * being called to fill in the gamma tables. Don't set this value - * less then 8, and even that may not work (I haven't tested it). - */ - -#ifndef PNG_MAX_GAMMA_8 -# define PNG_MAX_GAMMA_8 11 -#endif - -/* This controls how much a difference in gamma we can tolerate before - * we actually start doing gamma conversion. - */ -#ifndef PNG_GAMMA_THRESHOLD -# define PNG_GAMMA_THRESHOLD 0.05 -#endif - -#endif /* PNG_INTERNAL */ - -/* The following uses const char * instead of char * for error - * and warning message functions, so some compilers won't complain. - * If you do not want to use const, define PNG_NO_CONST here. - */ - -#ifndef PNG_NO_CONST -# define PNG_CONST const -#else -# define PNG_CONST -#endif - -/* The following defines give you the ability to remove code from the - * library that you will not be using. I wish I could figure out how to - * automate this, but I can't do that without making it seriously hard - * on the users. So if you are not using an ability, change the #define - * to and #undef, and that part of the library will not be compiled. If - * your linker can't find a function, you may want to make sure the - * ability is defined here. Some of these depend upon some others being - * defined. I haven't figured out all the interactions here, so you may - * have to experiment awhile to get everything to compile. If you are - * creating or using a shared library, you probably shouldn't touch this, - * as it will affect the size of the structures, and this will cause bad - * things to happen if the library and/or application ever change. - */ - -/* Any features you will not be using can be undef'ed here */ - -/* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user - * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS - * on the compile line, then pick and choose which ones to define without - * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED - * if you only want to have a png-compliant reader/writer but don't need - * any of the extra transformations. This saves about 80 kbytes in a - * typical installation of the library. (PNG_NO_* form added in version - * 1.0.1c, for consistency) - */ - -/* The size of the png_text structure changed in libpng-1.0.6 when - * iTXt support was added. iTXt support was turned off by default through - * libpng-1.2.x, to support old apps that malloc the png_text structure - * instead of calling png_set_text() and letting libpng malloc it. It - * was turned on by default in libpng-1.3.0. - */ - -#if defined(PNG_1_0_X) || defined (PNG_1_2_X) -# ifndef PNG_NO_iTXt_SUPPORTED -# define PNG_NO_iTXt_SUPPORTED -# endif -# ifndef PNG_NO_READ_iTXt -# define PNG_NO_READ_iTXt -# endif -# ifndef PNG_NO_WRITE_iTXt -# define PNG_NO_WRITE_iTXt -# endif -#endif - -#if !defined(PNG_NO_iTXt_SUPPORTED) -# if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt) -# define PNG_READ_iTXt -# endif -# if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt) -# define PNG_WRITE_iTXt -# endif -#endif - -/* The following support, added after version 1.0.0, can be turned off here en - * masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility - * with old applications that require the length of png_struct and png_info - * to remain unchanged. - */ - -#ifdef PNG_LEGACY_SUPPORTED -# define PNG_NO_FREE_ME -# define PNG_NO_READ_UNKNOWN_CHUNKS -# define PNG_NO_WRITE_UNKNOWN_CHUNKS -# define PNG_NO_READ_USER_CHUNKS -# define PNG_NO_READ_iCCP -# define PNG_NO_WRITE_iCCP -# define PNG_NO_READ_iTXt -# define PNG_NO_WRITE_iTXt -# define PNG_NO_READ_sCAL -# define PNG_NO_WRITE_sCAL -# define PNG_NO_READ_sPLT -# define PNG_NO_WRITE_sPLT -# define PNG_NO_INFO_IMAGE -# define PNG_NO_READ_RGB_TO_GRAY -# define PNG_NO_READ_USER_TRANSFORM -# define PNG_NO_WRITE_USER_TRANSFORM -# define PNG_NO_USER_MEM -# define PNG_NO_READ_EMPTY_PLTE -# define PNG_NO_MNG_FEATURES -# define PNG_NO_FIXED_POINT_SUPPORTED -#endif - -/* Ignore attempt to turn off both floating and fixed point support */ -#if !defined(PNG_FLOATING_POINT_SUPPORTED) || \ - !defined(PNG_NO_FIXED_POINT_SUPPORTED) -# define PNG_FIXED_POINT_SUPPORTED -#endif - -#ifndef PNG_NO_FREE_ME -# define PNG_FREE_ME_SUPPORTED -#endif - -#if defined(PNG_READ_SUPPORTED) - -#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \ - !defined(PNG_NO_READ_TRANSFORMS) -# define PNG_READ_TRANSFORMS_SUPPORTED -#endif - -#ifdef PNG_READ_TRANSFORMS_SUPPORTED -# ifndef PNG_NO_READ_EXPAND -# define PNG_READ_EXPAND_SUPPORTED -# endif -# ifndef PNG_NO_READ_SHIFT -# define PNG_READ_SHIFT_SUPPORTED -# endif -# ifndef PNG_NO_READ_PACK -# define PNG_READ_PACK_SUPPORTED -# endif -# ifndef PNG_NO_READ_BGR -# define PNG_READ_BGR_SUPPORTED -# endif -# ifndef PNG_NO_READ_SWAP -# define PNG_READ_SWAP_SUPPORTED -# endif -# ifndef PNG_NO_READ_PACKSWAP -# define PNG_READ_PACKSWAP_SUPPORTED -# endif -# ifndef PNG_NO_READ_INVERT -# define PNG_READ_INVERT_SUPPORTED -# endif -# ifndef PNG_NO_READ_DITHER -# define PNG_READ_DITHER_SUPPORTED -# endif -# ifndef PNG_NO_READ_BACKGROUND -# define PNG_READ_BACKGROUND_SUPPORTED -# endif -# ifndef PNG_NO_READ_16_TO_8 -# define PNG_READ_16_TO_8_SUPPORTED -# endif -# ifndef PNG_NO_READ_FILLER -# define PNG_READ_FILLER_SUPPORTED -# endif -# ifndef PNG_NO_READ_GAMMA -# define PNG_READ_GAMMA_SUPPORTED -# endif -# ifndef PNG_NO_READ_GRAY_TO_RGB -# define PNG_READ_GRAY_TO_RGB_SUPPORTED -# endif -# ifndef PNG_NO_READ_SWAP_ALPHA -# define PNG_READ_SWAP_ALPHA_SUPPORTED -# endif -# ifndef PNG_NO_READ_INVERT_ALPHA -# define PNG_READ_INVERT_ALPHA_SUPPORTED -# endif -# ifndef PNG_NO_READ_STRIP_ALPHA -# define PNG_READ_STRIP_ALPHA_SUPPORTED -# endif -# ifndef PNG_NO_READ_USER_TRANSFORM -# define PNG_READ_USER_TRANSFORM_SUPPORTED -# endif -# ifndef PNG_NO_READ_RGB_TO_GRAY -# define PNG_READ_RGB_TO_GRAY_SUPPORTED -# endif -#endif /* PNG_READ_TRANSFORMS_SUPPORTED */ - -#if !defined(PNG_NO_PROGRESSIVE_READ) && \ - !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */ -# define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */ -#endif /* about interlacing capability! You'll */ - /* still have interlacing unless you change the following line: */ - -#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */ - -#ifndef PNG_NO_READ_COMPOSITE_NODIV -# ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */ -# define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */ -# endif -#endif - -#if defined(PNG_1_0_X) || defined (PNG_1_2_X) -/* Deprecated, will be removed from version 2.0.0. - Use PNG_MNG_FEATURES_SUPPORTED instead. */ -#ifndef PNG_NO_READ_EMPTY_PLTE -# define PNG_READ_EMPTY_PLTE_SUPPORTED -#endif -#endif - -#endif /* PNG_READ_SUPPORTED */ - -#if defined(PNG_WRITE_SUPPORTED) - -# if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \ - !defined(PNG_NO_WRITE_TRANSFORMS) -# define PNG_WRITE_TRANSFORMS_SUPPORTED -#endif - -#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED -# ifndef PNG_NO_WRITE_SHIFT -# define PNG_WRITE_SHIFT_SUPPORTED -# endif -# ifndef PNG_NO_WRITE_PACK -# define PNG_WRITE_PACK_SUPPORTED -# endif -# ifndef PNG_NO_WRITE_BGR -# define PNG_WRITE_BGR_SUPPORTED -# endif -# ifndef PNG_NO_WRITE_SWAP -# define PNG_WRITE_SWAP_SUPPORTED -# endif -# ifndef PNG_NO_WRITE_PACKSWAP -# define PNG_WRITE_PACKSWAP_SUPPORTED -# endif -# ifndef PNG_NO_WRITE_INVERT -# define PNG_WRITE_INVERT_SUPPORTED -# endif -# ifndef PNG_NO_WRITE_FILLER -# define PNG_WRITE_FILLER_SUPPORTED /* same as WRITE_STRIP_ALPHA */ -# endif -# ifndef PNG_NO_WRITE_SWAP_ALPHA -# define PNG_WRITE_SWAP_ALPHA_SUPPORTED -# endif -# ifndef PNG_NO_WRITE_INVERT_ALPHA -# define PNG_WRITE_INVERT_ALPHA_SUPPORTED -# endif -# ifndef PNG_NO_WRITE_USER_TRANSFORM -# define PNG_WRITE_USER_TRANSFORM_SUPPORTED -# endif -#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */ - -#if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \ - !defined(PNG_WRITE_INTERLACING_SUPPORTED) -#define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant - encoders, but can cause trouble - if left undefined */ -#endif - -#if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \ - !defined(PNG_WRITE_WEIGHTED_FILTER) && \ - defined(PNG_FLOATING_POINT_SUPPORTED) -# define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED -#endif - -#ifndef PNG_NO_WRITE_FLUSH -# define PNG_WRITE_FLUSH_SUPPORTED -#endif - -#if defined(PNG_1_0_X) || defined (PNG_1_2_X) -/* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */ -#ifndef PNG_NO_WRITE_EMPTY_PLTE -# define PNG_WRITE_EMPTY_PLTE_SUPPORTED -#endif -#endif - -#endif /* PNG_WRITE_SUPPORTED */ - -#ifndef PNG_1_0_X -# ifndef PNG_NO_ERROR_NUMBERS -# define PNG_ERROR_NUMBERS_SUPPORTED -# endif -#endif /* PNG_1_0_X */ - -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) -# ifndef PNG_NO_USER_TRANSFORM_PTR -# define PNG_USER_TRANSFORM_PTR_SUPPORTED -# endif -#endif - -#ifndef PNG_NO_STDIO -# define PNG_TIME_RFC1123_SUPPORTED -#endif - -/* This adds extra functions in pngget.c for accessing data from the - * info pointer (added in version 0.99) - * png_get_image_width() - * png_get_image_height() - * png_get_bit_depth() - * png_get_color_type() - * png_get_compression_type() - * png_get_filter_type() - * png_get_interlace_type() - * png_get_pixel_aspect_ratio() - * png_get_pixels_per_meter() - * png_get_x_offset_pixels() - * png_get_y_offset_pixels() - * png_get_x_offset_microns() - * png_get_y_offset_microns() - */ -#if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED) -# define PNG_EASY_ACCESS_SUPPORTED -#endif - -/* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0 - * even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined. - * - * PNG_NO_ASSEMBLER_CODE disables use of all assembler code and optimized C, - * and removes or includes several functions in the API. - * - * PNG_NO_MMX_CODE disables the use of MMX code without changing the API. - * When MMX code is off, then optimized C replacement functions are used. -*/ -#if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE) -# ifndef PNG_ASSEMBLER_CODE_SUPPORTED -# define PNG_ASSEMBLER_CODE_SUPPORTED -# endif -# if defined(XP_MACOSX) && !defined(PNG_NO_MMX_CODE) - /* work around Intel-Mac compiler bug */ -# define PNG_NO_MMX_CODE -# endif -# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE) && \ - defined(__MMX__) -# define PNG_MMX_CODE_SUPPORTED -# endif -# if !defined(PNG_USE_PNGGCCRD) && !defined(PNG_NO_MMX_CODE) && \ - !defined(PNG_USE_PNGVCRD) && defined(__MMX__) -# define PNG_USE_PNGGCCRD -# endif -#endif - -/* If you are sure that you don't need thread safety and you are compiling - with PNG_USE_PNGCCRD for an MMX application, you can define this for - faster execution. See pnggccrd.c. -#define PNG_THREAD_UNSAFE_OK -*/ - -#if !defined(PNG_1_0_X) -#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED) -# define PNG_USER_MEM_SUPPORTED -#endif -#endif /* PNG_1_0_X */ - -/* Added at libpng-1.2.6 */ -#if !defined(PNG_1_0_X) -#ifndef PNG_SET_USER_LIMITS_SUPPORTED -#if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED) -# define PNG_SET_USER_LIMITS_SUPPORTED -#endif -#endif -#endif /* PNG_1_0_X */ - -/* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGS no matter - * how large, set these limits to 0x7fffffffL - */ -#ifndef PNG_USER_WIDTH_MAX -# define PNG_USER_WIDTH_MAX 1000000L -#endif -#ifndef PNG_USER_HEIGHT_MAX -# define PNG_USER_HEIGHT_MAX 1000000L -#endif - -/* These are currently experimental features, define them if you want */ - -/* very little testing */ -/* -#ifdef PNG_READ_SUPPORTED -# ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED -# define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED -# endif -#endif -*/ - -/* This is only for PowerPC big-endian and 680x0 systems */ -/* some testing */ -/* -#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED -# define PNG_READ_BIG_ENDIAN_SUPPORTED -#endif -*/ - -/* Buggy compilers (e.g., gcc 2.7.2.2) need this */ -/* -#define PNG_NO_POINTER_INDEXING -*/ - -/* These functions are turned off by default, as they will be phased out. */ -/* -#define PNG_USELESS_TESTS_SUPPORTED -#define PNG_CORRECT_PALETTE_SUPPORTED -*/ - -/* Any chunks you are not interested in, you can undef here. The - * ones that allocate memory may be expecially important (hIST, - * tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info - * a bit smaller. - */ - -#if defined(PNG_READ_SUPPORTED) && \ - !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ - !defined(PNG_NO_READ_ANCILLARY_CHUNKS) -# define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED -#endif - -#if defined(PNG_WRITE_SUPPORTED) && \ - !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \ - !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS) -# define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED -#endif - -#ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED - -#ifdef PNG_NO_READ_TEXT -# define PNG_NO_READ_iTXt -# define PNG_NO_READ_tEXt -# define PNG_NO_READ_zTXt -#endif -#ifndef PNG_NO_READ_bKGD -# define PNG_READ_bKGD_SUPPORTED -# define PNG_bKGD_SUPPORTED -#endif -#ifndef PNG_NO_READ_cHRM -# define PNG_READ_cHRM_SUPPORTED -# define PNG_cHRM_SUPPORTED -#endif -#ifndef PNG_NO_READ_gAMA -# define PNG_READ_gAMA_SUPPORTED -# define PNG_gAMA_SUPPORTED -#endif -#ifndef PNG_NO_READ_hIST -# define PNG_READ_hIST_SUPPORTED -# define PNG_hIST_SUPPORTED -#endif -#ifndef PNG_NO_READ_iCCP -# define PNG_READ_iCCP_SUPPORTED -# define PNG_iCCP_SUPPORTED -#endif -#ifndef PNG_NO_READ_iTXt -# ifndef PNG_READ_iTXt_SUPPORTED -# define PNG_READ_iTXt_SUPPORTED -# endif -# ifndef PNG_iTXt_SUPPORTED -# define PNG_iTXt_SUPPORTED -# endif -#endif -#ifndef PNG_NO_READ_oFFs -# define PNG_READ_oFFs_SUPPORTED -# define PNG_oFFs_SUPPORTED -#endif -#ifndef PNG_NO_READ_pCAL -# define PNG_READ_pCAL_SUPPORTED -# define PNG_pCAL_SUPPORTED -#endif -#ifndef PNG_NO_READ_sCAL -# define PNG_READ_sCAL_SUPPORTED -# define PNG_sCAL_SUPPORTED -#endif -#ifndef PNG_NO_READ_pHYs -# define PNG_READ_pHYs_SUPPORTED -# define PNG_pHYs_SUPPORTED -#endif -#ifndef PNG_NO_READ_sBIT -# define PNG_READ_sBIT_SUPPORTED -# define PNG_sBIT_SUPPORTED -#endif -#ifndef PNG_NO_READ_sPLT -# define PNG_READ_sPLT_SUPPORTED -# define PNG_sPLT_SUPPORTED -#endif -#ifndef PNG_NO_READ_sRGB -# define PNG_READ_sRGB_SUPPORTED -# define PNG_sRGB_SUPPORTED -#endif -#ifndef PNG_NO_READ_tEXt -# define PNG_READ_tEXt_SUPPORTED -# define PNG_tEXt_SUPPORTED -#endif -#ifndef PNG_NO_READ_tIME -# define PNG_READ_tIME_SUPPORTED -# define PNG_tIME_SUPPORTED -#endif -#ifndef PNG_NO_READ_tRNS -# define PNG_READ_tRNS_SUPPORTED -# define PNG_tRNS_SUPPORTED -#endif -#ifndef PNG_NO_READ_zTXt -# define PNG_READ_zTXt_SUPPORTED -# define PNG_zTXt_SUPPORTED -#endif -#ifndef PNG_NO_READ_UNKNOWN_CHUNKS -# define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED -# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED -# define PNG_UNKNOWN_CHUNKS_SUPPORTED -# endif -# ifndef PNG_NO_HANDLE_AS_UNKNOWN -# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED -# endif -#endif -#if !defined(PNG_NO_READ_USER_CHUNKS) && \ - defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) -# define PNG_READ_USER_CHUNKS_SUPPORTED -# define PNG_USER_CHUNKS_SUPPORTED -# ifdef PNG_NO_READ_UNKNOWN_CHUNKS -# undef PNG_NO_READ_UNKNOWN_CHUNKS -# endif -# ifdef PNG_NO_HANDLE_AS_UNKNOWN -# undef PNG_NO_HANDLE_AS_UNKNOWN -# endif -#endif -#ifndef PNG_NO_READ_OPT_PLTE -# define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */ -#endif /* optional PLTE chunk in RGB and RGBA images */ -#if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \ - defined(PNG_READ_zTXt_SUPPORTED) -# define PNG_READ_TEXT_SUPPORTED -# define PNG_TEXT_SUPPORTED -#endif - -#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */ - -#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED - -#ifdef PNG_NO_WRITE_TEXT -# define PNG_NO_WRITE_iTXt -# define PNG_NO_WRITE_tEXt -# define PNG_NO_WRITE_zTXt -#endif -#ifndef PNG_NO_WRITE_bKGD -# define PNG_WRITE_bKGD_SUPPORTED -# ifndef PNG_bKGD_SUPPORTED -# define PNG_bKGD_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_cHRM -# define PNG_WRITE_cHRM_SUPPORTED -# ifndef PNG_cHRM_SUPPORTED -# define PNG_cHRM_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_gAMA -# define PNG_WRITE_gAMA_SUPPORTED -# ifndef PNG_gAMA_SUPPORTED -# define PNG_gAMA_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_hIST -# define PNG_WRITE_hIST_SUPPORTED -# ifndef PNG_hIST_SUPPORTED -# define PNG_hIST_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_iCCP -# define PNG_WRITE_iCCP_SUPPORTED -# ifndef PNG_iCCP_SUPPORTED -# define PNG_iCCP_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_iTXt -# ifndef PNG_WRITE_iTXt_SUPPORTED -# define PNG_WRITE_iTXt_SUPPORTED -# endif -# ifndef PNG_iTXt_SUPPORTED -# define PNG_iTXt_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_oFFs -# define PNG_WRITE_oFFs_SUPPORTED -# ifndef PNG_oFFs_SUPPORTED -# define PNG_oFFs_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_pCAL -# define PNG_WRITE_pCAL_SUPPORTED -# ifndef PNG_pCAL_SUPPORTED -# define PNG_pCAL_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_sCAL -# define PNG_WRITE_sCAL_SUPPORTED -# ifndef PNG_sCAL_SUPPORTED -# define PNG_sCAL_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_pHYs -# define PNG_WRITE_pHYs_SUPPORTED -# ifndef PNG_pHYs_SUPPORTED -# define PNG_pHYs_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_sBIT -# define PNG_WRITE_sBIT_SUPPORTED -# ifndef PNG_sBIT_SUPPORTED -# define PNG_sBIT_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_sPLT -# define PNG_WRITE_sPLT_SUPPORTED -# ifndef PNG_sPLT_SUPPORTED -# define PNG_sPLT_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_sRGB -# define PNG_WRITE_sRGB_SUPPORTED -# ifndef PNG_sRGB_SUPPORTED -# define PNG_sRGB_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_tEXt -# define PNG_WRITE_tEXt_SUPPORTED -# ifndef PNG_tEXt_SUPPORTED -# define PNG_tEXt_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_tIME -# define PNG_WRITE_tIME_SUPPORTED -# ifndef PNG_tIME_SUPPORTED -# define PNG_tIME_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_tRNS -# define PNG_WRITE_tRNS_SUPPORTED -# ifndef PNG_tRNS_SUPPORTED -# define PNG_tRNS_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_zTXt -# define PNG_WRITE_zTXt_SUPPORTED -# ifndef PNG_zTXt_SUPPORTED -# define PNG_zTXt_SUPPORTED -# endif -#endif -#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS -# define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED -# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED -# define PNG_UNKNOWN_CHUNKS_SUPPORTED -# endif -# ifndef PNG_NO_HANDLE_AS_UNKNOWN -# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED -# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED -# endif -# endif -#endif -#if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \ - defined(PNG_WRITE_zTXt_SUPPORTED) -# define PNG_WRITE_TEXT_SUPPORTED -# ifndef PNG_TEXT_SUPPORTED -# define PNG_TEXT_SUPPORTED -# endif -#endif - -#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */ - -/* Turn this off to disable png_read_png() and - * png_write_png() and leave the row_pointers member - * out of the info structure. - */ -#ifndef PNG_NO_INFO_IMAGE -# define PNG_INFO_IMAGE_SUPPORTED -#endif - -/* need the time information for reading tIME chunks */ -#if defined(PNG_tIME_SUPPORTED) -# if !defined(_WIN32_WCE) - /* "time.h" functions are not supported on WindowsCE */ -# include -# endif -#endif - -/* Some typedefs to get us started. These should be safe on most of the - * common platforms. The typedefs should be at least as large as the - * numbers suggest (a png_uint_32 must be at least 32 bits long), but they - * don't have to be exactly that size. Some compilers dislike passing - * unsigned shorts as function parameters, so you may be better off using - * unsigned int for png_uint_16. Likewise, for 64-bit systems, you may - * want to have unsigned int for png_uint_32 instead of unsigned long. - */ - -typedef unsigned int png_uint_32; -typedef int png_int_32; -typedef unsigned short png_uint_16; -typedef short png_int_16; -typedef unsigned char png_byte; - -/* This is usually size_t. It is typedef'ed just in case you need it to - change (I'm not sure if you will or not, so I thought I'd be safe) */ -#ifdef PNG_SIZE_T - typedef PNG_SIZE_T png_size_t; -# define png_sizeof(x) png_convert_size(sizeof (x)) -#else - typedef size_t png_size_t; -# define png_sizeof(x) sizeof (x) -#endif - -/* The following is needed for medium model support. It cannot be in the - * PNG_INTERNAL section. Needs modification for other compilers besides - * MSC. Model independent support declares all arrays and pointers to be - * large using the far keyword. The zlib version used must also support - * model independent data. As of version zlib 1.0.4, the necessary changes - * have been made in zlib. The USE_FAR_KEYWORD define triggers other - * changes that are needed. (Tim Wegner) - */ - -/* Separate compiler dependencies (problem here is that zlib.h always - defines FAR. (SJT) */ -#ifdef __BORLANDC__ -# if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__) -# define LDATA 1 -# else -# define LDATA 0 -# endif - /* GRR: why is Cygwin in here? Cygwin is not Borland C... */ -# if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__) -# define PNG_MAX_MALLOC_64K -# if (LDATA != 1) -# ifndef FAR -# define FAR __far -# endif -# define USE_FAR_KEYWORD -# endif /* LDATA != 1 */ - /* Possibly useful for moving data out of default segment. - * Uncomment it if you want. Could also define FARDATA as - * const if your compiler supports it. (SJT) -# define FARDATA FAR - */ -# endif /* __WIN32__, __FLAT__, __CYGWIN__ */ -#endif /* __BORLANDC__ */ - - -/* Suggest testing for specific compiler first before testing for - * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM, - * making reliance oncertain keywords suspect. (SJT) - */ - -/* MSC Medium model */ -#if defined(FAR) -# if defined(M_I86MM) -# define USE_FAR_KEYWORD -# define FARDATA FAR -# include -# endif -#endif - -/* SJT: default case */ -#ifndef FAR -# define FAR -#endif - -/* At this point FAR is always defined */ -#ifndef FARDATA -# define FARDATA -#endif - -/* Typedef for floating-point numbers that are converted - to fixed-point with a multiple of 100,000, e.g., int_gamma */ -typedef png_int_32 png_fixed_point; - -/* Add typedefs for pointers */ -typedef void FAR * png_voidp; -typedef png_byte FAR * png_bytep; -typedef png_uint_32 FAR * png_uint_32p; -typedef png_int_32 FAR * png_int_32p; -typedef png_uint_16 FAR * png_uint_16p; -typedef png_int_16 FAR * png_int_16p; -typedef PNG_CONST char FAR * png_const_charp; -typedef char FAR * png_charp; -typedef png_fixed_point FAR * png_fixed_point_p; - -#ifndef PNG_NO_STDIO -#if defined(_WIN32_WCE) -typedef HANDLE png_FILE_p; -#else -typedef FILE * png_FILE_p; -#endif -#endif - -#ifdef PNG_FLOATING_POINT_SUPPORTED -typedef double FAR * png_doublep; -#endif - -/* Pointers to pointers; i.e. arrays */ -typedef png_byte FAR * FAR * png_bytepp; -typedef png_uint_32 FAR * FAR * png_uint_32pp; -typedef png_int_32 FAR * FAR * png_int_32pp; -typedef png_uint_16 FAR * FAR * png_uint_16pp; -typedef png_int_16 FAR * FAR * png_int_16pp; -typedef PNG_CONST char FAR * FAR * png_const_charpp; -typedef char FAR * FAR * png_charpp; -typedef png_fixed_point FAR * FAR * png_fixed_point_pp; -#ifdef PNG_FLOATING_POINT_SUPPORTED -typedef double FAR * FAR * png_doublepp; -#endif - -/* Pointers to pointers to pointers; i.e., pointer to array */ -typedef char FAR * FAR * FAR * png_charppp; - -#if defined(PNG_1_0_X) || defined(PNG_1_2_X) -/* SPC - Is this stuff deprecated? */ -/* It'll be removed as of libpng-1.3.0 - GR-P */ -/* libpng typedefs for types in zlib. If zlib changes - * or another compression library is used, then change these. - * Eliminates need to change all the source files. - */ -typedef charf * png_zcharp; -typedef charf * FAR * png_zcharpp; -typedef z_stream FAR * png_zstreamp; -#endif /* (PNG_1_0_X) || defined(PNG_1_2_X) */ - -/* - * Define PNG_BUILD_DLL if the module being built is a Windows - * LIBPNG DLL. - * - * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL. - * It is equivalent to Microsoft predefined macro _DLL that is - * automatically defined when you compile using the share - * version of the CRT (C Run-Time library) - * - * The cygwin mods make this behavior a little different: - * Define PNG_BUILD_DLL if you are building a dll for use with cygwin - * Define PNG_STATIC if you are building a static library for use with cygwin, - * -or- if you are building an application that you want to link to the - * static library. - * PNG_USE_DLL is defined by default (no user action needed) unless one of - * the other flags is defined. - */ - -#if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL)) -# define PNG_DLL -#endif -/* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib. - * When building a static lib, default to no GLOBAL ARRAYS, but allow - * command-line override - */ -#if defined(__CYGWIN__) -# if !defined(PNG_STATIC) -# if defined(PNG_USE_GLOBAL_ARRAYS) -# undef PNG_USE_GLOBAL_ARRAYS -# endif -# if !defined(PNG_USE_LOCAL_ARRAYS) -# define PNG_USE_LOCAL_ARRAYS -# endif -# else -# if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS) -# if defined(PNG_USE_GLOBAL_ARRAYS) -# undef PNG_USE_GLOBAL_ARRAYS -# endif -# endif -# endif -# if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS) -# define PNG_USE_LOCAL_ARRAYS -# endif -#endif - -/* Do not use global arrays (helps with building DLL's) - * They are no longer used in libpng itself, since version 1.0.5c, - * but might be required for some pre-1.0.5c applications. - */ -#if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS) -# if defined(PNG_NO_GLOBAL_ARRAYS) || (defined(__GNUC__) && defined(PNG_DLL)) -# define PNG_USE_LOCAL_ARRAYS -# else -# define PNG_USE_GLOBAL_ARRAYS -# endif -#endif - -#if defined(__CYGWIN__) -# undef PNGAPI -# define PNGAPI __cdecl -# undef PNG_IMPEXP -# define PNG_IMPEXP -#endif - -/* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall", - * you may get warnings regarding the linkage of png_zalloc and png_zfree. - * Don't ignore those warnings; you must also reset the default calling - * convention in your compiler to match your PNGAPI, and you must build - * zlib and your applications the same way you build libpng. - */ - -#if defined(__MINGW32__) && !defined(PNG_MODULEDEF) -# ifndef PNG_NO_MODULEDEF -# define PNG_NO_MODULEDEF -# endif -#endif - -#if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF) -# define PNG_IMPEXP -#endif - -#if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \ - (( defined(_Windows) || defined(_WINDOWS) || \ - defined(WIN32) || defined(_WIN32) || defined(__WIN32__) )) - -# ifndef PNGAPI -# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800)) -# define PNGAPI __cdecl -# else -# define PNGAPI _cdecl -# endif -# endif - -# if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \ - 0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */) -# define PNG_IMPEXP -# endif - -# if !defined(PNG_IMPEXP) - -# define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol -# define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol - - /* Borland/Microsoft */ -# if defined(_MSC_VER) || defined(__BORLANDC__) -# if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500) -# define PNG_EXPORT PNG_EXPORT_TYPE1 -# else -# define PNG_EXPORT PNG_EXPORT_TYPE2 -# if defined(PNG_BUILD_DLL) -# define PNG_IMPEXP __export -# else -# define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in - VC++ */ -# endif /* Exists in Borland C++ for - C++ classes (== huge) */ -# endif -# endif - -# if !defined(PNG_IMPEXP) -# if defined(PNG_BUILD_DLL) -# define PNG_IMPEXP __declspec(dllexport) -# else -# define PNG_IMPEXP __declspec(dllimport) -# endif -# endif -# endif /* PNG_IMPEXP */ -#else /* !(DLL || non-cygwin WINDOWS) */ -# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__) -# ifndef PNGAPI -# define PNGAPI _System -# endif -# else -# if 0 /* ... other platforms, with other meanings */ -# endif -# endif -#endif - -#ifndef PNGAPI -# define PNGAPI -#endif -#ifndef PNG_IMPEXP -# define PNG_IMPEXP -#endif - -#ifdef PNG_BUILDSYMS -# ifndef PNG_EXPORT -# define PNG_EXPORT(type,symbol) PNG_FUNCTION_EXPORT symbol END -# endif -# ifdef PNG_USE_GLOBAL_ARRAYS -# ifndef PNG_EXPORT_VAR -# define PNG_EXPORT_VAR(type) PNG_DATA_EXPORT -# endif -# endif -#endif - -#ifndef PNG_EXPORT -# define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol -#endif - -#ifdef PNG_USE_GLOBAL_ARRAYS -# ifndef PNG_EXPORT_VAR -# define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type -# endif -#endif - -/* User may want to use these so they are not in PNG_INTERNAL. Any library - * functions that are passed far data must be model independent. - */ - -#ifndef PNG_ABORT -# define PNG_ABORT() abort() -#endif - -#ifdef PNG_SETJMP_SUPPORTED -# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf) -#else -# define png_jmpbuf(png_ptr) \ - (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED) -#endif - -#if defined(USE_FAR_KEYWORD) /* memory model independent fns */ -/* use this to make far-to-near assignments */ -# define CHECK 1 -# define NOCHECK 0 -# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK)) -# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK)) -# define png_strcpy _fstrcpy -# define png_strncpy _fstrncpy /* Added to v 1.2.6 */ -# define png_strlen _fstrlen -# define png_memcmp _fmemcmp /* SJT: added */ -# define png_memcpy _fmemcpy -# define png_memset _fmemset -#else /* use the usual functions */ -# define CVT_PTR(ptr) (ptr) -# define CVT_PTR_NOCHECK(ptr) (ptr) -# define png_strcpy strcpy -# define png_strncpy strncpy /* Added to v 1.2.6 */ -# define png_strlen strlen -# define png_memcmp memcmp /* SJT: added */ -# define png_memcpy memcpy -# define png_memset memset -#endif -/* End of memory model independent support */ - -/* Just a little check that someone hasn't tried to define something - * contradictory. - */ -#if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K) -# undef PNG_ZBUF_SIZE -# define PNG_ZBUF_SIZE 65536L -#endif - -#ifdef PNG_READ_SUPPORTED -/* Prior to libpng-1.0.9, this block was in pngasmrd.h */ -#if defined(PNG_INTERNAL) - -/* These are the default thresholds before the MMX code kicks in; if either - * rowbytes or bitdepth is below the threshold, plain C code is used. These - * can be overridden at runtime via the png_set_mmx_thresholds() call in - * libpng 1.2.0 and later. The values below were chosen by Intel. - */ - -#ifndef PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT -# define PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT 128 /* >= */ -#endif -#ifndef PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT -# define PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT 9 /* >= */ -#endif - -/* Set this in the makefile for VC++ on Pentium, not here. */ -/* Platform must be Pentium. Makefile must assemble and load pngvcrd.c . - * MMX will be detected at run time and used if present. - */ -#ifdef PNG_USE_PNGVCRD -# define PNG_HAVE_MMX_COMBINE_ROW -# define PNG_HAVE_MMX_READ_INTERLACE -# define PNG_HAVE_MMX_READ_FILTER_ROW -#endif - -/* Set this in the makefile for gcc/as on Pentium, not here. */ -/* Platform must be Pentium. Makefile must assemble and load pnggccrd.c . - * MMX will be detected at run time and used if present. - */ -#ifdef PNG_USE_PNGGCCRD -# define PNG_HAVE_MMX_COMBINE_ROW -# define PNG_HAVE_MMX_READ_INTERLACE -# define PNG_HAVE_MMX_READ_FILTER_ROW -#endif -/* - see pnggccrd.c for info about what is currently enabled */ - -#endif /* PNG_INTERNAL */ -#endif /* PNG_READ_SUPPORTED */ - -/* Added at libpng-1.2.8 */ -#endif /* PNG_VERSION_INFO_ONLY */ - -#endif /* PNGCONF_H */ diff --git a/src/dep/src/irrlicht/libpng/pngerror.c b/src/dep/src/irrlicht/libpng/pngerror.c index 0111872..17b137f 100644 --- a/src/dep/src/irrlicht/libpng/pngerror.c +++ b/src/dep/src/irrlicht/libpng/pngerror.c @@ -1,7 +1,7 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * Last changed in libpng 1.2.34 [December 18, 2008] + * Last changed in libpng 1.2.30 [August 15, 2008] * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -116,9 +116,9 @@ png_warning(png_structp png_ptr, png_const_charp warning_message) break; } } + if (png_ptr != NULL && png_ptr->warning_fn != NULL) + (*(png_ptr->warning_fn))(png_ptr, warning_message + offset); } - if (png_ptr != NULL && png_ptr->warning_fn != NULL) - (*(png_ptr->warning_fn))(png_ptr, warning_message + offset); else png_default_warning(png_ptr, warning_message + offset); } @@ -343,323 +343,3 @@ png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode) } #endif #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ - -/* pngerror.c - stub functions for i/o and memory allocation - * - * Last changed in libpng 1.2.13 November 13, 2006 - * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2006 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - * - * This file provides a location for all error handling. Users who - * need special error handling are expected to write replacement functions - * and use png_set_error_fn() to use those functions. See the instructions - * at each function. - */ - -#define PNG_INTERNAL -#include "png.h" - -#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) -static void /* PRIVATE */ -png_default_error PNGARG((png_structp png_ptr, - png_const_charp error_message)); -static void /* PRIVATE */ -png_default_warning PNGARG((png_structp png_ptr, - png_const_charp warning_message)); - -/* This function is called whenever there is a fatal error. This function - * should not be changed. If there is a need to handle errors differently, - * you should supply a replacement error function and use png_set_error_fn() - * to replace the error function at run-time. - */ -void PNGAPI -png_error(png_structp png_ptr, png_const_charp error_message) -{ -#ifdef PNG_ERROR_NUMBERS_SUPPORTED - char msg[16]; - if (png_ptr != NULL) - { - if (png_ptr->flags& - (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) - { - if (*error_message == '#') - { - int offset; - for (offset=1; offset<15; offset++) - if (*(error_message+offset) == ' ') - break; - if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT) - { - int i; - for (i=0; iflags&PNG_FLAG_STRIP_ERROR_TEXT) - { - msg[0]='0'; - msg[1]='\0'; - error_message=msg; - } - } - } - } -#endif - if (png_ptr != NULL && png_ptr->error_fn != NULL) - (*(png_ptr->error_fn))(png_ptr, error_message); - - /* If the custom handler doesn't exist, or if it returns, - use the default handler, which will not return. */ - png_default_error(png_ptr, error_message); -} - -/* This function is called whenever there is a non-fatal error. This function - * should not be changed. If there is a need to handle warnings differently, - * you should supply a replacement warning function and use - * png_set_error_fn() to replace the warning function at run-time. - */ -void PNGAPI -png_warning(png_structp png_ptr, png_const_charp warning_message) -{ - int offset = 0; - if (png_ptr != NULL) - { -#ifdef PNG_ERROR_NUMBERS_SUPPORTED - if (png_ptr->flags& - (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) -#endif - { - if (*warning_message == '#') - { - for (offset=1; offset<15; offset++) - if (*(warning_message+offset) == ' ') - break; - } - } - if (png_ptr != NULL && png_ptr->warning_fn != NULL) - (*(png_ptr->warning_fn))(png_ptr, warning_message+offset); - } - else - png_default_warning(png_ptr, warning_message+offset); -} - -/* These utilities are used internally to build an error message that relates - * to the current chunk. The chunk name comes from png_ptr->chunk_name, - * this is used to prefix the message. The message is limited in length - * to 63 bytes, the name characters are output as hex digits wrapped in [] - * if the character is invalid. - */ -#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97)) -const static PNG_CONST char png_digit[16] = { - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - 'A', 'B', 'C', 'D', 'E', 'F' -}; - -static void /* PRIVATE */ -png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp - error_message) -{ - int iout = 0, iin = 0; - - while (iin < 4) - { - int c = png_ptr->chunk_name[iin++]; - if (isnonalpha(c)) - { - buffer[iout++] = '['; - buffer[iout++] = png_digit[(c & 0xf0) >> 4]; - buffer[iout++] = png_digit[c & 0x0f]; - buffer[iout++] = ']'; - } - else - { - buffer[iout++] = (png_byte)c; - } - } - - if (error_message == NULL) - buffer[iout] = 0; - else - { - buffer[iout++] = ':'; - buffer[iout++] = ' '; - png_strncpy(buffer+iout, error_message, 63); - buffer[iout+63] = 0; - } -} - -void PNGAPI -png_chunk_error(png_structp png_ptr, png_const_charp error_message) -{ - char msg[18+64]; - if (png_ptr == NULL) - png_error(png_ptr, error_message); - else - { - png_format_buffer(png_ptr, msg, error_message); - png_error(png_ptr, msg); - } -} - -void PNGAPI -png_chunk_warning(png_structp png_ptr, png_const_charp warning_message) -{ - char msg[18+64]; - if (png_ptr == NULL) - png_warning(png_ptr, warning_message); - else - { - png_format_buffer(png_ptr, msg, warning_message); - png_warning(png_ptr, msg); - } -} - -/* This is the default error handling function. Note that replacements for - * this function MUST NOT RETURN, or the program will likely crash. This - * function is used by default, or if the program supplies NULL for the - * error function pointer in png_set_error_fn(). - */ -static void /* PRIVATE */ -png_default_error(png_structp png_ptr, png_const_charp error_message) -{ -#ifndef PNG_NO_CONSOLE_IO -#ifdef PNG_ERROR_NUMBERS_SUPPORTED - if (*error_message == '#') - { - int offset; - char error_number[16]; - for (offset=0; offset<15; offset++) - { - error_number[offset] = *(error_message+offset+1); - if (*(error_message+offset) == ' ') - break; - } - if((offset > 1) && (offset < 15)) - { - error_number[offset-1]='\0'; - fprintf(stderr, "libpng error no. %s: %s\n", error_number, - error_message+offset); - } - else - fprintf(stderr, "libpng error: %s, offset=%d\n", error_message,offset); - } - else -#endif - fprintf(stderr, "libpng error: %s\n", error_message); -#endif - -#ifdef PNG_SETJMP_SUPPORTED - if (png_ptr) - { -# ifdef USE_FAR_KEYWORD - { - jmp_buf jmpbuf; - png_memcpy(jmpbuf,png_ptr->jmpbuf,png_sizeof(jmp_buf)); - longjmp(jmpbuf, 1); - } -# else - longjmp(png_ptr->jmpbuf, 1); -# endif - } -#else - PNG_ABORT(); -#endif -#ifdef PNG_NO_CONSOLE_IO - /* make compiler happy */ ; - if (&error_message != NULL) - return; -#endif -} - -/* This function is called when there is a warning, but the library thinks - * it can continue anyway. Replacement functions don't have to do anything - * here if you don't want them to. In the default configuration, png_ptr is - * not used, but it is passed in case it may be useful. - */ -static void /* PRIVATE */ -png_default_warning(png_structp png_ptr, png_const_charp warning_message) -{ -#ifndef PNG_NO_CONSOLE_IO -# ifdef PNG_ERROR_NUMBERS_SUPPORTED - if (*warning_message == '#') - { - int offset; - char warning_number[16]; - for (offset=0; offset<15; offset++) - { - warning_number[offset]=*(warning_message+offset+1); - if (*(warning_message+offset) == ' ') - break; - } - if((offset > 1) && (offset < 15)) - { - warning_number[offset-1]='\0'; - fprintf(stderr, "libpng warning no. %s: %s\n", warning_number, - warning_message+offset); - } - else - fprintf(stderr, "libpng warning: %s\n", warning_message); - } - else -# endif - fprintf(stderr, "libpng warning: %s\n", warning_message); -#else - /* make compiler happy */ ; - if (warning_message) - return; -#endif - /* make compiler happy */ ; - if (png_ptr) - return; -} - -/* This function is called when the application wants to use another method - * of handling errors and warnings. Note that the error function MUST NOT - * return to the calling routine or serious problems will occur. The return - * method used in the default routine calls longjmp(png_ptr->jmpbuf, 1) - */ -void PNGAPI -png_set_error_fn(png_structp png_ptr, png_voidp error_ptr, - png_error_ptr error_fn, png_error_ptr warning_fn) -{ - if (png_ptr == NULL) - return; - png_ptr->error_ptr = error_ptr; - png_ptr->error_fn = error_fn; - png_ptr->warning_fn = warning_fn; -} - - -/* This function returns a pointer to the error_ptr associated with the user - * functions. The application should free any memory associated with this - * pointer before png_write_destroy and png_read_destroy are called. - */ -png_voidp PNGAPI -png_get_error_ptr(png_structp png_ptr) -{ - if (png_ptr == NULL) - return NULL; - return ((png_voidp)png_ptr->error_ptr); -} - - -#ifdef PNG_ERROR_NUMBERS_SUPPORTED -void PNGAPI -png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode) -{ - if(png_ptr != NULL) - { - png_ptr->flags &= - ((~(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode); - } -} -#endif -#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ diff --git a/src/dep/src/irrlicht/libpng/pnggccrd.c b/src/dep/src/irrlicht/libpng/pnggccrd.c index f4f9180..6d932ab 100644 --- a/src/dep/src/irrlicht/libpng/pnggccrd.c +++ b/src/dep/src/irrlicht/libpng/pnggccrd.c @@ -101,5423 +101,3 @@ png_dummy_mmx_support(void) return _mmx_supported; } #endif - -/* pnggccrd.c - mixed C/assembler version of utilities to read a PNG file - * - * For Intel x86 CPU (Pentium-MMX or later) and GNU C compiler. - * - * See http://www.intel.com/drg/pentiumII/appnotes/916/916.htm - * and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm - * for Intel's performance analysis of the MMX vs. non-MMX code. - * - * Last changed in libpng 1.2.15 January 5, 2007 - * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson - * Copyright (c) 1998, Intel Corporation - * - * Based on MSVC code contributed by Nirav Chhatrapati, Intel Corp., 1998. - * Interface to libpng contributed by Gilles Vollant, 1999. - * GNU C port by Greg Roelofs, 1999-2001. - * - * Lines 2350-4300 converted in place with intel2gas 1.3.1: - * - * intel2gas -mdI pnggccrd.c.partially-msvc -o pnggccrd.c - * - * and then cleaned up by hand. See http://hermes.terminal.at/intel2gas/ . - * - * NOTE: A sufficiently recent version of GNU as (or as.exe under DOS/Windows) - * is required to assemble the newer MMX instructions such as movq. - * For djgpp, see - * - * ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bnu281b.zip - * - * (or a later version in the same directory). For Linux, check your - * distribution's web site(s) or try these links: - * - * http://rufus.w3.org/linux/RPM/binutils.html - * http://www.debian.org/Packages/stable/devel/binutils.html - * ftp://ftp.slackware.com/pub/linux/slackware/slackware/slakware/d1/ - * binutils.tgz - * - * For other platforms, see the main GNU site: - * - * ftp://ftp.gnu.org/pub/gnu/binutils/ - * - * Version 2.5.2l.15 is definitely too old... - */ - -/* - * TEMPORARY PORTING NOTES AND CHANGELOG (mostly by Greg Roelofs) - * ===================================== - * - * 19991006: - * - fixed sign error in post-MMX cleanup code (16- & 32-bit cases) - * - * 19991007: - * - additional optimizations (possible or definite): - * x [DONE] write MMX code for 64-bit case (pixel_bytes == 8) [not tested] - * - write MMX code for 48-bit case (pixel_bytes == 6) - * - figure out what's up with 24-bit case (pixel_bytes == 3): - * why subtract 8 from width_mmx in the pass 4/5 case? - * (only width_mmx case) (near line 1606) - * x [DONE] replace pixel_bytes within each block with the true - * constant value (or are compilers smart enough to do that?) - * - rewrite all MMX interlacing code so it's aligned with - * the *beginning* of the row buffer, not the end. This - * would not only allow one to eliminate half of the memory - * writes for odd passes (that is, pass == odd), it may also - * eliminate some unaligned-data-access exceptions (assuming - * there's a penalty for not aligning 64-bit accesses on - * 64-bit boundaries). The only catch is that the "leftover" - * pixel(s) at the end of the row would have to be saved, - * but there are enough unused MMX registers in every case, - * so this is not a problem. A further benefit is that the - * post-MMX cleanup code (C code) in at least some of the - * cases could be done within the assembler block. - * x [DONE] the "v3 v2 v1 v0 v7 v6 v5 v4" comments are confusing, - * inconsistent, and don't match the MMX Programmer's Reference - * Manual conventions anyway. They should be changed to - * "b7 b6 b5 b4 b3 b2 b1 b0," where b0 indicates the byte that - * was lowest in memory (e.g., corresponding to a left pixel) - * and b7 is the byte that was highest (e.g., a right pixel). - * - * 19991016: - * - Brennan's Guide notwithstanding, gcc under Linux does *not* - * want globals prefixed by underscores when referencing them-- - * i.e., if the variable is const4, then refer to it as const4, - * not _const4. This seems to be a djgpp-specific requirement. - * Also, such variables apparently *must* be declared outside - * of functions; neither static nor automatic variables work if - * defined within the scope of a single function, but both - * static and truly global (multi-module) variables work fine. - * - * 19991023: - * - fixed png_combine_row() non-MMX replication bug (odd passes only?) - * - switched from string-concatenation-with-macros to cleaner method of - * renaming global variables for djgpp--i.e., always use prefixes in - * inlined assembler code (== strings) and conditionally rename the - * variables, not the other way around. Hence _const4, _mask8_0, etc. - * - * 19991024: - * - fixed mmxsupport()/png_do_read_interlace() first-row bug - * This one was severely weird: even though mmxsupport() doesn't touch - * ebx (where "row" pointer was stored), it nevertheless managed to zero - * the register (even in static/non-fPIC code--see below), which in turn - * caused png_do_read_interlace() to return prematurely on the first row of - * interlaced images (i.e., without expanding the interlaced pixels). - * Inspection of the generated assembly code didn't turn up any clues, - * although it did point at a minor optimization (i.e., get rid of - * mmx_supported_local variable and just use eax). Possibly the CPUID - * instruction is more destructive than it looks? (Not yet checked.) - * - "info gcc" was next to useless, so compared fPIC and non-fPIC assembly - * listings... Apparently register spillage has to do with ebx, since - * it's used to index the global offset table. Commenting it out of the - * input-reg lists in png_combine_row() eliminated compiler barfage, so - * ifdef'd with __PIC__ macro: if defined, use a global for unmask - * - * 19991107: - * - verified CPUID clobberage: 12-char string constant ("GenuineIntel", - * "AuthenticAMD", etc.) placed in ebx:ecx:edx. Still need to polish. - * - * 19991120: - * - made "diff" variable (now "_dif") global to simplify conversion of - * filtering routines (running out of regs, sigh). "diff" is still used - * in interlacing routines, however. - * - fixed up both versions of mmxsupport() (ORIG_THAT_USED_TO_CLOBBER_EBX - * macro determines which is used); original not yet tested. - * - * 20000213: - * - when compiling with gcc, be sure to use -fomit-frame-pointer - * - * 20000319: - * - fixed a register-name typo in png_do_read_interlace(), default (MMX) case, - * pass == 4 or 5, that caused visible corruption of interlaced images - * - * 20000623: - * - Various problems were reported with gcc 2.95.2 in the Cygwin environment, - * many of the form "forbidden register 0 (ax) was spilled for class AREG." - * This is explained at http://gcc.gnu.org/fom_serv/cache/23.html, and - * Chuck Wilson supplied a patch involving dummy output registers. See - * http://sourceforge.net/bugs/?func=detailbug&bug_id=108741&group_id=5624 - * for the original (anonymous) SourceForge bug report. - * - * 20000706: - * - Chuck Wilson passed along these remaining gcc 2.95.2 errors: - * pnggccrd.c: In function `png_combine_row': - * pnggccrd.c:525: more than 10 operands in `asm' - * pnggccrd.c:669: more than 10 operands in `asm' - * pnggccrd.c:828: more than 10 operands in `asm' - * pnggccrd.c:994: more than 10 operands in `asm' - * pnggccrd.c:1177: more than 10 operands in `asm' - * They are all the same problem and can be worked around by using the - * global _unmask variable unconditionally, not just in the -fPIC case. - * Reportedly earlier versions of gcc also have the problem with more than - * 10 operands; they just don't report it. Much strangeness ensues, etc. - * - * 20000729: - * - enabled png_read_filter_row_mmx_up() (shortest remaining unconverted - * MMX routine); began converting png_read_filter_row_mmx_sub() - * - to finish remaining sections: - * - clean up indentation and comments - * - preload local variables - * - add output and input regs (order of former determines numerical - * mapping of latter) - * - avoid all usage of ebx (including bx, bh, bl) register [20000823] - * - remove "$" from addressing of Shift and Mask variables [20000823] - * - * 20000731: - * - global union vars causing segfaults in png_read_filter_row_mmx_sub()? - * - * 20000822: - * - ARGH, stupid png_read_filter_row_mmx_sub() segfault only happens with - * shared-library (-fPIC) version! Code works just fine as part of static - * library. Damn damn damn damn damn, should have tested that sooner. - * ebx is getting clobbered again (explicitly this time); need to save it - * on stack or rewrite asm code to avoid using it altogether. Blargh! - * - * 20000823: - * - first section was trickiest; all remaining sections have ebx -> edx now. - * (-fPIC works again.) Also added missing underscores to various Shift* - * and *Mask* globals and got rid of leading "$" signs. - * - * 20000826: - * - added visual separators to help navigate microscopic printed copies - * (http://pobox.com/~newt/code/gpr-latest.zip, mode 10); started working - * on png_read_filter_row_mmx_avg() - * - * 20000828: - * - finished png_read_filter_row_mmx_avg(): only Paeth left! (930 lines...) - * What the hell, did png_read_filter_row_mmx_paeth(), too. Comments not - * cleaned up/shortened in either routine, but functionality is complete - * and seems to be working fine. - * - * 20000829: - * - ahhh, figured out last(?) bit of gcc/gas asm-fu: if register is listed - * as an input reg (with dummy output variables, etc.), then it *cannot* - * also appear in the clobber list or gcc 2.95.2 will barf. The solution - * is simple enough... - * - * 20000914: - * - bug in png_read_filter_row_mmx_avg(): 16-bit grayscale not handled - * correctly (but 48-bit RGB just fine) - * - * 20000916: - * - fixed bug in png_read_filter_row_mmx_avg(), bpp == 2 case; three errors: - * - "_ShiftBpp.use = 24;" should have been "_ShiftBpp.use = 16;" - * - "_ShiftRem.use = 40;" should have been "_ShiftRem.use = 48;" - * - "psllq _ShiftRem, %%mm2" should have been "psrlq _ShiftRem, %%mm2" - * - * 20010101: - * - added new png_init_mmx_flags() function (here only because it needs to - * call mmxsupport(), which should probably become global png_mmxsupport()); - * modified other MMX routines to run conditionally (png_ptr->asm_flags) - * - * 20010103: - * - renamed mmxsupport() to png_mmx_support(), with auto-set of mmx_supported, - * and made it public; moved png_init_mmx_flags() to png.c as internal func - * - * 20010104: - * - removed dependency on png_read_filter_row_c() (C code already duplicated - * within MMX version of png_read_filter_row()) so no longer necessary to - * compile it into pngrutil.o - * - * 20010310: - * - fixed buffer-overrun bug in png_combine_row() C code (non-MMX) - * - * 20020304: - * - eliminated incorrect use of width_mmx in pixel_bytes == 8 case - * - * 20040724: - * - more tinkering with clobber list at lines 4529 and 5033, to get - * it to compile on gcc-3.4. - * - * STILL TO DO: - * - test png_do_read_interlace() 64-bit case (pixel_bytes == 8) - * - write MMX code for 48-bit case (pixel_bytes == 6) - * - figure out what's up with 24-bit case (pixel_bytes == 3): - * why subtract 8 from width_mmx in the pass 4/5 case? - * (only width_mmx case) (near line 1606) - * - rewrite all MMX interlacing code so it's aligned with beginning - * of the row buffer, not the end (see 19991007 for details) - * x pick one version of mmxsupport() and get rid of the other - * - add error messages to any remaining bogus default cases - * - enable pixel_depth == 8 cases in png_read_filter_row()? (test speed) - * x add support for runtime enable/disable/query of various MMX routines - */ - -#define PNG_INTERNAL -#include "png.h" - -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_USE_PNGGCCRD) - -int PNGAPI png_mmx_support(void); - -#ifdef PNG_USE_LOCAL_ARRAYS -const static int FARDATA png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; -const static int FARDATA png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; -const static int FARDATA png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1}; -#endif - -#if defined(PNG_MMX_CODE_SUPPORTED) -/* djgpp, Win32, Cygwin, and OS2 add their own underscores to global variables, - * so define them without: */ -#if defined(__DJGPP__) || defined(WIN32) || defined(__CYGWIN__) || \ - defined(__OS2__) -# define _mmx_supported mmx_supported -# define _const4 const4 -# define _const6 const6 -# define _mask8_0 mask8_0 -# define _mask16_1 mask16_1 -# define _mask16_0 mask16_0 -# define _mask24_2 mask24_2 -# define _mask24_1 mask24_1 -# define _mask24_0 mask24_0 -# define _mask32_3 mask32_3 -# define _mask32_2 mask32_2 -# define _mask32_1 mask32_1 -# define _mask32_0 mask32_0 -# define _mask48_5 mask48_5 -# define _mask48_4 mask48_4 -# define _mask48_3 mask48_3 -# define _mask48_2 mask48_2 -# define _mask48_1 mask48_1 -# define _mask48_0 mask48_0 -# define _LBCarryMask LBCarryMask -# define _HBClearMask HBClearMask -# define _ActiveMask ActiveMask -# define _ActiveMask2 ActiveMask2 -# define _ActiveMaskEnd ActiveMaskEnd -# define _ShiftBpp ShiftBpp -# define _ShiftRem ShiftRem -#ifdef PNG_THREAD_UNSAFE_OK -# define _unmask unmask -# define _FullLength FullLength -# define _MMXLength MMXLength -# define _dif dif -# define _patemp patemp -# define _pbtemp pbtemp -# define _pctemp pctemp -#endif -#endif - - -/* These constants are used in the inlined MMX assembly code. - Ignore gcc's "At top level: defined but not used" warnings. */ - -/* GRR 20000706: originally _unmask was needed only when compiling with -fPIC, - * since that case uses the %ebx register for indexing the Global Offset Table - * and there were no other registers available. But gcc 2.95 and later emit - * "more than 10 operands in `asm'" errors when %ebx is used to preload unmask - * in the non-PIC case, so we'll just use the global unconditionally now. - */ -#ifdef PNG_THREAD_UNSAFE_OK -static int _unmask; -#endif - -const static unsigned long long _mask8_0 = 0x0102040810204080LL; - -const static unsigned long long _mask16_1 = 0x0101020204040808LL; -const static unsigned long long _mask16_0 = 0x1010202040408080LL; - -const static unsigned long long _mask24_2 = 0x0101010202020404LL; -const static unsigned long long _mask24_1 = 0x0408080810101020LL; -const static unsigned long long _mask24_0 = 0x2020404040808080LL; - -const static unsigned long long _mask32_3 = 0x0101010102020202LL; -const static unsigned long long _mask32_2 = 0x0404040408080808LL; -const static unsigned long long _mask32_1 = 0x1010101020202020LL; -const static unsigned long long _mask32_0 = 0x4040404080808080LL; - -const static unsigned long long _mask48_5 = 0x0101010101010202LL; -const static unsigned long long _mask48_4 = 0x0202020204040404LL; -const static unsigned long long _mask48_3 = 0x0404080808080808LL; -const static unsigned long long _mask48_2 = 0x1010101010102020LL; -const static unsigned long long _mask48_1 = 0x2020202040404040LL; -const static unsigned long long _mask48_0 = 0x4040808080808080LL; - -const static unsigned long long _const4 = 0x0000000000FFFFFFLL; -//const static unsigned long long _const5 = 0x000000FFFFFF0000LL; // NOT USED -const static unsigned long long _const6 = 0x00000000000000FFLL; - -// These are used in the row-filter routines and should/would be local -// variables if not for gcc addressing limitations. -// WARNING: Their presence probably defeats the thread safety of libpng. - -#ifdef PNG_THREAD_UNSAFE_OK -static png_uint_32 _FullLength; -static png_uint_32 _MMXLength; -static int _dif; -static int _patemp; // temp variables for Paeth routine -static int _pbtemp; -static int _pctemp; -#endif - -void /* PRIVATE */ -png_squelch_warnings(void) -{ -#ifdef PNG_THREAD_UNSAFE_OK - _dif = _dif; - _patemp = _patemp; - _pbtemp = _pbtemp; - _pctemp = _pctemp; - _MMXLength = _MMXLength; -#endif - _const4 = _const4; - _const6 = _const6; - _mask8_0 = _mask8_0; - _mask16_1 = _mask16_1; - _mask16_0 = _mask16_0; - _mask24_2 = _mask24_2; - _mask24_1 = _mask24_1; - _mask24_0 = _mask24_0; - _mask32_3 = _mask32_3; - _mask32_2 = _mask32_2; - _mask32_1 = _mask32_1; - _mask32_0 = _mask32_0; - _mask48_5 = _mask48_5; - _mask48_4 = _mask48_4; - _mask48_3 = _mask48_3; - _mask48_2 = _mask48_2; - _mask48_1 = _mask48_1; - _mask48_0 = _mask48_0; -} -#endif /* PNG_MMX_CODE_SUPPORTED */ - - -static int _mmx_supported = 2; - -/*===========================================================================*/ -/* */ -/* P N G _ C O M B I N E _ R O W */ -/* */ -/*===========================================================================*/ - -#if defined(PNG_HAVE_MMX_COMBINE_ROW) - -#define BPP2 2 -#define BPP3 3 /* bytes per pixel (a.k.a. pixel_bytes) */ -#define BPP4 4 -#define BPP6 6 /* (defined only to help avoid cut-and-paste errors) */ -#define BPP8 8 - -/* Combines the row recently read in with the previous row. - This routine takes care of alpha and transparency if requested. - This routine also handles the two methods of progressive display - of interlaced images, depending on the mask value. - The mask value describes which pixels are to be combined with - the row. The pattern always repeats every 8 pixels, so just 8 - bits are needed. A one indicates the pixel is to be combined; a - zero indicates the pixel is to be skipped. This is in addition - to any alpha or transparency value associated with the pixel. - If you want all pixels to be combined, pass 0xff (255) in mask. */ - -/* Use this routine for the x86 platform - it uses a faster MMX routine - if the machine supports MMX. */ - -void /* PRIVATE */ -png_combine_row(png_structp png_ptr, png_bytep row, int mask) -{ - png_debug(1, "in png_combine_row (pnggccrd.c)\n"); - -#if defined(PNG_MMX_CODE_SUPPORTED) - if (_mmx_supported == 2) { -#if !defined(PNG_1_0_X) - /* this should have happened in png_init_mmx_flags() already */ - png_warning(png_ptr, "asm_flags may not have been initialized"); -#endif - png_mmx_support(); - } -#endif - - if (mask == 0xff) - { - png_debug(2,"mask == 0xff: doing single png_memcpy()\n"); - png_memcpy(row, png_ptr->row_buf + 1, - (png_size_t)PNG_ROWBYTES(png_ptr->row_info.pixel_depth,png_ptr->width)); - } - else /* (png_combine_row() is never called with mask == 0) */ - { - switch (png_ptr->row_info.pixel_depth) - { - case 1: /* png_ptr->row_info.pixel_depth */ - { - png_bytep sp; - png_bytep dp; - int s_inc, s_start, s_end; - int m; - int shift; - png_uint_32 i; - - sp = png_ptr->row_buf + 1; - dp = row; - m = 0x80; -#if defined(PNG_READ_PACKSWAP_SUPPORTED) - if (png_ptr->transformations & PNG_PACKSWAP) - { - s_start = 0; - s_end = 7; - s_inc = 1; - } - else -#endif - { - s_start = 7; - s_end = 0; - s_inc = -1; - } - - shift = s_start; - - for (i = 0; i < png_ptr->width; i++) - { - if (m & mask) - { - int value; - - value = (*sp >> shift) & 0x1; - *dp &= (png_byte)((0x7f7f >> (7 - shift)) & 0xff); - *dp |= (png_byte)(value << shift); - } - - if (shift == s_end) - { - shift = s_start; - sp++; - dp++; - } - else - shift += s_inc; - - if (m == 1) - m = 0x80; - else - m >>= 1; - } - break; - } - - case 2: /* png_ptr->row_info.pixel_depth */ - { - png_bytep sp; - png_bytep dp; - int s_start, s_end, s_inc; - int m; - int shift; - png_uint_32 i; - int value; - - sp = png_ptr->row_buf + 1; - dp = row; - m = 0x80; -#if defined(PNG_READ_PACKSWAP_SUPPORTED) - if (png_ptr->transformations & PNG_PACKSWAP) - { - s_start = 0; - s_end = 6; - s_inc = 2; - } - else -#endif - { - s_start = 6; - s_end = 0; - s_inc = -2; - } - - shift = s_start; - - for (i = 0; i < png_ptr->width; i++) - { - if (m & mask) - { - value = (*sp >> shift) & 0x3; - *dp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff); - *dp |= (png_byte)(value << shift); - } - - if (shift == s_end) - { - shift = s_start; - sp++; - dp++; - } - else - shift += s_inc; - if (m == 1) - m = 0x80; - else - m >>= 1; - } - break; - } - - case 4: /* png_ptr->row_info.pixel_depth */ - { - png_bytep sp; - png_bytep dp; - int s_start, s_end, s_inc; - int m; - int shift; - png_uint_32 i; - int value; - - sp = png_ptr->row_buf + 1; - dp = row; - m = 0x80; -#if defined(PNG_READ_PACKSWAP_SUPPORTED) - if (png_ptr->transformations & PNG_PACKSWAP) - { - s_start = 0; - s_end = 4; - s_inc = 4; - } - else -#endif - { - s_start = 4; - s_end = 0; - s_inc = -4; - } - shift = s_start; - - for (i = 0; i < png_ptr->width; i++) - { - if (m & mask) - { - value = (*sp >> shift) & 0xf; - *dp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff); - *dp |= (png_byte)(value << shift); - } - - if (shift == s_end) - { - shift = s_start; - sp++; - dp++; - } - else - shift += s_inc; - if (m == 1) - m = 0x80; - else - m >>= 1; - } - break; - } - - case 8: /* png_ptr->row_info.pixel_depth */ - { - png_bytep srcptr; - png_bytep dstptr; - -#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) -#if !defined(PNG_1_0_X) - if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) - /* && _mmx_supported */ ) -#else - if (_mmx_supported) -#endif - { - png_uint_32 len; - int diff; - int dummy_value_a; // fix 'forbidden register spilled' error - int dummy_value_d; - int dummy_value_c; - int dummy_value_S; - int dummy_value_D; - _unmask = ~mask; // global variable for -fPIC version - srcptr = png_ptr->row_buf + 1; - dstptr = row; - len = png_ptr->width &~7; // reduce to multiple of 8 - diff = (int) (png_ptr->width & 7); // amount lost - - __asm__ __volatile__ ( - "movd _unmask, %%mm7 \n\t" // load bit pattern - "psubb %%mm6, %%mm6 \n\t" // zero mm6 - "punpcklbw %%mm7, %%mm7 \n\t" - "punpcklwd %%mm7, %%mm7 \n\t" - "punpckldq %%mm7, %%mm7 \n\t" // fill reg with 8 masks - - "movq _mask8_0, %%mm0 \n\t" - "pand %%mm7, %%mm0 \n\t" // nonzero if keep byte - "pcmpeqb %%mm6, %%mm0 \n\t" // zeros->1s, v versa - -// preload "movl len, %%ecx \n\t" // load length of line -// preload "movl srcptr, %%esi \n\t" // load source -// preload "movl dstptr, %%edi \n\t" // load dest - - "cmpl $0, %%ecx \n\t" // len == 0 ? - "je mainloop8end \n\t" - - "mainloop8: \n\t" - "movq (%%esi), %%mm4 \n\t" // *srcptr - "pand %%mm0, %%mm4 \n\t" - "movq %%mm0, %%mm6 \n\t" - "pandn (%%edi), %%mm6 \n\t" // *dstptr - "por %%mm6, %%mm4 \n\t" - "movq %%mm4, (%%edi) \n\t" - "addl $8, %%esi \n\t" // inc by 8 bytes processed - "addl $8, %%edi \n\t" - "subl $8, %%ecx \n\t" // dec by 8 pixels processed - "ja mainloop8 \n\t" - - "mainloop8end: \n\t" -// preload "movl diff, %%ecx \n\t" // (diff is in eax) - "movl %%eax, %%ecx \n\t" - "cmpl $0, %%ecx \n\t" - "jz end8 \n\t" -// preload "movl mask, %%edx \n\t" - "sall $24, %%edx \n\t" // make low byte, high byte - - "secondloop8: \n\t" - "sall %%edx \n\t" // move high bit to CF - "jnc skip8 \n\t" // if CF = 0 - "movb (%%esi), %%al \n\t" - "movb %%al, (%%edi) \n\t" - - "skip8: \n\t" - "incl %%esi \n\t" - "incl %%edi \n\t" - "decl %%ecx \n\t" - "jnz secondloop8 \n\t" - - "end8: \n\t" - "EMMS \n\t" // DONE - - : "=a" (dummy_value_a), // output regs (dummy) - "=d" (dummy_value_d), - "=c" (dummy_value_c), - "=S" (dummy_value_S), - "=D" (dummy_value_D) - - : "3" (srcptr), // esi // input regs - "4" (dstptr), // edi - "0" (diff), // eax -// was (unmask) "b" RESERVED // ebx // Global Offset Table idx - "2" (len), // ecx - "1" (mask) // edx - -#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ - : "%mm0", "%mm4", "%mm6", "%mm7" // clobber list -#endif - ); - } - else /* mmx _not supported - Use modified C routine */ -#endif /* PNG_MMX_CODE_SUPPORTED */ - { - register png_uint_32 i; - png_uint_32 initial_val = png_pass_start[png_ptr->pass]; - /* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */ - register int stride = png_pass_inc[png_ptr->pass]; - /* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */ - register int rep_bytes = png_pass_width[png_ptr->pass]; - /* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */ - png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */ - int diff = (int) (png_ptr->width & 7); /* amount lost */ - register png_uint_32 final_val = len; /* GRR bugfix */ - - srcptr = png_ptr->row_buf + 1 + initial_val; - dstptr = row + initial_val; - - for (i = initial_val; i < final_val; i += stride) - { - png_memcpy(dstptr, srcptr, rep_bytes); - srcptr += stride; - dstptr += stride; - } - if (diff) /* number of leftover pixels: 3 for pngtest */ - { - final_val+=diff /* *BPP1 */ ; - for (; i < final_val; i += stride) - { - if (rep_bytes > (int)(final_val-i)) - rep_bytes = (int)(final_val-i); - png_memcpy(dstptr, srcptr, rep_bytes); - srcptr += stride; - dstptr += stride; - } - } - - } /* end of else (_mmx_supported) */ - - break; - } /* end 8 bpp */ - - case 16: /* png_ptr->row_info.pixel_depth */ - { - png_bytep srcptr; - png_bytep dstptr; - -#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) -#if !defined(PNG_1_0_X) - if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) - /* && _mmx_supported */ ) -#else - if (_mmx_supported) -#endif - { - png_uint_32 len; - int diff; - int dummy_value_a; // fix 'forbidden register spilled' error - int dummy_value_d; - int dummy_value_c; - int dummy_value_S; - int dummy_value_D; - _unmask = ~mask; // global variable for -fPIC version - srcptr = png_ptr->row_buf + 1; - dstptr = row; - len = png_ptr->width &~7; // reduce to multiple of 8 - diff = (int) (png_ptr->width & 7); // amount lost // - - __asm__ __volatile__ ( - "movd _unmask, %%mm7 \n\t" // load bit pattern - "psubb %%mm6, %%mm6 \n\t" // zero mm6 - "punpcklbw %%mm7, %%mm7 \n\t" - "punpcklwd %%mm7, %%mm7 \n\t" - "punpckldq %%mm7, %%mm7 \n\t" // fill reg with 8 masks - - "movq _mask16_0, %%mm0 \n\t" - "movq _mask16_1, %%mm1 \n\t" - - "pand %%mm7, %%mm0 \n\t" - "pand %%mm7, %%mm1 \n\t" - - "pcmpeqb %%mm6, %%mm0 \n\t" - "pcmpeqb %%mm6, %%mm1 \n\t" - -// preload "movl len, %%ecx \n\t" // load length of line -// preload "movl srcptr, %%esi \n\t" // load source -// preload "movl dstptr, %%edi \n\t" // load dest - - "cmpl $0, %%ecx \n\t" - "jz mainloop16end \n\t" - - "mainloop16: \n\t" - "movq (%%esi), %%mm4 \n\t" - "pand %%mm0, %%mm4 \n\t" - "movq %%mm0, %%mm6 \n\t" - "movq (%%edi), %%mm7 \n\t" - "pandn %%mm7, %%mm6 \n\t" - "por %%mm6, %%mm4 \n\t" - "movq %%mm4, (%%edi) \n\t" - - "movq 8(%%esi), %%mm5 \n\t" - "pand %%mm1, %%mm5 \n\t" - "movq %%mm1, %%mm7 \n\t" - "movq 8(%%edi), %%mm6 \n\t" - "pandn %%mm6, %%mm7 \n\t" - "por %%mm7, %%mm5 \n\t" - "movq %%mm5, 8(%%edi) \n\t" - - "addl $16, %%esi \n\t" // inc by 16 bytes processed - "addl $16, %%edi \n\t" - "subl $8, %%ecx \n\t" // dec by 8 pixels processed - "ja mainloop16 \n\t" - - "mainloop16end: \n\t" -// preload "movl diff, %%ecx \n\t" // (diff is in eax) - "movl %%eax, %%ecx \n\t" - "cmpl $0, %%ecx \n\t" - "jz end16 \n\t" -// preload "movl mask, %%edx \n\t" - "sall $24, %%edx \n\t" // make low byte, high byte - - "secondloop16: \n\t" - "sall %%edx \n\t" // move high bit to CF - "jnc skip16 \n\t" // if CF = 0 - "movw (%%esi), %%ax \n\t" - "movw %%ax, (%%edi) \n\t" - - "skip16: \n\t" - "addl $2, %%esi \n\t" - "addl $2, %%edi \n\t" - "decl %%ecx \n\t" - "jnz secondloop16 \n\t" - - "end16: \n\t" - "EMMS \n\t" // DONE - - : "=a" (dummy_value_a), // output regs (dummy) - "=c" (dummy_value_c), - "=d" (dummy_value_d), - "=S" (dummy_value_S), - "=D" (dummy_value_D) - - : "0" (diff), // eax // input regs -// was (unmask) " " RESERVED // ebx // Global Offset Table idx - "1" (len), // ecx - "2" (mask), // edx - "3" (srcptr), // esi - "4" (dstptr) // edi - -#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ - : "%mm0", "%mm1", "%mm4" // clobber list - , "%mm5", "%mm6", "%mm7" -#endif - ); - } - else /* mmx _not supported - Use modified C routine */ -#endif /* PNG_MMX_CODE_SUPPORTED */ - { - register png_uint_32 i; - png_uint_32 initial_val = BPP2 * png_pass_start[png_ptr->pass]; - /* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */ - register int stride = BPP2 * png_pass_inc[png_ptr->pass]; - /* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */ - register int rep_bytes = BPP2 * png_pass_width[png_ptr->pass]; - /* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */ - png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */ - int diff = (int) (png_ptr->width & 7); /* amount lost */ - register png_uint_32 final_val = BPP2 * len; /* GRR bugfix */ - - srcptr = png_ptr->row_buf + 1 + initial_val; - dstptr = row + initial_val; - - for (i = initial_val; i < final_val; i += stride) - { - png_memcpy(dstptr, srcptr, rep_bytes); - srcptr += stride; - dstptr += stride; - } - if (diff) /* number of leftover pixels: 3 for pngtest */ - { - final_val+=diff*BPP2; - for (; i < final_val; i += stride) - { - if (rep_bytes > (int)(final_val-i)) - rep_bytes = (int)(final_val-i); - png_memcpy(dstptr, srcptr, rep_bytes); - srcptr += stride; - dstptr += stride; - } - } - } /* end of else (_mmx_supported) */ - - break; - } /* end 16 bpp */ - - case 24: /* png_ptr->row_info.pixel_depth */ - { - png_bytep srcptr; - png_bytep dstptr; - -#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) -#if !defined(PNG_1_0_X) - if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) - /* && _mmx_supported */ ) -#else - if (_mmx_supported) -#endif - { - png_uint_32 len; - int diff; - int dummy_value_a; // fix 'forbidden register spilled' error - int dummy_value_d; - int dummy_value_c; - int dummy_value_S; - int dummy_value_D; - _unmask = ~mask; // global variable for -fPIC version - srcptr = png_ptr->row_buf + 1; - dstptr = row; - len = png_ptr->width &~7; // reduce to multiple of 8 - diff = (int) (png_ptr->width & 7); // amount lost // - - __asm__ __volatile__ ( - "movd _unmask, %%mm7 \n\t" // load bit pattern - "psubb %%mm6, %%mm6 \n\t" // zero mm6 - "punpcklbw %%mm7, %%mm7 \n\t" - "punpcklwd %%mm7, %%mm7 \n\t" - "punpckldq %%mm7, %%mm7 \n\t" // fill reg with 8 masks - - "movq _mask24_0, %%mm0 \n\t" - "movq _mask24_1, %%mm1 \n\t" - "movq _mask24_2, %%mm2 \n\t" - - "pand %%mm7, %%mm0 \n\t" - "pand %%mm7, %%mm1 \n\t" - "pand %%mm7, %%mm2 \n\t" - - "pcmpeqb %%mm6, %%mm0 \n\t" - "pcmpeqb %%mm6, %%mm1 \n\t" - "pcmpeqb %%mm6, %%mm2 \n\t" - -// preload "movl len, %%ecx \n\t" // load length of line -// preload "movl srcptr, %%esi \n\t" // load source -// preload "movl dstptr, %%edi \n\t" // load dest - - "cmpl $0, %%ecx \n\t" - "jz mainloop24end \n\t" - - "mainloop24: \n\t" - "movq (%%esi), %%mm4 \n\t" - "pand %%mm0, %%mm4 \n\t" - "movq %%mm0, %%mm6 \n\t" - "movq (%%edi), %%mm7 \n\t" - "pandn %%mm7, %%mm6 \n\t" - "por %%mm6, %%mm4 \n\t" - "movq %%mm4, (%%edi) \n\t" - - "movq 8(%%esi), %%mm5 \n\t" - "pand %%mm1, %%mm5 \n\t" - "movq %%mm1, %%mm7 \n\t" - "movq 8(%%edi), %%mm6 \n\t" - "pandn %%mm6, %%mm7 \n\t" - "por %%mm7, %%mm5 \n\t" - "movq %%mm5, 8(%%edi) \n\t" - - "movq 16(%%esi), %%mm6 \n\t" - "pand %%mm2, %%mm6 \n\t" - "movq %%mm2, %%mm4 \n\t" - "movq 16(%%edi), %%mm7 \n\t" - "pandn %%mm7, %%mm4 \n\t" - "por %%mm4, %%mm6 \n\t" - "movq %%mm6, 16(%%edi) \n\t" - - "addl $24, %%esi \n\t" // inc by 24 bytes processed - "addl $24, %%edi \n\t" - "subl $8, %%ecx \n\t" // dec by 8 pixels processed - - "ja mainloop24 \n\t" - - "mainloop24end: \n\t" -// preload "movl diff, %%ecx \n\t" // (diff is in eax) - "movl %%eax, %%ecx \n\t" - "cmpl $0, %%ecx \n\t" - "jz end24 \n\t" -// preload "movl mask, %%edx \n\t" - "sall $24, %%edx \n\t" // make low byte, high byte - - "secondloop24: \n\t" - "sall %%edx \n\t" // move high bit to CF - "jnc skip24 \n\t" // if CF = 0 - "movw (%%esi), %%ax \n\t" - "movw %%ax, (%%edi) \n\t" - "xorl %%eax, %%eax \n\t" - "movb 2(%%esi), %%al \n\t" - "movb %%al, 2(%%edi) \n\t" - - "skip24: \n\t" - "addl $3, %%esi \n\t" - "addl $3, %%edi \n\t" - "decl %%ecx \n\t" - "jnz secondloop24 \n\t" - - "end24: \n\t" - "EMMS \n\t" // DONE - - : "=a" (dummy_value_a), // output regs (dummy) - "=d" (dummy_value_d), - "=c" (dummy_value_c), - "=S" (dummy_value_S), - "=D" (dummy_value_D) - - : "3" (srcptr), // esi // input regs - "4" (dstptr), // edi - "0" (diff), // eax -// was (unmask) "b" RESERVED // ebx // Global Offset Table idx - "2" (len), // ecx - "1" (mask) // edx - -#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ - : "%mm0", "%mm1", "%mm2" // clobber list - , "%mm4", "%mm5", "%mm6", "%mm7" -#endif - ); - } - else /* mmx _not supported - Use modified C routine */ -#endif /* PNG_MMX_CODE_SUPPORTED */ - { - register png_uint_32 i; - png_uint_32 initial_val = BPP3 * png_pass_start[png_ptr->pass]; - /* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */ - register int stride = BPP3 * png_pass_inc[png_ptr->pass]; - /* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */ - register int rep_bytes = BPP3 * png_pass_width[png_ptr->pass]; - /* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */ - png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */ - int diff = (int) (png_ptr->width & 7); /* amount lost */ - register png_uint_32 final_val = BPP3 * len; /* GRR bugfix */ - - srcptr = png_ptr->row_buf + 1 + initial_val; - dstptr = row + initial_val; - - for (i = initial_val; i < final_val; i += stride) - { - png_memcpy(dstptr, srcptr, rep_bytes); - srcptr += stride; - dstptr += stride; - } - if (diff) /* number of leftover pixels: 3 for pngtest */ - { - final_val+=diff*BPP3; - for (; i < final_val; i += stride) - { - if (rep_bytes > (int)(final_val-i)) - rep_bytes = (int)(final_val-i); - png_memcpy(dstptr, srcptr, rep_bytes); - srcptr += stride; - dstptr += stride; - } - } - } /* end of else (_mmx_supported) */ - - break; - } /* end 24 bpp */ - - case 32: /* png_ptr->row_info.pixel_depth */ - { - png_bytep srcptr; - png_bytep dstptr; - -#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) -#if !defined(PNG_1_0_X) - if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) - /* && _mmx_supported */ ) -#else - if (_mmx_supported) -#endif - { - png_uint_32 len; - int diff; - int dummy_value_a; // fix 'forbidden register spilled' error - int dummy_value_d; - int dummy_value_c; - int dummy_value_S; - int dummy_value_D; - _unmask = ~mask; // global variable for -fPIC version - srcptr = png_ptr->row_buf + 1; - dstptr = row; - len = png_ptr->width &~7; // reduce to multiple of 8 - diff = (int) (png_ptr->width & 7); // amount lost // - - __asm__ __volatile__ ( - "movd _unmask, %%mm7 \n\t" // load bit pattern - "psubb %%mm6, %%mm6 \n\t" // zero mm6 - "punpcklbw %%mm7, %%mm7 \n\t" - "punpcklwd %%mm7, %%mm7 \n\t" - "punpckldq %%mm7, %%mm7 \n\t" // fill reg with 8 masks - - "movq _mask32_0, %%mm0 \n\t" - "movq _mask32_1, %%mm1 \n\t" - "movq _mask32_2, %%mm2 \n\t" - "movq _mask32_3, %%mm3 \n\t" - - "pand %%mm7, %%mm0 \n\t" - "pand %%mm7, %%mm1 \n\t" - "pand %%mm7, %%mm2 \n\t" - "pand %%mm7, %%mm3 \n\t" - - "pcmpeqb %%mm6, %%mm0 \n\t" - "pcmpeqb %%mm6, %%mm1 \n\t" - "pcmpeqb %%mm6, %%mm2 \n\t" - "pcmpeqb %%mm6, %%mm3 \n\t" - -// preload "movl len, %%ecx \n\t" // load length of line -// preload "movl srcptr, %%esi \n\t" // load source -// preload "movl dstptr, %%edi \n\t" // load dest - - "cmpl $0, %%ecx \n\t" // lcr - "jz mainloop32end \n\t" - - "mainloop32: \n\t" - "movq (%%esi), %%mm4 \n\t" - "pand %%mm0, %%mm4 \n\t" - "movq %%mm0, %%mm6 \n\t" - "movq (%%edi), %%mm7 \n\t" - "pandn %%mm7, %%mm6 \n\t" - "por %%mm6, %%mm4 \n\t" - "movq %%mm4, (%%edi) \n\t" - - "movq 8(%%esi), %%mm5 \n\t" - "pand %%mm1, %%mm5 \n\t" - "movq %%mm1, %%mm7 \n\t" - "movq 8(%%edi), %%mm6 \n\t" - "pandn %%mm6, %%mm7 \n\t" - "por %%mm7, %%mm5 \n\t" - "movq %%mm5, 8(%%edi) \n\t" - - "movq 16(%%esi), %%mm6 \n\t" - "pand %%mm2, %%mm6 \n\t" - "movq %%mm2, %%mm4 \n\t" - "movq 16(%%edi), %%mm7 \n\t" - "pandn %%mm7, %%mm4 \n\t" - "por %%mm4, %%mm6 \n\t" - "movq %%mm6, 16(%%edi) \n\t" - - "movq 24(%%esi), %%mm7 \n\t" - "pand %%mm3, %%mm7 \n\t" - "movq %%mm3, %%mm5 \n\t" - "movq 24(%%edi), %%mm4 \n\t" - "pandn %%mm4, %%mm5 \n\t" - "por %%mm5, %%mm7 \n\t" - "movq %%mm7, 24(%%edi) \n\t" - - "addl $32, %%esi \n\t" // inc by 32 bytes processed - "addl $32, %%edi \n\t" - "subl $8, %%ecx \n\t" // dec by 8 pixels processed - "ja mainloop32 \n\t" - - "mainloop32end: \n\t" -// preload "movl diff, %%ecx \n\t" // (diff is in eax) - "movl %%eax, %%ecx \n\t" - "cmpl $0, %%ecx \n\t" - "jz end32 \n\t" -// preload "movl mask, %%edx \n\t" - "sall $24, %%edx \n\t" // low byte => high byte - - "secondloop32: \n\t" - "sall %%edx \n\t" // move high bit to CF - "jnc skip32 \n\t" // if CF = 0 - "movl (%%esi), %%eax \n\t" - "movl %%eax, (%%edi) \n\t" - - "skip32: \n\t" - "addl $4, %%esi \n\t" - "addl $4, %%edi \n\t" - "decl %%ecx \n\t" - "jnz secondloop32 \n\t" - - "end32: \n\t" - "EMMS \n\t" // DONE - - : "=a" (dummy_value_a), // output regs (dummy) - "=d" (dummy_value_d), - "=c" (dummy_value_c), - "=S" (dummy_value_S), - "=D" (dummy_value_D) - - : "3" (srcptr), // esi // input regs - "4" (dstptr), // edi - "0" (diff), // eax -// was (unmask) "b" RESERVED // ebx // Global Offset Table idx - "2" (len), // ecx - "1" (mask) // edx - -#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ - : "%mm0", "%mm1", "%mm2", "%mm3" // clobber list - , "%mm4", "%mm5", "%mm6", "%mm7" -#endif - ); - } - else /* mmx _not supported - Use modified C routine */ -#endif /* PNG_MMX_CODE_SUPPORTED */ - { - register png_uint_32 i; - png_uint_32 initial_val = BPP4 * png_pass_start[png_ptr->pass]; - /* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */ - register int stride = BPP4 * png_pass_inc[png_ptr->pass]; - /* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */ - register int rep_bytes = BPP4 * png_pass_width[png_ptr->pass]; - /* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */ - png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */ - int diff = (int) (png_ptr->width & 7); /* amount lost */ - register png_uint_32 final_val = BPP4 * len; /* GRR bugfix */ - - srcptr = png_ptr->row_buf + 1 + initial_val; - dstptr = row + initial_val; - - for (i = initial_val; i < final_val; i += stride) - { - png_memcpy(dstptr, srcptr, rep_bytes); - srcptr += stride; - dstptr += stride; - } - if (diff) /* number of leftover pixels: 3 for pngtest */ - { - final_val+=diff*BPP4; - for (; i < final_val; i += stride) - { - if (rep_bytes > (int)(final_val-i)) - rep_bytes = (int)(final_val-i); - png_memcpy(dstptr, srcptr, rep_bytes); - srcptr += stride; - dstptr += stride; - } - } - } /* end of else (_mmx_supported) */ - - break; - } /* end 32 bpp */ - - case 48: /* png_ptr->row_info.pixel_depth */ - { - png_bytep srcptr; - png_bytep dstptr; - -#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) -#if !defined(PNG_1_0_X) - if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) - /* && _mmx_supported */ ) -#else - if (_mmx_supported) -#endif - { - png_uint_32 len; - int diff; - int dummy_value_a; // fix 'forbidden register spilled' error - int dummy_value_d; - int dummy_value_c; - int dummy_value_S; - int dummy_value_D; - _unmask = ~mask; // global variable for -fPIC version - srcptr = png_ptr->row_buf + 1; - dstptr = row; - len = png_ptr->width &~7; // reduce to multiple of 8 - diff = (int) (png_ptr->width & 7); // amount lost // - - __asm__ __volatile__ ( - "movd _unmask, %%mm7 \n\t" // load bit pattern - "psubb %%mm6, %%mm6 \n\t" // zero mm6 - "punpcklbw %%mm7, %%mm7 \n\t" - "punpcklwd %%mm7, %%mm7 \n\t" - "punpckldq %%mm7, %%mm7 \n\t" // fill reg with 8 masks - - "movq _mask48_0, %%mm0 \n\t" - "movq _mask48_1, %%mm1 \n\t" - "movq _mask48_2, %%mm2 \n\t" - "movq _mask48_3, %%mm3 \n\t" - "movq _mask48_4, %%mm4 \n\t" - "movq _mask48_5, %%mm5 \n\t" - - "pand %%mm7, %%mm0 \n\t" - "pand %%mm7, %%mm1 \n\t" - "pand %%mm7, %%mm2 \n\t" - "pand %%mm7, %%mm3 \n\t" - "pand %%mm7, %%mm4 \n\t" - "pand %%mm7, %%mm5 \n\t" - - "pcmpeqb %%mm6, %%mm0 \n\t" - "pcmpeqb %%mm6, %%mm1 \n\t" - "pcmpeqb %%mm6, %%mm2 \n\t" - "pcmpeqb %%mm6, %%mm3 \n\t" - "pcmpeqb %%mm6, %%mm4 \n\t" - "pcmpeqb %%mm6, %%mm5 \n\t" - -// preload "movl len, %%ecx \n\t" // load length of line -// preload "movl srcptr, %%esi \n\t" // load source -// preload "movl dstptr, %%edi \n\t" // load dest - - "cmpl $0, %%ecx \n\t" - "jz mainloop48end \n\t" - - "mainloop48: \n\t" - "movq (%%esi), %%mm7 \n\t" - "pand %%mm0, %%mm7 \n\t" - "movq %%mm0, %%mm6 \n\t" - "pandn (%%edi), %%mm6 \n\t" - "por %%mm6, %%mm7 \n\t" - "movq %%mm7, (%%edi) \n\t" - - "movq 8(%%esi), %%mm6 \n\t" - "pand %%mm1, %%mm6 \n\t" - "movq %%mm1, %%mm7 \n\t" - "pandn 8(%%edi), %%mm7 \n\t" - "por %%mm7, %%mm6 \n\t" - "movq %%mm6, 8(%%edi) \n\t" - - "movq 16(%%esi), %%mm6 \n\t" - "pand %%mm2, %%mm6 \n\t" - "movq %%mm2, %%mm7 \n\t" - "pandn 16(%%edi), %%mm7 \n\t" - "por %%mm7, %%mm6 \n\t" - "movq %%mm6, 16(%%edi) \n\t" - - "movq 24(%%esi), %%mm7 \n\t" - "pand %%mm3, %%mm7 \n\t" - "movq %%mm3, %%mm6 \n\t" - "pandn 24(%%edi), %%mm6 \n\t" - "por %%mm6, %%mm7 \n\t" - "movq %%mm7, 24(%%edi) \n\t" - - "movq 32(%%esi), %%mm6 \n\t" - "pand %%mm4, %%mm6 \n\t" - "movq %%mm4, %%mm7 \n\t" - "pandn 32(%%edi), %%mm7 \n\t" - "por %%mm7, %%mm6 \n\t" - "movq %%mm6, 32(%%edi) \n\t" - - "movq 40(%%esi), %%mm7 \n\t" - "pand %%mm5, %%mm7 \n\t" - "movq %%mm5, %%mm6 \n\t" - "pandn 40(%%edi), %%mm6 \n\t" - "por %%mm6, %%mm7 \n\t" - "movq %%mm7, 40(%%edi) \n\t" - - "addl $48, %%esi \n\t" // inc by 48 bytes processed - "addl $48, %%edi \n\t" - "subl $8, %%ecx \n\t" // dec by 8 pixels processed - - "ja mainloop48 \n\t" - - "mainloop48end: \n\t" -// preload "movl diff, %%ecx \n\t" // (diff is in eax) - "movl %%eax, %%ecx \n\t" - "cmpl $0, %%ecx \n\t" - "jz end48 \n\t" -// preload "movl mask, %%edx \n\t" - "sall $24, %%edx \n\t" // make low byte, high byte - - "secondloop48: \n\t" - "sall %%edx \n\t" // move high bit to CF - "jnc skip48 \n\t" // if CF = 0 - "movl (%%esi), %%eax \n\t" - "movl %%eax, (%%edi) \n\t" - - "skip48: \n\t" - "addl $4, %%esi \n\t" - "addl $4, %%edi \n\t" - "decl %%ecx \n\t" - "jnz secondloop48 \n\t" - - "end48: \n\t" - "EMMS \n\t" // DONE - - : "=a" (dummy_value_a), // output regs (dummy) - "=d" (dummy_value_d), - "=c" (dummy_value_c), - "=S" (dummy_value_S), - "=D" (dummy_value_D) - - : "3" (srcptr), // esi // input regs - "4" (dstptr), // edi - "0" (diff), // eax -// was (unmask) "b" RESERVED // ebx // Global Offset Table idx - "2" (len), // ecx - "1" (mask) // edx - -#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ - : "%mm0", "%mm1", "%mm2", "%mm3" // clobber list - , "%mm4", "%mm5", "%mm6", "%mm7" -#endif - ); - } - else /* mmx _not supported - Use modified C routine */ -#endif /* PNG_MMX_CODE_SUPPORTED */ - { - register png_uint_32 i; - png_uint_32 initial_val = BPP6 * png_pass_start[png_ptr->pass]; - /* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */ - register int stride = BPP6 * png_pass_inc[png_ptr->pass]; - /* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */ - register int rep_bytes = BPP6 * png_pass_width[png_ptr->pass]; - /* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */ - png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */ - int diff = (int) (png_ptr->width & 7); /* amount lost */ - register png_uint_32 final_val = BPP6 * len; /* GRR bugfix */ - - srcptr = png_ptr->row_buf + 1 + initial_val; - dstptr = row + initial_val; - - for (i = initial_val; i < final_val; i += stride) - { - png_memcpy(dstptr, srcptr, rep_bytes); - srcptr += stride; - dstptr += stride; - } - if (diff) /* number of leftover pixels: 3 for pngtest */ - { - final_val+=diff*BPP6; - for (; i < final_val; i += stride) - { - if (rep_bytes > (int)(final_val-i)) - rep_bytes = (int)(final_val-i); - png_memcpy(dstptr, srcptr, rep_bytes); - srcptr += stride; - dstptr += stride; - } - } - } /* end of else (_mmx_supported) */ - - break; - } /* end 48 bpp */ - - case 64: /* png_ptr->row_info.pixel_depth */ - { - png_bytep srcptr; - png_bytep dstptr; - register png_uint_32 i; - png_uint_32 initial_val = BPP8 * png_pass_start[png_ptr->pass]; - /* png.c: png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; */ - register int stride = BPP8 * png_pass_inc[png_ptr->pass]; - /* png.c: png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; */ - register int rep_bytes = BPP8 * png_pass_width[png_ptr->pass]; - /* png.c: png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; */ - png_uint_32 len = png_ptr->width &~7; /* reduce to mult. of 8 */ - int diff = (int) (png_ptr->width & 7); /* amount lost */ - register png_uint_32 final_val = BPP8 * len; /* GRR bugfix */ - - srcptr = png_ptr->row_buf + 1 + initial_val; - dstptr = row + initial_val; - - for (i = initial_val; i < final_val; i += stride) - { - png_memcpy(dstptr, srcptr, rep_bytes); - srcptr += stride; - dstptr += stride; - } - if (diff) /* number of leftover pixels: 3 for pngtest */ - { - final_val+=diff*BPP8; - for (; i < final_val; i += stride) - { - if (rep_bytes > (int)(final_val-i)) - rep_bytes = (int)(final_val-i); - png_memcpy(dstptr, srcptr, rep_bytes); - srcptr += stride; - dstptr += stride; - } - } - - break; - } /* end 64 bpp */ - - default: /* png_ptr->row_info.pixel_depth != 1,2,4,8,16,24,32,48,64 */ - { - /* this should never happen */ - png_warning(png_ptr, "Invalid row_info.pixel_depth in pnggccrd"); - break; - } - } /* end switch (png_ptr->row_info.pixel_depth) */ - - } /* end if (non-trivial mask) */ - -} /* end png_combine_row() */ - -#endif /* PNG_HAVE_MMX_COMBINE_ROW */ - - - - -/*===========================================================================*/ -/* */ -/* P N G _ D O _ R E A D _ I N T E R L A C E */ -/* */ -/*===========================================================================*/ - -#if defined(PNG_READ_INTERLACING_SUPPORTED) -#if defined(PNG_HAVE_MMX_READ_INTERLACE) - -/* png_do_read_interlace() is called after any 16-bit to 8-bit conversion - * has taken place. [GRR: what other steps come before and/or after?] - */ - -void /* PRIVATE */ -png_do_read_interlace(png_structp png_ptr) -{ - png_row_infop row_info = &(png_ptr->row_info); - png_bytep row = png_ptr->row_buf + 1; - int pass = png_ptr->pass; -#if defined(PNG_READ_PACKSWAP_SUPPORTED) - png_uint_32 transformations = png_ptr->transformations; -#endif - - png_debug(1, "in png_do_read_interlace (pnggccrd.c)\n"); - -#if defined(PNG_MMX_CODE_SUPPORTED) - if (_mmx_supported == 2) { -#if !defined(PNG_1_0_X) - /* this should have happened in png_init_mmx_flags() already */ - png_warning(png_ptr, "asm_flags may not have been initialized"); -#endif - png_mmx_support(); - } -#endif - - if (row != NULL && row_info != NULL) - { - png_uint_32 final_width; - - final_width = row_info->width * png_pass_inc[pass]; - - switch (row_info->pixel_depth) - { - case 1: - { - png_bytep sp, dp; - int sshift, dshift; - int s_start, s_end, s_inc; - png_byte v; - png_uint_32 i; - int j; - - sp = row + (png_size_t)((row_info->width - 1) >> 3); - dp = row + (png_size_t)((final_width - 1) >> 3); -#if defined(PNG_READ_PACKSWAP_SUPPORTED) - if (transformations & PNG_PACKSWAP) - { - sshift = (int)((row_info->width + 7) & 7); - dshift = (int)((final_width + 7) & 7); - s_start = 7; - s_end = 0; - s_inc = -1; - } - else -#endif - { - sshift = 7 - (int)((row_info->width + 7) & 7); - dshift = 7 - (int)((final_width + 7) & 7); - s_start = 0; - s_end = 7; - s_inc = 1; - } - - for (i = row_info->width; i; i--) - { - v = (png_byte)((*sp >> sshift) & 0x1); - for (j = 0; j < png_pass_inc[pass]; j++) - { - *dp &= (png_byte)((0x7f7f >> (7 - dshift)) & 0xff); - *dp |= (png_byte)(v << dshift); - if (dshift == s_end) - { - dshift = s_start; - dp--; - } - else - dshift += s_inc; - } - if (sshift == s_end) - { - sshift = s_start; - sp--; - } - else - sshift += s_inc; - } - break; - } - - case 2: - { - png_bytep sp, dp; - int sshift, dshift; - int s_start, s_end, s_inc; - png_uint_32 i; - - sp = row + (png_size_t)((row_info->width - 1) >> 2); - dp = row + (png_size_t)((final_width - 1) >> 2); -#if defined(PNG_READ_PACKSWAP_SUPPORTED) - if (transformations & PNG_PACKSWAP) - { - sshift = (png_size_t)(((row_info->width + 3) & 3) << 1); - dshift = (png_size_t)(((final_width + 3) & 3) << 1); - s_start = 6; - s_end = 0; - s_inc = -2; - } - else -#endif - { - sshift = (png_size_t)((3 - ((row_info->width + 3) & 3)) << 1); - dshift = (png_size_t)((3 - ((final_width + 3) & 3)) << 1); - s_start = 0; - s_end = 6; - s_inc = 2; - } - - for (i = row_info->width; i; i--) - { - png_byte v; - int j; - - v = (png_byte)((*sp >> sshift) & 0x3); - for (j = 0; j < png_pass_inc[pass]; j++) - { - *dp &= (png_byte)((0x3f3f >> (6 - dshift)) & 0xff); - *dp |= (png_byte)(v << dshift); - if (dshift == s_end) - { - dshift = s_start; - dp--; - } - else - dshift += s_inc; - } - if (sshift == s_end) - { - sshift = s_start; - sp--; - } - else - sshift += s_inc; - } - break; - } - - case 4: - { - png_bytep sp, dp; - int sshift, dshift; - int s_start, s_end, s_inc; - png_uint_32 i; - - sp = row + (png_size_t)((row_info->width - 1) >> 1); - dp = row + (png_size_t)((final_width - 1) >> 1); -#if defined(PNG_READ_PACKSWAP_SUPPORTED) - if (transformations & PNG_PACKSWAP) - { - sshift = (png_size_t)(((row_info->width + 1) & 1) << 2); - dshift = (png_size_t)(((final_width + 1) & 1) << 2); - s_start = 4; - s_end = 0; - s_inc = -4; - } - else -#endif - { - sshift = (png_size_t)((1 - ((row_info->width + 1) & 1)) << 2); - dshift = (png_size_t)((1 - ((final_width + 1) & 1)) << 2); - s_start = 0; - s_end = 4; - s_inc = 4; - } - - for (i = row_info->width; i; i--) - { - png_byte v; - int j; - - v = (png_byte)((*sp >> sshift) & 0xf); - for (j = 0; j < png_pass_inc[pass]; j++) - { - *dp &= (png_byte)((0xf0f >> (4 - dshift)) & 0xff); - *dp |= (png_byte)(v << dshift); - if (dshift == s_end) - { - dshift = s_start; - dp--; - } - else - dshift += s_inc; - } - if (sshift == s_end) - { - sshift = s_start; - sp--; - } - else - sshift += s_inc; - } - break; - } - - /*====================================================================*/ - - default: /* 8-bit or larger (this is where the routine is modified) */ - { -#if 0 -// static unsigned long long _const4 = 0x0000000000FFFFFFLL; no good -// static unsigned long long const4 = 0x0000000000FFFFFFLL; no good -// unsigned long long _const4 = 0x0000000000FFFFFFLL; no good -// unsigned long long const4 = 0x0000000000FFFFFFLL; no good -#endif - png_bytep sptr, dp; - png_uint_32 i; - png_size_t pixel_bytes; - int width = (int)row_info->width; - - pixel_bytes = (row_info->pixel_depth >> 3); - - /* point sptr at the last pixel in the pre-expanded row: */ - sptr = row + (width - 1) * pixel_bytes; - - /* point dp at the last pixel position in the expanded row: */ - dp = row + (final_width - 1) * pixel_bytes; - - /* New code by Nirav Chhatrapati - Intel Corporation */ - -#if defined(PNG_MMX_CODE_SUPPORTED) -#if !defined(PNG_1_0_X) - if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_INTERLACE) - /* && _mmx_supported */ ) -#else - if (_mmx_supported) -#endif - { - //-------------------------------------------------------------- - if (pixel_bytes == 3) - { - if (((pass == 0) || (pass == 1)) && width) - { - int dummy_value_c; // fix 'forbidden register spilled' - int dummy_value_S; - int dummy_value_D; - int dummy_value_a; - - __asm__ __volatile__ ( - "subl $21, %%edi \n\t" - // (png_pass_inc[pass] - 1)*pixel_bytes - - ".loop3_pass0: \n\t" - "movd (%%esi), %%mm0 \n\t" // x x x x x 2 1 0 - "pand (%3), %%mm0 \n\t" // z z z z z 2 1 0 - "movq %%mm0, %%mm1 \n\t" // z z z z z 2 1 0 - "psllq $16, %%mm0 \n\t" // z z z 2 1 0 z z - "movq %%mm0, %%mm2 \n\t" // z z z 2 1 0 z z - "psllq $24, %%mm0 \n\t" // 2 1 0 z z z z z - "psrlq $8, %%mm1 \n\t" // z z z z z z 2 1 - "por %%mm2, %%mm0 \n\t" // 2 1 0 2 1 0 z z - "por %%mm1, %%mm0 \n\t" // 2 1 0 2 1 0 2 1 - "movq %%mm0, %%mm3 \n\t" // 2 1 0 2 1 0 2 1 - "psllq $16, %%mm0 \n\t" // 0 2 1 0 2 1 z z - "movq %%mm3, %%mm4 \n\t" // 2 1 0 2 1 0 2 1 - "punpckhdq %%mm0, %%mm3 \n\t" // 0 2 1 0 2 1 0 2 - "movq %%mm4, 16(%%edi) \n\t" - "psrlq $32, %%mm0 \n\t" // z z z z 0 2 1 0 - "movq %%mm3, 8(%%edi) \n\t" - "punpckldq %%mm4, %%mm0 \n\t" // 1 0 2 1 0 2 1 0 - "subl $3, %%esi \n\t" - "movq %%mm0, (%%edi) \n\t" - "subl $24, %%edi \n\t" - "decl %%ecx \n\t" - "jnz .loop3_pass0 \n\t" - "EMMS \n\t" // DONE - - : "=c" (dummy_value_c), // output regs (dummy) - "=S" (dummy_value_S), - "=D" (dummy_value_D), - "=a" (dummy_value_a) - - - : "1" (sptr), // esi // input regs - "2" (dp), // edi - "0" (width), // ecx - "3" (&_const4) // %1(?) (0x0000000000FFFFFFLL) - -#if 0 /* %mm0, ..., %mm4 not supported by gcc 2.7.2.3 or egcs 1.1 */ - : "%mm0", "%mm1", "%mm2" // clobber list - , "%mm3", "%mm4" -#endif - ); - } - else if (((pass == 2) || (pass == 3)) && width) - { - int dummy_value_c; // fix 'forbidden register spilled' - int dummy_value_S; - int dummy_value_D; - int dummy_value_a; - - __asm__ __volatile__ ( - "subl $9, %%edi \n\t" - // (png_pass_inc[pass] - 1)*pixel_bytes - - ".loop3_pass2: \n\t" - "movd (%%esi), %%mm0 \n\t" // x x x x x 2 1 0 - "pand (%3), %%mm0 \n\t" // z z z z z 2 1 0 - "movq %%mm0, %%mm1 \n\t" // z z z z z 2 1 0 - "psllq $16, %%mm0 \n\t" // z z z 2 1 0 z z - "movq %%mm0, %%mm2 \n\t" // z z z 2 1 0 z z - "psllq $24, %%mm0 \n\t" // 2 1 0 z z z z z - "psrlq $8, %%mm1 \n\t" // z z z z z z 2 1 - "por %%mm2, %%mm0 \n\t" // 2 1 0 2 1 0 z z - "por %%mm1, %%mm0 \n\t" // 2 1 0 2 1 0 2 1 - "movq %%mm0, 4(%%edi) \n\t" - "psrlq $16, %%mm0 \n\t" // z z 2 1 0 2 1 0 - "subl $3, %%esi \n\t" - "movd %%mm0, (%%edi) \n\t" - "subl $12, %%edi \n\t" - "decl %%ecx \n\t" - "jnz .loop3_pass2 \n\t" - "EMMS \n\t" // DONE - - : "=c" (dummy_value_c), // output regs (dummy) - "=S" (dummy_value_S), - "=D" (dummy_value_D), - "=a" (dummy_value_a) - - : "1" (sptr), // esi // input regs - "2" (dp), // edi - "0" (width), // ecx - "3" (&_const4) // (0x0000000000FFFFFFLL) - -#if 0 /* %mm0, ..., %mm2 not supported by gcc 2.7.2.3 or egcs 1.1 */ - : "%mm0", "%mm1", "%mm2" // clobber list -#endif - ); - } - else if (width) /* && ((pass == 4) || (pass == 5)) */ - { - int width_mmx = ((width >> 1) << 1) - 8; // GRR: huh? - if (width_mmx < 0) - width_mmx = 0; - width -= width_mmx; // 8 or 9 pix, 24 or 27 bytes - if (width_mmx) - { - // png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; - // sptr points at last pixel in pre-expanded row - // dp points at last pixel position in expanded row - int dummy_value_c; // fix 'forbidden register spilled' - int dummy_value_S; - int dummy_value_D; - int dummy_value_a; - int dummy_value_d; - - __asm__ __volatile__ ( - "subl $3, %%esi \n\t" - "subl $9, %%edi \n\t" - // (png_pass_inc[pass] + 1)*pixel_bytes - - ".loop3_pass4: \n\t" - "movq (%%esi), %%mm0 \n\t" // x x 5 4 3 2 1 0 - "movq %%mm0, %%mm1 \n\t" // x x 5 4 3 2 1 0 - "movq %%mm0, %%mm2 \n\t" // x x 5 4 3 2 1 0 - "psllq $24, %%mm0 \n\t" // 4 3 2 1 0 z z z - "pand (%3), %%mm1 \n\t" // z z z z z 2 1 0 - "psrlq $24, %%mm2 \n\t" // z z z x x 5 4 3 - "por %%mm1, %%mm0 \n\t" // 4 3 2 1 0 2 1 0 - "movq %%mm2, %%mm3 \n\t" // z z z x x 5 4 3 - "psllq $8, %%mm2 \n\t" // z z x x 5 4 3 z - "movq %%mm0, (%%edi) \n\t" - "psrlq $16, %%mm3 \n\t" // z z z z z x x 5 - "pand (%4), %%mm3 \n\t" // z z z z z z z 5 - "por %%mm3, %%mm2 \n\t" // z z x x 5 4 3 5 - "subl $6, %%esi \n\t" - "movd %%mm2, 8(%%edi) \n\t" - "subl $12, %%edi \n\t" - "subl $2, %%ecx \n\t" - "jnz .loop3_pass4 \n\t" - "EMMS \n\t" // DONE - - : "=c" (dummy_value_c), // output regs (dummy) - "=S" (dummy_value_S), - "=D" (dummy_value_D), - "=a" (dummy_value_a), - "=d" (dummy_value_d) - - : "1" (sptr), // esi // input regs - "2" (dp), // edi - "0" (width_mmx), // ecx - "3" (&_const4), // 0x0000000000FFFFFFLL - "4" (&_const6) // 0x00000000000000FFLL - -#if 0 /* %mm0, ..., %mm3 not supported by gcc 2.7.2.3 or egcs 1.1 */ - : "%mm0", "%mm1" // clobber list - , "%mm2", "%mm3" -#endif - ); - } - - sptr -= width_mmx*3; - dp -= width_mmx*6; - for (i = width; i; i--) - { - png_byte v[8]; - int j; - - png_memcpy(v, sptr, 3); - for (j = 0; j < png_pass_inc[pass]; j++) - { - png_memcpy(dp, v, 3); - dp -= 3; - } - sptr -= 3; - } - } - } /* end of pixel_bytes == 3 */ - - //-------------------------------------------------------------- - else if (pixel_bytes == 1) - { - if (((pass == 0) || (pass == 1)) && width) - { - int width_mmx = ((width >> 2) << 2); - width -= width_mmx; // 0-3 pixels => 0-3 bytes - if (width_mmx) - { - int dummy_value_c; // fix 'forbidden register spilled' - int dummy_value_S; - int dummy_value_D; - - __asm__ __volatile__ ( - "subl $3, %%esi \n\t" - "subl $31, %%edi \n\t" - - ".loop1_pass0: \n\t" - "movd (%%esi), %%mm0 \n\t" // x x x x 3 2 1 0 - "movq %%mm0, %%mm1 \n\t" // x x x x 3 2 1 0 - "punpcklbw %%mm0, %%mm0 \n\t" // 3 3 2 2 1 1 0 0 - "movq %%mm0, %%mm2 \n\t" // 3 3 2 2 1 1 0 0 - "punpcklwd %%mm0, %%mm0 \n\t" // 1 1 1 1 0 0 0 0 - "movq %%mm0, %%mm3 \n\t" // 1 1 1 1 0 0 0 0 - "punpckldq %%mm0, %%mm0 \n\t" // 0 0 0 0 0 0 0 0 - "punpckhdq %%mm3, %%mm3 \n\t" // 1 1 1 1 1 1 1 1 - "movq %%mm0, (%%edi) \n\t" - "punpckhwd %%mm2, %%mm2 \n\t" // 3 3 3 3 2 2 2 2 - "movq %%mm3, 8(%%edi) \n\t" - "movq %%mm2, %%mm4 \n\t" // 3 3 3 3 2 2 2 2 - "punpckldq %%mm2, %%mm2 \n\t" // 2 2 2 2 2 2 2 2 - "punpckhdq %%mm4, %%mm4 \n\t" // 3 3 3 3 3 3 3 3 - "movq %%mm2, 16(%%edi) \n\t" - "subl $4, %%esi \n\t" - "movq %%mm4, 24(%%edi) \n\t" - "subl $32, %%edi \n\t" - "subl $4, %%ecx \n\t" - "jnz .loop1_pass0 \n\t" - "EMMS \n\t" // DONE - - : "=c" (dummy_value_c), // output regs (dummy) - "=S" (dummy_value_S), - "=D" (dummy_value_D) - - : "1" (sptr), // esi // input regs - "2" (dp), // edi - "0" (width_mmx) // ecx - -#if 0 /* %mm0, ..., %mm4 not supported by gcc 2.7.2.3 or egcs 1.1 */ - : "%mm0", "%mm1", "%mm2" // clobber list - , "%mm3", "%mm4" -#endif - ); - } - - sptr -= width_mmx; - dp -= width_mmx*8; - for (i = width; i; i--) - { - int j; - - /* I simplified this part in version 1.0.4e - * here and in several other instances where - * pixel_bytes == 1 -- GR-P - * - * Original code: - * - * png_byte v[8]; - * png_memcpy(v, sptr, pixel_bytes); - * for (j = 0; j < png_pass_inc[pass]; j++) - * { - * png_memcpy(dp, v, pixel_bytes); - * dp -= pixel_bytes; - * } - * sptr -= pixel_bytes; - * - * Replacement code is in the next three lines: - */ - - for (j = 0; j < png_pass_inc[pass]; j++) - { - *dp-- = *sptr; - } - --sptr; - } - } - else if (((pass == 2) || (pass == 3)) && width) - { - int width_mmx = ((width >> 2) << 2); - width -= width_mmx; // 0-3 pixels => 0-3 bytes - if (width_mmx) - { - int dummy_value_c; // fix 'forbidden register spilled' - int dummy_value_S; - int dummy_value_D; - - __asm__ __volatile__ ( - "subl $3, %%esi \n\t" - "subl $15, %%edi \n\t" - - ".loop1_pass2: \n\t" - "movd (%%esi), %%mm0 \n\t" // x x x x 3 2 1 0 - "punpcklbw %%mm0, %%mm0 \n\t" // 3 3 2 2 1 1 0 0 - "movq %%mm0, %%mm1 \n\t" // 3 3 2 2 1 1 0 0 - "punpcklwd %%mm0, %%mm0 \n\t" // 1 1 1 1 0 0 0 0 - "punpckhwd %%mm1, %%mm1 \n\t" // 3 3 3 3 2 2 2 2 - "movq %%mm0, (%%edi) \n\t" - "subl $4, %%esi \n\t" - "movq %%mm1, 8(%%edi) \n\t" - "subl $16, %%edi \n\t" - "subl $4, %%ecx \n\t" - "jnz .loop1_pass2 \n\t" - "EMMS \n\t" // DONE - - : "=c" (dummy_value_c), // output regs (dummy) - "=S" (dummy_value_S), - "=D" (dummy_value_D) - - : "1" (sptr), // esi // input regs - "2" (dp), // edi - "0" (width_mmx) // ecx - -#if 0 /* %mm0, %mm1 not supported by gcc 2.7.2.3 or egcs 1.1 */ - : "%mm0", "%mm1" // clobber list -#endif - ); - } - - sptr -= width_mmx; - dp -= width_mmx*4; - for (i = width; i; i--) - { - int j; - - for (j = 0; j < png_pass_inc[pass]; j++) - { - *dp-- = *sptr; - } - --sptr; - } - } - else if (width) /* && ((pass == 4) || (pass == 5)) */ - { - int width_mmx = ((width >> 3) << 3); - width -= width_mmx; // 0-3 pixels => 0-3 bytes - if (width_mmx) - { - int dummy_value_c; // fix 'forbidden register spilled' - int dummy_value_S; - int dummy_value_D; - - __asm__ __volatile__ ( - "subl $7, %%esi \n\t" - "subl $15, %%edi \n\t" - - ".loop1_pass4: \n\t" - "movq (%%esi), %%mm0 \n\t" // 7 6 5 4 3 2 1 0 - "movq %%mm0, %%mm1 \n\t" // 7 6 5 4 3 2 1 0 - "punpcklbw %%mm0, %%mm0 \n\t" // 3 3 2 2 1 1 0 0 - "punpckhbw %%mm1, %%mm1 \n\t" // 7 7 6 6 5 5 4 4 - "movq %%mm1, 8(%%edi) \n\t" - "subl $8, %%esi \n\t" - "movq %%mm0, (%%edi) \n\t" - "subl $16, %%edi \n\t" - "subl $8, %%ecx \n\t" - "jnz .loop1_pass4 \n\t" - "EMMS \n\t" // DONE - - : "=c" (dummy_value_c), // output regs (none) - "=S" (dummy_value_S), - "=D" (dummy_value_D) - - : "1" (sptr), // esi // input regs - "2" (dp), // edi - "0" (width_mmx) // ecx - -#if 0 /* %mm0, %mm1 not supported by gcc 2.7.2.3 or egcs 1.1 */ - : "%mm0", "%mm1" // clobber list -#endif - ); - } - - sptr -= width_mmx; - dp -= width_mmx*2; - for (i = width; i; i--) - { - int j; - - for (j = 0; j < png_pass_inc[pass]; j++) - { - *dp-- = *sptr; - } - --sptr; - } - } - } /* end of pixel_bytes == 1 */ - - //-------------------------------------------------------------- - else if (pixel_bytes == 2) - { - if (((pass == 0) || (pass == 1)) && width) - { - int width_mmx = ((width >> 1) << 1); - width -= width_mmx; // 0,1 pixels => 0,2 bytes - if (width_mmx) - { - int dummy_value_c; // fix 'forbidden register spilled' - int dummy_value_S; - int dummy_value_D; - - __asm__ __volatile__ ( - "subl $2, %%esi \n\t" - "subl $30, %%edi \n\t" - - ".loop2_pass0: \n\t" - "movd (%%esi), %%mm0 \n\t" // x x x x 3 2 1 0 - "punpcklwd %%mm0, %%mm0 \n\t" // 3 2 3 2 1 0 1 0 - "movq %%mm0, %%mm1 \n\t" // 3 2 3 2 1 0 1 0 - "punpckldq %%mm0, %%mm0 \n\t" // 1 0 1 0 1 0 1 0 - "punpckhdq %%mm1, %%mm1 \n\t" // 3 2 3 2 3 2 3 2 - "movq %%mm0, (%%edi) \n\t" - "movq %%mm0, 8(%%edi) \n\t" - "movq %%mm1, 16(%%edi) \n\t" - "subl $4, %%esi \n\t" - "movq %%mm1, 24(%%edi) \n\t" - "subl $32, %%edi \n\t" - "subl $2, %%ecx \n\t" - "jnz .loop2_pass0 \n\t" - "EMMS \n\t" // DONE - - : "=c" (dummy_value_c), // output regs (dummy) - "=S" (dummy_value_S), - "=D" (dummy_value_D) - - : "1" (sptr), // esi // input regs - "2" (dp), // edi - "0" (width_mmx) // ecx - -#if 0 /* %mm0, %mm1 not supported by gcc 2.7.2.3 or egcs 1.1 */ - : "%mm0", "%mm1" // clobber list -#endif - ); - } - - sptr -= (width_mmx*2 - 2); // sign fixed - dp -= (width_mmx*16 - 2); // sign fixed - for (i = width; i; i--) - { - png_byte v[8]; - int j; - sptr -= 2; - png_memcpy(v, sptr, 2); - for (j = 0; j < png_pass_inc[pass]; j++) - { - dp -= 2; - png_memcpy(dp, v, 2); - } - } - } - else if (((pass == 2) || (pass == 3)) && width) - { - int width_mmx = ((width >> 1) << 1) ; - width -= width_mmx; // 0,1 pixels => 0,2 bytes - if (width_mmx) - { - int dummy_value_c; // fix 'forbidden register spilled' - int dummy_value_S; - int dummy_value_D; - - __asm__ __volatile__ ( - "subl $2, %%esi \n\t" - "subl $14, %%edi \n\t" - - ".loop2_pass2: \n\t" - "movd (%%esi), %%mm0 \n\t" // x x x x 3 2 1 0 - "punpcklwd %%mm0, %%mm0 \n\t" // 3 2 3 2 1 0 1 0 - "movq %%mm0, %%mm1 \n\t" // 3 2 3 2 1 0 1 0 - "punpckldq %%mm0, %%mm0 \n\t" // 1 0 1 0 1 0 1 0 - "punpckhdq %%mm1, %%mm1 \n\t" // 3 2 3 2 3 2 3 2 - "movq %%mm0, (%%edi) \n\t" - "subl $4, %%esi \n\t" - "movq %%mm1, 8(%%edi) \n\t" - "subl $16, %%edi \n\t" - "subl $2, %%ecx \n\t" - "jnz .loop2_pass2 \n\t" - "EMMS \n\t" // DONE - - : "=c" (dummy_value_c), // output regs (dummy) - "=S" (dummy_value_S), - "=D" (dummy_value_D) - - : "1" (sptr), // esi // input regs - "2" (dp), // edi - "0" (width_mmx) // ecx - -#if 0 /* %mm0, %mm1 not supported by gcc 2.7.2.3 or egcs 1.1 */ - : "%mm0", "%mm1" // clobber list -#endif - ); - } - - sptr -= (width_mmx*2 - 2); // sign fixed - dp -= (width_mmx*8 - 2); // sign fixed - for (i = width; i; i--) - { - png_byte v[8]; - int j; - sptr -= 2; - png_memcpy(v, sptr, 2); - for (j = 0; j < png_pass_inc[pass]; j++) - { - dp -= 2; - png_memcpy(dp, v, 2); - } - } - } - else if (width) // pass == 4 or 5 - { - int width_mmx = ((width >> 1) << 1) ; - width -= width_mmx; // 0,1 pixels => 0,2 bytes - if (width_mmx) - { - int dummy_value_c; // fix 'forbidden register spilled' - int dummy_value_S; - int dummy_value_D; - - __asm__ __volatile__ ( - "subl $2, %%esi \n\t" - "subl $6, %%edi \n\t" - - ".loop2_pass4: \n\t" - "movd (%%esi), %%mm0 \n\t" // x x x x 3 2 1 0 - "punpcklwd %%mm0, %%mm0 \n\t" // 3 2 3 2 1 0 1 0 - "subl $4, %%esi \n\t" - "movq %%mm0, (%%edi) \n\t" - "subl $8, %%edi \n\t" - "subl $2, %%ecx \n\t" - "jnz .loop2_pass4 \n\t" - "EMMS \n\t" // DONE - - : "=c" (dummy_value_c), // output regs (dummy) - "=S" (dummy_value_S), - "=D" (dummy_value_D) - - : "1" (sptr), // esi // input regs - "2" (dp), // edi - "0" (width_mmx) // ecx - -#if 0 /* %mm0 not supported by gcc 2.7.2.3 or egcs 1.1 */ - : "%mm0" // clobber list -#endif - ); - } - - sptr -= (width_mmx*2 - 2); // sign fixed - dp -= (width_mmx*4 - 2); // sign fixed - for (i = width; i; i--) - { - png_byte v[8]; - int j; - sptr -= 2; - png_memcpy(v, sptr, 2); - for (j = 0; j < png_pass_inc[pass]; j++) - { - dp -= 2; - png_memcpy(dp, v, 2); - } - } - } - } /* end of pixel_bytes == 2 */ - - //-------------------------------------------------------------- - else if (pixel_bytes == 4) - { - if (((pass == 0) || (pass == 1)) && width) - { - int width_mmx = ((width >> 1) << 1); - width -= width_mmx; // 0,1 pixels => 0,4 bytes - if (width_mmx) - { - int dummy_value_c; // fix 'forbidden register spilled' - int dummy_value_S; - int dummy_value_D; - - __asm__ __volatile__ ( - "subl $4, %%esi \n\t" - "subl $60, %%edi \n\t" - - ".loop4_pass0: \n\t" - "movq (%%esi), %%mm0 \n\t" // 7 6 5 4 3 2 1 0 - "movq %%mm0, %%mm1 \n\t" // 7 6 5 4 3 2 1 0 - "punpckldq %%mm0, %%mm0 \n\t" // 3 2 1 0 3 2 1 0 - "punpckhdq %%mm1, %%mm1 \n\t" // 7 6 5 4 7 6 5 4 - "movq %%mm0, (%%edi) \n\t" - "movq %%mm0, 8(%%edi) \n\t" - "movq %%mm0, 16(%%edi) \n\t" - "movq %%mm0, 24(%%edi) \n\t" - "movq %%mm1, 32(%%edi) \n\t" - "movq %%mm1, 40(%%edi) \n\t" - "movq %%mm1, 48(%%edi) \n\t" - "subl $8, %%esi \n\t" - "movq %%mm1, 56(%%edi) \n\t" - "subl $64, %%edi \n\t" - "subl $2, %%ecx \n\t" - "jnz .loop4_pass0 \n\t" - "EMMS \n\t" // DONE - - : "=c" (dummy_value_c), // output regs (dummy) - "=S" (dummy_value_S), - "=D" (dummy_value_D) - - : "1" (sptr), // esi // input regs - "2" (dp), // edi - "0" (width_mmx) // ecx - -#if 0 /* %mm0, %mm1 not supported by gcc 2.7.2.3 or egcs 1.1 */ - : "%mm0", "%mm1" // clobber list -#endif - ); - } - - sptr -= (width_mmx*4 - 4); // sign fixed - dp -= (width_mmx*32 - 4); // sign fixed - for (i = width; i; i--) - { - png_byte v[8]; - int j; - sptr -= 4; - png_memcpy(v, sptr, 4); - for (j = 0; j < png_pass_inc[pass]; j++) - { - dp -= 4; - png_memcpy(dp, v, 4); - } - } - } - else if (((pass == 2) || (pass == 3)) && width) - { - int width_mmx = ((width >> 1) << 1); - width -= width_mmx; // 0,1 pixels => 0,4 bytes - if (width_mmx) - { - int dummy_value_c; // fix 'forbidden register spilled' - int dummy_value_S; - int dummy_value_D; - - __asm__ __volatile__ ( - "subl $4, %%esi \n\t" - "subl $28, %%edi \n\t" - - ".loop4_pass2: \n\t" - "movq (%%esi), %%mm0 \n\t" // 7 6 5 4 3 2 1 0 - "movq %%mm0, %%mm1 \n\t" // 7 6 5 4 3 2 1 0 - "punpckldq %%mm0, %%mm0 \n\t" // 3 2 1 0 3 2 1 0 - "punpckhdq %%mm1, %%mm1 \n\t" // 7 6 5 4 7 6 5 4 - "movq %%mm0, (%%edi) \n\t" - "movq %%mm0, 8(%%edi) \n\t" - "movq %%mm1, 16(%%edi) \n\t" - "movq %%mm1, 24(%%edi) \n\t" - "subl $8, %%esi \n\t" - "subl $32, %%edi \n\t" - "subl $2, %%ecx \n\t" - "jnz .loop4_pass2 \n\t" - "EMMS \n\t" // DONE - - : "=c" (dummy_value_c), // output regs (dummy) - "=S" (dummy_value_S), - "=D" (dummy_value_D) - - : "1" (sptr), // esi // input regs - "2" (dp), // edi - "0" (width_mmx) // ecx - -#if 0 /* %mm0, %mm1 not supported by gcc 2.7.2.3 or egcs 1.1 */ - : "%mm0", "%mm1" // clobber list -#endif - ); - } - - sptr -= (width_mmx*4 - 4); // sign fixed - dp -= (width_mmx*16 - 4); // sign fixed - for (i = width; i; i--) - { - png_byte v[8]; - int j; - sptr -= 4; - png_memcpy(v, sptr, 4); - for (j = 0; j < png_pass_inc[pass]; j++) - { - dp -= 4; - png_memcpy(dp, v, 4); - } - } - } - else if (width) // pass == 4 or 5 - { - int width_mmx = ((width >> 1) << 1) ; - width -= width_mmx; // 0,1 pixels => 0,4 bytes - if (width_mmx) - { - int dummy_value_c; // fix 'forbidden register spilled' - int dummy_value_S; - int dummy_value_D; - - __asm__ __volatile__ ( - "subl $4, %%esi \n\t" - "subl $12, %%edi \n\t" - - ".loop4_pass4: \n\t" - "movq (%%esi), %%mm0 \n\t" // 7 6 5 4 3 2 1 0 - "movq %%mm0, %%mm1 \n\t" // 7 6 5 4 3 2 1 0 - "punpckldq %%mm0, %%mm0 \n\t" // 3 2 1 0 3 2 1 0 - "punpckhdq %%mm1, %%mm1 \n\t" // 7 6 5 4 7 6 5 4 - "movq %%mm0, (%%edi) \n\t" - "subl $8, %%esi \n\t" - "movq %%mm1, 8(%%edi) \n\t" - "subl $16, %%edi \n\t" - "subl $2, %%ecx \n\t" - "jnz .loop4_pass4 \n\t" - "EMMS \n\t" // DONE - - : "=c" (dummy_value_c), // output regs (dummy) - "=S" (dummy_value_S), - "=D" (dummy_value_D) - - : "1" (sptr), // esi // input regs - "2" (dp), // edi - "0" (width_mmx) // ecx - -#if 0 /* %mm0, %mm1 not supported by gcc 2.7.2.3 or egcs 1.1 */ - : "%mm0", "%mm1" // clobber list -#endif - ); - } - - sptr -= (width_mmx*4 - 4); // sign fixed - dp -= (width_mmx*8 - 4); // sign fixed - for (i = width; i; i--) - { - png_byte v[8]; - int j; - sptr -= 4; - png_memcpy(v, sptr, 4); - for (j = 0; j < png_pass_inc[pass]; j++) - { - dp -= 4; - png_memcpy(dp, v, 4); - } - } - } - } /* end of pixel_bytes == 4 */ - - //-------------------------------------------------------------- - else if (pixel_bytes == 8) - { -// GRR TEST: should work, but needs testing (special 64-bit version of rpng2?) - // GRR NOTE: no need to combine passes here! - if (((pass == 0) || (pass == 1)) && width) - { - int dummy_value_c; // fix 'forbidden register spilled' - int dummy_value_S; - int dummy_value_D; - - // source is 8-byte RRGGBBAA - // dest is 64-byte RRGGBBAA RRGGBBAA RRGGBBAA RRGGBBAA ... - __asm__ __volatile__ ( - "subl $56, %%edi \n\t" // start of last block - - ".loop8_pass0: \n\t" - "movq (%%esi), %%mm0 \n\t" // 7 6 5 4 3 2 1 0 - "movq %%mm0, (%%edi) \n\t" - "movq %%mm0, 8(%%edi) \n\t" - "movq %%mm0, 16(%%edi) \n\t" - "movq %%mm0, 24(%%edi) \n\t" - "movq %%mm0, 32(%%edi) \n\t" - "movq %%mm0, 40(%%edi) \n\t" - "movq %%mm0, 48(%%edi) \n\t" - "subl $8, %%esi \n\t" - "movq %%mm0, 56(%%edi) \n\t" - "subl $64, %%edi \n\t" - "decl %%ecx \n\t" - "jnz .loop8_pass0 \n\t" - "EMMS \n\t" // DONE - - : "=c" (dummy_value_c), // output regs (dummy) - "=S" (dummy_value_S), - "=D" (dummy_value_D) - - : "1" (sptr), // esi // input regs - "2" (dp), // edi - "0" (width) // ecx - -#if 0 /* %mm0 not supported by gcc 2.7.2.3 or egcs 1.1 */ - : "%mm0" // clobber list -#endif - ); - } - else if (((pass == 2) || (pass == 3)) && width) - { - // source is 8-byte RRGGBBAA - // dest is 32-byte RRGGBBAA RRGGBBAA RRGGBBAA RRGGBBAA - // (recall that expansion is _in place_: sptr and dp - // both point at locations within same row buffer) - { - int dummy_value_c; // fix 'forbidden register spilled' - int dummy_value_S; - int dummy_value_D; - - __asm__ __volatile__ ( - "subl $24, %%edi \n\t" // start of last block - - ".loop8_pass2: \n\t" - "movq (%%esi), %%mm0 \n\t" // 7 6 5 4 3 2 1 0 - "movq %%mm0, (%%edi) \n\t" - "movq %%mm0, 8(%%edi) \n\t" - "movq %%mm0, 16(%%edi) \n\t" - "subl $8, %%esi \n\t" - "movq %%mm0, 24(%%edi) \n\t" - "subl $32, %%edi \n\t" - "decl %%ecx \n\t" - "jnz .loop8_pass2 \n\t" - "EMMS \n\t" // DONE - - : "=c" (dummy_value_c), // output regs (dummy) - "=S" (dummy_value_S), - "=D" (dummy_value_D) - - : "1" (sptr), // esi // input regs - "2" (dp), // edi - "0" (width) // ecx - -#if 0 /* %mm0 not supported by gcc 2.7.2.3 or egcs 1.1 */ - : "%mm0" // clobber list -#endif - ); - } - } - else if (width) // pass == 4 or 5 - { - // source is 8-byte RRGGBBAA - // dest is 16-byte RRGGBBAA RRGGBBAA - { - int dummy_value_c; // fix 'forbidden register spilled' - int dummy_value_S; - int dummy_value_D; - - __asm__ __volatile__ ( - "subl $8, %%edi \n\t" // start of last block - - ".loop8_pass4: \n\t" - "movq (%%esi), %%mm0 \n\t" // 7 6 5 4 3 2 1 0 - "movq %%mm0, (%%edi) \n\t" - "subl $8, %%esi \n\t" - "movq %%mm0, 8(%%edi) \n\t" - "subl $16, %%edi \n\t" - "decl %%ecx \n\t" - "jnz .loop8_pass4 \n\t" - "EMMS \n\t" // DONE - - : "=c" (dummy_value_c), // output regs (dummy) - "=S" (dummy_value_S), - "=D" (dummy_value_D) - - : "1" (sptr), // esi // input regs - "2" (dp), // edi - "0" (width) // ecx - -#if 0 /* %mm0 not supported by gcc 2.7.2.3 or egcs 1.1 */ - : "%mm0" // clobber list -#endif - ); - } - } - - } /* end of pixel_bytes == 8 */ - - //-------------------------------------------------------------- - else if (pixel_bytes == 6) - { - for (i = width; i; i--) - { - png_byte v[8]; - int j; - png_memcpy(v, sptr, 6); - for (j = 0; j < png_pass_inc[pass]; j++) - { - png_memcpy(dp, v, 6); - dp -= 6; - } - sptr -= 6; - } - } /* end of pixel_bytes == 6 */ - - //-------------------------------------------------------------- - else - { - for (i = width; i; i--) - { - png_byte v[8]; - int j; - png_memcpy(v, sptr, pixel_bytes); - for (j = 0; j < png_pass_inc[pass]; j++) - { - png_memcpy(dp, v, pixel_bytes); - dp -= pixel_bytes; - } - sptr-= pixel_bytes; - } - } - } // end of _mmx_supported ======================================== - - else /* MMX not supported: use modified C code - takes advantage - * of inlining of png_memcpy for a constant */ - /* GRR 19991007: does it? or should pixel_bytes in each - * block be replaced with immediate value (e.g., 1)? */ - /* GRR 19991017: replaced with constants in each case */ -#endif /* PNG_MMX_CODE_SUPPORTED */ - { - if (pixel_bytes == 1) - { - for (i = width; i; i--) - { - int j; - for (j = 0; j < png_pass_inc[pass]; j++) - { - *dp-- = *sptr; - } - --sptr; - } - } - else if (pixel_bytes == 3) - { - for (i = width; i; i--) - { - png_byte v[8]; - int j; - png_memcpy(v, sptr, 3); - for (j = 0; j < png_pass_inc[pass]; j++) - { - png_memcpy(dp, v, 3); - dp -= 3; - } - sptr -= 3; - } - } - else if (pixel_bytes == 2) - { - for (i = width; i; i--) - { - png_byte v[8]; - int j; - png_memcpy(v, sptr, 2); - for (j = 0; j < png_pass_inc[pass]; j++) - { - png_memcpy(dp, v, 2); - dp -= 2; - } - sptr -= 2; - } - } - else if (pixel_bytes == 4) - { - for (i = width; i; i--) - { - png_byte v[8]; - int j; - png_memcpy(v, sptr, 4); - for (j = 0; j < png_pass_inc[pass]; j++) - { -#ifdef PNG_DEBUG - if (dp < row || dp+3 > row+png_ptr->row_buf_size) - { - printf("dp out of bounds: row=%d, dp=%d, rp=%d\n", - row, dp, row+png_ptr->row_buf_size); - printf("row_buf=%d\n",png_ptr->row_buf_size); - } -#endif - png_memcpy(dp, v, 4); - dp -= 4; - } - sptr -= 4; - } - } - else if (pixel_bytes == 6) - { - for (i = width; i; i--) - { - png_byte v[8]; - int j; - png_memcpy(v, sptr, 6); - for (j = 0; j < png_pass_inc[pass]; j++) - { - png_memcpy(dp, v, 6); - dp -= 6; - } - sptr -= 6; - } - } - else if (pixel_bytes == 8) - { - for (i = width; i; i--) - { - png_byte v[8]; - int j; - png_memcpy(v, sptr, 8); - for (j = 0; j < png_pass_inc[pass]; j++) - { - png_memcpy(dp, v, 8); - dp -= 8; - } - sptr -= 8; - } - } - else /* GRR: should never be reached */ - { - for (i = width; i; i--) - { - png_byte v[8]; - int j; - png_memcpy(v, sptr, pixel_bytes); - for (j = 0; j < png_pass_inc[pass]; j++) - { - png_memcpy(dp, v, pixel_bytes); - dp -= pixel_bytes; - } - sptr -= pixel_bytes; - } - } - - } /* end if (MMX not supported) */ - break; - } - } /* end switch (row_info->pixel_depth) */ - - row_info->width = final_width; - - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,final_width); - } - -} /* end png_do_read_interlace() */ - -#endif /* PNG_HAVE_MMX_READ_INTERLACE */ -#endif /* PNG_READ_INTERLACING_SUPPORTED */ - - - -#if defined(PNG_HAVE_MMX_READ_FILTER_ROW) -#if defined(PNG_MMX_CODE_SUPPORTED) - -// These variables are utilized in the functions below. They are declared -// globally here to ensure alignment on 8-byte boundaries. - -union uAll { - long long use; - double align; -} _LBCarryMask = {0x0101010101010101LL}, - _HBClearMask = {0x7f7f7f7f7f7f7f7fLL}, - _ActiveMask, _ActiveMask2, _ActiveMaskEnd, _ShiftBpp, _ShiftRem; - -#ifdef PNG_THREAD_UNSAFE_OK -//===========================================================================// -// // -// P N G _ R E A D _ F I L T E R _ R O W _ M M X _ A V G // -// // -//===========================================================================// - -// Optimized code for PNG Average filter decoder - -static void /* PRIVATE */ -png_read_filter_row_mmx_avg(png_row_infop row_info, png_bytep row, - png_bytep prev_row) -{ - int bpp; - int dummy_value_c; // fix 'forbidden register 2 (cx) was spilled' error - int dummy_value_S; - int dummy_value_D; - - bpp = (row_info->pixel_depth + 7) >> 3; // get # bytes per pixel - _FullLength = row_info->rowbytes; // # of bytes to filter - - __asm__ __volatile__ ( - // initialize address pointers and offset -#ifdef __PIC__ - "pushl %%ebx \n\t" // save index to Global Offset Table -#endif -//pre "movl row, %%edi \n\t" // edi: Avg(x) - "xorl %%ebx, %%ebx \n\t" // ebx: x - "movl %%edi, %%edx \n\t" -//pre "movl prev_row, %%esi \n\t" // esi: Prior(x) -//pre "subl bpp, %%edx \n\t" // (bpp is preloaded into ecx) - "subl %%ecx, %%edx \n\t" // edx: Raw(x-bpp) - - "xorl %%eax,%%eax \n\t" - - // Compute the Raw value for the first bpp bytes - // Raw(x) = Avg(x) + (Prior(x)/2) - "avg_rlp: \n\t" - "movb (%%esi,%%ebx,),%%al \n\t" // load al with Prior(x) - "incl %%ebx \n\t" - "shrb %%al \n\t" // divide by 2 - "addb -1(%%edi,%%ebx,),%%al \n\t" // add Avg(x); -1 to offset inc ebx -//pre "cmpl bpp, %%ebx \n\t" // (bpp is preloaded into ecx) - "cmpl %%ecx, %%ebx \n\t" - "movb %%al,-1(%%edi,%%ebx,) \n\t" // write Raw(x); -1 to offset inc ebx - "jb avg_rlp \n\t" // mov does not affect flags - - // get # of bytes to alignment - "movl %%edi, _dif \n\t" // take start of row - "addl %%ebx, _dif \n\t" // add bpp - "addl $0xf, _dif \n\t" // add 7+8 to incr past alignment bdry - "andl $0xfffffff8, _dif \n\t" // mask to alignment boundary - "subl %%edi, _dif \n\t" // subtract from start => value ebx at - "jz avg_go \n\t" // alignment - - // fix alignment - // Compute the Raw value for the bytes up to the alignment boundary - // Raw(x) = Avg(x) + ((Raw(x-bpp) + Prior(x))/2) - "xorl %%ecx, %%ecx \n\t" - - "avg_lp1: \n\t" - "xorl %%eax, %%eax \n\t" - "movb (%%esi,%%ebx,), %%cl \n\t" // load cl with Prior(x) - "movb (%%edx,%%ebx,), %%al \n\t" // load al with Raw(x-bpp) - "addw %%cx, %%ax \n\t" - "incl %%ebx \n\t" - "shrw %%ax \n\t" // divide by 2 - "addb -1(%%edi,%%ebx,), %%al \n\t" // add Avg(x); -1 to offset inc ebx - "cmpl _dif, %%ebx \n\t" // check if at alignment boundary - "movb %%al, -1(%%edi,%%ebx,) \n\t" // write Raw(x); -1 to offset inc ebx - "jb avg_lp1 \n\t" // repeat until at alignment boundary - - "avg_go: \n\t" - "movl _FullLength, %%eax \n\t" - "movl %%eax, %%ecx \n\t" - "subl %%ebx, %%eax \n\t" // subtract alignment fix - "andl $0x00000007, %%eax \n\t" // calc bytes over mult of 8 - "subl %%eax, %%ecx \n\t" // drop over bytes from original length - "movl %%ecx, _MMXLength \n\t" -#ifdef __PIC__ - "popl %%ebx \n\t" // restore index to Global Offset Table -#endif - - : "=c" (dummy_value_c), // output regs (dummy) - "=S" (dummy_value_S), - "=D" (dummy_value_D) - - : "0" (bpp), // ecx // input regs - "1" (prev_row), // esi - "2" (row) // edi - - : "%eax", "%edx" // clobber list -#ifndef __PIC__ - , "%ebx" -#endif - // GRR: INCLUDE "memory" as clobbered? (_dif, _MMXLength) - // (seems to work fine without...) - ); - - // now do the math for the rest of the row - switch (bpp) - { - case 3: - { - _ActiveMask.use = 0x0000000000ffffffLL; - _ShiftBpp.use = 24; // == 3 * 8 - _ShiftRem.use = 40; // == 64 - 24 - - __asm__ __volatile__ ( - // re-init address pointers and offset - "movq _ActiveMask, %%mm7 \n\t" - "movl _dif, %%ecx \n\t" // ecx: x = offset to - "movq _LBCarryMask, %%mm5 \n\t" // alignment boundary -// preload "movl row, %%edi \n\t" // edi: Avg(x) - "movq _HBClearMask, %%mm4 \n\t" -// preload "movl prev_row, %%esi \n\t" // esi: Prior(x) - - // prime the pump: load the first Raw(x-bpp) data set - "movq -8(%%edi,%%ecx,), %%mm2 \n\t" // load previous aligned 8 bytes - // (correct pos. in loop below) - "avg_3lp: \n\t" - "movq (%%edi,%%ecx,), %%mm0 \n\t" // load mm0 with Avg(x) - "movq %%mm5, %%mm3 \n\t" - "psrlq _ShiftRem, %%mm2 \n\t" // correct position Raw(x-bpp) - // data - "movq (%%esi,%%ecx,), %%mm1 \n\t" // load mm1 with Prior(x) - "movq %%mm7, %%mm6 \n\t" - "pand %%mm1, %%mm3 \n\t" // get lsb for each prev_row byte - "psrlq $1, %%mm1 \n\t" // divide prev_row bytes by 2 - "pand %%mm4, %%mm1 \n\t" // clear invalid bit 7 of each - // byte - "paddb %%mm1, %%mm0 \n\t" // add (Prev_row/2) to Avg for - // each byte - // add 1st active group (Raw(x-bpp)/2) to average with LBCarry - "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting - // LBCarrys - "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte - // where both - // lsb's were == 1 (only valid for active group) - "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2 - "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each - // byte - "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2) - // for each byte - "pand %%mm6, %%mm2 \n\t" // leave only Active Group 1 - // bytes to add to Avg - "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to - // Avg for each Active - // byte - // add 2nd active group (Raw(x-bpp)/2) to average with _LBCarry - "psllq _ShiftBpp, %%mm6 \n\t" // shift the mm6 mask to cover - // bytes 3-5 - "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2 - "psllq _ShiftBpp, %%mm2 \n\t" // shift data to pos. correctly - "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting - // LBCarrys - "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte - // where both - // lsb's were == 1 (only valid for active group) - "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2 - "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each - // byte - "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2) - // for each byte - "pand %%mm6, %%mm2 \n\t" // leave only Active Group 2 - // bytes to add to Avg - "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to - // Avg for each Active - // byte - - // add 3rd active group (Raw(x-bpp)/2) to average with _LBCarry - "psllq _ShiftBpp, %%mm6 \n\t" // shift mm6 mask to cover last - // two - // bytes - "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2 - "psllq _ShiftBpp, %%mm2 \n\t" // shift data to pos. correctly - // Data only needs to be shifted once here to - // get the correct x-bpp offset. - "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting - // LBCarrys - "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte - // where both - // lsb's were == 1 (only valid for active group) - "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2 - "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each - // byte - "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2) - // for each byte - "pand %%mm6, %%mm2 \n\t" // leave only Active Group 2 - // bytes to add to Avg - "addl $8, %%ecx \n\t" - "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to - // Avg for each Active - // byte - // now ready to write back to memory - "movq %%mm0, -8(%%edi,%%ecx,) \n\t" - // move updated Raw(x) to use as Raw(x-bpp) for next loop - "cmpl _MMXLength, %%ecx \n\t" - "movq %%mm0, %%mm2 \n\t" // mov updated Raw(x) to mm2 - "jb avg_3lp \n\t" - - : "=S" (dummy_value_S), // output regs (dummy) - "=D" (dummy_value_D) - - : "0" (prev_row), // esi // input regs - "1" (row) // edi - - : "%ecx" // clobber list -#if 0 /* %mm0, ..., %mm7 not supported by gcc 2.7.2.3 or egcs 1.1 */ - , "%mm0", "%mm1", "%mm2", "%mm3" - , "%mm4", "%mm5", "%mm6", "%mm7" -#endif - ); - } - break; // end 3 bpp - - case 6: - case 4: - //case 7: // who wrote this? PNG doesn't support 5 or 7 bytes/pixel - //case 5: // GRR BOGUS - { - _ActiveMask.use = 0xffffffffffffffffLL; // use shift below to clear - // appropriate inactive bytes - _ShiftBpp.use = bpp << 3; - _ShiftRem.use = 64 - _ShiftBpp.use; - - __asm__ __volatile__ ( - "movq _HBClearMask, %%mm4 \n\t" - - // re-init address pointers and offset - "movl _dif, %%ecx \n\t" // ecx: x = offset to - // alignment boundary - - // load _ActiveMask and clear all bytes except for 1st active group - "movq _ActiveMask, %%mm7 \n\t" -// preload "movl row, %%edi \n\t" // edi: Avg(x) - "psrlq _ShiftRem, %%mm7 \n\t" -// preload "movl prev_row, %%esi \n\t" // esi: Prior(x) - "movq %%mm7, %%mm6 \n\t" - "movq _LBCarryMask, %%mm5 \n\t" - "psllq _ShiftBpp, %%mm6 \n\t" // create mask for 2nd active - // group - - // prime the pump: load the first Raw(x-bpp) data set - "movq -8(%%edi,%%ecx,), %%mm2 \n\t" // load previous aligned 8 bytes - // (we correct pos. in loop below) - "avg_4lp: \n\t" - "movq (%%edi,%%ecx,), %%mm0 \n\t" - "psrlq _ShiftRem, %%mm2 \n\t" // shift data to pos. correctly - "movq (%%esi,%%ecx,), %%mm1 \n\t" - // add (Prev_row/2) to average - "movq %%mm5, %%mm3 \n\t" - "pand %%mm1, %%mm3 \n\t" // get lsb for each prev_row byte - "psrlq $1, %%mm1 \n\t" // divide prev_row bytes by 2 - "pand %%mm4, %%mm1 \n\t" // clear invalid bit 7 of each - // byte - "paddb %%mm1, %%mm0 \n\t" // add (Prev_row/2) to Avg for - // each byte - // add 1st active group (Raw(x-bpp)/2) to average with _LBCarry - "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting - // LBCarrys - "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte - // where both - // lsb's were == 1 (only valid for active group) - "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2 - "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each - // byte - "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2) - // for each byte - "pand %%mm7, %%mm2 \n\t" // leave only Active Group 1 - // bytes to add to Avg - "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to Avg - // for each Active - // byte - // add 2nd active group (Raw(x-bpp)/2) to average with _LBCarry - "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2 - "psllq _ShiftBpp, %%mm2 \n\t" // shift data to pos. correctly - "addl $8, %%ecx \n\t" - "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting - // LBCarrys - "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte - // where both - // lsb's were == 1 (only valid for active group) - "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2 - "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each - // byte - "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2) - // for each byte - "pand %%mm6, %%mm2 \n\t" // leave only Active Group 2 - // bytes to add to Avg - "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to - // Avg for each Active - // byte - "cmpl _MMXLength, %%ecx \n\t" - // now ready to write back to memory - "movq %%mm0, -8(%%edi,%%ecx,) \n\t" - // prep Raw(x-bpp) for next loop - "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2 - "jb avg_4lp \n\t" - - : "=S" (dummy_value_S), // output regs (dummy) - "=D" (dummy_value_D) - - : "0" (prev_row), // esi // input regs - "1" (row) // edi - - : "%ecx" // clobber list -#if 0 /* %mm0, ..., %mm7 not supported by gcc 2.7.2.3 or egcs 1.1 */ - , "%mm0", "%mm1", "%mm2", "%mm3" - , "%mm4", "%mm5", "%mm6", "%mm7" -#endif - ); - } - break; // end 4,6 bpp - - case 2: - { - _ActiveMask.use = 0x000000000000ffffLL; - _ShiftBpp.use = 16; // == 2 * 8 - _ShiftRem.use = 48; // == 64 - 16 - - __asm__ __volatile__ ( - // load _ActiveMask - "movq _ActiveMask, %%mm7 \n\t" - // re-init address pointers and offset - "movl _dif, %%ecx \n\t" // ecx: x = offset to alignment - // boundary - "movq _LBCarryMask, %%mm5 \n\t" -// preload "movl row, %%edi \n\t" // edi: Avg(x) - "movq _HBClearMask, %%mm4 \n\t" -// preload "movl prev_row, %%esi \n\t" // esi: Prior(x) - - // prime the pump: load the first Raw(x-bpp) data set - "movq -8(%%edi,%%ecx,), %%mm2 \n\t" // load previous aligned 8 bytes - // (we correct pos. in loop below) - "avg_2lp: \n\t" - "movq (%%edi,%%ecx,), %%mm0 \n\t" - "psrlq _ShiftRem, %%mm2 \n\t" // shift data to pos. correctly - "movq (%%esi,%%ecx,), %%mm1 \n\t" // (GRR BUGFIX: was psllq) - // add (Prev_row/2) to average - "movq %%mm5, %%mm3 \n\t" - "pand %%mm1, %%mm3 \n\t" // get lsb for each prev_row byte - "psrlq $1, %%mm1 \n\t" // divide prev_row bytes by 2 - "pand %%mm4, %%mm1 \n\t" // clear invalid bit 7 of each - // byte - "movq %%mm7, %%mm6 \n\t" - "paddb %%mm1, %%mm0 \n\t" // add (Prev_row/2) to Avg for - // each byte - - // add 1st active group (Raw(x-bpp)/2) to average with _LBCarry - "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting - // LBCarrys - "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte - // where both - // lsb's were == 1 (only valid - // for active group) - "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2 - "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each - // byte - "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2) - // for each byte - "pand %%mm6, %%mm2 \n\t" // leave only Active Group 1 - // bytes to add to Avg - "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to Avg - // for each Active byte - - // add 2nd active group (Raw(x-bpp)/2) to average with _LBCarry - "psllq _ShiftBpp, %%mm6 \n\t" // shift the mm6 mask to cover - // bytes 2 & 3 - "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2 - "psllq _ShiftBpp, %%mm2 \n\t" // shift data to pos. correctly - "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting - // LBCarrys - "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte - // where both - // lsb's were == 1 (only valid - // for active group) - "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2 - "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each - // byte - "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2) - // for each byte - "pand %%mm6, %%mm2 \n\t" // leave only Active Group 2 - // bytes to add to Avg - "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to - // Avg for each Active byte - - // add 3rd active group (Raw(x-bpp)/2) to average with _LBCarry - "psllq _ShiftBpp, %%mm6 \n\t" // shift the mm6 mask to cover - // bytes 4 & 5 - "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2 - "psllq _ShiftBpp, %%mm2 \n\t" // shift data to pos. correctly - "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting - // LBCarrys - "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte - // where both lsb's were == 1 - // (only valid for active group) - "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2 - "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each - // byte - "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2) - // for each byte - "pand %%mm6, %%mm2 \n\t" // leave only Active Group 2 - // bytes to add to Avg - "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to - // Avg for each Active byte - - // add 4th active group (Raw(x-bpp)/2) to average with _LBCarry - "psllq _ShiftBpp, %%mm6 \n\t" // shift the mm6 mask to cover - // bytes 6 & 7 - "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2 - "psllq _ShiftBpp, %%mm2 \n\t" // shift data to pos. correctly - "addl $8, %%ecx \n\t" - "movq %%mm3, %%mm1 \n\t" // now use mm1 for getting - // LBCarrys - "pand %%mm2, %%mm1 \n\t" // get LBCarrys for each byte - // where both - // lsb's were == 1 (only valid - // for active group) - "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2 - "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each - // byte - "paddb %%mm1, %%mm2 \n\t" // add LBCarrys to (Raw(x-bpp)/2) - // for each byte - "pand %%mm6, %%mm2 \n\t" // leave only Active Group 2 - // bytes to add to Avg - "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) + LBCarrys to - // Avg for each Active byte - - "cmpl _MMXLength, %%ecx \n\t" - // now ready to write back to memory - "movq %%mm0, -8(%%edi,%%ecx,) \n\t" - // prep Raw(x-bpp) for next loop - "movq %%mm0, %%mm2 \n\t" // mov updated Raws to mm2 - "jb avg_2lp \n\t" - - : "=S" (dummy_value_S), // output regs (dummy) - "=D" (dummy_value_D) - - : "0" (prev_row), // esi // input regs - "1" (row) // edi - - : "%ecx" // clobber list -#if 0 /* %mm0, ..., %mm7 not supported by gcc 2.7.2.3 or egcs 1.1 */ - , "%mm0", "%mm1", "%mm2", "%mm3" - , "%mm4", "%mm5", "%mm6", "%mm7" -#endif - ); - } - break; // end 2 bpp - - case 1: - { - __asm__ __volatile__ ( - // re-init address pointers and offset -#ifdef __PIC__ - "pushl %%ebx \n\t" // save Global Offset Table index -#endif - "movl _dif, %%ebx \n\t" // ebx: x = offset to alignment - // boundary -// preload "movl row, %%edi \n\t" // edi: Avg(x) - "cmpl _FullLength, %%ebx \n\t" // test if offset at end of array - "jnb avg_1end \n\t" - // do Paeth decode for remaining bytes -// preload "movl prev_row, %%esi \n\t" // esi: Prior(x) - "movl %%edi, %%edx \n\t" -// preload "subl bpp, %%edx \n\t" // (bpp is preloaded into ecx) - "subl %%ecx, %%edx \n\t" // edx: Raw(x-bpp) - "xorl %%ecx, %%ecx \n\t" // zero ecx before using cl & cx - // in loop below - "avg_1lp: \n\t" - // Raw(x) = Avg(x) + ((Raw(x-bpp) + Prior(x))/2) - "xorl %%eax, %%eax \n\t" - "movb (%%esi,%%ebx,), %%cl \n\t" // load cl with Prior(x) - "movb (%%edx,%%ebx,), %%al \n\t" // load al with Raw(x-bpp) - "addw %%cx, %%ax \n\t" - "incl %%ebx \n\t" - "shrw %%ax \n\t" // divide by 2 - "addb -1(%%edi,%%ebx,), %%al \n\t" // add Avg(x); -1 to offset - // inc ebx - "cmpl _FullLength, %%ebx \n\t" // check if at end of array - "movb %%al, -1(%%edi,%%ebx,) \n\t" // write back Raw(x); - // mov does not affect flags; -1 to offset inc ebx - "jb avg_1lp \n\t" - - "avg_1end: \n\t" -#ifdef __PIC__ - "popl %%ebx \n\t" // Global Offset Table index -#endif - - : "=c" (dummy_value_c), // output regs (dummy) - "=S" (dummy_value_S), - "=D" (dummy_value_D) - - : "0" (bpp), // ecx // input regs - "1" (prev_row), // esi - "2" (row) // edi - - : "%eax", "%edx" // clobber list -#ifndef __PIC__ - , "%ebx" -#endif - ); - } - return; // end 1 bpp - - case 8: - { - __asm__ __volatile__ ( - // re-init address pointers and offset - "movl _dif, %%ecx \n\t" // ecx: x == offset to alignment - "movq _LBCarryMask, %%mm5 \n\t" // boundary -// preload "movl row, %%edi \n\t" // edi: Avg(x) - "movq _HBClearMask, %%mm4 \n\t" -// preload "movl prev_row, %%esi \n\t" // esi: Prior(x) - - // prime the pump: load the first Raw(x-bpp) data set - "movq -8(%%edi,%%ecx,), %%mm2 \n\t" // load previous aligned 8 bytes - // (NO NEED to correct pos. in loop below) - - "avg_8lp: \n\t" - "movq (%%edi,%%ecx,), %%mm0 \n\t" - "movq %%mm5, %%mm3 \n\t" - "movq (%%esi,%%ecx,), %%mm1 \n\t" - "addl $8, %%ecx \n\t" - "pand %%mm1, %%mm3 \n\t" // get lsb for each prev_row byte - "psrlq $1, %%mm1 \n\t" // divide prev_row bytes by 2 - "pand %%mm2, %%mm3 \n\t" // get LBCarrys for each byte - // where both lsb's were == 1 - "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2 - "pand %%mm4, %%mm1 \n\t" // clear invalid bit 7, each byte - "paddb %%mm3, %%mm0 \n\t" // add LBCarrys to Avg, each byte - "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7, each byte - "paddb %%mm1, %%mm0 \n\t" // add (Prev_row/2) to Avg, each - "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) to Avg for each - "cmpl _MMXLength, %%ecx \n\t" - "movq %%mm0, -8(%%edi,%%ecx,) \n\t" - "movq %%mm0, %%mm2 \n\t" // reuse as Raw(x-bpp) - "jb avg_8lp \n\t" - - : "=S" (dummy_value_S), // output regs (dummy) - "=D" (dummy_value_D) - - : "0" (prev_row), // esi // input regs - "1" (row) // edi - - : "%ecx" // clobber list -#if 0 /* %mm0, ..., %mm5 not supported by gcc 2.7.2.3 or egcs 1.1 */ - , "%mm0", "%mm1", "%mm2" - , "%mm3", "%mm4", "%mm5" -#endif - ); - } - break; // end 8 bpp - - default: // bpp greater than 8 (!= 1,2,3,4,[5],6,[7],8) - { - -#ifdef PNG_DEBUG - // GRR: PRINT ERROR HERE: SHOULD NEVER BE REACHED - png_debug(1, - "Internal logic error in pnggccrd (png_read_filter_row_mmx_avg())\n"); -#endif - -#if 0 - __asm__ __volatile__ ( - "movq _LBCarryMask, %%mm5 \n\t" - // re-init address pointers and offset - "movl _dif, %%ebx \n\t" // ebx: x = offset to - // alignment boundary - "movl row, %%edi \n\t" // edi: Avg(x) - "movq _HBClearMask, %%mm4 \n\t" - "movl %%edi, %%edx \n\t" - "movl prev_row, %%esi \n\t" // esi: Prior(x) - "subl bpp, %%edx \n\t" // edx: Raw(x-bpp) - "avg_Alp: \n\t" - "movq (%%edi,%%ebx,), %%mm0 \n\t" - "movq %%mm5, %%mm3 \n\t" - "movq (%%esi,%%ebx,), %%mm1 \n\t" - "pand %%mm1, %%mm3 \n\t" // get lsb for each prev_row byte - "movq (%%edx,%%ebx,), %%mm2 \n\t" - "psrlq $1, %%mm1 \n\t" // divide prev_row bytes by 2 - "pand %%mm2, %%mm3 \n\t" // get LBCarrys for each byte - // where both lsb's were == 1 - "psrlq $1, %%mm2 \n\t" // divide raw bytes by 2 - "pand %%mm4, %%mm1 \n\t" // clear invalid bit 7 of each - // byte - "paddb %%mm3, %%mm0 \n\t" // add LBCarrys to Avg for each - // byte - "pand %%mm4, %%mm2 \n\t" // clear invalid bit 7 of each - // byte - "paddb %%mm1, %%mm0 \n\t" // add (Prev_row/2) to Avg for - // each byte - "addl $8, %%ebx \n\t" - "paddb %%mm2, %%mm0 \n\t" // add (Raw/2) to Avg for each - // byte - "cmpl _MMXLength, %%ebx \n\t" - "movq %%mm0, -8(%%edi,%%ebx,) \n\t" - "jb avg_Alp \n\t" - - : // FIXASM: output regs/vars go here, e.g.: "=m" (memory_var) - - : // FIXASM: input regs, e.g.: "c" (count), "S" (src), "D" (dest) - - : "%ebx", "%edx", "%edi", "%esi" // CHECKASM: clobber list - ); -#endif /* 0 - NEVER REACHED */ - } - break; - - } // end switch (bpp) - - __asm__ __volatile__ ( - // MMX acceleration complete; now do clean-up - // check if any remaining bytes left to decode -#ifdef __PIC__ - "pushl %%ebx \n\t" // save index to Global Offset Table -#endif - "movl _MMXLength, %%ebx \n\t" // ebx: x == offset bytes after MMX -//pre "movl row, %%edi \n\t" // edi: Avg(x) - "cmpl _FullLength, %%ebx \n\t" // test if offset at end of array - "jnb avg_end \n\t" - - // do Avg decode for remaining bytes -//pre "movl prev_row, %%esi \n\t" // esi: Prior(x) - "movl %%edi, %%edx \n\t" -//pre "subl bpp, %%edx \n\t" // (bpp is preloaded into ecx) - "subl %%ecx, %%edx \n\t" // edx: Raw(x-bpp) - "xorl %%ecx, %%ecx \n\t" // zero ecx before using cl & cx below - - "avg_lp2: \n\t" - // Raw(x) = Avg(x) + ((Raw(x-bpp) + Prior(x))/2) - "xorl %%eax, %%eax \n\t" - "movb (%%esi,%%ebx,), %%cl \n\t" // load cl with Prior(x) - "movb (%%edx,%%ebx,), %%al \n\t" // load al with Raw(x-bpp) - "addw %%cx, %%ax \n\t" - "incl %%ebx \n\t" - "shrw %%ax \n\t" // divide by 2 - "addb -1(%%edi,%%ebx,), %%al \n\t" // add Avg(x); -1 to offset inc ebx - "cmpl _FullLength, %%ebx \n\t" // check if at end of array - "movb %%al, -1(%%edi,%%ebx,) \n\t" // write back Raw(x) [mov does not - "jb avg_lp2 \n\t" // affect flags; -1 to offset inc ebx] - - "avg_end: \n\t" - "EMMS \n\t" // end MMX; prep for poss. FP instrs. -#ifdef __PIC__ - "popl %%ebx \n\t" // restore index to Global Offset Table -#endif - - : "=c" (dummy_value_c), // output regs (dummy) - "=S" (dummy_value_S), - "=D" (dummy_value_D) - - : "0" (bpp), // ecx // input regs - "1" (prev_row), // esi - "2" (row) // edi - - : "%eax", "%edx" // clobber list -#ifndef __PIC__ - , "%ebx" -#endif - ); - -} /* end png_read_filter_row_mmx_avg() */ -#endif - - - -#ifdef PNG_THREAD_UNSAFE_OK -//===========================================================================// -// // -// P N G _ R E A D _ F I L T E R _ R O W _ M M X _ P A E T H // -// // -//===========================================================================// - -// Optimized code for PNG Paeth filter decoder - -static void /* PRIVATE */ -png_read_filter_row_mmx_paeth(png_row_infop row_info, png_bytep row, - png_bytep prev_row) -{ - int bpp; - int dummy_value_c; // fix 'forbidden register 2 (cx) was spilled' error - int dummy_value_S; - int dummy_value_D; - - bpp = (row_info->pixel_depth + 7) >> 3; // Get # bytes per pixel - _FullLength = row_info->rowbytes; // # of bytes to filter - - __asm__ __volatile__ ( -#ifdef __PIC__ - "pushl %%ebx \n\t" // save index to Global Offset Table -#endif - "xorl %%ebx, %%ebx \n\t" // ebx: x offset -//pre "movl row, %%edi \n\t" - "xorl %%edx, %%edx \n\t" // edx: x-bpp offset -//pre "movl prev_row, %%esi \n\t" - "xorl %%eax, %%eax \n\t" - - // Compute the Raw value for the first bpp bytes - // Note: the formula works out to be always - // Paeth(x) = Raw(x) + Prior(x) where x < bpp - "paeth_rlp: \n\t" - "movb (%%edi,%%ebx,), %%al \n\t" - "addb (%%esi,%%ebx,), %%al \n\t" - "incl %%ebx \n\t" -//pre "cmpl bpp, %%ebx \n\t" (bpp is preloaded into ecx) - "cmpl %%ecx, %%ebx \n\t" - "movb %%al, -1(%%edi,%%ebx,) \n\t" - "jb paeth_rlp \n\t" - // get # of bytes to alignment - "movl %%edi, _dif \n\t" // take start of row - "addl %%ebx, _dif \n\t" // add bpp - "xorl %%ecx, %%ecx \n\t" - "addl $0xf, _dif \n\t" // add 7 + 8 to incr past alignment - // boundary - "andl $0xfffffff8, _dif \n\t" // mask to alignment boundary - "subl %%edi, _dif \n\t" // subtract from start ==> value ebx - // at alignment - "jz paeth_go \n\t" - // fix alignment - - "paeth_lp1: \n\t" - "xorl %%eax, %%eax \n\t" - // pav = p - a = (a + b - c) - a = b - c - "movb (%%esi,%%ebx,), %%al \n\t" // load Prior(x) into al - "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl - "subl %%ecx, %%eax \n\t" // subtract Prior(x-bpp) - "movl %%eax, _patemp \n\t" // Save pav for later use - "xorl %%eax, %%eax \n\t" - // pbv = p - b = (a + b - c) - b = a - c - "movb (%%edi,%%edx,), %%al \n\t" // load Raw(x-bpp) into al - "subl %%ecx, %%eax \n\t" // subtract Prior(x-bpp) - "movl %%eax, %%ecx \n\t" - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv - "addl _patemp, %%eax \n\t" // pcv = pav + pbv - // pc = abs(pcv) - "testl $0x80000000, %%eax \n\t" - "jz paeth_pca \n\t" - "negl %%eax \n\t" // reverse sign of neg values - - "paeth_pca: \n\t" - "movl %%eax, _pctemp \n\t" // save pc for later use - // pb = abs(pbv) - "testl $0x80000000, %%ecx \n\t" - "jz paeth_pba \n\t" - "negl %%ecx \n\t" // reverse sign of neg values - - "paeth_pba: \n\t" - "movl %%ecx, _pbtemp \n\t" // save pb for later use - // pa = abs(pav) - "movl _patemp, %%eax \n\t" - "testl $0x80000000, %%eax \n\t" - "jz paeth_paa \n\t" - "negl %%eax \n\t" // reverse sign of neg values - - "paeth_paa: \n\t" - "movl %%eax, _patemp \n\t" // save pa for later use - // test if pa <= pb - "cmpl %%ecx, %%eax \n\t" - "jna paeth_abb \n\t" - // pa > pb; now test if pb <= pc - "cmpl _pctemp, %%ecx \n\t" - "jna paeth_bbc \n\t" - // pb > pc; Raw(x) = Paeth(x) + Prior(x-bpp) - "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl - "jmp paeth_paeth \n\t" - - "paeth_bbc: \n\t" - // pb <= pc; Raw(x) = Paeth(x) + Prior(x) - "movb (%%esi,%%ebx,), %%cl \n\t" // load Prior(x) into cl - "jmp paeth_paeth \n\t" - - "paeth_abb: \n\t" - // pa <= pb; now test if pa <= pc - "cmpl _pctemp, %%eax \n\t" - "jna paeth_abc \n\t" - // pa > pc; Raw(x) = Paeth(x) + Prior(x-bpp) - "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl - "jmp paeth_paeth \n\t" - - "paeth_abc: \n\t" - // pa <= pc; Raw(x) = Paeth(x) + Raw(x-bpp) - "movb (%%edi,%%edx,), %%cl \n\t" // load Raw(x-bpp) into cl - - "paeth_paeth: \n\t" - "incl %%ebx \n\t" - "incl %%edx \n\t" - // Raw(x) = (Paeth(x) + Paeth_Predictor( a, b, c )) mod 256 - "addb %%cl, -1(%%edi,%%ebx,) \n\t" - "cmpl _dif, %%ebx \n\t" - "jb paeth_lp1 \n\t" - - "paeth_go: \n\t" - "movl _FullLength, %%ecx \n\t" - "movl %%ecx, %%eax \n\t" - "subl %%ebx, %%eax \n\t" // subtract alignment fix - "andl $0x00000007, %%eax \n\t" // calc bytes over mult of 8 - "subl %%eax, %%ecx \n\t" // drop over bytes from original length - "movl %%ecx, _MMXLength \n\t" -#ifdef __PIC__ - "popl %%ebx \n\t" // restore index to Global Offset Table -#endif - - : "=c" (dummy_value_c), // output regs (dummy) - "=S" (dummy_value_S), - "=D" (dummy_value_D) - - : "0" (bpp), // ecx // input regs - "1" (prev_row), // esi - "2" (row) // edi - - : "%eax", "%edx" // clobber list -#ifndef __PIC__ - , "%ebx" -#endif - ); - - // now do the math for the rest of the row - switch (bpp) - { - case 3: - { - _ActiveMask.use = 0x0000000000ffffffLL; - _ActiveMaskEnd.use = 0xffff000000000000LL; - _ShiftBpp.use = 24; // == bpp(3) * 8 - _ShiftRem.use = 40; // == 64 - 24 - - __asm__ __volatile__ ( - "movl _dif, %%ecx \n\t" -// preload "movl row, %%edi \n\t" -// preload "movl prev_row, %%esi \n\t" - "pxor %%mm0, %%mm0 \n\t" - // prime the pump: load the first Raw(x-bpp) data set - "movq -8(%%edi,%%ecx,), %%mm1 \n\t" - "paeth_3lp: \n\t" - "psrlq _ShiftRem, %%mm1 \n\t" // shift last 3 bytes to 1st - // 3 bytes - "movq (%%esi,%%ecx,), %%mm2 \n\t" // load b=Prior(x) - "punpcklbw %%mm0, %%mm1 \n\t" // unpack High bytes of a - "movq -8(%%esi,%%ecx,), %%mm3 \n\t" // prep c=Prior(x-bpp) bytes - "punpcklbw %%mm0, %%mm2 \n\t" // unpack High bytes of b - "psrlq _ShiftRem, %%mm3 \n\t" // shift last 3 bytes to 1st - // 3 bytes - // pav = p - a = (a + b - c) - a = b - c - "movq %%mm2, %%mm4 \n\t" - "punpcklbw %%mm0, %%mm3 \n\t" // unpack High bytes of c - // pbv = p - b = (a + b - c) - b = a - c - "movq %%mm1, %%mm5 \n\t" - "psubw %%mm3, %%mm4 \n\t" - "pxor %%mm7, %%mm7 \n\t" - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv - "movq %%mm4, %%mm6 \n\t" - "psubw %%mm3, %%mm5 \n\t" - - // pa = abs(p-a) = abs(pav) - // pb = abs(p-b) = abs(pbv) - // pc = abs(p-c) = abs(pcv) - "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0 - "paddw %%mm5, %%mm6 \n\t" - "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7 - "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0 - "psubw %%mm0, %%mm4 \n\t" - "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0 - "psubw %%mm0, %%mm4 \n\t" - "psubw %%mm7, %%mm5 \n\t" - "pxor %%mm0, %%mm0 \n\t" - "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0 - "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7 - "psubw %%mm7, %%mm5 \n\t" - "psubw %%mm0, %%mm6 \n\t" - // test pa <= pb - "movq %%mm4, %%mm7 \n\t" - "psubw %%mm0, %%mm6 \n\t" - "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb? - "movq %%mm7, %%mm0 \n\t" - // use mm7 mask to merge pa & pb - "pand %%mm7, %%mm5 \n\t" - // use mm0 mask copy to merge a & b - "pand %%mm0, %%mm2 \n\t" - "pandn %%mm4, %%mm7 \n\t" - "pandn %%mm1, %%mm0 \n\t" - "paddw %%mm5, %%mm7 \n\t" - "paddw %%mm2, %%mm0 \n\t" - // test ((pa <= pb)? pa:pb) <= pc - "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc? - "pxor %%mm1, %%mm1 \n\t" - "pand %%mm7, %%mm3 \n\t" - "pandn %%mm0, %%mm7 \n\t" - "paddw %%mm3, %%mm7 \n\t" - "pxor %%mm0, %%mm0 \n\t" - "packuswb %%mm1, %%mm7 \n\t" - "movq (%%esi,%%ecx,), %%mm3 \n\t" // load c=Prior(x-bpp) - "pand _ActiveMask, %%mm7 \n\t" - "movq %%mm3, %%mm2 \n\t" // load b=Prior(x) step 1 - "paddb (%%edi,%%ecx,), %%mm7 \n\t" // add Paeth predictor with Raw(x) - "punpcklbw %%mm0, %%mm3 \n\t" // unpack High bytes of c - "movq %%mm7, (%%edi,%%ecx,) \n\t" // write back updated value - "movq %%mm7, %%mm1 \n\t" // now mm1 will be used as - // Raw(x-bpp) - // now do Paeth for 2nd set of bytes (3-5) - "psrlq _ShiftBpp, %%mm2 \n\t" // load b=Prior(x) step 2 - "punpcklbw %%mm0, %%mm1 \n\t" // unpack High bytes of a - "pxor %%mm7, %%mm7 \n\t" - "punpcklbw %%mm0, %%mm2 \n\t" // unpack High bytes of b - // pbv = p - b = (a + b - c) - b = a - c - "movq %%mm1, %%mm5 \n\t" - // pav = p - a = (a + b - c) - a = b - c - "movq %%mm2, %%mm4 \n\t" - "psubw %%mm3, %%mm5 \n\t" - "psubw %%mm3, %%mm4 \n\t" - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = - // pav + pbv = pbv + pav - "movq %%mm5, %%mm6 \n\t" - "paddw %%mm4, %%mm6 \n\t" - - // pa = abs(p-a) = abs(pav) - // pb = abs(p-b) = abs(pbv) - // pc = abs(p-c) = abs(pcv) - "pcmpgtw %%mm5, %%mm0 \n\t" // create mask pbv bytes < 0 - "pcmpgtw %%mm4, %%mm7 \n\t" // create mask pav bytes < 0 - "pand %%mm5, %%mm0 \n\t" // only pbv bytes < 0 in mm0 - "pand %%mm4, %%mm7 \n\t" // only pav bytes < 0 in mm7 - "psubw %%mm0, %%mm5 \n\t" - "psubw %%mm7, %%mm4 \n\t" - "psubw %%mm0, %%mm5 \n\t" - "psubw %%mm7, %%mm4 \n\t" - "pxor %%mm0, %%mm0 \n\t" - "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0 - "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7 - "psubw %%mm0, %%mm6 \n\t" - // test pa <= pb - "movq %%mm4, %%mm7 \n\t" - "psubw %%mm0, %%mm6 \n\t" - "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb? - "movq %%mm7, %%mm0 \n\t" - // use mm7 mask to merge pa & pb - "pand %%mm7, %%mm5 \n\t" - // use mm0 mask copy to merge a & b - "pand %%mm0, %%mm2 \n\t" - "pandn %%mm4, %%mm7 \n\t" - "pandn %%mm1, %%mm0 \n\t" - "paddw %%mm5, %%mm7 \n\t" - "paddw %%mm2, %%mm0 \n\t" - // test ((pa <= pb)? pa:pb) <= pc - "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc? - "movq (%%esi,%%ecx,), %%mm2 \n\t" // load b=Prior(x) - "pand %%mm7, %%mm3 \n\t" - "pandn %%mm0, %%mm7 \n\t" - "pxor %%mm1, %%mm1 \n\t" - "paddw %%mm3, %%mm7 \n\t" - "pxor %%mm0, %%mm0 \n\t" - "packuswb %%mm1, %%mm7 \n\t" - "movq %%mm2, %%mm3 \n\t" // load c=Prior(x-bpp) step 1 - "pand _ActiveMask, %%mm7 \n\t" - "punpckhbw %%mm0, %%mm2 \n\t" // unpack High bytes of b - "psllq _ShiftBpp, %%mm7 \n\t" // shift bytes to 2nd group of - // 3 bytes - // pav = p - a = (a + b - c) - a = b - c - "movq %%mm2, %%mm4 \n\t" - "paddb (%%edi,%%ecx,), %%mm7 \n\t" // add Paeth predictor with Raw(x) - "psllq _ShiftBpp, %%mm3 \n\t" // load c=Prior(x-bpp) step 2 - "movq %%mm7, (%%edi,%%ecx,) \n\t" // write back updated value - "movq %%mm7, %%mm1 \n\t" - "punpckhbw %%mm0, %%mm3 \n\t" // unpack High bytes of c - "psllq _ShiftBpp, %%mm1 \n\t" // shift bytes - // now mm1 will be used as Raw(x-bpp) - // now do Paeth for 3rd, and final, set of bytes (6-7) - "pxor %%mm7, %%mm7 \n\t" - "punpckhbw %%mm0, %%mm1 \n\t" // unpack High bytes of a - "psubw %%mm3, %%mm4 \n\t" - // pbv = p - b = (a + b - c) - b = a - c - "movq %%mm1, %%mm5 \n\t" - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv - "movq %%mm4, %%mm6 \n\t" - "psubw %%mm3, %%mm5 \n\t" - "pxor %%mm0, %%mm0 \n\t" - "paddw %%mm5, %%mm6 \n\t" - - // pa = abs(p-a) = abs(pav) - // pb = abs(p-b) = abs(pbv) - // pc = abs(p-c) = abs(pcv) - "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0 - "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0 - "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7 - "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0 - "psubw %%mm0, %%mm4 \n\t" - "psubw %%mm7, %%mm5 \n\t" - "psubw %%mm0, %%mm4 \n\t" - "psubw %%mm7, %%mm5 \n\t" - "pxor %%mm0, %%mm0 \n\t" - "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0 - "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7 - "psubw %%mm0, %%mm6 \n\t" - // test pa <= pb - "movq %%mm4, %%mm7 \n\t" - "psubw %%mm0, %%mm6 \n\t" - "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb? - "movq %%mm7, %%mm0 \n\t" - // use mm0 mask copy to merge a & b - "pand %%mm0, %%mm2 \n\t" - // use mm7 mask to merge pa & pb - "pand %%mm7, %%mm5 \n\t" - "pandn %%mm1, %%mm0 \n\t" - "pandn %%mm4, %%mm7 \n\t" - "paddw %%mm2, %%mm0 \n\t" - "paddw %%mm5, %%mm7 \n\t" - // test ((pa <= pb)? pa:pb) <= pc - "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc? - "pand %%mm7, %%mm3 \n\t" - "pandn %%mm0, %%mm7 \n\t" - "paddw %%mm3, %%mm7 \n\t" - "pxor %%mm1, %%mm1 \n\t" - "packuswb %%mm7, %%mm1 \n\t" - // step ecx to next set of 8 bytes and repeat loop til done - "addl $8, %%ecx \n\t" - "pand _ActiveMaskEnd, %%mm1 \n\t" - "paddb -8(%%edi,%%ecx,), %%mm1 \n\t" // add Paeth predictor with - // Raw(x) - - "cmpl _MMXLength, %%ecx \n\t" - "pxor %%mm0, %%mm0 \n\t" // pxor does not affect flags - "movq %%mm1, -8(%%edi,%%ecx,) \n\t" // write back updated value - // mm1 will be used as Raw(x-bpp) next loop - // mm3 ready to be used as Prior(x-bpp) next loop - "jb paeth_3lp \n\t" - - : "=S" (dummy_value_S), // output regs (dummy) - "=D" (dummy_value_D) - - : "0" (prev_row), // esi // input regs - "1" (row) // edi - - : "%ecx" // clobber list -#if 0 /* %mm0, ..., %mm7 not supported by gcc 2.7.2.3 or egcs 1.1 */ - , "%mm0", "%mm1", "%mm2", "%mm3" - , "%mm4", "%mm5", "%mm6", "%mm7" -#endif - ); - } - break; // end 3 bpp - - case 6: - //case 7: // GRR BOGUS - //case 5: // GRR BOGUS - { - _ActiveMask.use = 0x00000000ffffffffLL; - _ActiveMask2.use = 0xffffffff00000000LL; - _ShiftBpp.use = bpp << 3; // == bpp * 8 - _ShiftRem.use = 64 - _ShiftBpp.use; - - __asm__ __volatile__ ( - "movl _dif, %%ecx \n\t" -// preload "movl row, %%edi \n\t" -// preload "movl prev_row, %%esi \n\t" - // prime the pump: load the first Raw(x-bpp) data set - "movq -8(%%edi,%%ecx,), %%mm1 \n\t" - "pxor %%mm0, %%mm0 \n\t" - - "paeth_6lp: \n\t" - // must shift to position Raw(x-bpp) data - "psrlq _ShiftRem, %%mm1 \n\t" - // do first set of 4 bytes - "movq -8(%%esi,%%ecx,), %%mm3 \n\t" // read c=Prior(x-bpp) bytes - "punpcklbw %%mm0, %%mm1 \n\t" // unpack Low bytes of a - "movq (%%esi,%%ecx,), %%mm2 \n\t" // load b=Prior(x) - "punpcklbw %%mm0, %%mm2 \n\t" // unpack Low bytes of b - // must shift to position Prior(x-bpp) data - "psrlq _ShiftRem, %%mm3 \n\t" - // pav = p - a = (a + b - c) - a = b - c - "movq %%mm2, %%mm4 \n\t" - "punpcklbw %%mm0, %%mm3 \n\t" // unpack Low bytes of c - // pbv = p - b = (a + b - c) - b = a - c - "movq %%mm1, %%mm5 \n\t" - "psubw %%mm3, %%mm4 \n\t" - "pxor %%mm7, %%mm7 \n\t" - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv - "movq %%mm4, %%mm6 \n\t" - "psubw %%mm3, %%mm5 \n\t" - // pa = abs(p-a) = abs(pav) - // pb = abs(p-b) = abs(pbv) - // pc = abs(p-c) = abs(pcv) - "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0 - "paddw %%mm5, %%mm6 \n\t" - "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7 - "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0 - "psubw %%mm0, %%mm4 \n\t" - "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0 - "psubw %%mm0, %%mm4 \n\t" - "psubw %%mm7, %%mm5 \n\t" - "pxor %%mm0, %%mm0 \n\t" - "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0 - "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7 - "psubw %%mm7, %%mm5 \n\t" - "psubw %%mm0, %%mm6 \n\t" - // test pa <= pb - "movq %%mm4, %%mm7 \n\t" - "psubw %%mm0, %%mm6 \n\t" - "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb? - "movq %%mm7, %%mm0 \n\t" - // use mm7 mask to merge pa & pb - "pand %%mm7, %%mm5 \n\t" - // use mm0 mask copy to merge a & b - "pand %%mm0, %%mm2 \n\t" - "pandn %%mm4, %%mm7 \n\t" - "pandn %%mm1, %%mm0 \n\t" - "paddw %%mm5, %%mm7 \n\t" - "paddw %%mm2, %%mm0 \n\t" - // test ((pa <= pb)? pa:pb) <= pc - "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc? - "pxor %%mm1, %%mm1 \n\t" - "pand %%mm7, %%mm3 \n\t" - "pandn %%mm0, %%mm7 \n\t" - "paddw %%mm3, %%mm7 \n\t" - "pxor %%mm0, %%mm0 \n\t" - "packuswb %%mm1, %%mm7 \n\t" - "movq -8(%%esi,%%ecx,), %%mm3 \n\t" // load c=Prior(x-bpp) - "pand _ActiveMask, %%mm7 \n\t" - "psrlq _ShiftRem, %%mm3 \n\t" - "movq (%%esi,%%ecx,), %%mm2 \n\t" // load b=Prior(x) step 1 - "paddb (%%edi,%%ecx,), %%mm7 \n\t" // add Paeth predictor and Raw(x) - "movq %%mm2, %%mm6 \n\t" - "movq %%mm7, (%%edi,%%ecx,) \n\t" // write back updated value - "movq -8(%%edi,%%ecx,), %%mm1 \n\t" - "psllq _ShiftBpp, %%mm6 \n\t" - "movq %%mm7, %%mm5 \n\t" - "psrlq _ShiftRem, %%mm1 \n\t" - "por %%mm6, %%mm3 \n\t" - "psllq _ShiftBpp, %%mm5 \n\t" - "punpckhbw %%mm0, %%mm3 \n\t" // unpack High bytes of c - "por %%mm5, %%mm1 \n\t" - // do second set of 4 bytes - "punpckhbw %%mm0, %%mm2 \n\t" // unpack High bytes of b - "punpckhbw %%mm0, %%mm1 \n\t" // unpack High bytes of a - // pav = p - a = (a + b - c) - a = b - c - "movq %%mm2, %%mm4 \n\t" - // pbv = p - b = (a + b - c) - b = a - c - "movq %%mm1, %%mm5 \n\t" - "psubw %%mm3, %%mm4 \n\t" - "pxor %%mm7, %%mm7 \n\t" - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv - "movq %%mm4, %%mm6 \n\t" - "psubw %%mm3, %%mm5 \n\t" - // pa = abs(p-a) = abs(pav) - // pb = abs(p-b) = abs(pbv) - // pc = abs(p-c) = abs(pcv) - "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0 - "paddw %%mm5, %%mm6 \n\t" - "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7 - "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0 - "psubw %%mm0, %%mm4 \n\t" - "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0 - "psubw %%mm0, %%mm4 \n\t" - "psubw %%mm7, %%mm5 \n\t" - "pxor %%mm0, %%mm0 \n\t" - "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0 - "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7 - "psubw %%mm7, %%mm5 \n\t" - "psubw %%mm0, %%mm6 \n\t" - // test pa <= pb - "movq %%mm4, %%mm7 \n\t" - "psubw %%mm0, %%mm6 \n\t" - "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb? - "movq %%mm7, %%mm0 \n\t" - // use mm7 mask to merge pa & pb - "pand %%mm7, %%mm5 \n\t" - // use mm0 mask copy to merge a & b - "pand %%mm0, %%mm2 \n\t" - "pandn %%mm4, %%mm7 \n\t" - "pandn %%mm1, %%mm0 \n\t" - "paddw %%mm5, %%mm7 \n\t" - "paddw %%mm2, %%mm0 \n\t" - // test ((pa <= pb)? pa:pb) <= pc - "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc? - "pxor %%mm1, %%mm1 \n\t" - "pand %%mm7, %%mm3 \n\t" - "pandn %%mm0, %%mm7 \n\t" - "pxor %%mm1, %%mm1 \n\t" - "paddw %%mm3, %%mm7 \n\t" - "pxor %%mm0, %%mm0 \n\t" - // step ecx to next set of 8 bytes and repeat loop til done - "addl $8, %%ecx \n\t" - "packuswb %%mm7, %%mm1 \n\t" - "paddb -8(%%edi,%%ecx,), %%mm1 \n\t" // add Paeth predictor with Raw(x) - "cmpl _MMXLength, %%ecx \n\t" - "movq %%mm1, -8(%%edi,%%ecx,) \n\t" // write back updated value - // mm1 will be used as Raw(x-bpp) next loop - "jb paeth_6lp \n\t" - - : "=S" (dummy_value_S), // output regs (dummy) - "=D" (dummy_value_D) - - : "0" (prev_row), // esi // input regs - "1" (row) // edi - - : "%ecx" // clobber list -#if 0 /* %mm0, ..., %mm7 not supported by gcc 2.7.2.3 or egcs 1.1 */ - , "%mm0", "%mm1", "%mm2", "%mm3" - , "%mm4", "%mm5", "%mm6", "%mm7" -#endif - ); - } - break; // end 6 bpp - - case 4: - { - _ActiveMask.use = 0x00000000ffffffffLL; - - __asm__ __volatile__ ( - "movl _dif, %%ecx \n\t" -// preload "movl row, %%edi \n\t" -// preload "movl prev_row, %%esi \n\t" - "pxor %%mm0, %%mm0 \n\t" - // prime the pump: load the first Raw(x-bpp) data set - "movq -8(%%edi,%%ecx,), %%mm1 \n\t" // only time should need to read - // a=Raw(x-bpp) bytes - "paeth_4lp: \n\t" - // do first set of 4 bytes - "movq -8(%%esi,%%ecx,), %%mm3 \n\t" // read c=Prior(x-bpp) bytes - "punpckhbw %%mm0, %%mm1 \n\t" // unpack Low bytes of a - "movq (%%esi,%%ecx,), %%mm2 \n\t" // load b=Prior(x) - "punpcklbw %%mm0, %%mm2 \n\t" // unpack High bytes of b - // pav = p - a = (a + b - c) - a = b - c - "movq %%mm2, %%mm4 \n\t" - "punpckhbw %%mm0, %%mm3 \n\t" // unpack High bytes of c - // pbv = p - b = (a + b - c) - b = a - c - "movq %%mm1, %%mm5 \n\t" - "psubw %%mm3, %%mm4 \n\t" - "pxor %%mm7, %%mm7 \n\t" - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv - "movq %%mm4, %%mm6 \n\t" - "psubw %%mm3, %%mm5 \n\t" - // pa = abs(p-a) = abs(pav) - // pb = abs(p-b) = abs(pbv) - // pc = abs(p-c) = abs(pcv) - "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0 - "paddw %%mm5, %%mm6 \n\t" - "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7 - "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0 - "psubw %%mm0, %%mm4 \n\t" - "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0 - "psubw %%mm0, %%mm4 \n\t" - "psubw %%mm7, %%mm5 \n\t" - "pxor %%mm0, %%mm0 \n\t" - "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0 - "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7 - "psubw %%mm7, %%mm5 \n\t" - "psubw %%mm0, %%mm6 \n\t" - // test pa <= pb - "movq %%mm4, %%mm7 \n\t" - "psubw %%mm0, %%mm6 \n\t" - "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb? - "movq %%mm7, %%mm0 \n\t" - // use mm7 mask to merge pa & pb - "pand %%mm7, %%mm5 \n\t" - // use mm0 mask copy to merge a & b - "pand %%mm0, %%mm2 \n\t" - "pandn %%mm4, %%mm7 \n\t" - "pandn %%mm1, %%mm0 \n\t" - "paddw %%mm5, %%mm7 \n\t" - "paddw %%mm2, %%mm0 \n\t" - // test ((pa <= pb)? pa:pb) <= pc - "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc? - "pxor %%mm1, %%mm1 \n\t" - "pand %%mm7, %%mm3 \n\t" - "pandn %%mm0, %%mm7 \n\t" - "paddw %%mm3, %%mm7 \n\t" - "pxor %%mm0, %%mm0 \n\t" - "packuswb %%mm1, %%mm7 \n\t" - "movq (%%esi,%%ecx,), %%mm3 \n\t" // load c=Prior(x-bpp) - "pand _ActiveMask, %%mm7 \n\t" - "movq %%mm3, %%mm2 \n\t" // load b=Prior(x) step 1 - "paddb (%%edi,%%ecx,), %%mm7 \n\t" // add Paeth predictor with Raw(x) - "punpcklbw %%mm0, %%mm3 \n\t" // unpack High bytes of c - "movq %%mm7, (%%edi,%%ecx,) \n\t" // write back updated value - "movq %%mm7, %%mm1 \n\t" // now mm1 will be used as Raw(x-bpp) - // do second set of 4 bytes - "punpckhbw %%mm0, %%mm2 \n\t" // unpack Low bytes of b - "punpcklbw %%mm0, %%mm1 \n\t" // unpack Low bytes of a - // pav = p - a = (a + b - c) - a = b - c - "movq %%mm2, %%mm4 \n\t" - // pbv = p - b = (a + b - c) - b = a - c - "movq %%mm1, %%mm5 \n\t" - "psubw %%mm3, %%mm4 \n\t" - "pxor %%mm7, %%mm7 \n\t" - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv - "movq %%mm4, %%mm6 \n\t" - "psubw %%mm3, %%mm5 \n\t" - // pa = abs(p-a) = abs(pav) - // pb = abs(p-b) = abs(pbv) - // pc = abs(p-c) = abs(pcv) - "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0 - "paddw %%mm5, %%mm6 \n\t" - "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7 - "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0 - "psubw %%mm0, %%mm4 \n\t" - "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0 - "psubw %%mm0, %%mm4 \n\t" - "psubw %%mm7, %%mm5 \n\t" - "pxor %%mm0, %%mm0 \n\t" - "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0 - "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7 - "psubw %%mm7, %%mm5 \n\t" - "psubw %%mm0, %%mm6 \n\t" - // test pa <= pb - "movq %%mm4, %%mm7 \n\t" - "psubw %%mm0, %%mm6 \n\t" - "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb? - "movq %%mm7, %%mm0 \n\t" - // use mm7 mask to merge pa & pb - "pand %%mm7, %%mm5 \n\t" - // use mm0 mask copy to merge a & b - "pand %%mm0, %%mm2 \n\t" - "pandn %%mm4, %%mm7 \n\t" - "pandn %%mm1, %%mm0 \n\t" - "paddw %%mm5, %%mm7 \n\t" - "paddw %%mm2, %%mm0 \n\t" - // test ((pa <= pb)? pa:pb) <= pc - "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc? - "pxor %%mm1, %%mm1 \n\t" - "pand %%mm7, %%mm3 \n\t" - "pandn %%mm0, %%mm7 \n\t" - "pxor %%mm1, %%mm1 \n\t" - "paddw %%mm3, %%mm7 \n\t" - "pxor %%mm0, %%mm0 \n\t" - // step ecx to next set of 8 bytes and repeat loop til done - "addl $8, %%ecx \n\t" - "packuswb %%mm7, %%mm1 \n\t" - "paddb -8(%%edi,%%ecx,), %%mm1 \n\t" // add predictor with Raw(x) - "cmpl _MMXLength, %%ecx \n\t" - "movq %%mm1, -8(%%edi,%%ecx,) \n\t" // write back updated value - // mm1 will be used as Raw(x-bpp) next loop - "jb paeth_4lp \n\t" - - : "=S" (dummy_value_S), // output regs (dummy) - "=D" (dummy_value_D) - - : "0" (prev_row), // esi // input regs - "1" (row) // edi - - : "%ecx" // clobber list -#if 0 /* %mm0, ..., %mm7 not supported by gcc 2.7.2.3 or egcs 1.1 */ - , "%mm0", "%mm1", "%mm2", "%mm3" - , "%mm4", "%mm5", "%mm6", "%mm7" -#endif - ); - } - break; // end 4 bpp - - case 8: // bpp == 8 - { - _ActiveMask.use = 0x00000000ffffffffLL; - - __asm__ __volatile__ ( - "movl _dif, %%ecx \n\t" -// preload "movl row, %%edi \n\t" -// preload "movl prev_row, %%esi \n\t" - "pxor %%mm0, %%mm0 \n\t" - // prime the pump: load the first Raw(x-bpp) data set - "movq -8(%%edi,%%ecx,), %%mm1 \n\t" // only time should need to read - // a=Raw(x-bpp) bytes - "paeth_8lp: \n\t" - // do first set of 4 bytes - "movq -8(%%esi,%%ecx,), %%mm3 \n\t" // read c=Prior(x-bpp) bytes - "punpcklbw %%mm0, %%mm1 \n\t" // unpack Low bytes of a - "movq (%%esi,%%ecx,), %%mm2 \n\t" // load b=Prior(x) - "punpcklbw %%mm0, %%mm2 \n\t" // unpack Low bytes of b - // pav = p - a = (a + b - c) - a = b - c - "movq %%mm2, %%mm4 \n\t" - "punpcklbw %%mm0, %%mm3 \n\t" // unpack Low bytes of c - // pbv = p - b = (a + b - c) - b = a - c - "movq %%mm1, %%mm5 \n\t" - "psubw %%mm3, %%mm4 \n\t" - "pxor %%mm7, %%mm7 \n\t" - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv - "movq %%mm4, %%mm6 \n\t" - "psubw %%mm3, %%mm5 \n\t" - // pa = abs(p-a) = abs(pav) - // pb = abs(p-b) = abs(pbv) - // pc = abs(p-c) = abs(pcv) - "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0 - "paddw %%mm5, %%mm6 \n\t" - "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7 - "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0 - "psubw %%mm0, %%mm4 \n\t" - "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0 - "psubw %%mm0, %%mm4 \n\t" - "psubw %%mm7, %%mm5 \n\t" - "pxor %%mm0, %%mm0 \n\t" - "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0 - "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7 - "psubw %%mm7, %%mm5 \n\t" - "psubw %%mm0, %%mm6 \n\t" - // test pa <= pb - "movq %%mm4, %%mm7 \n\t" - "psubw %%mm0, %%mm6 \n\t" - "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb? - "movq %%mm7, %%mm0 \n\t" - // use mm7 mask to merge pa & pb - "pand %%mm7, %%mm5 \n\t" - // use mm0 mask copy to merge a & b - "pand %%mm0, %%mm2 \n\t" - "pandn %%mm4, %%mm7 \n\t" - "pandn %%mm1, %%mm0 \n\t" - "paddw %%mm5, %%mm7 \n\t" - "paddw %%mm2, %%mm0 \n\t" - // test ((pa <= pb)? pa:pb) <= pc - "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc? - "pxor %%mm1, %%mm1 \n\t" - "pand %%mm7, %%mm3 \n\t" - "pandn %%mm0, %%mm7 \n\t" - "paddw %%mm3, %%mm7 \n\t" - "pxor %%mm0, %%mm0 \n\t" - "packuswb %%mm1, %%mm7 \n\t" - "movq -8(%%esi,%%ecx,), %%mm3 \n\t" // read c=Prior(x-bpp) bytes - "pand _ActiveMask, %%mm7 \n\t" - "movq (%%esi,%%ecx,), %%mm2 \n\t" // load b=Prior(x) - "paddb (%%edi,%%ecx,), %%mm7 \n\t" // add Paeth predictor with Raw(x) - "punpckhbw %%mm0, %%mm3 \n\t" // unpack High bytes of c - "movq %%mm7, (%%edi,%%ecx,) \n\t" // write back updated value - "movq -8(%%edi,%%ecx,), %%mm1 \n\t" // read a=Raw(x-bpp) bytes - - // do second set of 4 bytes - "punpckhbw %%mm0, %%mm2 \n\t" // unpack High bytes of b - "punpckhbw %%mm0, %%mm1 \n\t" // unpack High bytes of a - // pav = p - a = (a + b - c) - a = b - c - "movq %%mm2, %%mm4 \n\t" - // pbv = p - b = (a + b - c) - b = a - c - "movq %%mm1, %%mm5 \n\t" - "psubw %%mm3, %%mm4 \n\t" - "pxor %%mm7, %%mm7 \n\t" - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv - "movq %%mm4, %%mm6 \n\t" - "psubw %%mm3, %%mm5 \n\t" - // pa = abs(p-a) = abs(pav) - // pb = abs(p-b) = abs(pbv) - // pc = abs(p-c) = abs(pcv) - "pcmpgtw %%mm4, %%mm0 \n\t" // create mask pav bytes < 0 - "paddw %%mm5, %%mm6 \n\t" - "pand %%mm4, %%mm0 \n\t" // only pav bytes < 0 in mm7 - "pcmpgtw %%mm5, %%mm7 \n\t" // create mask pbv bytes < 0 - "psubw %%mm0, %%mm4 \n\t" - "pand %%mm5, %%mm7 \n\t" // only pbv bytes < 0 in mm0 - "psubw %%mm0, %%mm4 \n\t" - "psubw %%mm7, %%mm5 \n\t" - "pxor %%mm0, %%mm0 \n\t" - "pcmpgtw %%mm6, %%mm0 \n\t" // create mask pcv bytes < 0 - "pand %%mm6, %%mm0 \n\t" // only pav bytes < 0 in mm7 - "psubw %%mm7, %%mm5 \n\t" - "psubw %%mm0, %%mm6 \n\t" - // test pa <= pb - "movq %%mm4, %%mm7 \n\t" - "psubw %%mm0, %%mm6 \n\t" - "pcmpgtw %%mm5, %%mm7 \n\t" // pa > pb? - "movq %%mm7, %%mm0 \n\t" - // use mm7 mask to merge pa & pb - "pand %%mm7, %%mm5 \n\t" - // use mm0 mask copy to merge a & b - "pand %%mm0, %%mm2 \n\t" - "pandn %%mm4, %%mm7 \n\t" - "pandn %%mm1, %%mm0 \n\t" - "paddw %%mm5, %%mm7 \n\t" - "paddw %%mm2, %%mm0 \n\t" - // test ((pa <= pb)? pa:pb) <= pc - "pcmpgtw %%mm6, %%mm7 \n\t" // pab > pc? - "pxor %%mm1, %%mm1 \n\t" - "pand %%mm7, %%mm3 \n\t" - "pandn %%mm0, %%mm7 \n\t" - "pxor %%mm1, %%mm1 \n\t" - "paddw %%mm3, %%mm7 \n\t" - "pxor %%mm0, %%mm0 \n\t" - // step ecx to next set of 8 bytes and repeat loop til done - "addl $8, %%ecx \n\t" - "packuswb %%mm7, %%mm1 \n\t" - "paddb -8(%%edi,%%ecx,), %%mm1 \n\t" // add Paeth predictor with Raw(x) - "cmpl _MMXLength, %%ecx \n\t" - "movq %%mm1, -8(%%edi,%%ecx,) \n\t" // write back updated value - // mm1 will be used as Raw(x-bpp) next loop - "jb paeth_8lp \n\t" - - : "=S" (dummy_value_S), // output regs (dummy) - "=D" (dummy_value_D) - - : "0" (prev_row), // esi // input regs - "1" (row) // edi - - : "%ecx" // clobber list -#if 0 /* %mm0, ..., %mm7 not supported by gcc 2.7.2.3 or egcs 1.1 */ - , "%mm0", "%mm1", "%mm2", "%mm3" - , "%mm4", "%mm5", "%mm6", "%mm7" -#endif - ); - } - break; // end 8 bpp - - case 1: // bpp = 1 - case 2: // bpp = 2 - default: // bpp > 8 - { - __asm__ __volatile__ ( -#ifdef __PIC__ - "pushl %%ebx \n\t" // save Global Offset Table index -#endif - "movl _dif, %%ebx \n\t" - "cmpl _FullLength, %%ebx \n\t" - "jnb paeth_dend \n\t" - -// preload "movl row, %%edi \n\t" -// preload "movl prev_row, %%esi \n\t" - // do Paeth decode for remaining bytes - "movl %%ebx, %%edx \n\t" -// preload "subl bpp, %%edx \n\t" // (bpp is preloaded into ecx) - "subl %%ecx, %%edx \n\t" // edx = ebx - bpp - "xorl %%ecx, %%ecx \n\t" // zero ecx before using cl & cx - - "paeth_dlp: \n\t" - "xorl %%eax, %%eax \n\t" - // pav = p - a = (a + b - c) - a = b - c - "movb (%%esi,%%ebx,), %%al \n\t" // load Prior(x) into al - "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl - "subl %%ecx, %%eax \n\t" // subtract Prior(x-bpp) - "movl %%eax, _patemp \n\t" // Save pav for later use - "xorl %%eax, %%eax \n\t" - // pbv = p - b = (a + b - c) - b = a - c - "movb (%%edi,%%edx,), %%al \n\t" // load Raw(x-bpp) into al - "subl %%ecx, %%eax \n\t" // subtract Prior(x-bpp) - "movl %%eax, %%ecx \n\t" - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv - "addl _patemp, %%eax \n\t" // pcv = pav + pbv - // pc = abs(pcv) - "testl $0x80000000, %%eax \n\t" - "jz paeth_dpca \n\t" - "negl %%eax \n\t" // reverse sign of neg values - - "paeth_dpca: \n\t" - "movl %%eax, _pctemp \n\t" // save pc for later use - // pb = abs(pbv) - "testl $0x80000000, %%ecx \n\t" - "jz paeth_dpba \n\t" - "negl %%ecx \n\t" // reverse sign of neg values - - "paeth_dpba: \n\t" - "movl %%ecx, _pbtemp \n\t" // save pb for later use - // pa = abs(pav) - "movl _patemp, %%eax \n\t" - "testl $0x80000000, %%eax \n\t" - "jz paeth_dpaa \n\t" - "negl %%eax \n\t" // reverse sign of neg values - - "paeth_dpaa: \n\t" - "movl %%eax, _patemp \n\t" // save pa for later use - // test if pa <= pb - "cmpl %%ecx, %%eax \n\t" - "jna paeth_dabb \n\t" - // pa > pb; now test if pb <= pc - "cmpl _pctemp, %%ecx \n\t" - "jna paeth_dbbc \n\t" - // pb > pc; Raw(x) = Paeth(x) + Prior(x-bpp) - "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl - "jmp paeth_dpaeth \n\t" - - "paeth_dbbc: \n\t" - // pb <= pc; Raw(x) = Paeth(x) + Prior(x) - "movb (%%esi,%%ebx,), %%cl \n\t" // load Prior(x) into cl - "jmp paeth_dpaeth \n\t" - - "paeth_dabb: \n\t" - // pa <= pb; now test if pa <= pc - "cmpl _pctemp, %%eax \n\t" - "jna paeth_dabc \n\t" - // pa > pc; Raw(x) = Paeth(x) + Prior(x-bpp) - "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl - "jmp paeth_dpaeth \n\t" - - "paeth_dabc: \n\t" - // pa <= pc; Raw(x) = Paeth(x) + Raw(x-bpp) - "movb (%%edi,%%edx,), %%cl \n\t" // load Raw(x-bpp) into cl - - "paeth_dpaeth: \n\t" - "incl %%ebx \n\t" - "incl %%edx \n\t" - // Raw(x) = (Paeth(x) + Paeth_Predictor( a, b, c )) mod 256 - "addb %%cl, -1(%%edi,%%ebx,) \n\t" - "cmpl _FullLength, %%ebx \n\t" - "jb paeth_dlp \n\t" - - "paeth_dend: \n\t" -#ifdef __PIC__ - "popl %%ebx \n\t" // index to Global Offset Table -#endif - - : "=c" (dummy_value_c), // output regs (dummy) - "=S" (dummy_value_S), - "=D" (dummy_value_D) - - : "0" (bpp), // ecx // input regs - "1" (prev_row), // esi - "2" (row) // edi - - : "%eax", "%edx" // clobber list -#ifndef __PIC__ - , "%ebx" -#endif - ); - } - return; // No need to go further with this one - - } // end switch (bpp) - - __asm__ __volatile__ ( - // MMX acceleration complete; now do clean-up - // check if any remaining bytes left to decode -#ifdef __PIC__ - "pushl %%ebx \n\t" // save index to Global Offset Table -#endif - "movl _MMXLength, %%ebx \n\t" - "cmpl _FullLength, %%ebx \n\t" - "jnb paeth_end \n\t" -//pre "movl row, %%edi \n\t" -//pre "movl prev_row, %%esi \n\t" - // do Paeth decode for remaining bytes - "movl %%ebx, %%edx \n\t" -//pre "subl bpp, %%edx \n\t" // (bpp is preloaded into ecx) - "subl %%ecx, %%edx \n\t" // edx = ebx - bpp - "xorl %%ecx, %%ecx \n\t" // zero ecx before using cl & cx below - - "paeth_lp2: \n\t" - "xorl %%eax, %%eax \n\t" - // pav = p - a = (a + b - c) - a = b - c - "movb (%%esi,%%ebx,), %%al \n\t" // load Prior(x) into al - "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl - "subl %%ecx, %%eax \n\t" // subtract Prior(x-bpp) - "movl %%eax, _patemp \n\t" // Save pav for later use - "xorl %%eax, %%eax \n\t" - // pbv = p - b = (a + b - c) - b = a - c - "movb (%%edi,%%edx,), %%al \n\t" // load Raw(x-bpp) into al - "subl %%ecx, %%eax \n\t" // subtract Prior(x-bpp) - "movl %%eax, %%ecx \n\t" - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv - "addl _patemp, %%eax \n\t" // pcv = pav + pbv - // pc = abs(pcv) - "testl $0x80000000, %%eax \n\t" - "jz paeth_pca2 \n\t" - "negl %%eax \n\t" // reverse sign of neg values - - "paeth_pca2: \n\t" - "movl %%eax, _pctemp \n\t" // save pc for later use - // pb = abs(pbv) - "testl $0x80000000, %%ecx \n\t" - "jz paeth_pba2 \n\t" - "negl %%ecx \n\t" // reverse sign of neg values - - "paeth_pba2: \n\t" - "movl %%ecx, _pbtemp \n\t" // save pb for later use - // pa = abs(pav) - "movl _patemp, %%eax \n\t" - "testl $0x80000000, %%eax \n\t" - "jz paeth_paa2 \n\t" - "negl %%eax \n\t" // reverse sign of neg values - - "paeth_paa2: \n\t" - "movl %%eax, _patemp \n\t" // save pa for later use - // test if pa <= pb - "cmpl %%ecx, %%eax \n\t" - "jna paeth_abb2 \n\t" - // pa > pb; now test if pb <= pc - "cmpl _pctemp, %%ecx \n\t" - "jna paeth_bbc2 \n\t" - // pb > pc; Raw(x) = Paeth(x) + Prior(x-bpp) - "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl - "jmp paeth_paeth2 \n\t" - - "paeth_bbc2: \n\t" - // pb <= pc; Raw(x) = Paeth(x) + Prior(x) - "movb (%%esi,%%ebx,), %%cl \n\t" // load Prior(x) into cl - "jmp paeth_paeth2 \n\t" - - "paeth_abb2: \n\t" - // pa <= pb; now test if pa <= pc - "cmpl _pctemp, %%eax \n\t" - "jna paeth_abc2 \n\t" - // pa > pc; Raw(x) = Paeth(x) + Prior(x-bpp) - "movb (%%esi,%%edx,), %%cl \n\t" // load Prior(x-bpp) into cl - "jmp paeth_paeth2 \n\t" - - "paeth_abc2: \n\t" - // pa <= pc; Raw(x) = Paeth(x) + Raw(x-bpp) - "movb (%%edi,%%edx,), %%cl \n\t" // load Raw(x-bpp) into cl - - "paeth_paeth2: \n\t" - "incl %%ebx \n\t" - "incl %%edx \n\t" - // Raw(x) = (Paeth(x) + Paeth_Predictor( a, b, c )) mod 256 - "addb %%cl, -1(%%edi,%%ebx,) \n\t" - "cmpl _FullLength, %%ebx \n\t" - "jb paeth_lp2 \n\t" - - "paeth_end: \n\t" - "EMMS \n\t" // end MMX; prep for poss. FP instrs. -#ifdef __PIC__ - "popl %%ebx \n\t" // restore index to Global Offset Table -#endif - - : "=c" (dummy_value_c), // output regs (dummy) - "=S" (dummy_value_S), - "=D" (dummy_value_D) - - : "0" (bpp), // ecx // input regs - "1" (prev_row), // esi - "2" (row) // edi - - : "%eax", "%edx" // clobber list (no input regs!) -#ifndef __PIC__ - , "%ebx" -#endif - ); - -} /* end png_read_filter_row_mmx_paeth() */ -#endif - - - - -#ifdef PNG_THREAD_UNSAFE_OK -//===========================================================================// -// // -// P N G _ R E A D _ F I L T E R _ R O W _ M M X _ S U B // -// // -//===========================================================================// - -// Optimized code for PNG Sub filter decoder - -static void /* PRIVATE */ -png_read_filter_row_mmx_sub(png_row_infop row_info, png_bytep row) -{ - int bpp; - int dummy_value_a; - int dummy_value_D; - - bpp = (row_info->pixel_depth + 7) >> 3; // calc number of bytes per pixel - _FullLength = row_info->rowbytes - bpp; // number of bytes to filter - - __asm__ __volatile__ ( -//pre "movl row, %%edi \n\t" - "movl %%edi, %%esi \n\t" // lp = row -//pre "movl bpp, %%eax \n\t" - "addl %%eax, %%edi \n\t" // rp = row + bpp -//irr "xorl %%eax, %%eax \n\t" - // get # of bytes to alignment - "movl %%edi, _dif \n\t" // take start of row - "addl $0xf, _dif \n\t" // add 7 + 8 to incr past - // alignment boundary - "xorl %%ecx, %%ecx \n\t" - "andl $0xfffffff8, _dif \n\t" // mask to alignment boundary - "subl %%edi, _dif \n\t" // subtract from start ==> value - "jz sub_go \n\t" // ecx at alignment - - "sub_lp1: \n\t" // fix alignment - "movb (%%esi,%%ecx,), %%al \n\t" - "addb %%al, (%%edi,%%ecx,) \n\t" - "incl %%ecx \n\t" - "cmpl _dif, %%ecx \n\t" - "jb sub_lp1 \n\t" - - "sub_go: \n\t" - "movl _FullLength, %%eax \n\t" - "movl %%eax, %%edx \n\t" - "subl %%ecx, %%edx \n\t" // subtract alignment fix - "andl $0x00000007, %%edx \n\t" // calc bytes over mult of 8 - "subl %%edx, %%eax \n\t" // drop over bytes from length - "movl %%eax, _MMXLength \n\t" - - : "=a" (dummy_value_a), // 0 // output regs (dummy) - "=D" (dummy_value_D) // 1 - - : "0" (bpp), // eax // input regs - "1" (row) // edi - - : "%esi", "%ecx", "%edx" // clobber list - -#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ - , "%mm0", "%mm1", "%mm2", "%mm3" - , "%mm4", "%mm5", "%mm6", "%mm7" -#endif - ); - - // now do the math for the rest of the row - switch (bpp) - { - case 3: - { - _ActiveMask.use = 0x0000ffffff000000LL; - _ShiftBpp.use = 24; // == 3 * 8 - _ShiftRem.use = 40; // == 64 - 24 - - __asm__ __volatile__ ( -// preload "movl row, %%edi \n\t" - "movq _ActiveMask, %%mm7 \n\t" // load _ActiveMask for 2nd - // active byte group - "movl %%edi, %%esi \n\t" // lp = row -// preload "movl bpp, %%eax \n\t" - "addl %%eax, %%edi \n\t" // rp = row + bpp - "movq %%mm7, %%mm6 \n\t" - "movl _dif, %%edx \n\t" - "psllq _ShiftBpp, %%mm6 \n\t" // move mask in mm6 to cover - // 3rd active byte group - // prime the pump: load the first Raw(x-bpp) data set - "movq -8(%%edi,%%edx,), %%mm1 \n\t" - - "sub_3lp: \n\t" // shift data for adding first - "psrlq _ShiftRem, %%mm1 \n\t" // bpp bytes (no need for mask; - // shift clears inactive bytes) - // add 1st active group - "movq (%%edi,%%edx,), %%mm0 \n\t" - "paddb %%mm1, %%mm0 \n\t" - - // add 2nd active group - "movq %%mm0, %%mm1 \n\t" // mov updated Raws to mm1 - "psllq _ShiftBpp, %%mm1 \n\t" // shift data to pos. correctly - "pand %%mm7, %%mm1 \n\t" // mask to use 2nd active group - "paddb %%mm1, %%mm0 \n\t" - - // add 3rd active group - "movq %%mm0, %%mm1 \n\t" // mov updated Raws to mm1 - "psllq _ShiftBpp, %%mm1 \n\t" // shift data to pos. correctly - "pand %%mm6, %%mm1 \n\t" // mask to use 3rd active group - "addl $8, %%edx \n\t" - "paddb %%mm1, %%mm0 \n\t" - - "cmpl _MMXLength, %%edx \n\t" - "movq %%mm0, -8(%%edi,%%edx,) \n\t" // write updated Raws to array - "movq %%mm0, %%mm1 \n\t" // prep 1st add at top of loop - "jb sub_3lp \n\t" - - : "=a" (dummy_value_a), // 0 // output regs (dummy) - "=D" (dummy_value_D) // 1 - - : "0" (bpp), // eax // input regs - "1" (row) // edi - - : "%edx", "%esi" // clobber list -#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ - , "%mm0", "%mm1", "%mm6", "%mm7" -#endif - ); - } - break; - - case 1: - { - __asm__ __volatile__ ( - "movl _dif, %%edx \n\t" -// preload "movl row, %%edi \n\t" - "cmpl _FullLength, %%edx \n\t" - "jnb sub_1end \n\t" - "movl %%edi, %%esi \n\t" // lp = row - "xorl %%eax, %%eax \n\t" -// preload "movl bpp, %%eax \n\t" - "addl %%eax, %%edi \n\t" // rp = row + bpp - - "sub_1lp: \n\t" - "movb (%%esi,%%edx,), %%al \n\t" - "addb %%al, (%%edi,%%edx,) \n\t" - "incl %%edx \n\t" - "cmpl _FullLength, %%edx \n\t" - "jb sub_1lp \n\t" - - "sub_1end: \n\t" - - : "=a" (dummy_value_a), // 0 // output regs (dummy) - "=D" (dummy_value_D) // 1 - - : "0" (bpp), // eax // input regs - "1" (row) // edi - - : "%edx", "%esi" // clobber list - ); - } - return; - - case 6: - case 4: - //case 7: // GRR BOGUS - //case 5: // GRR BOGUS - { - _ShiftBpp.use = bpp << 3; - _ShiftRem.use = 64 - _ShiftBpp.use; - - __asm__ __volatile__ ( -// preload "movl row, %%edi \n\t" - "movl _dif, %%edx \n\t" - "movl %%edi, %%esi \n\t" // lp = row -// preload "movl bpp, %%eax \n\t" - "addl %%eax, %%edi \n\t" // rp = row + bpp - - // prime the pump: load the first Raw(x-bpp) data set - "movq -8(%%edi,%%edx,), %%mm1 \n\t" - - "sub_4lp: \n\t" // shift data for adding first - "psrlq _ShiftRem, %%mm1 \n\t" // bpp bytes (no need for mask; - // shift clears inactive bytes) - "movq (%%edi,%%edx,), %%mm0 \n\t" - "paddb %%mm1, %%mm0 \n\t" - - // add 2nd active group - "movq %%mm0, %%mm1 \n\t" // mov updated Raws to mm1 - "psllq _ShiftBpp, %%mm1 \n\t" // shift data to pos. correctly - "addl $8, %%edx \n\t" - "paddb %%mm1, %%mm0 \n\t" - - "cmpl _MMXLength, %%edx \n\t" - "movq %%mm0, -8(%%edi,%%edx,) \n\t" - "movq %%mm0, %%mm1 \n\t" // prep 1st add at top of loop - "jb sub_4lp \n\t" - - : "=a" (dummy_value_a), // 0 // output regs (dummy) - "=D" (dummy_value_D) // 1 - - : "0" (bpp), // eax // input regs - "1" (row) // edi - - : "%edx", "%esi" // clobber list -#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ - , "%mm0", "%mm1" -#endif - ); - } - break; - - case 2: - { - _ActiveMask.use = 0x00000000ffff0000LL; - _ShiftBpp.use = 16; // == 2 * 8 - _ShiftRem.use = 48; // == 64 - 16 - - __asm__ __volatile__ ( - "movq _ActiveMask, %%mm7 \n\t" // load _ActiveMask for 2nd - // active byte group - "movl _dif, %%edx \n\t" - "movq %%mm7, %%mm6 \n\t" -// preload "movl row, %%edi \n\t" - "psllq _ShiftBpp, %%mm6 \n\t" // move mask in mm6 to cover - // 3rd active byte group - "movl %%edi, %%esi \n\t" // lp = row - "movq %%mm6, %%mm5 \n\t" -// preload "movl bpp, %%eax \n\t" - "addl %%eax, %%edi \n\t" // rp = row + bpp - "psllq _ShiftBpp, %%mm5 \n\t" // move mask in mm5 to cover - // 4th active byte group - // prime the pump: load the first Raw(x-bpp) data set - "movq -8(%%edi,%%edx,), %%mm1 \n\t" - - "sub_2lp: \n\t" // shift data for adding first - "psrlq _ShiftRem, %%mm1 \n\t" // bpp bytes (no need for mask; - // shift clears inactive bytes) - // add 1st active group - "movq (%%edi,%%edx,), %%mm0 \n\t" - "paddb %%mm1, %%mm0 \n\t" - - // add 2nd active group - "movq %%mm0, %%mm1 \n\t" // mov updated Raws to mm1 - "psllq _ShiftBpp, %%mm1 \n\t" // shift data to pos. correctly - "pand %%mm7, %%mm1 \n\t" // mask to use 2nd active group - "paddb %%mm1, %%mm0 \n\t" - - // add 3rd active group - "movq %%mm0, %%mm1 \n\t" // mov updated Raws to mm1 - "psllq _ShiftBpp, %%mm1 \n\t" // shift data to pos. correctly - "pand %%mm6, %%mm1 \n\t" // mask to use 3rd active group - "paddb %%mm1, %%mm0 \n\t" - - // add 4th active group - "movq %%mm0, %%mm1 \n\t" // mov updated Raws to mm1 - "psllq _ShiftBpp, %%mm1 \n\t" // shift data to pos. correctly - "pand %%mm5, %%mm1 \n\t" // mask to use 4th active group - "addl $8, %%edx \n\t" - "paddb %%mm1, %%mm0 \n\t" - "cmpl _MMXLength, %%edx \n\t" - "movq %%mm0, -8(%%edi,%%edx,) \n\t" // write updated Raws to array - "movq %%mm0, %%mm1 \n\t" // prep 1st add at top of loop - "jb sub_2lp \n\t" - - : "=a" (dummy_value_a), // 0 // output regs (dummy) - "=D" (dummy_value_D) // 1 - - : "0" (bpp), // eax // input regs - "1" (row) // edi - - : "%edx", "%esi" // clobber list -#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ - , "%mm0", "%mm1", "%mm5", "%mm6", "%mm7" -#endif - ); - } - break; - - case 8: - { - __asm__ __volatile__ ( -// preload "movl row, %%edi \n\t" - "movl _dif, %%edx \n\t" - "movl %%edi, %%esi \n\t" // lp = row -// preload "movl bpp, %%eax \n\t" - "addl %%eax, %%edi \n\t" // rp = row + bpp - "movl _MMXLength, %%ecx \n\t" - - // prime the pump: load the first Raw(x-bpp) data set - "movq -8(%%edi,%%edx,), %%mm7 \n\t" - "andl $0x0000003f, %%ecx \n\t" // calc bytes over mult of 64 - - "sub_8lp: \n\t" - "movq (%%edi,%%edx,), %%mm0 \n\t" // load Sub(x) for 1st 8 bytes - "paddb %%mm7, %%mm0 \n\t" - "movq 8(%%edi,%%edx,), %%mm1 \n\t" // load Sub(x) for 2nd 8 bytes - "movq %%mm0, (%%edi,%%edx,) \n\t" // write Raw(x) for 1st 8 bytes - - // Now mm0 will be used as Raw(x-bpp) for the 2nd group of 8 bytes. - // This will be repeated for each group of 8 bytes with the 8th - // group being used as the Raw(x-bpp) for the 1st group of the - // next loop. - - "paddb %%mm0, %%mm1 \n\t" - "movq 16(%%edi,%%edx,), %%mm2 \n\t" // load Sub(x) for 3rd 8 bytes - "movq %%mm1, 8(%%edi,%%edx,) \n\t" // write Raw(x) for 2nd 8 bytes - "paddb %%mm1, %%mm2 \n\t" - "movq 24(%%edi,%%edx,), %%mm3 \n\t" // load Sub(x) for 4th 8 bytes - "movq %%mm2, 16(%%edi,%%edx,) \n\t" // write Raw(x) for 3rd 8 bytes - "paddb %%mm2, %%mm3 \n\t" - "movq 32(%%edi,%%edx,), %%mm4 \n\t" // load Sub(x) for 5th 8 bytes - "movq %%mm3, 24(%%edi,%%edx,) \n\t" // write Raw(x) for 4th 8 bytes - "paddb %%mm3, %%mm4 \n\t" - "movq 40(%%edi,%%edx,), %%mm5 \n\t" // load Sub(x) for 6th 8 bytes - "movq %%mm4, 32(%%edi,%%edx,) \n\t" // write Raw(x) for 5th 8 bytes - "paddb %%mm4, %%mm5 \n\t" - "movq 48(%%edi,%%edx,), %%mm6 \n\t" // load Sub(x) for 7th 8 bytes - "movq %%mm5, 40(%%edi,%%edx,) \n\t" // write Raw(x) for 6th 8 bytes - "paddb %%mm5, %%mm6 \n\t" - "movq 56(%%edi,%%edx,), %%mm7 \n\t" // load Sub(x) for 8th 8 bytes - "movq %%mm6, 48(%%edi,%%edx,) \n\t" // write Raw(x) for 7th 8 bytes - "addl $64, %%edx \n\t" - "paddb %%mm6, %%mm7 \n\t" - "cmpl %%ecx, %%edx \n\t" - "movq %%mm7, -8(%%edi,%%edx,) \n\t" // write Raw(x) for 8th 8 bytes - "jb sub_8lp \n\t" - - "cmpl _MMXLength, %%edx \n\t" - "jnb sub_8lt8 \n\t" - - "sub_8lpA: \n\t" - "movq (%%edi,%%edx,), %%mm0 \n\t" - "addl $8, %%edx \n\t" - "paddb %%mm7, %%mm0 \n\t" - "cmpl _MMXLength, %%edx \n\t" - "movq %%mm0, -8(%%edi,%%edx,) \n\t" // -8 to offset early addl edx - "movq %%mm0, %%mm7 \n\t" // move calculated Raw(x) data - // to mm1 to be new Raw(x-bpp) - // for next loop - "jb sub_8lpA \n\t" - - "sub_8lt8: \n\t" - - : "=a" (dummy_value_a), // 0 // output regs (dummy) - "=D" (dummy_value_D) // 1 - - : "0" (bpp), // eax // input regs - "1" (row) // edi - - : "%ecx", "%edx", "%esi" // clobber list -#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ - , "%mm0", "%mm1", "%mm2", "%mm3", "%mm4", "%mm5", "%mm6", "%mm7" -#endif - ); - } - break; - - default: // bpp greater than 8 bytes GRR BOGUS - { - __asm__ __volatile__ ( - "movl _dif, %%edx \n\t" -// preload "movl row, %%edi \n\t" - "movl %%edi, %%esi \n\t" // lp = row -// preload "movl bpp, %%eax \n\t" - "addl %%eax, %%edi \n\t" // rp = row + bpp - - "sub_Alp: \n\t" - "movq (%%edi,%%edx,), %%mm0 \n\t" - "movq (%%esi,%%edx,), %%mm1 \n\t" - "addl $8, %%edx \n\t" - "paddb %%mm1, %%mm0 \n\t" - "cmpl _MMXLength, %%edx \n\t" - "movq %%mm0, -8(%%edi,%%edx,) \n\t" // mov does not affect flags; - // -8 to offset addl edx - "jb sub_Alp \n\t" - - : "=a" (dummy_value_a), // 0 // output regs (dummy) - "=D" (dummy_value_D) // 1 - - : "0" (bpp), // eax // input regs - "1" (row) // edi - - : "%edx", "%esi" // clobber list -#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ - , "%mm0", "%mm1" -#endif - ); - } - break; - - } // end switch (bpp) - - __asm__ __volatile__ ( - "movl _MMXLength, %%edx \n\t" -//pre "movl row, %%edi \n\t" - "cmpl _FullLength, %%edx \n\t" - "jnb sub_end \n\t" - - "movl %%edi, %%esi \n\t" // lp = row -//pre "movl bpp, %%eax \n\t" - "addl %%eax, %%edi \n\t" // rp = row + bpp - "xorl %%eax, %%eax \n\t" - - "sub_lp2: \n\t" - "movb (%%esi,%%edx,), %%al \n\t" - "addb %%al, (%%edi,%%edx,) \n\t" - "incl %%edx \n\t" - "cmpl _FullLength, %%edx \n\t" - "jb sub_lp2 \n\t" - - "sub_end: \n\t" - "EMMS \n\t" // end MMX instructions - - : "=a" (dummy_value_a), // 0 // output regs (dummy) - "=D" (dummy_value_D) // 1 - - : "0" (bpp), // eax // input regs - "1" (row) // edi - - : "%edx", "%esi" // clobber list - ); - -} // end of png_read_filter_row_mmx_sub() -#endif - - - - -//===========================================================================// -// // -// P N G _ R E A D _ F I L T E R _ R O W _ M M X _ U P // -// // -//===========================================================================// - -// Optimized code for PNG Up filter decoder - -static void /* PRIVATE */ -png_read_filter_row_mmx_up(png_row_infop row_info, png_bytep row, - png_bytep prev_row) -{ - png_uint_32 len; - int dummy_value_d; // fix 'forbidden register 3 (dx) was spilled' error - int dummy_value_S; - int dummy_value_D; - - len = row_info->rowbytes; // number of bytes to filter - - __asm__ __volatile__ ( -//pre "movl row, %%edi \n\t" - // get # of bytes to alignment -#ifdef __PIC__ - "pushl %%ebx \n\t" -#endif - "movl %%edi, %%ecx \n\t" - "xorl %%ebx, %%ebx \n\t" - "addl $0x7, %%ecx \n\t" - "xorl %%eax, %%eax \n\t" - "andl $0xfffffff8, %%ecx \n\t" -//pre "movl prev_row, %%esi \n\t" - "subl %%edi, %%ecx \n\t" - "jz up_go \n\t" - - "up_lp1: \n\t" // fix alignment - "movb (%%edi,%%ebx,), %%al \n\t" - "addb (%%esi,%%ebx,), %%al \n\t" - "incl %%ebx \n\t" - "cmpl %%ecx, %%ebx \n\t" - "movb %%al, -1(%%edi,%%ebx,) \n\t" // mov does not affect flags; -1 to - "jb up_lp1 \n\t" // offset incl ebx - - "up_go: \n\t" -//pre "movl len, %%edx \n\t" - "movl %%edx, %%ecx \n\t" - "subl %%ebx, %%edx \n\t" // subtract alignment fix - "andl $0x0000003f, %%edx \n\t" // calc bytes over mult of 64 - "subl %%edx, %%ecx \n\t" // drop over bytes from length - - // unrolled loop - use all MMX registers and interleave to reduce - // number of branch instructions (loops) and reduce partial stalls - "up_loop: \n\t" - "movq (%%esi,%%ebx,), %%mm1 \n\t" - "movq (%%edi,%%ebx,), %%mm0 \n\t" - "movq 8(%%esi,%%ebx,), %%mm3 \n\t" - "paddb %%mm1, %%mm0 \n\t" - "movq 8(%%edi,%%ebx,), %%mm2 \n\t" - "movq %%mm0, (%%edi,%%ebx,) \n\t" - "paddb %%mm3, %%mm2 \n\t" - "movq 16(%%esi,%%ebx,), %%mm5 \n\t" - "movq %%mm2, 8(%%edi,%%ebx,) \n\t" - "movq 16(%%edi,%%ebx,), %%mm4 \n\t" - "movq 24(%%esi,%%ebx,), %%mm7 \n\t" - "paddb %%mm5, %%mm4 \n\t" - "movq 24(%%edi,%%ebx,), %%mm6 \n\t" - "movq %%mm4, 16(%%edi,%%ebx,) \n\t" - "paddb %%mm7, %%mm6 \n\t" - "movq 32(%%esi,%%ebx,), %%mm1 \n\t" - "movq %%mm6, 24(%%edi,%%ebx,) \n\t" - "movq 32(%%edi,%%ebx,), %%mm0 \n\t" - "movq 40(%%esi,%%ebx,), %%mm3 \n\t" - "paddb %%mm1, %%mm0 \n\t" - "movq 40(%%edi,%%ebx,), %%mm2 \n\t" - "movq %%mm0, 32(%%edi,%%ebx,) \n\t" - "paddb %%mm3, %%mm2 \n\t" - "movq 48(%%esi,%%ebx,), %%mm5 \n\t" - "movq %%mm2, 40(%%edi,%%ebx,) \n\t" - "movq 48(%%edi,%%ebx,), %%mm4 \n\t" - "movq 56(%%esi,%%ebx,), %%mm7 \n\t" - "paddb %%mm5, %%mm4 \n\t" - "movq 56(%%edi,%%ebx,), %%mm6 \n\t" - "movq %%mm4, 48(%%edi,%%ebx,) \n\t" - "addl $64, %%ebx \n\t" - "paddb %%mm7, %%mm6 \n\t" - "cmpl %%ecx, %%ebx \n\t" - "movq %%mm6, -8(%%edi,%%ebx,) \n\t" // (+56)movq does not affect flags; - "jb up_loop \n\t" // -8 to offset addl ebx - - "cmpl $0, %%edx \n\t" // test for bytes over mult of 64 - "jz up_end \n\t" - - "cmpl $8, %%edx \n\t" // test for less than 8 bytes - "jb up_lt8 \n\t" // [added by lcreeve at netins.net] - - "addl %%edx, %%ecx \n\t" - "andl $0x00000007, %%edx \n\t" // calc bytes over mult of 8 - "subl %%edx, %%ecx \n\t" // drop over bytes from length - "jz up_lt8 \n\t" - - "up_lpA: \n\t" // use MMX regs to update 8 bytes sim. - "movq (%%esi,%%ebx,), %%mm1 \n\t" - "movq (%%edi,%%ebx,), %%mm0 \n\t" - "addl $8, %%ebx \n\t" - "paddb %%mm1, %%mm0 \n\t" - "cmpl %%ecx, %%ebx \n\t" - "movq %%mm0, -8(%%edi,%%ebx,) \n\t" // movq does not affect flags; -8 to - "jb up_lpA \n\t" // offset add ebx - "cmpl $0, %%edx \n\t" // test for bytes over mult of 8 - "jz up_end \n\t" - - "up_lt8: \n\t" - "xorl %%eax, %%eax \n\t" - "addl %%edx, %%ecx \n\t" // move over byte count into counter - - "up_lp2: \n\t" // use x86 regs for remaining bytes - "movb (%%edi,%%ebx,), %%al \n\t" - "addb (%%esi,%%ebx,), %%al \n\t" - "incl %%ebx \n\t" - "cmpl %%ecx, %%ebx \n\t" - "movb %%al, -1(%%edi,%%ebx,) \n\t" // mov does not affect flags; -1 to - "jb up_lp2 \n\t" // offset inc ebx - - "up_end: \n\t" - "EMMS \n\t" // conversion of filtered row complete -#ifdef __PIC__ - "popl %%ebx \n\t" -#endif - - : "=d" (dummy_value_d), // 0 // output regs (dummy) - "=S" (dummy_value_S), // 1 - "=D" (dummy_value_D) // 2 - - : "0" (len), // edx // input regs - "1" (prev_row), // esi - "2" (row) // edi - - : "%eax", "%ecx" // clobber list (no input regs!) -#ifndef __PIC__ - , "%ebx" -#endif - -#if 0 /* MMX regs (%mm0, etc.) not supported by gcc 2.7.2.3 or egcs 1.1 */ - , "%mm0", "%mm1", "%mm2", "%mm3" - , "%mm4", "%mm5", "%mm6", "%mm7" -#endif - ); - -} // end of png_read_filter_row_mmx_up() - -#endif /* PNG_MMX_CODE_SUPPORTED */ - - - - -/*===========================================================================*/ -/* */ -/* P N G _ R E A D _ F I L T E R _ R O W */ -/* */ -/*===========================================================================*/ - - -/* Optimized png_read_filter_row routines */ - -void /* PRIVATE */ -png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep - row, png_bytep prev_row, int filter) -{ -#ifdef PNG_DEBUG - char filnm[10]; -#endif - -#if defined(PNG_MMX_CODE_SUPPORTED) -/* GRR: these are superseded by png_ptr->asm_flags: */ -#define UseMMX_sub 1 // GRR: converted 20000730 -#define UseMMX_up 1 // GRR: converted 20000729 -#define UseMMX_avg 1 // GRR: converted 20000828 (+ 16-bit bugfix 20000916) -#define UseMMX_paeth 1 // GRR: converted 20000828 - - if (_mmx_supported == 2) { - /* this should have happened in png_init_mmx_flags() already */ -#if !defined(PNG_1_0_X) - png_warning(png_ptr, "asm_flags may not have been initialized"); -#endif - png_mmx_support(); - } -#endif /* PNG_MMX_CODE_SUPPORTED */ - -#ifdef PNG_DEBUG - png_debug(1, "in png_read_filter_row (pnggccrd.c)\n"); - switch (filter) - { - case 0: sprintf(filnm, "none"); - break; - case 1: sprintf(filnm, "sub-%s", -#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) -#if !defined(PNG_1_0_X) - (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)? "MMX" : -#endif -#endif -"x86"); - break; - case 2: sprintf(filnm, "up-%s", -#ifdef PNG_MMX_CODE_SUPPORTED -#if !defined(PNG_1_0_X) - (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP)? "MMX" : -#endif -#endif - "x86"); - break; - case 3: sprintf(filnm, "avg-%s", -#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) -#if !defined(PNG_1_0_X) - (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)? "MMX" : -#endif -#endif - "x86"); - break; - case 4: sprintf(filnm, "Paeth-%s", -#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) -#if !defined(PNG_1_0_X) - (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)? "MMX": -#endif -#endif -"x86"); - break; - default: sprintf(filnm, "unknw"); - break; - } - png_debug2(0, "row_number=%5ld, %5s, ", png_ptr->row_number, filnm); - png_debug1(0, "row=0x%08lx, ", (unsigned long)row); - png_debug2(0, "pixdepth=%2d, bytes=%d, ", (int)row_info->pixel_depth, - (int)((row_info->pixel_depth + 7) >> 3)); - png_debug1(0,"rowbytes=%8ld\n", row_info->rowbytes); -#endif /* PNG_DEBUG */ - - switch (filter) - { - case PNG_FILTER_VALUE_NONE: - break; - - case PNG_FILTER_VALUE_SUB: -#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) -#if !defined(PNG_1_0_X) - if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB) && - (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && - (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold)) -#else - if (_mmx_supported) -#endif - { - png_read_filter_row_mmx_sub(row_info, row); - } - else -#endif /* PNG_MMX_CODE_SUPPORTED */ - { - png_uint_32 i; - png_uint_32 istop = row_info->rowbytes; - png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3; - png_bytep rp = row + bpp; - png_bytep lp = row; - - for (i = bpp; i < istop; i++) - { - *rp = (png_byte)(((int)(*rp) + (int)(*lp++)) & 0xff); - rp++; - } - } /* end !UseMMX_sub */ - break; - - case PNG_FILTER_VALUE_UP: -#if defined(PNG_MMX_CODE_SUPPORTED) -#if !defined(PNG_1_0_X) - if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP) && - (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && - (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold)) -#else - if (_mmx_supported) -#endif - { - png_read_filter_row_mmx_up(row_info, row, prev_row); - } - else -#endif /* PNG_MMX_CODE_SUPPORTED */ - { - png_uint_32 i; - png_uint_32 istop = row_info->rowbytes; - png_bytep rp = row; - png_bytep pp = prev_row; - - for (i = 0; i < istop; ++i) - { - *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff); - rp++; - } - } /* end !UseMMX_up */ - break; - - case PNG_FILTER_VALUE_AVG: -#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) -#if !defined(PNG_1_0_X) - if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG) && - (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && - (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold)) -#else - if (_mmx_supported) -#endif - { - png_read_filter_row_mmx_avg(row_info, row, prev_row); - } - else -#endif /* PNG_MMX_CODE_SUPPORTED */ - { - png_uint_32 i; - png_bytep rp = row; - png_bytep pp = prev_row; - png_bytep lp = row; - png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3; - png_uint_32 istop = row_info->rowbytes - bpp; - - for (i = 0; i < bpp; i++) - { - *rp = (png_byte)(((int)(*rp) + - ((int)(*pp++) >> 1)) & 0xff); - rp++; - } - - for (i = 0; i < istop; i++) - { - *rp = (png_byte)(((int)(*rp) + - ((int)(*pp++ + *lp++) >> 1)) & 0xff); - rp++; - } - } /* end !UseMMX_avg */ - break; - - case PNG_FILTER_VALUE_PAETH: -#if defined(PNG_MMX_CODE_SUPPORTED) && defined(PNG_THREAD_UNSAFE_OK) -#if !defined(PNG_1_0_X) - if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH) && - (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && - (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold)) -#else - if (_mmx_supported) -#endif - { - png_read_filter_row_mmx_paeth(row_info, row, prev_row); - } - else -#endif /* PNG_MMX_CODE_SUPPORTED */ - { - png_uint_32 i; - png_bytep rp = row; - png_bytep pp = prev_row; - png_bytep lp = row; - png_bytep cp = prev_row; - png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3; - png_uint_32 istop = row_info->rowbytes - bpp; - - for (i = 0; i < bpp; i++) - { - *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff); - rp++; - } - - for (i = 0; i < istop; i++) /* use leftover rp,pp */ - { - int a, b, c, pa, pb, pc, p; - - a = *lp++; - b = *pp++; - c = *cp++; - - p = b - c; - pc = a - c; - -#ifdef PNG_USE_ABS - pa = abs(p); - pb = abs(pc); - pc = abs(p + pc); -#else - pa = p < 0 ? -p : p; - pb = pc < 0 ? -pc : pc; - pc = (p + pc) < 0 ? -(p + pc) : p + pc; -#endif - - /* - if (pa <= pb && pa <= pc) - p = a; - else if (pb <= pc) - p = b; - else - p = c; - */ - - p = (pa <= pb && pa <= pc) ? a : (pb <= pc) ? b : c; - - *rp = (png_byte)(((int)(*rp) + p) & 0xff); - rp++; - } - } /* end !UseMMX_paeth */ - break; - - default: - png_warning(png_ptr, "Ignoring bad row-filter type"); - *row=0; - break; - } -} - -#endif /* PNG_HAVE_MMX_READ_FILTER_ROW */ - - -/*===========================================================================*/ -/* */ -/* P N G _ M M X _ S U P P O R T */ -/* */ -/*===========================================================================*/ - -/* GRR NOTES: (1) the following code assumes 386 or better (pushfl/popfl) - * (2) all instructions compile with gcc 2.7.2.3 and later - * (3) the function is moved down here to prevent gcc from - * inlining it in multiple places and then barfing be- - * cause the ".NOT_SUPPORTED" label is multiply defined - * [is there a way to signal that a *single* function should - * not be inlined? is there a way to modify the label for - * each inlined instance, e.g., by appending _1, _2, etc.? - * maybe if don't use leading "." in label name? (nope...sigh)] - */ - -int PNGAPI -png_mmx_support(void) -{ -#if defined(PNG_MMX_CODE_SUPPORTED) - int result; - __asm__ __volatile__ ( - "pushl %%ebx \n\t" // ebx gets clobbered by CPUID instruction - "pushl %%ecx \n\t" // so does ecx... - "pushl %%edx \n\t" // ...and edx (but ecx & edx safe on Linux) -// ".byte 0x66 \n\t" // convert 16-bit pushf to 32-bit pushfd -// "pushf \n\t" // 16-bit pushf - "pushfl \n\t" // save Eflag to stack - "popl %%eax \n\t" // get Eflag from stack into eax - "movl %%eax, %%ecx \n\t" // make another copy of Eflag in ecx - "xorl $0x200000, %%eax \n\t" // toggle ID bit in Eflag (i.e., bit 21) - "pushl %%eax \n\t" // save modified Eflag back to stack -// ".byte 0x66 \n\t" // convert 16-bit popf to 32-bit popfd -// "popf \n\t" // 16-bit popf - "popfl \n\t" // restore modified value to Eflag reg - "pushfl \n\t" // save Eflag to stack - "popl %%eax \n\t" // get Eflag from stack - "pushl %%ecx \n\t" // save original Eflag to stack - "popfl \n\t" // restore original Eflag - "xorl %%ecx, %%eax \n\t" // compare new Eflag with original Eflag - "jz 0f \n\t" // if same, CPUID instr. is not supported - - "xorl %%eax, %%eax \n\t" // set eax to zero -// ".byte 0x0f, 0xa2 \n\t" // CPUID instruction (two-byte opcode) - "cpuid \n\t" // get the CPU identification info - "cmpl $1, %%eax \n\t" // make sure eax return non-zero value - "jl 0f \n\t" // if eax is zero, MMX is not supported - - "xorl %%eax, %%eax \n\t" // set eax to zero and... - "incl %%eax \n\t" // ...increment eax to 1. This pair is - // faster than the instruction "mov eax, 1" - "cpuid \n\t" // get the CPU identification info again - "andl $0x800000, %%edx \n\t" // mask out all bits but MMX bit (23) - "cmpl $0, %%edx \n\t" // 0 = MMX not supported - "jz 0f \n\t" // non-zero = yes, MMX IS supported - - "movl $1, %%eax \n\t" // set return value to 1 - "jmp 1f \n\t" // DONE: have MMX support - - "0: \n\t" // .NOT_SUPPORTED: target label for jump instructions - "movl $0, %%eax \n\t" // set return value to 0 - "1: \n\t" // .RETURN: target label for jump instructions - "popl %%edx \n\t" // restore edx - "popl %%ecx \n\t" // restore ecx - "popl %%ebx \n\t" // restore ebx - -// "ret \n\t" // DONE: no MMX support - // (fall through to standard C "ret") - - : "=a" (result) // output list - - : // any variables used on input (none) - - // no clobber list -// , "%ebx", "%ecx", "%edx" // GRR: we handle these manually -// , "memory" // if write to a variable gcc thought was in a reg -// , "cc" // "condition codes" (flag bits) - ); - _mmx_supported = result; -#else - _mmx_supported = 0; -#endif /* PNG_MMX_CODE_SUPPORTED */ - - return _mmx_supported; -} - - -#endif /* PNG_USE_PNGGCCRD */ diff --git a/src/dep/src/irrlicht/libpng/pngget.c b/src/dep/src/irrlicht/libpng/pngget.c index 3fb160b..cf639d0 100644 --- a/src/dep/src/irrlicht/libpng/pngget.c +++ b/src/dep/src/irrlicht/libpng/pngget.c @@ -113,907 +113,6 @@ png_get_compression_type(png_structp png_ptr, png_infop info_ptr) return (0); } -png_uint_32 PNGAPI -png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) -{ - if (png_ptr != NULL && info_ptr != NULL) -#if defined(PNG_pHYs_SUPPORTED) - if (info_ptr->valid & PNG_INFO_pHYs) - { - png_debug1(1, "in %s retrieval function", "png_get_x_pixels_per_meter"); - if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER) - return (0); - else return (info_ptr->x_pixels_per_unit); - } -#else - return (0); -#endif - return (0); -} - -png_uint_32 PNGAPI -png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) -{ - if (png_ptr != NULL && info_ptr != NULL) -#if defined(PNG_pHYs_SUPPORTED) - if (info_ptr->valid & PNG_INFO_pHYs) - { - png_debug1(1, "in %s retrieval function", "png_get_y_pixels_per_meter"); - if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER) - return (0); - else return (info_ptr->y_pixels_per_unit); - } -#else - return (0); -#endif - return (0); -} - -png_uint_32 PNGAPI -png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) -{ - if (png_ptr != NULL && info_ptr != NULL) -#if defined(PNG_pHYs_SUPPORTED) - if (info_ptr->valid & PNG_INFO_pHYs) - { - png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter"); - if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER || - info_ptr->x_pixels_per_unit != info_ptr->y_pixels_per_unit) - return (0); - else return (info_ptr->x_pixels_per_unit); - } -#else - return (0); -#endif - return (0); -} - -#ifdef PNG_FLOATING_POINT_SUPPORTED -float PNGAPI -png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr) - { - if (png_ptr != NULL && info_ptr != NULL) -#if defined(PNG_pHYs_SUPPORTED) - if (info_ptr->valid & PNG_INFO_pHYs) - { - png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio"); - if (info_ptr->x_pixels_per_unit == 0) - return ((float)0.0); - else - return ((float)((float)info_ptr->y_pixels_per_unit - /(float)info_ptr->x_pixels_per_unit)); - } -#else - return (0.0); -#endif - return ((float)0.0); -} -#endif - -png_int_32 PNGAPI -png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr) -{ - if (png_ptr != NULL && info_ptr != NULL) -#if defined(PNG_oFFs_SUPPORTED) - if (info_ptr->valid & PNG_INFO_oFFs) - { - png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns"); - if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER) - return (0); - else return (info_ptr->x_offset); - } -#else - return (0); -#endif - return (0); -} - -png_int_32 PNGAPI -png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr) -{ - if (png_ptr != NULL && info_ptr != NULL) -#if defined(PNG_oFFs_SUPPORTED) - if (info_ptr->valid & PNG_INFO_oFFs) - { - png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns"); - if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER) - return (0); - else return (info_ptr->y_offset); - } -#else - return (0); -#endif - return (0); -} - -png_int_32 PNGAPI -png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr) -{ - if (png_ptr != NULL && info_ptr != NULL) -#if defined(PNG_oFFs_SUPPORTED) - if (info_ptr->valid & PNG_INFO_oFFs) - { - png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns"); - if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL) - return (0); - else return (info_ptr->x_offset); - } -#else - return (0); -#endif - return (0); -} - -png_int_32 PNGAPI -png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr) -{ - if (png_ptr != NULL && info_ptr != NULL) -#if defined(PNG_oFFs_SUPPORTED) - if (info_ptr->valid & PNG_INFO_oFFs) - { - png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns"); - if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL) - return (0); - else return (info_ptr->y_offset); - } -#else - return (0); -#endif - return (0); -} - -#if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED) -png_uint_32 PNGAPI -png_get_pixels_per_inch(png_structp png_ptr, png_infop info_ptr) -{ - return ((png_uint_32)((float)png_get_pixels_per_meter(png_ptr, info_ptr) - *.0254 +.5)); -} - -png_uint_32 PNGAPI -png_get_x_pixels_per_inch(png_structp png_ptr, png_infop info_ptr) -{ - return ((png_uint_32)((float)png_get_x_pixels_per_meter(png_ptr, info_ptr) - *.0254 +.5)); -} - -png_uint_32 PNGAPI -png_get_y_pixels_per_inch(png_structp png_ptr, png_infop info_ptr) -{ - return ((png_uint_32)((float)png_get_y_pixels_per_meter(png_ptr, info_ptr) - *.0254 +.5)); -} - -float PNGAPI -png_get_x_offset_inches(png_structp png_ptr, png_infop info_ptr) -{ - return ((float)png_get_x_offset_microns(png_ptr, info_ptr) - *.00003937); -} - -float PNGAPI -png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr) -{ - return ((float)png_get_y_offset_microns(png_ptr, info_ptr) - *.00003937); -} - -#if defined(PNG_pHYs_SUPPORTED) -png_uint_32 PNGAPI -png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr, - png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type) -{ - png_uint_32 retval = 0; - - if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) - { - png_debug1(1, "in %s retrieval function", "pHYs"); - if (res_x != NULL) - { - *res_x = info_ptr->x_pixels_per_unit; - retval |= PNG_INFO_pHYs; - } - if (res_y != NULL) - { - *res_y = info_ptr->y_pixels_per_unit; - retval |= PNG_INFO_pHYs; - } - if (unit_type != NULL) - { - *unit_type = (int)info_ptr->phys_unit_type; - retval |= PNG_INFO_pHYs; - if (*unit_type == 1) - { - if (res_x != NULL) *res_x = (png_uint_32)(*res_x * .0254 + .50); - if (res_y != NULL) *res_y = (png_uint_32)(*res_y * .0254 + .50); - } - } - } - return (retval); -} -#endif /* PNG_pHYs_SUPPORTED */ -#endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */ - -/* png_get_channels really belongs in here, too, but it's been around longer */ - -#endif /* PNG_EASY_ACCESS_SUPPORTED */ - -png_byte PNGAPI -png_get_channels(png_structp png_ptr, png_infop info_ptr) -{ - if (png_ptr != NULL && info_ptr != NULL) - return(info_ptr->channels); - else - return (0); -} - -png_bytep PNGAPI -png_get_signature(png_structp png_ptr, png_infop info_ptr) -{ - if (png_ptr != NULL && info_ptr != NULL) - return(info_ptr->signature); - else - return (NULL); -} - -#if defined(PNG_bKGD_SUPPORTED) -png_uint_32 PNGAPI -png_get_bKGD(png_structp png_ptr, png_infop info_ptr, - png_color_16p *background) -{ - if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD) - && background != NULL) - { - png_debug1(1, "in %s retrieval function", "bKGD"); - *background = &(info_ptr->background); - return (PNG_INFO_bKGD); - } - return (0); -} -#endif - -#if defined(PNG_cHRM_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED -png_uint_32 PNGAPI -png_get_cHRM(png_structp png_ptr, png_infop info_ptr, - double *white_x, double *white_y, double *red_x, double *red_y, - double *green_x, double *green_y, double *blue_x, double *blue_y) -{ - if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM)) - { - png_debug1(1, "in %s retrieval function", "cHRM"); - if (white_x != NULL) - *white_x = (double)info_ptr->x_white; - if (white_y != NULL) - *white_y = (double)info_ptr->y_white; - if (red_x != NULL) - *red_x = (double)info_ptr->x_red; - if (red_y != NULL) - *red_y = (double)info_ptr->y_red; - if (green_x != NULL) - *green_x = (double)info_ptr->x_green; - if (green_y != NULL) - *green_y = (double)info_ptr->y_green; - if (blue_x != NULL) - *blue_x = (double)info_ptr->x_blue; - if (blue_y != NULL) - *blue_y = (double)info_ptr->y_blue; - return (PNG_INFO_cHRM); - } - return (0); -} -#endif -#ifdef PNG_FIXED_POINT_SUPPORTED -png_uint_32 PNGAPI -png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr, - png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x, - png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y, - png_fixed_point *blue_x, png_fixed_point *blue_y) -{ - if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM)) - { - png_debug1(1, "in %s retrieval function", "cHRM"); - if (white_x != NULL) - *white_x = info_ptr->int_x_white; - if (white_y != NULL) - *white_y = info_ptr->int_y_white; - if (red_x != NULL) - *red_x = info_ptr->int_x_red; - if (red_y != NULL) - *red_y = info_ptr->int_y_red; - if (green_x != NULL) - *green_x = info_ptr->int_x_green; - if (green_y != NULL) - *green_y = info_ptr->int_y_green; - if (blue_x != NULL) - *blue_x = info_ptr->int_x_blue; - if (blue_y != NULL) - *blue_y = info_ptr->int_y_blue; - return (PNG_INFO_cHRM); - } - return (0); -} -#endif -#endif - -#if defined(PNG_gAMA_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED -png_uint_32 PNGAPI -png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma) -{ - if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA) - && file_gamma != NULL) - { - png_debug1(1, "in %s retrieval function", "gAMA"); - *file_gamma = (double)info_ptr->gamma; - return (PNG_INFO_gAMA); - } - return (0); -} -#endif -#ifdef PNG_FIXED_POINT_SUPPORTED -png_uint_32 PNGAPI -png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, - png_fixed_point *int_file_gamma) -{ - if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA) - && int_file_gamma != NULL) - { - png_debug1(1, "in %s retrieval function", "gAMA"); - *int_file_gamma = info_ptr->int_gamma; - return (PNG_INFO_gAMA); - } - return (0); -} -#endif -#endif - -#if defined(PNG_sRGB_SUPPORTED) -png_uint_32 PNGAPI -png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent) -{ - if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB) - && file_srgb_intent != NULL) - { - png_debug1(1, "in %s retrieval function", "sRGB"); - *file_srgb_intent = (int)info_ptr->srgb_intent; - return (PNG_INFO_sRGB); - } - return (0); -} -#endif - -#if defined(PNG_iCCP_SUPPORTED) -png_uint_32 PNGAPI -png_get_iCCP(png_structp png_ptr, png_infop info_ptr, - png_charpp name, int *compression_type, - png_charpp profile, png_uint_32 *proflen) -{ - if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP) - && name != NULL && profile != NULL && proflen != NULL) - { - png_debug1(1, "in %s retrieval function", "iCCP"); - *name = info_ptr->iccp_name; - *profile = info_ptr->iccp_profile; - /* compression_type is a dummy so the API won't have to change - if we introduce multiple compression types later. */ - *proflen = (int)info_ptr->iccp_proflen; - *compression_type = (int)info_ptr->iccp_compression; - return (PNG_INFO_iCCP); - } - return (0); -} -#endif - -#if defined(PNG_sPLT_SUPPORTED) -png_uint_32 PNGAPI -png_get_sPLT(png_structp png_ptr, png_infop info_ptr, - png_sPLT_tpp spalettes) -{ - if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL) - { - *spalettes = info_ptr->splt_palettes; - return ((png_uint_32)info_ptr->splt_palettes_num); - } - return (0); -} -#endif - -#if defined(PNG_hIST_SUPPORTED) -png_uint_32 PNGAPI -png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist) -{ - if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST) - && hist != NULL) - { - png_debug1(1, "in %s retrieval function", "hIST"); - *hist = info_ptr->hist; - return (PNG_INFO_hIST); - } - return (0); -} -#endif - -png_uint_32 PNGAPI -png_get_IHDR(png_structp png_ptr, png_infop info_ptr, - png_uint_32 *width, png_uint_32 *height, int *bit_depth, - int *color_type, int *interlace_type, int *compression_type, - int *filter_type) - -{ - if (png_ptr != NULL && info_ptr != NULL && width != NULL && height != NULL && - bit_depth != NULL && color_type != NULL) - { - png_debug1(1, "in %s retrieval function", "IHDR"); - *width = info_ptr->width; - *height = info_ptr->height; - *bit_depth = info_ptr->bit_depth; - if (info_ptr->bit_depth < 1 || info_ptr->bit_depth > 16) - png_error(png_ptr, "Invalid bit depth"); - *color_type = info_ptr->color_type; - if (info_ptr->color_type > 6) - png_error(png_ptr, "Invalid color type"); - if (compression_type != NULL) - *compression_type = info_ptr->compression_type; - if (filter_type != NULL) - *filter_type = info_ptr->filter_type; - if (interlace_type != NULL) - *interlace_type = info_ptr->interlace_type; - - /* check for potential overflow of rowbytes */ - if (*width == 0 || *width > PNG_UINT_31_MAX) - png_error(png_ptr, "Invalid image width"); - if (*height == 0 || *height > PNG_UINT_31_MAX) - png_error(png_ptr, "Invalid image height"); - if (info_ptr->width > (PNG_UINT_32_MAX - >> 3) /* 8-byte RGBA pixels */ - - 64 /* bigrowbuf hack */ - - 1 /* filter byte */ - - 7*8 /* rounding of width to multiple of 8 pixels */ - - 8) /* extra max_pixel_depth pad */ - { - png_warning(png_ptr, - "Width too large for libpng to process image data."); - } - return (1); - } - return (0); -} - -#if defined(PNG_oFFs_SUPPORTED) -png_uint_32 PNGAPI -png_get_oFFs(png_structp png_ptr, png_infop info_ptr, - png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type) -{ - if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs) - && offset_x != NULL && offset_y != NULL && unit_type != NULL) - { - png_debug1(1, "in %s retrieval function", "oFFs"); - *offset_x = info_ptr->x_offset; - *offset_y = info_ptr->y_offset; - *unit_type = (int)info_ptr->offset_unit_type; - return (PNG_INFO_oFFs); - } - return (0); -} -#endif - -#if defined(PNG_pCAL_SUPPORTED) -png_uint_32 PNGAPI -png_get_pCAL(png_structp png_ptr, png_infop info_ptr, - png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams, - png_charp *units, png_charpp *params) -{ - if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL) - && purpose != NULL && X0 != NULL && X1 != NULL && type != NULL && - nparams != NULL && units != NULL && params != NULL) - { - png_debug1(1, "in %s retrieval function", "pCAL"); - *purpose = info_ptr->pcal_purpose; - *X0 = info_ptr->pcal_X0; - *X1 = info_ptr->pcal_X1; - *type = (int)info_ptr->pcal_type; - *nparams = (int)info_ptr->pcal_nparams; - *units = info_ptr->pcal_units; - *params = info_ptr->pcal_params; - return (PNG_INFO_pCAL); - } - return (0); -} -#endif - -#if defined(PNG_sCAL_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED -png_uint_32 PNGAPI -png_get_sCAL(png_structp png_ptr, png_infop info_ptr, - int *unit, double *width, double *height) -{ - if (png_ptr != NULL && info_ptr != NULL && - (info_ptr->valid & PNG_INFO_sCAL)) - { - *unit = info_ptr->scal_unit; - *width = info_ptr->scal_pixel_width; - *height = info_ptr->scal_pixel_height; - return (PNG_INFO_sCAL); - } - return(0); -} -#else -#ifdef PNG_FIXED_POINT_SUPPORTED -png_uint_32 PNGAPI -png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr, - int *unit, png_charpp width, png_charpp height) -{ - if (png_ptr != NULL && info_ptr != NULL && - (info_ptr->valid & PNG_INFO_sCAL)) - { - *unit = info_ptr->scal_unit; - *width = info_ptr->scal_s_width; - *height = info_ptr->scal_s_height; - return (PNG_INFO_sCAL); - } - return(0); -} -#endif -#endif -#endif - -#if defined(PNG_pHYs_SUPPORTED) -png_uint_32 PNGAPI -png_get_pHYs(png_structp png_ptr, png_infop info_ptr, - png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type) -{ - png_uint_32 retval = 0; - - if (png_ptr != NULL && info_ptr != NULL && - (info_ptr->valid & PNG_INFO_pHYs)) - { - png_debug1(1, "in %s retrieval function", "pHYs"); - if (res_x != NULL) - { - *res_x = info_ptr->x_pixels_per_unit; - retval |= PNG_INFO_pHYs; - } - if (res_y != NULL) - { - *res_y = info_ptr->y_pixels_per_unit; - retval |= PNG_INFO_pHYs; - } - if (unit_type != NULL) - { - *unit_type = (int)info_ptr->phys_unit_type; - retval |= PNG_INFO_pHYs; - } - } - return (retval); -} -#endif - -png_uint_32 PNGAPI -png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette, - int *num_palette) -{ - if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE) - && palette != NULL) - { - png_debug1(1, "in %s retrieval function", "PLTE"); - *palette = info_ptr->palette; - *num_palette = info_ptr->num_palette; - png_debug1(3, "num_palette = %d", *num_palette); - return (PNG_INFO_PLTE); - } - return (0); -} - -#if defined(PNG_sBIT_SUPPORTED) -png_uint_32 PNGAPI -png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit) -{ - if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT) - && sig_bit != NULL) - { - png_debug1(1, "in %s retrieval function", "sBIT"); - *sig_bit = &(info_ptr->sig_bit); - return (PNG_INFO_sBIT); - } - return (0); -} -#endif - -#if defined(PNG_TEXT_SUPPORTED) -png_uint_32 PNGAPI -png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr, - int *num_text) -{ - if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0) - { - png_debug1(1, "in %s retrieval function", - (png_ptr->chunk_name[0] == '\0' ? "text" - : (png_const_charp)png_ptr->chunk_name)); - if (text_ptr != NULL) - *text_ptr = info_ptr->text; - if (num_text != NULL) - *num_text = info_ptr->num_text; - return ((png_uint_32)info_ptr->num_text); - } - if (num_text != NULL) - *num_text = 0; - return(0); -} -#endif - -#if defined(PNG_tIME_SUPPORTED) -png_uint_32 PNGAPI -png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time) -{ - if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME) - && mod_time != NULL) - { - png_debug1(1, "in %s retrieval function", "tIME"); - *mod_time = &(info_ptr->mod_time); - return (PNG_INFO_tIME); - } - return (0); -} -#endif - -#if defined(PNG_tRNS_SUPPORTED) -png_uint_32 PNGAPI -png_get_tRNS(png_structp png_ptr, png_infop info_ptr, - png_bytep *trans, int *num_trans, png_color_16p *trans_values) -{ - png_uint_32 retval = 0; - if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS)) - { - png_debug1(1, "in %s retrieval function", "tRNS"); - if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) - { - if (trans != NULL) - { - *trans = info_ptr->trans; - retval |= PNG_INFO_tRNS; - } - if (trans_values != NULL) - *trans_values = &(info_ptr->trans_values); - } - else /* if (info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) */ - { - if (trans_values != NULL) - { - *trans_values = &(info_ptr->trans_values); - retval |= PNG_INFO_tRNS; - } - if (trans != NULL) - *trans = NULL; - } - if (num_trans != NULL) - { - *num_trans = info_ptr->num_trans; - retval |= PNG_INFO_tRNS; - } - } - return (retval); -} -#endif - -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) -png_uint_32 PNGAPI -png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr, - png_unknown_chunkpp unknowns) -{ - if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL) - { - *unknowns = info_ptr->unknown_chunks; - return ((png_uint_32)info_ptr->unknown_chunks_num); - } - return (0); -} -#endif - -#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) -png_byte PNGAPI -png_get_rgb_to_gray_status (png_structp png_ptr) -{ - return (png_byte)(png_ptr? png_ptr->rgb_to_gray_status : 0); -} -#endif - -#if defined(PNG_USER_CHUNKS_SUPPORTED) -png_voidp PNGAPI -png_get_user_chunk_ptr(png_structp png_ptr) -{ - return (png_ptr? png_ptr->user_chunk_ptr : NULL); -} -#endif - -#ifdef PNG_WRITE_SUPPORTED -png_uint_32 PNGAPI -png_get_compression_buffer_size(png_structp png_ptr) -{ - return (png_uint_32)(png_ptr? png_ptr->zbuf_size : 0L); -} -#endif - -#ifdef PNG_ASSEMBLER_CODE_SUPPORTED -#ifndef PNG_1_0_X -/* this function was added to libpng 1.2.0 and should exist by default */ -png_uint_32 PNGAPI -png_get_asm_flags (png_structp png_ptr) -{ - /* obsolete, to be removed from libpng-1.4.0 */ - return (png_ptr? 0L: 0L); -} - -/* this function was added to libpng 1.2.0 and should exist by default */ -png_uint_32 PNGAPI -png_get_asm_flagmask (int flag_select) -{ - /* obsolete, to be removed from libpng-1.4.0 */ - flag_select=flag_select; - return 0L; -} - - /* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */ -/* this function was added to libpng 1.2.0 */ -png_uint_32 PNGAPI -png_get_mmx_flagmask (int flag_select, int *compilerID) -{ - /* obsolete, to be removed from libpng-1.4.0 */ - flag_select=flag_select; - *compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */ - return 0L; -} - -/* this function was added to libpng 1.2.0 */ -png_byte PNGAPI -png_get_mmx_bitdepth_threshold (png_structp png_ptr) -{ - /* obsolete, to be removed from libpng-1.4.0 */ - return (png_ptr? 0: 0); -} - -/* this function was added to libpng 1.2.0 */ -png_uint_32 PNGAPI -png_get_mmx_rowbytes_threshold (png_structp png_ptr) -{ - /* obsolete, to be removed from libpng-1.4.0 */ - return (png_ptr? 0L: 0L); -} -#endif /* ?PNG_1_0_X */ -#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */ - -#ifdef PNG_SET_USER_LIMITS_SUPPORTED -/* These functions were added to libpng 1.2.6 */ -png_uint_32 PNGAPI -png_get_user_width_max (png_structp png_ptr) -{ - return (png_ptr? png_ptr->user_width_max : 0); -} -png_uint_32 PNGAPI -png_get_user_height_max (png_structp png_ptr) -{ - return (png_ptr? png_ptr->user_height_max : 0); -} -#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */ - - -#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ - -/* pngget.c - retrieval of values from info struct - * - * Last changed in libpng 1.2.15 January 5, 2007 - * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - */ - -#define PNG_INTERNAL -#include "png.h" - -#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) - -png_uint_32 PNGAPI -png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag) -{ - if (png_ptr != NULL && info_ptr != NULL) - return(info_ptr->valid & flag); - else - return(0); -} - -png_uint_32 PNGAPI -png_get_rowbytes(png_structp png_ptr, png_infop info_ptr) -{ - if (png_ptr != NULL && info_ptr != NULL) - return(info_ptr->rowbytes); - else - return(0); -} - -#if defined(PNG_INFO_IMAGE_SUPPORTED) -png_bytepp PNGAPI -png_get_rows(png_structp png_ptr, png_infop info_ptr) -{ - if (png_ptr != NULL && info_ptr != NULL) - return(info_ptr->row_pointers); - else - return(0); -} -#endif - -#ifdef PNG_EASY_ACCESS_SUPPORTED -/* easy access to info, added in libpng-0.99 */ -png_uint_32 PNGAPI -png_get_image_width(png_structp png_ptr, png_infop info_ptr) -{ - if (png_ptr != NULL && info_ptr != NULL) - { - return info_ptr->width; - } - return (0); -} - -png_uint_32 PNGAPI -png_get_image_height(png_structp png_ptr, png_infop info_ptr) -{ - if (png_ptr != NULL && info_ptr != NULL) - { - return info_ptr->height; - } - return (0); -} - -png_byte PNGAPI -png_get_bit_depth(png_structp png_ptr, png_infop info_ptr) -{ - if (png_ptr != NULL && info_ptr != NULL) - { - return info_ptr->bit_depth; - } - return (0); -} - -png_byte PNGAPI -png_get_color_type(png_structp png_ptr, png_infop info_ptr) -{ - if (png_ptr != NULL && info_ptr != NULL) - { - return info_ptr->color_type; - } - return (0); -} - -png_byte PNGAPI -png_get_filter_type(png_structp png_ptr, png_infop info_ptr) -{ - if (png_ptr != NULL && info_ptr != NULL) - { - return info_ptr->filter_type; - } - return (0); -} - -png_byte PNGAPI -png_get_interlace_type(png_structp png_ptr, png_infop info_ptr) -{ - if (png_ptr != NULL && info_ptr != NULL) - { - return info_ptr->interlace_type; - } - return (0); -} - -png_byte PNGAPI -png_get_compression_type(png_structp png_ptr, png_infop info_ptr) -{ - if (png_ptr != NULL && info_ptr != NULL) - { - return info_ptr->compression_type; - } - return (0); -} - png_uint_32 PNGAPI png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) { @@ -1022,7 +121,7 @@ png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) if (info_ptr->valid & PNG_INFO_pHYs) { png_debug1(1, "in %s retrieval function\n", "png_get_x_pixels_per_meter"); - if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER) + if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER) return (0); else return (info_ptr->x_pixels_per_unit); } @@ -1040,7 +139,7 @@ png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) if (info_ptr->valid & PNG_INFO_pHYs) { png_debug1(1, "in %s retrieval function\n", "png_get_y_pixels_per_meter"); - if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER) + if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER) return (0); else return (info_ptr->y_pixels_per_unit); } @@ -1058,7 +157,7 @@ png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) if (info_ptr->valid & PNG_INFO_pHYs) { png_debug1(1, "in %s retrieval function\n", "png_get_pixels_per_meter"); - if(info_ptr->phys_unit_type != PNG_RESOLUTION_METER || + if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER || info_ptr->x_pixels_per_unit != info_ptr->y_pixels_per_unit) return (0); else return (info_ptr->x_pixels_per_unit); @@ -1099,7 +198,7 @@ png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr) if (info_ptr->valid & PNG_INFO_oFFs) { png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns"); - if(info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER) + if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER) return (0); else return (info_ptr->x_offset); } @@ -1117,7 +216,7 @@ png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr) if (info_ptr->valid & PNG_INFO_oFFs) { png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns"); - if(info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER) + if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER) return (0); else return (info_ptr->y_offset); } @@ -1135,7 +234,7 @@ png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr) if (info_ptr->valid & PNG_INFO_oFFs) { png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns"); - if(info_ptr->offset_unit_type != PNG_OFFSET_PIXEL) + if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL) return (0); else return (info_ptr->x_offset); } @@ -1153,7 +252,7 @@ png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr) if (info_ptr->valid & PNG_INFO_oFFs) { png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns"); - if(info_ptr->offset_unit_type != PNG_OFFSET_PIXEL) + if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL) return (0); else return (info_ptr->y_offset); } @@ -1223,7 +322,7 @@ png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr, { *unit_type = (int)info_ptr->phys_unit_type; retval |= PNG_INFO_pHYs; - if(*unit_type == 1) + if (*unit_type == 1) { if (res_x != NULL) *res_x = (png_uint_32)(*res_x * .0254 + .50); if (res_y != NULL) *res_y = (png_uint_32)(*res_y * .0254 + .50); @@ -1412,8 +511,11 @@ png_get_sPLT(png_structp png_ptr, png_infop info_ptr, png_sPLT_tpp spalettes) { if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL) + { *spalettes = info_ptr->splt_palettes; - return ((png_uint_32)info_ptr->splt_palettes_num); + return ((png_uint_32)info_ptr->splt_palettes_num); + } + return (0); } #endif @@ -1681,10 +783,10 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr, *trans_values = &(info_ptr->trans_values); retval |= PNG_INFO_tRNS; } - if(trans != NULL) + if (trans != NULL) *trans = NULL; } - if(num_trans != NULL) + if (num_trans != NULL) { *num_trans = info_ptr->num_trans; retval |= PNG_INFO_tRNS; @@ -1700,8 +802,11 @@ png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr, png_unknown_chunkpp unknowns) { if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL) + { *unknowns = info_ptr->unknown_chunks; - return ((png_uint_32)info_ptr->unknown_chunks_num); + return ((png_uint_32)info_ptr->unknown_chunks_num); + } + return (0); } #endif @@ -1735,105 +840,44 @@ png_get_compression_buffer_size(png_structp png_ptr) png_uint_32 PNGAPI png_get_asm_flags (png_structp png_ptr) { -#ifdef PNG_MMX_CODE_SUPPORTED - return (png_uint_32)(png_ptr? png_ptr->asm_flags : 0L); -#else + /* obsolete, to be removed from libpng-1.4.0 */ return (png_ptr? 0L: 0L); -#endif } /* this function was added to libpng 1.2.0 and should exist by default */ png_uint_32 PNGAPI png_get_asm_flagmask (int flag_select) { -#ifdef PNG_MMX_CODE_SUPPORTED - png_uint_32 settable_asm_flags = 0; - - if (flag_select & PNG_SELECT_READ) - settable_asm_flags |= - PNG_ASM_FLAG_MMX_READ_COMBINE_ROW | - PNG_ASM_FLAG_MMX_READ_INTERLACE | - PNG_ASM_FLAG_MMX_READ_FILTER_SUB | - PNG_ASM_FLAG_MMX_READ_FILTER_UP | - PNG_ASM_FLAG_MMX_READ_FILTER_AVG | - PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ; - /* no non-MMX flags yet */ - -#if 0 - /* GRR: no write-flags yet, either, but someday... */ - if (flag_select & PNG_SELECT_WRITE) - settable_asm_flags |= - PNG_ASM_FLAG_MMX_WRITE_ [whatever] ; -#endif /* 0 */ - - return settable_asm_flags; /* _theoretically_ settable capabilities only */ -#else - return (0L); -#endif /* PNG_MMX_CODE_SUPPORTED */ + /* obsolete, to be removed from libpng-1.4.0 */ + flag_select=flag_select; + return 0L; } - /* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */ /* this function was added to libpng 1.2.0 */ png_uint_32 PNGAPI png_get_mmx_flagmask (int flag_select, int *compilerID) { -#if defined(PNG_MMX_CODE_SUPPORTED) - png_uint_32 settable_mmx_flags = 0; - - if (flag_select & PNG_SELECT_READ) - settable_mmx_flags |= - PNG_ASM_FLAG_MMX_READ_COMBINE_ROW | - PNG_ASM_FLAG_MMX_READ_INTERLACE | - PNG_ASM_FLAG_MMX_READ_FILTER_SUB | - PNG_ASM_FLAG_MMX_READ_FILTER_UP | - PNG_ASM_FLAG_MMX_READ_FILTER_AVG | - PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ; -#if 0 - /* GRR: no MMX write support yet, but someday... */ - if (flag_select & PNG_SELECT_WRITE) - settable_mmx_flags |= - PNG_ASM_FLAG_MMX_WRITE_ [whatever] ; -#endif /* 0 */ - - if (compilerID != NULL) { -#ifdef PNG_USE_PNGVCRD - *compilerID = 1; /* MSVC */ -#else -#ifdef PNG_USE_PNGGCCRD - *compilerID = 2; /* gcc/gas */ -#else - *compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */ -#endif -#endif - } - - return settable_mmx_flags; /* _theoretically_ settable capabilities only */ -#else - return (0L); -#endif /* ?PNG_MMX_CODE_SUPPORTED */ + /* obsolete, to be removed from libpng-1.4.0 */ + flag_select=flag_select; + *compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */ + return 0L; } /* this function was added to libpng 1.2.0 */ png_byte PNGAPI png_get_mmx_bitdepth_threshold (png_structp png_ptr) { -#if defined(PNG_MMX_CODE_SUPPORTED) - return (png_byte)(png_ptr? png_ptr->mmx_bitdepth_threshold : 0); -#else + /* obsolete, to be removed from libpng-1.4.0 */ return (png_ptr? 0: 0); -#endif /* ?PNG_MMX_CODE_SUPPORTED */ } /* this function was added to libpng 1.2.0 */ png_uint_32 PNGAPI png_get_mmx_rowbytes_threshold (png_structp png_ptr) { -#if defined(PNG_MMX_CODE_SUPPORTED) - return (png_uint_32)(png_ptr? png_ptr->mmx_rowbytes_threshold : 0L); -#else + /* obsolete, to be removed from libpng-1.4.0 */ return (png_ptr? 0L: 0L); -#endif /* ?PNG_MMX_CODE_SUPPORTED */ } #endif /* ?PNG_1_0_X */ #endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */ @@ -1851,5 +895,6 @@ png_get_user_height_max (png_structp png_ptr) return (png_ptr? png_ptr->user_height_max : 0); } #endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */ + #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ diff --git a/src/dep/src/irrlicht/libpng/pngmem.c b/src/dep/src/irrlicht/libpng/pngmem.c index 6325ca7..afa3b77 100644 --- a/src/dep/src/irrlicht/libpng/pngmem.c +++ b/src/dep/src/irrlicht/libpng/pngmem.c @@ -607,611 +607,3 @@ png_get_mem_ptr(png_structp png_ptr) } #endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ - -/* pngmem.c - stub functions for memory allocation - * - * Last changed in libpng 1.2.13 November 13, 2006 - * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2006 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - * - * This file provides a location for all memory allocation. Users who - * need special memory handling are expected to supply replacement - * functions for png_malloc() and png_free(), and to use - * png_create_read_struct_2() and png_create_write_struct_2() to - * identify the replacement functions. - */ - -#define PNG_INTERNAL -#include "png.h" - -#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) - -/* Borland DOS special memory handler */ -#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__) -/* if you change this, be sure to change the one in png.h also */ - -/* Allocate memory for a png_struct. The malloc and memset can be replaced - by a single call to calloc() if this is thought to improve performance. */ -png_voidp /* PRIVATE */ -png_create_struct(int type) -{ -#ifdef PNG_USER_MEM_SUPPORTED - return (png_create_struct_2(type, png_malloc_ptr_NULL, png_voidp_NULL)); -} - -/* Alternate version of png_create_struct, for use with user-defined malloc. */ -png_voidp /* PRIVATE */ -png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr) -{ -#endif /* PNG_USER_MEM_SUPPORTED */ - png_size_t size; - png_voidp struct_ptr; - - if (type == PNG_STRUCT_INFO) - size = png_sizeof(png_info); - else if (type == PNG_STRUCT_PNG) - size = png_sizeof(png_struct); - else - return (png_get_copyright(NULL)); - -#ifdef PNG_USER_MEM_SUPPORTED - if(malloc_fn != NULL) - { - png_struct dummy_struct; - png_structp png_ptr = &dummy_struct; - png_ptr->mem_ptr=mem_ptr; - struct_ptr = (*(malloc_fn))(png_ptr, (png_uint_32)size); - } - else -#endif /* PNG_USER_MEM_SUPPORTED */ - struct_ptr = (png_voidp)farmalloc(size); - if (struct_ptr != NULL) - png_memset(struct_ptr, 0, size); - return (struct_ptr); -} - -/* Free memory allocated by a png_create_struct() call */ -void /* PRIVATE */ -png_destroy_struct(png_voidp struct_ptr) -{ -#ifdef PNG_USER_MEM_SUPPORTED - png_destroy_struct_2(struct_ptr, png_free_ptr_NULL, png_voidp_NULL); -} - -/* Free memory allocated by a png_create_struct() call */ -void /* PRIVATE */ -png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn, - png_voidp mem_ptr) -{ -#endif - if (struct_ptr != NULL) - { -#ifdef PNG_USER_MEM_SUPPORTED - if(free_fn != NULL) - { - png_struct dummy_struct; - png_structp png_ptr = &dummy_struct; - png_ptr->mem_ptr=mem_ptr; - (*(free_fn))(png_ptr, struct_ptr); - return; - } -#endif /* PNG_USER_MEM_SUPPORTED */ - farfree (struct_ptr); - } -} - -/* Allocate memory. For reasonable files, size should never exceed - * 64K. However, zlib may allocate more then 64K if you don't tell - * it not to. See zconf.h and png.h for more information. zlib does - * need to allocate exactly 64K, so whatever you call here must - * have the ability to do that. - * - * Borland seems to have a problem in DOS mode for exactly 64K. - * It gives you a segment with an offset of 8 (perhaps to store its - * memory stuff). zlib doesn't like this at all, so we have to - * detect and deal with it. This code should not be needed in - * Windows or OS/2 modes, and only in 16 bit mode. This code has - * been updated by Alexander Lehmann for version 0.89 to waste less - * memory. - * - * Note that we can't use png_size_t for the "size" declaration, - * since on some systems a png_size_t is a 16-bit quantity, and as a - * result, we would be truncating potentially larger memory requests - * (which should cause a fatal error) and introducing major problems. - */ - -png_voidp PNGAPI -png_malloc(png_structp png_ptr, png_uint_32 size) -{ - png_voidp ret; - - if (png_ptr == NULL || size == 0) - return (NULL); - -#ifdef PNG_USER_MEM_SUPPORTED - if(png_ptr->malloc_fn != NULL) - ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size)); - else - ret = (png_malloc_default(png_ptr, size)); - if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) - png_error(png_ptr, "Out of memory!"); - return (ret); -} - -png_voidp PNGAPI -png_malloc_default(png_structp png_ptr, png_uint_32 size) -{ - png_voidp ret; -#endif /* PNG_USER_MEM_SUPPORTED */ - - if (png_ptr == NULL || size == 0) - return (NULL); - -#ifdef PNG_MAX_MALLOC_64K - if (size > (png_uint_32)65536L) - { - png_warning(png_ptr, "Cannot Allocate > 64K"); - ret = NULL; - } - else -#endif - - if (size != (size_t)size) - ret = NULL; - else if (size == (png_uint_32)65536L) - { - if (png_ptr->offset_table == NULL) - { - /* try to see if we need to do any of this fancy stuff */ - ret = farmalloc(size); - if (ret == NULL || ((png_size_t)ret & 0xffff)) - { - int num_blocks; - png_uint_32 total_size; - png_bytep table; - int i; - png_byte huge * hptr; - - if (ret != NULL) - { - farfree(ret); - ret = NULL; - } - - if(png_ptr->zlib_window_bits > 14) - num_blocks = (int)(1 << (png_ptr->zlib_window_bits - 14)); - else - num_blocks = 1; - if (png_ptr->zlib_mem_level >= 7) - num_blocks += (int)(1 << (png_ptr->zlib_mem_level - 7)); - else - num_blocks++; - - total_size = ((png_uint_32)65536L) * (png_uint_32)num_blocks+16; - - table = farmalloc(total_size); - - if (table == NULL) - { -#ifndef PNG_USER_MEM_SUPPORTED - if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) - png_error(png_ptr, "Out Of Memory."); /* Note "O" and "M" */ - else - png_warning(png_ptr, "Out Of Memory."); -#endif - return (NULL); - } - - if ((png_size_t)table & 0xfff0) - { -#ifndef PNG_USER_MEM_SUPPORTED - if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) - png_error(png_ptr, - "Farmalloc didn't return normalized pointer"); - else - png_warning(png_ptr, - "Farmalloc didn't return normalized pointer"); -#endif - return (NULL); - } - - png_ptr->offset_table = table; - png_ptr->offset_table_ptr = farmalloc(num_blocks * - png_sizeof (png_bytep)); - - if (png_ptr->offset_table_ptr == NULL) - { -#ifndef PNG_USER_MEM_SUPPORTED - if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) - png_error(png_ptr, "Out Of memory."); /* Note "O" and "M" */ - else - png_warning(png_ptr, "Out Of memory."); -#endif - return (NULL); - } - - hptr = (png_byte huge *)table; - if ((png_size_t)hptr & 0xf) - { - hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L); - hptr = hptr + 16L; /* "hptr += 16L" fails on Turbo C++ 3.0 */ - } - for (i = 0; i < num_blocks; i++) - { - png_ptr->offset_table_ptr[i] = (png_bytep)hptr; - hptr = hptr + (png_uint_32)65536L; /* "+=" fails on TC++3.0 */ - } - - png_ptr->offset_table_number = num_blocks; - png_ptr->offset_table_count = 0; - png_ptr->offset_table_count_free = 0; - } - } - - if (png_ptr->offset_table_count >= png_ptr->offset_table_number) - { -#ifndef PNG_USER_MEM_SUPPORTED - if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) - png_error(png_ptr, "Out of Memory."); /* Note "o" and "M" */ - else - png_warning(png_ptr, "Out of Memory."); -#endif - return (NULL); - } - - ret = png_ptr->offset_table_ptr[png_ptr->offset_table_count++]; - } - else - ret = farmalloc(size); - -#ifndef PNG_USER_MEM_SUPPORTED - if (ret == NULL) - { - if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) - png_error(png_ptr, "Out of memory."); /* Note "o" and "m" */ - else - png_warning(png_ptr, "Out of memory."); /* Note "o" and "m" */ - } -#endif - - return (ret); -} - -/* free a pointer allocated by png_malloc(). In the default - configuration, png_ptr is not used, but is passed in case it - is needed. If ptr is NULL, return without taking any action. */ -void PNGAPI -png_free(png_structp png_ptr, png_voidp ptr) -{ - if (png_ptr == NULL || ptr == NULL) - return; - -#ifdef PNG_USER_MEM_SUPPORTED - if (png_ptr->free_fn != NULL) - { - (*(png_ptr->free_fn))(png_ptr, ptr); - return; - } - else png_free_default(png_ptr, ptr); -} - -void PNGAPI -png_free_default(png_structp png_ptr, png_voidp ptr) -{ -#endif /* PNG_USER_MEM_SUPPORTED */ - - if(png_ptr == NULL) return; - - if (png_ptr->offset_table != NULL) - { - int i; - - for (i = 0; i < png_ptr->offset_table_count; i++) - { - if (ptr == png_ptr->offset_table_ptr[i]) - { - ptr = NULL; - png_ptr->offset_table_count_free++; - break; - } - } - if (png_ptr->offset_table_count_free == png_ptr->offset_table_count) - { - farfree(png_ptr->offset_table); - farfree(png_ptr->offset_table_ptr); - png_ptr->offset_table = NULL; - png_ptr->offset_table_ptr = NULL; - } - } - - if (ptr != NULL) - { - farfree(ptr); - } -} - -#else /* Not the Borland DOS special memory handler */ - -/* Allocate memory for a png_struct or a png_info. The malloc and - memset can be replaced by a single call to calloc() if this is thought - to improve performance noticably. */ -png_voidp /* PRIVATE */ -png_create_struct(int type) -{ -#ifdef PNG_USER_MEM_SUPPORTED - return (png_create_struct_2(type, png_malloc_ptr_NULL, png_voidp_NULL)); -} - -/* Allocate memory for a png_struct or a png_info. The malloc and - memset can be replaced by a single call to calloc() if this is thought - to improve performance noticably. */ -png_voidp /* PRIVATE */ -png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr) -{ -#endif /* PNG_USER_MEM_SUPPORTED */ - png_size_t size; - png_voidp struct_ptr; - - if (type == PNG_STRUCT_INFO) - size = png_sizeof(png_info); - else if (type == PNG_STRUCT_PNG) - size = png_sizeof(png_struct); - else - return (NULL); - -#ifdef PNG_USER_MEM_SUPPORTED - if(malloc_fn != NULL) - { - png_struct dummy_struct; - png_structp png_ptr = &dummy_struct; - png_ptr->mem_ptr=mem_ptr; - struct_ptr = (*(malloc_fn))(png_ptr, size); - if (struct_ptr != NULL) - png_memset(struct_ptr, 0, size); - return (struct_ptr); - } -#endif /* PNG_USER_MEM_SUPPORTED */ - -#if defined(__TURBOC__) && !defined(__FLAT__) - struct_ptr = (png_voidp)farmalloc(size); -#else -# if defined(_MSC_VER) && defined(MAXSEG_64K) - struct_ptr = (png_voidp)halloc(size,1); -# else - struct_ptr = (png_voidp)malloc(size); -# endif -#endif - if (struct_ptr != NULL) - png_memset(struct_ptr, 0, size); - - return (struct_ptr); -} - - -/* Free memory allocated by a png_create_struct() call */ -void /* PRIVATE */ -png_destroy_struct(png_voidp struct_ptr) -{ -#ifdef PNG_USER_MEM_SUPPORTED - png_destroy_struct_2(struct_ptr, png_free_ptr_NULL, png_voidp_NULL); -} - -/* Free memory allocated by a png_create_struct() call */ -void /* PRIVATE */ -png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn, - png_voidp mem_ptr) -{ -#endif /* PNG_USER_MEM_SUPPORTED */ - if (struct_ptr != NULL) - { -#ifdef PNG_USER_MEM_SUPPORTED - if(free_fn != NULL) - { - png_struct dummy_struct; - png_structp png_ptr = &dummy_struct; - png_ptr->mem_ptr=mem_ptr; - (*(free_fn))(png_ptr, struct_ptr); - return; - } -#endif /* PNG_USER_MEM_SUPPORTED */ -#if defined(__TURBOC__) && !defined(__FLAT__) - farfree(struct_ptr); -#else -# if defined(_MSC_VER) && defined(MAXSEG_64K) - hfree(struct_ptr); -# else - free(struct_ptr); -# endif -#endif - } -} - -/* Allocate memory. For reasonable files, size should never exceed - 64K. However, zlib may allocate more then 64K if you don't tell - it not to. See zconf.h and png.h for more information. zlib does - need to allocate exactly 64K, so whatever you call here must - have the ability to do that. */ - -png_voidp PNGAPI -png_malloc(png_structp png_ptr, png_uint_32 size) -{ - png_voidp ret; - -#ifdef PNG_USER_MEM_SUPPORTED - if (png_ptr == NULL || size == 0) - return (NULL); - - if(png_ptr->malloc_fn != NULL) - ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size)); - else - ret = (png_malloc_default(png_ptr, size)); - if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) - png_error(png_ptr, "Out of Memory!"); - return (ret); -} - -png_voidp PNGAPI -png_malloc_default(png_structp png_ptr, png_uint_32 size) -{ - png_voidp ret; -#endif /* PNG_USER_MEM_SUPPORTED */ - - if (png_ptr == NULL || size == 0) - return (NULL); - -#ifdef PNG_MAX_MALLOC_64K - if (size > (png_uint_32)65536L) - { -#ifndef PNG_USER_MEM_SUPPORTED - if(png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) - png_error(png_ptr, "Cannot Allocate > 64K"); - else -#endif - return NULL; - } -#endif - - /* Check for overflow */ -#if defined(__TURBOC__) && !defined(__FLAT__) - if (size != (unsigned long)size) - ret = NULL; - else - ret = farmalloc(size); -#else -# if defined(_MSC_VER) && defined(MAXSEG_64K) - if (size != (unsigned long)size) - ret = NULL; - else - ret = halloc(size, 1); -# else - if (size != (size_t)size) - ret = NULL; - else - ret = malloc((size_t)size); -# endif -#endif - -#ifndef PNG_USER_MEM_SUPPORTED - if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) - png_error(png_ptr, "Out of Memory"); -#endif - - return (ret); -} - -/* Free a pointer allocated by png_malloc(). If ptr is NULL, return - without taking any action. */ -void PNGAPI -png_free(png_structp png_ptr, png_voidp ptr) -{ - if (png_ptr == NULL || ptr == NULL) - return; - -#ifdef PNG_USER_MEM_SUPPORTED - if (png_ptr->free_fn != NULL) - { - (*(png_ptr->free_fn))(png_ptr, ptr); - return; - } - else png_free_default(png_ptr, ptr); -} -void PNGAPI -png_free_default(png_structp png_ptr, png_voidp ptr) -{ - if (png_ptr == NULL || ptr == NULL) - return; - -#endif /* PNG_USER_MEM_SUPPORTED */ - -#if defined(__TURBOC__) && !defined(__FLAT__) - farfree(ptr); -#else -# if defined(_MSC_VER) && defined(MAXSEG_64K) - hfree(ptr); -# else - free(ptr); -# endif -#endif -} - -#endif /* Not Borland DOS special memory handler */ - -#if defined(PNG_1_0_X) -# define png_malloc_warn png_malloc -#else -/* This function was added at libpng version 1.2.3. The png_malloc_warn() - * function will set up png_malloc() to issue a png_warning and return NULL - * instead of issuing a png_error, if it fails to allocate the requested - * memory. - */ -png_voidp PNGAPI -png_malloc_warn(png_structp png_ptr, png_uint_32 size) -{ - png_voidp ptr; - png_uint_32 save_flags; - if(png_ptr == NULL) return (NULL); - - save_flags=png_ptr->flags; - png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK; - ptr = (png_voidp)png_malloc((png_structp)png_ptr, size); - png_ptr->flags=save_flags; - return(ptr); -} -#endif - -png_voidp PNGAPI -png_memcpy_check (png_structp png_ptr, png_voidp s1, png_voidp s2, - png_uint_32 length) -{ - png_size_t size; - - size = (png_size_t)length; - if ((png_uint_32)size != length) - png_error(png_ptr,"Overflow in png_memcpy_check."); - - return(png_memcpy (s1, s2, size)); -} - -png_voidp PNGAPI -png_memset_check (png_structp png_ptr, png_voidp s1, int value, - png_uint_32 length) -{ - png_size_t size; - - size = (png_size_t)length; - if ((png_uint_32)size != length) - png_error(png_ptr,"Overflow in png_memset_check."); - - return (png_memset (s1, value, size)); - -} - -#ifdef PNG_USER_MEM_SUPPORTED -/* This function is called when the application wants to use another method - * of allocating and freeing memory. - */ -void PNGAPI -png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr - malloc_fn, png_free_ptr free_fn) -{ - if(png_ptr != NULL) { - png_ptr->mem_ptr = mem_ptr; - png_ptr->malloc_fn = malloc_fn; - png_ptr->free_fn = free_fn; - } -} - -/* This function returns a pointer to the mem_ptr associated with the user - * functions. The application should free any memory associated with this - * pointer before png_write_destroy and png_read_destroy are called. - */ -png_voidp PNGAPI -png_get_mem_ptr(png_structp png_ptr) -{ - if(png_ptr == NULL) return (NULL); - return ((png_voidp)png_ptr->mem_ptr); -} -#endif /* PNG_USER_MEM_SUPPORTED */ -#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ diff --git a/src/dep/src/irrlicht/libpng/pngpread.c b/src/dep/src/irrlicht/libpng/pngpread.c index 76bcc90..c891add 100644 --- a/src/dep/src/irrlicht/libpng/pngpread.c +++ b/src/dep/src/irrlicht/libpng/pngpread.c @@ -1592,1592 +1592,3 @@ png_get_progressive_ptr(png_structp png_ptr) return png_ptr->io_ptr; } #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ - -/* pngpread.c - read a png file in push mode - * - * Last changed in libpng 1.2.17 May 15, 2007 - * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - */ - -#define PNG_INTERNAL -#include "png.h" - -#ifdef PNG_PROGRESSIVE_READ_SUPPORTED - -/* push model modes */ -#define PNG_READ_SIG_MODE 0 -#define PNG_READ_CHUNK_MODE 1 -#define PNG_READ_IDAT_MODE 2 -#define PNG_SKIP_MODE 3 -#define PNG_READ_tEXt_MODE 4 -#define PNG_READ_zTXt_MODE 5 -#define PNG_READ_DONE_MODE 6 -#define PNG_READ_iTXt_MODE 7 -#define PNG_ERROR_MODE 8 - -void PNGAPI -png_process_data(png_structp png_ptr, png_infop info_ptr, - png_bytep buffer, png_size_t buffer_size) -{ - if(png_ptr == NULL) return; - png_push_restore_buffer(png_ptr, buffer, buffer_size); - - while (png_ptr->buffer_size) - { - png_process_some_data(png_ptr, info_ptr); - } -} - -/* What we do with the incoming data depends on what we were previously - * doing before we ran out of data... - */ -void /* PRIVATE */ -png_process_some_data(png_structp png_ptr, png_infop info_ptr) -{ - if(png_ptr == NULL) return; - switch (png_ptr->process_mode) - { - case PNG_READ_SIG_MODE: - { - png_push_read_sig(png_ptr, info_ptr); - break; - } - case PNG_READ_CHUNK_MODE: - { - png_push_read_chunk(png_ptr, info_ptr); - break; - } - case PNG_READ_IDAT_MODE: - { - png_push_read_IDAT(png_ptr); - break; - } -#if defined(PNG_READ_tEXt_SUPPORTED) - case PNG_READ_tEXt_MODE: - { - png_push_read_tEXt(png_ptr, info_ptr); - break; - } -#endif -#if defined(PNG_READ_zTXt_SUPPORTED) - case PNG_READ_zTXt_MODE: - { - png_push_read_zTXt(png_ptr, info_ptr); - break; - } -#endif -#if defined(PNG_READ_iTXt_SUPPORTED) - case PNG_READ_iTXt_MODE: - { - png_push_read_iTXt(png_ptr, info_ptr); - break; - } -#endif - case PNG_SKIP_MODE: - { - png_push_crc_finish(png_ptr); - break; - } - default: - { - png_ptr->buffer_size = 0; - break; - } - } -} - -/* Read any remaining signature bytes from the stream and compare them with - * the correct PNG signature. It is possible that this routine is called - * with bytes already read from the signature, either because they have been - * checked by the calling application, or because of multiple calls to this - * routine. - */ -void /* PRIVATE */ -png_push_read_sig(png_structp png_ptr, png_infop info_ptr) -{ - png_size_t num_checked = png_ptr->sig_bytes, - num_to_check = 8 - num_checked; - - if (png_ptr->buffer_size < num_to_check) - { - num_to_check = png_ptr->buffer_size; - } - - png_push_fill_buffer(png_ptr, &(info_ptr->signature[num_checked]), - num_to_check); - png_ptr->sig_bytes = (png_byte)(png_ptr->sig_bytes+num_to_check); - - if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check)) - { - if (num_checked < 4 && - png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4)) - png_error(png_ptr, "Not a PNG file"); - else - png_error(png_ptr, "PNG file corrupted by ASCII conversion"); - } - else - { - if (png_ptr->sig_bytes >= 8) - { - png_ptr->process_mode = PNG_READ_CHUNK_MODE; - } - } -} - -void /* PRIVATE */ -png_push_read_chunk(png_structp png_ptr, png_infop info_ptr) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_IHDR; - PNG_IDAT; - PNG_IEND; - PNG_PLTE; -#if defined(PNG_READ_bKGD_SUPPORTED) - PNG_bKGD; -#endif -#if defined(PNG_READ_cHRM_SUPPORTED) - PNG_cHRM; -#endif -#if defined(PNG_READ_gAMA_SUPPORTED) - PNG_gAMA; -#endif -#if defined(PNG_READ_hIST_SUPPORTED) - PNG_hIST; -#endif -#if defined(PNG_READ_iCCP_SUPPORTED) - PNG_iCCP; -#endif -#if defined(PNG_READ_iTXt_SUPPORTED) - PNG_iTXt; -#endif -#if defined(PNG_READ_oFFs_SUPPORTED) - PNG_oFFs; -#endif -#if defined(PNG_READ_pCAL_SUPPORTED) - PNG_pCAL; -#endif -#if defined(PNG_READ_pHYs_SUPPORTED) - PNG_pHYs; -#endif -#if defined(PNG_READ_sBIT_SUPPORTED) - PNG_sBIT; -#endif -#if defined(PNG_READ_sCAL_SUPPORTED) - PNG_sCAL; -#endif -#if defined(PNG_READ_sRGB_SUPPORTED) - PNG_sRGB; -#endif -#if defined(PNG_READ_sPLT_SUPPORTED) - PNG_sPLT; -#endif -#if defined(PNG_READ_tEXt_SUPPORTED) - PNG_tEXt; -#endif -#if defined(PNG_READ_tIME_SUPPORTED) - PNG_tIME; -#endif -#if defined(PNG_READ_tRNS_SUPPORTED) - PNG_tRNS; -#endif -#if defined(PNG_READ_zTXt_SUPPORTED) - PNG_zTXt; -#endif -#endif /* PNG_USE_LOCAL_ARRAYS */ - /* First we make sure we have enough data for the 4 byte chunk name - * and the 4 byte chunk length before proceeding with decoding the - * chunk data. To fully decode each of these chunks, we also make - * sure we have enough data in the buffer for the 4 byte CRC at the - * end of every chunk (except IDAT, which is handled separately). - */ - if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER)) - { - png_byte chunk_length[4]; - - if (png_ptr->buffer_size < 8) - { - png_push_save_buffer(png_ptr); - return; - } - - png_push_fill_buffer(png_ptr, chunk_length, 4); - png_ptr->push_length = png_get_uint_31(png_ptr,chunk_length); - png_reset_crc(png_ptr); - png_crc_read(png_ptr, png_ptr->chunk_name, 4); - png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; - } - - if (!png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4)) - if(png_ptr->mode & PNG_AFTER_IDAT) - png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT; - - if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4)) - { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - png_handle_IHDR(png_ptr, info_ptr, png_ptr->push_length); - } - else if (!png_memcmp(png_ptr->chunk_name, png_IEND, 4)) - { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - png_handle_IEND(png_ptr, info_ptr, png_ptr->push_length); - - png_ptr->process_mode = PNG_READ_DONE_MODE; - png_push_have_end(png_ptr, info_ptr); - } -#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED - else if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name)) - { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) - png_ptr->mode |= PNG_HAVE_IDAT; - png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length); - if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) - png_ptr->mode |= PNG_HAVE_PLTE; - else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) - { - if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before IDAT"); - else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && - !(png_ptr->mode & PNG_HAVE_PLTE)) - png_error(png_ptr, "Missing PLTE before IDAT"); - } - } -#endif - else if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) - { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length); - } - else if (!png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4)) - { - /* If we reach an IDAT chunk, this means we have read all of the - * header chunks, and we can start reading the image (or if this - * is called after the image has been read - we have an error). - */ - if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before IDAT"); - else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && - !(png_ptr->mode & PNG_HAVE_PLTE)) - png_error(png_ptr, "Missing PLTE before IDAT"); - - if (png_ptr->mode & PNG_HAVE_IDAT) - { - if (!(png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT)) - if (png_ptr->push_length == 0) - return; - - if (png_ptr->mode & PNG_AFTER_IDAT) - png_error(png_ptr, "Too many IDAT's found"); - } - - png_ptr->idat_size = png_ptr->push_length; - png_ptr->mode |= PNG_HAVE_IDAT; - png_ptr->process_mode = PNG_READ_IDAT_MODE; - png_push_have_info(png_ptr, info_ptr); - png_ptr->zstream.avail_out = (uInt)png_ptr->irowbytes; - png_ptr->zstream.next_out = png_ptr->row_buf; - return; - } -#if defined(PNG_READ_gAMA_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_gAMA, 4)) - { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - png_handle_gAMA(png_ptr, info_ptr, png_ptr->push_length); - } -#endif -#if defined(PNG_READ_sBIT_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_sBIT, 4)) - { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - png_handle_sBIT(png_ptr, info_ptr, png_ptr->push_length); - } -#endif -#if defined(PNG_READ_cHRM_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_cHRM, 4)) - { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - png_handle_cHRM(png_ptr, info_ptr, png_ptr->push_length); - } -#endif -#if defined(PNG_READ_sRGB_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_sRGB, 4)) - { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - png_handle_sRGB(png_ptr, info_ptr, png_ptr->push_length); - } -#endif -#if defined(PNG_READ_iCCP_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_iCCP, 4)) - { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - png_handle_iCCP(png_ptr, info_ptr, png_ptr->push_length); - } -#endif -#if defined(PNG_READ_sPLT_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_sPLT, 4)) - { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - png_handle_sPLT(png_ptr, info_ptr, png_ptr->push_length); - } -#endif -#if defined(PNG_READ_tRNS_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_tRNS, 4)) - { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - png_handle_tRNS(png_ptr, info_ptr, png_ptr->push_length); - } -#endif -#if defined(PNG_READ_bKGD_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_bKGD, 4)) - { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - png_handle_bKGD(png_ptr, info_ptr, png_ptr->push_length); - } -#endif -#if defined(PNG_READ_hIST_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_hIST, 4)) - { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - png_handle_hIST(png_ptr, info_ptr, png_ptr->push_length); - } -#endif -#if defined(PNG_READ_pHYs_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_pHYs, 4)) - { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - png_handle_pHYs(png_ptr, info_ptr, png_ptr->push_length); - } -#endif -#if defined(PNG_READ_oFFs_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_oFFs, 4)) - { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - png_handle_oFFs(png_ptr, info_ptr, png_ptr->push_length); - } -#endif -#if defined(PNG_READ_pCAL_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_pCAL, 4)) - { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - png_handle_pCAL(png_ptr, info_ptr, png_ptr->push_length); - } -#endif -#if defined(PNG_READ_sCAL_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_sCAL, 4)) - { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - png_handle_sCAL(png_ptr, info_ptr, png_ptr->push_length); - } -#endif -#if defined(PNG_READ_tIME_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_tIME, 4)) - { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - png_handle_tIME(png_ptr, info_ptr, png_ptr->push_length); - } -#endif -#if defined(PNG_READ_tEXt_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_tEXt, 4)) - { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - png_push_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length); - } -#endif -#if defined(PNG_READ_zTXt_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_zTXt, 4)) - { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - png_push_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length); - } -#endif -#if defined(PNG_READ_iTXt_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_iTXt, 4)) - { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - png_push_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length); - } -#endif - else - { - if (png_ptr->push_length + 4 > png_ptr->buffer_size) - { - png_push_save_buffer(png_ptr); - return; - } - png_push_handle_unknown(png_ptr, info_ptr, png_ptr->push_length); - } - - png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER; -} - -void /* PRIVATE */ -png_push_crc_skip(png_structp png_ptr, png_uint_32 skip) -{ - png_ptr->process_mode = PNG_SKIP_MODE; - png_ptr->skip_length = skip; -} - -void /* PRIVATE */ -png_push_crc_finish(png_structp png_ptr) -{ - if (png_ptr->skip_length && png_ptr->save_buffer_size) - { - png_size_t save_size; - - if (png_ptr->skip_length < (png_uint_32)png_ptr->save_buffer_size) - save_size = (png_size_t)png_ptr->skip_length; - else - save_size = png_ptr->save_buffer_size; - - png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size); - - png_ptr->skip_length -= save_size; - png_ptr->buffer_size -= save_size; - png_ptr->save_buffer_size -= save_size; - png_ptr->save_buffer_ptr += save_size; - } - if (png_ptr->skip_length && png_ptr->current_buffer_size) - { - png_size_t save_size; - - if (png_ptr->skip_length < (png_uint_32)png_ptr->current_buffer_size) - save_size = (png_size_t)png_ptr->skip_length; - else - save_size = png_ptr->current_buffer_size; - - png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size); - - png_ptr->skip_length -= save_size; - png_ptr->buffer_size -= save_size; - png_ptr->current_buffer_size -= save_size; - png_ptr->current_buffer_ptr += save_size; - } - if (!png_ptr->skip_length) - { - if (png_ptr->buffer_size < 4) - { - png_push_save_buffer(png_ptr); - return; - } - - png_crc_finish(png_ptr, 0); - png_ptr->process_mode = PNG_READ_CHUNK_MODE; - } -} - -void PNGAPI -png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length) -{ - png_bytep ptr; - - if(png_ptr == NULL) return; - ptr = buffer; - if (png_ptr->save_buffer_size) - { - png_size_t save_size; - - if (length < png_ptr->save_buffer_size) - save_size = length; - else - save_size = png_ptr->save_buffer_size; - - png_memcpy(ptr, png_ptr->save_buffer_ptr, save_size); - length -= save_size; - ptr += save_size; - png_ptr->buffer_size -= save_size; - png_ptr->save_buffer_size -= save_size; - png_ptr->save_buffer_ptr += save_size; - } - if (length && png_ptr->current_buffer_size) - { - png_size_t save_size; - - if (length < png_ptr->current_buffer_size) - save_size = length; - else - save_size = png_ptr->current_buffer_size; - - png_memcpy(ptr, png_ptr->current_buffer_ptr, save_size); - png_ptr->buffer_size -= save_size; - png_ptr->current_buffer_size -= save_size; - png_ptr->current_buffer_ptr += save_size; - } -} - -void /* PRIVATE */ -png_push_save_buffer(png_structp png_ptr) -{ - if (png_ptr->save_buffer_size) - { - if (png_ptr->save_buffer_ptr != png_ptr->save_buffer) - { - png_size_t i,istop; - png_bytep sp; - png_bytep dp; - - istop = png_ptr->save_buffer_size; - for (i = 0, sp = png_ptr->save_buffer_ptr, dp = png_ptr->save_buffer; - i < istop; i++, sp++, dp++) - { - *dp = *sp; - } - } - } - if (png_ptr->save_buffer_size + png_ptr->current_buffer_size > - png_ptr->save_buffer_max) - { - png_size_t new_max; - png_bytep old_buffer; - - if (png_ptr->save_buffer_size > PNG_SIZE_MAX - - (png_ptr->current_buffer_size + 256)) - { - png_error(png_ptr, "Potential overflow of save_buffer"); - } - new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + 256; - old_buffer = png_ptr->save_buffer; - png_ptr->save_buffer = (png_bytep)png_malloc(png_ptr, - (png_uint_32)new_max); - png_memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size); - png_free(png_ptr, old_buffer); - png_ptr->save_buffer_max = new_max; - } - if (png_ptr->current_buffer_size) - { - png_memcpy(png_ptr->save_buffer + png_ptr->save_buffer_size, - png_ptr->current_buffer_ptr, png_ptr->current_buffer_size); - png_ptr->save_buffer_size += png_ptr->current_buffer_size; - png_ptr->current_buffer_size = 0; - } - png_ptr->save_buffer_ptr = png_ptr->save_buffer; - png_ptr->buffer_size = 0; -} - -void /* PRIVATE */ -png_push_restore_buffer(png_structp png_ptr, png_bytep buffer, - png_size_t buffer_length) -{ - png_ptr->current_buffer = buffer; - png_ptr->current_buffer_size = buffer_length; - png_ptr->buffer_size = buffer_length + png_ptr->save_buffer_size; - png_ptr->current_buffer_ptr = png_ptr->current_buffer; -} - -void /* PRIVATE */ -png_push_read_IDAT(png_structp png_ptr) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_IDAT; -#endif - if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER)) - { - png_byte chunk_length[4]; - - if (png_ptr->buffer_size < 8) - { - png_push_save_buffer(png_ptr); - return; - } - - png_push_fill_buffer(png_ptr, chunk_length, 4); - png_ptr->push_length = png_get_uint_31(png_ptr,chunk_length); - png_reset_crc(png_ptr); - png_crc_read(png_ptr, png_ptr->chunk_name, 4); - png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; - - if (png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4)) - { - png_ptr->process_mode = PNG_READ_CHUNK_MODE; - if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)) - png_error(png_ptr, "Not enough compressed data"); - return; - } - - png_ptr->idat_size = png_ptr->push_length; - } - if (png_ptr->idat_size && png_ptr->save_buffer_size) - { - png_size_t save_size; - - if (png_ptr->idat_size < (png_uint_32)png_ptr->save_buffer_size) - { - save_size = (png_size_t)png_ptr->idat_size; - /* check for overflow */ - if((png_uint_32)save_size != png_ptr->idat_size) - png_error(png_ptr, "save_size overflowed in pngpread"); - } - else - save_size = png_ptr->save_buffer_size; - - png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size); - if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)) - png_process_IDAT_data(png_ptr, png_ptr->save_buffer_ptr, save_size); - png_ptr->idat_size -= save_size; - png_ptr->buffer_size -= save_size; - png_ptr->save_buffer_size -= save_size; - png_ptr->save_buffer_ptr += save_size; - } - if (png_ptr->idat_size && png_ptr->current_buffer_size) - { - png_size_t save_size; - - if (png_ptr->idat_size < (png_uint_32)png_ptr->current_buffer_size) - { - save_size = (png_size_t)png_ptr->idat_size; - /* check for overflow */ - if((png_uint_32)save_size != png_ptr->idat_size) - png_error(png_ptr, "save_size overflowed in pngpread"); - } - else - save_size = png_ptr->current_buffer_size; - - png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size); - if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)) - png_process_IDAT_data(png_ptr, png_ptr->current_buffer_ptr, save_size); - - png_ptr->idat_size -= save_size; - png_ptr->buffer_size -= save_size; - png_ptr->current_buffer_size -= save_size; - png_ptr->current_buffer_ptr += save_size; - } - if (!png_ptr->idat_size) - { - if (png_ptr->buffer_size < 4) - { - png_push_save_buffer(png_ptr); - return; - } - - png_crc_finish(png_ptr, 0); - png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER; - png_ptr->mode |= PNG_AFTER_IDAT; - } -} - -void /* PRIVATE */ -png_process_IDAT_data(png_structp png_ptr, png_bytep buffer, - png_size_t buffer_length) -{ - int ret; - - if ((png_ptr->flags & PNG_FLAG_ZLIB_FINISHED) && buffer_length) - png_error(png_ptr, "Extra compression data"); - - png_ptr->zstream.next_in = buffer; - png_ptr->zstream.avail_in = (uInt)buffer_length; - for(;;) - { - ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH); - if (ret != Z_OK) - { - if (ret == Z_STREAM_END) - { - if (png_ptr->zstream.avail_in) - png_error(png_ptr, "Extra compressed data"); - if (!(png_ptr->zstream.avail_out)) - { - png_push_process_row(png_ptr); - } - - png_ptr->mode |= PNG_AFTER_IDAT; - png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; - break; - } - else if (ret == Z_BUF_ERROR) - break; - else - png_error(png_ptr, "Decompression Error"); - } - if (!(png_ptr->zstream.avail_out)) - { - if (( -#if defined(PNG_READ_INTERLACING_SUPPORTED) - png_ptr->interlaced && png_ptr->pass > 6) || - (!png_ptr->interlaced && -#endif - png_ptr->row_number == png_ptr->num_rows)) - { - if (png_ptr->zstream.avail_in) - png_warning(png_ptr, "Too much data in IDAT chunks"); - png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; - break; - } - png_push_process_row(png_ptr); - png_ptr->zstream.avail_out = (uInt)png_ptr->irowbytes; - png_ptr->zstream.next_out = png_ptr->row_buf; - } - else - break; - } -} - -void /* PRIVATE */ -png_push_process_row(png_structp png_ptr) -{ - png_ptr->row_info.color_type = png_ptr->color_type; - png_ptr->row_info.width = png_ptr->iwidth; - png_ptr->row_info.channels = png_ptr->channels; - png_ptr->row_info.bit_depth = png_ptr->bit_depth; - png_ptr->row_info.pixel_depth = png_ptr->pixel_depth; - - png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth, - png_ptr->row_info.width); - - png_read_filter_row(png_ptr, &(png_ptr->row_info), - png_ptr->row_buf + 1, png_ptr->prev_row + 1, - (int)(png_ptr->row_buf[0])); - - png_memcpy_check(png_ptr, png_ptr->prev_row, png_ptr->row_buf, - png_ptr->rowbytes + 1); - - if (png_ptr->transformations || (png_ptr->flags&PNG_FLAG_STRIP_ALPHA)) - png_do_read_transformations(png_ptr); - -#if defined(PNG_READ_INTERLACING_SUPPORTED) - /* blow up interlaced rows to full size */ - if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE)) - { - if (png_ptr->pass < 6) -/* old interface (pre-1.0.9): - png_do_read_interlace(&(png_ptr->row_info), - png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations); - */ - png_do_read_interlace(png_ptr); - - switch (png_ptr->pass) - { - case 0: - { - int i; - for (i = 0; i < 8 && png_ptr->pass == 0; i++) - { - png_push_have_row(png_ptr, png_ptr->row_buf + 1); - png_read_push_finish_row(png_ptr); /* updates png_ptr->pass */ - } - if (png_ptr->pass == 2) /* pass 1 might be empty */ - { - for (i = 0; i < 4 && png_ptr->pass == 2; i++) - { - png_push_have_row(png_ptr, png_bytep_NULL); - png_read_push_finish_row(png_ptr); - } - } - if (png_ptr->pass == 4 && png_ptr->height <= 4) - { - for (i = 0; i < 2 && png_ptr->pass == 4; i++) - { - png_push_have_row(png_ptr, png_bytep_NULL); - png_read_push_finish_row(png_ptr); - } - } - if (png_ptr->pass == 6 && png_ptr->height <= 4) - { - png_push_have_row(png_ptr, png_bytep_NULL); - png_read_push_finish_row(png_ptr); - } - break; - } - case 1: - { - int i; - for (i = 0; i < 8 && png_ptr->pass == 1; i++) - { - png_push_have_row(png_ptr, png_ptr->row_buf + 1); - png_read_push_finish_row(png_ptr); - } - if (png_ptr->pass == 2) /* skip top 4 generated rows */ - { - for (i = 0; i < 4 && png_ptr->pass == 2; i++) - { - png_push_have_row(png_ptr, png_bytep_NULL); - png_read_push_finish_row(png_ptr); - } - } - break; - } - case 2: - { - int i; - for (i = 0; i < 4 && png_ptr->pass == 2; i++) - { - png_push_have_row(png_ptr, png_ptr->row_buf + 1); - png_read_push_finish_row(png_ptr); - } - for (i = 0; i < 4 && png_ptr->pass == 2; i++) - { - png_push_have_row(png_ptr, png_bytep_NULL); - png_read_push_finish_row(png_ptr); - } - if (png_ptr->pass == 4) /* pass 3 might be empty */ - { - for (i = 0; i < 2 && png_ptr->pass == 4; i++) - { - png_push_have_row(png_ptr, png_bytep_NULL); - png_read_push_finish_row(png_ptr); - } - } - break; - } - case 3: - { - int i; - for (i = 0; i < 4 && png_ptr->pass == 3; i++) - { - png_push_have_row(png_ptr, png_ptr->row_buf + 1); - png_read_push_finish_row(png_ptr); - } - if (png_ptr->pass == 4) /* skip top two generated rows */ - { - for (i = 0; i < 2 && png_ptr->pass == 4; i++) - { - png_push_have_row(png_ptr, png_bytep_NULL); - png_read_push_finish_row(png_ptr); - } - } - break; - } - case 4: - { - int i; - for (i = 0; i < 2 && png_ptr->pass == 4; i++) - { - png_push_have_row(png_ptr, png_ptr->row_buf + 1); - png_read_push_finish_row(png_ptr); - } - for (i = 0; i < 2 && png_ptr->pass == 4; i++) - { - png_push_have_row(png_ptr, png_bytep_NULL); - png_read_push_finish_row(png_ptr); - } - if (png_ptr->pass == 6) /* pass 5 might be empty */ - { - png_push_have_row(png_ptr, png_bytep_NULL); - png_read_push_finish_row(png_ptr); - } - break; - } - case 5: - { - int i; - for (i = 0; i < 2 && png_ptr->pass == 5; i++) - { - png_push_have_row(png_ptr, png_ptr->row_buf + 1); - png_read_push_finish_row(png_ptr); - } - if (png_ptr->pass == 6) /* skip top generated row */ - { - png_push_have_row(png_ptr, png_bytep_NULL); - png_read_push_finish_row(png_ptr); - } - break; - } - case 6: - { - png_push_have_row(png_ptr, png_ptr->row_buf + 1); - png_read_push_finish_row(png_ptr); - if (png_ptr->pass != 6) - break; - png_push_have_row(png_ptr, png_bytep_NULL); - png_read_push_finish_row(png_ptr); - } - } - } - else -#endif - { - png_push_have_row(png_ptr, png_ptr->row_buf + 1); - png_read_push_finish_row(png_ptr); - } -} - -void /* PRIVATE */ -png_read_push_finish_row(png_structp png_ptr) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ - - /* start of interlace block */ - const int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; - - /* offset to next interlace block */ - const int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; - - /* start of interlace block in the y direction */ - const int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1}; - - /* offset to next interlace block in the y direction */ - const int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2}; - - /* Width of interlace block. This is not currently used - if you need - * it, uncomment it here and in png.h - const int FARDATA png_pass_width[] = {8, 4, 4, 2, 2, 1, 1}; - */ - - /* Height of interlace block. This is not currently used - if you need - * it, uncomment it here and in png.h - const int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1}; - */ -#endif - - png_ptr->row_number++; - if (png_ptr->row_number < png_ptr->num_rows) - return; - - if (png_ptr->interlaced) - { - png_ptr->row_number = 0; - png_memset_check(png_ptr, png_ptr->prev_row, 0, - png_ptr->rowbytes + 1); - do - { - png_ptr->pass++; - if ((png_ptr->pass == 1 && png_ptr->width < 5) || - (png_ptr->pass == 3 && png_ptr->width < 3) || - (png_ptr->pass == 5 && png_ptr->width < 2)) - png_ptr->pass++; - - if (png_ptr->pass > 7) - png_ptr->pass--; - if (png_ptr->pass >= 7) - break; - - png_ptr->iwidth = (png_ptr->width + - png_pass_inc[png_ptr->pass] - 1 - - png_pass_start[png_ptr->pass]) / - png_pass_inc[png_ptr->pass]; - - png_ptr->irowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, - png_ptr->iwidth) + 1; - - if (png_ptr->transformations & PNG_INTERLACE) - break; - - png_ptr->num_rows = (png_ptr->height + - png_pass_yinc[png_ptr->pass] - 1 - - png_pass_ystart[png_ptr->pass]) / - png_pass_yinc[png_ptr->pass]; - - } while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0); - } -} - -#if defined(PNG_READ_tEXt_SUPPORTED) -void /* PRIVATE */ -png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 - length) -{ - if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) - { - png_error(png_ptr, "Out of place tEXt"); - /* to quiet some compiler warnings */ - if(info_ptr == NULL) return; - } - -#ifdef PNG_MAX_MALLOC_64K - png_ptr->skip_length = 0; /* This may not be necessary */ - - if (length > (png_uint_32)65535L) /* Can't hold entire string in memory */ - { - png_warning(png_ptr, "tEXt chunk too large to fit in memory"); - png_ptr->skip_length = length - (png_uint_32)65535L; - length = (png_uint_32)65535L; - } -#endif - - png_ptr->current_text = (png_charp)png_malloc(png_ptr, - (png_uint_32)(length+1)); - png_ptr->current_text[length] = '\0'; - png_ptr->current_text_ptr = png_ptr->current_text; - png_ptr->current_text_size = (png_size_t)length; - png_ptr->current_text_left = (png_size_t)length; - png_ptr->process_mode = PNG_READ_tEXt_MODE; -} - -void /* PRIVATE */ -png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr) -{ - if (png_ptr->buffer_size && png_ptr->current_text_left) - { - png_size_t text_size; - - if (png_ptr->buffer_size < png_ptr->current_text_left) - text_size = png_ptr->buffer_size; - else - text_size = png_ptr->current_text_left; - png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size); - png_ptr->current_text_left -= text_size; - png_ptr->current_text_ptr += text_size; - } - if (!(png_ptr->current_text_left)) - { - png_textp text_ptr; - png_charp text; - png_charp key; - int ret; - - if (png_ptr->buffer_size < 4) - { - png_push_save_buffer(png_ptr); - return; - } - - png_push_crc_finish(png_ptr); - -#if defined(PNG_MAX_MALLOC_64K) - if (png_ptr->skip_length) - return; -#endif - - key = png_ptr->current_text; - - for (text = key; *text; text++) - /* empty loop */ ; - - if (text != key + png_ptr->current_text_size) - text++; - - text_ptr = (png_textp)png_malloc(png_ptr, - (png_uint_32)png_sizeof(png_text)); - text_ptr->compression = PNG_TEXT_COMPRESSION_NONE; - text_ptr->key = key; -#ifdef PNG_iTXt_SUPPORTED - text_ptr->lang = NULL; - text_ptr->lang_key = NULL; -#endif - text_ptr->text = text; - - ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1); - - png_free(png_ptr, key); - png_free(png_ptr, text_ptr); - png_ptr->current_text = NULL; - - if (ret) - png_warning(png_ptr, "Insufficient memory to store text chunk."); - } -} -#endif - -#if defined(PNG_READ_zTXt_SUPPORTED) -void /* PRIVATE */ -png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 - length) -{ - if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) - { - png_error(png_ptr, "Out of place zTXt"); - /* to quiet some compiler warnings */ - if(info_ptr == NULL) return; - } - -#ifdef PNG_MAX_MALLOC_64K - /* We can't handle zTXt chunks > 64K, since we don't have enough space - * to be able to store the uncompressed data. Actually, the threshold - * is probably around 32K, but it isn't as definite as 64K is. - */ - if (length > (png_uint_32)65535L) - { - png_warning(png_ptr, "zTXt chunk too large to fit in memory"); - png_push_crc_skip(png_ptr, length); - return; - } -#endif - - png_ptr->current_text = (png_charp)png_malloc(png_ptr, - (png_uint_32)(length+1)); - png_ptr->current_text[length] = '\0'; - png_ptr->current_text_ptr = png_ptr->current_text; - png_ptr->current_text_size = (png_size_t)length; - png_ptr->current_text_left = (png_size_t)length; - png_ptr->process_mode = PNG_READ_zTXt_MODE; -} - -void /* PRIVATE */ -png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr) -{ - if (png_ptr->buffer_size && png_ptr->current_text_left) - { - png_size_t text_size; - - if (png_ptr->buffer_size < (png_uint_32)png_ptr->current_text_left) - text_size = png_ptr->buffer_size; - else - text_size = png_ptr->current_text_left; - png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size); - png_ptr->current_text_left -= text_size; - png_ptr->current_text_ptr += text_size; - } - if (!(png_ptr->current_text_left)) - { - png_textp text_ptr; - png_charp text; - png_charp key; - int ret; - png_size_t text_size, key_size; - - if (png_ptr->buffer_size < 4) - { - png_push_save_buffer(png_ptr); - return; - } - - png_push_crc_finish(png_ptr); - - key = png_ptr->current_text; - - for (text = key; *text; text++) - /* empty loop */ ; - - /* zTXt can't have zero text */ - if (text == key + png_ptr->current_text_size) - { - png_ptr->current_text = NULL; - png_free(png_ptr, key); - return; - } - - text++; - - if (*text != PNG_TEXT_COMPRESSION_zTXt) /* check compression byte */ - { - png_ptr->current_text = NULL; - png_free(png_ptr, key); - return; - } - - text++; - - png_ptr->zstream.next_in = (png_bytep )text; - png_ptr->zstream.avail_in = (uInt)(png_ptr->current_text_size - - (text - key)); - png_ptr->zstream.next_out = png_ptr->zbuf; - png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; - - key_size = text - key; - text_size = 0; - text = NULL; - ret = Z_STREAM_END; - - while (png_ptr->zstream.avail_in) - { - ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH); - if (ret != Z_OK && ret != Z_STREAM_END) - { - inflateReset(&png_ptr->zstream); - png_ptr->zstream.avail_in = 0; - png_ptr->current_text = NULL; - png_free(png_ptr, key); - png_free(png_ptr, text); - return; - } - if (!(png_ptr->zstream.avail_out) || ret == Z_STREAM_END) - { - if (text == NULL) - { - text = (png_charp)png_malloc(png_ptr, - (png_uint_32)(png_ptr->zbuf_size - png_ptr->zstream.avail_out - + key_size + 1)); - png_memcpy(text + key_size, png_ptr->zbuf, - png_ptr->zbuf_size - png_ptr->zstream.avail_out); - png_memcpy(text, key, key_size); - text_size = key_size + png_ptr->zbuf_size - - png_ptr->zstream.avail_out; - *(text + text_size) = '\0'; - } - else - { - png_charp tmp; - - tmp = text; - text = (png_charp)png_malloc(png_ptr, text_size + - (png_uint_32)(png_ptr->zbuf_size - png_ptr->zstream.avail_out - + 1)); - png_memcpy(text, tmp, text_size); - png_free(png_ptr, tmp); - png_memcpy(text + text_size, png_ptr->zbuf, - png_ptr->zbuf_size - png_ptr->zstream.avail_out); - text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out; - *(text + text_size) = '\0'; - } - if (ret != Z_STREAM_END) - { - png_ptr->zstream.next_out = png_ptr->zbuf; - png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; - } - } - else - { - break; - } - - if (ret == Z_STREAM_END) - break; - } - - inflateReset(&png_ptr->zstream); - png_ptr->zstream.avail_in = 0; - - if (ret != Z_STREAM_END) - { - png_ptr->current_text = NULL; - png_free(png_ptr, key); - png_free(png_ptr, text); - return; - } - - png_ptr->current_text = NULL; - png_free(png_ptr, key); - key = text; - text += key_size; - - text_ptr = (png_textp)png_malloc(png_ptr, - (png_uint_32)png_sizeof(png_text)); - text_ptr->compression = PNG_TEXT_COMPRESSION_zTXt; - text_ptr->key = key; -#ifdef PNG_iTXt_SUPPORTED - text_ptr->lang = NULL; - text_ptr->lang_key = NULL; -#endif - text_ptr->text = text; - - ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1); - - png_free(png_ptr, key); - png_free(png_ptr, text_ptr); - - if (ret) - png_warning(png_ptr, "Insufficient memory to store text chunk."); - } -} -#endif - -#if defined(PNG_READ_iTXt_SUPPORTED) -void /* PRIVATE */ -png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 - length) -{ - if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND)) - { - png_error(png_ptr, "Out of place iTXt"); - /* to quiet some compiler warnings */ - if(info_ptr == NULL) return; - } - -#ifdef PNG_MAX_MALLOC_64K - png_ptr->skip_length = 0; /* This may not be necessary */ - - if (length > (png_uint_32)65535L) /* Can't hold entire string in memory */ - { - png_warning(png_ptr, "iTXt chunk too large to fit in memory"); - png_ptr->skip_length = length - (png_uint_32)65535L; - length = (png_uint_32)65535L; - } -#endif - - png_ptr->current_text = (png_charp)png_malloc(png_ptr, - (png_uint_32)(length+1)); - png_ptr->current_text[length] = '\0'; - png_ptr->current_text_ptr = png_ptr->current_text; - png_ptr->current_text_size = (png_size_t)length; - png_ptr->current_text_left = (png_size_t)length; - png_ptr->process_mode = PNG_READ_iTXt_MODE; -} - -void /* PRIVATE */ -png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr) -{ - - if (png_ptr->buffer_size && png_ptr->current_text_left) - { - png_size_t text_size; - - if (png_ptr->buffer_size < png_ptr->current_text_left) - text_size = png_ptr->buffer_size; - else - text_size = png_ptr->current_text_left; - png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size); - png_ptr->current_text_left -= text_size; - png_ptr->current_text_ptr += text_size; - } - if (!(png_ptr->current_text_left)) - { - png_textp text_ptr; - png_charp key; - int comp_flag; - png_charp lang; - png_charp lang_key; - png_charp text; - int ret; - - if (png_ptr->buffer_size < 4) - { - png_push_save_buffer(png_ptr); - return; - } - - png_push_crc_finish(png_ptr); - -#if defined(PNG_MAX_MALLOC_64K) - if (png_ptr->skip_length) - return; -#endif - - key = png_ptr->current_text; - - for (lang = key; *lang; lang++) - /* empty loop */ ; - - if (lang != key + png_ptr->current_text_size) - lang++; - - comp_flag = *lang++; - lang++; /* skip comp_type, always zero */ - - for (lang_key = lang; *lang_key; lang_key++) - /* empty loop */ ; - lang_key++; /* skip NUL separator */ - - for (text = lang_key; *text; text++) - /* empty loop */ ; - - if (text != key + png_ptr->current_text_size) - text++; - - text_ptr = (png_textp)png_malloc(png_ptr, - (png_uint_32)png_sizeof(png_text)); - text_ptr->compression = comp_flag + 2; - text_ptr->key = key; - text_ptr->lang = lang; - text_ptr->lang_key = lang_key; - text_ptr->text = text; - text_ptr->text_length = 0; - text_ptr->itxt_length = png_strlen(text); - - ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1); - - png_ptr->current_text = NULL; - - png_free(png_ptr, text_ptr); - if (ret) - png_warning(png_ptr, "Insufficient memory to store iTXt chunk."); - } -} -#endif - -/* This function is called when we haven't found a handler for this - * chunk. If there isn't a problem with the chunk itself (ie a bad chunk - * name or a critical chunk), the chunk is (currently) silently ignored. - */ -void /* PRIVATE */ -png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 - length) -{ - png_uint_32 skip=0; - png_check_chunk_name(png_ptr, png_ptr->chunk_name); - - if (!(png_ptr->chunk_name[0] & 0x20)) - { -#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) - if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) != - PNG_HANDLE_CHUNK_ALWAYS -#if defined(PNG_READ_USER_CHUNKS_SUPPORTED) - && png_ptr->read_user_chunk_fn == NULL -#endif - ) -#endif - png_chunk_error(png_ptr, "unknown critical chunk"); - - /* to quiet compiler warnings about unused info_ptr */ - if (info_ptr == NULL) - return; - } - -#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) - if (png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS) - { -#ifdef PNG_MAX_MALLOC_64K - if (length > (png_uint_32)65535L) - { - png_warning(png_ptr, "unknown chunk too large to fit in memory"); - skip = length - (png_uint_32)65535L; - length = (png_uint_32)65535L; - } -#endif - png_strcpy((png_charp)png_ptr->unknown_chunk.name, - (png_charp)png_ptr->chunk_name); - png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, length); - png_ptr->unknown_chunk.size = (png_size_t)length; - png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length); -#if defined(PNG_READ_USER_CHUNKS_SUPPORTED) - if(png_ptr->read_user_chunk_fn != NULL) - { - /* callback to user unknown chunk handler */ - int ret; - ret = (*(png_ptr->read_user_chunk_fn)) - (png_ptr, &png_ptr->unknown_chunk); - if (ret < 0) - png_chunk_error(png_ptr, "error in user chunk"); - if (ret == 0) - { - if (!(png_ptr->chunk_name[0] & 0x20)) - if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) != - PNG_HANDLE_CHUNK_ALWAYS) - png_chunk_error(png_ptr, "unknown critical chunk"); - png_set_unknown_chunks(png_ptr, info_ptr, - &png_ptr->unknown_chunk, 1); - } - } -#else - png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1); -#endif - png_free(png_ptr, png_ptr->unknown_chunk.data); - png_ptr->unknown_chunk.data = NULL; - } - else -#endif - skip=length; - png_push_crc_skip(png_ptr, skip); -} - -void /* PRIVATE */ -png_push_have_info(png_structp png_ptr, png_infop info_ptr) -{ - if (png_ptr->info_fn != NULL) - (*(png_ptr->info_fn))(png_ptr, info_ptr); -} - -void /* PRIVATE */ -png_push_have_end(png_structp png_ptr, png_infop info_ptr) -{ - if (png_ptr->end_fn != NULL) - (*(png_ptr->end_fn))(png_ptr, info_ptr); -} - -void /* PRIVATE */ -png_push_have_row(png_structp png_ptr, png_bytep row) -{ - if (png_ptr->row_fn != NULL) - (*(png_ptr->row_fn))(png_ptr, row, png_ptr->row_number, - (int)png_ptr->pass); -} - -void PNGAPI -png_progressive_combine_row (png_structp png_ptr, - png_bytep old_row, png_bytep new_row) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - const int FARDATA png_pass_dsp_mask[7] = - {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff}; -#endif - if(png_ptr == NULL) return; - if (new_row != NULL) /* new_row must == png_ptr->row_buf here. */ - png_combine_row(png_ptr, old_row, png_pass_dsp_mask[png_ptr->pass]); -} - -void PNGAPI -png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr, - png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, - png_progressive_end_ptr end_fn) -{ - if(png_ptr == NULL) return; - png_ptr->info_fn = info_fn; - png_ptr->row_fn = row_fn; - png_ptr->end_fn = end_fn; - - png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer); -} - -png_voidp PNGAPI -png_get_progressive_ptr(png_structp png_ptr) -{ - if(png_ptr == NULL) return (NULL); - return png_ptr->io_ptr; -} -#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ diff --git a/src/dep/src/irrlicht/libpng/pngread.c b/src/dep/src/irrlicht/libpng/pngread.c index c8ec4da..dbda812 100644 --- a/src/dep/src/irrlicht/libpng/pngread.c +++ b/src/dep/src/irrlicht/libpng/pngread.c @@ -1,9 +1,9 @@ /* pngread.c - read a PNG file * - * Last changed in libpng 1.2.35 [February 14, 2009] + * Last changed in libpng 1.2.30 [August 15, 2008] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2009 Glenn Randers-Pehrson + * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -47,7 +47,7 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, int i; - png_debug(1, "in png_create_read_struct"); + png_debug(1, "in png_create_read_struct\n"); #ifdef PNG_USER_MEM_SUPPORTED png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG, (png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr); @@ -263,7 +263,7 @@ png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver, } } while (png_libpng_ver[i++]); - png_debug(1, "in png_read_init_3"); + png_debug(1, "in png_read_init_3\n"); #ifdef PNG_SETJMP_SUPPORTED /* save jump buffer and error functions */ @@ -327,7 +327,7 @@ void PNGAPI png_read_info(png_structp png_ptr, png_infop info_ptr) { if (png_ptr == NULL || info_ptr == NULL) return; - png_debug(1, "in png_read_info"); + png_debug(1, "in png_read_info\n"); /* If we haven't checked all of the PNG signature bytes, do so now. */ if (png_ptr->sig_bytes < 8) { @@ -533,7 +533,7 @@ png_read_info(png_structp png_ptr, png_infop info_ptr) void PNGAPI png_read_update_info(png_structp png_ptr, png_infop info_ptr) { - png_debug(1, "in png_read_update_info"); + png_debug(1, "in png_read_update_info\n"); if (png_ptr == NULL) return; if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) png_read_start_row(png_ptr); @@ -552,7 +552,7 @@ png_read_update_info(png_structp png_ptr, png_infop info_ptr) void PNGAPI png_start_read_image(png_structp png_ptr) { - png_debug(1, "in png_start_read_image"); + png_debug(1, "in png_start_read_image\n"); if (png_ptr == NULL) return; if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) png_read_start_row(png_ptr); @@ -571,7 +571,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row) #endif int ret; if (png_ptr == NULL) return; - png_debug2(1, "in png_read_row (row %lu, pass %d)", + png_debug2(1, "in png_read_row (row %lu, pass %d)\n", png_ptr->row_number, png_ptr->pass); if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) png_read_start_row(png_ptr); @@ -822,7 +822,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row, png_bytepp rp; png_bytepp dp; - png_debug(1, "in png_read_rows"); + png_debug(1, "in png_read_rows\n"); if (png_ptr == NULL) return; rp = row; dp = display_row; @@ -871,7 +871,7 @@ png_read_image(png_structp png_ptr, png_bytepp image) int pass, j; png_bytepp rp; - png_debug(1, "in png_read_image"); + png_debug(1, "in png_read_image\n"); if (png_ptr == NULL) return; #ifdef PNG_READ_INTERLACING_SUPPORTED @@ -907,7 +907,7 @@ png_read_image(png_structp png_ptr, png_bytepp image) void PNGAPI png_read_end(png_structp png_ptr, png_infop info_ptr) { - png_debug(1, "in png_read_end"); + png_debug(1, "in png_read_end\n"); if (png_ptr == NULL) return; png_crc_finish(png_ptr, 0); /* Finish off CRC from last IDAT chunk */ @@ -1087,7 +1087,7 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_voidp mem_ptr = NULL; #endif - png_debug(1, "in png_destroy_read_struct"); + png_debug(1, "in png_destroy_read_struct\n"); if (png_ptr_ptr != NULL) png_ptr = *png_ptr_ptr; if (png_ptr == NULL) @@ -1161,7 +1161,7 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr png_free_ptr free_fn; #endif - png_debug(1, "in png_read_destroy"); + png_debug(1, "in png_read_destroy\n"); if (info_ptr != NULL) png_info_destroy(png_ptr, info_ptr); @@ -1437,11 +1437,11 @@ png_read_png(png_structp png_ptr, png_infop info_ptr, #ifdef PNG_FREE_ME_SUPPORTED info_ptr->free_me |= PNG_FREE_ROWS; #endif - png_memset(info_ptr->row_pointers, 0, info_ptr->height - * png_sizeof(png_bytep)); for (row = 0; row < (int)info_ptr->height; row++) + { info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr)); + } } png_read_image(png_ptr, info_ptr->row_pointers); @@ -1457,1476 +1457,3 @@ png_read_png(png_structp png_ptr, png_infop info_ptr, #endif /* PNG_INFO_IMAGE_SUPPORTED */ #endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ #endif /* PNG_READ_SUPPORTED */ - -/* pngread.c - read a PNG file - * - * Last changed in libpng 1.2.15 January 5, 2007 - * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - * - * This file contains routines that an application calls directly to - * read a PNG file or stream. - */ - -#define PNG_INTERNAL -#include "png.h" - -#if defined(PNG_READ_SUPPORTED) - -/* Create a PNG structure for reading, and allocate any memory needed. */ -png_structp PNGAPI -png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr, - png_error_ptr error_fn, png_error_ptr warn_fn) -{ - -#ifdef PNG_USER_MEM_SUPPORTED - return (png_create_read_struct_2(user_png_ver, error_ptr, error_fn, - warn_fn, png_voidp_NULL, png_malloc_ptr_NULL, png_free_ptr_NULL)); -} - -/* Alternate create PNG structure for reading, and allocate any memory needed. */ -png_structp PNGAPI -png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, - png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, - png_malloc_ptr malloc_fn, png_free_ptr free_fn) -{ -#endif /* PNG_USER_MEM_SUPPORTED */ - - png_structp png_ptr; - -#ifdef PNG_SETJMP_SUPPORTED -#ifdef USE_FAR_KEYWORD - jmp_buf jmpbuf; -#endif -#endif - - int i; - - png_debug(1, "in png_create_read_struct\n"); -#ifdef PNG_USER_MEM_SUPPORTED - png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG, - (png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr); -#else - png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG); -#endif - if (png_ptr == NULL) - return (NULL); - -#if !defined(PNG_1_0_X) -#ifdef PNG_MMX_CODE_SUPPORTED - png_init_mmx_flags(png_ptr); /* 1.2.0 addition */ -#endif -#endif /* PNG_1_0_X */ - - /* added at libpng-1.2.6 */ -#ifdef PNG_SET_USER_LIMITS_SUPPORTED - png_ptr->user_width_max=PNG_USER_WIDTH_MAX; - png_ptr->user_height_max=PNG_USER_HEIGHT_MAX; -#endif - -#ifdef PNG_SETJMP_SUPPORTED -#ifdef USE_FAR_KEYWORD - if (setjmp(jmpbuf)) -#else - if (setjmp(png_ptr->jmpbuf)) -#endif - { - png_free(png_ptr, png_ptr->zbuf); - png_ptr->zbuf=NULL; -#ifdef PNG_USER_MEM_SUPPORTED - png_destroy_struct_2((png_voidp)png_ptr, - (png_free_ptr)free_fn, (png_voidp)mem_ptr); -#else - png_destroy_struct((png_voidp)png_ptr); -#endif - return (NULL); - } -#ifdef USE_FAR_KEYWORD - png_memcpy(png_ptr->jmpbuf,jmpbuf,png_sizeof(jmp_buf)); -#endif -#endif - -#ifdef PNG_USER_MEM_SUPPORTED - png_set_mem_fn(png_ptr, mem_ptr, malloc_fn, free_fn); -#endif - - png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn); - - i=0; - do - { - if(user_png_ver[i] != png_libpng_ver[i]) - png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; - } while (png_libpng_ver[i++]); - - if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH) - { - /* Libpng 0.90 and later are binary incompatible with libpng 0.89, so - * we must recompile any applications that use any older library version. - * For versions after libpng 1.0, we will be compatible, so we need - * only check the first digit. - */ - if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] || - (user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) || - (user_png_ver[0] == '0' && user_png_ver[2] < '9')) - { -#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) - char msg[80]; - if (user_png_ver) - { - sprintf(msg, "Application was compiled with png.h from libpng-%.20s", - user_png_ver); - png_warning(png_ptr, msg); - } - sprintf(msg, "Application is running with png.c from libpng-%.20s", - png_libpng_ver); - png_warning(png_ptr, msg); -#endif -#ifdef PNG_ERROR_NUMBERS_SUPPORTED - png_ptr->flags=0; -#endif - png_error(png_ptr, - "Incompatible libpng version in application and library"); - } - } - - /* initialize zbuf - compression buffer */ - png_ptr->zbuf_size = PNG_ZBUF_SIZE; - png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, - (png_uint_32)png_ptr->zbuf_size); - png_ptr->zstream.zalloc = png_zalloc; - png_ptr->zstream.zfree = png_zfree; - png_ptr->zstream.opaque = (voidpf)png_ptr; - - switch (inflateInit(&png_ptr->zstream)) - { - case Z_OK: /* Do nothing */ break; - case Z_MEM_ERROR: - case Z_STREAM_ERROR: png_error(png_ptr, "zlib memory error"); break; - case Z_VERSION_ERROR: png_error(png_ptr, "zlib version error"); break; - default: png_error(png_ptr, "Unknown zlib error"); - } - - png_ptr->zstream.next_out = png_ptr->zbuf; - png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; - - png_set_read_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL); - -#ifdef PNG_SETJMP_SUPPORTED -/* Applications that neglect to set up their own setjmp() and then encounter - a png_error() will longjmp here. Since the jmpbuf is then meaningless we - abort instead of returning. */ -#ifdef USE_FAR_KEYWORD - if (setjmp(jmpbuf)) - PNG_ABORT(); - png_memcpy(png_ptr->jmpbuf,jmpbuf,png_sizeof(jmp_buf)); -#else - if (setjmp(png_ptr->jmpbuf)) - PNG_ABORT(); -#endif -#endif - return (png_ptr); -} - -#if defined(PNG_1_0_X) || defined(PNG_1_2_X) -/* Initialize PNG structure for reading, and allocate any memory needed. - This interface is deprecated in favour of the png_create_read_struct(), - and it will disappear as of libpng-1.3.0. */ -#undef png_read_init -void PNGAPI -png_read_init(png_structp png_ptr) -{ - /* We only come here via pre-1.0.7-compiled applications */ - png_read_init_2(png_ptr, "1.0.6 or earlier", 0, 0); -} - -void PNGAPI -png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver, - png_size_t png_struct_size, png_size_t png_info_size) -{ - /* We only come here via pre-1.0.12-compiled applications */ - if(png_ptr == NULL) return; -#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) - if(png_sizeof(png_struct) > png_struct_size || - png_sizeof(png_info) > png_info_size) - { - char msg[80]; - png_ptr->warning_fn=NULL; - if (user_png_ver) - { - sprintf(msg, "Application was compiled with png.h from libpng-%.20s", - user_png_ver); - png_warning(png_ptr, msg); - } - sprintf(msg, "Application is running with png.c from libpng-%.20s", - png_libpng_ver); - png_warning(png_ptr, msg); - } -#endif - if(png_sizeof(png_struct) > png_struct_size) - { - png_ptr->error_fn=NULL; -#ifdef PNG_ERROR_NUMBERS_SUPPORTED - png_ptr->flags=0; -#endif - png_error(png_ptr, - "The png struct allocated by the application for reading is too small."); - } - if(png_sizeof(png_info) > png_info_size) - { - png_ptr->error_fn=NULL; -#ifdef PNG_ERROR_NUMBERS_SUPPORTED - png_ptr->flags=0; -#endif - png_error(png_ptr, - "The info struct allocated by application for reading is too small."); - } - png_read_init_3(&png_ptr, user_png_ver, png_struct_size); -} -#endif /* PNG_1_0_X || PNG_1_2_X */ - -void PNGAPI -png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver, - png_size_t png_struct_size) -{ -#ifdef PNG_SETJMP_SUPPORTED - jmp_buf tmp_jmp; /* to save current jump buffer */ -#endif - - int i=0; - - png_structp png_ptr=*ptr_ptr; - - if(png_ptr == NULL) return; - - do - { - if(user_png_ver[i] != png_libpng_ver[i]) - { -#ifdef PNG_LEGACY_SUPPORTED - png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; -#else - png_ptr->warning_fn=NULL; - png_warning(png_ptr, - "Application uses deprecated png_read_init() and should be recompiled."); - break; -#endif - } - } while (png_libpng_ver[i++]); - - png_debug(1, "in png_read_init_3\n"); - -#ifdef PNG_SETJMP_SUPPORTED - /* save jump buffer and error functions */ - png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof (jmp_buf)); -#endif - - if(png_sizeof(png_struct) > png_struct_size) - { - png_destroy_struct(png_ptr); - *ptr_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG); - png_ptr = *ptr_ptr; - } - - /* reset all variables to 0 */ - png_memset(png_ptr, 0, png_sizeof (png_struct)); - -#ifdef PNG_SETJMP_SUPPORTED - /* restore jump buffer */ - png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof (jmp_buf)); -#endif - - /* added at libpng-1.2.6 */ -#ifdef PNG_SET_USER_LIMITS_SUPPORTED - png_ptr->user_width_max=PNG_USER_WIDTH_MAX; - png_ptr->user_height_max=PNG_USER_HEIGHT_MAX; -#endif - - /* initialize zbuf - compression buffer */ - png_ptr->zbuf_size = PNG_ZBUF_SIZE; - png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, - (png_uint_32)png_ptr->zbuf_size); - png_ptr->zstream.zalloc = png_zalloc; - png_ptr->zstream.zfree = png_zfree; - png_ptr->zstream.opaque = (voidpf)png_ptr; - - switch (inflateInit(&png_ptr->zstream)) - { - case Z_OK: /* Do nothing */ break; - case Z_MEM_ERROR: - case Z_STREAM_ERROR: png_error(png_ptr, "zlib memory"); break; - case Z_VERSION_ERROR: png_error(png_ptr, "zlib version"); break; - default: png_error(png_ptr, "Unknown zlib error"); - } - - png_ptr->zstream.next_out = png_ptr->zbuf; - png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; - - png_set_read_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL); -} - -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED -/* Read the information before the actual image data. This has been - * changed in v0.90 to allow reading a file that already has the magic - * bytes read from the stream. You can tell libpng how many bytes have - * been read from the beginning of the stream (up to the maximum of 8) - * via png_set_sig_bytes(), and we will only check the remaining bytes - * here. The application can then have access to the signature bytes we - * read if it is determined that this isn't a valid PNG file. - */ -void PNGAPI -png_read_info(png_structp png_ptr, png_infop info_ptr) -{ - if(png_ptr == NULL) return; - png_debug(1, "in png_read_info\n"); - /* If we haven't checked all of the PNG signature bytes, do so now. */ - if (png_ptr->sig_bytes < 8) - { - png_size_t num_checked = png_ptr->sig_bytes, - num_to_check = 8 - num_checked; - - png_read_data(png_ptr, &(info_ptr->signature[num_checked]), num_to_check); - png_ptr->sig_bytes = 8; - - if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check)) - { - if (num_checked < 4 && - png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4)) - png_error(png_ptr, "Not a PNG file"); - else - png_error(png_ptr, "PNG file corrupted by ASCII conversion"); - } - if (num_checked < 3) - png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE; - } - - for(;;) - { -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_IHDR; - PNG_IDAT; - PNG_IEND; - PNG_PLTE; -#if defined(PNG_READ_bKGD_SUPPORTED) - PNG_bKGD; -#endif -#if defined(PNG_READ_cHRM_SUPPORTED) - PNG_cHRM; -#endif -#if defined(PNG_READ_gAMA_SUPPORTED) - PNG_gAMA; -#endif -#if defined(PNG_READ_hIST_SUPPORTED) - PNG_hIST; -#endif -#if defined(PNG_READ_iCCP_SUPPORTED) - PNG_iCCP; -#endif -#if defined(PNG_READ_iTXt_SUPPORTED) - PNG_iTXt; -#endif -#if defined(PNG_READ_oFFs_SUPPORTED) - PNG_oFFs; -#endif -#if defined(PNG_READ_pCAL_SUPPORTED) - PNG_pCAL; -#endif -#if defined(PNG_READ_pHYs_SUPPORTED) - PNG_pHYs; -#endif -#if defined(PNG_READ_sBIT_SUPPORTED) - PNG_sBIT; -#endif -#if defined(PNG_READ_sCAL_SUPPORTED) - PNG_sCAL; -#endif -#if defined(PNG_READ_sPLT_SUPPORTED) - PNG_sPLT; -#endif -#if defined(PNG_READ_sRGB_SUPPORTED) - PNG_sRGB; -#endif -#if defined(PNG_READ_tEXt_SUPPORTED) - PNG_tEXt; -#endif -#if defined(PNG_READ_tIME_SUPPORTED) - PNG_tIME; -#endif -#if defined(PNG_READ_tRNS_SUPPORTED) - PNG_tRNS; -#endif -#if defined(PNG_READ_zTXt_SUPPORTED) - PNG_zTXt; -#endif -#endif /* PNG_USE_LOCAL_ARRAYS */ - png_byte chunk_length[4]; - png_uint_32 length; - - png_read_data(png_ptr, chunk_length, 4); - length = png_get_uint_31(png_ptr,chunk_length); - - png_reset_crc(png_ptr); - png_crc_read(png_ptr, png_ptr->chunk_name, 4); - - png_debug2(0, "Reading %s chunk, length=%lu.\n", png_ptr->chunk_name, - length); - - /* This should be a binary subdivision search or a hash for - * matching the chunk name rather than a linear search. - */ - if (!png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4)) - if(png_ptr->mode & PNG_AFTER_IDAT) - png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT; - - if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4)) - png_handle_IHDR(png_ptr, info_ptr, length); - else if (!png_memcmp(png_ptr->chunk_name, png_IEND, 4)) - png_handle_IEND(png_ptr, info_ptr, length); -#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED - else if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name)) - { - if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) - png_ptr->mode |= PNG_HAVE_IDAT; - png_handle_unknown(png_ptr, info_ptr, length); - if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) - png_ptr->mode |= PNG_HAVE_PLTE; - else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) - { - if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before IDAT"); - else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && - !(png_ptr->mode & PNG_HAVE_PLTE)) - png_error(png_ptr, "Missing PLTE before IDAT"); - break; - } - } -#endif - else if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) - png_handle_PLTE(png_ptr, info_ptr, length); - else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) - { - if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before IDAT"); - else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && - !(png_ptr->mode & PNG_HAVE_PLTE)) - png_error(png_ptr, "Missing PLTE before IDAT"); - - png_ptr->idat_size = length; - png_ptr->mode |= PNG_HAVE_IDAT; - break; - } -#if defined(PNG_READ_bKGD_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_bKGD, 4)) - png_handle_bKGD(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_cHRM_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_cHRM, 4)) - png_handle_cHRM(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_gAMA_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_gAMA, 4)) - png_handle_gAMA(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_hIST_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_hIST, 4)) - png_handle_hIST(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_oFFs_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_oFFs, 4)) - png_handle_oFFs(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_pCAL_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_pCAL, 4)) - png_handle_pCAL(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_sCAL_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_sCAL, 4)) - png_handle_sCAL(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_pHYs_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_pHYs, 4)) - png_handle_pHYs(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_sBIT_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_sBIT, 4)) - png_handle_sBIT(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_sRGB_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_sRGB, 4)) - png_handle_sRGB(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_iCCP_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_iCCP, 4)) - png_handle_iCCP(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_sPLT_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_sPLT, 4)) - png_handle_sPLT(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_tEXt_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_tEXt, 4)) - png_handle_tEXt(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_tIME_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_tIME, 4)) - png_handle_tIME(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_tRNS_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_tRNS, 4)) - png_handle_tRNS(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_zTXt_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_zTXt, 4)) - png_handle_zTXt(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_iTXt_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_iTXt, 4)) - png_handle_iTXt(png_ptr, info_ptr, length); -#endif - else - png_handle_unknown(png_ptr, info_ptr, length); - } -} -#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ - -/* optional call to update the users info_ptr structure */ -void PNGAPI -png_read_update_info(png_structp png_ptr, png_infop info_ptr) -{ - png_debug(1, "in png_read_update_info\n"); - if(png_ptr == NULL) return; - if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) - png_read_start_row(png_ptr); - else - png_warning(png_ptr, - "Ignoring extra png_read_update_info() call; row buffer not reallocated"); - png_read_transform_info(png_ptr, info_ptr); -} - -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED -/* Initialize palette, background, etc, after transformations - * are set, but before any reading takes place. This allows - * the user to obtain a gamma-corrected palette, for example. - * If the user doesn't call this, we will do it ourselves. - */ -void PNGAPI -png_start_read_image(png_structp png_ptr) -{ - png_debug(1, "in png_start_read_image\n"); - if(png_ptr == NULL) return; - if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) - png_read_start_row(png_ptr); -} -#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ - -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED -void PNGAPI -png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_IDAT; - const int png_pass_dsp_mask[7] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff}; - const int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff}; -#endif - int ret; - if(png_ptr == NULL) return; - png_debug2(1, "in png_read_row (row %lu, pass %d)\n", - png_ptr->row_number, png_ptr->pass); - if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) - png_read_start_row(png_ptr); - if (png_ptr->row_number == 0 && png_ptr->pass == 0) - { - /* check for transforms that have been set but were defined out */ -#if defined(PNG_WRITE_INVERT_SUPPORTED) && !defined(PNG_READ_INVERT_SUPPORTED) - if (png_ptr->transformations & PNG_INVERT_MONO) - png_warning(png_ptr, "PNG_READ_INVERT_SUPPORTED is not defined."); -#endif -#if defined(PNG_WRITE_FILLER_SUPPORTED) && !defined(PNG_READ_FILLER_SUPPORTED) - if (png_ptr->transformations & PNG_FILLER) - png_warning(png_ptr, "PNG_READ_FILLER_SUPPORTED is not defined."); -#endif -#if defined(PNG_WRITE_PACKSWAP_SUPPORTED) && !defined(PNG_READ_PACKSWAP_SUPPORTED) - if (png_ptr->transformations & PNG_PACKSWAP) - png_warning(png_ptr, "PNG_READ_PACKSWAP_SUPPORTED is not defined."); -#endif -#if defined(PNG_WRITE_PACK_SUPPORTED) && !defined(PNG_READ_PACK_SUPPORTED) - if (png_ptr->transformations & PNG_PACK) - png_warning(png_ptr, "PNG_READ_PACK_SUPPORTED is not defined."); -#endif -#if defined(PNG_WRITE_SHIFT_SUPPORTED) && !defined(PNG_READ_SHIFT_SUPPORTED) - if (png_ptr->transformations & PNG_SHIFT) - png_warning(png_ptr, "PNG_READ_SHIFT_SUPPORTED is not defined."); -#endif -#if defined(PNG_WRITE_BGR_SUPPORTED) && !defined(PNG_READ_BGR_SUPPORTED) - if (png_ptr->transformations & PNG_BGR) - png_warning(png_ptr, "PNG_READ_BGR_SUPPORTED is not defined."); -#endif -#if defined(PNG_WRITE_SWAP_SUPPORTED) && !defined(PNG_READ_SWAP_SUPPORTED) - if (png_ptr->transformations & PNG_SWAP_BYTES) - png_warning(png_ptr, "PNG_READ_SWAP_SUPPORTED is not defined."); -#endif - } - -#if defined(PNG_READ_INTERLACING_SUPPORTED) - /* if interlaced and we do not need a new row, combine row and return */ - if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE)) - { - switch (png_ptr->pass) - { - case 0: - if (png_ptr->row_number & 0x07) - { - if (dsp_row != NULL) - png_combine_row(png_ptr, dsp_row, - png_pass_dsp_mask[png_ptr->pass]); - png_read_finish_row(png_ptr); - return; - } - break; - case 1: - if ((png_ptr->row_number & 0x07) || png_ptr->width < 5) - { - if (dsp_row != NULL) - png_combine_row(png_ptr, dsp_row, - png_pass_dsp_mask[png_ptr->pass]); - png_read_finish_row(png_ptr); - return; - } - break; - case 2: - if ((png_ptr->row_number & 0x07) != 4) - { - if (dsp_row != NULL && (png_ptr->row_number & 4)) - png_combine_row(png_ptr, dsp_row, - png_pass_dsp_mask[png_ptr->pass]); - png_read_finish_row(png_ptr); - return; - } - break; - case 3: - if ((png_ptr->row_number & 3) || png_ptr->width < 3) - { - if (dsp_row != NULL) - png_combine_row(png_ptr, dsp_row, - png_pass_dsp_mask[png_ptr->pass]); - png_read_finish_row(png_ptr); - return; - } - break; - case 4: - if ((png_ptr->row_number & 3) != 2) - { - if (dsp_row != NULL && (png_ptr->row_number & 2)) - png_combine_row(png_ptr, dsp_row, - png_pass_dsp_mask[png_ptr->pass]); - png_read_finish_row(png_ptr); - return; - } - break; - case 5: - if ((png_ptr->row_number & 1) || png_ptr->width < 2) - { - if (dsp_row != NULL) - png_combine_row(png_ptr, dsp_row, - png_pass_dsp_mask[png_ptr->pass]); - png_read_finish_row(png_ptr); - return; - } - break; - case 6: - if (!(png_ptr->row_number & 1)) - { - png_read_finish_row(png_ptr); - return; - } - break; - } - } -#endif - - if (!(png_ptr->mode & PNG_HAVE_IDAT)) - png_error(png_ptr, "Invalid attempt to read row data"); - - png_ptr->zstream.next_out = png_ptr->row_buf; - png_ptr->zstream.avail_out = (uInt)png_ptr->irowbytes; - do - { - if (!(png_ptr->zstream.avail_in)) - { - while (!png_ptr->idat_size) - { - png_byte chunk_length[4]; - - png_crc_finish(png_ptr, 0); - - png_read_data(png_ptr, chunk_length, 4); - png_ptr->idat_size = png_get_uint_31(png_ptr,chunk_length); - - png_reset_crc(png_ptr); - png_crc_read(png_ptr, png_ptr->chunk_name, 4); - if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) - png_error(png_ptr, "Not enough image data"); - } - png_ptr->zstream.avail_in = (uInt)png_ptr->zbuf_size; - png_ptr->zstream.next_in = png_ptr->zbuf; - if (png_ptr->zbuf_size > png_ptr->idat_size) - png_ptr->zstream.avail_in = (uInt)png_ptr->idat_size; - png_crc_read(png_ptr, png_ptr->zbuf, - (png_size_t)png_ptr->zstream.avail_in); - png_ptr->idat_size -= png_ptr->zstream.avail_in; - } - ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH); - if (ret == Z_STREAM_END) - { - if (png_ptr->zstream.avail_out || png_ptr->zstream.avail_in || - png_ptr->idat_size) - png_error(png_ptr, "Extra compressed data"); - png_ptr->mode |= PNG_AFTER_IDAT; - png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; - break; - } - if (ret != Z_OK) - png_error(png_ptr, png_ptr->zstream.msg ? png_ptr->zstream.msg : - "Decompression error"); - - } while (png_ptr->zstream.avail_out); - - png_ptr->row_info.color_type = png_ptr->color_type; - png_ptr->row_info.width = png_ptr->iwidth; - png_ptr->row_info.channels = png_ptr->channels; - png_ptr->row_info.bit_depth = png_ptr->bit_depth; - png_ptr->row_info.pixel_depth = png_ptr->pixel_depth; - png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth, - png_ptr->row_info.width); - - if(png_ptr->row_buf[0]) - png_read_filter_row(png_ptr, &(png_ptr->row_info), - png_ptr->row_buf + 1, png_ptr->prev_row + 1, - (int)(png_ptr->row_buf[0])); - - png_memcpy_check(png_ptr, png_ptr->prev_row, png_ptr->row_buf, - png_ptr->rowbytes + 1); - -#if defined(PNG_MNG_FEATURES_SUPPORTED) - if((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) && - (png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING)) - { - /* Intrapixel differencing */ - png_do_read_intrapixel(&(png_ptr->row_info), png_ptr->row_buf + 1); - } -#endif - - - if (png_ptr->transformations || (png_ptr->flags&PNG_FLAG_STRIP_ALPHA)) - png_do_read_transformations(png_ptr); - -#if defined(PNG_READ_INTERLACING_SUPPORTED) - /* blow up interlaced rows to full size */ - if (png_ptr->interlaced && - (png_ptr->transformations & PNG_INTERLACE)) - { - if (png_ptr->pass < 6) -/* old interface (pre-1.0.9): - png_do_read_interlace(&(png_ptr->row_info), - png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations); - */ - png_do_read_interlace(png_ptr); - - if (dsp_row != NULL) - png_combine_row(png_ptr, dsp_row, - png_pass_dsp_mask[png_ptr->pass]); - if (row != NULL) - png_combine_row(png_ptr, row, - png_pass_mask[png_ptr->pass]); - } - else -#endif - { - if (row != NULL) - png_combine_row(png_ptr, row, 0xff); - if (dsp_row != NULL) - png_combine_row(png_ptr, dsp_row, 0xff); - } - png_read_finish_row(png_ptr); - - if (png_ptr->read_row_fn != NULL) - (*(png_ptr->read_row_fn))(png_ptr, png_ptr->row_number, png_ptr->pass); -} -#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ - -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED -/* Read one or more rows of image data. If the image is interlaced, - * and png_set_interlace_handling() has been called, the rows need to - * contain the contents of the rows from the previous pass. If the - * image has alpha or transparency, and png_handle_alpha()[*] has been - * called, the rows contents must be initialized to the contents of the - * screen. - * - * "row" holds the actual image, and pixels are placed in it - * as they arrive. If the image is displayed after each pass, it will - * appear to "sparkle" in. "display_row" can be used to display a - * "chunky" progressive image, with finer detail added as it becomes - * available. If you do not want this "chunky" display, you may pass - * NULL for display_row. If you do not want the sparkle display, and - * you have not called png_handle_alpha(), you may pass NULL for rows. - * If you have called png_handle_alpha(), and the image has either an - * alpha channel or a transparency chunk, you must provide a buffer for - * rows. In this case, you do not have to provide a display_row buffer - * also, but you may. If the image is not interlaced, or if you have - * not called png_set_interlace_handling(), the display_row buffer will - * be ignored, so pass NULL to it. - * - * [*] png_handle_alpha() does not exist yet, as of this version of libpng - */ - -void PNGAPI -png_read_rows(png_structp png_ptr, png_bytepp row, - png_bytepp display_row, png_uint_32 num_rows) -{ - png_uint_32 i; - png_bytepp rp; - png_bytepp dp; - - png_debug(1, "in png_read_rows\n"); - if(png_ptr == NULL) return; - rp = row; - dp = display_row; - if (rp != NULL && dp != NULL) - for (i = 0; i < num_rows; i++) - { - png_bytep rptr = *rp++; - png_bytep dptr = *dp++; - - png_read_row(png_ptr, rptr, dptr); - } - else if(rp != NULL) - for (i = 0; i < num_rows; i++) - { - png_bytep rptr = *rp; - png_read_row(png_ptr, rptr, png_bytep_NULL); - rp++; - } - else if(dp != NULL) - for (i = 0; i < num_rows; i++) - { - png_bytep dptr = *dp; - png_read_row(png_ptr, png_bytep_NULL, dptr); - dp++; - } -} -#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ - -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED -/* Read the entire image. If the image has an alpha channel or a tRNS - * chunk, and you have called png_handle_alpha()[*], you will need to - * initialize the image to the current image that PNG will be overlaying. - * We set the num_rows again here, in case it was incorrectly set in - * png_read_start_row() by a call to png_read_update_info() or - * png_start_read_image() if png_set_interlace_handling() wasn't called - * prior to either of these functions like it should have been. You can - * only call this function once. If you desire to have an image for - * each pass of a interlaced image, use png_read_rows() instead. - * - * [*] png_handle_alpha() does not exist yet, as of this version of libpng - */ -void PNGAPI -png_read_image(png_structp png_ptr, png_bytepp image) -{ - png_uint_32 i,image_height; - int pass, j; - png_bytepp rp; - - png_debug(1, "in png_read_image\n"); - if(png_ptr == NULL) return; - -#ifdef PNG_READ_INTERLACING_SUPPORTED - pass = png_set_interlace_handling(png_ptr); -#else - if (png_ptr->interlaced) - png_error(png_ptr, - "Cannot read interlaced image -- interlace handler disabled."); - pass = 1; -#endif - - - image_height=png_ptr->height; - png_ptr->num_rows = image_height; /* Make sure this is set correctly */ - - for (j = 0; j < pass; j++) - { - rp = image; - for (i = 0; i < image_height; i++) - { - png_read_row(png_ptr, *rp, png_bytep_NULL); - rp++; - } - } -} -#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ - -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED -/* Read the end of the PNG file. Will not read past the end of the - * file, will verify the end is accurate, and will read any comments - * or time information at the end of the file, if info is not NULL. - */ -void PNGAPI -png_read_end(png_structp png_ptr, png_infop info_ptr) -{ - png_byte chunk_length[4]; - png_uint_32 length; - - png_debug(1, "in png_read_end\n"); - if(png_ptr == NULL) return; - png_crc_finish(png_ptr, 0); /* Finish off CRC from last IDAT chunk */ - - do - { -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_IHDR; - PNG_IDAT; - PNG_IEND; - PNG_PLTE; -#if defined(PNG_READ_bKGD_SUPPORTED) - PNG_bKGD; -#endif -#if defined(PNG_READ_cHRM_SUPPORTED) - PNG_cHRM; -#endif -#if defined(PNG_READ_gAMA_SUPPORTED) - PNG_gAMA; -#endif -#if defined(PNG_READ_hIST_SUPPORTED) - PNG_hIST; -#endif -#if defined(PNG_READ_iCCP_SUPPORTED) - PNG_iCCP; -#endif -#if defined(PNG_READ_iTXt_SUPPORTED) - PNG_iTXt; -#endif -#if defined(PNG_READ_oFFs_SUPPORTED) - PNG_oFFs; -#endif -#if defined(PNG_READ_pCAL_SUPPORTED) - PNG_pCAL; -#endif -#if defined(PNG_READ_pHYs_SUPPORTED) - PNG_pHYs; -#endif -#if defined(PNG_READ_sBIT_SUPPORTED) - PNG_sBIT; -#endif -#if defined(PNG_READ_sCAL_SUPPORTED) - PNG_sCAL; -#endif -#if defined(PNG_READ_sPLT_SUPPORTED) - PNG_sPLT; -#endif -#if defined(PNG_READ_sRGB_SUPPORTED) - PNG_sRGB; -#endif -#if defined(PNG_READ_tEXt_SUPPORTED) - PNG_tEXt; -#endif -#if defined(PNG_READ_tIME_SUPPORTED) - PNG_tIME; -#endif -#if defined(PNG_READ_tRNS_SUPPORTED) - PNG_tRNS; -#endif -#if defined(PNG_READ_zTXt_SUPPORTED) - PNG_zTXt; -#endif -#endif /* PNG_USE_LOCAL_ARRAYS */ - - png_read_data(png_ptr, chunk_length, 4); - length = png_get_uint_31(png_ptr,chunk_length); - - png_reset_crc(png_ptr); - png_crc_read(png_ptr, png_ptr->chunk_name, 4); - - png_debug1(0, "Reading %s chunk.\n", png_ptr->chunk_name); - - if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4)) - png_handle_IHDR(png_ptr, info_ptr, length); - else if (!png_memcmp(png_ptr->chunk_name, png_IEND, 4)) - png_handle_IEND(png_ptr, info_ptr, length); -#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED - else if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name)) - { - if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) - { - if ((length > 0) || (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT)) - png_error(png_ptr, "Too many IDAT's found"); - } - png_handle_unknown(png_ptr, info_ptr, length); - if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) - png_ptr->mode |= PNG_HAVE_PLTE; - } -#endif - else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) - { - /* Zero length IDATs are legal after the last IDAT has been - * read, but not after other chunks have been read. - */ - if ((length > 0) || (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT)) - png_error(png_ptr, "Too many IDAT's found"); - png_crc_finish(png_ptr, length); - } - else if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) - png_handle_PLTE(png_ptr, info_ptr, length); -#if defined(PNG_READ_bKGD_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_bKGD, 4)) - png_handle_bKGD(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_cHRM_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_cHRM, 4)) - png_handle_cHRM(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_gAMA_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_gAMA, 4)) - png_handle_gAMA(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_hIST_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_hIST, 4)) - png_handle_hIST(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_oFFs_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_oFFs, 4)) - png_handle_oFFs(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_pCAL_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_pCAL, 4)) - png_handle_pCAL(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_sCAL_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_sCAL, 4)) - png_handle_sCAL(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_pHYs_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_pHYs, 4)) - png_handle_pHYs(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_sBIT_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_sBIT, 4)) - png_handle_sBIT(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_sRGB_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_sRGB, 4)) - png_handle_sRGB(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_iCCP_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_iCCP, 4)) - png_handle_iCCP(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_sPLT_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_sPLT, 4)) - png_handle_sPLT(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_tEXt_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_tEXt, 4)) - png_handle_tEXt(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_tIME_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_tIME, 4)) - png_handle_tIME(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_tRNS_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_tRNS, 4)) - png_handle_tRNS(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_zTXt_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_zTXt, 4)) - png_handle_zTXt(png_ptr, info_ptr, length); -#endif -#if defined(PNG_READ_iTXt_SUPPORTED) - else if (!png_memcmp(png_ptr->chunk_name, png_iTXt, 4)) - png_handle_iTXt(png_ptr, info_ptr, length); -#endif - else - png_handle_unknown(png_ptr, info_ptr, length); - } while (!(png_ptr->mode & PNG_HAVE_IEND)); -} -#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ - -/* free all memory used by the read */ -void PNGAPI -png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, - png_infopp end_info_ptr_ptr) -{ - png_structp png_ptr = NULL; - png_infop info_ptr = NULL, end_info_ptr = NULL; -#ifdef PNG_USER_MEM_SUPPORTED - png_free_ptr free_fn; - png_voidp mem_ptr; -#endif - - png_debug(1, "in png_destroy_read_struct\n"); - if (png_ptr_ptr != NULL) - png_ptr = *png_ptr_ptr; - - if (info_ptr_ptr != NULL) - info_ptr = *info_ptr_ptr; - - if (end_info_ptr_ptr != NULL) - end_info_ptr = *end_info_ptr_ptr; - -#ifdef PNG_USER_MEM_SUPPORTED - free_fn = png_ptr->free_fn; - mem_ptr = png_ptr->mem_ptr; -#endif - - png_read_destroy(png_ptr, info_ptr, end_info_ptr); - - if (info_ptr != NULL) - { -#if defined(PNG_TEXT_SUPPORTED) - png_free_data(png_ptr, info_ptr, PNG_FREE_TEXT, -1); -#endif - -#ifdef PNG_USER_MEM_SUPPORTED - png_destroy_struct_2((png_voidp)info_ptr, (png_free_ptr)free_fn, - (png_voidp)mem_ptr); -#else - png_destroy_struct((png_voidp)info_ptr); -#endif - *info_ptr_ptr = NULL; - } - - if (end_info_ptr != NULL) - { -#if defined(PNG_READ_TEXT_SUPPORTED) - png_free_data(png_ptr, end_info_ptr, PNG_FREE_TEXT, -1); -#endif -#ifdef PNG_USER_MEM_SUPPORTED - png_destroy_struct_2((png_voidp)end_info_ptr, (png_free_ptr)free_fn, - (png_voidp)mem_ptr); -#else - png_destroy_struct((png_voidp)end_info_ptr); -#endif - *end_info_ptr_ptr = NULL; - } - - if (png_ptr != NULL) - { -#ifdef PNG_USER_MEM_SUPPORTED - png_destroy_struct_2((png_voidp)png_ptr, (png_free_ptr)free_fn, - (png_voidp)mem_ptr); -#else - png_destroy_struct((png_voidp)png_ptr); -#endif - *png_ptr_ptr = NULL; - } -} - -/* free all memory used by the read (old method) */ -void /* PRIVATE */ -png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr) -{ -#ifdef PNG_SETJMP_SUPPORTED - jmp_buf tmp_jmp; -#endif - png_error_ptr error_fn; - png_error_ptr warning_fn; - png_voidp error_ptr; -#ifdef PNG_USER_MEM_SUPPORTED - png_free_ptr free_fn; -#endif - - png_debug(1, "in png_read_destroy\n"); - if (info_ptr != NULL) - png_info_destroy(png_ptr, info_ptr); - - if (end_info_ptr != NULL) - png_info_destroy(png_ptr, end_info_ptr); - - png_free(png_ptr, png_ptr->zbuf); - png_free(png_ptr, png_ptr->big_row_buf); - png_free(png_ptr, png_ptr->prev_row); -#if defined(PNG_READ_DITHER_SUPPORTED) - png_free(png_ptr, png_ptr->palette_lookup); - png_free(png_ptr, png_ptr->dither_index); -#endif -#if defined(PNG_READ_GAMMA_SUPPORTED) - png_free(png_ptr, png_ptr->gamma_table); -#endif -#if defined(PNG_READ_BACKGROUND_SUPPORTED) - png_free(png_ptr, png_ptr->gamma_from_1); - png_free(png_ptr, png_ptr->gamma_to_1); -#endif -#ifdef PNG_FREE_ME_SUPPORTED - if (png_ptr->free_me & PNG_FREE_PLTE) - png_zfree(png_ptr, png_ptr->palette); - png_ptr->free_me &= ~PNG_FREE_PLTE; -#else - if (png_ptr->flags & PNG_FLAG_FREE_PLTE) - png_zfree(png_ptr, png_ptr->palette); - png_ptr->flags &= ~PNG_FLAG_FREE_PLTE; -#endif -#if defined(PNG_tRNS_SUPPORTED) || \ - defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) -#ifdef PNG_FREE_ME_SUPPORTED - if (png_ptr->free_me & PNG_FREE_TRNS) - png_free(png_ptr, png_ptr->trans); - png_ptr->free_me &= ~PNG_FREE_TRNS; -#else - if (png_ptr->flags & PNG_FLAG_FREE_TRNS) - png_free(png_ptr, png_ptr->trans); - png_ptr->flags &= ~PNG_FLAG_FREE_TRNS; -#endif -#endif -#if defined(PNG_READ_hIST_SUPPORTED) -#ifdef PNG_FREE_ME_SUPPORTED - if (png_ptr->free_me & PNG_FREE_HIST) - png_free(png_ptr, png_ptr->hist); - png_ptr->free_me &= ~PNG_FREE_HIST; -#else - if (png_ptr->flags & PNG_FLAG_FREE_HIST) - png_free(png_ptr, png_ptr->hist); - png_ptr->flags &= ~PNG_FLAG_FREE_HIST; -#endif -#endif -#if defined(PNG_READ_GAMMA_SUPPORTED) - if (png_ptr->gamma_16_table != NULL) - { - int i; - int istop = (1 << (8 - png_ptr->gamma_shift)); - for (i = 0; i < istop; i++) - { - png_free(png_ptr, png_ptr->gamma_16_table[i]); - } - png_free(png_ptr, png_ptr->gamma_16_table); - } -#if defined(PNG_READ_BACKGROUND_SUPPORTED) - if (png_ptr->gamma_16_from_1 != NULL) - { - int i; - int istop = (1 << (8 - png_ptr->gamma_shift)); - for (i = 0; i < istop; i++) - { - png_free(png_ptr, png_ptr->gamma_16_from_1[i]); - } - png_free(png_ptr, png_ptr->gamma_16_from_1); - } - if (png_ptr->gamma_16_to_1 != NULL) - { - int i; - int istop = (1 << (8 - png_ptr->gamma_shift)); - for (i = 0; i < istop; i++) - { - png_free(png_ptr, png_ptr->gamma_16_to_1[i]); - } - png_free(png_ptr, png_ptr->gamma_16_to_1); - } -#endif -#endif -#if defined(PNG_TIME_RFC1123_SUPPORTED) - png_free(png_ptr, png_ptr->time_buffer); -#endif - - inflateEnd(&png_ptr->zstream); -#ifdef PNG_PROGRESSIVE_READ_SUPPORTED - png_free(png_ptr, png_ptr->save_buffer); -#endif - -#ifdef PNG_PROGRESSIVE_READ_SUPPORTED -#ifdef PNG_TEXT_SUPPORTED - png_free(png_ptr, png_ptr->current_text); -#endif /* PNG_TEXT_SUPPORTED */ -#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ - - /* Save the important info out of the png_struct, in case it is - * being used again. - */ -#ifdef PNG_SETJMP_SUPPORTED - png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof (jmp_buf)); -#endif - - error_fn = png_ptr->error_fn; - warning_fn = png_ptr->warning_fn; - error_ptr = png_ptr->error_ptr; -#ifdef PNG_USER_MEM_SUPPORTED - free_fn = png_ptr->free_fn; -#endif - - png_memset(png_ptr, 0, png_sizeof (png_struct)); - - png_ptr->error_fn = error_fn; - png_ptr->warning_fn = warning_fn; - png_ptr->error_ptr = error_ptr; -#ifdef PNG_USER_MEM_SUPPORTED - png_ptr->free_fn = free_fn; -#endif - -#ifdef PNG_SETJMP_SUPPORTED - png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof (jmp_buf)); -#endif - -} - -void PNGAPI -png_set_read_status_fn(png_structp png_ptr, png_read_status_ptr read_row_fn) -{ - if(png_ptr == NULL) return; - png_ptr->read_row_fn = read_row_fn; -} - - -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED -#if defined(PNG_INFO_IMAGE_SUPPORTED) -void PNGAPI -png_read_png(png_structp png_ptr, png_infop info_ptr, - int transforms, - voidp params) -{ - int row; - - if(png_ptr == NULL) return; -#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) - /* invert the alpha channel from opacity to transparency - */ - if (transforms & PNG_TRANSFORM_INVERT_ALPHA) - png_set_invert_alpha(png_ptr); -#endif - - /* png_read_info() gives us all of the information from the - * PNG file before the first IDAT (image data chunk). - */ - png_read_info(png_ptr, info_ptr); - if (info_ptr->height > PNG_UINT_32_MAX/png_sizeof(png_bytep)) - png_error(png_ptr,"Image is too high to process with png_read_png()"); - - /* -------------- image transformations start here ------------------- */ - -#if defined(PNG_READ_16_TO_8_SUPPORTED) - /* tell libpng to strip 16 bit/color files down to 8 bits per color - */ - if (transforms & PNG_TRANSFORM_STRIP_16) - png_set_strip_16(png_ptr); -#endif - -#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED) - /* Strip alpha bytes from the input data without combining with - * the background (not recommended). - */ - if (transforms & PNG_TRANSFORM_STRIP_ALPHA) - png_set_strip_alpha(png_ptr); -#endif - -#if defined(PNG_READ_PACK_SUPPORTED) && !defined(PNG_READ_EXPAND_SUPPORTED) - /* Extract multiple pixels with bit depths of 1, 2, or 4 from a single - * byte into separate bytes (useful for paletted and grayscale images). - */ - if (transforms & PNG_TRANSFORM_PACKING) - png_set_packing(png_ptr); -#endif - -#if defined(PNG_READ_PACKSWAP_SUPPORTED) - /* Change the order of packed pixels to least significant bit first - * (not useful if you are using png_set_packing). - */ - if (transforms & PNG_TRANSFORM_PACKSWAP) - png_set_packswap(png_ptr); -#endif - -#if defined(PNG_READ_EXPAND_SUPPORTED) - /* Expand paletted colors into true RGB triplets - * Expand grayscale images to full 8 bits from 1, 2, or 4 bits/pixel - * Expand paletted or RGB images with transparency to full alpha - * channels so the data will be available as RGBA quartets. - */ - if (transforms & PNG_TRANSFORM_EXPAND) - if ((png_ptr->bit_depth < 8) || - (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) || - (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))) - png_set_expand(png_ptr); -#endif - - /* We don't handle background color or gamma transformation or dithering. - */ - -#if defined(PNG_READ_INVERT_SUPPORTED) - /* invert monochrome files to have 0 as white and 1 as black - */ - if (transforms & PNG_TRANSFORM_INVERT_MONO) - png_set_invert_mono(png_ptr); -#endif - -#if defined(PNG_READ_SHIFT_SUPPORTED) - /* If you want to shift the pixel values from the range [0,255] or - * [0,65535] to the original [0,7] or [0,31], or whatever range the - * colors were originally in: - */ - if ((transforms & PNG_TRANSFORM_SHIFT) - && png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT)) - { - png_color_8p sig_bit; - - png_get_sBIT(png_ptr, info_ptr, &sig_bit); - png_set_shift(png_ptr, sig_bit); - } -#endif - -#if defined(PNG_READ_BGR_SUPPORTED) - /* flip the RGB pixels to BGR (or RGBA to BGRA) - */ - if (transforms & PNG_TRANSFORM_BGR) - png_set_bgr(png_ptr); -#endif - -#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) - /* swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) - */ - if (transforms & PNG_TRANSFORM_SWAP_ALPHA) - png_set_swap_alpha(png_ptr); -#endif - -#if defined(PNG_READ_SWAP_SUPPORTED) - /* swap bytes of 16 bit files to least significant byte first - */ - if (transforms & PNG_TRANSFORM_SWAP_ENDIAN) - png_set_swap(png_ptr); -#endif - - /* We don't handle adding filler bytes */ - - /* Optional call to gamma correct and add the background to the palette - * and update info structure. REQUIRED if you are expecting libpng to - * update the palette for you (i.e., you selected such a transform above). - */ - png_read_update_info(png_ptr, info_ptr); - - /* -------------- image transformations end here ------------------- */ - -#ifdef PNG_FREE_ME_SUPPORTED - png_free_data(png_ptr, info_ptr, PNG_FREE_ROWS, 0); -#endif - if(info_ptr->row_pointers == NULL) - { - info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr, - info_ptr->height * png_sizeof(png_bytep)); -#ifdef PNG_FREE_ME_SUPPORTED - info_ptr->free_me |= PNG_FREE_ROWS; -#endif - for (row = 0; row < (int)info_ptr->height; row++) - { - info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_ptr, - png_get_rowbytes(png_ptr, info_ptr)); - } - } - - png_read_image(png_ptr, info_ptr->row_pointers); - info_ptr->valid |= PNG_INFO_IDAT; - - /* read rest of file, and get additional chunks in info_ptr - REQUIRED */ - png_read_end(png_ptr, info_ptr); - - if(transforms == 0 || params == NULL) - /* quiet compiler warnings */ return; - -} -#endif /* PNG_INFO_IMAGE_SUPPORTED */ -#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */ -#endif /* PNG_READ_SUPPORTED */ diff --git a/src/dep/src/irrlicht/libpng/pngrio.c b/src/dep/src/irrlicht/libpng/pngrio.c index de64d77..dffae55 100644 --- a/src/dep/src/irrlicht/libpng/pngrio.c +++ b/src/dep/src/irrlicht/libpng/pngrio.c @@ -27,7 +27,7 @@ void /* PRIVATE */ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length) { - png_debug1(4, "reading %d bytes", (int)length); + png_debug1(4, "reading %d bytes\n", (int)length); if (png_ptr->read_data_fn != NULL) (*(png_ptr->read_data_fn))(png_ptr, data, length); else @@ -164,170 +164,3 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr, #endif } #endif /* PNG_READ_SUPPORTED */ - -/* pngrio.c - functions for data input - * - * Last changed in libpng 1.2.13 November 13, 2006 - * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2006 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - * - * This file provides a location for all input. Users who need - * special handling are expected to write a function that has the same - * arguments as this and performs a similar function, but that possibly - * has a different input method. Note that you shouldn't change this - * function, but rather write a replacement function and then make - * libpng use it at run time with png_set_read_fn(...). - */ - -#define PNG_INTERNAL -#include "png.h" - -#if defined(PNG_READ_SUPPORTED) - -/* Read the data from whatever input you are using. The default routine - reads from a file pointer. Note that this routine sometimes gets called - with very small lengths, so you should implement some kind of simple - buffering if you are using unbuffered reads. This should never be asked - to read more then 64K on a 16 bit machine. */ -void /* PRIVATE */ -png_read_data(png_structp png_ptr, png_bytep data, png_size_t length) -{ - png_debug1(4,"reading %d bytes\n", (int)length); - if (png_ptr->read_data_fn != NULL) - (*(png_ptr->read_data_fn))(png_ptr, data, length); - else - png_error(png_ptr, "Call to NULL read function"); -} - -#if !defined(PNG_NO_STDIO) -/* This is the function that does the actual reading of data. If you are - not reading from a standard C stream, you should create a replacement - read_data function and use it at run time with png_set_read_fn(), rather - than changing the library. */ -#ifndef USE_FAR_KEYWORD -void PNGAPI -png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length) -{ - png_size_t check; - - if(png_ptr == NULL) return; - /* fread() returns 0 on error, so it is OK to store this in a png_size_t - * instead of an int, which is what fread() actually returns. - */ -#if defined(_WIN32_WCE) - if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) ) - check = 0; -#else - check = (png_size_t)fread(data, (png_size_t)1, length, - (png_FILE_p)png_ptr->io_ptr); -#endif - - if (check != length) - png_error(png_ptr, "Read Error"); -} -#else -/* this is the model-independent version. Since the standard I/O library - can't handle far buffers in the medium and small models, we have to copy - the data. -*/ - -#define NEAR_BUF_SIZE 1024 -#define MIN(a,b) (a <= b ? a : b) - -static void PNGAPI -png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length) -{ - int check; - png_byte *n_data; - png_FILE_p io_ptr; - - if(png_ptr == NULL) return; - /* Check if data really is near. If so, use usual code. */ - n_data = (png_byte *)CVT_PTR_NOCHECK(data); - io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr); - if ((png_bytep)n_data == data) - { -#if defined(_WIN32_WCE) - if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) ) - check = 0; -#else - check = fread(n_data, 1, length, io_ptr); -#endif - } - else - { - png_byte buf[NEAR_BUF_SIZE]; - png_size_t read, remaining, err; - check = 0; - remaining = length; - do - { - read = MIN(NEAR_BUF_SIZE, remaining); -#if defined(_WIN32_WCE) - if ( !ReadFile((HANDLE)(io_ptr), buf, read, &err, NULL) ) - err = 0; -#else - err = fread(buf, (png_size_t)1, read, io_ptr); -#endif - png_memcpy(data, buf, read); /* copy far buffer to near buffer */ - if(err != read) - break; - else - check += err; - data += read; - remaining -= read; - } - while (remaining != 0); - } - if ((png_uint_32)check != (png_uint_32)length) - png_error(png_ptr, "read Error"); -} -#endif -#endif - -/* This function allows the application to supply a new input function - for libpng if standard C streams aren't being used. - - This function takes as its arguments: - png_ptr - pointer to a png input data structure - io_ptr - pointer to user supplied structure containing info about - the input functions. May be NULL. - read_data_fn - pointer to a new input function that takes as its - arguments a pointer to a png_struct, a pointer to - a location where input data can be stored, and a 32-bit - unsigned int that is the number of bytes to be read. - To exit and output any fatal error messages the new write - function should call png_error(png_ptr, "Error msg"). */ -void PNGAPI -png_set_read_fn(png_structp png_ptr, png_voidp io_ptr, - png_rw_ptr read_data_fn) -{ - if(png_ptr == NULL) return; - png_ptr->io_ptr = io_ptr; - -#if !defined(PNG_NO_STDIO) - if (read_data_fn != NULL) - png_ptr->read_data_fn = read_data_fn; - else - png_ptr->read_data_fn = png_default_read_data; -#else - png_ptr->read_data_fn = read_data_fn; -#endif - - /* It is an error to write to a read device */ - if (png_ptr->write_data_fn != NULL) - { - png_ptr->write_data_fn = NULL; - png_warning(png_ptr, - "It's an error to set both read_data_fn and write_data_fn in the "); - png_warning(png_ptr, - "same structure. Resetting write_data_fn to NULL."); - } - -#if defined(PNG_WRITE_FLUSH_SUPPORTED) - png_ptr->output_flush_fn = NULL; -#endif -} -#endif /* PNG_READ_SUPPORTED */ diff --git a/src/dep/src/irrlicht/libpng/pngrtran.c b/src/dep/src/irrlicht/libpng/pngrtran.c index a5a656a..7481c5b 100644 --- a/src/dep/src/irrlicht/libpng/pngrtran.c +++ b/src/dep/src/irrlicht/libpng/pngrtran.c @@ -1,9 +1,9 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.2.35 [February 14, 2009] + * Last changed in libpng 1.2.30 [August 15, 2008] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2009 Glenn Randers-Pehrson + * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -21,7 +21,7 @@ void PNGAPI png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action) { - png_debug(1, "in png_set_crc_action"); + png_debug(1, "in png_set_crc_action\n"); /* Tell libpng how we react to CRC errors in critical chunks */ if (png_ptr == NULL) return; switch (crit_action) @@ -80,7 +80,7 @@ png_set_background(png_structp png_ptr, png_color_16p background_color, int background_gamma_code, int need_expand, double background_gamma) { - png_debug(1, "in png_set_background"); + png_debug(1, "in png_set_background\n"); if (png_ptr == NULL) return; if (background_gamma_code == PNG_BACKGROUND_GAMMA_UNKNOWN) { @@ -102,7 +102,7 @@ png_set_background(png_structp png_ptr, void PNGAPI png_set_strip_16(png_structp png_ptr) { - png_debug(1, "in png_set_strip_16"); + png_debug(1, "in png_set_strip_16\n"); if (png_ptr == NULL) return; png_ptr->transformations |= PNG_16_TO_8; } @@ -112,7 +112,7 @@ png_set_strip_16(png_structp png_ptr) void PNGAPI png_set_strip_alpha(png_structp png_ptr) { - png_debug(1, "in png_set_strip_alpha"); + png_debug(1, "in png_set_strip_alpha\n"); if (png_ptr == NULL) return; png_ptr->flags |= PNG_FLAG_STRIP_ALPHA; } @@ -142,7 +142,7 @@ png_set_dither(png_structp png_ptr, png_colorp palette, int num_palette, int maximum_colors, png_uint_16p histogram, int full_dither) { - png_debug(1, "in png_set_dither"); + png_debug(1, "in png_set_dither\n"); if (png_ptr == NULL) return; png_ptr->transformations |= PNG_DITHER; @@ -309,7 +309,9 @@ png_set_dither(png_structp png_ptr, png_colorp palette, hash = (png_dsortpp)png_malloc(png_ptr, (png_uint_32)(769 * png_sizeof(png_dsortp))); - png_memset(hash, 0, 769 * png_sizeof(png_dsortp)); + for (i = 0; i < 769; i++) + hash[i] = NULL; +/* png_memset(hash, 0, 769 * png_sizeof(png_dsortp)); */ num_new_palette = num_palette; @@ -524,7 +526,7 @@ png_set_dither(png_structp png_ptr, png_colorp palette, void PNGAPI png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma) { - png_debug(1, "in png_set_gamma"); + png_debug(1, "in png_set_gamma\n"); if (png_ptr == NULL) return; if ((fabs(scrn_gamma * file_gamma - 1.0) > PNG_GAMMA_THRESHOLD) || (png_ptr->color_type & PNG_COLOR_MASK_ALPHA) || @@ -543,7 +545,7 @@ png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma) void PNGAPI png_set_expand(png_structp png_ptr) { - png_debug(1, "in png_set_expand"); + png_debug(1, "in png_set_expand\n"); if (png_ptr == NULL) return; png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); png_ptr->flags &= ~PNG_FLAG_ROW_INIT; @@ -570,7 +572,7 @@ png_set_expand(png_structp png_ptr) void PNGAPI png_set_palette_to_rgb(png_structp png_ptr) { - png_debug(1, "in png_set_palette_to_rgb"); + png_debug(1, "in png_set_palette_to_rgb\n"); if (png_ptr == NULL) return; png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); png_ptr->flags &= ~PNG_FLAG_ROW_INIT; @@ -581,7 +583,7 @@ png_set_palette_to_rgb(png_structp png_ptr) void PNGAPI png_set_expand_gray_1_2_4_to_8(png_structp png_ptr) { - png_debug(1, "in png_set_expand_gray_1_2_4_to_8"); + png_debug(1, "in png_set_expand_gray_1_2_4_to_8\n"); if (png_ptr == NULL) return; png_ptr->transformations |= PNG_EXPAND; png_ptr->flags &= ~PNG_FLAG_ROW_INIT; @@ -594,7 +596,7 @@ png_set_expand_gray_1_2_4_to_8(png_structp png_ptr) void PNGAPI png_set_gray_1_2_4_to_8(png_structp png_ptr) { - png_debug(1, "in png_set_gray_1_2_4_to_8"); + png_debug(1, "in png_set_gray_1_2_4_to_8\n"); if (png_ptr == NULL) return; png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); } @@ -605,7 +607,7 @@ png_set_gray_1_2_4_to_8(png_structp png_ptr) void PNGAPI png_set_tRNS_to_alpha(png_structp png_ptr) { - png_debug(1, "in png_set_tRNS_to_alpha"); + png_debug(1, "in png_set_tRNS_to_alpha\n"); png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); png_ptr->flags &= ~PNG_FLAG_ROW_INIT; } @@ -615,7 +617,7 @@ png_set_tRNS_to_alpha(png_structp png_ptr) void PNGAPI png_set_gray_to_rgb(png_structp png_ptr) { - png_debug(1, "in png_set_gray_to_rgb"); + png_debug(1, "in png_set_gray_to_rgb\n"); png_ptr->transformations |= PNG_GRAY_TO_RGB; png_ptr->flags &= ~PNG_FLAG_ROW_INIT; } @@ -642,7 +644,7 @@ void PNGAPI png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action, png_fixed_point red, png_fixed_point green) { - png_debug(1, "in png_set_rgb_to_gray"); + png_debug(1, "in png_set_rgb_to_gray\n"); if (png_ptr == NULL) return; switch(error_action) { @@ -682,7 +684,7 @@ png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action, } png_ptr->rgb_to_gray_red_coeff = red_int; png_ptr->rgb_to_gray_green_coeff = green_int; - png_ptr->rgb_to_gray_blue_coeff = + png_ptr->rgb_to_gray_blue_coeff = (png_uint_16)(32768 - red_int - green_int); } } @@ -695,7 +697,7 @@ void PNGAPI png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr read_user_transform_fn) { - png_debug(1, "in png_set_read_user_transform_fn"); + png_debug(1, "in png_set_read_user_transform_fn\n"); if (png_ptr == NULL) return; #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) png_ptr->transformations |= PNG_USER_TRANSFORM; @@ -715,7 +717,7 @@ png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr void /* PRIVATE */ png_init_read_transformations(png_structp png_ptr) { - png_debug(1, "in png_init_read_transformations"); + png_debug(1, "in png_init_read_transformations\n"); #if defined(PNG_USELESS_TESTS_SUPPORTED) if (png_ptr != NULL) #endif @@ -1122,7 +1124,7 @@ png_init_read_transformations(png_structp png_ptr) void /* PRIVATE */ png_read_transform_info(png_structp png_ptr, png_infop info_ptr) { - png_debug(1, "in png_read_transform_info"); + png_debug(1, "in png_read_transform_info\n"); #if defined(PNG_READ_EXPAND_SUPPORTED) if (png_ptr->transformations & PNG_EXPAND) { @@ -1266,7 +1268,7 @@ defined(PNG_READ_USER_TRANSFORM_SUPPORTED) void /* PRIVATE */ png_do_read_transformations(png_structp png_ptr) { - png_debug(1, "in png_do_read_transformations"); + png_debug(1, "in png_do_read_transformations\n"); if (png_ptr->row_buf == NULL) { #if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) @@ -1327,7 +1329,7 @@ png_do_read_transformations(png_structp png_ptr) if (rgb_error) { png_ptr->rgb_to_gray_status=1; - if ((png_ptr->transformations & PNG_RGB_TO_GRAY) == + if ((png_ptr->transformations & PNG_RGB_TO_GRAY) == PNG_RGB_TO_GRAY_WARN) png_warning(png_ptr, "png_do_rgb_to_gray found nongray pixel"); if ((png_ptr->transformations & PNG_RGB_TO_GRAY) == @@ -1502,4271 +1504,6 @@ From Andreas Dilger e-mail to png-implement, 26 March 1998: } -#if defined(PNG_READ_PACK_SUPPORTED) -/* Unpack pixels of 1, 2, or 4 bits per pixel into 1 byte per pixel, - * without changing the actual values. Thus, if you had a row with - * a bit depth of 1, you would end up with bytes that only contained - * the numbers 0 or 1. If you would rather they contain 0 and 255, use - * png_do_shift() after this. - */ -void /* PRIVATE */ -png_do_unpack(png_row_infop row_info, png_bytep row) -{ - png_debug(1, "in png_do_unpack"); -#if defined(PNG_USELESS_TESTS_SUPPORTED) - if (row != NULL && row_info != NULL && row_info->bit_depth < 8) -#else - if (row_info->bit_depth < 8) -#endif - { - png_uint_32 i; - png_uint_32 row_width=row_info->width; - - switch (row_info->bit_depth) - { - case 1: - { - png_bytep sp = row + (png_size_t)((row_width - 1) >> 3); - png_bytep dp = row + (png_size_t)row_width - 1; - png_uint_32 shift = 7 - (int)((row_width + 7) & 0x07); - for (i = 0; i < row_width; i++) - { - *dp = (png_byte)((*sp >> shift) & 0x01); - if (shift == 7) - { - shift = 0; - sp--; - } - else - shift++; - - dp--; - } - break; - } - case 2: - { - - png_bytep sp = row + (png_size_t)((row_width - 1) >> 2); - png_bytep dp = row + (png_size_t)row_width - 1; - png_uint_32 shift = (int)((3 - ((row_width + 3) & 0x03)) << 1); - for (i = 0; i < row_width; i++) - { - *dp = (png_byte)((*sp >> shift) & 0x03); - if (shift == 6) - { - shift = 0; - sp--; - } - else - shift += 2; - - dp--; - } - break; - } - case 4: - { - png_bytep sp = row + (png_size_t)((row_width - 1) >> 1); - png_bytep dp = row + (png_size_t)row_width - 1; - png_uint_32 shift = (int)((1 - ((row_width + 1) & 0x01)) << 2); - for (i = 0; i < row_width; i++) - { - *dp = (png_byte)((*sp >> shift) & 0x0f); - if (shift == 4) - { - shift = 0; - sp--; - } - else - shift = 4; - - dp--; - } - break; - } - } - row_info->bit_depth = 8; - row_info->pixel_depth = (png_byte)(8 * row_info->channels); - row_info->rowbytes = row_width * row_info->channels; - } -} -#endif - -#if defined(PNG_READ_SHIFT_SUPPORTED) -/* Reverse the effects of png_do_shift. This routine merely shifts the - * pixels back to their significant bits values. Thus, if you have - * a row of bit depth 8, but only 5 are significant, this will shift - * the values back to 0 through 31. - */ -void /* PRIVATE */ -png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits) -{ - png_debug(1, "in png_do_unshift"); - if ( -#if defined(PNG_USELESS_TESTS_SUPPORTED) - row != NULL && row_info != NULL && sig_bits != NULL && -#endif - row_info->color_type != PNG_COLOR_TYPE_PALETTE) - { - int shift[4]; - int channels = 0; - int c; - png_uint_16 value = 0; - png_uint_32 row_width = row_info->width; - - if (row_info->color_type & PNG_COLOR_MASK_COLOR) - { - shift[channels++] = row_info->bit_depth - sig_bits->red; - shift[channels++] = row_info->bit_depth - sig_bits->green; - shift[channels++] = row_info->bit_depth - sig_bits->blue; - } - else - { - shift[channels++] = row_info->bit_depth - sig_bits->gray; - } - if (row_info->color_type & PNG_COLOR_MASK_ALPHA) - { - shift[channels++] = row_info->bit_depth - sig_bits->alpha; - } - - for (c = 0; c < channels; c++) - { - if (shift[c] <= 0) - shift[c] = 0; - else - value = 1; - } - - if (!value) - return; - - switch (row_info->bit_depth) - { - case 2: - { - png_bytep bp; - png_uint_32 i; - png_uint_32 istop = row_info->rowbytes; - - for (bp = row, i = 0; i < istop; i++) - { - *bp >>= 1; - *bp++ &= 0x55; - } - break; - } - case 4: - { - png_bytep bp = row; - png_uint_32 i; - png_uint_32 istop = row_info->rowbytes; - png_byte mask = (png_byte)((((int)0xf0 >> shift[0]) & (int)0xf0) | - (png_byte)((int)0xf >> shift[0])); - - for (i = 0; i < istop; i++) - { - *bp >>= shift[0]; - *bp++ &= mask; - } - break; - } - case 8: - { - png_bytep bp = row; - png_uint_32 i; - png_uint_32 istop = row_width * channels; - - for (i = 0; i < istop; i++) - { - *bp++ >>= shift[i%channels]; - } - break; - } - case 16: - { - png_bytep bp = row; - png_uint_32 i; - png_uint_32 istop = channels * row_width; - - for (i = 0; i < istop; i++) - { - value = (png_uint_16)((*bp << 8) + *(bp + 1)); - value >>= shift[i%channels]; - *bp++ = (png_byte)(value >> 8); - *bp++ = (png_byte)(value & 0xff); - } - break; - } - } - } -} -#endif - -#if defined(PNG_READ_16_TO_8_SUPPORTED) -/* chop rows of bit depth 16 down to 8 */ -void /* PRIVATE */ -png_do_chop(png_row_infop row_info, png_bytep row) -{ - png_debug(1, "in png_do_chop"); -#if defined(PNG_USELESS_TESTS_SUPPORTED) - if (row != NULL && row_info != NULL && row_info->bit_depth == 16) -#else - if (row_info->bit_depth == 16) -#endif - { - png_bytep sp = row; - png_bytep dp = row; - png_uint_32 i; - png_uint_32 istop = row_info->width * row_info->channels; - - for (i = 0; i> 8)) >> 8; - * - * Approximate calculation with shift/add instead of multiply/divide: - * *dp = ((((png_uint_32)(*sp) << 8) | - * (png_uint_32)((int)(*(sp + 1)) - *sp)) + 128) >> 8; - * - * What we actually do to avoid extra shifting and conversion: - */ - - *dp = *sp + ((((int)(*(sp + 1)) - *sp) > 128) ? 1 : 0); -#else - /* Simply discard the low order byte */ - *dp = *sp; -#endif - } - row_info->bit_depth = 8; - row_info->pixel_depth = (png_byte)(8 * row_info->channels); - row_info->rowbytes = row_info->width * row_info->channels; - } -} -#endif - -#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) -void /* PRIVATE */ -png_do_read_swap_alpha(png_row_infop row_info, png_bytep row) -{ - png_debug(1, "in png_do_read_swap_alpha"); -#if defined(PNG_USELESS_TESTS_SUPPORTED) - if (row != NULL && row_info != NULL) -#endif - { - png_uint_32 row_width = row_info->width; - if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) - { - /* This converts from RGBA to ARGB */ - if (row_info->bit_depth == 8) - { - png_bytep sp = row + row_info->rowbytes; - png_bytep dp = sp; - png_byte save; - png_uint_32 i; - - for (i = 0; i < row_width; i++) - { - save = *(--sp); - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = save; - } - } - /* This converts from RRGGBBAA to AARRGGBB */ - else - { - png_bytep sp = row + row_info->rowbytes; - png_bytep dp = sp; - png_byte save[2]; - png_uint_32 i; - - for (i = 0; i < row_width; i++) - { - save[0] = *(--sp); - save[1] = *(--sp); - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = save[0]; - *(--dp) = save[1]; - } - } - } - else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) - { - /* This converts from GA to AG */ - if (row_info->bit_depth == 8) - { - png_bytep sp = row + row_info->rowbytes; - png_bytep dp = sp; - png_byte save; - png_uint_32 i; - - for (i = 0; i < row_width; i++) - { - save = *(--sp); - *(--dp) = *(--sp); - *(--dp) = save; - } - } - /* This converts from GGAA to AAGG */ - else - { - png_bytep sp = row + row_info->rowbytes; - png_bytep dp = sp; - png_byte save[2]; - png_uint_32 i; - - for (i = 0; i < row_width; i++) - { - save[0] = *(--sp); - save[1] = *(--sp); - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = save[0]; - *(--dp) = save[1]; - } - } - } - } -} -#endif - -#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) -void /* PRIVATE */ -png_do_read_invert_alpha(png_row_infop row_info, png_bytep row) -{ - png_debug(1, "in png_do_read_invert_alpha"); -#if defined(PNG_USELESS_TESTS_SUPPORTED) - if (row != NULL && row_info != NULL) -#endif - { - png_uint_32 row_width = row_info->width; - if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) - { - /* This inverts the alpha channel in RGBA */ - if (row_info->bit_depth == 8) - { - png_bytep sp = row + row_info->rowbytes; - png_bytep dp = sp; - png_uint_32 i; - - for (i = 0; i < row_width; i++) - { - *(--dp) = (png_byte)(255 - *(--sp)); - -/* This does nothing: - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = *(--sp); - We can replace it with: -*/ - sp-=3; - dp=sp; - } - } - /* This inverts the alpha channel in RRGGBBAA */ - else - { - png_bytep sp = row + row_info->rowbytes; - png_bytep dp = sp; - png_uint_32 i; - - for (i = 0; i < row_width; i++) - { - *(--dp) = (png_byte)(255 - *(--sp)); - *(--dp) = (png_byte)(255 - *(--sp)); - -/* This does nothing: - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = *(--sp); - We can replace it with: -*/ - sp-=6; - dp=sp; - } - } - } - else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) - { - /* This inverts the alpha channel in GA */ - if (row_info->bit_depth == 8) - { - png_bytep sp = row + row_info->rowbytes; - png_bytep dp = sp; - png_uint_32 i; - - for (i = 0; i < row_width; i++) - { - *(--dp) = (png_byte)(255 - *(--sp)); - *(--dp) = *(--sp); - } - } - /* This inverts the alpha channel in GGAA */ - else - { - png_bytep sp = row + row_info->rowbytes; - png_bytep dp = sp; - png_uint_32 i; - - for (i = 0; i < row_width; i++) - { - *(--dp) = (png_byte)(255 - *(--sp)); - *(--dp) = (png_byte)(255 - *(--sp)); -/* - *(--dp) = *(--sp); - *(--dp) = *(--sp); -*/ - sp-=2; - dp=sp; - } - } - } - } -} -#endif - -#if defined(PNG_READ_FILLER_SUPPORTED) -/* Add filler channel if we have RGB color */ -void /* PRIVATE */ -png_do_read_filler(png_row_infop row_info, png_bytep row, - png_uint_32 filler, png_uint_32 flags) -{ - png_uint_32 i; - png_uint_32 row_width = row_info->width; - - png_byte hi_filler = (png_byte)((filler>>8) & 0xff); - png_byte lo_filler = (png_byte)(filler & 0xff); - - png_debug(1, "in png_do_read_filler"); - if ( -#if defined(PNG_USELESS_TESTS_SUPPORTED) - row != NULL && row_info != NULL && -#endif - row_info->color_type == PNG_COLOR_TYPE_GRAY) - { - if (row_info->bit_depth == 8) - { - /* This changes the data from G to GX */ - if (flags & PNG_FLAG_FILLER_AFTER) - { - png_bytep sp = row + (png_size_t)row_width; - png_bytep dp = sp + (png_size_t)row_width; - for (i = 1; i < row_width; i++) - { - *(--dp) = lo_filler; - *(--dp) = *(--sp); - } - *(--dp) = lo_filler; - row_info->channels = 2; - row_info->pixel_depth = 16; - row_info->rowbytes = row_width * 2; - } - /* This changes the data from G to XG */ - else - { - png_bytep sp = row + (png_size_t)row_width; - png_bytep dp = sp + (png_size_t)row_width; - for (i = 0; i < row_width; i++) - { - *(--dp) = *(--sp); - *(--dp) = lo_filler; - } - row_info->channels = 2; - row_info->pixel_depth = 16; - row_info->rowbytes = row_width * 2; - } - } - else if (row_info->bit_depth == 16) - { - /* This changes the data from GG to GGXX */ - if (flags & PNG_FLAG_FILLER_AFTER) - { - png_bytep sp = row + (png_size_t)row_width * 2; - png_bytep dp = sp + (png_size_t)row_width * 2; - for (i = 1; i < row_width; i++) - { - *(--dp) = hi_filler; - *(--dp) = lo_filler; - *(--dp) = *(--sp); - *(--dp) = *(--sp); - } - *(--dp) = hi_filler; - *(--dp) = lo_filler; - row_info->channels = 2; - row_info->pixel_depth = 32; - row_info->rowbytes = row_width * 4; - } - /* This changes the data from GG to XXGG */ - else - { - png_bytep sp = row + (png_size_t)row_width * 2; - png_bytep dp = sp + (png_size_t)row_width * 2; - for (i = 0; i < row_width; i++) - { - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = hi_filler; - *(--dp) = lo_filler; - } - row_info->channels = 2; - row_info->pixel_depth = 32; - row_info->rowbytes = row_width * 4; - } - } - } /* COLOR_TYPE == GRAY */ - else if (row_info->color_type == PNG_COLOR_TYPE_RGB) - { - if (row_info->bit_depth == 8) - { - /* This changes the data from RGB to RGBX */ - if (flags & PNG_FLAG_FILLER_AFTER) - { - png_bytep sp = row + (png_size_t)row_width * 3; - png_bytep dp = sp + (png_size_t)row_width; - for (i = 1; i < row_width; i++) - { - *(--dp) = lo_filler; - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = *(--sp); - } - *(--dp) = lo_filler; - row_info->channels = 4; - row_info->pixel_depth = 32; - row_info->rowbytes = row_width * 4; - } - /* This changes the data from RGB to XRGB */ - else - { - png_bytep sp = row + (png_size_t)row_width * 3; - png_bytep dp = sp + (png_size_t)row_width; - for (i = 0; i < row_width; i++) - { - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = lo_filler; - } - row_info->channels = 4; - row_info->pixel_depth = 32; - row_info->rowbytes = row_width * 4; - } - } - else if (row_info->bit_depth == 16) - { - /* This changes the data from RRGGBB to RRGGBBXX */ - if (flags & PNG_FLAG_FILLER_AFTER) - { - png_bytep sp = row + (png_size_t)row_width * 6; - png_bytep dp = sp + (png_size_t)row_width * 2; - for (i = 1; i < row_width; i++) - { - *(--dp) = hi_filler; - *(--dp) = lo_filler; - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = *(--sp); - } - *(--dp) = hi_filler; - *(--dp) = lo_filler; - row_info->channels = 4; - row_info->pixel_depth = 64; - row_info->rowbytes = row_width * 8; - } - /* This changes the data from RRGGBB to XXRRGGBB */ - else - { - png_bytep sp = row + (png_size_t)row_width * 6; - png_bytep dp = sp + (png_size_t)row_width * 2; - for (i = 0; i < row_width; i++) - { - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = *(--sp); - *(--dp) = hi_filler; - *(--dp) = lo_filler; - } - row_info->channels = 4; - row_info->pixel_depth = 64; - row_info->rowbytes = row_width * 8; - } - } - } /* COLOR_TYPE == RGB */ -} -#endif - -#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) -/* expand grayscale files to RGB, with or without alpha */ -void /* PRIVATE */ -png_do_gray_to_rgb(png_row_infop row_info, png_bytep row) -{ - png_uint_32 i; - png_uint_32 row_width = row_info->width; - - png_debug(1, "in png_do_gray_to_rgb"); - if (row_info->bit_depth >= 8 && -#if defined(PNG_USELESS_TESTS_SUPPORTED) - row != NULL && row_info != NULL && -#endif - !(row_info->color_type & PNG_COLOR_MASK_COLOR)) - { - if (row_info->color_type == PNG_COLOR_TYPE_GRAY) - { - if (row_info->bit_depth == 8) - { - png_bytep sp = row + (png_size_t)row_width - 1; - png_bytep dp = sp + (png_size_t)row_width * 2; - for (i = 0; i < row_width; i++) - { - *(dp--) = *sp; - *(dp--) = *sp; - *(dp--) = *(sp--); - } - } - else - { - png_bytep sp = row + (png_size_t)row_width * 2 - 1; - png_bytep dp = sp + (png_size_t)row_width * 4; - for (i = 0; i < row_width; i++) - { - *(dp--) = *sp; - *(dp--) = *(sp - 1); - *(dp--) = *sp; - *(dp--) = *(sp - 1); - *(dp--) = *(sp--); - *(dp--) = *(sp--); - } - } - } - else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) - { - if (row_info->bit_depth == 8) - { - png_bytep sp = row + (png_size_t)row_width * 2 - 1; - png_bytep dp = sp + (png_size_t)row_width * 2; - for (i = 0; i < row_width; i++) - { - *(dp--) = *(sp--); - *(dp--) = *sp; - *(dp--) = *sp; - *(dp--) = *(sp--); - } - } - else - { - png_bytep sp = row + (png_size_t)row_width * 4 - 1; - png_bytep dp = sp + (png_size_t)row_width * 4; - for (i = 0; i < row_width; i++) - { - *(dp--) = *(sp--); - *(dp--) = *(sp--); - *(dp--) = *sp; - *(dp--) = *(sp - 1); - *(dp--) = *sp; - *(dp--) = *(sp - 1); - *(dp--) = *(sp--); - *(dp--) = *(sp--); - } - } - } - row_info->channels += (png_byte)2; - row_info->color_type |= PNG_COLOR_MASK_COLOR; - row_info->pixel_depth = (png_byte)(row_info->channels * - row_info->bit_depth); - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width); - } -} -#endif - -#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) -/* reduce RGB files to grayscale, with or without alpha - * using the equation given in Poynton's ColorFAQ at - * (THIS LINK IS DEAD June 2008) - * New link: - * - * Charles Poynton poynton at poynton.com - * - * Y = 0.212671 * R + 0.715160 * G + 0.072169 * B - * - * We approximate this with - * - * Y = 0.21268 * R + 0.7151 * G + 0.07217 * B - * - * which can be expressed with integers as - * - * Y = (6969 * R + 23434 * G + 2365 * B)/32768 - * - * The calculation is to be done in a linear colorspace. - * - * Other integer coefficents can be used via png_set_rgb_to_gray(). - */ -int /* PRIVATE */ -png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row) - -{ - png_uint_32 i; - - png_uint_32 row_width = row_info->width; - int rgb_error = 0; - - png_debug(1, "in png_do_rgb_to_gray"); - if ( -#if defined(PNG_USELESS_TESTS_SUPPORTED) - row != NULL && row_info != NULL && -#endif - (row_info->color_type & PNG_COLOR_MASK_COLOR)) - { - png_uint_32 rc = png_ptr->rgb_to_gray_red_coeff; - png_uint_32 gc = png_ptr->rgb_to_gray_green_coeff; - png_uint_32 bc = png_ptr->rgb_to_gray_blue_coeff; - - if (row_info->color_type == PNG_COLOR_TYPE_RGB) - { - if (row_info->bit_depth == 8) - { -#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) - if (png_ptr->gamma_from_1 != NULL && png_ptr->gamma_to_1 != NULL) - { - png_bytep sp = row; - png_bytep dp = row; - - for (i = 0; i < row_width; i++) - { - png_byte red = png_ptr->gamma_to_1[*(sp++)]; - png_byte green = png_ptr->gamma_to_1[*(sp++)]; - png_byte blue = png_ptr->gamma_to_1[*(sp++)]; - if (red != green || red != blue) - { - rgb_error |= 1; - *(dp++) = png_ptr->gamma_from_1[ - (rc*red + gc*green + bc*blue)>>15]; - } - else - *(dp++) = *(sp - 1); - } - } - else -#endif - { - png_bytep sp = row; - png_bytep dp = row; - for (i = 0; i < row_width; i++) - { - png_byte red = *(sp++); - png_byte green = *(sp++); - png_byte blue = *(sp++); - if (red != green || red != blue) - { - rgb_error |= 1; - *(dp++) = (png_byte)((rc*red + gc*green + bc*blue)>>15); - } - else - *(dp++) = *(sp - 1); - } - } - } - - else /* RGB bit_depth == 16 */ - { -#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) - if (png_ptr->gamma_16_to_1 != NULL && - png_ptr->gamma_16_from_1 != NULL) - { - png_bytep sp = row; - png_bytep dp = row; - for (i = 0; i < row_width; i++) - { - png_uint_16 red, green, blue, w; - - red = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; - green = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; - blue = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; - - if (red == green && red == blue) - w = red; - else - { - png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red&0xff) >> - png_ptr->gamma_shift][red>>8]; - png_uint_16 green_1 = png_ptr->gamma_16_to_1[(green&0xff) >> - png_ptr->gamma_shift][green>>8]; - png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue&0xff) >> - png_ptr->gamma_shift][blue>>8]; - png_uint_16 gray16 = (png_uint_16)((rc*red_1 + gc*green_1 - + bc*blue_1)>>15); - w = png_ptr->gamma_16_from_1[(gray16&0xff) >> - png_ptr->gamma_shift][gray16 >> 8]; - rgb_error |= 1; - } - - *(dp++) = (png_byte)((w>>8) & 0xff); - *(dp++) = (png_byte)(w & 0xff); - } - } - else -#endif - { - png_bytep sp = row; - png_bytep dp = row; - for (i = 0; i < row_width; i++) - { - png_uint_16 red, green, blue, gray16; - - red = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; - green = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; - blue = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; - - if (red != green || red != blue) - rgb_error |= 1; - gray16 = (png_uint_16)((rc*red + gc*green + bc*blue)>>15); - *(dp++) = (png_byte)((gray16>>8) & 0xff); - *(dp++) = (png_byte)(gray16 & 0xff); - } - } - } - } - if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) - { - if (row_info->bit_depth == 8) - { -#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) - if (png_ptr->gamma_from_1 != NULL && png_ptr->gamma_to_1 != NULL) - { - png_bytep sp = row; - png_bytep dp = row; - for (i = 0; i < row_width; i++) - { - png_byte red = png_ptr->gamma_to_1[*(sp++)]; - png_byte green = png_ptr->gamma_to_1[*(sp++)]; - png_byte blue = png_ptr->gamma_to_1[*(sp++)]; - if (red != green || red != blue) - rgb_error |= 1; - *(dp++) = png_ptr->gamma_from_1 - [(rc*red + gc*green + bc*blue)>>15]; - *(dp++) = *(sp++); /* alpha */ - } - } - else -#endif - { - png_bytep sp = row; - png_bytep dp = row; - for (i = 0; i < row_width; i++) - { - png_byte red = *(sp++); - png_byte green = *(sp++); - png_byte blue = *(sp++); - if (red != green || red != blue) - rgb_error |= 1; - *(dp++) = (png_byte)((rc*red + gc*green + bc*blue)>>15); - *(dp++) = *(sp++); /* alpha */ - } - } - } - else /* RGBA bit_depth == 16 */ - { -#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) - if (png_ptr->gamma_16_to_1 != NULL && - png_ptr->gamma_16_from_1 != NULL) - { - png_bytep sp = row; - png_bytep dp = row; - for (i = 0; i < row_width; i++) - { - png_uint_16 red, green, blue, w; - - red = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; - green = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; - blue = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; - - if (red == green && red == blue) - w = red; - else - { - png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red&0xff) >> - png_ptr->gamma_shift][red>>8]; - png_uint_16 green_1 = png_ptr->gamma_16_to_1[(green&0xff) >> - png_ptr->gamma_shift][green>>8]; - png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue&0xff) >> - png_ptr->gamma_shift][blue>>8]; - png_uint_16 gray16 = (png_uint_16)((rc * red_1 - + gc * green_1 + bc * blue_1)>>15); - w = png_ptr->gamma_16_from_1[(gray16&0xff) >> - png_ptr->gamma_shift][gray16 >> 8]; - rgb_error |= 1; - } - - *(dp++) = (png_byte)((w>>8) & 0xff); - *(dp++) = (png_byte)(w & 0xff); - *(dp++) = *(sp++); /* alpha */ - *(dp++) = *(sp++); - } - } - else -#endif - { - png_bytep sp = row; - png_bytep dp = row; - for (i = 0; i < row_width; i++) - { - png_uint_16 red, green, blue, gray16; - red = (png_uint_16)((*(sp)<<8) | *(sp+1)); sp+=2; - green = (png_uint_16)((*(sp)<<8) | *(sp+1)); sp+=2; - blue = (png_uint_16)((*(sp)<<8) | *(sp+1)); sp+=2; - if (red != green || red != blue) - rgb_error |= 1; - gray16 = (png_uint_16)((rc*red + gc*green + bc*blue)>>15); - *(dp++) = (png_byte)((gray16>>8) & 0xff); - *(dp++) = (png_byte)(gray16 & 0xff); - *(dp++) = *(sp++); /* alpha */ - *(dp++) = *(sp++); - } - } - } - } - row_info->channels -= (png_byte)2; - row_info->color_type &= ~PNG_COLOR_MASK_COLOR; - row_info->pixel_depth = (png_byte)(row_info->channels * - row_info->bit_depth); - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width); - } - return rgb_error; -} -#endif - -/* Build a grayscale palette. Palette is assumed to be 1 << bit_depth - * large of png_color. This lets grayscale images be treated as - * paletted. Most useful for gamma correction and simplification - * of code. - */ -void PNGAPI -png_build_grayscale_palette(int bit_depth, png_colorp palette) -{ - int num_palette; - int color_inc; - int i; - int v; - - png_debug(1, "in png_do_build_grayscale_palette"); - if (palette == NULL) - return; - - switch (bit_depth) - { - case 1: - num_palette = 2; - color_inc = 0xff; - break; - case 2: - num_palette = 4; - color_inc = 0x55; - break; - case 4: - num_palette = 16; - color_inc = 0x11; - break; - case 8: - num_palette = 256; - color_inc = 1; - break; - default: - num_palette = 0; - color_inc = 0; - break; - } - - for (i = 0, v = 0; i < num_palette; i++, v += color_inc) - { - palette[i].red = (png_byte)v; - palette[i].green = (png_byte)v; - palette[i].blue = (png_byte)v; - } -} - -/* This function is currently unused. Do we really need it? */ -#if defined(PNG_READ_DITHER_SUPPORTED) && defined(PNG_CORRECT_PALETTE_SUPPORTED) -void /* PRIVATE */ -png_correct_palette(png_structp png_ptr, png_colorp palette, - int num_palette) -{ - png_debug(1, "in png_correct_palette"); -#if defined(PNG_READ_BACKGROUND_SUPPORTED) && \ - defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED) - if (png_ptr->transformations & (PNG_GAMMA | PNG_BACKGROUND)) - { - png_color back, back_1; - - if (png_ptr->background_gamma_type == PNG_BACKGROUND_GAMMA_FILE) - { - back.red = png_ptr->gamma_table[png_ptr->background.red]; - back.green = png_ptr->gamma_table[png_ptr->background.green]; - back.blue = png_ptr->gamma_table[png_ptr->background.blue]; - - back_1.red = png_ptr->gamma_to_1[png_ptr->background.red]; - back_1.green = png_ptr->gamma_to_1[png_ptr->background.green]; - back_1.blue = png_ptr->gamma_to_1[png_ptr->background.blue]; - } - else - { - double g; - - g = 1.0 / (png_ptr->background_gamma * png_ptr->screen_gamma); - - if (png_ptr->background_gamma_type == PNG_BACKGROUND_GAMMA_SCREEN || - fabs(g - 1.0) < PNG_GAMMA_THRESHOLD) - { - back.red = png_ptr->background.red; - back.green = png_ptr->background.green; - back.blue = png_ptr->background.blue; - } - else - { - back.red = - (png_byte)(pow((double)png_ptr->background.red/255, g) * - 255.0 + 0.5); - back.green = - (png_byte)(pow((double)png_ptr->background.green/255, g) * - 255.0 + 0.5); - back.blue = - (png_byte)(pow((double)png_ptr->background.blue/255, g) * - 255.0 + 0.5); - } - - g = 1.0 / png_ptr->background_gamma; - - back_1.red = - (png_byte)(pow((double)png_ptr->background.red/255, g) * - 255.0 + 0.5); - back_1.green = - (png_byte)(pow((double)png_ptr->background.green/255, g) * - 255.0 + 0.5); - back_1.blue = - (png_byte)(pow((double)png_ptr->background.blue/255, g) * - 255.0 + 0.5); - } - - if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) - { - png_uint_32 i; - - for (i = 0; i < (png_uint_32)num_palette; i++) - { - if (i < png_ptr->num_trans && png_ptr->trans[i] == 0) - { - palette[i] = back; - } - else if (i < png_ptr->num_trans && png_ptr->trans[i] != 0xff) - { - png_byte v, w; - - v = png_ptr->gamma_to_1[png_ptr->palette[i].red]; - png_composite(w, v, png_ptr->trans[i], back_1.red); - palette[i].red = png_ptr->gamma_from_1[w]; - - v = png_ptr->gamma_to_1[png_ptr->palette[i].green]; - png_composite(w, v, png_ptr->trans[i], back_1.green); - palette[i].green = png_ptr->gamma_from_1[w]; - - v = png_ptr->gamma_to_1[png_ptr->palette[i].blue]; - png_composite(w, v, png_ptr->trans[i], back_1.blue); - palette[i].blue = png_ptr->gamma_from_1[w]; - } - else - { - palette[i].red = png_ptr->gamma_table[palette[i].red]; - palette[i].green = png_ptr->gamma_table[palette[i].green]; - palette[i].blue = png_ptr->gamma_table[palette[i].blue]; - } - } - } - else - { - int i; - - for (i = 0; i < num_palette; i++) - { - if (palette[i].red == (png_byte)png_ptr->trans_values.gray) - { - palette[i] = back; - } - else - { - palette[i].red = png_ptr->gamma_table[palette[i].red]; - palette[i].green = png_ptr->gamma_table[palette[i].green]; - palette[i].blue = png_ptr->gamma_table[palette[i].blue]; - } - } - } - } - else -#endif -#if defined(PNG_READ_GAMMA_SUPPORTED) - if (png_ptr->transformations & PNG_GAMMA) - { - int i; - - for (i = 0; i < num_palette; i++) - { - palette[i].red = png_ptr->gamma_table[palette[i].red]; - palette[i].green = png_ptr->gamma_table[palette[i].green]; - palette[i].blue = png_ptr->gamma_table[palette[i].blue]; - } - } -#if defined(PNG_READ_BACKGROUND_SUPPORTED) - else -#endif -#endif -#if defined(PNG_READ_BACKGROUND_SUPPORTED) - if (png_ptr->transformations & PNG_BACKGROUND) - { - if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) - { - png_color back; - - back.red = (png_byte)png_ptr->background.red; - back.green = (png_byte)png_ptr->background.green; - back.blue = (png_byte)png_ptr->background.blue; - - for (i = 0; i < (int)png_ptr->num_trans; i++) - { - if (png_ptr->trans[i] == 0) - { - palette[i].red = back.red; - palette[i].green = back.green; - palette[i].blue = back.blue; - } - else if (png_ptr->trans[i] != 0xff) - { - png_composite(palette[i].red, png_ptr->palette[i].red, - png_ptr->trans[i], back.red); - png_composite(palette[i].green, png_ptr->palette[i].green, - png_ptr->trans[i], back.green); - png_composite(palette[i].blue, png_ptr->palette[i].blue, - png_ptr->trans[i], back.blue); - } - } - } - else /* assume grayscale palette (what else could it be?) */ - { - int i; - - for (i = 0; i < num_palette; i++) - { - if (i == (png_byte)png_ptr->trans_values.gray) - { - palette[i].red = (png_byte)png_ptr->background.red; - palette[i].green = (png_byte)png_ptr->background.green; - palette[i].blue = (png_byte)png_ptr->background.blue; - } - } - } - } -#endif -} -#endif - -#if defined(PNG_READ_BACKGROUND_SUPPORTED) -/* Replace any alpha or transparency with the supplied background color. - * "background" is already in the screen gamma, while "background_1" is - * at a gamma of 1.0. Paletted files have already been taken care of. - */ -void /* PRIVATE */ -png_do_background(png_row_infop row_info, png_bytep row, - png_color_16p trans_values, png_color_16p background -#if defined(PNG_READ_GAMMA_SUPPORTED) - , png_color_16p background_1, - png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1, - png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1, - png_uint_16pp gamma_16_to_1, int gamma_shift -#endif - ) -{ - png_bytep sp, dp; - png_uint_32 i; - png_uint_32 row_width=row_info->width; - int shift; - - png_debug(1, "in png_do_background"); - if (background != NULL && -#if defined(PNG_USELESS_TESTS_SUPPORTED) - row != NULL && row_info != NULL && -#endif - (!(row_info->color_type & PNG_COLOR_MASK_ALPHA) || - (row_info->color_type != PNG_COLOR_TYPE_PALETTE && trans_values))) - { - switch (row_info->color_type) - { - case PNG_COLOR_TYPE_GRAY: - { - switch (row_info->bit_depth) - { - case 1: - { - sp = row; - shift = 7; - for (i = 0; i < row_width; i++) - { - if ((png_uint_16)((*sp >> shift) & 0x01) - == trans_values->gray) - { - *sp &= (png_byte)((0x7f7f >> (7 - shift)) & 0xff); - *sp |= (png_byte)(background->gray << shift); - } - if (!shift) - { - shift = 7; - sp++; - } - else - shift--; - } - break; - } - case 2: - { -#if defined(PNG_READ_GAMMA_SUPPORTED) - if (gamma_table != NULL) - { - sp = row; - shift = 6; - for (i = 0; i < row_width; i++) - { - if ((png_uint_16)((*sp >> shift) & 0x03) - == trans_values->gray) - { - *sp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff); - *sp |= (png_byte)(background->gray << shift); - } - else - { - png_byte p = (png_byte)((*sp >> shift) & 0x03); - png_byte g = (png_byte)((gamma_table [p | (p << 2) | - (p << 4) | (p << 6)] >> 6) & 0x03); - *sp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff); - *sp |= (png_byte)(g << shift); - } - if (!shift) - { - shift = 6; - sp++; - } - else - shift -= 2; - } - } - else -#endif - { - sp = row; - shift = 6; - for (i = 0; i < row_width; i++) - { - if ((png_uint_16)((*sp >> shift) & 0x03) - == trans_values->gray) - { - *sp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff); - *sp |= (png_byte)(background->gray << shift); - } - if (!shift) - { - shift = 6; - sp++; - } - else - shift -= 2; - } - } - break; - } - case 4: - { -#if defined(PNG_READ_GAMMA_SUPPORTED) - if (gamma_table != NULL) - { - sp = row; - shift = 4; - for (i = 0; i < row_width; i++) - { - if ((png_uint_16)((*sp >> shift) & 0x0f) - == trans_values->gray) - { - *sp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff); - *sp |= (png_byte)(background->gray << shift); - } - else - { - png_byte p = (png_byte)((*sp >> shift) & 0x0f); - png_byte g = (png_byte)((gamma_table[p | - (p << 4)] >> 4) & 0x0f); - *sp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff); - *sp |= (png_byte)(g << shift); - } - if (!shift) - { - shift = 4; - sp++; - } - else - shift -= 4; - } - } - else -#endif - { - sp = row; - shift = 4; - for (i = 0; i < row_width; i++) - { - if ((png_uint_16)((*sp >> shift) & 0x0f) - == trans_values->gray) - { - *sp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff); - *sp |= (png_byte)(background->gray << shift); - } - if (!shift) - { - shift = 4; - sp++; - } - else - shift -= 4; - } - } - break; - } - case 8: - { -#if defined(PNG_READ_GAMMA_SUPPORTED) - if (gamma_table != NULL) - { - sp = row; - for (i = 0; i < row_width; i++, sp++) - { - if (*sp == trans_values->gray) - { - *sp = (png_byte)background->gray; - } - else - { - *sp = gamma_table[*sp]; - } - } - } - else -#endif - { - sp = row; - for (i = 0; i < row_width; i++, sp++) - { - if (*sp == trans_values->gray) - { - *sp = (png_byte)background->gray; - } - } - } - break; - } - case 16: - { -#if defined(PNG_READ_GAMMA_SUPPORTED) - if (gamma_16 != NULL) - { - sp = row; - for (i = 0; i < row_width; i++, sp += 2) - { - png_uint_16 v; - - v = (png_uint_16)(((*sp) << 8) + *(sp + 1)); - if (v == trans_values->gray) - { - /* background is already in screen gamma */ - *sp = (png_byte)((background->gray >> 8) & 0xff); - *(sp + 1) = (png_byte)(background->gray & 0xff); - } - else - { - v = gamma_16[*(sp + 1) >> gamma_shift][*sp]; - *sp = (png_byte)((v >> 8) & 0xff); - *(sp + 1) = (png_byte)(v & 0xff); - } - } - } - else -#endif - { - sp = row; - for (i = 0; i < row_width; i++, sp += 2) - { - png_uint_16 v; - - v = (png_uint_16)(((*sp) << 8) + *(sp + 1)); - if (v == trans_values->gray) - { - *sp = (png_byte)((background->gray >> 8) & 0xff); - *(sp + 1) = (png_byte)(background->gray & 0xff); - } - } - } - break; - } - } - break; - } - case PNG_COLOR_TYPE_RGB: - { - if (row_info->bit_depth == 8) - { -#if defined(PNG_READ_GAMMA_SUPPORTED) - if (gamma_table != NULL) - { - sp = row; - for (i = 0; i < row_width; i++, sp += 3) - { - if (*sp == trans_values->red && - *(sp + 1) == trans_values->green && - *(sp + 2) == trans_values->blue) - { - *sp = (png_byte)background->red; - *(sp + 1) = (png_byte)background->green; - *(sp + 2) = (png_byte)background->blue; - } - else - { - *sp = gamma_table[*sp]; - *(sp + 1) = gamma_table[*(sp + 1)]; - *(sp + 2) = gamma_table[*(sp + 2)]; - } - } - } - else -#endif - { - sp = row; - for (i = 0; i < row_width; i++, sp += 3) - { - if (*sp == trans_values->red && - *(sp + 1) == trans_values->green && - *(sp + 2) == trans_values->blue) - { - *sp = (png_byte)background->red; - *(sp + 1) = (png_byte)background->green; - *(sp + 2) = (png_byte)background->blue; - } - } - } - } - else /* if (row_info->bit_depth == 16) */ - { -#if defined(PNG_READ_GAMMA_SUPPORTED) - if (gamma_16 != NULL) - { - sp = row; - for (i = 0; i < row_width; i++, sp += 6) - { - png_uint_16 r = (png_uint_16)(((*sp) << 8) + *(sp + 1)); - png_uint_16 g = (png_uint_16)(((*(sp+2)) << 8) + *(sp+3)); - png_uint_16 b = (png_uint_16)(((*(sp+4)) << 8) + *(sp+5)); - if (r == trans_values->red && g == trans_values->green && - b == trans_values->blue) - { - /* background is already in screen gamma */ - *sp = (png_byte)((background->red >> 8) & 0xff); - *(sp + 1) = (png_byte)(background->red & 0xff); - *(sp + 2) = (png_byte)((background->green >> 8) & 0xff); - *(sp + 3) = (png_byte)(background->green & 0xff); - *(sp + 4) = (png_byte)((background->blue >> 8) & 0xff); - *(sp + 5) = (png_byte)(background->blue & 0xff); - } - else - { - png_uint_16 v = gamma_16[*(sp + 1) >> gamma_shift][*sp]; - *sp = (png_byte)((v >> 8) & 0xff); - *(sp + 1) = (png_byte)(v & 0xff); - v = gamma_16[*(sp + 3) >> gamma_shift][*(sp + 2)]; - *(sp + 2) = (png_byte)((v >> 8) & 0xff); - *(sp + 3) = (png_byte)(v & 0xff); - v = gamma_16[*(sp + 5) >> gamma_shift][*(sp + 4)]; - *(sp + 4) = (png_byte)((v >> 8) & 0xff); - *(sp + 5) = (png_byte)(v & 0xff); - } - } - } - else -#endif - { - sp = row; - for (i = 0; i < row_width; i++, sp += 6) - { - png_uint_16 r = (png_uint_16)(((*sp) << 8) + *(sp+1)); - png_uint_16 g = (png_uint_16)(((*(sp+2)) << 8) + *(sp+3)); - png_uint_16 b = (png_uint_16)(((*(sp+4)) << 8) + *(sp+5)); - - if (r == trans_values->red && g == trans_values->green && - b == trans_values->blue) - { - *sp = (png_byte)((background->red >> 8) & 0xff); - *(sp + 1) = (png_byte)(background->red & 0xff); - *(sp + 2) = (png_byte)((background->green >> 8) & 0xff); - *(sp + 3) = (png_byte)(background->green & 0xff); - *(sp + 4) = (png_byte)((background->blue >> 8) & 0xff); - *(sp + 5) = (png_byte)(background->blue & 0xff); - } - } - } - } - break; - } - case PNG_COLOR_TYPE_GRAY_ALPHA: - { - if (row_info->bit_depth == 8) - { -#if defined(PNG_READ_GAMMA_SUPPORTED) - if (gamma_to_1 != NULL && gamma_from_1 != NULL && - gamma_table != NULL) - { - sp = row; - dp = row; - for (i = 0; i < row_width; i++, sp += 2, dp++) - { - png_uint_16 a = *(sp + 1); - - if (a == 0xff) - { - *dp = gamma_table[*sp]; - } - else if (a == 0) - { - /* background is already in screen gamma */ - *dp = (png_byte)background->gray; - } - else - { - png_byte v, w; - - v = gamma_to_1[*sp]; - png_composite(w, v, a, background_1->gray); - *dp = gamma_from_1[w]; - } - } - } - else -#endif - { - sp = row; - dp = row; - for (i = 0; i < row_width; i++, sp += 2, dp++) - { - png_byte a = *(sp + 1); - - if (a == 0xff) - { - *dp = *sp; - } -#if defined(PNG_READ_GAMMA_SUPPORTED) - else if (a == 0) - { - *dp = (png_byte)background->gray; - } - else - { - png_composite(*dp, *sp, a, background_1->gray); - } -#else - *dp = (png_byte)background->gray; -#endif - } - } - } - else /* if (png_ptr->bit_depth == 16) */ - { -#if defined(PNG_READ_GAMMA_SUPPORTED) - if (gamma_16 != NULL && gamma_16_from_1 != NULL && - gamma_16_to_1 != NULL) - { - sp = row; - dp = row; - for (i = 0; i < row_width; i++, sp += 4, dp += 2) - { - png_uint_16 a = (png_uint_16)(((*(sp+2)) << 8) + *(sp+3)); - - if (a == (png_uint_16)0xffff) - { - png_uint_16 v; - - v = gamma_16[*(sp + 1) >> gamma_shift][*sp]; - *dp = (png_byte)((v >> 8) & 0xff); - *(dp + 1) = (png_byte)(v & 0xff); - } -#if defined(PNG_READ_GAMMA_SUPPORTED) - else if (a == 0) -#else - else -#endif - { - /* background is already in screen gamma */ - *dp = (png_byte)((background->gray >> 8) & 0xff); - *(dp + 1) = (png_byte)(background->gray & 0xff); - } -#if defined(PNG_READ_GAMMA_SUPPORTED) - else - { - png_uint_16 g, v, w; - - g = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp]; - png_composite_16(v, g, a, background_1->gray); - w = gamma_16_from_1[(v&0xff) >> gamma_shift][v >> 8]; - *dp = (png_byte)((w >> 8) & 0xff); - *(dp + 1) = (png_byte)(w & 0xff); - } -#endif - } - } - else -#endif - { - sp = row; - dp = row; - for (i = 0; i < row_width; i++, sp += 4, dp += 2) - { - png_uint_16 a = (png_uint_16)(((*(sp+2)) << 8) + *(sp+3)); - if (a == (png_uint_16)0xffff) - { - png_memcpy(dp, sp, 2); - } -#if defined(PNG_READ_GAMMA_SUPPORTED) - else if (a == 0) -#else - else -#endif - { - *dp = (png_byte)((background->gray >> 8) & 0xff); - *(dp + 1) = (png_byte)(background->gray & 0xff); - } -#if defined(PNG_READ_GAMMA_SUPPORTED) - else - { - png_uint_16 g, v; - - g = (png_uint_16)(((*sp) << 8) + *(sp + 1)); - png_composite_16(v, g, a, background_1->gray); - *dp = (png_byte)((v >> 8) & 0xff); - *(dp + 1) = (png_byte)(v & 0xff); - } -#endif - } - } - } - break; - } - case PNG_COLOR_TYPE_RGB_ALPHA: - { - if (row_info->bit_depth == 8) - { -#if defined(PNG_READ_GAMMA_SUPPORTED) - if (gamma_to_1 != NULL && gamma_from_1 != NULL && - gamma_table != NULL) - { - sp = row; - dp = row; - for (i = 0; i < row_width; i++, sp += 4, dp += 3) - { - png_byte a = *(sp + 3); - - if (a == 0xff) - { - *dp = gamma_table[*sp]; - *(dp + 1) = gamma_table[*(sp + 1)]; - *(dp + 2) = gamma_table[*(sp + 2)]; - } - else if (a == 0) - { - /* background is already in screen gamma */ - *dp = (png_byte)background->red; - *(dp + 1) = (png_byte)background->green; - *(dp + 2) = (png_byte)background->blue; - } - else - { - png_byte v, w; - - v = gamma_to_1[*sp]; - png_composite(w, v, a, background_1->red); - *dp = gamma_from_1[w]; - v = gamma_to_1[*(sp + 1)]; - png_composite(w, v, a, background_1->green); - *(dp + 1) = gamma_from_1[w]; - v = gamma_to_1[*(sp + 2)]; - png_composite(w, v, a, background_1->blue); - *(dp + 2) = gamma_from_1[w]; - } - } - } - else -#endif - { - sp = row; - dp = row; - for (i = 0; i < row_width; i++, sp += 4, dp += 3) - { - png_byte a = *(sp + 3); - - if (a == 0xff) - { - *dp = *sp; - *(dp + 1) = *(sp + 1); - *(dp + 2) = *(sp + 2); - } - else if (a == 0) - { - *dp = (png_byte)background->red; - *(dp + 1) = (png_byte)background->green; - *(dp + 2) = (png_byte)background->blue; - } - else - { - png_composite(*dp, *sp, a, background->red); - png_composite(*(dp + 1), *(sp + 1), a, - background->green); - png_composite(*(dp + 2), *(sp + 2), a, - background->blue); - } - } - } - } - else /* if (row_info->bit_depth == 16) */ - { -#if defined(PNG_READ_GAMMA_SUPPORTED) - if (gamma_16 != NULL && gamma_16_from_1 != NULL && - gamma_16_to_1 != NULL) - { - sp = row; - dp = row; - for (i = 0; i < row_width; i++, sp += 8, dp += 6) - { - png_uint_16 a = (png_uint_16)(((png_uint_16)(*(sp + 6)) - << 8) + (png_uint_16)(*(sp + 7))); - if (a == (png_uint_16)0xffff) - { - png_uint_16 v; - - v = gamma_16[*(sp + 1) >> gamma_shift][*sp]; - *dp = (png_byte)((v >> 8) & 0xff); - *(dp + 1) = (png_byte)(v & 0xff); - v = gamma_16[*(sp + 3) >> gamma_shift][*(sp + 2)]; - *(dp + 2) = (png_byte)((v >> 8) & 0xff); - *(dp + 3) = (png_byte)(v & 0xff); - v = gamma_16[*(sp + 5) >> gamma_shift][*(sp + 4)]; - *(dp + 4) = (png_byte)((v >> 8) & 0xff); - *(dp + 5) = (png_byte)(v & 0xff); - } - else if (a == 0) - { - /* background is already in screen gamma */ - *dp = (png_byte)((background->red >> 8) & 0xff); - *(dp + 1) = (png_byte)(background->red & 0xff); - *(dp + 2) = (png_byte)((background->green >> 8) & 0xff); - *(dp + 3) = (png_byte)(background->green & 0xff); - *(dp + 4) = (png_byte)((background->blue >> 8) & 0xff); - *(dp + 5) = (png_byte)(background->blue & 0xff); - } - else - { - png_uint_16 v, w, x; - - v = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp]; - png_composite_16(w, v, a, background_1->red); - x = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> 8]; - *dp = (png_byte)((x >> 8) & 0xff); - *(dp + 1) = (png_byte)(x & 0xff); - v = gamma_16_to_1[*(sp + 3) >> gamma_shift][*(sp + 2)]; - png_composite_16(w, v, a, background_1->green); - x = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> 8]; - *(dp + 2) = (png_byte)((x >> 8) & 0xff); - *(dp + 3) = (png_byte)(x & 0xff); - v = gamma_16_to_1[*(sp + 5) >> gamma_shift][*(sp + 4)]; - png_composite_16(w, v, a, background_1->blue); - x = gamma_16_from_1[(w & 0xff) >> gamma_shift][w >> 8]; - *(dp + 4) = (png_byte)((x >> 8) & 0xff); - *(dp + 5) = (png_byte)(x & 0xff); - } - } - } - else -#endif - { - sp = row; - dp = row; - for (i = 0; i < row_width; i++, sp += 8, dp += 6) - { - png_uint_16 a = (png_uint_16)(((png_uint_16)(*(sp + 6)) - << 8) + (png_uint_16)(*(sp + 7))); - if (a == (png_uint_16)0xffff) - { - png_memcpy(dp, sp, 6); - } - else if (a == 0) - { - *dp = (png_byte)((background->red >> 8) & 0xff); - *(dp + 1) = (png_byte)(background->red & 0xff); - *(dp + 2) = (png_byte)((background->green >> 8) & 0xff); - *(dp + 3) = (png_byte)(background->green & 0xff); - *(dp + 4) = (png_byte)((background->blue >> 8) & 0xff); - *(dp + 5) = (png_byte)(background->blue & 0xff); - } - else - { - png_uint_16 v; - - png_uint_16 r = (png_uint_16)(((*sp) << 8) + *(sp + 1)); - png_uint_16 g = (png_uint_16)(((*(sp + 2)) << 8) - + *(sp + 3)); - png_uint_16 b = (png_uint_16)(((*(sp + 4)) << 8) - + *(sp + 5)); - - png_composite_16(v, r, a, background->red); - *dp = (png_byte)((v >> 8) & 0xff); - *(dp + 1) = (png_byte)(v & 0xff); - png_composite_16(v, g, a, background->green); - *(dp + 2) = (png_byte)((v >> 8) & 0xff); - *(dp + 3) = (png_byte)(v & 0xff); - png_composite_16(v, b, a, background->blue); - *(dp + 4) = (png_byte)((v >> 8) & 0xff); - *(dp + 5) = (png_byte)(v & 0xff); - } - } - } - } - break; - } - } - - if (row_info->color_type & PNG_COLOR_MASK_ALPHA) - { - row_info->color_type &= ~PNG_COLOR_MASK_ALPHA; - row_info->channels--; - row_info->pixel_depth = (png_byte)(row_info->channels * - row_info->bit_depth); - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width); - } - } -} -#endif - -#if defined(PNG_READ_GAMMA_SUPPORTED) -/* Gamma correct the image, avoiding the alpha channel. Make sure - * you do this after you deal with the transparency issue on grayscale - * or RGB images. If your bit depth is 8, use gamma_table, if it - * is 16, use gamma_16_table and gamma_shift. Build these with - * build_gamma_table(). - */ -void /* PRIVATE */ -png_do_gamma(png_row_infop row_info, png_bytep row, - png_bytep gamma_table, png_uint_16pp gamma_16_table, - int gamma_shift) -{ - png_bytep sp; - png_uint_32 i; - png_uint_32 row_width=row_info->width; - - png_debug(1, "in png_do_gamma"); - if ( -#if defined(PNG_USELESS_TESTS_SUPPORTED) - row != NULL && row_info != NULL && -#endif - ((row_info->bit_depth <= 8 && gamma_table != NULL) || - (row_info->bit_depth == 16 && gamma_16_table != NULL))) - { - switch (row_info->color_type) - { - case PNG_COLOR_TYPE_RGB: - { - if (row_info->bit_depth == 8) - { - sp = row; - for (i = 0; i < row_width; i++) - { - *sp = gamma_table[*sp]; - sp++; - *sp = gamma_table[*sp]; - sp++; - *sp = gamma_table[*sp]; - sp++; - } - } - else /* if (row_info->bit_depth == 16) */ - { - sp = row; - for (i = 0; i < row_width; i++) - { - png_uint_16 v; - - v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; - *sp = (png_byte)((v >> 8) & 0xff); - *(sp + 1) = (png_byte)(v & 0xff); - sp += 2; - v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; - *sp = (png_byte)((v >> 8) & 0xff); - *(sp + 1) = (png_byte)(v & 0xff); - sp += 2; - v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; - *sp = (png_byte)((v >> 8) & 0xff); - *(sp + 1) = (png_byte)(v & 0xff); - sp += 2; - } - } - break; - } - case PNG_COLOR_TYPE_RGB_ALPHA: - { - if (row_info->bit_depth == 8) - { - sp = row; - for (i = 0; i < row_width; i++) - { - *sp = gamma_table[*sp]; - sp++; - *sp = gamma_table[*sp]; - sp++; - *sp = gamma_table[*sp]; - sp++; - sp++; - } - } - else /* if (row_info->bit_depth == 16) */ - { - sp = row; - for (i = 0; i < row_width; i++) - { - png_uint_16 v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; - *sp = (png_byte)((v >> 8) & 0xff); - *(sp + 1) = (png_byte)(v & 0xff); - sp += 2; - v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; - *sp = (png_byte)((v >> 8) & 0xff); - *(sp + 1) = (png_byte)(v & 0xff); - sp += 2; - v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; - *sp = (png_byte)((v >> 8) & 0xff); - *(sp + 1) = (png_byte)(v & 0xff); - sp += 4; - } - } - break; - } - case PNG_COLOR_TYPE_GRAY_ALPHA: - { - if (row_info->bit_depth == 8) - { - sp = row; - for (i = 0; i < row_width; i++) - { - *sp = gamma_table[*sp]; - sp += 2; - } - } - else /* if (row_info->bit_depth == 16) */ - { - sp = row; - for (i = 0; i < row_width; i++) - { - png_uint_16 v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; - *sp = (png_byte)((v >> 8) & 0xff); - *(sp + 1) = (png_byte)(v & 0xff); - sp += 4; - } - } - break; - } - case PNG_COLOR_TYPE_GRAY: - { - if (row_info->bit_depth == 2) - { - sp = row; - for (i = 0; i < row_width; i += 4) - { - int a = *sp & 0xc0; - int b = *sp & 0x30; - int c = *sp & 0x0c; - int d = *sp & 0x03; - - *sp = (png_byte)( - ((((int)gamma_table[a|(a>>2)|(a>>4)|(a>>6)]) ) & 0xc0)| - ((((int)gamma_table[(b<<2)|b|(b>>2)|(b>>4)])>>2) & 0x30)| - ((((int)gamma_table[(c<<4)|(c<<2)|c|(c>>2)])>>4) & 0x0c)| - ((((int)gamma_table[(d<<6)|(d<<4)|(d<<2)|d])>>6) )); - sp++; - } - } - if (row_info->bit_depth == 4) - { - sp = row; - for (i = 0; i < row_width; i += 2) - { - int msb = *sp & 0xf0; - int lsb = *sp & 0x0f; - - *sp = (png_byte)((((int)gamma_table[msb | (msb >> 4)]) & 0xf0) - | (((int)gamma_table[(lsb << 4) | lsb]) >> 4)); - sp++; - } - } - else if (row_info->bit_depth == 8) - { - sp = row; - for (i = 0; i < row_width; i++) - { - *sp = gamma_table[*sp]; - sp++; - } - } - else if (row_info->bit_depth == 16) - { - sp = row; - for (i = 0; i < row_width; i++) - { - png_uint_16 v = gamma_16_table[*(sp + 1) >> gamma_shift][*sp]; - *sp = (png_byte)((v >> 8) & 0xff); - *(sp + 1) = (png_byte)(v & 0xff); - sp += 2; - } - } - break; - } - } - } -} -#endif - -#if defined(PNG_READ_EXPAND_SUPPORTED) -/* Expands a palette row to an RGB or RGBA row depending - * upon whether you supply trans and num_trans. - */ -void /* PRIVATE */ -png_do_expand_palette(png_row_infop row_info, png_bytep row, - png_colorp palette, png_bytep trans, int num_trans) -{ - int shift, value; - png_bytep sp, dp; - png_uint_32 i; - png_uint_32 row_width=row_info->width; - - png_debug(1, "in png_do_expand_palette"); - if ( -#if defined(PNG_USELESS_TESTS_SUPPORTED) - row != NULL && row_info != NULL && -#endif - row_info->color_type == PNG_COLOR_TYPE_PALETTE) - { - if (row_info->bit_depth < 8) - { - switch (row_info->bit_depth) - { - case 1: - { - sp = row + (png_size_t)((row_width - 1) >> 3); - dp = row + (png_size_t)row_width - 1; - shift = 7 - (int)((row_width + 7) & 0x07); - for (i = 0; i < row_width; i++) - { - if ((*sp >> shift) & 0x01) - *dp = 1; - else - *dp = 0; - if (shift == 7) - { - shift = 0; - sp--; - } - else - shift++; - - dp--; - } - break; - } - case 2: - { - sp = row + (png_size_t)((row_width - 1) >> 2); - dp = row + (png_size_t)row_width - 1; - shift = (int)((3 - ((row_width + 3) & 0x03)) << 1); - for (i = 0; i < row_width; i++) - { - value = (*sp >> shift) & 0x03; - *dp = (png_byte)value; - if (shift == 6) - { - shift = 0; - sp--; - } - else - shift += 2; - - dp--; - } - break; - } - case 4: - { - sp = row + (png_size_t)((row_width - 1) >> 1); - dp = row + (png_size_t)row_width - 1; - shift = (int)((row_width & 0x01) << 2); - for (i = 0; i < row_width; i++) - { - value = (*sp >> shift) & 0x0f; - *dp = (png_byte)value; - if (shift == 4) - { - shift = 0; - sp--; - } - else - shift += 4; - - dp--; - } - break; - } - } - row_info->bit_depth = 8; - row_info->pixel_depth = 8; - row_info->rowbytes = row_width; - } - switch (row_info->bit_depth) - { - case 8: - { - if (trans != NULL) - { - sp = row + (png_size_t)row_width - 1; - dp = row + (png_size_t)(row_width << 2) - 1; - - for (i = 0; i < row_width; i++) - { - if ((int)(*sp) >= num_trans) - *dp-- = 0xff; - else - *dp-- = trans[*sp]; - *dp-- = palette[*sp].blue; - *dp-- = palette[*sp].green; - *dp-- = palette[*sp].red; - sp--; - } - row_info->bit_depth = 8; - row_info->pixel_depth = 32; - row_info->rowbytes = row_width * 4; - row_info->color_type = 6; - row_info->channels = 4; - } - else - { - sp = row + (png_size_t)row_width - 1; - dp = row + (png_size_t)(row_width * 3) - 1; - - for (i = 0; i < row_width; i++) - { - *dp-- = palette[*sp].blue; - *dp-- = palette[*sp].green; - *dp-- = palette[*sp].red; - sp--; - } - row_info->bit_depth = 8; - row_info->pixel_depth = 24; - row_info->rowbytes = row_width * 3; - row_info->color_type = 2; - row_info->channels = 3; - } - break; - } - } - } -} - -/* If the bit depth < 8, it is expanded to 8. Also, if the already - * expanded transparency value is supplied, an alpha channel is built. - */ -void /* PRIVATE */ -png_do_expand(png_row_infop row_info, png_bytep row, - png_color_16p trans_value) -{ - int shift, value; - png_bytep sp, dp; - png_uint_32 i; - png_uint_32 row_width=row_info->width; - - png_debug(1, "in png_do_expand"); -#if defined(PNG_USELESS_TESTS_SUPPORTED) - if (row != NULL && row_info != NULL) -#endif - { - if (row_info->color_type == PNG_COLOR_TYPE_GRAY) - { - png_uint_16 gray = (png_uint_16)(trans_value ? trans_value->gray : 0); - - if (row_info->bit_depth < 8) - { - switch (row_info->bit_depth) - { - case 1: - { - gray = (png_uint_16)((gray&0x01)*0xff); - sp = row + (png_size_t)((row_width - 1) >> 3); - dp = row + (png_size_t)row_width - 1; - shift = 7 - (int)((row_width + 7) & 0x07); - for (i = 0; i < row_width; i++) - { - if ((*sp >> shift) & 0x01) - *dp = 0xff; - else - *dp = 0; - if (shift == 7) - { - shift = 0; - sp--; - } - else - shift++; - - dp--; - } - break; - } - case 2: - { - gray = (png_uint_16)((gray&0x03)*0x55); - sp = row + (png_size_t)((row_width - 1) >> 2); - dp = row + (png_size_t)row_width - 1; - shift = (int)((3 - ((row_width + 3) & 0x03)) << 1); - for (i = 0; i < row_width; i++) - { - value = (*sp >> shift) & 0x03; - *dp = (png_byte)(value | (value << 2) | (value << 4) | - (value << 6)); - if (shift == 6) - { - shift = 0; - sp--; - } - else - shift += 2; - - dp--; - } - break; - } - case 4: - { - gray = (png_uint_16)((gray&0x0f)*0x11); - sp = row + (png_size_t)((row_width - 1) >> 1); - dp = row + (png_size_t)row_width - 1; - shift = (int)((1 - ((row_width + 1) & 0x01)) << 2); - for (i = 0; i < row_width; i++) - { - value = (*sp >> shift) & 0x0f; - *dp = (png_byte)(value | (value << 4)); - if (shift == 4) - { - shift = 0; - sp--; - } - else - shift = 4; - - dp--; - } - break; - } - } - row_info->bit_depth = 8; - row_info->pixel_depth = 8; - row_info->rowbytes = row_width; - } - - if (trans_value != NULL) - { - if (row_info->bit_depth == 8) - { - gray = gray & 0xff; - sp = row + (png_size_t)row_width - 1; - dp = row + (png_size_t)(row_width << 1) - 1; - for (i = 0; i < row_width; i++) - { - if (*sp == gray) - *dp-- = 0; - else - *dp-- = 0xff; - *dp-- = *sp--; - } - } - else if (row_info->bit_depth == 16) - { - png_byte gray_high = (gray >> 8) & 0xff; - png_byte gray_low = gray & 0xff; - sp = row + row_info->rowbytes - 1; - dp = row + (row_info->rowbytes << 1) - 1; - for (i = 0; i < row_width; i++) - { - if (*(sp - 1) == gray_high && *(sp) == gray_low) - { - *dp-- = 0; - *dp-- = 0; - } - else - { - *dp-- = 0xff; - *dp-- = 0xff; - } - *dp-- = *sp--; - *dp-- = *sp--; - } - } - row_info->color_type = PNG_COLOR_TYPE_GRAY_ALPHA; - row_info->channels = 2; - row_info->pixel_depth = (png_byte)(row_info->bit_depth << 1); - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, - row_width); - } - } - else if (row_info->color_type == PNG_COLOR_TYPE_RGB && trans_value) - { - if (row_info->bit_depth == 8) - { - png_byte red = trans_value->red & 0xff; - png_byte green = trans_value->green & 0xff; - png_byte blue = trans_value->blue & 0xff; - sp = row + (png_size_t)row_info->rowbytes - 1; - dp = row + (png_size_t)(row_width << 2) - 1; - for (i = 0; i < row_width; i++) - { - if (*(sp - 2) == red && *(sp - 1) == green && *(sp) == blue) - *dp-- = 0; - else - *dp-- = 0xff; - *dp-- = *sp--; - *dp-- = *sp--; - *dp-- = *sp--; - } - } - else if (row_info->bit_depth == 16) - { - png_byte red_high = (trans_value->red >> 8) & 0xff; - png_byte green_high = (trans_value->green >> 8) & 0xff; - png_byte blue_high = (trans_value->blue >> 8) & 0xff; - png_byte red_low = trans_value->red & 0xff; - png_byte green_low = trans_value->green & 0xff; - png_byte blue_low = trans_value->blue & 0xff; - sp = row + row_info->rowbytes - 1; - dp = row + (png_size_t)(row_width << 3) - 1; - for (i = 0; i < row_width; i++) - { - if (*(sp - 5) == red_high && - *(sp - 4) == red_low && - *(sp - 3) == green_high && - *(sp - 2) == green_low && - *(sp - 1) == blue_high && - *(sp ) == blue_low) - { - *dp-- = 0; - *dp-- = 0; - } - else - { - *dp-- = 0xff; - *dp-- = 0xff; - } - *dp-- = *sp--; - *dp-- = *sp--; - *dp-- = *sp--; - *dp-- = *sp--; - *dp-- = *sp--; - *dp-- = *sp--; - } - } - row_info->color_type = PNG_COLOR_TYPE_RGB_ALPHA; - row_info->channels = 4; - row_info->pixel_depth = (png_byte)(row_info->bit_depth << 2); - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width); - } - } -} -#endif - -#if defined(PNG_READ_DITHER_SUPPORTED) -void /* PRIVATE */ -png_do_dither(png_row_infop row_info, png_bytep row, - png_bytep palette_lookup, png_bytep dither_lookup) -{ - png_bytep sp, dp; - png_uint_32 i; - png_uint_32 row_width=row_info->width; - - png_debug(1, "in png_do_dither"); -#if defined(PNG_USELESS_TESTS_SUPPORTED) - if (row != NULL && row_info != NULL) -#endif - { - if (row_info->color_type == PNG_COLOR_TYPE_RGB && - palette_lookup && row_info->bit_depth == 8) - { - int r, g, b, p; - sp = row; - dp = row; - for (i = 0; i < row_width; i++) - { - r = *sp++; - g = *sp++; - b = *sp++; - - /* this looks real messy, but the compiler will reduce - it down to a reasonable formula. For example, with - 5 bits per color, we get: - p = (((r >> 3) & 0x1f) << 10) | - (((g >> 3) & 0x1f) << 5) | - ((b >> 3) & 0x1f); - */ - p = (((r >> (8 - PNG_DITHER_RED_BITS)) & - ((1 << PNG_DITHER_RED_BITS) - 1)) << - (PNG_DITHER_GREEN_BITS + PNG_DITHER_BLUE_BITS)) | - (((g >> (8 - PNG_DITHER_GREEN_BITS)) & - ((1 << PNG_DITHER_GREEN_BITS) - 1)) << - (PNG_DITHER_BLUE_BITS)) | - ((b >> (8 - PNG_DITHER_BLUE_BITS)) & - ((1 << PNG_DITHER_BLUE_BITS) - 1)); - - *dp++ = palette_lookup[p]; - } - row_info->color_type = PNG_COLOR_TYPE_PALETTE; - row_info->channels = 1; - row_info->pixel_depth = row_info->bit_depth; - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width); - } - else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA && - palette_lookup != NULL && row_info->bit_depth == 8) - { - int r, g, b, p; - sp = row; - dp = row; - for (i = 0; i < row_width; i++) - { - r = *sp++; - g = *sp++; - b = *sp++; - sp++; - - p = (((r >> (8 - PNG_DITHER_RED_BITS)) & - ((1 << PNG_DITHER_RED_BITS) - 1)) << - (PNG_DITHER_GREEN_BITS + PNG_DITHER_BLUE_BITS)) | - (((g >> (8 - PNG_DITHER_GREEN_BITS)) & - ((1 << PNG_DITHER_GREEN_BITS) - 1)) << - (PNG_DITHER_BLUE_BITS)) | - ((b >> (8 - PNG_DITHER_BLUE_BITS)) & - ((1 << PNG_DITHER_BLUE_BITS) - 1)); - - *dp++ = palette_lookup[p]; - } - row_info->color_type = PNG_COLOR_TYPE_PALETTE; - row_info->channels = 1; - row_info->pixel_depth = row_info->bit_depth; - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width); - } - else if (row_info->color_type == PNG_COLOR_TYPE_PALETTE && - dither_lookup && row_info->bit_depth == 8) - { - sp = row; - for (i = 0; i < row_width; i++, sp++) - { - *sp = dither_lookup[*sp]; - } - } - } -} -#endif - -#ifdef PNG_FLOATING_POINT_SUPPORTED -#if defined(PNG_READ_GAMMA_SUPPORTED) -static PNG_CONST int png_gamma_shift[] = - {0x10, 0x21, 0x42, 0x84, 0x110, 0x248, 0x550, 0xff0, 0x00}; - -/* We build the 8- or 16-bit gamma tables here. Note that for 16-bit - * tables, we don't make a full table if we are reducing to 8-bit in - * the future. Note also how the gamma_16 tables are segmented so that - * we don't need to allocate > 64K chunks for a full 16-bit table. - */ -void /* PRIVATE */ -png_build_gamma_table(png_structp png_ptr) -{ - png_debug(1, "in png_build_gamma_table"); - - if (png_ptr->bit_depth <= 8) - { - int i; - double g; - - if (png_ptr->screen_gamma > .000001) - g = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma); - else - g = 1.0; - - png_ptr->gamma_table = (png_bytep)png_malloc(png_ptr, - (png_uint_32)256); - - for (i = 0; i < 256; i++) - { - png_ptr->gamma_table[i] = (png_byte)(pow((double)i / 255.0, - g) * 255.0 + .5); - } - -#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \ - defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) - if (png_ptr->transformations & ((PNG_BACKGROUND) | PNG_RGB_TO_GRAY)) - { - - g = 1.0 / (png_ptr->gamma); - - png_ptr->gamma_to_1 = (png_bytep)png_malloc(png_ptr, - (png_uint_32)256); - - for (i = 0; i < 256; i++) - { - png_ptr->gamma_to_1[i] = (png_byte)(pow((double)i / 255.0, - g) * 255.0 + .5); - } - - - png_ptr->gamma_from_1 = (png_bytep)png_malloc(png_ptr, - (png_uint_32)256); - - if (png_ptr->screen_gamma > 0.000001) - g = 1.0 / png_ptr->screen_gamma; - else - g = png_ptr->gamma; /* probably doing rgb_to_gray */ - - for (i = 0; i < 256; i++) - { - png_ptr->gamma_from_1[i] = (png_byte)(pow((double)i / 255.0, - g) * 255.0 + .5); - - } - } -#endif /* PNG_READ_BACKGROUND_SUPPORTED || PNG_RGB_TO_GRAY_SUPPORTED */ - } - else - { - double g; - int i, j, shift, num; - int sig_bit; - png_uint_32 ig; - - if (png_ptr->color_type & PNG_COLOR_MASK_COLOR) - { - sig_bit = (int)png_ptr->sig_bit.red; - if ((int)png_ptr->sig_bit.green > sig_bit) - sig_bit = png_ptr->sig_bit.green; - if ((int)png_ptr->sig_bit.blue > sig_bit) - sig_bit = png_ptr->sig_bit.blue; - } - else - { - sig_bit = (int)png_ptr->sig_bit.gray; - } - - if (sig_bit > 0) - shift = 16 - sig_bit; - else - shift = 0; - - if (png_ptr->transformations & PNG_16_TO_8) - { - if (shift < (16 - PNG_MAX_GAMMA_8)) - shift = (16 - PNG_MAX_GAMMA_8); - } - - if (shift > 8) - shift = 8; - if (shift < 0) - shift = 0; - - png_ptr->gamma_shift = (png_byte)shift; - - num = (1 << (8 - shift)); - - if (png_ptr->screen_gamma > .000001) - g = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma); - else - g = 1.0; - - png_ptr->gamma_16_table = (png_uint_16pp)png_malloc(png_ptr, - (png_uint_32)(num * png_sizeof(png_uint_16p))); - - if (png_ptr->transformations & (PNG_16_TO_8 | PNG_BACKGROUND)) - { - double fin, fout; - png_uint_32 last, max; - - png_memset(png_ptr->gamma_16_table, 0, num * png_sizeof(png_uint_16p)); - - for (i = 0; i < num; i++) - { - png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr, - (png_uint_32)(256 * png_sizeof(png_uint_16))); - } - - g = 1.0 / g; - last = 0; - for (i = 0; i < 256; i++) - { - fout = ((double)i + 0.5) / 256.0; - fin = pow(fout, g); - max = (png_uint_32)(fin * (double)((png_uint_32)num << 8)); - while (last <= max) - { - png_ptr->gamma_16_table[(int)(last & (0xff >> shift))] - [(int)(last >> (8 - shift))] = (png_uint_16)( - (png_uint_16)i | ((png_uint_16)i << 8)); - last++; - } - } - while (last < ((png_uint_32)num << 8)) - { - png_ptr->gamma_16_table[(int)(last & (0xff >> shift))] - [(int)(last >> (8 - shift))] = (png_uint_16)65535L; - last++; - } - } - else - { - for (i = 0; i < num; i++) - { - png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr, - (png_uint_32)(256 * png_sizeof(png_uint_16))); - - ig = (((png_uint_32)i * (png_uint_32)png_gamma_shift[shift]) >> 4); - for (j = 0; j < 256; j++) - { - png_ptr->gamma_16_table[i][j] = - (png_uint_16)(pow((double)(ig + ((png_uint_32)j << 8)) / - 65535.0, g) * 65535.0 + .5); - } - } - } - -#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \ - defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) - if (png_ptr->transformations & (PNG_BACKGROUND | PNG_RGB_TO_GRAY)) - { - - g = 1.0 / (png_ptr->gamma); - - png_ptr->gamma_16_to_1 = (png_uint_16pp)png_malloc(png_ptr, - (png_uint_32)(num * png_sizeof(png_uint_16p ))); - - png_memset(png_ptr->gamma_16_to_1, 0, num * png_sizeof(png_uint_16p)); - - for (i = 0; i < num; i++) - { - png_ptr->gamma_16_to_1[i] = (png_uint_16p)png_malloc(png_ptr, - (png_uint_32)(256 * png_sizeof(png_uint_16))); - - ig = (((png_uint_32)i * - (png_uint_32)png_gamma_shift[shift]) >> 4); - for (j = 0; j < 256; j++) - { - png_ptr->gamma_16_to_1[i][j] = - (png_uint_16)(pow((double)(ig + ((png_uint_32)j << 8)) / - 65535.0, g) * 65535.0 + .5); - } - } - - if (png_ptr->screen_gamma > 0.000001) - g = 1.0 / png_ptr->screen_gamma; - else - g = png_ptr->gamma; /* probably doing rgb_to_gray */ - - png_ptr->gamma_16_from_1 = (png_uint_16pp)png_malloc(png_ptr, - (png_uint_32)(num * png_sizeof(png_uint_16p))); - - png_memset(png_ptr->gamma_16_from_1, 0, - num * png_sizeof(png_uint_16p)); - - for (i = 0; i < num; i++) - { - png_ptr->gamma_16_from_1[i] = (png_uint_16p)png_malloc(png_ptr, - (png_uint_32)(256 * png_sizeof(png_uint_16))); - - ig = (((png_uint_32)i * - (png_uint_32)png_gamma_shift[shift]) >> 4); - for (j = 0; j < 256; j++) - { - png_ptr->gamma_16_from_1[i][j] = - (png_uint_16)(pow((double)(ig + ((png_uint_32)j << 8)) / - 65535.0, g) * 65535.0 + .5); - } - } - } -#endif /* PNG_READ_BACKGROUND_SUPPORTED || PNG_RGB_TO_GRAY_SUPPORTED */ - } -} -#endif -/* To do: install integer version of png_build_gamma_table here */ -#endif - -#if defined(PNG_MNG_FEATURES_SUPPORTED) -/* undoes intrapixel differencing */ -void /* PRIVATE */ -png_do_read_intrapixel(png_row_infop row_info, png_bytep row) -{ - png_debug(1, "in png_do_read_intrapixel"); - if ( -#if defined(PNG_USELESS_TESTS_SUPPORTED) - row != NULL && row_info != NULL && -#endif - (row_info->color_type & PNG_COLOR_MASK_COLOR)) - { - int bytes_per_pixel; - png_uint_32 row_width = row_info->width; - if (row_info->bit_depth == 8) - { - png_bytep rp; - png_uint_32 i; - - if (row_info->color_type == PNG_COLOR_TYPE_RGB) - bytes_per_pixel = 3; - else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) - bytes_per_pixel = 4; - else - return; - - for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel) - { - *(rp) = (png_byte)((256 + *rp + *(rp+1))&0xff); - *(rp+2) = (png_byte)((256 + *(rp+2) + *(rp+1))&0xff); - } - } - else if (row_info->bit_depth == 16) - { - png_bytep rp; - png_uint_32 i; - - if (row_info->color_type == PNG_COLOR_TYPE_RGB) - bytes_per_pixel = 6; - else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) - bytes_per_pixel = 8; - else - return; - - for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel) - { - png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1); - png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3); - png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5); - png_uint_32 red = (png_uint_32)((s0 + s1 + 65536L) & 0xffffL); - png_uint_32 blue = (png_uint_32)((s2 + s1 + 65536L) & 0xffffL); - *(rp ) = (png_byte)((red >> 8) & 0xff); - *(rp+1) = (png_byte)(red & 0xff); - *(rp+4) = (png_byte)((blue >> 8) & 0xff); - *(rp+5) = (png_byte)(blue & 0xff); - } - } - } -} -#endif /* PNG_MNG_FEATURES_SUPPORTED */ -#endif /* PNG_READ_SUPPORTED */ - -/* pngrtran.c - transforms the data in a row for PNG readers - * - * Last changed in libpng 1.2.15 January 5, 2007 - * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - * - * This file contains functions optionally called by an application - * in order to tell libpng how to handle data when reading a PNG. - * Transformations that are used in both reading and writing are - * in pngtrans.c. - */ - -#define PNG_INTERNAL -#include "png.h" - -#if defined(PNG_READ_SUPPORTED) - -/* Set the action on getting a CRC error for an ancillary or critical chunk. */ -void PNGAPI -png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action) -{ - png_debug(1, "in png_set_crc_action\n"); - /* Tell libpng how we react to CRC errors in critical chunks */ - if(png_ptr == NULL) return; - switch (crit_action) - { - case PNG_CRC_NO_CHANGE: /* leave setting as is */ - break; - case PNG_CRC_WARN_USE: /* warn/use data */ - png_ptr->flags &= ~PNG_FLAG_CRC_CRITICAL_MASK; - png_ptr->flags |= PNG_FLAG_CRC_CRITICAL_USE; - break; - case PNG_CRC_QUIET_USE: /* quiet/use data */ - png_ptr->flags &= ~PNG_FLAG_CRC_CRITICAL_MASK; - png_ptr->flags |= PNG_FLAG_CRC_CRITICAL_USE | - PNG_FLAG_CRC_CRITICAL_IGNORE; - break; - case PNG_CRC_WARN_DISCARD: /* not a valid action for critical data */ - png_warning(png_ptr, "Can't discard critical data on CRC error."); - case PNG_CRC_ERROR_QUIT: /* error/quit */ - case PNG_CRC_DEFAULT: - default: - png_ptr->flags &= ~PNG_FLAG_CRC_CRITICAL_MASK; - break; - } - - switch (ancil_action) - { - case PNG_CRC_NO_CHANGE: /* leave setting as is */ - break; - case PNG_CRC_WARN_USE: /* warn/use data */ - png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK; - png_ptr->flags |= PNG_FLAG_CRC_ANCILLARY_USE; - break; - case PNG_CRC_QUIET_USE: /* quiet/use data */ - png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK; - png_ptr->flags |= PNG_FLAG_CRC_ANCILLARY_USE | - PNG_FLAG_CRC_ANCILLARY_NOWARN; - break; - case PNG_CRC_ERROR_QUIT: /* error/quit */ - png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK; - png_ptr->flags |= PNG_FLAG_CRC_ANCILLARY_NOWARN; - break; - case PNG_CRC_WARN_DISCARD: /* warn/discard data */ - case PNG_CRC_DEFAULT: - default: - png_ptr->flags &= ~PNG_FLAG_CRC_ANCILLARY_MASK; - break; - } -} - -#if defined(PNG_READ_BACKGROUND_SUPPORTED) && \ - defined(PNG_FLOATING_POINT_SUPPORTED) -/* handle alpha and tRNS via a background color */ -void PNGAPI -png_set_background(png_structp png_ptr, - png_color_16p background_color, int background_gamma_code, - int need_expand, double background_gamma) -{ - png_debug(1, "in png_set_background\n"); - if(png_ptr == NULL) return; - if (background_gamma_code == PNG_BACKGROUND_GAMMA_UNKNOWN) - { - png_warning(png_ptr, "Application must supply a known background gamma"); - return; - } - - png_ptr->transformations |= PNG_BACKGROUND; - png_memcpy(&(png_ptr->background), background_color, - png_sizeof(png_color_16)); - png_ptr->background_gamma = (float)background_gamma; - png_ptr->background_gamma_type = (png_byte)(background_gamma_code); - png_ptr->transformations |= (need_expand ? PNG_BACKGROUND_EXPAND : 0); -} -#endif - -#if defined(PNG_READ_16_TO_8_SUPPORTED) -/* strip 16 bit depth files to 8 bit depth */ -void PNGAPI -png_set_strip_16(png_structp png_ptr) -{ - png_debug(1, "in png_set_strip_16\n"); - if(png_ptr == NULL) return; - png_ptr->transformations |= PNG_16_TO_8; -} -#endif - -#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED) -void PNGAPI -png_set_strip_alpha(png_structp png_ptr) -{ - png_debug(1, "in png_set_strip_alpha\n"); - if(png_ptr == NULL) return; - png_ptr->flags |= PNG_FLAG_STRIP_ALPHA; -} -#endif - -#if defined(PNG_READ_DITHER_SUPPORTED) -/* Dither file to 8 bit. Supply a palette, the current number - * of elements in the palette, the maximum number of elements - * allowed, and a histogram if possible. If the current number - * of colors is greater then the maximum number, the palette will be - * modified to fit in the maximum number. "full_dither" indicates - * whether we need a dithering cube set up for RGB images, or if we - * simply are reducing the number of colors in a paletted image. - */ - -typedef struct png_dsort_struct -{ - struct png_dsort_struct FAR * next; - png_byte left; - png_byte right; -} png_dsort; -typedef png_dsort FAR * png_dsortp; -typedef png_dsort FAR * FAR * png_dsortpp; - -void PNGAPI -png_set_dither(png_structp png_ptr, png_colorp palette, - int num_palette, int maximum_colors, png_uint_16p histogram, - int full_dither) -{ - png_debug(1, "in png_set_dither\n"); - if(png_ptr == NULL) return; - png_ptr->transformations |= PNG_DITHER; - - if (!full_dither) - { - int i; - - png_ptr->dither_index = (png_bytep)png_malloc(png_ptr, - (png_uint_32)(num_palette * png_sizeof (png_byte))); - for (i = 0; i < num_palette; i++) - png_ptr->dither_index[i] = (png_byte)i; - } - - if (num_palette > maximum_colors) - { - if (histogram != NULL) - { - /* This is easy enough, just throw out the least used colors. - Perhaps not the best solution, but good enough. */ - - int i; - - /* initialize an array to sort colors */ - png_ptr->dither_sort = (png_bytep)png_malloc(png_ptr, - (png_uint_32)(num_palette * png_sizeof (png_byte))); - - /* initialize the dither_sort array */ - for (i = 0; i < num_palette; i++) - png_ptr->dither_sort[i] = (png_byte)i; - - /* Find the least used palette entries by starting a - bubble sort, and running it until we have sorted - out enough colors. Note that we don't care about - sorting all the colors, just finding which are - least used. */ - - for (i = num_palette - 1; i >= maximum_colors; i--) - { - int done; /* to stop early if the list is pre-sorted */ - int j; - - done = 1; - for (j = 0; j < i; j++) - { - if (histogram[png_ptr->dither_sort[j]] - < histogram[png_ptr->dither_sort[j + 1]]) - { - png_byte t; - - t = png_ptr->dither_sort[j]; - png_ptr->dither_sort[j] = png_ptr->dither_sort[j + 1]; - png_ptr->dither_sort[j + 1] = t; - done = 0; - } - } - if (done) - break; - } - - /* swap the palette around, and set up a table, if necessary */ - if (full_dither) - { - int j = num_palette; - - /* put all the useful colors within the max, but don't - move the others */ - for (i = 0; i < maximum_colors; i++) - { - if ((int)png_ptr->dither_sort[i] >= maximum_colors) - { - do - j--; - while ((int)png_ptr->dither_sort[j] >= maximum_colors); - palette[i] = palette[j]; - } - } - } - else - { - int j = num_palette; - - /* move all the used colors inside the max limit, and - develop a translation table */ - for (i = 0; i < maximum_colors; i++) - { - /* only move the colors we need to */ - if ((int)png_ptr->dither_sort[i] >= maximum_colors) - { - png_color tmp_color; - - do - j--; - while ((int)png_ptr->dither_sort[j] >= maximum_colors); - - tmp_color = palette[j]; - palette[j] = palette[i]; - palette[i] = tmp_color; - /* indicate where the color went */ - png_ptr->dither_index[j] = (png_byte)i; - png_ptr->dither_index[i] = (png_byte)j; - } - } - - /* find closest color for those colors we are not using */ - for (i = 0; i < num_palette; i++) - { - if ((int)png_ptr->dither_index[i] >= maximum_colors) - { - int min_d, k, min_k, d_index; - - /* find the closest color to one we threw out */ - d_index = png_ptr->dither_index[i]; - min_d = PNG_COLOR_DIST(palette[d_index], palette[0]); - for (k = 1, min_k = 0; k < maximum_colors; k++) - { - int d; - - d = PNG_COLOR_DIST(palette[d_index], palette[k]); - - if (d < min_d) - { - min_d = d; - min_k = k; - } - } - /* point to closest color */ - png_ptr->dither_index[i] = (png_byte)min_k; - } - } - } - png_free(png_ptr, png_ptr->dither_sort); - png_ptr->dither_sort=NULL; - } - else - { - /* This is much harder to do simply (and quickly). Perhaps - we need to go through a median cut routine, but those - don't always behave themselves with only a few colors - as input. So we will just find the closest two colors, - and throw out one of them (chosen somewhat randomly). - [We don't understand this at all, so if someone wants to - work on improving it, be our guest - AED, GRP] - */ - int i; - int max_d; - int num_new_palette; - png_dsortp t; - png_dsortpp hash; - - t=NULL; - - /* initialize palette index arrays */ - png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr, - (png_uint_32)(num_palette * png_sizeof (png_byte))); - png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr, - (png_uint_32)(num_palette * png_sizeof (png_byte))); - - /* initialize the sort array */ - for (i = 0; i < num_palette; i++) - { - png_ptr->index_to_palette[i] = (png_byte)i; - png_ptr->palette_to_index[i] = (png_byte)i; - } - - hash = (png_dsortpp)png_malloc(png_ptr, (png_uint_32)(769 * - png_sizeof (png_dsortp))); - for (i = 0; i < 769; i++) - hash[i] = NULL; -/* png_memset(hash, 0, 769 * png_sizeof (png_dsortp)); */ - - num_new_palette = num_palette; - - /* initial wild guess at how far apart the farthest pixel - pair we will be eliminating will be. Larger - numbers mean more areas will be allocated, Smaller - numbers run the risk of not saving enough data, and - having to do this all over again. - - I have not done extensive checking on this number. - */ - max_d = 96; - - while (num_new_palette > maximum_colors) - { - for (i = 0; i < num_new_palette - 1; i++) - { - int j; - - for (j = i + 1; j < num_new_palette; j++) - { - int d; - - d = PNG_COLOR_DIST(palette[i], palette[j]); - - if (d <= max_d) - { - - t = (png_dsortp)png_malloc_warn(png_ptr, - (png_uint_32)(png_sizeof(png_dsort))); - if (t == NULL) - break; - t->next = hash[d]; - t->left = (png_byte)i; - t->right = (png_byte)j; - hash[d] = t; - } - } - if (t == NULL) - break; - } - - if (t != NULL) - for (i = 0; i <= max_d; i++) - { - if (hash[i] != NULL) - { - png_dsortp p; - - for (p = hash[i]; p; p = p->next) - { - if ((int)png_ptr->index_to_palette[p->left] - < num_new_palette && - (int)png_ptr->index_to_palette[p->right] - < num_new_palette) - { - int j, next_j; - - if (num_new_palette & 0x01) - { - j = p->left; - next_j = p->right; - } - else - { - j = p->right; - next_j = p->left; - } - - num_new_palette--; - palette[png_ptr->index_to_palette[j]] - = palette[num_new_palette]; - if (!full_dither) - { - int k; - - for (k = 0; k < num_palette; k++) - { - if (png_ptr->dither_index[k] == - png_ptr->index_to_palette[j]) - png_ptr->dither_index[k] = - png_ptr->index_to_palette[next_j]; - if ((int)png_ptr->dither_index[k] == - num_new_palette) - png_ptr->dither_index[k] = - png_ptr->index_to_palette[j]; - } - } - - png_ptr->index_to_palette[png_ptr->palette_to_index - [num_new_palette]] = png_ptr->index_to_palette[j]; - png_ptr->palette_to_index[png_ptr->index_to_palette[j]] - = png_ptr->palette_to_index[num_new_palette]; - - png_ptr->index_to_palette[j] = (png_byte)num_new_palette; - png_ptr->palette_to_index[num_new_palette] = (png_byte)j; - } - if (num_new_palette <= maximum_colors) - break; - } - if (num_new_palette <= maximum_colors) - break; - } - } - - for (i = 0; i < 769; i++) - { - if (hash[i] != NULL) - { - png_dsortp p = hash[i]; - while (p) - { - t = p->next; - png_free(png_ptr, p); - p = t; - } - } - hash[i] = 0; - } - max_d += 96; - } - png_free(png_ptr, hash); - png_free(png_ptr, png_ptr->palette_to_index); - png_free(png_ptr, png_ptr->index_to_palette); - png_ptr->palette_to_index=NULL; - png_ptr->index_to_palette=NULL; - } - num_palette = maximum_colors; - } - if (png_ptr->palette == NULL) - { - png_ptr->palette = palette; - } - png_ptr->num_palette = (png_uint_16)num_palette; - - if (full_dither) - { - int i; - png_bytep distance; - int total_bits = PNG_DITHER_RED_BITS + PNG_DITHER_GREEN_BITS + - PNG_DITHER_BLUE_BITS; - int num_red = (1 << PNG_DITHER_RED_BITS); - int num_green = (1 << PNG_DITHER_GREEN_BITS); - int num_blue = (1 << PNG_DITHER_BLUE_BITS); - png_size_t num_entries = ((png_size_t)1 << total_bits); - - png_ptr->palette_lookup = (png_bytep )png_malloc(png_ptr, - (png_uint_32)(num_entries * png_sizeof (png_byte))); - - png_memset(png_ptr->palette_lookup, 0, num_entries * - png_sizeof (png_byte)); - - distance = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_entries * - png_sizeof(png_byte))); - - png_memset(distance, 0xff, num_entries * png_sizeof(png_byte)); - - for (i = 0; i < num_palette; i++) - { - int ir, ig, ib; - int r = (palette[i].red >> (8 - PNG_DITHER_RED_BITS)); - int g = (palette[i].green >> (8 - PNG_DITHER_GREEN_BITS)); - int b = (palette[i].blue >> (8 - PNG_DITHER_BLUE_BITS)); - - for (ir = 0; ir < num_red; ir++) - { - /* int dr = abs(ir - r); */ - int dr = ((ir > r) ? ir - r : r - ir); - int index_r = (ir << (PNG_DITHER_BLUE_BITS + PNG_DITHER_GREEN_BITS)); - - for (ig = 0; ig < num_green; ig++) - { - /* int dg = abs(ig - g); */ - int dg = ((ig > g) ? ig - g : g - ig); - int dt = dr + dg; - int dm = ((dr > dg) ? dr : dg); - int index_g = index_r | (ig << PNG_DITHER_BLUE_BITS); - - for (ib = 0; ib < num_blue; ib++) - { - int d_index = index_g | ib; - /* int db = abs(ib - b); */ - int db = ((ib > b) ? ib - b : b - ib); - int dmax = ((dm > db) ? dm : db); - int d = dmax + dt + db; - - if (d < (int)distance[d_index]) - { - distance[d_index] = (png_byte)d; - png_ptr->palette_lookup[d_index] = (png_byte)i; - } - } - } - } - } - - png_free(png_ptr, distance); - } -} -#endif - -#if defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED) -/* Transform the image from the file_gamma to the screen_gamma. We - * only do transformations on images where the file_gamma and screen_gamma - * are not close reciprocals, otherwise it slows things down slightly, and - * also needlessly introduces small errors. - * - * We will turn off gamma transformation later if no semitransparent entries - * are present in the tRNS array for palette images. We can't do it here - * because we don't necessarily have the tRNS chunk yet. - */ -void PNGAPI -png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma) -{ - png_debug(1, "in png_set_gamma\n"); - if(png_ptr == NULL) return; - if ((fabs(scrn_gamma * file_gamma - 1.0) > PNG_GAMMA_THRESHOLD) || - (png_ptr->color_type & PNG_COLOR_MASK_ALPHA) || - (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)) - png_ptr->transformations |= PNG_GAMMA; - png_ptr->gamma = (float)file_gamma; - png_ptr->screen_gamma = (float)scrn_gamma; -} -#endif - -#if defined(PNG_READ_EXPAND_SUPPORTED) -/* Expand paletted images to RGB, expand grayscale images of - * less than 8-bit depth to 8-bit depth, and expand tRNS chunks - * to alpha channels. - */ -void PNGAPI -png_set_expand(png_structp png_ptr) -{ - png_debug(1, "in png_set_expand\n"); - if(png_ptr == NULL) return; - png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); -} - -/* GRR 19990627: the following three functions currently are identical - * to png_set_expand(). However, it is entirely reasonable that someone - * might wish to expand an indexed image to RGB but *not* expand a single, - * fully transparent palette entry to a full alpha channel--perhaps instead - * convert tRNS to the grayscale/RGB format (16-bit RGB value), or replace - * the transparent color with a particular RGB value, or drop tRNS entirely. - * IOW, a future version of the library may make the transformations flag - * a bit more fine-grained, with separate bits for each of these three - * functions. - * - * More to the point, these functions make it obvious what libpng will be - * doing, whereas "expand" can (and does) mean any number of things. - * - * GRP 20060307: In libpng-1.4.0, png_set_gray_1_2_4_to_8() was modified - * to expand only the sample depth but not to expand the tRNS to alpha. - */ - -/* Expand paletted images to RGB. */ -void PNGAPI -png_set_palette_to_rgb(png_structp png_ptr) -{ - png_debug(1, "in png_set_palette_to_rgb\n"); - if(png_ptr == NULL) return; - png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); -} - -#if !defined(PNG_1_0_X) -/* Expand grayscale images of less than 8-bit depth to 8 bits. */ -void PNGAPI -png_set_expand_gray_1_2_4_to_8(png_structp png_ptr) -{ - png_debug(1, "in png_set_expand_gray_1_2_4_to_8\n"); - if(png_ptr == NULL) return; - png_ptr->transformations |= PNG_EXPAND; -} -#endif - -#if defined(PNG_1_0_X) || defined(PNG_1_2_X) -/* Expand grayscale images of less than 8-bit depth to 8 bits. */ -/* Deprecated as of libpng-1.2.9 */ -void PNGAPI -png_set_gray_1_2_4_to_8(png_structp png_ptr) -{ - png_debug(1, "in png_set_gray_1_2_4_to_8\n"); - if(png_ptr == NULL) return; - png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); -} -#endif - - -/* Expand tRNS chunks to alpha channels. */ -void PNGAPI -png_set_tRNS_to_alpha(png_structp png_ptr) -{ - png_debug(1, "in png_set_expand\n"); - png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); -} -#endif /* defined(PNG_READ_EXPAND_SUPPORTED) */ - -#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) -void PNGAPI -png_set_gray_to_rgb(png_structp png_ptr) -{ - png_debug(1, "in png_set_gray_to_rgb\n"); - png_ptr->transformations |= PNG_GRAY_TO_RGB; -} -#endif - -#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) -#if defined(PNG_FLOATING_POINT_SUPPORTED) -/* Convert a RGB image to a grayscale of the same width. This allows us, - * for example, to convert a 24 bpp RGB image into an 8 bpp grayscale image. - */ - -void PNGAPI -png_set_rgb_to_gray(png_structp png_ptr, int error_action, double red, - double green) -{ - int red_fixed = (int)((float)red*100000.0 + 0.5); - int green_fixed = (int)((float)green*100000.0 + 0.5); - if(png_ptr == NULL) return; - png_set_rgb_to_gray_fixed(png_ptr, error_action, red_fixed, green_fixed); -} -#endif - -void PNGAPI -png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action, - png_fixed_point red, png_fixed_point green) -{ - png_debug(1, "in png_set_rgb_to_gray\n"); - if(png_ptr == NULL) return; - switch(error_action) - { - case 1: png_ptr->transformations |= PNG_RGB_TO_GRAY; - break; - case 2: png_ptr->transformations |= PNG_RGB_TO_GRAY_WARN; - break; - case 3: png_ptr->transformations |= PNG_RGB_TO_GRAY_ERR; - } - if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) -#if defined(PNG_READ_EXPAND_SUPPORTED) - png_ptr->transformations |= PNG_EXPAND; -#else - { - png_warning(png_ptr, "Cannot do RGB_TO_GRAY without EXPAND_SUPPORTED."); - png_ptr->transformations &= ~PNG_RGB_TO_GRAY; - } -#endif - { - png_uint_16 red_int, green_int; - if(red < 0 || green < 0) - { - red_int = 6968; /* .212671 * 32768 + .5 */ - green_int = 23434; /* .715160 * 32768 + .5 */ - } - else if(red + green < 100000L) - { - red_int = (png_uint_16)(((png_uint_32)red*32768L)/100000L); - green_int = (png_uint_16)(((png_uint_32)green*32768L)/100000L); - } - else - { - png_warning(png_ptr, "ignoring out of range rgb_to_gray coefficients"); - red_int = 6968; - green_int = 23434; - } - png_ptr->rgb_to_gray_red_coeff = red_int; - png_ptr->rgb_to_gray_green_coeff = green_int; - png_ptr->rgb_to_gray_blue_coeff = (png_uint_16)(32768-red_int-green_int); - } -} -#endif - -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_LEGACY_SUPPORTED) -void PNGAPI -png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr - read_user_transform_fn) -{ - png_debug(1, "in png_set_read_user_transform_fn\n"); - if(png_ptr == NULL) return; -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) - png_ptr->transformations |= PNG_USER_TRANSFORM; - png_ptr->read_user_transform_fn = read_user_transform_fn; -#endif -#ifdef PNG_LEGACY_SUPPORTED - if(read_user_transform_fn) - png_warning(png_ptr, - "This version of libpng does not support user transforms"); -#endif -} -#endif - -/* Initialize everything needed for the read. This includes modifying - * the palette. - */ -void /* PRIVATE */ -png_init_read_transformations(png_structp png_ptr) -{ - png_debug(1, "in png_init_read_transformations\n"); -#if defined(PNG_USELESS_TESTS_SUPPORTED) - if(png_ptr != NULL) -#endif - { -#if defined(PNG_READ_BACKGROUND_SUPPORTED) || defined(PNG_READ_SHIFT_SUPPORTED) \ - || defined(PNG_READ_GAMMA_SUPPORTED) - int color_type = png_ptr->color_type; -#endif - -#if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED) - -#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) - /* Detect gray background and attempt to enable optimization - * for gray --> RGB case */ - /* Note: if PNG_BACKGROUND_EXPAND is set and color_type is either RGB or - * RGB_ALPHA (in which case need_expand is superfluous anyway), the - * background color might actually be gray yet not be flagged as such. - * This is not a problem for the current code, which uses - * PNG_BACKGROUND_IS_GRAY only to decide when to do the - * png_do_gray_to_rgb() transformation. - */ - if ((png_ptr->transformations & PNG_BACKGROUND_EXPAND) && - !(color_type & PNG_COLOR_MASK_COLOR)) - { - png_ptr->mode |= PNG_BACKGROUND_IS_GRAY; - } else if ((png_ptr->transformations & PNG_BACKGROUND) && - !(png_ptr->transformations & PNG_BACKGROUND_EXPAND) && - (png_ptr->transformations & PNG_GRAY_TO_RGB) && - png_ptr->background.red == png_ptr->background.green && - png_ptr->background.red == png_ptr->background.blue) - { - png_ptr->mode |= PNG_BACKGROUND_IS_GRAY; - png_ptr->background.gray = png_ptr->background.red; - } -#endif - - if ((png_ptr->transformations & PNG_BACKGROUND_EXPAND) && - (png_ptr->transformations & PNG_EXPAND)) - { - if (!(color_type & PNG_COLOR_MASK_COLOR)) /* i.e., GRAY or GRAY_ALPHA */ - { - /* expand background and tRNS chunks */ - switch (png_ptr->bit_depth) - { - case 1: - png_ptr->background.gray *= (png_uint_16)0xff; - png_ptr->background.red = png_ptr->background.green - = png_ptr->background.blue = png_ptr->background.gray; - if (!(png_ptr->transformations & PNG_EXPAND_tRNS)) - { - png_ptr->trans_values.gray *= (png_uint_16)0xff; - png_ptr->trans_values.red = png_ptr->trans_values.green - = png_ptr->trans_values.blue = png_ptr->trans_values.gray; - } - break; - case 2: - png_ptr->background.gray *= (png_uint_16)0x55; - png_ptr->background.red = png_ptr->background.green - = png_ptr->background.blue = png_ptr->background.gray; - if (!(png_ptr->transformations & PNG_EXPAND_tRNS)) - { - png_ptr->trans_values.gray *= (png_uint_16)0x55; - png_ptr->trans_values.red = png_ptr->trans_values.green - = png_ptr->trans_values.blue = png_ptr->trans_values.gray; - } - break; - case 4: - png_ptr->background.gray *= (png_uint_16)0x11; - png_ptr->background.red = png_ptr->background.green - = png_ptr->background.blue = png_ptr->background.gray; - if (!(png_ptr->transformations & PNG_EXPAND_tRNS)) - { - png_ptr->trans_values.gray *= (png_uint_16)0x11; - png_ptr->trans_values.red = png_ptr->trans_values.green - = png_ptr->trans_values.blue = png_ptr->trans_values.gray; - } - break; - case 8: - case 16: - png_ptr->background.red = png_ptr->background.green - = png_ptr->background.blue = png_ptr->background.gray; - break; - } - } - else if (color_type == PNG_COLOR_TYPE_PALETTE) - { - png_ptr->background.red = - png_ptr->palette[png_ptr->background.index].red; - png_ptr->background.green = - png_ptr->palette[png_ptr->background.index].green; - png_ptr->background.blue = - png_ptr->palette[png_ptr->background.index].blue; - -#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) - if (png_ptr->transformations & PNG_INVERT_ALPHA) - { -#if defined(PNG_READ_EXPAND_SUPPORTED) - if (!(png_ptr->transformations & PNG_EXPAND_tRNS)) -#endif - { - /* invert the alpha channel (in tRNS) unless the pixels are - going to be expanded, in which case leave it for later */ - int i,istop; - istop=(int)png_ptr->num_trans; - for (i=0; itrans[i] = (png_byte)(255 - png_ptr->trans[i]); - } - } -#endif - - } - } -#endif - -#if defined(PNG_READ_BACKGROUND_SUPPORTED) && defined(PNG_READ_GAMMA_SUPPORTED) - png_ptr->background_1 = png_ptr->background; -#endif -#if defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED) - - if ((color_type == PNG_COLOR_TYPE_PALETTE && png_ptr->num_trans != 0) - && (fabs(png_ptr->screen_gamma * png_ptr->gamma - 1.0) - < PNG_GAMMA_THRESHOLD)) - { - int i,k; - k=0; - for (i=0; inum_trans; i++) - { - if (png_ptr->trans[i] != 0 && png_ptr->trans[i] != 0xff) - k=1; /* partial transparency is present */ - } - if (k == 0) - png_ptr->transformations &= (~PNG_GAMMA); - } - - if ((png_ptr->transformations & (PNG_GAMMA | PNG_RGB_TO_GRAY)) && - png_ptr->gamma != 0.0) - { - png_build_gamma_table(png_ptr); -#if defined(PNG_READ_BACKGROUND_SUPPORTED) - if (png_ptr->transformations & PNG_BACKGROUND) - { - if (color_type == PNG_COLOR_TYPE_PALETTE) - { - /* could skip if no transparency and - */ - png_color back, back_1; - png_colorp palette = png_ptr->palette; - int num_palette = png_ptr->num_palette; - int i; - if (png_ptr->background_gamma_type == PNG_BACKGROUND_GAMMA_FILE) - { - back.red = png_ptr->gamma_table[png_ptr->background.red]; - back.green = png_ptr->gamma_table[png_ptr->background.green]; - back.blue = png_ptr->gamma_table[png_ptr->background.blue]; - - back_1.red = png_ptr->gamma_to_1[png_ptr->background.red]; - back_1.green = png_ptr->gamma_to_1[png_ptr->background.green]; - back_1.blue = png_ptr->gamma_to_1[png_ptr->background.blue]; - } - else - { - double g, gs; - - switch (png_ptr->background_gamma_type) - { - case PNG_BACKGROUND_GAMMA_SCREEN: - g = (png_ptr->screen_gamma); - gs = 1.0; - break; - case PNG_BACKGROUND_GAMMA_FILE: - g = 1.0 / (png_ptr->gamma); - gs = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma); - break; - case PNG_BACKGROUND_GAMMA_UNIQUE: - g = 1.0 / (png_ptr->background_gamma); - gs = 1.0 / (png_ptr->background_gamma * - png_ptr->screen_gamma); - break; - default: - g = 1.0; /* back_1 */ - gs = 1.0; /* back */ - } - - if ( fabs(gs - 1.0) < PNG_GAMMA_THRESHOLD) - { - back.red = (png_byte)png_ptr->background.red; - back.green = (png_byte)png_ptr->background.green; - back.blue = (png_byte)png_ptr->background.blue; - } - else - { - back.red = (png_byte)(pow( - (double)png_ptr->background.red/255, gs) * 255.0 + .5); - back.green = (png_byte)(pow( - (double)png_ptr->background.green/255, gs) * 255.0 + .5); - back.blue = (png_byte)(pow( - (double)png_ptr->background.blue/255, gs) * 255.0 + .5); - } - - back_1.red = (png_byte)(pow( - (double)png_ptr->background.red/255, g) * 255.0 + .5); - back_1.green = (png_byte)(pow( - (double)png_ptr->background.green/255, g) * 255.0 + .5); - back_1.blue = (png_byte)(pow( - (double)png_ptr->background.blue/255, g) * 255.0 + .5); - } - for (i = 0; i < num_palette; i++) - { - if (i < (int)png_ptr->num_trans && png_ptr->trans[i] != 0xff) - { - if (png_ptr->trans[i] == 0) - { - palette[i] = back; - } - else /* if (png_ptr->trans[i] != 0xff) */ - { - png_byte v, w; - - v = png_ptr->gamma_to_1[palette[i].red]; - png_composite(w, v, png_ptr->trans[i], back_1.red); - palette[i].red = png_ptr->gamma_from_1[w]; - - v = png_ptr->gamma_to_1[palette[i].green]; - png_composite(w, v, png_ptr->trans[i], back_1.green); - palette[i].green = png_ptr->gamma_from_1[w]; - - v = png_ptr->gamma_to_1[palette[i].blue]; - png_composite(w, v, png_ptr->trans[i], back_1.blue); - palette[i].blue = png_ptr->gamma_from_1[w]; - } - } - else - { - palette[i].red = png_ptr->gamma_table[palette[i].red]; - palette[i].green = png_ptr->gamma_table[palette[i].green]; - palette[i].blue = png_ptr->gamma_table[palette[i].blue]; - } - } - } - /* if (png_ptr->background_gamma_type!=PNG_BACKGROUND_GAMMA_UNKNOWN) */ - else - /* color_type != PNG_COLOR_TYPE_PALETTE */ - { - double m = (double)(((png_uint_32)1 << png_ptr->bit_depth) - 1); - double g = 1.0; - double gs = 1.0; - - switch (png_ptr->background_gamma_type) - { - case PNG_BACKGROUND_GAMMA_SCREEN: - g = (png_ptr->screen_gamma); - gs = 1.0; - break; - case PNG_BACKGROUND_GAMMA_FILE: - g = 1.0 / (png_ptr->gamma); - gs = 1.0 / (png_ptr->gamma * png_ptr->screen_gamma); - break; - case PNG_BACKGROUND_GAMMA_UNIQUE: - g = 1.0 / (png_ptr->background_gamma); - gs = 1.0 / (png_ptr->background_gamma * - png_ptr->screen_gamma); - break; - } - - png_ptr->background_1.gray = (png_uint_16)(pow( - (double)png_ptr->background.gray / m, g) * m + .5); - png_ptr->background.gray = (png_uint_16)(pow( - (double)png_ptr->background.gray / m, gs) * m + .5); - - if ((png_ptr->background.red != png_ptr->background.green) || - (png_ptr->background.red != png_ptr->background.blue) || - (png_ptr->background.red != png_ptr->background.gray)) - { - /* RGB or RGBA with color background */ - png_ptr->background_1.red = (png_uint_16)(pow( - (double)png_ptr->background.red / m, g) * m + .5); - png_ptr->background_1.green = (png_uint_16)(pow( - (double)png_ptr->background.green / m, g) * m + .5); - png_ptr->background_1.blue = (png_uint_16)(pow( - (double)png_ptr->background.blue / m, g) * m + .5); - png_ptr->background.red = (png_uint_16)(pow( - (double)png_ptr->background.red / m, gs) * m + .5); - png_ptr->background.green = (png_uint_16)(pow( - (double)png_ptr->background.green / m, gs) * m + .5); - png_ptr->background.blue = (png_uint_16)(pow( - (double)png_ptr->background.blue / m, gs) * m + .5); - } - else - { - /* GRAY, GRAY ALPHA, RGB, or RGBA with gray background */ - png_ptr->background_1.red = png_ptr->background_1.green - = png_ptr->background_1.blue = png_ptr->background_1.gray; - png_ptr->background.red = png_ptr->background.green - = png_ptr->background.blue = png_ptr->background.gray; - } - } - } - else - /* transformation does not include PNG_BACKGROUND */ -#endif /* PNG_READ_BACKGROUND_SUPPORTED */ - if (color_type == PNG_COLOR_TYPE_PALETTE) - { - png_colorp palette = png_ptr->palette; - int num_palette = png_ptr->num_palette; - int i; - - for (i = 0; i < num_palette; i++) - { - palette[i].red = png_ptr->gamma_table[palette[i].red]; - palette[i].green = png_ptr->gamma_table[palette[i].green]; - palette[i].blue = png_ptr->gamma_table[palette[i].blue]; - } - } - } -#if defined(PNG_READ_BACKGROUND_SUPPORTED) - else -#endif -#endif /* PNG_READ_GAMMA_SUPPORTED && PNG_FLOATING_POINT_SUPPORTED */ -#if defined(PNG_READ_BACKGROUND_SUPPORTED) - /* No GAMMA transformation */ - if ((png_ptr->transformations & PNG_BACKGROUND) && - (color_type == PNG_COLOR_TYPE_PALETTE)) - { - int i; - int istop = (int)png_ptr->num_trans; - png_color back; - png_colorp palette = png_ptr->palette; - - back.red = (png_byte)png_ptr->background.red; - back.green = (png_byte)png_ptr->background.green; - back.blue = (png_byte)png_ptr->background.blue; - - for (i = 0; i < istop; i++) - { - if (png_ptr->trans[i] == 0) - { - palette[i] = back; - } - else if (png_ptr->trans[i] != 0xff) - { - /* The png_composite() macro is defined in png.h */ - png_composite(palette[i].red, palette[i].red, - png_ptr->trans[i], back.red); - png_composite(palette[i].green, palette[i].green, - png_ptr->trans[i], back.green); - png_composite(palette[i].blue, palette[i].blue, - png_ptr->trans[i], back.blue); - } - } - } -#endif /* PNG_READ_BACKGROUND_SUPPORTED */ - -#if defined(PNG_READ_SHIFT_SUPPORTED) - if ((png_ptr->transformations & PNG_SHIFT) && - (color_type == PNG_COLOR_TYPE_PALETTE)) - { - png_uint_16 i; - png_uint_16 istop = png_ptr->num_palette; - int sr = 8 - png_ptr->sig_bit.red; - int sg = 8 - png_ptr->sig_bit.green; - int sb = 8 - png_ptr->sig_bit.blue; - - if (sr < 0 || sr > 8) - sr = 0; - if (sg < 0 || sg > 8) - sg = 0; - if (sb < 0 || sb > 8) - sb = 0; - for (i = 0; i < istop; i++) - { - png_ptr->palette[i].red >>= sr; - png_ptr->palette[i].green >>= sg; - png_ptr->palette[i].blue >>= sb; - } - } -#endif /* PNG_READ_SHIFT_SUPPORTED */ - } -#if !defined(PNG_READ_GAMMA_SUPPORTED) && !defined(PNG_READ_SHIFT_SUPPORTED) \ - && !defined(PNG_READ_BACKGROUND_SUPPORTED) - if(png_ptr) - return; -#endif -} - -/* Modify the info structure to reflect the transformations. The - * info should be updated so a PNG file could be written with it, - * assuming the transformations result in valid PNG data. - */ -void /* PRIVATE */ -png_read_transform_info(png_structp png_ptr, png_infop info_ptr) -{ - png_debug(1, "in png_read_transform_info\n"); -#if defined(PNG_READ_EXPAND_SUPPORTED) - if (png_ptr->transformations & PNG_EXPAND) - { - if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) - { - if (png_ptr->num_trans && (png_ptr->transformations & PNG_EXPAND_tRNS)) - info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA; - else - info_ptr->color_type = PNG_COLOR_TYPE_RGB; - info_ptr->bit_depth = 8; - info_ptr->num_trans = 0; - } - else - { - if (png_ptr->num_trans) - { - if (png_ptr->transformations & PNG_EXPAND_tRNS) - info_ptr->color_type |= PNG_COLOR_MASK_ALPHA; - else - info_ptr->color_type |= PNG_COLOR_MASK_COLOR; - } - if (info_ptr->bit_depth < 8) - info_ptr->bit_depth = 8; - info_ptr->num_trans = 0; - } - } -#endif - -#if defined(PNG_READ_BACKGROUND_SUPPORTED) - if (png_ptr->transformations & PNG_BACKGROUND) - { - info_ptr->color_type &= ~PNG_COLOR_MASK_ALPHA; - info_ptr->num_trans = 0; - info_ptr->background = png_ptr->background; - } -#endif - -#if defined(PNG_READ_GAMMA_SUPPORTED) - if (png_ptr->transformations & PNG_GAMMA) - { -#ifdef PNG_FLOATING_POINT_SUPPORTED - info_ptr->gamma = png_ptr->gamma; -#endif -#ifdef PNG_FIXED_POINT_SUPPORTED - info_ptr->int_gamma = png_ptr->int_gamma; -#endif - } -#endif - -#if defined(PNG_READ_16_TO_8_SUPPORTED) - if ((png_ptr->transformations & PNG_16_TO_8) && (info_ptr->bit_depth == 16)) - info_ptr->bit_depth = 8; -#endif - -#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) - if (png_ptr->transformations & PNG_GRAY_TO_RGB) - info_ptr->color_type |= PNG_COLOR_MASK_COLOR; -#endif - -#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) - if (png_ptr->transformations & PNG_RGB_TO_GRAY) - info_ptr->color_type &= ~PNG_COLOR_MASK_COLOR; -#endif - -#if defined(PNG_READ_DITHER_SUPPORTED) - if (png_ptr->transformations & PNG_DITHER) - { - if (((info_ptr->color_type == PNG_COLOR_TYPE_RGB) || - (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)) && - png_ptr->palette_lookup && info_ptr->bit_depth == 8) - { - info_ptr->color_type = PNG_COLOR_TYPE_PALETTE; - } - } -#endif - -#if defined(PNG_READ_PACK_SUPPORTED) - if ((png_ptr->transformations & PNG_PACK) && (info_ptr->bit_depth < 8)) - info_ptr->bit_depth = 8; -#endif - - if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) - info_ptr->channels = 1; - else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR) - info_ptr->channels = 3; - else - info_ptr->channels = 1; - -#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED) - if (png_ptr->flags & PNG_FLAG_STRIP_ALPHA) - info_ptr->color_type &= ~PNG_COLOR_MASK_ALPHA; -#endif - - if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA) - info_ptr->channels++; - -#if defined(PNG_READ_FILLER_SUPPORTED) - /* STRIP_ALPHA and FILLER allowed: MASK_ALPHA bit stripped above */ - if ((png_ptr->transformations & PNG_FILLER) && - ((info_ptr->color_type == PNG_COLOR_TYPE_RGB) || - (info_ptr->color_type == PNG_COLOR_TYPE_GRAY))) - { - info_ptr->channels++; - /* if adding a true alpha channel not just filler */ -#if !defined(PNG_1_0_X) - if (png_ptr->transformations & PNG_ADD_ALPHA) - info_ptr->color_type |= PNG_COLOR_MASK_ALPHA; -#endif - } -#endif - -#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) && \ -defined(PNG_READ_USER_TRANSFORM_SUPPORTED) - if(png_ptr->transformations & PNG_USER_TRANSFORM) - { - if(info_ptr->bit_depth < png_ptr->user_transform_depth) - info_ptr->bit_depth = png_ptr->user_transform_depth; - if(info_ptr->channels < png_ptr->user_transform_channels) - info_ptr->channels = png_ptr->user_transform_channels; - } -#endif - - info_ptr->pixel_depth = (png_byte)(info_ptr->channels * - info_ptr->bit_depth); - - info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth,info_ptr->width); - -#if !defined(PNG_READ_EXPAND_SUPPORTED) - if(png_ptr) - return; -#endif -} - -/* Transform the row. The order of transformations is significant, - * and is very touchy. If you add a transformation, take care to - * decide how it fits in with the other transformations here. - */ -void /* PRIVATE */ -png_do_read_transformations(png_structp png_ptr) -{ - png_debug(1, "in png_do_read_transformations\n"); -#if !defined(PNG_USELESS_TESTS_SUPPORTED) - if (png_ptr->row_buf == NULL) - { -#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) - char msg[50]; - - sprintf(msg, "NULL row buffer for row %ld, pass %d", png_ptr->row_number, - png_ptr->pass); - png_error(png_ptr, msg); -#else - png_error(png_ptr, "NULL row buffer"); -#endif - } -#endif - -#if defined(PNG_READ_EXPAND_SUPPORTED) - if (png_ptr->transformations & PNG_EXPAND) - { - if (png_ptr->row_info.color_type == PNG_COLOR_TYPE_PALETTE) - { - png_do_expand_palette(&(png_ptr->row_info), png_ptr->row_buf + 1, - png_ptr->palette, png_ptr->trans, png_ptr->num_trans); - } - else - { - if (png_ptr->num_trans && (png_ptr->transformations & PNG_EXPAND_tRNS)) - png_do_expand(&(png_ptr->row_info), png_ptr->row_buf + 1, - &(png_ptr->trans_values)); - else - png_do_expand(&(png_ptr->row_info), png_ptr->row_buf + 1, - NULL); - } - } -#endif - -#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED) - if (png_ptr->flags & PNG_FLAG_STRIP_ALPHA) - png_do_strip_filler(&(png_ptr->row_info), png_ptr->row_buf + 1, - PNG_FLAG_FILLER_AFTER | (png_ptr->flags & PNG_FLAG_STRIP_ALPHA)); -#endif - -#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) - if (png_ptr->transformations & PNG_RGB_TO_GRAY) - { - int rgb_error = - png_do_rgb_to_gray(png_ptr, &(png_ptr->row_info), png_ptr->row_buf + 1); - if(rgb_error) - { - png_ptr->rgb_to_gray_status=1; - if(png_ptr->transformations & PNG_RGB_TO_GRAY_WARN) - png_warning(png_ptr, "png_do_rgb_to_gray found nongray pixel"); - if(png_ptr->transformations & PNG_RGB_TO_GRAY_ERR) - png_error(png_ptr, "png_do_rgb_to_gray found nongray pixel"); - } - } -#endif - -/* -From Andreas Dilger e-mail to png-implement, 26 March 1998: - - In most cases, the "simple transparency" should be done prior to doing - gray-to-RGB, or you will have to test 3x as many bytes to check if a - pixel is transparent. You would also need to make sure that the - transparency information is upgraded to RGB. - - To summarize, the current flow is: - - Gray + simple transparency -> compare 1 or 2 gray bytes and composite - with background "in place" if transparent, - convert to RGB if necessary - - Gray + alpha -> composite with gray background and remove alpha bytes, - convert to RGB if necessary - - To support RGB backgrounds for gray images we need: - - Gray + simple transparency -> convert to RGB + simple transparency, compare - 3 or 6 bytes and composite with background - "in place" if transparent (3x compare/pixel - compared to doing composite with gray bkgrnd) - - Gray + alpha -> convert to RGB + alpha, composite with background and - remove alpha bytes (3x float operations/pixel - compared with composite on gray background) - - Greg's change will do this. The reason it wasn't done before is for - performance, as this increases the per-pixel operations. If we would check - in advance if the background was gray or RGB, and position the gray-to-RGB - transform appropriately, then it would save a lot of work/time. - */ - -#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) - /* if gray -> RGB, do so now only if background is non-gray; else do later - * for performance reasons */ - if ((png_ptr->transformations & PNG_GRAY_TO_RGB) && - !(png_ptr->mode & PNG_BACKGROUND_IS_GRAY)) - png_do_gray_to_rgb(&(png_ptr->row_info), png_ptr->row_buf + 1); -#endif - -#if defined(PNG_READ_BACKGROUND_SUPPORTED) - if ((png_ptr->transformations & PNG_BACKGROUND) && - ((png_ptr->num_trans != 0 ) || - (png_ptr->color_type & PNG_COLOR_MASK_ALPHA))) - png_do_background(&(png_ptr->row_info), png_ptr->row_buf + 1, - &(png_ptr->trans_values), &(png_ptr->background) -#if defined(PNG_READ_GAMMA_SUPPORTED) - , &(png_ptr->background_1), - png_ptr->gamma_table, png_ptr->gamma_from_1, - png_ptr->gamma_to_1, png_ptr->gamma_16_table, - png_ptr->gamma_16_from_1, png_ptr->gamma_16_to_1, - png_ptr->gamma_shift -#endif -); -#endif - -#if defined(PNG_READ_GAMMA_SUPPORTED) - if ((png_ptr->transformations & PNG_GAMMA) && -#if defined(PNG_READ_BACKGROUND_SUPPORTED) - !((png_ptr->transformations & PNG_BACKGROUND) && - ((png_ptr->num_trans != 0) || - (png_ptr->color_type & PNG_COLOR_MASK_ALPHA))) && -#endif - (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE)) - png_do_gamma(&(png_ptr->row_info), png_ptr->row_buf + 1, - png_ptr->gamma_table, png_ptr->gamma_16_table, - png_ptr->gamma_shift); -#endif - -#if defined(PNG_READ_16_TO_8_SUPPORTED) - if (png_ptr->transformations & PNG_16_TO_8) - png_do_chop(&(png_ptr->row_info), png_ptr->row_buf + 1); -#endif - -#if defined(PNG_READ_DITHER_SUPPORTED) - if (png_ptr->transformations & PNG_DITHER) - { - png_do_dither((png_row_infop)&(png_ptr->row_info), png_ptr->row_buf + 1, - png_ptr->palette_lookup, png_ptr->dither_index); - if(png_ptr->row_info.rowbytes == (png_uint_32)0) - png_error(png_ptr, "png_do_dither returned rowbytes=0"); - } -#endif - -#if defined(PNG_READ_INVERT_SUPPORTED) - if (png_ptr->transformations & PNG_INVERT_MONO) - png_do_invert(&(png_ptr->row_info), png_ptr->row_buf + 1); -#endif - -#if defined(PNG_READ_SHIFT_SUPPORTED) - if (png_ptr->transformations & PNG_SHIFT) - png_do_unshift(&(png_ptr->row_info), png_ptr->row_buf + 1, - &(png_ptr->shift)); -#endif - -#if defined(PNG_READ_PACK_SUPPORTED) - if (png_ptr->transformations & PNG_PACK) - png_do_unpack(&(png_ptr->row_info), png_ptr->row_buf + 1); -#endif - -#if defined(PNG_READ_BGR_SUPPORTED) - if (png_ptr->transformations & PNG_BGR) - png_do_bgr(&(png_ptr->row_info), png_ptr->row_buf + 1); -#endif - -#if defined(PNG_READ_PACKSWAP_SUPPORTED) - if (png_ptr->transformations & PNG_PACKSWAP) - png_do_packswap(&(png_ptr->row_info), png_ptr->row_buf + 1); -#endif - -#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) - /* if gray -> RGB, do so now only if we did not do so above */ - if ((png_ptr->transformations & PNG_GRAY_TO_RGB) && - (png_ptr->mode & PNG_BACKGROUND_IS_GRAY)) - png_do_gray_to_rgb(&(png_ptr->row_info), png_ptr->row_buf + 1); -#endif - -#if defined(PNG_READ_FILLER_SUPPORTED) - if (png_ptr->transformations & PNG_FILLER) - png_do_read_filler(&(png_ptr->row_info), png_ptr->row_buf + 1, - (png_uint_32)png_ptr->filler, png_ptr->flags); -#endif - -#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) - if (png_ptr->transformations & PNG_INVERT_ALPHA) - png_do_read_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1); -#endif - -#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) - if (png_ptr->transformations & PNG_SWAP_ALPHA) - png_do_read_swap_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1); -#endif - -#if defined(PNG_READ_SWAP_SUPPORTED) - if (png_ptr->transformations & PNG_SWAP_BYTES) - png_do_swap(&(png_ptr->row_info), png_ptr->row_buf + 1); -#endif - -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) - if (png_ptr->transformations & PNG_USER_TRANSFORM) - { - if(png_ptr->read_user_transform_fn != NULL) - (*(png_ptr->read_user_transform_fn)) /* user read transform function */ - (png_ptr, /* png_ptr */ - &(png_ptr->row_info), /* row_info: */ - /* png_uint_32 width; width of row */ - /* png_uint_32 rowbytes; number of bytes in row */ - /* png_byte color_type; color type of pixels */ - /* png_byte bit_depth; bit depth of samples */ - /* png_byte channels; number of channels (1-4) */ - /* png_byte pixel_depth; bits per pixel (depth*channels) */ - png_ptr->row_buf + 1); /* start of pixel data for row */ -#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) - if(png_ptr->user_transform_depth) - png_ptr->row_info.bit_depth = png_ptr->user_transform_depth; - if(png_ptr->user_transform_channels) - png_ptr->row_info.channels = png_ptr->user_transform_channels; -#endif - png_ptr->row_info.pixel_depth = (png_byte)(png_ptr->row_info.bit_depth * - png_ptr->row_info.channels); - png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth, - png_ptr->row_info.width); - } -#endif - -} - #if defined(PNG_READ_PACK_SUPPORTED) /* Unpack pixels of 1, 2, or 4 bits per pixel into 1 byte per pixel, * without changing the actual values. Thus, if you had a row with @@ -6232,7 +1969,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row, #endif row_info->color_type == PNG_COLOR_TYPE_GRAY) { - if(row_info->bit_depth == 8) + if (row_info->bit_depth == 8) { /* This changes the data from G to GX */ if (flags & PNG_FLAG_FILLER_AFTER) @@ -6264,7 +2001,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row, row_info->rowbytes = row_width * 2; } } - else if(row_info->bit_depth == 16) + else if (row_info->bit_depth == 16) { /* This changes the data from GG to GGXX */ if (flags & PNG_FLAG_FILLER_AFTER) @@ -6304,7 +2041,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row, } /* COLOR_TYPE == GRAY */ else if (row_info->color_type == PNG_COLOR_TYPE_RGB) { - if(row_info->bit_depth == 8) + if (row_info->bit_depth == 8) { /* This changes the data from RGB to RGBX */ if (flags & PNG_FLAG_FILLER_AFTER) @@ -6340,7 +2077,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row, row_info->rowbytes = row_width * 4; } } - else if(row_info->bit_depth == 16) + else if (row_info->bit_depth == 16) { /* This changes the data from RRGGBB to RRGGBBXX */ if (flags & PNG_FLAG_FILLER_AFTER) @@ -6467,7 +2204,7 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row) row_info->color_type |= PNG_COLOR_MASK_COLOR; row_info->pixel_depth = (png_byte)(row_info->channels * row_info->bit_depth); - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width); + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width); } } #endif @@ -6475,8 +2212,10 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row) #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) /* reduce RGB files to grayscale, with or without alpha * using the equation given in Poynton's ColorFAQ at - * - * Copyright (c) 1998-01-04 Charles Poynton poynton at inforamp.net + * (THIS LINK IS DEAD June 2008) + * New link: + * + * Charles Poynton poynton at poynton.com * * Y = 0.212671 * R + 0.715160 * G + 0.072169 * B * @@ -6527,14 +2266,14 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row) png_byte red = png_ptr->gamma_to_1[*(sp++)]; png_byte green = png_ptr->gamma_to_1[*(sp++)]; png_byte blue = png_ptr->gamma_to_1[*(sp++)]; - if(red != green || red != blue) + if (red != green || red != blue) { rgb_error |= 1; *(dp++) = png_ptr->gamma_from_1[ - (rc*red+gc*green+bc*blue)>>15]; + (rc*red + gc*green + bc*blue)>>15]; } else - *(dp++) = *(sp-1); + *(dp++) = *(sp - 1); } } else @@ -6547,13 +2286,13 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row) png_byte red = *(sp++); png_byte green = *(sp++); png_byte blue = *(sp++); - if(red != green || red != blue) + if (red != green || red != blue) { rgb_error |= 1; - *(dp++) = (png_byte)((rc*red+gc*green+bc*blue)>>15); + *(dp++) = (png_byte)((rc*red + gc*green + bc*blue)>>15); } else - *(dp++) = *(sp-1); + *(dp++) = *(sp - 1); } } } @@ -6574,7 +2313,7 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row) green = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; blue = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; - if(red == green && red == blue) + if (red == green && red == blue) w = red; else { @@ -6608,7 +2347,7 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row) green = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; blue = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; - if(red != green || red != blue) + if (red != green || red != blue) rgb_error |= 1; gray16 = (png_uint_16)((rc*red + gc*green + bc*blue)>>15); *(dp++) = (png_byte)((gray16>>8) & 0xff); @@ -6631,7 +2370,7 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row) png_byte red = png_ptr->gamma_to_1[*(sp++)]; png_byte green = png_ptr->gamma_to_1[*(sp++)]; png_byte blue = png_ptr->gamma_to_1[*(sp++)]; - if(red != green || red != blue) + if (red != green || red != blue) rgb_error |= 1; *(dp++) = png_ptr->gamma_from_1 [(rc*red + gc*green + bc*blue)>>15]; @@ -6648,7 +2387,7 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row) png_byte red = *(sp++); png_byte green = *(sp++); png_byte blue = *(sp++); - if(red != green || red != blue) + if (red != green || red != blue) rgb_error |= 1; *(dp++) = (png_byte)((rc*red + gc*green + bc*blue)>>15); *(dp++) = *(sp++); /* alpha */ @@ -6671,7 +2410,7 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row) green = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; blue = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; - if(red == green && red == blue) + if (red == green && red == blue) w = red; else { @@ -6705,7 +2444,7 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row) red = (png_uint_16)((*(sp)<<8) | *(sp+1)); sp+=2; green = (png_uint_16)((*(sp)<<8) | *(sp+1)); sp+=2; blue = (png_uint_16)((*(sp)<<8) | *(sp+1)); sp+=2; - if(red != green || red != blue) + if (red != green || red != blue) rgb_error |= 1; gray16 = (png_uint_16)((rc*red + gc*green + bc*blue)>>15); *(dp++) = (png_byte)((gray16>>8) & 0xff); @@ -6720,7 +2459,7 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row) row_info->color_type &= ~PNG_COLOR_MASK_COLOR; row_info->pixel_depth = (png_byte)(row_info->channels * row_info->bit_depth); - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width); + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width); } return rgb_error; } @@ -7638,7 +3377,7 @@ png_do_background(png_row_infop row_info, png_bytep row, row_info->channels--; row_info->pixel_depth = (png_byte)(row_info->channels * row_info->bit_depth); - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width); + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width); } } } @@ -8000,7 +3739,7 @@ png_do_expand(png_row_infop row_info, png_bytep row, { case 1: { - gray = (png_uint_16)(gray*0xff); + gray = (png_uint_16)((gray&0x01)*0xff); sp = row + (png_size_t)((row_width - 1) >> 3); dp = row + (png_size_t)row_width - 1; shift = 7 - (int)((row_width + 7) & 0x07); @@ -8024,7 +3763,7 @@ png_do_expand(png_row_infop row_info, png_bytep row, } case 2: { - gray = (png_uint_16)(gray*0x55); + gray = (png_uint_16)((gray&0x03)*0x55); sp = row + (png_size_t)((row_width - 1) >> 2); dp = row + (png_size_t)row_width - 1; shift = (int)((3 - ((row_width + 3) & 0x03)) << 1); @@ -8047,7 +3786,7 @@ png_do_expand(png_row_infop row_info, png_bytep row, } case 4: { - gray = (png_uint_16)(gray*0x11); + gray = (png_uint_16)((gray&0x0f)*0x11); sp = row + (png_size_t)((row_width - 1) >> 1); dp = row + (png_size_t)row_width - 1; shift = (int)((1 - ((row_width + 1) & 0x01)) << 2); @@ -8077,6 +3816,7 @@ png_do_expand(png_row_infop row_info, png_bytep row, { if (row_info->bit_depth == 8) { + gray = gray & 0xff; sp = row + (png_size_t)row_width - 1; dp = row + (png_size_t)(row_width << 1) - 1; for (i = 0; i < row_width; i++) @@ -8090,12 +3830,13 @@ png_do_expand(png_row_infop row_info, png_bytep row, } else if (row_info->bit_depth == 16) { + png_byte gray_high = (gray >> 8) & 0xff; + png_byte gray_low = gray & 0xff; sp = row + row_info->rowbytes - 1; dp = row + (row_info->rowbytes << 1) - 1; for (i = 0; i < row_width; i++) { - if (((png_uint_16)*(sp) | - ((png_uint_16)*(sp - 1) << 8)) == gray) + if (*(sp - 1) == gray_high && *(sp) == gray_low) { *dp-- = 0; *dp-- = 0; @@ -8120,13 +3861,14 @@ png_do_expand(png_row_infop row_info, png_bytep row, { if (row_info->bit_depth == 8) { + png_byte red = trans_value->red & 0xff; + png_byte green = trans_value->green & 0xff; + png_byte blue = trans_value->blue & 0xff; sp = row + (png_size_t)row_info->rowbytes - 1; dp = row + (png_size_t)(row_width << 2) - 1; for (i = 0; i < row_width; i++) { - if (*(sp - 2) == trans_value->red && - *(sp - 1) == trans_value->green && - *(sp - 0) == trans_value->blue) + if (*(sp - 2) == red && *(sp - 1) == green && *(sp) == blue) *dp-- = 0; else *dp-- = 0xff; @@ -8137,16 +3879,22 @@ png_do_expand(png_row_infop row_info, png_bytep row, } else if (row_info->bit_depth == 16) { + png_byte red_high = (trans_value->red >> 8) & 0xff; + png_byte green_high = (trans_value->green >> 8) & 0xff; + png_byte blue_high = (trans_value->blue >> 8) & 0xff; + png_byte red_low = trans_value->red & 0xff; + png_byte green_low = trans_value->green & 0xff; + png_byte blue_low = trans_value->blue & 0xff; sp = row + row_info->rowbytes - 1; dp = row + (png_size_t)(row_width << 3) - 1; for (i = 0; i < row_width; i++) { - if ((((png_uint_16)*(sp - 4) | - ((png_uint_16)*(sp - 5) << 8)) == trans_value->red) && - (((png_uint_16)*(sp - 2) | - ((png_uint_16)*(sp - 3) << 8)) == trans_value->green) && - (((png_uint_16)*(sp - 0) | - ((png_uint_16)*(sp - 1) << 8)) == trans_value->blue)) + if (*(sp - 5) == red_high && + *(sp - 4) == red_low && + *(sp - 3) == green_high && + *(sp - 2) == green_low && + *(sp - 1) == blue_high && + *(sp ) == blue_low) { *dp-- = 0; *dp-- = 0; @@ -8167,7 +3915,7 @@ png_do_expand(png_row_infop row_info, png_bytep row, row_info->color_type = PNG_COLOR_TYPE_RGB_ALPHA; row_info->channels = 4; row_info->pixel_depth = (png_byte)(row_info->bit_depth << 2); - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width); + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width); } } } @@ -8220,7 +3968,7 @@ png_do_dither(png_row_infop row_info, png_bytep row, row_info->color_type = PNG_COLOR_TYPE_PALETTE; row_info->channels = 1; row_info->pixel_depth = row_info->bit_depth; - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width); + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width); } else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA && palette_lookup != NULL && row_info->bit_depth == 8) @@ -8249,7 +3997,7 @@ png_do_dither(png_row_infop row_info, png_bytep row, row_info->color_type = PNG_COLOR_TYPE_PALETTE; row_info->channels = 1; row_info->pixel_depth = row_info->bit_depth; - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,row_width); + row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width); } else if (row_info->color_type == PNG_COLOR_TYPE_PALETTE && dither_lookup && row_info->bit_depth == 8) @@ -8266,7 +4014,7 @@ png_do_dither(png_row_infop row_info, png_bytep row, #ifdef PNG_FLOATING_POINT_SUPPORTED #if defined(PNG_READ_GAMMA_SUPPORTED) -const static int png_gamma_shift[] = +static PNG_CONST int png_gamma_shift[] = {0x10, 0x21, 0x42, 0x84, 0x110, 0x248, 0x550, 0xff0, 0x00}; /* We build the 8- or 16-bit gamma tables here. Note that for 16-bit @@ -8318,7 +4066,7 @@ png_build_gamma_table(png_structp png_ptr) png_ptr->gamma_from_1 = (png_bytep)png_malloc(png_ptr, (png_uint_32)256); - if(png_ptr->screen_gamma > 0.000001) + if (png_ptr->screen_gamma > 0.000001) g = 1.0 / png_ptr->screen_gamma; else g = png_ptr->gamma; /* probably doing rgb_to_gray */ @@ -8378,7 +4126,7 @@ png_build_gamma_table(png_structp png_ptr) g = 1.0; png_ptr->gamma_16_table = (png_uint_16pp)png_malloc(png_ptr, - (png_uint_32)(num * png_sizeof (png_uint_16p))); + (png_uint_32)(num * png_sizeof(png_uint_16p))); if (png_ptr->transformations & (PNG_16_TO_8 | PNG_BACKGROUND)) { @@ -8388,7 +4136,7 @@ png_build_gamma_table(png_structp png_ptr) for (i = 0; i < num; i++) { png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr, - (png_uint_32)(256 * png_sizeof (png_uint_16))); + (png_uint_32)(256 * png_sizeof(png_uint_16))); } g = 1.0 / g; @@ -8418,7 +4166,7 @@ png_build_gamma_table(png_structp png_ptr) for (i = 0; i < num; i++) { png_ptr->gamma_16_table[i] = (png_uint_16p)png_malloc(png_ptr, - (png_uint_32)(256 * png_sizeof (png_uint_16))); + (png_uint_32)(256 * png_sizeof(png_uint_16))); ig = (((png_uint_32)i * (png_uint_32)png_gamma_shift[shift]) >> 4); for (j = 0; j < 256; j++) @@ -8438,12 +4186,12 @@ png_build_gamma_table(png_structp png_ptr) g = 1.0 / (png_ptr->gamma); png_ptr->gamma_16_to_1 = (png_uint_16pp)png_malloc(png_ptr, - (png_uint_32)(num * png_sizeof (png_uint_16p ))); + (png_uint_32)(num * png_sizeof(png_uint_16p ))); for (i = 0; i < num; i++) { png_ptr->gamma_16_to_1[i] = (png_uint_16p)png_malloc(png_ptr, - (png_uint_32)(256 * png_sizeof (png_uint_16))); + (png_uint_32)(256 * png_sizeof(png_uint_16))); ig = (((png_uint_32)i * (png_uint_32)png_gamma_shift[shift]) >> 4); @@ -8455,18 +4203,18 @@ png_build_gamma_table(png_structp png_ptr) } } - if(png_ptr->screen_gamma > 0.000001) + if (png_ptr->screen_gamma > 0.000001) g = 1.0 / png_ptr->screen_gamma; else g = png_ptr->gamma; /* probably doing rgb_to_gray */ png_ptr->gamma_16_from_1 = (png_uint_16pp)png_malloc(png_ptr, - (png_uint_32)(num * png_sizeof (png_uint_16p))); + (png_uint_32)(num * png_sizeof(png_uint_16p))); for (i = 0; i < num; i++) { png_ptr->gamma_16_from_1[i] = (png_uint_16p)png_malloc(png_ptr, - (png_uint_32)(256 * png_sizeof (png_uint_16))); + (png_uint_32)(256 * png_sizeof(png_uint_16))); ig = (((png_uint_32)i * (png_uint_32)png_gamma_shift[shift]) >> 4); @@ -8531,11 +4279,11 @@ png_do_read_intrapixel(png_row_infop row_info, png_bytep row) for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel) { - png_uint_32 s0 = (*(rp ) << 8) | *(rp+1); - png_uint_32 s1 = (*(rp+2) << 8) | *(rp+3); - png_uint_32 s2 = (*(rp+4) << 8) | *(rp+5); - png_uint_32 red = (png_uint_32)((s0+s1+65536L) & 0xffffL); - png_uint_32 blue = (png_uint_32)((s2+s1+65536L) & 0xffffL); + png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1); + png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3); + png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5); + png_uint_32 red = (png_uint_32)((s0 + s1 + 65536L) & 0xffffL); + png_uint_32 blue = (png_uint_32)((s2 + s1 + 65536L) & 0xffffL); *(rp ) = (png_byte)((red >> 8) & 0xff); *(rp+1) = (png_byte)(red & 0xff); *(rp+4) = (png_byte)((blue >> 8) & 0xff); diff --git a/src/dep/src/irrlicht/libpng/pngrutil.c b/src/dep/src/irrlicht/libpng/pngrutil.c index 32275bd..f1783a8 100644 --- a/src/dep/src/irrlicht/libpng/pngrutil.c +++ b/src/dep/src/irrlicht/libpng/pngrutil.c @@ -1,7 +1,7 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.2.34 [December 18, 2008] + * Last changed in libpng 1.2.31 [August 19, 2008] * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -115,7 +115,7 @@ png_read_chunk_header(png_structp png_ptr) /* put the chunk name into png_ptr->chunk_name */ png_memcpy(png_ptr->chunk_name, buf + 4, 4); - png_debug2(0, "Reading %s chunk, length = %lu", + png_debug2(0, "Reading %s chunk, length = %lu\n", png_ptr->chunk_name, length); /* reset the crc and run it over the chunk name */ @@ -392,7 +392,7 @@ png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) int bit_depth, color_type, compression_type, filter_type; int interlace_type; - png_debug(1, "in png_handle_IHDR"); + png_debug(1, "in png_handle_IHDR\n"); if (png_ptr->mode & PNG_HAVE_IHDR) png_error(png_ptr, "Out of place IHDR"); @@ -447,9 +447,9 @@ png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_ptr->pixel_depth = (png_byte)(png_ptr->bit_depth * png_ptr->channels); png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->width); - png_debug1(3, "bit_depth = %d", png_ptr->bit_depth); - png_debug1(3, "channels = %d", png_ptr->channels); - png_debug1(3, "rowbytes = %lu", png_ptr->rowbytes); + png_debug1(3, "bit_depth = %d\n", png_ptr->bit_depth); + png_debug1(3, "channels = %d\n", png_ptr->channels); + png_debug1(3, "rowbytes = %lu\n", png_ptr->rowbytes); png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, color_type, interlace_type, compression_type, filter_type); } @@ -464,7 +464,7 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_colorp pal_ptr; #endif - png_debug(1, "in png_handle_PLTE"); + png_debug(1, "in png_handle_PLTE\n"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, "Missing IHDR before PLTE"); @@ -596,7 +596,7 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) void /* PRIVATE */ png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) { - png_debug(1, "in png_handle_IEND"); + png_debug(1, "in png_handle_IEND\n"); if (!(png_ptr->mode & PNG_HAVE_IHDR) || !(png_ptr->mode & PNG_HAVE_IDAT)) { @@ -624,7 +624,7 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) #endif png_byte buf[4]; - png_debug(1, "in png_handle_gAMA"); + png_debug(1, "in png_handle_gAMA\n"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, "Missing IHDR before gAMA"); @@ -676,7 +676,7 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_warning(png_ptr, "Ignoring incorrect gAMA value when sRGB is also present"); #ifndef PNG_NO_CONSOLE_IO - fprintf(stderr, "gamma = (%d/100000)", (int)igamma); + fprintf(stderr, "gamma = (%d/100000)\n", (int)igamma); #endif return; } @@ -702,7 +702,7 @@ png_handle_sBIT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_size_t truelen; png_byte buf[4]; - png_debug(1, "in png_handle_sBIT"); + png_debug(1, "in png_handle_sBIT\n"); buf[0] = buf[1] = buf[2] = buf[3] = 0; @@ -774,7 +774,7 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_uint_32 uint_x, uint_y; - png_debug(1, "in png_handle_cHRM"); + png_debug(1, "in png_handle_cHRM\n"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, "Missing IHDR before cHRM"); @@ -812,21 +812,42 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) uint_x = png_get_uint_32(buf); uint_y = png_get_uint_32(buf + 4); + if (uint_x > 80000L || uint_y > 80000L || + uint_x + uint_y > 100000L) + { + png_warning(png_ptr, "Invalid cHRM white point"); + return; + } int_x_white = (png_fixed_point)uint_x; int_y_white = (png_fixed_point)uint_y; uint_x = png_get_uint_32(buf + 8); uint_y = png_get_uint_32(buf + 12); + if (uint_x + uint_y > 100000L) + { + png_warning(png_ptr, "Invalid cHRM red point"); + return; + } int_x_red = (png_fixed_point)uint_x; int_y_red = (png_fixed_point)uint_y; uint_x = png_get_uint_32(buf + 16); uint_y = png_get_uint_32(buf + 20); + if (uint_x + uint_y > 100000L) + { + png_warning(png_ptr, "Invalid cHRM green point"); + return; + } int_x_green = (png_fixed_point)uint_x; int_y_green = (png_fixed_point)uint_y; uint_x = png_get_uint_32(buf + 24); uint_y = png_get_uint_32(buf + 28); + if (uint_x + uint_y > 100000L) + { + png_warning(png_ptr, "Invalid cHRM blue point"); + return; + } int_x_blue = (png_fixed_point)uint_x; int_y_blue = (png_fixed_point)uint_y; @@ -892,7 +913,7 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) int intent; png_byte buf[1]; - png_debug(1, "in png_handle_sRGB"); + png_debug(1, "in png_handle_sRGB\n"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, "Missing IHDR before sRGB"); @@ -995,7 +1016,7 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_uint_32 profile_size, profile_length; png_size_t slength, prefix_length, data_length; - png_debug(1, "in png_handle_iCCP"); + png_debug(1, "in png_handle_iCCP\n"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, "Missing IHDR before iCCP"); @@ -1116,8 +1137,7 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_uint_32 skip = 0; png_size_t slength; - png_debug(1, "in png_handle_sPLT"); - + png_debug(1, "in png_handle_sPLT\n"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, "Missing IHDR before sPLT"); @@ -1253,7 +1273,7 @@ png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) { png_byte readbuf[PNG_MAX_PALETTE_LENGTH]; - png_debug(1, "in png_handle_tRNS"); + png_debug(1, "in png_handle_tRNS\n"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, "Missing IHDR before tRNS"); @@ -1349,7 +1369,7 @@ png_handle_bKGD(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_size_t truelen; png_byte buf[6]; - png_debug(1, "in png_handle_bKGD"); + png_debug(1, "in png_handle_bKGD\n"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, "Missing IHDR before bKGD"); @@ -1400,7 +1420,7 @@ png_handle_bKGD(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_ptr->background.index = buf[0]; if (info_ptr && info_ptr->num_palette) { - if (buf[0] >= info_ptr->num_palette) + if (buf[0] > info_ptr->num_palette) { png_warning(png_ptr, "Incorrect bKGD chunk index value"); return; @@ -1438,7 +1458,7 @@ png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) unsigned int num, i; png_uint_16 readbuf[PNG_MAX_PALETTE_LENGTH]; - png_debug(1, "in png_handle_hIST"); + png_debug(1, "in png_handle_hIST\n"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, "Missing IHDR before hIST"); @@ -1493,7 +1513,7 @@ png_handle_pHYs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_uint_32 res_x, res_y; int unit_type; - png_debug(1, "in png_handle_pHYs"); + png_debug(1, "in png_handle_pHYs\n"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, "Missing IHDR before pHYs"); @@ -1536,7 +1556,7 @@ png_handle_oFFs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_int_32 offset_x, offset_y; int unit_type; - png_debug(1, "in png_handle_oFFs"); + png_debug(1, "in png_handle_oFFs\n"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, "Missing IHDR before oFFs"); @@ -1583,7 +1603,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_size_t slength; int i; - png_debug(1, "in png_handle_pCAL"); + png_debug(1, "in png_handle_pCAL\n"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, "Missing IHDR before pCAL"); @@ -1600,7 +1620,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) return; } - png_debug1(2, "Allocating and reading pCAL chunk data (%lu bytes)", + png_debug1(2, "Allocating and reading pCAL chunk data (%lu bytes)\n", length + 1); png_free(png_ptr, png_ptr->chunkdata); png_ptr->chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1); @@ -1621,7 +1641,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_ptr->chunkdata[slength] = 0x00; /* null terminate the last string */ - png_debug(3, "Finding end of pCAL purpose string"); + png_debug(3, "Finding end of pCAL purpose string\n"); for (buf = png_ptr->chunkdata; *buf; buf++) /* empty loop */ ; @@ -1637,14 +1657,14 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) return; } - png_debug(3, "Reading pCAL X0, X1, type, nparams, and units"); + png_debug(3, "Reading pCAL X0, X1, type, nparams, and units\n"); X0 = png_get_int_32((png_bytep)buf+1); X1 = png_get_int_32((png_bytep)buf+5); type = buf[9]; nparams = buf[10]; units = buf + 11; - png_debug(3, "Checking pCAL equation type and number of parameters"); + png_debug(3, "Checking pCAL equation type and number of parameters\n"); /* Check that we have the right number of parameters for known equation types. */ if ((type == PNG_EQUATION_LINEAR && nparams != 2) || @@ -1665,7 +1685,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) for (buf = units; *buf; buf++) /* Empty loop to move past the units string. */ ; - png_debug(3, "Allocating pCAL parameters array"); + png_debug(3, "Allocating pCAL parameters array\n"); params = (png_charpp)png_malloc_warn(png_ptr, (png_uint_32)(nparams * png_sizeof(png_charp))) ; if (params == NULL) @@ -1681,7 +1701,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) { buf++; /* Skip the null string terminator from previous parameter. */ - png_debug1(3, "Reading pCAL parameter %d", i); + png_debug1(3, "Reading pCAL parameter %d\n", i); for (params[i] = buf; buf <= endptr && *buf != 0x00; buf++) /* Empty loop to move past each parameter string */ ; @@ -1721,7 +1741,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) #endif png_size_t slength; - png_debug(1, "in png_handle_sCAL"); + png_debug(1, "in png_handle_sCAL\n"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, "Missing IHDR before sCAL"); @@ -1738,7 +1758,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) return; } - png_debug1(2, "Allocating and reading sCAL chunk data (%lu bytes)", + png_debug1(2, "Allocating and reading sCAL chunk data (%lu bytes)\n", length + 1); png_ptr->chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1); if (png_ptr->chunkdata == NULL) @@ -1855,7 +1875,7 @@ png_handle_tIME(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_byte buf[7]; png_time mod_time; - png_debug(1, "in png_handle_tIME"); + png_debug(1, "in png_handle_tIME\n"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, "Out of place tIME chunk"); @@ -1903,8 +1923,7 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_size_t slength; int ret; - png_debug(1, "in png_handle_tEXt"); - + png_debug(1, "in png_handle_tEXt\n"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, "Missing IHDR before tEXt"); @@ -1921,26 +1940,21 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) } #endif - png_free(png_ptr, png_ptr->chunkdata); - - png_ptr->chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1); - if (png_ptr->chunkdata == NULL) + key = (png_charp)png_malloc_warn(png_ptr, length + 1); + if (key == NULL) { png_warning(png_ptr, "No memory to process text chunk."); return; } slength = (png_size_t)length; - png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength); + png_crc_read(png_ptr, (png_bytep)key, slength); if (png_crc_finish(png_ptr, skip)) { - png_free(png_ptr, png_ptr->chunkdata); - png_ptr->chunkdata = NULL; + png_free(png_ptr, key); return; } - key = png_ptr->chunkdata; - key[slength] = 0x00; for (text = key; *text; text++) @@ -1954,8 +1968,7 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) if (text_ptr == NULL) { png_warning(png_ptr, "Not enough memory to process text chunk."); - png_free(png_ptr, png_ptr->chunkdata); - png_ptr->chunkdata = NULL; + png_free(png_ptr, key); return; } text_ptr->compression = PNG_TEXT_COMPRESSION_NONE; @@ -1970,8 +1983,7 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1); - png_free(png_ptr, png_ptr->chunkdata); - png_ptr->chunkdata = NULL; + png_free(png_ptr, key); png_free(png_ptr, text_ptr); if (ret) png_warning(png_ptr, "Insufficient memory to process text chunk."); @@ -1989,9 +2001,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) int ret; png_size_t slength, prefix_len, data_len; - png_debug(1, "in png_handle_zTXt"); - - + png_debug(1, "in png_handle_zTXt\n"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, "Missing IHDR before zTXt"); @@ -2009,7 +2019,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) } #endif - png_free(png_ptr, png_ptr->chunkdata); + png_free(png_ptr,png_ptr->chunkdata); png_ptr->chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1); if (png_ptr->chunkdata == NULL) { @@ -2094,8 +2104,7 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) int ret; png_size_t slength, prefix_len, data_len; - png_debug(1, "in png_handle_iTXt"); - + png_debug(1, "in png_handle_iTXt\n"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, "Missing IHDR before iTXt"); @@ -2221,8 +2230,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) { png_uint_32 skip = 0; - png_debug(1, "in png_handle_unknown"); - + png_debug(1, "in png_handle_unknown\n"); if (png_ptr->mode & PNG_HAVE_IDAT) { @@ -2317,7 +2325,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) void /* PRIVATE */ png_check_chunk_name(png_structp png_ptr, png_bytep chunk_name) { - png_debug(1, "in png_check_chunk_name"); + png_debug(1, "in png_check_chunk_name\n"); if (isnonalpha(chunk_name[0]) || isnonalpha(chunk_name[1]) || isnonalpha(chunk_name[2]) || isnonalpha(chunk_name[3])) { @@ -2339,7 +2347,7 @@ png_check_chunk_name(png_structp png_ptr, png_bytep chunk_name) void /* PRIVATE */ png_combine_row(png_structp png_ptr, png_bytep row, int mask) { - png_debug(1, "in png_combine_row"); + png_debug(1, "in png_combine_row\n"); if (mask == 0xff) { png_memcpy(row, png_ptr->row_buf + 1, @@ -2555,7 +2563,7 @@ png_do_read_interlace(png_structp png_ptr) PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; #endif - png_debug(1, "in png_do_read_interlace"); + png_debug(1, "in png_do_read_interlace\n"); if (row != NULL && row_info != NULL) { png_uint_32 final_width; @@ -2768,8 +2776,8 @@ void /* PRIVATE */ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter) { - png_debug(1, "in png_read_filter_row"); - png_debug2(2, "row = %lu, filter = %d", png_ptr->row_number, filter); + png_debug(1, "in png_read_filter_row\n"); + png_debug2(2, "row = %lu, filter = %d\n", png_ptr->row_number, filter); switch (filter) { case PNG_FILTER_VALUE_NONE: @@ -2908,7 +2916,7 @@ png_read_finish_row(png_structp png_ptr) #endif /* PNG_READ_INTERLACING_SUPPORTED */ #endif - png_debug(1, "in png_read_finish_row"); + png_debug(1, "in png_read_finish_row\n"); png_ptr->row_number++; if (png_ptr->row_number < png_ptr->num_rows) return; @@ -3043,7 +3051,7 @@ png_read_start_row(png_structp png_ptr) int max_pixel_depth; png_size_t row_bytes; - png_debug(1, "in png_read_start_row"); + png_debug(1, "in png_read_start_row\n"); png_ptr->zstream.avail_in = 0; png_init_read_transformations(png_ptr); #ifdef PNG_READ_INTERLACING_SUPPORTED @@ -3209,3138 +3217,6 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) png_memset_check(png_ptr, png_ptr->prev_row, 0, png_ptr->rowbytes + 1); - png_debug1(3, "width = %lu,", png_ptr->width); - png_debug1(3, "height = %lu,", png_ptr->height); - png_debug1(3, "iwidth = %lu,", png_ptr->iwidth); - png_debug1(3, "num_rows = %lu,", png_ptr->num_rows); - png_debug1(3, "rowbytes = %lu,", png_ptr->rowbytes); - png_debug1(3, "irowbytes = %lu", png_ptr->irowbytes); - - png_ptr->flags |= PNG_FLAG_ROW_INIT; -} -#endif /* PNG_READ_SUPPORTED */ - -/* pngrutil.c - utilities to read a PNG file - * - * Last changed in libpng 1.2.17 May 15, 2007 - * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - * - * This file contains routines that are only called from within - * libpng itself during the course of reading an image. - */ - -#define PNG_INTERNAL -#include "png.h" - -#if defined(PNG_READ_SUPPORTED) - -#ifdef PNG_FLOATING_POINT_SUPPORTED -# if defined(_WIN32_WCE) -/* strtod() function is not supported on WindowsCE */ -__inline double png_strtod(png_structp png_ptr, const char *nptr, char **endptr) -{ - double result = 0; - int len; - wchar_t *str, *end; - - len = MultiByteToWideChar(CP_ACP, 0, nptr, -1, NULL, 0); - str = (wchar_t *)png_malloc(png_ptr, len * sizeof(wchar_t)); - if ( NULL != str ) - { - MultiByteToWideChar(CP_ACP, 0, nptr, -1, str, len); - result = wcstod(str, &end); - len = WideCharToMultiByte(CP_ACP, 0, end, -1, NULL, 0, NULL, NULL); - *endptr = (char *)nptr + (png_strlen(nptr) - len + 1); - png_free(str); - } - return result; -} -# else -# define png_strtod(p,a,b) strtod(a,b) -# endif -#endif - -png_uint_32 PNGAPI -png_get_uint_31(png_structp png_ptr, png_bytep buf) -{ - png_uint_32 i = png_get_uint_32(buf); - if (i > PNG_UINT_31_MAX) - png_error(png_ptr, "PNG unsigned integer out of range."); - return (i); -} -#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED -/* Grab an unsigned 32-bit integer from a buffer in big-endian format. */ -png_uint_32 PNGAPI -png_get_uint_32(png_bytep buf) -{ - png_uint_32 i = ((png_uint_32)(*buf) << 24) + - ((png_uint_32)(*(buf + 1)) << 16) + - ((png_uint_32)(*(buf + 2)) << 8) + - (png_uint_32)(*(buf + 3)); - - return (i); -} - -/* Grab a signed 32-bit integer from a buffer in big-endian format. The - * data is stored in the PNG file in two's complement format, and it is - * assumed that the machine format for signed integers is the same. */ -png_int_32 PNGAPI -png_get_int_32(png_bytep buf) -{ - png_int_32 i = ((png_int_32)(*buf) << 24) + - ((png_int_32)(*(buf + 1)) << 16) + - ((png_int_32)(*(buf + 2)) << 8) + - (png_int_32)(*(buf + 3)); - - return (i); -} - -/* Grab an unsigned 16-bit integer from a buffer in big-endian format. */ -png_uint_16 PNGAPI -png_get_uint_16(png_bytep buf) -{ - png_uint_16 i = (png_uint_16)(((png_uint_16)(*buf) << 8) + - (png_uint_16)(*(buf + 1))); - - return (i); -} -#endif /* PNG_READ_BIG_ENDIAN_SUPPORTED */ - -/* Read data, and (optionally) run it through the CRC. */ -void /* PRIVATE */ -png_crc_read(png_structp png_ptr, png_bytep buf, png_size_t length) -{ - if(png_ptr == NULL) return; - png_read_data(png_ptr, buf, length); - png_calculate_crc(png_ptr, buf, length); -} - -/* Optionally skip data and then check the CRC. Depending on whether we - are reading a ancillary or critical chunk, and how the program has set - things up, we may calculate the CRC on the data and print a message. - Returns '1' if there was a CRC error, '0' otherwise. */ -int /* PRIVATE */ -png_crc_finish(png_structp png_ptr, png_uint_32 skip) -{ - png_size_t i; - png_size_t istop = png_ptr->zbuf_size; - - for (i = (png_size_t)skip; i > istop; i -= istop) - { - png_crc_read(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size); - } - if (i) - { - png_crc_read(png_ptr, png_ptr->zbuf, i); - } - - if (png_crc_error(png_ptr)) - { - if (((png_ptr->chunk_name[0] & 0x20) && /* Ancillary */ - !(png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN)) || - (!(png_ptr->chunk_name[0] & 0x20) && /* Critical */ - (png_ptr->flags & PNG_FLAG_CRC_CRITICAL_USE))) - { - png_chunk_warning(png_ptr, "CRC error"); - } - else - { - png_chunk_error(png_ptr, "CRC error"); - } - return (1); - } - - return (0); -} - -/* Compare the CRC stored in the PNG file with that calculated by libpng from - the data it has read thus far. */ -int /* PRIVATE */ -png_crc_error(png_structp png_ptr) -{ - png_byte crc_bytes[4]; - png_uint_32 crc; - int need_crc = 1; - - if (png_ptr->chunk_name[0] & 0x20) /* ancillary */ - { - if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_MASK) == - (PNG_FLAG_CRC_ANCILLARY_USE | PNG_FLAG_CRC_ANCILLARY_NOWARN)) - need_crc = 0; - } - else /* critical */ - { - if (png_ptr->flags & PNG_FLAG_CRC_CRITICAL_IGNORE) - need_crc = 0; - } - - png_read_data(png_ptr, crc_bytes, 4); - - if (need_crc) - { - crc = png_get_uint_32(crc_bytes); - return ((int)(crc != png_ptr->crc)); - } - else - return (0); -} - -#if defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) || \ - defined(PNG_READ_iCCP_SUPPORTED) -/* - * Decompress trailing data in a chunk. The assumption is that chunkdata - * points at an allocated area holding the contents of a chunk with a - * trailing compressed part. What we get back is an allocated area - * holding the original prefix part and an uncompressed version of the - * trailing part (the malloc area passed in is freed). - */ -png_charp /* PRIVATE */ -png_decompress_chunk(png_structp png_ptr, int comp_type, - png_charp chunkdata, png_size_t chunklength, - png_size_t prefix_size, png_size_t *newlength) -{ - const static char msg[] = "Error decoding compressed text"; - png_charp text; - png_size_t text_size; - - if (comp_type == PNG_COMPRESSION_TYPE_BASE) - { - int ret = Z_OK; - png_ptr->zstream.next_in = (png_bytep)(chunkdata + prefix_size); - png_ptr->zstream.avail_in = (uInt)(chunklength - prefix_size); - png_ptr->zstream.next_out = png_ptr->zbuf; - png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; - - text_size = 0; - text = NULL; - - while (png_ptr->zstream.avail_in) - { - ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH); - if (ret != Z_OK && ret != Z_STREAM_END) - { - if (png_ptr->zstream.msg != NULL) - png_warning(png_ptr, png_ptr->zstream.msg); - else - png_warning(png_ptr, msg); - inflateReset(&png_ptr->zstream); - png_ptr->zstream.avail_in = 0; - - if (text == NULL) - { - text_size = prefix_size + png_sizeof(msg) + 1; - text = (png_charp)png_malloc_warn(png_ptr, text_size); - if (text == NULL) - { - png_free(png_ptr,chunkdata); - png_error(png_ptr,"Not enough memory to decompress chunk"); - } - png_memcpy(text, chunkdata, prefix_size); - } - - text[text_size - 1] = 0x00; - - /* Copy what we can of the error message into the text chunk */ - text_size = (png_size_t)(chunklength - (text - chunkdata) - 1); - text_size = png_sizeof(msg) > text_size ? text_size : - png_sizeof(msg); - png_memcpy(text + prefix_size, msg, text_size + 1); - break; - } - if (!png_ptr->zstream.avail_out || ret == Z_STREAM_END) - { - if (text == NULL) - { - text_size = prefix_size + - png_ptr->zbuf_size - png_ptr->zstream.avail_out; - text = (png_charp)png_malloc_warn(png_ptr, text_size + 1); - if (text == NULL) - { - png_free(png_ptr,chunkdata); - png_error(png_ptr,"Not enough memory to decompress chunk."); - } - png_memcpy(text + prefix_size, png_ptr->zbuf, - text_size - prefix_size); - png_memcpy(text, chunkdata, prefix_size); - *(text + text_size) = 0x00; - } - else - { - png_charp tmp; - - tmp = text; - text = (png_charp)png_malloc_warn(png_ptr, - (png_uint_32)(text_size + - png_ptr->zbuf_size - png_ptr->zstream.avail_out + 1)); - if (text == NULL) - { - png_free(png_ptr, tmp); - png_free(png_ptr, chunkdata); - png_error(png_ptr,"Not enough memory to decompress chunk.."); - } - png_memcpy(text, tmp, text_size); - png_free(png_ptr, tmp); - png_memcpy(text + text_size, png_ptr->zbuf, - (png_ptr->zbuf_size - png_ptr->zstream.avail_out)); - text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out; - *(text + text_size) = 0x00; - } - if (ret == Z_STREAM_END) - break; - else - { - png_ptr->zstream.next_out = png_ptr->zbuf; - png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; - } - } - } - if (ret != Z_STREAM_END) - { -#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) - char umsg[52]; - - if (ret == Z_BUF_ERROR) - sprintf(umsg,"Buffer error in compressed datastream in %s chunk", - png_ptr->chunk_name); - else if (ret == Z_DATA_ERROR) - sprintf(umsg,"Data error in compressed datastream in %s chunk", - png_ptr->chunk_name); - else - sprintf(umsg,"Incomplete compressed datastream in %s chunk", - png_ptr->chunk_name); - png_warning(png_ptr, umsg); -#else - png_warning(png_ptr, - "Incomplete compressed datastream in chunk other than IDAT"); -#endif - text_size=prefix_size; - if (text == NULL) - { - text = (png_charp)png_malloc_warn(png_ptr, text_size+1); - if (text == NULL) - { - png_free(png_ptr, chunkdata); - png_error(png_ptr,"Not enough memory for text."); - } - png_memcpy(text, chunkdata, prefix_size); - } - *(text + text_size) = 0x00; - } - - inflateReset(&png_ptr->zstream); - png_ptr->zstream.avail_in = 0; - - png_free(png_ptr, chunkdata); - chunkdata = text; - *newlength=text_size; - } - else /* if (comp_type != PNG_COMPRESSION_TYPE_BASE) */ - { -#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) - char umsg[50]; - - sprintf(umsg, "Unknown zTXt compression type %d", comp_type); - png_warning(png_ptr, umsg); -#else - png_warning(png_ptr, "Unknown zTXt compression type"); -#endif - - *(chunkdata + prefix_size) = 0x00; - *newlength=prefix_size; - } - - return chunkdata; -} -#endif - -/* read and check the IDHR chunk */ -void /* PRIVATE */ -png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) -{ - png_byte buf[13]; - png_uint_32 width, height; - int bit_depth, color_type, compression_type, filter_type; - int interlace_type; - - png_debug(1, "in png_handle_IHDR\n"); - - if (png_ptr->mode & PNG_HAVE_IHDR) - png_error(png_ptr, "Out of place IHDR"); - - /* check the length */ - if (length != 13) - png_error(png_ptr, "Invalid IHDR chunk"); - - png_ptr->mode |= PNG_HAVE_IHDR; - - png_crc_read(png_ptr, buf, 13); - png_crc_finish(png_ptr, 0); - - width = png_get_uint_31(png_ptr, buf); - height = png_get_uint_31(png_ptr, buf + 4); - bit_depth = buf[8]; - color_type = buf[9]; - compression_type = buf[10]; - filter_type = buf[11]; - interlace_type = buf[12]; - - /* set internal variables */ - png_ptr->width = width; - png_ptr->height = height; - png_ptr->bit_depth = (png_byte)bit_depth; - png_ptr->interlaced = (png_byte)interlace_type; - png_ptr->color_type = (png_byte)color_type; -#if defined(PNG_MNG_FEATURES_SUPPORTED) - png_ptr->filter_type = (png_byte)filter_type; -#endif - png_ptr->compression_type = (png_byte)compression_type; - - /* find number of channels */ - switch (png_ptr->color_type) - { - case PNG_COLOR_TYPE_GRAY: - case PNG_COLOR_TYPE_PALETTE: - png_ptr->channels = 1; - break; - case PNG_COLOR_TYPE_RGB: - png_ptr->channels = 3; - break; - case PNG_COLOR_TYPE_GRAY_ALPHA: - png_ptr->channels = 2; - break; - case PNG_COLOR_TYPE_RGB_ALPHA: - png_ptr->channels = 4; - break; - } - - /* set up other useful info */ - png_ptr->pixel_depth = (png_byte)(png_ptr->bit_depth * - png_ptr->channels); - png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth,png_ptr->width); - png_debug1(3,"bit_depth = %d\n", png_ptr->bit_depth); - png_debug1(3,"channels = %d\n", png_ptr->channels); - png_debug1(3,"rowbytes = %lu\n", png_ptr->rowbytes); - png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, - color_type, interlace_type, compression_type, filter_type); -} - -/* read and check the palette */ -void /* PRIVATE */ -png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) -{ - png_color palette[PNG_MAX_PALETTE_LENGTH]; - int num, i; -#ifndef PNG_NO_POINTER_INDEXING - png_colorp pal_ptr; -#endif - - png_debug(1, "in png_handle_PLTE\n"); - - if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before PLTE"); - else if (png_ptr->mode & PNG_HAVE_IDAT) - { - png_warning(png_ptr, "Invalid PLTE after IDAT"); - png_crc_finish(png_ptr, length); - return; - } - else if (png_ptr->mode & PNG_HAVE_PLTE) - png_error(png_ptr, "Duplicate PLTE chunk"); - - png_ptr->mode |= PNG_HAVE_PLTE; - - if (!(png_ptr->color_type&PNG_COLOR_MASK_COLOR)) - { - png_warning(png_ptr, - "Ignoring PLTE chunk in grayscale PNG"); - png_crc_finish(png_ptr, length); - return; - } -#if !defined(PNG_READ_OPT_PLTE_SUPPORTED) - if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE) - { - png_crc_finish(png_ptr, length); - return; - } -#endif - - if (length > 3*PNG_MAX_PALETTE_LENGTH || length % 3) - { - if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE) - { - png_warning(png_ptr, "Invalid palette chunk"); - png_crc_finish(png_ptr, length); - return; - } - else - { - png_error(png_ptr, "Invalid palette chunk"); - } - } - - num = (int)length / 3; - -#ifndef PNG_NO_POINTER_INDEXING - for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++) - { - png_byte buf[3]; - - png_crc_read(png_ptr, buf, 3); - pal_ptr->red = buf[0]; - pal_ptr->green = buf[1]; - pal_ptr->blue = buf[2]; - } -#else - for (i = 0; i < num; i++) - { - png_byte buf[3]; - - png_crc_read(png_ptr, buf, 3); - /* don't depend upon png_color being any order */ - palette[i].red = buf[0]; - palette[i].green = buf[1]; - palette[i].blue = buf[2]; - } -#endif - - /* If we actually NEED the PLTE chunk (ie for a paletted image), we do - whatever the normal CRC configuration tells us. However, if we - have an RGB image, the PLTE can be considered ancillary, so - we will act as though it is. */ -#if !defined(PNG_READ_OPT_PLTE_SUPPORTED) - if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) -#endif - { - png_crc_finish(png_ptr, 0); - } -#if !defined(PNG_READ_OPT_PLTE_SUPPORTED) - else if (png_crc_error(png_ptr)) /* Only if we have a CRC error */ - { - /* If we don't want to use the data from an ancillary chunk, - we have two options: an error abort, or a warning and we - ignore the data in this chunk (which should be OK, since - it's considered ancillary for a RGB or RGBA image). */ - if (!(png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_USE)) - { - if (png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN) - { - png_chunk_error(png_ptr, "CRC error"); - } - else - { - png_chunk_warning(png_ptr, "CRC error"); - return; - } - } - /* Otherwise, we (optionally) emit a warning and use the chunk. */ - else if (!(png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN)) - { - png_chunk_warning(png_ptr, "CRC error"); - } - } -#endif - - png_set_PLTE(png_ptr, info_ptr, palette, num); - -#if defined(PNG_READ_tRNS_SUPPORTED) - if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) - { - if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS)) - { - if (png_ptr->num_trans > (png_uint_16)num) - { - png_warning(png_ptr, "Truncating incorrect tRNS chunk length"); - png_ptr->num_trans = (png_uint_16)num; - } - if (info_ptr->num_trans > (png_uint_16)num) - { - png_warning(png_ptr, "Truncating incorrect info tRNS chunk length"); - info_ptr->num_trans = (png_uint_16)num; - } - } - } -#endif - -} - -void /* PRIVATE */ -png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) -{ - png_debug(1, "in png_handle_IEND\n"); - - if (!(png_ptr->mode & PNG_HAVE_IHDR) || !(png_ptr->mode & PNG_HAVE_IDAT)) - { - png_error(png_ptr, "No image in file"); - } - - png_ptr->mode |= (PNG_AFTER_IDAT | PNG_HAVE_IEND); - - if (length != 0) - { - png_warning(png_ptr, "Incorrect IEND chunk length"); - } - png_crc_finish(png_ptr, length); - - if (&info_ptr == NULL) /* quiet compiler warnings about unused info_ptr */ - return; -} - -#if defined(PNG_READ_gAMA_SUPPORTED) -void /* PRIVATE */ -png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) -{ - png_fixed_point igamma; -#ifdef PNG_FLOATING_POINT_SUPPORTED - float file_gamma; -#endif - png_byte buf[4]; - - png_debug(1, "in png_handle_gAMA\n"); - - if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before gAMA"); - else if (png_ptr->mode & PNG_HAVE_IDAT) - { - png_warning(png_ptr, "Invalid gAMA after IDAT"); - png_crc_finish(png_ptr, length); - return; - } - else if (png_ptr->mode & PNG_HAVE_PLTE) - /* Should be an error, but we can cope with it */ - png_warning(png_ptr, "Out of place gAMA chunk"); - - if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA) -#if defined(PNG_READ_sRGB_SUPPORTED) - && !(info_ptr->valid & PNG_INFO_sRGB) -#endif - ) - { - png_warning(png_ptr, "Duplicate gAMA chunk"); - png_crc_finish(png_ptr, length); - return; - } - - if (length != 4) - { - png_warning(png_ptr, "Incorrect gAMA chunk length"); - png_crc_finish(png_ptr, length); - return; - } - - png_crc_read(png_ptr, buf, 4); - if (png_crc_finish(png_ptr, 0)) - return; - - igamma = (png_fixed_point)png_get_uint_32(buf); - /* check for zero gamma */ - if (igamma == 0) - { - png_warning(png_ptr, - "Ignoring gAMA chunk with gamma=0"); - return; - } - -#if defined(PNG_READ_sRGB_SUPPORTED) - if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)) - if (PNG_OUT_OF_RANGE(igamma, 45500L, 500)) - { - png_warning(png_ptr, - "Ignoring incorrect gAMA value when sRGB is also present"); -#ifndef PNG_NO_CONSOLE_IO - fprintf(stderr, "gamma = (%d/100000)\n", (int)igamma); -#endif - return; - } -#endif /* PNG_READ_sRGB_SUPPORTED */ - -#ifdef PNG_FLOATING_POINT_SUPPORTED - file_gamma = (float)igamma / (float)100000.0; -# ifdef PNG_READ_GAMMA_SUPPORTED - png_ptr->gamma = file_gamma; -# endif - png_set_gAMA(png_ptr, info_ptr, file_gamma); -#endif -#ifdef PNG_FIXED_POINT_SUPPORTED - png_set_gAMA_fixed(png_ptr, info_ptr, igamma); -#endif -} -#endif - -#if defined(PNG_READ_sBIT_SUPPORTED) -void /* PRIVATE */ -png_handle_sBIT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) -{ - png_size_t truelen; - png_byte buf[4]; - - png_debug(1, "in png_handle_sBIT\n"); - - buf[0] = buf[1] = buf[2] = buf[3] = 0; - - if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before sBIT"); - else if (png_ptr->mode & PNG_HAVE_IDAT) - { - png_warning(png_ptr, "Invalid sBIT after IDAT"); - png_crc_finish(png_ptr, length); - return; - } - else if (png_ptr->mode & PNG_HAVE_PLTE) - { - /* Should be an error, but we can cope with it */ - png_warning(png_ptr, "Out of place sBIT chunk"); - } - if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT)) - { - png_warning(png_ptr, "Duplicate sBIT chunk"); - png_crc_finish(png_ptr, length); - return; - } - - if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) - truelen = 3; - else - truelen = (png_size_t)png_ptr->channels; - - if (length != truelen || length > 4) - { - png_warning(png_ptr, "Incorrect sBIT chunk length"); - png_crc_finish(png_ptr, length); - return; - } - - png_crc_read(png_ptr, buf, truelen); - if (png_crc_finish(png_ptr, 0)) - return; - - if (png_ptr->color_type & PNG_COLOR_MASK_COLOR) - { - png_ptr->sig_bit.red = buf[0]; - png_ptr->sig_bit.green = buf[1]; - png_ptr->sig_bit.blue = buf[2]; - png_ptr->sig_bit.alpha = buf[3]; - } - else - { - png_ptr->sig_bit.gray = buf[0]; - png_ptr->sig_bit.red = buf[0]; - png_ptr->sig_bit.green = buf[0]; - png_ptr->sig_bit.blue = buf[0]; - png_ptr->sig_bit.alpha = buf[1]; - } - png_set_sBIT(png_ptr, info_ptr, &(png_ptr->sig_bit)); -} -#endif - -#if defined(PNG_READ_cHRM_SUPPORTED) -void /* PRIVATE */ -png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) -{ - png_byte buf[4]; -#ifdef PNG_FLOATING_POINT_SUPPORTED - float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y; -#endif - png_fixed_point int_x_white, int_y_white, int_x_red, int_y_red, int_x_green, - int_y_green, int_x_blue, int_y_blue; - - png_uint_32 uint_x, uint_y; - - png_debug(1, "in png_handle_cHRM\n"); - - if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before cHRM"); - else if (png_ptr->mode & PNG_HAVE_IDAT) - { - png_warning(png_ptr, "Invalid cHRM after IDAT"); - png_crc_finish(png_ptr, length); - return; - } - else if (png_ptr->mode & PNG_HAVE_PLTE) - /* Should be an error, but we can cope with it */ - png_warning(png_ptr, "Missing PLTE before cHRM"); - - if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM) -#if defined(PNG_READ_sRGB_SUPPORTED) - && !(info_ptr->valid & PNG_INFO_sRGB) -#endif - ) - { - png_warning(png_ptr, "Duplicate cHRM chunk"); - png_crc_finish(png_ptr, length); - return; - } - - if (length != 32) - { - png_warning(png_ptr, "Incorrect cHRM chunk length"); - png_crc_finish(png_ptr, length); - return; - } - - png_crc_read(png_ptr, buf, 4); - uint_x = png_get_uint_32(buf); - - png_crc_read(png_ptr, buf, 4); - uint_y = png_get_uint_32(buf); - - if (uint_x > 80000L || uint_y > 80000L || - uint_x + uint_y > 100000L) - { - png_warning(png_ptr, "Invalid cHRM white point"); - png_crc_finish(png_ptr, 24); - return; - } - int_x_white = (png_fixed_point)uint_x; - int_y_white = (png_fixed_point)uint_y; - - png_crc_read(png_ptr, buf, 4); - uint_x = png_get_uint_32(buf); - - png_crc_read(png_ptr, buf, 4); - uint_y = png_get_uint_32(buf); - - if (uint_x + uint_y > 100000L) - { - png_warning(png_ptr, "Invalid cHRM red point"); - png_crc_finish(png_ptr, 16); - return; - } - int_x_red = (png_fixed_point)uint_x; - int_y_red = (png_fixed_point)uint_y; - - png_crc_read(png_ptr, buf, 4); - uint_x = png_get_uint_32(buf); - - png_crc_read(png_ptr, buf, 4); - uint_y = png_get_uint_32(buf); - - if (uint_x + uint_y > 100000L) - { - png_warning(png_ptr, "Invalid cHRM green point"); - png_crc_finish(png_ptr, 8); - return; - } - int_x_green = (png_fixed_point)uint_x; - int_y_green = (png_fixed_point)uint_y; - - png_crc_read(png_ptr, buf, 4); - uint_x = png_get_uint_32(buf); - - png_crc_read(png_ptr, buf, 4); - uint_y = png_get_uint_32(buf); - - if (uint_x + uint_y > 100000L) - { - png_warning(png_ptr, "Invalid cHRM blue point"); - png_crc_finish(png_ptr, 0); - return; - } - int_x_blue = (png_fixed_point)uint_x; - int_y_blue = (png_fixed_point)uint_y; - -#ifdef PNG_FLOATING_POINT_SUPPORTED - white_x = (float)int_x_white / (float)100000.0; - white_y = (float)int_y_white / (float)100000.0; - red_x = (float)int_x_red / (float)100000.0; - red_y = (float)int_y_red / (float)100000.0; - green_x = (float)int_x_green / (float)100000.0; - green_y = (float)int_y_green / (float)100000.0; - blue_x = (float)int_x_blue / (float)100000.0; - blue_y = (float)int_y_blue / (float)100000.0; -#endif - -#if defined(PNG_READ_sRGB_SUPPORTED) - if ((info_ptr != NULL) && (info_ptr->valid & PNG_INFO_sRGB)) - { - if (PNG_OUT_OF_RANGE(int_x_white, 31270, 1000) || - PNG_OUT_OF_RANGE(int_y_white, 32900, 1000) || - PNG_OUT_OF_RANGE(int_x_red, 64000L, 1000) || - PNG_OUT_OF_RANGE(int_y_red, 33000, 1000) || - PNG_OUT_OF_RANGE(int_x_green, 30000, 1000) || - PNG_OUT_OF_RANGE(int_y_green, 60000L, 1000) || - PNG_OUT_OF_RANGE(int_x_blue, 15000, 1000) || - PNG_OUT_OF_RANGE(int_y_blue, 6000, 1000)) - { - png_warning(png_ptr, - "Ignoring incorrect cHRM value when sRGB is also present"); -#ifndef PNG_NO_CONSOLE_IO -#ifdef PNG_FLOATING_POINT_SUPPORTED - fprintf(stderr,"wx=%f, wy=%f, rx=%f, ry=%f\n", - white_x, white_y, red_x, red_y); - fprintf(stderr,"gx=%f, gy=%f, bx=%f, by=%f\n", - green_x, green_y, blue_x, blue_y); -#else - fprintf(stderr,"wx=%ld, wy=%ld, rx=%ld, ry=%ld\n", - int_x_white, int_y_white, int_x_red, int_y_red); - fprintf(stderr,"gx=%ld, gy=%ld, bx=%ld, by=%ld\n", - int_x_green, int_y_green, int_x_blue, int_y_blue); -#endif -#endif /* PNG_NO_CONSOLE_IO */ - } - png_crc_finish(png_ptr, 0); - return; - } -#endif /* PNG_READ_sRGB_SUPPORTED */ - -#ifdef PNG_FLOATING_POINT_SUPPORTED - png_set_cHRM(png_ptr, info_ptr, - white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y); -#endif -#ifdef PNG_FIXED_POINT_SUPPORTED - png_set_cHRM_fixed(png_ptr, info_ptr, - int_x_white, int_y_white, int_x_red, int_y_red, int_x_green, - int_y_green, int_x_blue, int_y_blue); -#endif - if (png_crc_finish(png_ptr, 0)) - return; -} -#endif - -#if defined(PNG_READ_sRGB_SUPPORTED) -void /* PRIVATE */ -png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) -{ - int intent; - png_byte buf[1]; - - png_debug(1, "in png_handle_sRGB\n"); - - if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before sRGB"); - else if (png_ptr->mode & PNG_HAVE_IDAT) - { - png_warning(png_ptr, "Invalid sRGB after IDAT"); - png_crc_finish(png_ptr, length); - return; - } - else if (png_ptr->mode & PNG_HAVE_PLTE) - /* Should be an error, but we can cope with it */ - png_warning(png_ptr, "Out of place sRGB chunk"); - - if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)) - { - png_warning(png_ptr, "Duplicate sRGB chunk"); - png_crc_finish(png_ptr, length); - return; - } - - if (length != 1) - { - png_warning(png_ptr, "Incorrect sRGB chunk length"); - png_crc_finish(png_ptr, length); - return; - } - - png_crc_read(png_ptr, buf, 1); - if (png_crc_finish(png_ptr, 0)) - return; - - intent = buf[0]; - /* check for bad intent */ - if (intent >= PNG_sRGB_INTENT_LAST) - { - png_warning(png_ptr, "Unknown sRGB intent"); - return; - } - -#if defined(PNG_READ_gAMA_SUPPORTED) && defined(PNG_READ_GAMMA_SUPPORTED) - if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)) - { - png_fixed_point igamma; -#ifdef PNG_FIXED_POINT_SUPPORTED - igamma=info_ptr->int_gamma; -#else -# ifdef PNG_FLOATING_POINT_SUPPORTED - igamma=(png_fixed_point)(info_ptr->gamma * 100000.); -# endif -#endif - if (PNG_OUT_OF_RANGE(igamma, 45500L, 500)) - { - png_warning(png_ptr, - "Ignoring incorrect gAMA value when sRGB is also present"); -#ifndef PNG_NO_CONSOLE_IO -# ifdef PNG_FIXED_POINT_SUPPORTED - fprintf(stderr,"incorrect gamma=(%d/100000)\n",(int)png_ptr->int_gamma); -# else -# ifdef PNG_FLOATING_POINT_SUPPORTED - fprintf(stderr,"incorrect gamma=%f\n",png_ptr->gamma); -# endif -# endif -#endif - } - } -#endif /* PNG_READ_gAMA_SUPPORTED */ - -#ifdef PNG_READ_cHRM_SUPPORTED -#ifdef PNG_FIXED_POINT_SUPPORTED - if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM)) - if (PNG_OUT_OF_RANGE(info_ptr->int_x_white, 31270, 1000) || - PNG_OUT_OF_RANGE(info_ptr->int_y_white, 32900, 1000) || - PNG_OUT_OF_RANGE(info_ptr->int_x_red, 64000L, 1000) || - PNG_OUT_OF_RANGE(info_ptr->int_y_red, 33000, 1000) || - PNG_OUT_OF_RANGE(info_ptr->int_x_green, 30000, 1000) || - PNG_OUT_OF_RANGE(info_ptr->int_y_green, 60000L, 1000) || - PNG_OUT_OF_RANGE(info_ptr->int_x_blue, 15000, 1000) || - PNG_OUT_OF_RANGE(info_ptr->int_y_blue, 6000, 1000)) - { - png_warning(png_ptr, - "Ignoring incorrect cHRM value when sRGB is also present"); - } -#endif /* PNG_FIXED_POINT_SUPPORTED */ -#endif /* PNG_READ_cHRM_SUPPORTED */ - - png_set_sRGB_gAMA_and_cHRM(png_ptr, info_ptr, intent); -} -#endif /* PNG_READ_sRGB_SUPPORTED */ - -#if defined(PNG_READ_iCCP_SUPPORTED) -void /* PRIVATE */ -png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) -/* Note: this does not properly handle chunks that are > 64K under DOS */ -{ - png_charp chunkdata; - png_byte compression_type; - png_bytep pC; - png_charp profile; - png_uint_32 skip = 0; - png_uint_32 profile_size, profile_length; - png_size_t slength, prefix_length, data_length; - - png_debug(1, "in png_handle_iCCP\n"); - - if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before iCCP"); - else if (png_ptr->mode & PNG_HAVE_IDAT) - { - png_warning(png_ptr, "Invalid iCCP after IDAT"); - png_crc_finish(png_ptr, length); - return; - } - else if (png_ptr->mode & PNG_HAVE_PLTE) - /* Should be an error, but we can cope with it */ - png_warning(png_ptr, "Out of place iCCP chunk"); - - if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP)) - { - png_warning(png_ptr, "Duplicate iCCP chunk"); - png_crc_finish(png_ptr, length); - return; - } - -#ifdef PNG_MAX_MALLOC_64K - if (length > (png_uint_32)65535L) - { - png_warning(png_ptr, "iCCP chunk too large to fit in memory"); - skip = length - (png_uint_32)65535L; - length = (png_uint_32)65535L; - } -#endif - - chunkdata = (png_charp)png_malloc(png_ptr, length + 1); - slength = (png_size_t)length; - png_crc_read(png_ptr, (png_bytep)chunkdata, slength); - - if (png_crc_finish(png_ptr, skip)) - { - png_free(png_ptr, chunkdata); - return; - } - - chunkdata[slength] = 0x00; - - for (profile = chunkdata; *profile; profile++) - /* empty loop to find end of name */ ; - - ++profile; - - /* there should be at least one zero (the compression type byte) - following the separator, and we should be on it */ - if ( profile >= chunkdata + slength) - { - png_free(png_ptr, chunkdata); - png_warning(png_ptr, "Malformed iCCP chunk"); - return; - } - - /* compression_type should always be zero */ - compression_type = *profile++; - if (compression_type) - { - png_warning(png_ptr, "Ignoring nonzero compression type in iCCP chunk"); - compression_type=0x00; /* Reset it to zero (libpng-1.0.6 through 1.0.8 - wrote nonzero) */ - } - - prefix_length = profile - chunkdata; - chunkdata = png_decompress_chunk(png_ptr, compression_type, chunkdata, - slength, prefix_length, &data_length); - - profile_length = data_length - prefix_length; - - if ( prefix_length > data_length || profile_length < 4) - { - png_free(png_ptr, chunkdata); - png_warning(png_ptr, "Profile size field missing from iCCP chunk"); - return; - } - - /* Check the profile_size recorded in the first 32 bits of the ICC profile */ - pC = (png_bytep)(chunkdata+prefix_length); - profile_size = ((*(pC ))<<24) | - ((*(pC+1))<<16) | - ((*(pC+2))<< 8) | - ((*(pC+3)) ); - - if(profile_size < profile_length) - profile_length = profile_size; - - if(profile_size > profile_length) - { - png_free(png_ptr, chunkdata); - png_warning(png_ptr, "Ignoring truncated iCCP profile."); - return; - } - - png_set_iCCP(png_ptr, info_ptr, chunkdata, compression_type, - chunkdata + prefix_length, profile_length); - png_free(png_ptr, chunkdata); -} -#endif /* PNG_READ_iCCP_SUPPORTED */ - -#if defined(PNG_READ_sPLT_SUPPORTED) -void /* PRIVATE */ -png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) -/* Note: this does not properly handle chunks that are > 64K under DOS */ -{ - png_bytep chunkdata; - png_bytep entry_start; - png_sPLT_t new_palette; -#ifdef PNG_NO_POINTER_INDEXING - png_sPLT_entryp pp; -#endif - int data_length, entry_size, i; - png_uint_32 skip = 0; - png_size_t slength; - - png_debug(1, "in png_handle_sPLT\n"); - - if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before sPLT"); - else if (png_ptr->mode & PNG_HAVE_IDAT) - { - png_warning(png_ptr, "Invalid sPLT after IDAT"); - png_crc_finish(png_ptr, length); - return; - } - -#ifdef PNG_MAX_MALLOC_64K - if (length > (png_uint_32)65535L) - { - png_warning(png_ptr, "sPLT chunk too large to fit in memory"); - skip = length - (png_uint_32)65535L; - length = (png_uint_32)65535L; - } -#endif - - chunkdata = (png_bytep)png_malloc(png_ptr, length + 1); - slength = (png_size_t)length; - png_crc_read(png_ptr, (png_bytep)chunkdata, slength); - - if (png_crc_finish(png_ptr, skip)) - { - png_free(png_ptr, chunkdata); - return; - } - - chunkdata[slength] = 0x00; - - for (entry_start = chunkdata; *entry_start; entry_start++) - /* empty loop to find end of name */ ; - ++entry_start; - - /* a sample depth should follow the separator, and we should be on it */ - if (entry_start > chunkdata + slength) - { - png_free(png_ptr, chunkdata); - png_warning(png_ptr, "malformed sPLT chunk"); - return; - } - - new_palette.depth = *entry_start++; - entry_size = (new_palette.depth == 8 ? 6 : 10); - data_length = (slength - (entry_start - chunkdata)); - - /* integrity-check the data length */ - if (data_length % entry_size) - { - png_free(png_ptr, chunkdata); - png_warning(png_ptr, "sPLT chunk has bad length"); - return; - } - - new_palette.nentries = (png_int_32) ( data_length / entry_size); - if ((png_uint_32) new_palette.nentries > (png_uint_32) (PNG_SIZE_MAX / - png_sizeof(png_sPLT_entry))) - { - png_warning(png_ptr, "sPLT chunk too long"); - return; - } - new_palette.entries = (png_sPLT_entryp)png_malloc_warn( - png_ptr, new_palette.nentries * png_sizeof(png_sPLT_entry)); - if (new_palette.entries == NULL) - { - png_warning(png_ptr, "sPLT chunk requires too much memory"); - return; - } - -#ifndef PNG_NO_POINTER_INDEXING - for (i = 0; i < new_palette.nentries; i++) - { - png_sPLT_entryp pp = new_palette.entries + i; - - if (new_palette.depth == 8) - { - pp->red = *entry_start++; - pp->green = *entry_start++; - pp->blue = *entry_start++; - pp->alpha = *entry_start++; - } - else - { - pp->red = png_get_uint_16(entry_start); entry_start += 2; - pp->green = png_get_uint_16(entry_start); entry_start += 2; - pp->blue = png_get_uint_16(entry_start); entry_start += 2; - pp->alpha = png_get_uint_16(entry_start); entry_start += 2; - } - pp->frequency = png_get_uint_16(entry_start); entry_start += 2; - } -#else - pp = new_palette.entries; - for (i = 0; i < new_palette.nentries; i++) - { - - if (new_palette.depth == 8) - { - pp[i].red = *entry_start++; - pp[i].green = *entry_start++; - pp[i].blue = *entry_start++; - pp[i].alpha = *entry_start++; - } - else - { - pp[i].red = png_get_uint_16(entry_start); entry_start += 2; - pp[i].green = png_get_uint_16(entry_start); entry_start += 2; - pp[i].blue = png_get_uint_16(entry_start); entry_start += 2; - pp[i].alpha = png_get_uint_16(entry_start); entry_start += 2; - } - pp->frequency = png_get_uint_16(entry_start); entry_start += 2; - } -#endif - - /* discard all chunk data except the name and stash that */ - new_palette.name = (png_charp)chunkdata; - - png_set_sPLT(png_ptr, info_ptr, &new_palette, 1); - - png_free(png_ptr, chunkdata); - png_free(png_ptr, new_palette.entries); -} -#endif /* PNG_READ_sPLT_SUPPORTED */ - -#if defined(PNG_READ_tRNS_SUPPORTED) -void /* PRIVATE */ -png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) -{ - png_byte readbuf[PNG_MAX_PALETTE_LENGTH]; - - png_debug(1, "in png_handle_tRNS\n"); - - if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before tRNS"); - else if (png_ptr->mode & PNG_HAVE_IDAT) - { - png_warning(png_ptr, "Invalid tRNS after IDAT"); - png_crc_finish(png_ptr, length); - return; - } - else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS)) - { - png_warning(png_ptr, "Duplicate tRNS chunk"); - png_crc_finish(png_ptr, length); - return; - } - - if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY) - { - png_byte buf[2]; - - if (length != 2) - { - png_warning(png_ptr, "Incorrect tRNS chunk length"); - png_crc_finish(png_ptr, length); - return; - } - - png_crc_read(png_ptr, buf, 2); - png_ptr->num_trans = 1; - png_ptr->trans_values.gray = png_get_uint_16(buf); - } - else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB) - { - png_byte buf[6]; - - if (length != 6) - { - png_warning(png_ptr, "Incorrect tRNS chunk length"); - png_crc_finish(png_ptr, length); - return; - } - png_crc_read(png_ptr, buf, (png_size_t)length); - png_ptr->num_trans = 1; - png_ptr->trans_values.red = png_get_uint_16(buf); - png_ptr->trans_values.green = png_get_uint_16(buf + 2); - png_ptr->trans_values.blue = png_get_uint_16(buf + 4); - } - else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) - { - if (!(png_ptr->mode & PNG_HAVE_PLTE)) - { - /* Should be an error, but we can cope with it. */ - png_warning(png_ptr, "Missing PLTE before tRNS"); - } - if (length > (png_uint_32)png_ptr->num_palette || - length > PNG_MAX_PALETTE_LENGTH) - { - png_warning(png_ptr, "Incorrect tRNS chunk length"); - png_crc_finish(png_ptr, length); - return; - } - if (length == 0) - { - png_warning(png_ptr, "Zero length tRNS chunk"); - png_crc_finish(png_ptr, length); - return; - } - png_crc_read(png_ptr, readbuf, (png_size_t)length); - png_ptr->num_trans = (png_uint_16)length; - } - else - { - png_warning(png_ptr, "tRNS chunk not allowed with alpha channel"); - png_crc_finish(png_ptr, length); - return; - } - - if (png_crc_finish(png_ptr, 0)) - { - png_ptr->num_trans = 0; - return; - } - - png_set_tRNS(png_ptr, info_ptr, readbuf, png_ptr->num_trans, - &(png_ptr->trans_values)); -} -#endif - -#if defined(PNG_READ_bKGD_SUPPORTED) -void /* PRIVATE */ -png_handle_bKGD(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) -{ - png_size_t truelen; - png_byte buf[6]; - - png_debug(1, "in png_handle_bKGD\n"); - - if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before bKGD"); - else if (png_ptr->mode & PNG_HAVE_IDAT) - { - png_warning(png_ptr, "Invalid bKGD after IDAT"); - png_crc_finish(png_ptr, length); - return; - } - else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && - !(png_ptr->mode & PNG_HAVE_PLTE)) - { - png_warning(png_ptr, "Missing PLTE before bKGD"); - png_crc_finish(png_ptr, length); - return; - } - else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD)) - { - png_warning(png_ptr, "Duplicate bKGD chunk"); - png_crc_finish(png_ptr, length); - return; - } - - if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) - truelen = 1; - else if (png_ptr->color_type & PNG_COLOR_MASK_COLOR) - truelen = 6; - else - truelen = 2; - - if (length != truelen) - { - png_warning(png_ptr, "Incorrect bKGD chunk length"); - png_crc_finish(png_ptr, length); - return; - } - - png_crc_read(png_ptr, buf, truelen); - if (png_crc_finish(png_ptr, 0)) - return; - - /* We convert the index value into RGB components so that we can allow - * arbitrary RGB values for background when we have transparency, and - * so it is easy to determine the RGB values of the background color - * from the info_ptr struct. */ - if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) - { - png_ptr->background.index = buf[0]; - if(info_ptr->num_palette) - { - if(buf[0] > info_ptr->num_palette) - { - png_warning(png_ptr, "Incorrect bKGD chunk index value"); - return; - } - png_ptr->background.red = - (png_uint_16)png_ptr->palette[buf[0]].red; - png_ptr->background.green = - (png_uint_16)png_ptr->palette[buf[0]].green; - png_ptr->background.blue = - (png_uint_16)png_ptr->palette[buf[0]].blue; - } - } - else if (!(png_ptr->color_type & PNG_COLOR_MASK_COLOR)) /* GRAY */ - { - png_ptr->background.red = - png_ptr->background.green = - png_ptr->background.blue = - png_ptr->background.gray = png_get_uint_16(buf); - } - else - { - png_ptr->background.red = png_get_uint_16(buf); - png_ptr->background.green = png_get_uint_16(buf + 2); - png_ptr->background.blue = png_get_uint_16(buf + 4); - } - - png_set_bKGD(png_ptr, info_ptr, &(png_ptr->background)); -} -#endif - -#if defined(PNG_READ_hIST_SUPPORTED) -void /* PRIVATE */ -png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) -{ - unsigned int num, i; - png_uint_16 readbuf[PNG_MAX_PALETTE_LENGTH]; - - png_debug(1, "in png_handle_hIST\n"); - - if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before hIST"); - else if (png_ptr->mode & PNG_HAVE_IDAT) - { - png_warning(png_ptr, "Invalid hIST after IDAT"); - png_crc_finish(png_ptr, length); - return; - } - else if (!(png_ptr->mode & PNG_HAVE_PLTE)) - { - png_warning(png_ptr, "Missing PLTE before hIST"); - png_crc_finish(png_ptr, length); - return; - } - else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST)) - { - png_warning(png_ptr, "Duplicate hIST chunk"); - png_crc_finish(png_ptr, length); - return; - } - - num = length / 2 ; - if (num != (unsigned int) png_ptr->num_palette || num > - (unsigned int) PNG_MAX_PALETTE_LENGTH) - { - png_warning(png_ptr, "Incorrect hIST chunk length"); - png_crc_finish(png_ptr, length); - return; - } - - for (i = 0; i < num; i++) - { - png_byte buf[2]; - - png_crc_read(png_ptr, buf, 2); - readbuf[i] = png_get_uint_16(buf); - } - - if (png_crc_finish(png_ptr, 0)) - return; - - png_set_hIST(png_ptr, info_ptr, readbuf); -} -#endif - -#if defined(PNG_READ_pHYs_SUPPORTED) -void /* PRIVATE */ -png_handle_pHYs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) -{ - png_byte buf[9]; - png_uint_32 res_x, res_y; - int unit_type; - - png_debug(1, "in png_handle_pHYs\n"); - - if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before pHYs"); - else if (png_ptr->mode & PNG_HAVE_IDAT) - { - png_warning(png_ptr, "Invalid pHYs after IDAT"); - png_crc_finish(png_ptr, length); - return; - } - else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) - { - png_warning(png_ptr, "Duplicate pHYs chunk"); - png_crc_finish(png_ptr, length); - return; - } - - if (length != 9) - { - png_warning(png_ptr, "Incorrect pHYs chunk length"); - png_crc_finish(png_ptr, length); - return; - } - - png_crc_read(png_ptr, buf, 9); - if (png_crc_finish(png_ptr, 0)) - return; - - res_x = png_get_uint_32(buf); - res_y = png_get_uint_32(buf + 4); - unit_type = buf[8]; - png_set_pHYs(png_ptr, info_ptr, res_x, res_y, unit_type); -} -#endif - -#if defined(PNG_READ_oFFs_SUPPORTED) -void /* PRIVATE */ -png_handle_oFFs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) -{ - png_byte buf[9]; - png_int_32 offset_x, offset_y; - int unit_type; - - png_debug(1, "in png_handle_oFFs\n"); - - if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before oFFs"); - else if (png_ptr->mode & PNG_HAVE_IDAT) - { - png_warning(png_ptr, "Invalid oFFs after IDAT"); - png_crc_finish(png_ptr, length); - return; - } - else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)) - { - png_warning(png_ptr, "Duplicate oFFs chunk"); - png_crc_finish(png_ptr, length); - return; - } - - if (length != 9) - { - png_warning(png_ptr, "Incorrect oFFs chunk length"); - png_crc_finish(png_ptr, length); - return; - } - - png_crc_read(png_ptr, buf, 9); - if (png_crc_finish(png_ptr, 0)) - return; - - offset_x = png_get_int_32(buf); - offset_y = png_get_int_32(buf + 4); - unit_type = buf[8]; - png_set_oFFs(png_ptr, info_ptr, offset_x, offset_y, unit_type); -} -#endif - -#if defined(PNG_READ_pCAL_SUPPORTED) -/* read the pCAL chunk (described in the PNG Extensions document) */ -void /* PRIVATE */ -png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) -{ - png_charp purpose; - png_int_32 X0, X1; - png_byte type, nparams; - png_charp buf, units, endptr; - png_charpp params; - png_size_t slength; - int i; - - png_debug(1, "in png_handle_pCAL\n"); - - if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before pCAL"); - else if (png_ptr->mode & PNG_HAVE_IDAT) - { - png_warning(png_ptr, "Invalid pCAL after IDAT"); - png_crc_finish(png_ptr, length); - return; - } - else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL)) - { - png_warning(png_ptr, "Duplicate pCAL chunk"); - png_crc_finish(png_ptr, length); - return; - } - - png_debug1(2, "Allocating and reading pCAL chunk data (%lu bytes)\n", - length + 1); - purpose = (png_charp)png_malloc_warn(png_ptr, length + 1); - if (purpose == NULL) - { - png_warning(png_ptr, "No memory for pCAL purpose."); - return; - } - slength = (png_size_t)length; - png_crc_read(png_ptr, (png_bytep)purpose, slength); - - if (png_crc_finish(png_ptr, 0)) - { - png_free(png_ptr, purpose); - return; - } - - purpose[slength] = 0x00; /* null terminate the last string */ - - png_debug(3, "Finding end of pCAL purpose string\n"); - for (buf = purpose; *buf; buf++) - /* empty loop */ ; - - endptr = purpose + slength; - - /* We need to have at least 12 bytes after the purpose string - in order to get the parameter information. */ - if (endptr <= buf + 12) - { - png_warning(png_ptr, "Invalid pCAL data"); - png_free(png_ptr, purpose); - return; - } - - png_debug(3, "Reading pCAL X0, X1, type, nparams, and units\n"); - X0 = png_get_int_32((png_bytep)buf+1); - X1 = png_get_int_32((png_bytep)buf+5); - type = buf[9]; - nparams = buf[10]; - units = buf + 11; - - png_debug(3, "Checking pCAL equation type and number of parameters\n"); - /* Check that we have the right number of parameters for known - equation types. */ - if ((type == PNG_EQUATION_LINEAR && nparams != 2) || - (type == PNG_EQUATION_BASE_E && nparams != 3) || - (type == PNG_EQUATION_ARBITRARY && nparams != 3) || - (type == PNG_EQUATION_HYPERBOLIC && nparams != 4)) - { - png_warning(png_ptr, "Invalid pCAL parameters for equation type"); - png_free(png_ptr, purpose); - return; - } - else if (type >= PNG_EQUATION_LAST) - { - png_warning(png_ptr, "Unrecognized equation type for pCAL chunk"); - } - - for (buf = units; *buf; buf++) - /* Empty loop to move past the units string. */ ; - - png_debug(3, "Allocating pCAL parameters array\n"); - params = (png_charpp)png_malloc_warn(png_ptr, (png_uint_32)(nparams - *png_sizeof(png_charp))) ; - if (params == NULL) - { - png_free(png_ptr, purpose); - png_warning(png_ptr, "No memory for pCAL params."); - return; - } - - /* Get pointers to the start of each parameter string. */ - for (i = 0; i < (int)nparams; i++) - { - buf++; /* Skip the null string terminator from previous parameter. */ - - png_debug1(3, "Reading pCAL parameter %d\n", i); - for (params[i] = buf; *buf != 0x00 && buf <= endptr; buf++) - /* Empty loop to move past each parameter string */ ; - - /* Make sure we haven't run out of data yet */ - if (buf > endptr) - { - png_warning(png_ptr, "Invalid pCAL data"); - png_free(png_ptr, purpose); - png_free(png_ptr, params); - return; - } - } - - png_set_pCAL(png_ptr, info_ptr, purpose, X0, X1, type, nparams, - units, params); - - png_free(png_ptr, purpose); - png_free(png_ptr, params); -} -#endif - -#if defined(PNG_READ_sCAL_SUPPORTED) -/* read the sCAL chunk */ -void /* PRIVATE */ -png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) -{ - png_charp buffer, ep; -#ifdef PNG_FLOATING_POINT_SUPPORTED - double width, height; - png_charp vp; -#else -#ifdef PNG_FIXED_POINT_SUPPORTED - png_charp swidth, sheight; -#endif -#endif - png_size_t slength; - - png_debug(1, "in png_handle_sCAL\n"); - - if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before sCAL"); - else if (png_ptr->mode & PNG_HAVE_IDAT) - { - png_warning(png_ptr, "Invalid sCAL after IDAT"); - png_crc_finish(png_ptr, length); - return; - } - else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sCAL)) - { - png_warning(png_ptr, "Duplicate sCAL chunk"); - png_crc_finish(png_ptr, length); - return; - } - - png_debug1(2, "Allocating and reading sCAL chunk data (%lu bytes)\n", - length + 1); - buffer = (png_charp)png_malloc_warn(png_ptr, length + 1); - if (buffer == NULL) - { - png_warning(png_ptr, "Out of memory while processing sCAL chunk"); - return; - } - slength = (png_size_t)length; - png_crc_read(png_ptr, (png_bytep)buffer, slength); - - if (png_crc_finish(png_ptr, 0)) - { - png_free(png_ptr, buffer); - return; - } - - buffer[slength] = 0x00; /* null terminate the last string */ - - ep = buffer + 1; /* skip unit byte */ - -#ifdef PNG_FLOATING_POINT_SUPPORTED - width = png_strtod(png_ptr, ep, &vp); - if (*vp) - { - png_warning(png_ptr, "malformed width string in sCAL chunk"); - return; - } -#else -#ifdef PNG_FIXED_POINT_SUPPORTED - swidth = (png_charp)png_malloc_warn(png_ptr, png_strlen(ep) + 1); - if (swidth == NULL) - { - png_warning(png_ptr, "Out of memory while processing sCAL chunk width"); - return; - } - png_memcpy(swidth, ep, (png_size_t)png_strlen(ep)); -#endif -#endif - - for (ep = buffer; *ep; ep++) - /* empty loop */ ; - ep++; - -#ifdef PNG_FLOATING_POINT_SUPPORTED - height = png_strtod(png_ptr, ep, &vp); - if (*vp) - { - png_warning(png_ptr, "malformed height string in sCAL chunk"); - return; - } -#else -#ifdef PNG_FIXED_POINT_SUPPORTED - sheight = (png_charp)png_malloc_warn(png_ptr, png_strlen(ep) + 1); - if (swidth == NULL) - { - png_warning(png_ptr, "Out of memory while processing sCAL chunk height"); - return; - } - png_memcpy(sheight, ep, (png_size_t)png_strlen(ep)); -#endif -#endif - - if (buffer + slength < ep -#ifdef PNG_FLOATING_POINT_SUPPORTED - || width <= 0. || height <= 0. -#endif - ) - { - png_warning(png_ptr, "Invalid sCAL data"); - png_free(png_ptr, buffer); -#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED) - png_free(png_ptr, swidth); - png_free(png_ptr, sheight); -#endif - return; - } - - -#ifdef PNG_FLOATING_POINT_SUPPORTED - png_set_sCAL(png_ptr, info_ptr, buffer[0], width, height); -#else -#ifdef PNG_FIXED_POINT_SUPPORTED - png_set_sCAL_s(png_ptr, info_ptr, buffer[0], swidth, sheight); -#endif -#endif - - png_free(png_ptr, buffer); -#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED) - png_free(png_ptr, swidth); - png_free(png_ptr, sheight); -#endif -} -#endif - -#if defined(PNG_READ_tIME_SUPPORTED) -void /* PRIVATE */ -png_handle_tIME(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) -{ - png_byte buf[7]; - png_time mod_time; - - png_debug(1, "in png_handle_tIME\n"); - - if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Out of place tIME chunk"); - else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME)) - { - png_warning(png_ptr, "Duplicate tIME chunk"); - png_crc_finish(png_ptr, length); - return; - } - - if (png_ptr->mode & PNG_HAVE_IDAT) - png_ptr->mode |= PNG_AFTER_IDAT; - - if (length != 7) - { - png_warning(png_ptr, "Incorrect tIME chunk length"); - png_crc_finish(png_ptr, length); - return; - } - - png_crc_read(png_ptr, buf, 7); - if (png_crc_finish(png_ptr, 0)) - return; - - mod_time.second = buf[6]; - mod_time.minute = buf[5]; - mod_time.hour = buf[4]; - mod_time.day = buf[3]; - mod_time.month = buf[2]; - mod_time.year = png_get_uint_16(buf); - - png_set_tIME(png_ptr, info_ptr, &mod_time); -} -#endif - -#if defined(PNG_READ_tEXt_SUPPORTED) -/* Note: this does not properly handle chunks that are > 64K under DOS */ -void /* PRIVATE */ -png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) -{ - png_textp text_ptr; - png_charp key; - png_charp text; - png_uint_32 skip = 0; - png_size_t slength; - int ret; - - png_debug(1, "in png_handle_tEXt\n"); - - if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before tEXt"); - - if (png_ptr->mode & PNG_HAVE_IDAT) - png_ptr->mode |= PNG_AFTER_IDAT; - -#ifdef PNG_MAX_MALLOC_64K - if (length > (png_uint_32)65535L) - { - png_warning(png_ptr, "tEXt chunk too large to fit in memory"); - skip = length - (png_uint_32)65535L; - length = (png_uint_32)65535L; - } -#endif - - key = (png_charp)png_malloc_warn(png_ptr, length + 1); - if (key == NULL) - { - png_warning(png_ptr, "No memory to process text chunk."); - return; - } - slength = (png_size_t)length; - png_crc_read(png_ptr, (png_bytep)key, slength); - - if (png_crc_finish(png_ptr, skip)) - { - png_free(png_ptr, key); - return; - } - - key[slength] = 0x00; - - for (text = key; *text; text++) - /* empty loop to find end of key */ ; - - if (text != key + slength) - text++; - - text_ptr = (png_textp)png_malloc_warn(png_ptr, - (png_uint_32)png_sizeof(png_text)); - if (text_ptr == NULL) - { - png_warning(png_ptr, "Not enough memory to process text chunk."); - png_free(png_ptr, key); - return; - } - text_ptr->compression = PNG_TEXT_COMPRESSION_NONE; - text_ptr->key = key; -#ifdef PNG_iTXt_SUPPORTED - text_ptr->lang = NULL; - text_ptr->lang_key = NULL; - text_ptr->itxt_length = 0; -#endif - text_ptr->text = text; - text_ptr->text_length = png_strlen(text); - - ret=png_set_text_2(png_ptr, info_ptr, text_ptr, 1); - - png_free(png_ptr, key); - png_free(png_ptr, text_ptr); - if (ret) - png_warning(png_ptr, "Insufficient memory to process text chunk."); -} -#endif - -#if defined(PNG_READ_zTXt_SUPPORTED) -/* note: this does not correctly handle chunks that are > 64K under DOS */ -void /* PRIVATE */ -png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) -{ - png_textp text_ptr; - png_charp chunkdata; - png_charp text; - int comp_type; - int ret; - png_size_t slength, prefix_len, data_len; - - png_debug(1, "in png_handle_zTXt\n"); - if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before zTXt"); - - if (png_ptr->mode & PNG_HAVE_IDAT) - png_ptr->mode |= PNG_AFTER_IDAT; - -#ifdef PNG_MAX_MALLOC_64K - /* We will no doubt have problems with chunks even half this size, but - there is no hard and fast rule to tell us where to stop. */ - if (length > (png_uint_32)65535L) - { - png_warning(png_ptr,"zTXt chunk too large to fit in memory"); - png_crc_finish(png_ptr, length); - return; - } -#endif - - chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1); - if (chunkdata == NULL) - { - png_warning(png_ptr,"Out of memory processing zTXt chunk."); - return; - } - slength = (png_size_t)length; - png_crc_read(png_ptr, (png_bytep)chunkdata, slength); - if (png_crc_finish(png_ptr, 0)) - { - png_free(png_ptr, chunkdata); - return; - } - - chunkdata[slength] = 0x00; - - for (text = chunkdata; *text; text++) - /* empty loop */ ; - - /* zTXt must have some text after the chunkdataword */ - if (text == chunkdata + slength) - { - comp_type = PNG_TEXT_COMPRESSION_NONE; - png_warning(png_ptr, "Zero length zTXt chunk"); - } - else - { - comp_type = *(++text); - if (comp_type != PNG_TEXT_COMPRESSION_zTXt) - { - png_warning(png_ptr, "Unknown compression type in zTXt chunk"); - comp_type = PNG_TEXT_COMPRESSION_zTXt; - } - text++; /* skip the compression_method byte */ - } - prefix_len = text - chunkdata; - - chunkdata = (png_charp)png_decompress_chunk(png_ptr, comp_type, chunkdata, - (png_size_t)length, prefix_len, &data_len); - - text_ptr = (png_textp)png_malloc_warn(png_ptr, - (png_uint_32)png_sizeof(png_text)); - if (text_ptr == NULL) - { - png_warning(png_ptr,"Not enough memory to process zTXt chunk."); - png_free(png_ptr, chunkdata); - return; - } - text_ptr->compression = comp_type; - text_ptr->key = chunkdata; -#ifdef PNG_iTXt_SUPPORTED - text_ptr->lang = NULL; - text_ptr->lang_key = NULL; - text_ptr->itxt_length = 0; -#endif - text_ptr->text = chunkdata + prefix_len; - text_ptr->text_length = data_len; - - ret=png_set_text_2(png_ptr, info_ptr, text_ptr, 1); - - png_free(png_ptr, text_ptr); - png_free(png_ptr, chunkdata); - if (ret) - png_error(png_ptr, "Insufficient memory to store zTXt chunk."); -} -#endif - -#if defined(PNG_READ_iTXt_SUPPORTED) -/* note: this does not correctly handle chunks that are > 64K under DOS */ -void /* PRIVATE */ -png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) -{ - png_textp text_ptr; - png_charp chunkdata; - png_charp key, lang, text, lang_key; - int comp_flag; - int comp_type = 0; - int ret; - png_size_t slength, prefix_len, data_len; - - png_debug(1, "in png_handle_iTXt\n"); - - if (!(png_ptr->mode & PNG_HAVE_IHDR)) - png_error(png_ptr, "Missing IHDR before iTXt"); - - if (png_ptr->mode & PNG_HAVE_IDAT) - png_ptr->mode |= PNG_AFTER_IDAT; - -#ifdef PNG_MAX_MALLOC_64K - /* We will no doubt have problems with chunks even half this size, but - there is no hard and fast rule to tell us where to stop. */ - if (length > (png_uint_32)65535L) - { - png_warning(png_ptr,"iTXt chunk too large to fit in memory"); - png_crc_finish(png_ptr, length); - return; - } -#endif - - chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1); - if (chunkdata == NULL) - { - png_warning(png_ptr, "No memory to process iTXt chunk."); - return; - } - slength = (png_size_t)length; - png_crc_read(png_ptr, (png_bytep)chunkdata, slength); - if (png_crc_finish(png_ptr, 0)) - { - png_free(png_ptr, chunkdata); - return; - } - - chunkdata[slength] = 0x00; - - for (lang = chunkdata; *lang; lang++) - /* empty loop */ ; - lang++; /* skip NUL separator */ - - /* iTXt must have a language tag (possibly empty), two compression bytes, - translated keyword (possibly empty), and possibly some text after the - keyword */ - - if (lang >= chunkdata + slength) - { - comp_flag = PNG_TEXT_COMPRESSION_NONE; - png_warning(png_ptr, "Zero length iTXt chunk"); - } - else - { - comp_flag = *lang++; - comp_type = *lang++; - } - - for (lang_key = lang; *lang_key; lang_key++) - /* empty loop */ ; - lang_key++; /* skip NUL separator */ - - for (text = lang_key; *text; text++) - /* empty loop */ ; - text++; /* skip NUL separator */ - - prefix_len = text - chunkdata; - - key=chunkdata; - if (comp_flag) - chunkdata = png_decompress_chunk(png_ptr, comp_type, chunkdata, - (size_t)length, prefix_len, &data_len); - else - data_len=png_strlen(chunkdata + prefix_len); - text_ptr = (png_textp)png_malloc_warn(png_ptr, - (png_uint_32)png_sizeof(png_text)); - if (text_ptr == NULL) - { - png_warning(png_ptr,"Not enough memory to process iTXt chunk."); - png_free(png_ptr, chunkdata); - return; - } - text_ptr->compression = (int)comp_flag + 1; - text_ptr->lang_key = chunkdata+(lang_key-key); - text_ptr->lang = chunkdata+(lang-key); - text_ptr->itxt_length = data_len; - text_ptr->text_length = 0; - text_ptr->key = chunkdata; - text_ptr->text = chunkdata + prefix_len; - - ret=png_set_text_2(png_ptr, info_ptr, text_ptr, 1); - - png_free(png_ptr, text_ptr); - png_free(png_ptr, chunkdata); - if (ret) - png_error(png_ptr, "Insufficient memory to store iTXt chunk."); -} -#endif - -/* This function is called when we haven't found a handler for a - chunk. If there isn't a problem with the chunk itself (ie bad - chunk name, CRC, or a critical chunk), the chunk is silently ignored - -- unless the PNG_FLAG_UNKNOWN_CHUNKS_SUPPORTED flag is on in which - case it will be saved away to be written out later. */ -void /* PRIVATE */ -png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) -{ - png_uint_32 skip = 0; - - png_debug(1, "in png_handle_unknown\n"); - - if (png_ptr->mode & PNG_HAVE_IDAT) - { -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_IDAT; -#endif - if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) /* not an IDAT */ - png_ptr->mode |= PNG_AFTER_IDAT; - } - - png_check_chunk_name(png_ptr, png_ptr->chunk_name); - - if (!(png_ptr->chunk_name[0] & 0x20)) - { -#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) - if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) != - PNG_HANDLE_CHUNK_ALWAYS -#if defined(PNG_READ_USER_CHUNKS_SUPPORTED) - && png_ptr->read_user_chunk_fn == NULL -#endif - ) -#endif - png_chunk_error(png_ptr, "unknown critical chunk"); - } - -#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) - if ((png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS) || - (png_ptr->read_user_chunk_fn != NULL)) - { -#ifdef PNG_MAX_MALLOC_64K - if (length > (png_uint_32)65535L) - { - png_warning(png_ptr, "unknown chunk too large to fit in memory"); - skip = length - (png_uint_32)65535L; - length = (png_uint_32)65535L; - } -#endif - png_strcpy((png_charp)png_ptr->unknown_chunk.name, - (png_charp)png_ptr->chunk_name); - png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, length); - png_ptr->unknown_chunk.size = (png_size_t)length; - png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length); -#if defined(PNG_READ_USER_CHUNKS_SUPPORTED) - if(png_ptr->read_user_chunk_fn != NULL) - { - /* callback to user unknown chunk handler */ - int ret; - ret = (*(png_ptr->read_user_chunk_fn)) - (png_ptr, &png_ptr->unknown_chunk); - if (ret < 0) - png_chunk_error(png_ptr, "error in user chunk"); - if (ret == 0) - { - if (!(png_ptr->chunk_name[0] & 0x20)) - if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) != - PNG_HANDLE_CHUNK_ALWAYS) - png_chunk_error(png_ptr, "unknown critical chunk"); - png_set_unknown_chunks(png_ptr, info_ptr, - &png_ptr->unknown_chunk, 1); - } - } -#else - png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1); -#endif - png_free(png_ptr, png_ptr->unknown_chunk.data); - png_ptr->unknown_chunk.data = NULL; - } - else -#endif - skip = length; - - png_crc_finish(png_ptr, skip); - -#if !defined(PNG_READ_USER_CHUNKS_SUPPORTED) - if (&info_ptr == NULL) /* quiet compiler warnings about unused info_ptr */ - return; -#endif -} - -/* This function is called to verify that a chunk name is valid. - This function can't have the "critical chunk check" incorporated - into it, since in the future we will need to be able to call user - functions to handle unknown critical chunks after we check that - the chunk name itself is valid. */ - -#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97)) - -void /* PRIVATE */ -png_check_chunk_name(png_structp png_ptr, png_bytep chunk_name) -{ - png_debug(1, "in png_check_chunk_name\n"); - if (isnonalpha(chunk_name[0]) || isnonalpha(chunk_name[1]) || - isnonalpha(chunk_name[2]) || isnonalpha(chunk_name[3])) - { - png_chunk_error(png_ptr, "invalid chunk type"); - } -} - -/* Combines the row recently read in with the existing pixels in the - row. This routine takes care of alpha and transparency if requested. - This routine also handles the two methods of progressive display - of interlaced images, depending on the mask value. - The mask value describes which pixels are to be combined with - the row. The pattern always repeats every 8 pixels, so just 8 - bits are needed. A one indicates the pixel is to be combined, - a zero indicates the pixel is to be skipped. This is in addition - to any alpha or transparency value associated with the pixel. If - you want all pixels to be combined, pass 0xff (255) in mask. */ -#ifndef PNG_HAVE_MMX_COMBINE_ROW -void /* PRIVATE */ -png_combine_row(png_structp png_ptr, png_bytep row, int mask) -{ - png_debug(1,"in png_combine_row\n"); - if (mask == 0xff) - { - png_memcpy(row, png_ptr->row_buf + 1, - PNG_ROWBYTES(png_ptr->row_info.pixel_depth, png_ptr->width)); - } - else - { - switch (png_ptr->row_info.pixel_depth) - { - case 1: - { - png_bytep sp = png_ptr->row_buf + 1; - png_bytep dp = row; - int s_inc, s_start, s_end; - int m = 0x80; - int shift; - png_uint_32 i; - png_uint_32 row_width = png_ptr->width; - -#if defined(PNG_READ_PACKSWAP_SUPPORTED) - if (png_ptr->transformations & PNG_PACKSWAP) - { - s_start = 0; - s_end = 7; - s_inc = 1; - } - else -#endif - { - s_start = 7; - s_end = 0; - s_inc = -1; - } - - shift = s_start; - - for (i = 0; i < row_width; i++) - { - if (m & mask) - { - int value; - - value = (*sp >> shift) & 0x01; - *dp &= (png_byte)((0x7f7f >> (7 - shift)) & 0xff); - *dp |= (png_byte)(value << shift); - } - - if (shift == s_end) - { - shift = s_start; - sp++; - dp++; - } - else - shift += s_inc; - - if (m == 1) - m = 0x80; - else - m >>= 1; - } - break; - } - case 2: - { - png_bytep sp = png_ptr->row_buf + 1; - png_bytep dp = row; - int s_start, s_end, s_inc; - int m = 0x80; - int shift; - png_uint_32 i; - png_uint_32 row_width = png_ptr->width; - int value; - -#if defined(PNG_READ_PACKSWAP_SUPPORTED) - if (png_ptr->transformations & PNG_PACKSWAP) - { - s_start = 0; - s_end = 6; - s_inc = 2; - } - else -#endif - { - s_start = 6; - s_end = 0; - s_inc = -2; - } - - shift = s_start; - - for (i = 0; i < row_width; i++) - { - if (m & mask) - { - value = (*sp >> shift) & 0x03; - *dp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff); - *dp |= (png_byte)(value << shift); - } - - if (shift == s_end) - { - shift = s_start; - sp++; - dp++; - } - else - shift += s_inc; - if (m == 1) - m = 0x80; - else - m >>= 1; - } - break; - } - case 4: - { - png_bytep sp = png_ptr->row_buf + 1; - png_bytep dp = row; - int s_start, s_end, s_inc; - int m = 0x80; - int shift; - png_uint_32 i; - png_uint_32 row_width = png_ptr->width; - int value; - -#if defined(PNG_READ_PACKSWAP_SUPPORTED) - if (png_ptr->transformations & PNG_PACKSWAP) - { - s_start = 0; - s_end = 4; - s_inc = 4; - } - else -#endif - { - s_start = 4; - s_end = 0; - s_inc = -4; - } - shift = s_start; - - for (i = 0; i < row_width; i++) - { - if (m & mask) - { - value = (*sp >> shift) & 0xf; - *dp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff); - *dp |= (png_byte)(value << shift); - } - - if (shift == s_end) - { - shift = s_start; - sp++; - dp++; - } - else - shift += s_inc; - if (m == 1) - m = 0x80; - else - m >>= 1; - } - break; - } - default: - { - png_bytep sp = png_ptr->row_buf + 1; - png_bytep dp = row; - png_size_t pixel_bytes = (png_ptr->row_info.pixel_depth >> 3); - png_uint_32 i; - png_uint_32 row_width = png_ptr->width; - png_byte m = 0x80; - - - for (i = 0; i < row_width; i++) - { - if (m & mask) - { - png_memcpy(dp, sp, pixel_bytes); - } - - sp += pixel_bytes; - dp += pixel_bytes; - - if (m == 1) - m = 0x80; - else - m >>= 1; - } - break; - } - } - } -} -#endif /* !PNG_HAVE_MMX_COMBINE_ROW */ - -#ifdef PNG_READ_INTERLACING_SUPPORTED -#ifndef PNG_HAVE_MMX_READ_INTERLACE /* else in pngvcrd.c, pnggccrd.c */ -/* OLD pre-1.0.9 interface: -void png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, - png_uint_32 transformations) - */ -void /* PRIVATE */ -png_do_read_interlace(png_structp png_ptr) -{ - png_row_infop row_info = &(png_ptr->row_info); - png_bytep row = png_ptr->row_buf + 1; - int pass = png_ptr->pass; - png_uint_32 transformations = png_ptr->transformations; -#ifdef PNG_USE_LOCAL_ARRAYS - /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ - /* offset to next interlace block */ - const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; -#endif - - png_debug(1,"in png_do_read_interlace (stock C version)\n"); - if (row != NULL && row_info != NULL) - { - png_uint_32 final_width; - - final_width = row_info->width * png_pass_inc[pass]; - - switch (row_info->pixel_depth) - { - case 1: - { - png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 3); - png_bytep dp = row + (png_size_t)((final_width - 1) >> 3); - int sshift, dshift; - int s_start, s_end, s_inc; - int jstop = png_pass_inc[pass]; - png_byte v; - png_uint_32 i; - int j; - -#if defined(PNG_READ_PACKSWAP_SUPPORTED) - if (transformations & PNG_PACKSWAP) - { - sshift = (int)((row_info->width + 7) & 0x07); - dshift = (int)((final_width + 7) & 0x07); - s_start = 7; - s_end = 0; - s_inc = -1; - } - else -#endif - { - sshift = 7 - (int)((row_info->width + 7) & 0x07); - dshift = 7 - (int)((final_width + 7) & 0x07); - s_start = 0; - s_end = 7; - s_inc = 1; - } - - for (i = 0; i < row_info->width; i++) - { - v = (png_byte)((*sp >> sshift) & 0x01); - for (j = 0; j < jstop; j++) - { - *dp &= (png_byte)((0x7f7f >> (7 - dshift)) & 0xff); - *dp |= (png_byte)(v << dshift); - if (dshift == s_end) - { - dshift = s_start; - dp--; - } - else - dshift += s_inc; - } - if (sshift == s_end) - { - sshift = s_start; - sp--; - } - else - sshift += s_inc; - } - break; - } - case 2: - { - png_bytep sp = row + (png_uint_32)((row_info->width - 1) >> 2); - png_bytep dp = row + (png_uint_32)((final_width - 1) >> 2); - int sshift, dshift; - int s_start, s_end, s_inc; - int jstop = png_pass_inc[pass]; - png_uint_32 i; - -#if defined(PNG_READ_PACKSWAP_SUPPORTED) - if (transformations & PNG_PACKSWAP) - { - sshift = (int)(((row_info->width + 3) & 0x03) << 1); - dshift = (int)(((final_width + 3) & 0x03) << 1); - s_start = 6; - s_end = 0; - s_inc = -2; - } - else -#endif - { - sshift = (int)((3 - ((row_info->width + 3) & 0x03)) << 1); - dshift = (int)((3 - ((final_width + 3) & 0x03)) << 1); - s_start = 0; - s_end = 6; - s_inc = 2; - } - - for (i = 0; i < row_info->width; i++) - { - png_byte v; - int j; - - v = (png_byte)((*sp >> sshift) & 0x03); - for (j = 0; j < jstop; j++) - { - *dp &= (png_byte)((0x3f3f >> (6 - dshift)) & 0xff); - *dp |= (png_byte)(v << dshift); - if (dshift == s_end) - { - dshift = s_start; - dp--; - } - else - dshift += s_inc; - } - if (sshift == s_end) - { - sshift = s_start; - sp--; - } - else - sshift += s_inc; - } - break; - } - case 4: - { - png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 1); - png_bytep dp = row + (png_size_t)((final_width - 1) >> 1); - int sshift, dshift; - int s_start, s_end, s_inc; - png_uint_32 i; - int jstop = png_pass_inc[pass]; - -#if defined(PNG_READ_PACKSWAP_SUPPORTED) - if (transformations & PNG_PACKSWAP) - { - sshift = (int)(((row_info->width + 1) & 0x01) << 2); - dshift = (int)(((final_width + 1) & 0x01) << 2); - s_start = 4; - s_end = 0; - s_inc = -4; - } - else -#endif - { - sshift = (int)((1 - ((row_info->width + 1) & 0x01)) << 2); - dshift = (int)((1 - ((final_width + 1) & 0x01)) << 2); - s_start = 0; - s_end = 4; - s_inc = 4; - } - - for (i = 0; i < row_info->width; i++) - { - png_byte v = (png_byte)((*sp >> sshift) & 0xf); - int j; - - for (j = 0; j < jstop; j++) - { - *dp &= (png_byte)((0xf0f >> (4 - dshift)) & 0xff); - *dp |= (png_byte)(v << dshift); - if (dshift == s_end) - { - dshift = s_start; - dp--; - } - else - dshift += s_inc; - } - if (sshift == s_end) - { - sshift = s_start; - sp--; - } - else - sshift += s_inc; - } - break; - } - default: - { - png_size_t pixel_bytes = (row_info->pixel_depth >> 3); - png_bytep sp = row + (png_size_t)(row_info->width - 1) * pixel_bytes; - png_bytep dp = row + (png_size_t)(final_width - 1) * pixel_bytes; - - int jstop = png_pass_inc[pass]; - png_uint_32 i; - - for (i = 0; i < row_info->width; i++) - { - png_byte v[8]; - int j; - - png_memcpy(v, sp, pixel_bytes); - for (j = 0; j < jstop; j++) - { - png_memcpy(dp, v, pixel_bytes); - dp -= pixel_bytes; - } - sp -= pixel_bytes; - } - break; - } - } - row_info->width = final_width; - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,final_width); - } -#if !defined(PNG_READ_PACKSWAP_SUPPORTED) - if (&transformations == NULL) /* silence compiler warning */ - return; -#endif -} -#endif /* !PNG_HAVE_MMX_READ_INTERLACE */ -#endif /* PNG_READ_INTERLACING_SUPPORTED */ - -#ifndef PNG_HAVE_MMX_READ_FILTER_ROW -void /* PRIVATE */ -png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row, - png_bytep prev_row, int filter) -{ - png_debug(1, "in png_read_filter_row\n"); - png_debug2(2,"row = %lu, filter = %d\n", png_ptr->row_number, filter); - switch (filter) - { - case PNG_FILTER_VALUE_NONE: - break; - case PNG_FILTER_VALUE_SUB: - { - png_uint_32 i; - png_uint_32 istop = row_info->rowbytes; - png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3; - png_bytep rp = row + bpp; - png_bytep lp = row; - - for (i = bpp; i < istop; i++) - { - *rp = (png_byte)(((int)(*rp) + (int)(*lp++)) & 0xff); - rp++; - } - break; - } - case PNG_FILTER_VALUE_UP: - { - png_uint_32 i; - png_uint_32 istop = row_info->rowbytes; - png_bytep rp = row; - png_bytep pp = prev_row; - - for (i = 0; i < istop; i++) - { - *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff); - rp++; - } - break; - } - case PNG_FILTER_VALUE_AVG: - { - png_uint_32 i; - png_bytep rp = row; - png_bytep pp = prev_row; - png_bytep lp = row; - png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3; - png_uint_32 istop = row_info->rowbytes - bpp; - - for (i = 0; i < bpp; i++) - { - *rp = (png_byte)(((int)(*rp) + - ((int)(*pp++) / 2 )) & 0xff); - rp++; - } - - for (i = 0; i < istop; i++) - { - *rp = (png_byte)(((int)(*rp) + - (int)(*pp++ + *lp++) / 2 ) & 0xff); - rp++; - } - break; - } - case PNG_FILTER_VALUE_PAETH: - { - png_uint_32 i; - png_bytep rp = row; - png_bytep pp = prev_row; - png_bytep lp = row; - png_bytep cp = prev_row; - png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3; - png_uint_32 istop=row_info->rowbytes - bpp; - - for (i = 0; i < bpp; i++) - { - *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff); - rp++; - } - - for (i = 0; i < istop; i++) /* use leftover rp,pp */ - { - int a, b, c, pa, pb, pc, p; - - a = *lp++; - b = *pp++; - c = *cp++; - - p = b - c; - pc = a - c; - -#ifdef PNG_USE_ABS - pa = abs(p); - pb = abs(pc); - pc = abs(p + pc); -#else - pa = p < 0 ? -p : p; - pb = pc < 0 ? -pc : pc; - pc = (p + pc) < 0 ? -(p + pc) : p + pc; -#endif - - /* - if (pa <= pb && pa <= pc) - p = a; - else if (pb <= pc) - p = b; - else - p = c; - */ - - p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c; - - *rp = (png_byte)(((int)(*rp) + p) & 0xff); - rp++; - } - break; - } - default: - png_warning(png_ptr, "Ignoring bad adaptive filter type"); - *row=0; - break; - } -} -#endif /* !PNG_HAVE_MMX_READ_FILTER_ROW */ - -void /* PRIVATE */ -png_read_finish_row(png_structp png_ptr) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ - - /* start of interlace block */ - const int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; - - /* offset to next interlace block */ - const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; - - /* start of interlace block in the y direction */ - const int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; - - /* offset to next interlace block in the y direction */ - const int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; -#endif - - png_debug(1, "in png_read_finish_row\n"); - png_ptr->row_number++; - if (png_ptr->row_number < png_ptr->num_rows) - return; - - if (png_ptr->interlaced) - { - png_ptr->row_number = 0; - png_memset_check(png_ptr, png_ptr->prev_row, 0, png_ptr->rowbytes + 1); - do - { - png_ptr->pass++; - if (png_ptr->pass >= 7) - break; - png_ptr->iwidth = (png_ptr->width + - png_pass_inc[png_ptr->pass] - 1 - - png_pass_start[png_ptr->pass]) / - png_pass_inc[png_ptr->pass]; - - png_ptr->irowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, - png_ptr->iwidth) + 1; - - if (!(png_ptr->transformations & PNG_INTERLACE)) - { - png_ptr->num_rows = (png_ptr->height + - png_pass_yinc[png_ptr->pass] - 1 - - png_pass_ystart[png_ptr->pass]) / - png_pass_yinc[png_ptr->pass]; - if (!(png_ptr->num_rows)) - continue; - } - else /* if (png_ptr->transformations & PNG_INTERLACE) */ - break; - } while (png_ptr->iwidth == 0); - - if (png_ptr->pass < 7) - return; - } - - if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)) - { -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_IDAT; -#endif - char extra; - int ret; - - png_ptr->zstream.next_out = (Byte *)&extra; - png_ptr->zstream.avail_out = (uInt)1; - for(;;) - { - if (!(png_ptr->zstream.avail_in)) - { - while (!png_ptr->idat_size) - { - png_byte chunk_length[4]; - - png_crc_finish(png_ptr, 0); - - png_read_data(png_ptr, chunk_length, 4); - png_ptr->idat_size = png_get_uint_31(png_ptr, chunk_length); - png_reset_crc(png_ptr); - png_crc_read(png_ptr, png_ptr->chunk_name, 4); - if (png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4)) - png_error(png_ptr, "Not enough image data"); - - } - png_ptr->zstream.avail_in = (uInt)png_ptr->zbuf_size; - png_ptr->zstream.next_in = png_ptr->zbuf; - if (png_ptr->zbuf_size > png_ptr->idat_size) - png_ptr->zstream.avail_in = (uInt)png_ptr->idat_size; - png_crc_read(png_ptr, png_ptr->zbuf, png_ptr->zstream.avail_in); - png_ptr->idat_size -= png_ptr->zstream.avail_in; - } - ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH); - if (ret == Z_STREAM_END) - { - if (!(png_ptr->zstream.avail_out) || png_ptr->zstream.avail_in || - png_ptr->idat_size) - png_warning(png_ptr, "Extra compressed data"); - png_ptr->mode |= PNG_AFTER_IDAT; - png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; - break; - } - if (ret != Z_OK) - png_error(png_ptr, png_ptr->zstream.msg ? png_ptr->zstream.msg : - "Decompression Error"); - - if (!(png_ptr->zstream.avail_out)) - { - png_warning(png_ptr, "Extra compressed data."); - png_ptr->mode |= PNG_AFTER_IDAT; - png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; - break; - } - - } - png_ptr->zstream.avail_out = 0; - } - - if (png_ptr->idat_size || png_ptr->zstream.avail_in) - png_warning(png_ptr, "Extra compression data"); - - inflateReset(&png_ptr->zstream); - - png_ptr->mode |= PNG_AFTER_IDAT; -} - -void /* PRIVATE */ -png_read_start_row(png_structp png_ptr) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ - - /* start of interlace block */ - const int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; - - /* offset to next interlace block */ - const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; - - /* start of interlace block in the y direction */ - const int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; - - /* offset to next interlace block in the y direction */ - const int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; -#endif - - int max_pixel_depth; - png_uint_32 row_bytes; - - png_debug(1, "in png_read_start_row\n"); - png_ptr->zstream.avail_in = 0; - png_init_read_transformations(png_ptr); - if (png_ptr->interlaced) - { - if (!(png_ptr->transformations & PNG_INTERLACE)) - png_ptr->num_rows = (png_ptr->height + png_pass_yinc[0] - 1 - - png_pass_ystart[0]) / png_pass_yinc[0]; - else - png_ptr->num_rows = png_ptr->height; - - png_ptr->iwidth = (png_ptr->width + - png_pass_inc[png_ptr->pass] - 1 - - png_pass_start[png_ptr->pass]) / - png_pass_inc[png_ptr->pass]; - - row_bytes = PNG_ROWBYTES(png_ptr->pixel_depth,png_ptr->iwidth) + 1; - - png_ptr->irowbytes = (png_size_t)row_bytes; - if((png_uint_32)png_ptr->irowbytes != row_bytes) - png_error(png_ptr, "Rowbytes overflow in png_read_start_row"); - } - else - { - png_ptr->num_rows = png_ptr->height; - png_ptr->iwidth = png_ptr->width; - png_ptr->irowbytes = png_ptr->rowbytes + 1; - } - max_pixel_depth = png_ptr->pixel_depth; - -#if defined(PNG_READ_PACK_SUPPORTED) - if ((png_ptr->transformations & PNG_PACK) && png_ptr->bit_depth < 8) - max_pixel_depth = 8; -#endif - -#if defined(PNG_READ_EXPAND_SUPPORTED) - if (png_ptr->transformations & PNG_EXPAND) - { - if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) - { - if (png_ptr->num_trans) - max_pixel_depth = 32; - else - max_pixel_depth = 24; - } - else if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY) - { - if (max_pixel_depth < 8) - max_pixel_depth = 8; - if (png_ptr->num_trans) - max_pixel_depth *= 2; - } - else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB) - { - if (png_ptr->num_trans) - { - max_pixel_depth *= 4; - max_pixel_depth /= 3; - } - } - } -#endif - -#if defined(PNG_READ_FILLER_SUPPORTED) - if (png_ptr->transformations & (PNG_FILLER)) - { - if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) - max_pixel_depth = 32; - else if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY) - { - if (max_pixel_depth <= 8) - max_pixel_depth = 16; - else - max_pixel_depth = 32; - } - else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB) - { - if (max_pixel_depth <= 32) - max_pixel_depth = 32; - else - max_pixel_depth = 64; - } - } -#endif - -#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) - if (png_ptr->transformations & PNG_GRAY_TO_RGB) - { - if ( -#if defined(PNG_READ_EXPAND_SUPPORTED) - (png_ptr->num_trans && (png_ptr->transformations & PNG_EXPAND)) || -#endif -#if defined(PNG_READ_FILLER_SUPPORTED) - (png_ptr->transformations & (PNG_FILLER)) || -#endif - png_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) - { - if (max_pixel_depth <= 16) - max_pixel_depth = 32; - else - max_pixel_depth = 64; - } - else - { - if (max_pixel_depth <= 8) - { - if (png_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) - max_pixel_depth = 32; - else - max_pixel_depth = 24; - } - else if (png_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) - max_pixel_depth = 64; - else - max_pixel_depth = 48; - } - } -#endif - -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) && \ -defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) - if(png_ptr->transformations & PNG_USER_TRANSFORM) - { - int user_pixel_depth=png_ptr->user_transform_depth* - png_ptr->user_transform_channels; - if(user_pixel_depth > max_pixel_depth) - max_pixel_depth=user_pixel_depth; - } -#endif - - /* align the width on the next larger 8 pixels. Mainly used - for interlacing */ - row_bytes = ((png_ptr->width + 7) & ~((png_uint_32)7)); - /* calculate the maximum bytes needed, adding a byte and a pixel - for safety's sake */ - row_bytes = PNG_ROWBYTES(max_pixel_depth,row_bytes) + - 1 + ((max_pixel_depth + 7) >> 3); -#ifdef PNG_MAX_MALLOC_64K - if (row_bytes > (png_uint_32)65536L) - png_error(png_ptr, "This image requires a row greater than 64KB"); -#endif - png_ptr->big_row_buf = (png_bytep)png_malloc(png_ptr, row_bytes+64); - png_ptr->row_buf = png_ptr->big_row_buf+32; -#if defined(PNG_DEBUG) && defined(PNG_USE_PNGGCCRD) - png_ptr->row_buf_size = row_bytes; -#endif - -#ifdef PNG_MAX_MALLOC_64K - if ((png_uint_32)png_ptr->rowbytes + 1 > (png_uint_32)65536L) - png_error(png_ptr, "This image requires a row greater than 64KB"); -#endif - if ((png_uint_32)png_ptr->rowbytes > (png_uint_32)(PNG_SIZE_MAX - 1)) - png_error(png_ptr, "Row has too many bytes to allocate in memory."); - png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)( - png_ptr->rowbytes + 1)); - - png_memset_check(png_ptr, png_ptr->prev_row, 0, png_ptr->rowbytes + 1); - png_debug1(3, "width = %lu,\n", png_ptr->width); png_debug1(3, "height = %lu,\n", png_ptr->height); png_debug1(3, "iwidth = %lu,\n", png_ptr->iwidth); diff --git a/src/dep/src/irrlicht/libpng/pngset.c b/src/dep/src/irrlicht/libpng/pngset.c index 8eb2d57..14f44c3 100644 --- a/src/dep/src/irrlicht/libpng/pngset.c +++ b/src/dep/src/irrlicht/libpng/pngset.c @@ -1,9 +1,9 @@ /* pngset.c - storage of image information into info struct * - * Last changed in libpng 1.2.35 [February 14, 2009] + * Last changed in libpng 1.2.30 [August 15, 2008] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2009 Glenn Randers-Pehrson + * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -21,7 +21,7 @@ void PNGAPI png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background) { - png_debug1(1, "in %s storage function", "bKGD"); + png_debug1(1, "in %s storage function\n", "bKGD"); if (png_ptr == NULL || info_ptr == NULL) return; @@ -37,9 +37,34 @@ png_set_cHRM(png_structp png_ptr, png_infop info_ptr, double white_x, double white_y, double red_x, double red_y, double green_x, double green_y, double blue_x, double blue_y) { - png_debug1(1, "in %s storage function", "cHRM"); + png_debug1(1, "in %s storage function\n", "cHRM"); if (png_ptr == NULL || info_ptr == NULL) return; + if (!(white_x || white_y || red_x || red_y || green_x || green_y || + blue_x || blue_y)) + { + png_warning(png_ptr, + "Ignoring attempt to set all-zero chromaticity values"); + return; + } + if (white_x < 0.0 || white_y < 0.0 || + red_x < 0.0 || red_y < 0.0 || + green_x < 0.0 || green_y < 0.0 || + blue_x < 0.0 || blue_y < 0.0) + { + png_warning(png_ptr, + "Ignoring attempt to set negative chromaticity value"); + return; + } + if (white_x > 21474.83 || white_y > 21474.83 || + red_x > 21474.83 || red_y > 21474.83 || + green_x > 21474.83 || green_y > 21474.83 || + blue_x > 21474.83 || blue_y > 21474.83) + { + png_warning(png_ptr, + "Ignoring attempt to set chromaticity value exceeding 21474.83"); + return; + } info_ptr->x_white = (float)white_x; info_ptr->y_white = (float)white_y; @@ -61,8 +86,7 @@ png_set_cHRM(png_structp png_ptr, png_infop info_ptr, #endif info_ptr->valid |= PNG_INFO_cHRM; } -#endif /* PNG_FLOATING_POINT_SUPPORTED */ - +#endif #ifdef PNG_FIXED_POINT_SUPPORTED void PNGAPI png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr, @@ -70,38 +94,61 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y, png_fixed_point blue_x, png_fixed_point blue_y) { - png_debug1(1, "in %s storage function", "cHRM fixed"); + png_debug1(1, "in %s storage function\n", "cHRM"); if (png_ptr == NULL || info_ptr == NULL) return; -#if !defined(PNG_NO_CHECK_cHRM) - if (png_check_cHRM_fixed(png_ptr, - white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y)) -#endif + if (!(white_x || white_y || red_x || red_y || green_x || green_y || + blue_x || blue_y)) { - info_ptr->int_x_white = white_x; - info_ptr->int_y_white = white_y; - info_ptr->int_x_red = red_x; - info_ptr->int_y_red = red_y; - info_ptr->int_x_green = green_x; - info_ptr->int_y_green = green_y; - info_ptr->int_x_blue = blue_x; - info_ptr->int_y_blue = blue_y; -#ifdef PNG_FLOATING_POINT_SUPPORTED - info_ptr->x_white = (float)(white_x/100000.); - info_ptr->y_white = (float)(white_y/100000.); - info_ptr->x_red = (float)( red_x/100000.); - info_ptr->y_red = (float)( red_y/100000.); - info_ptr->x_green = (float)(green_x/100000.); - info_ptr->y_green = (float)(green_y/100000.); - info_ptr->x_blue = (float)( blue_x/100000.); - info_ptr->y_blue = (float)( blue_y/100000.); -#endif - info_ptr->valid |= PNG_INFO_cHRM; + png_warning(png_ptr, + "Ignoring attempt to set all-zero chromaticity values"); + return; } + if (white_x < 0 || white_y < 0 || + red_x < 0 || red_y < 0 || + green_x < 0 || green_y < 0 || + blue_x < 0 || blue_y < 0) + { + png_warning(png_ptr, + "Ignoring attempt to set negative chromaticity value"); + return; + } + if (white_x > (png_fixed_point) PNG_UINT_31_MAX || + white_y > (png_fixed_point) PNG_UINT_31_MAX || + red_x > (png_fixed_point) PNG_UINT_31_MAX || + red_y > (png_fixed_point) PNG_UINT_31_MAX || + green_x > (png_fixed_point) PNG_UINT_31_MAX || + green_y > (png_fixed_point) PNG_UINT_31_MAX || + blue_x > (png_fixed_point) PNG_UINT_31_MAX || + blue_y > (png_fixed_point) PNG_UINT_31_MAX ) + { + png_warning(png_ptr, + "Ignoring attempt to set chromaticity value exceeding 21474.83"); + return; + } + info_ptr->int_x_white = white_x; + info_ptr->int_y_white = white_y; + info_ptr->int_x_red = red_x; + info_ptr->int_y_red = red_y; + info_ptr->int_x_green = green_x; + info_ptr->int_y_green = green_y; + info_ptr->int_x_blue = blue_x; + info_ptr->int_y_blue = blue_y; +#ifdef PNG_FLOATING_POINT_SUPPORTED + info_ptr->x_white = (float)(white_x/100000.); + info_ptr->y_white = (float)(white_y/100000.); + info_ptr->x_red = (float)( red_x/100000.); + info_ptr->y_red = (float)( red_y/100000.); + info_ptr->x_green = (float)(green_x/100000.); + info_ptr->y_green = (float)(green_y/100000.); + info_ptr->x_blue = (float)( blue_x/100000.); + info_ptr->y_blue = (float)( blue_y/100000.); +#endif + info_ptr->valid |= PNG_INFO_cHRM; } -#endif /* PNG_FIXED_POINT_SUPPORTED */ -#endif /* PNG_cHRM_SUPPORTED */ +#endif +#endif #if defined(PNG_gAMA_SUPPORTED) #ifdef PNG_FLOATING_POINT_SUPPORTED @@ -109,7 +156,7 @@ void PNGAPI png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma) { double gamma; - png_debug1(1, "in %s storage function", "gAMA"); + png_debug1(1, "in %s storage function\n", "gAMA"); if (png_ptr == NULL || info_ptr == NULL) return; @@ -136,7 +183,7 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point { png_fixed_point gamma; - png_debug1(1, "in %s storage function", "gAMA"); + png_debug1(1, "in %s storage function\n", "gAMA"); if (png_ptr == NULL || info_ptr == NULL) return; @@ -173,7 +220,7 @@ png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist) { int i; - png_debug1(1, "in %s storage function", "hIST"); + png_debug1(1, "in %s storage function\n", "hIST"); if (png_ptr == NULL || info_ptr == NULL) return; if (info_ptr->num_palette == 0 || info_ptr->num_palette @@ -216,7 +263,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr, int color_type, int interlace_type, int compression_type, int filter_type) { - png_debug1(1, "in %s storage function", "IHDR"); + png_debug1(1, "in %s storage function\n", "IHDR"); if (png_ptr == NULL || info_ptr == NULL) return; @@ -323,7 +370,7 @@ void PNGAPI png_set_oFFs(png_structp png_ptr, png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y, int unit_type) { - png_debug1(1, "in %s storage function", "oFFs"); + png_debug1(1, "in %s storage function\n", "oFFs"); if (png_ptr == NULL || info_ptr == NULL) return; @@ -343,12 +390,12 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length; int i; - png_debug1(1, "in %s storage function", "pCAL"); + png_debug1(1, "in %s storage function\n", "pCAL"); if (png_ptr == NULL || info_ptr == NULL) return; length = png_strlen(purpose) + 1; - png_debug1(3, "allocating purpose for info (%lu bytes)", + png_debug1(3, "allocating purpose for info (%lu bytes)\n", (unsigned long)length); info_ptr->pcal_purpose = (png_charp)png_malloc_warn(png_ptr, length); if (info_ptr->pcal_purpose == NULL) @@ -358,14 +405,14 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr, } png_memcpy(info_ptr->pcal_purpose, purpose, (png_size_t)length); - png_debug(3, "storing X0, X1, type, and nparams in info"); + png_debug(3, "storing X0, X1, type, and nparams in info\n"); info_ptr->pcal_X0 = X0; info_ptr->pcal_X1 = X1; info_ptr->pcal_type = (png_byte)type; info_ptr->pcal_nparams = (png_byte)nparams; length = png_strlen(units) + 1; - png_debug1(3, "allocating units for info (%lu bytes)", + png_debug1(3, "allocating units for info (%lu bytes)\n", (unsigned long)length); info_ptr->pcal_units = (png_charp)png_malloc_warn(png_ptr, length); if (info_ptr->pcal_units == NULL) @@ -383,16 +430,12 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr, return; } -#ifdef PNG_FREE_ME_SUPPORTED - info_ptr->free_me |= PNG_FREE_PCAL; -#endif - - png_memset(info_ptr->pcal_params, 0, (nparams + 1) * png_sizeof(png_charp)); + info_ptr->pcal_params[nparams] = NULL; for (i = 0; i < nparams; i++) { length = png_strlen(params[i]) + 1; - png_debug2(3, "allocating parameter %d for info (%lu bytes)", i, + png_debug2(3, "allocating parameter %d for info (%lu bytes)\n", i, (unsigned long)length); info_ptr->pcal_params[i] = (png_charp)png_malloc_warn(png_ptr, length); if (info_ptr->pcal_params[i] == NULL) @@ -404,6 +447,9 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr, } info_ptr->valid |= PNG_INFO_pCAL; +#ifdef PNG_FREE_ME_SUPPORTED + info_ptr->free_me |= PNG_FREE_PCAL; +#endif } #endif @@ -413,7 +459,7 @@ void PNGAPI png_set_sCAL(png_structp png_ptr, png_infop info_ptr, int unit, double width, double height) { - png_debug1(1, "in %s storage function", "sCAL"); + png_debug1(1, "in %s storage function\n", "sCAL"); if (png_ptr == NULL || info_ptr == NULL) return; @@ -431,14 +477,14 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr, { png_uint_32 length; - png_debug1(1, "in %s storage function", "sCAL"); + png_debug1(1, "in %s storage function\n", "sCAL"); if (png_ptr == NULL || info_ptr == NULL) return; info_ptr->scal_unit = (png_byte)unit; length = png_strlen(swidth) + 1; - png_debug1(3, "allocating unit for info (%u bytes)", + png_debug1(3, "allocating unit for info (%u bytes)\n", (unsigned int)length); info_ptr->scal_s_width = (png_charp)png_malloc_warn(png_ptr, length); if (info_ptr->scal_s_width == NULL) @@ -450,7 +496,7 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr, png_memcpy(info_ptr->scal_s_width, swidth, (png_size_t)length); length = png_strlen(sheight) + 1; - png_debug1(3, "allocating unit for info (%u bytes)", + png_debug1(3, "allocating unit for info (%u bytes)\n", (unsigned int)length); info_ptr->scal_s_height = (png_charp)png_malloc_warn(png_ptr, length); if (info_ptr->scal_s_height == NULL) @@ -476,7 +522,7 @@ void PNGAPI png_set_pHYs(png_structp png_ptr, png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type) { - png_debug1(1, "in %s storage function", "pHYs"); + png_debug1(1, "in %s storage function\n", "pHYs"); if (png_ptr == NULL || info_ptr == NULL) return; @@ -492,7 +538,7 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp palette, int num_palette) { - png_debug1(1, "in %s storage function", "PLTE"); + png_debug1(1, "in %s storage function\n", "PLTE"); if (png_ptr == NULL || info_ptr == NULL) return; @@ -541,7 +587,7 @@ void PNGAPI png_set_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p sig_bit) { - png_debug1(1, "in %s storage function", "sBIT"); + png_debug1(1, "in %s storage function\n", "sBIT"); if (png_ptr == NULL || info_ptr == NULL) return; @@ -554,7 +600,7 @@ png_set_sBIT(png_structp png_ptr, png_infop info_ptr, void PNGAPI png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int intent) { - png_debug1(1, "in %s storage function", "sRGB"); + png_debug1(1, "in %s storage function\n", "sRGB"); if (png_ptr == NULL || info_ptr == NULL) return; @@ -578,10 +624,12 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr, #ifdef PNG_FLOATING_POINT_SUPPORTED float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y; #endif +#ifdef PNG_FIXED_POINT_SUPPORTED png_fixed_point int_white_x, int_white_y, int_red_x, int_red_y, int_green_x, int_green_y, int_blue_x, int_blue_y; #endif - png_debug1(1, "in %s storage function", "sRGB_gAMA_and_cHRM"); +#endif + png_debug1(1, "in %s storage function\n", "sRGB_gAMA_and_cHRM"); if (png_ptr == NULL || info_ptr == NULL) return; @@ -599,6 +647,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr, #endif #if defined(PNG_cHRM_SUPPORTED) +#ifdef PNG_FIXED_POINT_SUPPORTED int_white_x = 31270L; int_white_y = 32900L; int_red_x = 64000L; @@ -608,6 +657,10 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr, int_blue_x = 15000L; int_blue_y = 6000L; + png_set_cHRM_fixed(png_ptr, info_ptr, + int_white_x, int_white_y, int_red_x, int_red_y, int_green_x, int_green_y, + int_blue_x, int_blue_y); +#endif #ifdef PNG_FLOATING_POINT_SUPPORTED white_x = (float).3127; white_y = (float).3290; @@ -617,27 +670,13 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr, green_y = (float).60; blue_x = (float).15; blue_y = (float).06; -#endif -#if !defined(PNG_NO_CHECK_cHRM) - if (png_check_cHRM_fixed(png_ptr, - int_white_x, int_white_y, int_red_x, int_red_y, int_green_x, - int_green_y, int_blue_x, int_blue_y)) + png_set_cHRM(png_ptr, info_ptr, + white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y); #endif - { -#ifdef PNG_FIXED_POINT_SUPPORTED - png_set_cHRM_fixed(png_ptr, info_ptr, - int_white_x, int_white_y, int_red_x, int_red_y, int_green_x, - int_green_y, int_blue_x, int_blue_y); #endif -#ifdef PNG_FLOATING_POINT_SUPPORTED - png_set_cHRM(png_ptr, info_ptr, - white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y); -#endif - } -#endif /* cHRM */ } -#endif /* sRGB */ +#endif #if defined(PNG_iCCP_SUPPORTED) @@ -650,7 +689,7 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr, png_charp new_iccp_profile; png_uint_32 length; - png_debug1(1, "in %s storage function", "iCCP"); + png_debug1(1, "in %s storage function\n", "iCCP"); if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL) return; @@ -704,7 +743,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, { int i; - png_debug1(1, "in %s storage function", (png_ptr->chunk_name[0] == '\0' ? + png_debug1(1, "in %s storage function\n", (png_ptr->chunk_name[0] == '\0' ? "text" : (png_const_charp)png_ptr->chunk_name)); if (png_ptr == NULL || info_ptr == NULL || num_text == 0) @@ -746,7 +785,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, info_ptr->free_me |= PNG_FREE_TEXT; #endif } - png_debug1(3, "allocated %d entries for info_ptr->text", + png_debug1(3, "allocated %d entries for info_ptr->text\n", info_ptr->max_text); } for (i = 0; i < num_text; i++) @@ -806,7 +845,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, (key_len + text_length + lang_len + lang_key_len + 4)); if (textp->key == NULL) return(1); - png_debug2(2, "Allocated %lu bytes at %x in png_set_text", + png_debug2(2, "Allocated %lu bytes at %x in png_set_text\n", (png_uint_32) (key_len + lang_len + lang_key_len + text_length + 4), (int)textp->key); @@ -854,7 +893,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, #endif } info_ptr->num_text++; - png_debug1(3, "transferred text chunk %d", info_ptr->num_text); + png_debug1(3, "transferred text chunk %d\n", info_ptr->num_text); } return(0); } @@ -864,7 +903,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, void PNGAPI png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time) { - png_debug1(1, "in %s storage function", "tIME"); + png_debug1(1, "in %s storage function\n", "tIME"); if (png_ptr == NULL || info_ptr == NULL || (png_ptr->mode & PNG_WROTE_tIME)) return; @@ -879,7 +918,7 @@ void PNGAPI png_set_tRNS(png_structp png_ptr, png_infop info_ptr, png_bytep trans, int num_trans, png_color_16p trans_values) { - png_debug1(1, "in %s storage function", "tRNS"); + png_debug1(1, "in %s storage function\n", "tRNS"); if (png_ptr == NULL || info_ptr == NULL) return; @@ -961,7 +1000,6 @@ png_set_sPLT(png_structp png_ptr, png_memcpy(np, info_ptr->splt_palettes, info_ptr->splt_palettes_num * png_sizeof(png_sPLT_t)); - png_free(png_ptr, info_ptr->splt_palettes); info_ptr->splt_palettes=NULL; @@ -1085,7 +1123,7 @@ png_permit_empty_plte (png_structp png_ptr, int empty_plte_permitted) { /* This function is deprecated in favor of png_permit_mng_features() and will be removed from libpng-1.3.0 */ - png_debug(1, "in png_permit_empty_plte, DEPRECATED."); + png_debug(1, "in png_permit_empty_plte, DEPRECATED.\n"); if (png_ptr == NULL) return; png_ptr->mng_features_permitted = (png_byte) @@ -1099,7 +1137,7 @@ png_permit_empty_plte (png_structp png_ptr, int empty_plte_permitted) png_uint_32 PNGAPI png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features) { - png_debug(1, "in png_permit_mng_features"); + png_debug(1, "in png_permit_mng_features\n"); if (png_ptr == NULL) return (png_uint_32)0; png_ptr->mng_features_permitted = @@ -1160,7 +1198,7 @@ void PNGAPI png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn) { - png_debug(1, "in png_set_read_user_chunk_fn"); + png_debug(1, "in png_set_read_user_chunk_fn\n"); if (png_ptr == NULL) return; png_ptr->read_user_chunk_fn = read_user_chunk_fn; @@ -1172,7 +1210,7 @@ png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr, void PNGAPI png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers) { - png_debug1(1, "in %s storage function", "rows"); + png_debug1(1, "in %s storage function\n", "rows"); if (png_ptr == NULL || info_ptr == NULL) return; @@ -1253,1274 +1291,3 @@ png_set_user_limits (png_structp png_ptr, png_uint_32 user_width_max, #endif /* ?PNG_1_0_X */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ - -/* pngset.c - storage of image information into info struct - * - * Last changed in libpng 1.2.17 May 15, 2007 - * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - * - * The functions here are used during reads to store data from the file - * into the info struct, and during writes to store application data - * into the info struct for writing into the file. This abstracts the - * info struct and allows us to change the structure in the future. - */ - -#define PNG_INTERNAL -#include "png.h" - -#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) - -#if defined(PNG_bKGD_SUPPORTED) -void PNGAPI -png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background) -{ - png_debug1(1, "in %s storage function\n", "bKGD"); - if (png_ptr == NULL || info_ptr == NULL) - return; - - png_memcpy(&(info_ptr->background), background, png_sizeof(png_color_16)); - info_ptr->valid |= PNG_INFO_bKGD; -} -#endif - -#if defined(PNG_cHRM_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED -void PNGAPI -png_set_cHRM(png_structp png_ptr, png_infop info_ptr, - double white_x, double white_y, double red_x, double red_y, - double green_x, double green_y, double blue_x, double blue_y) -{ - png_debug1(1, "in %s storage function\n", "cHRM"); - if (png_ptr == NULL || info_ptr == NULL) - return; - - if (white_x < 0.0 || white_y < 0.0 || - red_x < 0.0 || red_y < 0.0 || - green_x < 0.0 || green_y < 0.0 || - blue_x < 0.0 || blue_y < 0.0) - { - png_warning(png_ptr, - "Ignoring attempt to set negative chromaticity value"); - return; - } - if (white_x > 21474.83 || white_y > 21474.83 || - red_x > 21474.83 || red_y > 21474.83 || - green_x > 21474.83 || green_y > 21474.83 || - blue_x > 21474.83 || blue_y > 21474.83) - { - png_warning(png_ptr, - "Ignoring attempt to set chromaticity value exceeding 21474.83"); - return; - } - - info_ptr->x_white = (float)white_x; - info_ptr->y_white = (float)white_y; - info_ptr->x_red = (float)red_x; - info_ptr->y_red = (float)red_y; - info_ptr->x_green = (float)green_x; - info_ptr->y_green = (float)green_y; - info_ptr->x_blue = (float)blue_x; - info_ptr->y_blue = (float)blue_y; -#ifdef PNG_FIXED_POINT_SUPPORTED - info_ptr->int_x_white = (png_fixed_point)(white_x*100000.+0.5); - info_ptr->int_y_white = (png_fixed_point)(white_y*100000.+0.5); - info_ptr->int_x_red = (png_fixed_point)( red_x*100000.+0.5); - info_ptr->int_y_red = (png_fixed_point)( red_y*100000.+0.5); - info_ptr->int_x_green = (png_fixed_point)(green_x*100000.+0.5); - info_ptr->int_y_green = (png_fixed_point)(green_y*100000.+0.5); - info_ptr->int_x_blue = (png_fixed_point)( blue_x*100000.+0.5); - info_ptr->int_y_blue = (png_fixed_point)( blue_y*100000.+0.5); -#endif - info_ptr->valid |= PNG_INFO_cHRM; -} -#endif -#ifdef PNG_FIXED_POINT_SUPPORTED -void PNGAPI -png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr, - png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x, - png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y, - png_fixed_point blue_x, png_fixed_point blue_y) -{ - png_debug1(1, "in %s storage function\n", "cHRM"); - if (png_ptr == NULL || info_ptr == NULL) - return; - - if (white_x < 0 || white_y < 0 || - red_x < 0 || red_y < 0 || - green_x < 0 || green_y < 0 || - blue_x < 0 || blue_y < 0) - { - png_warning(png_ptr, - "Ignoring attempt to set negative chromaticity value"); - return; - } -#ifdef PNG_FLOATING_POINT_SUPPORTED - if (white_x > (double) PNG_UINT_31_MAX || - white_y > (double) PNG_UINT_31_MAX || - red_x > (double) PNG_UINT_31_MAX || - red_y > (double) PNG_UINT_31_MAX || - green_x > (double) PNG_UINT_31_MAX || - green_y > (double) PNG_UINT_31_MAX || - blue_x > (double) PNG_UINT_31_MAX || - blue_y > (double) PNG_UINT_31_MAX) -#else - if (white_x > (png_fixed_point) PNG_UINT_31_MAX/100000L || - white_y > (png_fixed_point) PNG_UINT_31_MAX/100000L || - red_x > (png_fixed_point) PNG_UINT_31_MAX/100000L || - red_y > (png_fixed_point) PNG_UINT_31_MAX/100000L || - green_x > (png_fixed_point) PNG_UINT_31_MAX/100000L || - green_y > (png_fixed_point) PNG_UINT_31_MAX/100000L || - blue_x > (png_fixed_point) PNG_UINT_31_MAX/100000L || - blue_y > (png_fixed_point) PNG_UINT_31_MAX/100000L) -#endif - { - png_warning(png_ptr, - "Ignoring attempt to set chromaticity value exceeding 21474.83"); - return; - } - info_ptr->int_x_white = white_x; - info_ptr->int_y_white = white_y; - info_ptr->int_x_red = red_x; - info_ptr->int_y_red = red_y; - info_ptr->int_x_green = green_x; - info_ptr->int_y_green = green_y; - info_ptr->int_x_blue = blue_x; - info_ptr->int_y_blue = blue_y; -#ifdef PNG_FLOATING_POINT_SUPPORTED - info_ptr->x_white = (float)(white_x/100000.); - info_ptr->y_white = (float)(white_y/100000.); - info_ptr->x_red = (float)( red_x/100000.); - info_ptr->y_red = (float)( red_y/100000.); - info_ptr->x_green = (float)(green_x/100000.); - info_ptr->y_green = (float)(green_y/100000.); - info_ptr->x_blue = (float)( blue_x/100000.); - info_ptr->y_blue = (float)( blue_y/100000.); -#endif - info_ptr->valid |= PNG_INFO_cHRM; -} -#endif -#endif - -#if defined(PNG_gAMA_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED -void PNGAPI -png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma) -{ - double gamma; - png_debug1(1, "in %s storage function\n", "gAMA"); - if (png_ptr == NULL || info_ptr == NULL) - return; - - /* Check for overflow */ - if (file_gamma > 21474.83) - { - png_warning(png_ptr, "Limiting gamma to 21474.83"); - gamma=21474.83; - } - else - gamma=file_gamma; - info_ptr->gamma = (float)gamma; -#ifdef PNG_FIXED_POINT_SUPPORTED - info_ptr->int_gamma = (int)(gamma*100000.+.5); -#endif - info_ptr->valid |= PNG_INFO_gAMA; - if(gamma == 0.0) - png_warning(png_ptr, "Setting gamma=0"); -} -#endif -void PNGAPI -png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point - int_gamma) -{ - png_fixed_point gamma; - - png_debug1(1, "in %s storage function\n", "gAMA"); - if (png_ptr == NULL || info_ptr == NULL) - return; - - if (int_gamma > (png_fixed_point) PNG_UINT_31_MAX) - { - png_warning(png_ptr, "Limiting gamma to 21474.83"); - gamma=PNG_UINT_31_MAX; - } - else - { - if (int_gamma < 0) - { - png_warning(png_ptr, "Setting negative gamma to zero"); - gamma=0; - } - else - gamma=int_gamma; - } -#ifdef PNG_FLOATING_POINT_SUPPORTED - info_ptr->gamma = (float)(gamma/100000.); -#endif -#ifdef PNG_FIXED_POINT_SUPPORTED - info_ptr->int_gamma = gamma; -#endif - info_ptr->valid |= PNG_INFO_gAMA; - if(gamma == 0) - png_warning(png_ptr, "Setting gamma=0"); -} -#endif - -#if defined(PNG_hIST_SUPPORTED) -void PNGAPI -png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist) -{ - int i; - - png_debug1(1, "in %s storage function\n", "hIST"); - if (png_ptr == NULL || info_ptr == NULL) - return; - if (info_ptr->num_palette <= 0 || info_ptr->num_palette - > PNG_MAX_PALETTE_LENGTH) - { - png_warning(png_ptr, - "Invalid palette size, hIST allocation skipped."); - return; - } - -#ifdef PNG_FREE_ME_SUPPORTED - png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0); -#endif - /* Changed from info->num_palette to PNG_MAX_PALETTE_LENGTH in version - 1.2.1 */ - png_ptr->hist = (png_uint_16p)png_malloc_warn(png_ptr, - (png_uint_32)(PNG_MAX_PALETTE_LENGTH * png_sizeof (png_uint_16))); - if (png_ptr->hist == NULL) - { - png_warning(png_ptr, "Insufficient memory for hIST chunk data."); - return; - } - - for (i = 0; i < info_ptr->num_palette; i++) - png_ptr->hist[i] = hist[i]; - info_ptr->hist = png_ptr->hist; - info_ptr->valid |= PNG_INFO_hIST; - -#ifdef PNG_FREE_ME_SUPPORTED - info_ptr->free_me |= PNG_FREE_HIST; -#else - png_ptr->flags |= PNG_FLAG_FREE_HIST; -#endif -} -#endif - -void PNGAPI -png_set_IHDR(png_structp png_ptr, png_infop info_ptr, - png_uint_32 width, png_uint_32 height, int bit_depth, - int color_type, int interlace_type, int compression_type, - int filter_type) -{ - png_debug1(1, "in %s storage function\n", "IHDR"); - if (png_ptr == NULL || info_ptr == NULL) - return; - - /* check for width and height valid values */ - if (width == 0 || height == 0) - png_error(png_ptr, "Image width or height is zero in IHDR"); -#ifdef PNG_SET_USER_LIMITS_SUPPORTED - if (width > png_ptr->user_width_max || height > png_ptr->user_height_max) - png_error(png_ptr, "image size exceeds user limits in IHDR"); -#else - if (width > PNG_USER_WIDTH_MAX || height > PNG_USER_HEIGHT_MAX) - png_error(png_ptr, "image size exceeds user limits in IHDR"); -#endif - if (width > PNG_UINT_31_MAX || height > PNG_UINT_31_MAX) - png_error(png_ptr, "Invalid image size in IHDR"); - if ( width > (PNG_UINT_32_MAX - >> 3) /* 8-byte RGBA pixels */ - - 64 /* bigrowbuf hack */ - - 1 /* filter byte */ - - 7*8 /* rounding of width to multiple of 8 pixels */ - - 8) /* extra max_pixel_depth pad */ - png_warning(png_ptr, "Width is too large for libpng to process pixels"); - - /* check other values */ - if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 && - bit_depth != 8 && bit_depth != 16) - png_error(png_ptr, "Invalid bit depth in IHDR"); - - if (color_type < 0 || color_type == 1 || - color_type == 5 || color_type > 6) - png_error(png_ptr, "Invalid color type in IHDR"); - - if (((color_type == PNG_COLOR_TYPE_PALETTE) && bit_depth > 8) || - ((color_type == PNG_COLOR_TYPE_RGB || - color_type == PNG_COLOR_TYPE_GRAY_ALPHA || - color_type == PNG_COLOR_TYPE_RGB_ALPHA) && bit_depth < 8)) - png_error(png_ptr, "Invalid color type/bit depth combination in IHDR"); - - if (interlace_type >= PNG_INTERLACE_LAST) - png_error(png_ptr, "Unknown interlace method in IHDR"); - - if (compression_type != PNG_COMPRESSION_TYPE_BASE) - png_error(png_ptr, "Unknown compression method in IHDR"); - -#if defined(PNG_MNG_FEATURES_SUPPORTED) - /* Accept filter_method 64 (intrapixel differencing) only if - * 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and - * 2. Libpng did not read a PNG signature (this filter_method is only - * used in PNG datastreams that are embedded in MNG datastreams) and - * 3. The application called png_permit_mng_features with a mask that - * included PNG_FLAG_MNG_FILTER_64 and - * 4. The filter_method is 64 and - * 5. The color_type is RGB or RGBA - */ - if((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)&&png_ptr->mng_features_permitted) - png_warning(png_ptr,"MNG features are not allowed in a PNG datastream"); - if(filter_type != PNG_FILTER_TYPE_BASE) - { - if(!((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) && - (filter_type == PNG_INTRAPIXEL_DIFFERENCING) && - ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) == 0) && - (color_type == PNG_COLOR_TYPE_RGB || - color_type == PNG_COLOR_TYPE_RGB_ALPHA))) - png_error(png_ptr, "Unknown filter method in IHDR"); - if(png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) - png_warning(png_ptr, "Invalid filter method in IHDR"); - } -#else - if(filter_type != PNG_FILTER_TYPE_BASE) - png_error(png_ptr, "Unknown filter method in IHDR"); -#endif - - info_ptr->width = width; - info_ptr->height = height; - info_ptr->bit_depth = (png_byte)bit_depth; - info_ptr->color_type =(png_byte) color_type; - info_ptr->compression_type = (png_byte)compression_type; - info_ptr->filter_type = (png_byte)filter_type; - info_ptr->interlace_type = (png_byte)interlace_type; - if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) - info_ptr->channels = 1; - else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR) - info_ptr->channels = 3; - else - info_ptr->channels = 1; - if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA) - info_ptr->channels++; - info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth); - - /* check for potential overflow */ - if ( width > (PNG_UINT_32_MAX - >> 3) /* 8-byte RGBA pixels */ - - 64 /* bigrowbuf hack */ - - 1 /* filter byte */ - - 7*8 /* rounding of width to multiple of 8 pixels */ - - 8) /* extra max_pixel_depth pad */ - info_ptr->rowbytes = (png_size_t)0; - else - info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth,width); -} - -#if defined(PNG_oFFs_SUPPORTED) -void PNGAPI -png_set_oFFs(png_structp png_ptr, png_infop info_ptr, - png_int_32 offset_x, png_int_32 offset_y, int unit_type) -{ - png_debug1(1, "in %s storage function\n", "oFFs"); - if (png_ptr == NULL || info_ptr == NULL) - return; - - info_ptr->x_offset = offset_x; - info_ptr->y_offset = offset_y; - info_ptr->offset_unit_type = (png_byte)unit_type; - info_ptr->valid |= PNG_INFO_oFFs; -} -#endif - -#if defined(PNG_pCAL_SUPPORTED) -void PNGAPI -png_set_pCAL(png_structp png_ptr, png_infop info_ptr, - png_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams, - png_charp units, png_charpp params) -{ - png_uint_32 length; - int i; - - png_debug1(1, "in %s storage function\n", "pCAL"); - if (png_ptr == NULL || info_ptr == NULL) - return; - - length = png_strlen(purpose) + 1; - png_debug1(3, "allocating purpose for info (%lu bytes)\n", length); - info_ptr->pcal_purpose = (png_charp)png_malloc_warn(png_ptr, length); - if (info_ptr->pcal_purpose == NULL) - { - png_warning(png_ptr, "Insufficient memory for pCAL purpose."); - return; - } - png_memcpy(info_ptr->pcal_purpose, purpose, (png_size_t)length); - - png_debug(3, "storing X0, X1, type, and nparams in info\n"); - info_ptr->pcal_X0 = X0; - info_ptr->pcal_X1 = X1; - info_ptr->pcal_type = (png_byte)type; - info_ptr->pcal_nparams = (png_byte)nparams; - - length = png_strlen(units) + 1; - png_debug1(3, "allocating units for info (%lu bytes)\n", length); - info_ptr->pcal_units = (png_charp)png_malloc_warn(png_ptr, length); - if (info_ptr->pcal_units == NULL) - { - png_warning(png_ptr, "Insufficient memory for pCAL units."); - return; - } - png_memcpy(info_ptr->pcal_units, units, (png_size_t)length); - - info_ptr->pcal_params = (png_charpp)png_malloc_warn(png_ptr, - (png_uint_32)((nparams + 1) * png_sizeof(png_charp))); - if (info_ptr->pcal_params == NULL) - { - png_warning(png_ptr, "Insufficient memory for pCAL params."); - return; - } - - info_ptr->pcal_params[nparams] = NULL; - - for (i = 0; i < nparams; i++) - { - length = png_strlen(params[i]) + 1; - png_debug2(3, "allocating parameter %d for info (%lu bytes)\n", i, length); - info_ptr->pcal_params[i] = (png_charp)png_malloc_warn(png_ptr, length); - if (info_ptr->pcal_params[i] == NULL) - { - png_warning(png_ptr, "Insufficient memory for pCAL parameter."); - return; - } - png_memcpy(info_ptr->pcal_params[i], params[i], (png_size_t)length); - } - - info_ptr->valid |= PNG_INFO_pCAL; -#ifdef PNG_FREE_ME_SUPPORTED - info_ptr->free_me |= PNG_FREE_PCAL; -#endif -} -#endif - -#if defined(PNG_READ_sCAL_SUPPORTED) || defined(PNG_WRITE_sCAL_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED -void PNGAPI -png_set_sCAL(png_structp png_ptr, png_infop info_ptr, - int unit, double width, double height) -{ - png_debug1(1, "in %s storage function\n", "sCAL"); - if (png_ptr == NULL || info_ptr == NULL) - return; - - info_ptr->scal_unit = (png_byte)unit; - info_ptr->scal_pixel_width = width; - info_ptr->scal_pixel_height = height; - - info_ptr->valid |= PNG_INFO_sCAL; -} -#else -#ifdef PNG_FIXED_POINT_SUPPORTED -void PNGAPI -png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr, - int unit, png_charp swidth, png_charp sheight) -{ - png_uint_32 length; - - png_debug1(1, "in %s storage function\n", "sCAL"); - if (png_ptr == NULL || info_ptr == NULL) - return; - - info_ptr->scal_unit = (png_byte)unit; - - length = png_strlen(swidth) + 1; - png_debug1(3, "allocating unit for info (%d bytes)\n", length); - info_ptr->scal_s_width = (png_charp)png_malloc_warn(png_ptr, length); - if (info_ptr->scal_s_width == NULL) - { - png_warning(png_ptr, "Memory allocation failed while processing sCAL."); - } - png_memcpy(info_ptr->scal_s_width, swidth, (png_size_t)length); - - length = png_strlen(sheight) + 1; - png_debug1(3, "allocating unit for info (%d bytes)\n", length); - info_ptr->scal_s_height = (png_charp)png_malloc_warn(png_ptr, length); - if (info_ptr->scal_s_height == NULL) - { - png_free (png_ptr, info_ptr->scal_s_width); - png_warning(png_ptr, "Memory allocation failed while processing sCAL."); - } - png_memcpy(info_ptr->scal_s_height, sheight, (png_size_t)length); - - info_ptr->valid |= PNG_INFO_sCAL; -#ifdef PNG_FREE_ME_SUPPORTED - info_ptr->free_me |= PNG_FREE_SCAL; -#endif -} -#endif -#endif -#endif - -#if defined(PNG_pHYs_SUPPORTED) -void PNGAPI -png_set_pHYs(png_structp png_ptr, png_infop info_ptr, - png_uint_32 res_x, png_uint_32 res_y, int unit_type) -{ - png_debug1(1, "in %s storage function\n", "pHYs"); - if (png_ptr == NULL || info_ptr == NULL) - return; - - info_ptr->x_pixels_per_unit = res_x; - info_ptr->y_pixels_per_unit = res_y; - info_ptr->phys_unit_type = (png_byte)unit_type; - info_ptr->valid |= PNG_INFO_pHYs; -} -#endif - -void PNGAPI -png_set_PLTE(png_structp png_ptr, png_infop info_ptr, - png_colorp palette, int num_palette) -{ - - png_debug1(1, "in %s storage function\n", "PLTE"); - if (png_ptr == NULL || info_ptr == NULL) - return; - - if (num_palette < 0 || num_palette > PNG_MAX_PALETTE_LENGTH) - { - if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) - png_error(png_ptr, "Invalid palette length"); - else - { - png_warning(png_ptr, "Invalid palette length"); - return; - } - } - - /* - * It may not actually be necessary to set png_ptr->palette here; - * we do it for backward compatibility with the way the png_handle_tRNS - * function used to do the allocation. - */ -#ifdef PNG_FREE_ME_SUPPORTED - png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0); -#endif - - /* Changed in libpng-1.2.1 to allocate PNG_MAX_PALETTE_LENGTH instead - of num_palette entries, - in case of an invalid PNG file that has too-large sample values. */ - png_ptr->palette = (png_colorp)png_malloc(png_ptr, - PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color)); - png_memset(png_ptr->palette, 0, PNG_MAX_PALETTE_LENGTH * - png_sizeof(png_color)); - png_memcpy(png_ptr->palette, palette, num_palette * png_sizeof (png_color)); - info_ptr->palette = png_ptr->palette; - info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette; - -#ifdef PNG_FREE_ME_SUPPORTED - info_ptr->free_me |= PNG_FREE_PLTE; -#else - png_ptr->flags |= PNG_FLAG_FREE_PLTE; -#endif - - info_ptr->valid |= PNG_INFO_PLTE; -} - -#if defined(PNG_sBIT_SUPPORTED) -void PNGAPI -png_set_sBIT(png_structp png_ptr, png_infop info_ptr, - png_color_8p sig_bit) -{ - png_debug1(1, "in %s storage function\n", "sBIT"); - if (png_ptr == NULL || info_ptr == NULL) - return; - - png_memcpy(&(info_ptr->sig_bit), sig_bit, png_sizeof (png_color_8)); - info_ptr->valid |= PNG_INFO_sBIT; -} -#endif - -#if defined(PNG_sRGB_SUPPORTED) -void PNGAPI -png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int intent) -{ - png_debug1(1, "in %s storage function\n", "sRGB"); - if (png_ptr == NULL || info_ptr == NULL) - return; - - info_ptr->srgb_intent = (png_byte)intent; - info_ptr->valid |= PNG_INFO_sRGB; -} - -void PNGAPI -png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr, - int intent) -{ -#if defined(PNG_gAMA_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED - float file_gamma; -#endif -#ifdef PNG_FIXED_POINT_SUPPORTED - png_fixed_point int_file_gamma; -#endif -#endif -#if defined(PNG_cHRM_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED - float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y; -#endif -#ifdef PNG_FIXED_POINT_SUPPORTED - png_fixed_point int_white_x, int_white_y, int_red_x, int_red_y, int_green_x, - int_green_y, int_blue_x, int_blue_y; -#endif -#endif - png_debug1(1, "in %s storage function\n", "sRGB_gAMA_and_cHRM"); - if (png_ptr == NULL || info_ptr == NULL) - return; - - png_set_sRGB(png_ptr, info_ptr, intent); - -#if defined(PNG_gAMA_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED - file_gamma = (float).45455; - png_set_gAMA(png_ptr, info_ptr, file_gamma); -#endif -#ifdef PNG_FIXED_POINT_SUPPORTED - int_file_gamma = 45455L; - png_set_gAMA_fixed(png_ptr, info_ptr, int_file_gamma); -#endif -#endif - -#if defined(PNG_cHRM_SUPPORTED) -#ifdef PNG_FIXED_POINT_SUPPORTED - int_white_x = 31270L; - int_white_y = 32900L; - int_red_x = 64000L; - int_red_y = 33000L; - int_green_x = 30000L; - int_green_y = 60000L; - int_blue_x = 15000L; - int_blue_y = 6000L; - - png_set_cHRM_fixed(png_ptr, info_ptr, - int_white_x, int_white_y, int_red_x, int_red_y, int_green_x, int_green_y, - int_blue_x, int_blue_y); -#endif -#ifdef PNG_FLOATING_POINT_SUPPORTED - white_x = (float).3127; - white_y = (float).3290; - red_x = (float).64; - red_y = (float).33; - green_x = (float).30; - green_y = (float).60; - blue_x = (float).15; - blue_y = (float).06; - - png_set_cHRM(png_ptr, info_ptr, - white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y); -#endif -#endif -} -#endif - - -#if defined(PNG_iCCP_SUPPORTED) -void PNGAPI -png_set_iCCP(png_structp png_ptr, png_infop info_ptr, - png_charp name, int compression_type, - png_charp profile, png_uint_32 proflen) -{ - png_charp new_iccp_name; - png_charp new_iccp_profile; - - png_debug1(1, "in %s storage function\n", "iCCP"); - if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL) - return; - - new_iccp_name = (png_charp)png_malloc_warn(png_ptr, png_strlen(name)+1); - if (new_iccp_name == NULL) - { - png_warning(png_ptr, "Insufficient memory to process iCCP chunk."); - return; - } - png_strcpy(new_iccp_name, name); - new_iccp_profile = (png_charp)png_malloc_warn(png_ptr, proflen); - if (new_iccp_profile == NULL) - { - png_free (png_ptr, new_iccp_name); - png_warning(png_ptr, "Insufficient memory to process iCCP profile."); - return; - } - png_memcpy(new_iccp_profile, profile, (png_size_t)proflen); - - png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, 0); - - info_ptr->iccp_proflen = proflen; - info_ptr->iccp_name = new_iccp_name; - info_ptr->iccp_profile = new_iccp_profile; - /* Compression is always zero but is here so the API and info structure - * does not have to change if we introduce multiple compression types */ - info_ptr->iccp_compression = (png_byte)compression_type; -#ifdef PNG_FREE_ME_SUPPORTED - info_ptr->free_me |= PNG_FREE_ICCP; -#endif - info_ptr->valid |= PNG_INFO_iCCP; -} -#endif - -#if defined(PNG_TEXT_SUPPORTED) -void PNGAPI -png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, - int num_text) -{ - int ret; - ret=png_set_text_2(png_ptr, info_ptr, text_ptr, num_text); - if (ret) - png_error(png_ptr, "Insufficient memory to store text"); -} - -int /* PRIVATE */ -png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, - int num_text) -{ - int i; - - png_debug1(1, "in %s storage function\n", (png_ptr->chunk_name[0] == '\0' ? - "text" : (png_const_charp)png_ptr->chunk_name)); - - if (png_ptr == NULL || info_ptr == NULL || num_text == 0) - return(0); - - /* Make sure we have enough space in the "text" array in info_struct - * to hold all of the incoming text_ptr objects. - */ - if (info_ptr->num_text + num_text > info_ptr->max_text) - { - if (info_ptr->text != NULL) - { - png_textp old_text; - int old_max; - - old_max = info_ptr->max_text; - info_ptr->max_text = info_ptr->num_text + num_text + 8; - old_text = info_ptr->text; - info_ptr->text = (png_textp)png_malloc_warn(png_ptr, - (png_uint_32)(info_ptr->max_text * png_sizeof (png_text))); - if (info_ptr->text == NULL) - { - png_free(png_ptr, old_text); - return(1); - } - png_memcpy(info_ptr->text, old_text, (png_size_t)(old_max * - png_sizeof(png_text))); - png_free(png_ptr, old_text); - } - else - { - info_ptr->max_text = num_text + 8; - info_ptr->num_text = 0; - info_ptr->text = (png_textp)png_malloc_warn(png_ptr, - (png_uint_32)(info_ptr->max_text * png_sizeof (png_text))); - if (info_ptr->text == NULL) - return(1); -#ifdef PNG_FREE_ME_SUPPORTED - info_ptr->free_me |= PNG_FREE_TEXT; -#endif - } - png_debug1(3, "allocated %d entries for info_ptr->text\n", - info_ptr->max_text); - } - for (i = 0; i < num_text; i++) - { - png_size_t text_length,key_len; - png_size_t lang_len,lang_key_len; - png_textp textp = &(info_ptr->text[info_ptr->num_text]); - - if (text_ptr[i].key == NULL) - continue; - - key_len = png_strlen(text_ptr[i].key); - - if(text_ptr[i].compression <= 0) - { - lang_len = 0; - lang_key_len = 0; - } - else -#ifdef PNG_iTXt_SUPPORTED - { - /* set iTXt data */ - if (text_ptr[i].lang != NULL) - lang_len = png_strlen(text_ptr[i].lang); - else - lang_len = 0; - if (text_ptr[i].lang_key != NULL) - lang_key_len = png_strlen(text_ptr[i].lang_key); - else - lang_key_len = 0; - } -#else - { - png_warning(png_ptr, "iTXt chunk not supported."); - continue; - } -#endif - - if (text_ptr[i].text == NULL || text_ptr[i].text[0] == '\0') - { - text_length = 0; -#ifdef PNG_iTXt_SUPPORTED - if(text_ptr[i].compression > 0) - textp->compression = PNG_ITXT_COMPRESSION_NONE; - else -#endif - textp->compression = PNG_TEXT_COMPRESSION_NONE; - } - else - { - text_length = png_strlen(text_ptr[i].text); - textp->compression = text_ptr[i].compression; - } - - textp->key = (png_charp)png_malloc_warn(png_ptr, - (png_uint_32)(key_len + text_length + lang_len + lang_key_len + 4)); - if (textp->key == NULL) - return(1); - png_debug2(2, "Allocated %lu bytes at %x in png_set_text\n", - (png_uint_32)(key_len + lang_len + lang_key_len + text_length + 4), - (int)textp->key); - - png_memcpy(textp->key, text_ptr[i].key, - (png_size_t)(key_len)); - *(textp->key+key_len) = '\0'; -#ifdef PNG_iTXt_SUPPORTED - if (text_ptr[i].compression > 0) - { - textp->lang=textp->key + key_len + 1; - png_memcpy(textp->lang, text_ptr[i].lang, lang_len); - *(textp->lang+lang_len) = '\0'; - textp->lang_key=textp->lang + lang_len + 1; - png_memcpy(textp->lang_key, text_ptr[i].lang_key, lang_key_len); - *(textp->lang_key+lang_key_len) = '\0'; - textp->text=textp->lang_key + lang_key_len + 1; - } - else -#endif - { -#ifdef PNG_iTXt_SUPPORTED - textp->lang=NULL; - textp->lang_key=NULL; -#endif - textp->text=textp->key + key_len + 1; - } - if(text_length) - png_memcpy(textp->text, text_ptr[i].text, - (png_size_t)(text_length)); - *(textp->text+text_length) = '\0'; - -#ifdef PNG_iTXt_SUPPORTED - if(textp->compression > 0) - { - textp->text_length = 0; - textp->itxt_length = text_length; - } - else -#endif - { - textp->text_length = text_length; -#ifdef PNG_iTXt_SUPPORTED - textp->itxt_length = 0; -#endif - } -#if 0 /* appears to be redundant; */ - info_ptr->text[info_ptr->num_text]= *textp; -#endif - info_ptr->num_text++; - png_debug1(3, "transferred text chunk %d\n", info_ptr->num_text); - } - return(0); -} -#endif - -#if defined(PNG_tIME_SUPPORTED) -void PNGAPI -png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time) -{ - png_debug1(1, "in %s storage function\n", "tIME"); - if (png_ptr == NULL || info_ptr == NULL || - (png_ptr->mode & PNG_WROTE_tIME)) - return; - - png_memcpy(&(info_ptr->mod_time), mod_time, png_sizeof (png_time)); - info_ptr->valid |= PNG_INFO_tIME; -} -#endif - -#if defined(PNG_tRNS_SUPPORTED) -void PNGAPI -png_set_tRNS(png_structp png_ptr, png_infop info_ptr, - png_bytep trans, int num_trans, png_color_16p trans_values) -{ - png_debug1(1, "in %s storage function\n", "tRNS"); - if (png_ptr == NULL || info_ptr == NULL) - return; - - if (trans != NULL) - { - /* - * It may not actually be necessary to set png_ptr->trans here; - * we do it for backward compatibility with the way the png_handle_tRNS - * function used to do the allocation. - */ -#ifdef PNG_FREE_ME_SUPPORTED - png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0); -#endif - /* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */ - png_ptr->trans = info_ptr->trans = (png_bytep)png_malloc(png_ptr, - (png_uint_32)PNG_MAX_PALETTE_LENGTH); - if (num_trans <= PNG_MAX_PALETTE_LENGTH) - png_memcpy(info_ptr->trans, trans, (png_size_t)num_trans); -#ifdef PNG_FREE_ME_SUPPORTED - info_ptr->free_me |= PNG_FREE_TRNS; -#else - png_ptr->flags |= PNG_FLAG_FREE_TRNS; -#endif - } - - if (trans_values != NULL) - { - png_memcpy(&(info_ptr->trans_values), trans_values, - png_sizeof(png_color_16)); - if (num_trans == 0) - num_trans = 1; - } - info_ptr->num_trans = (png_uint_16)num_trans; - info_ptr->valid |= PNG_INFO_tRNS; -} -#endif - -#if defined(PNG_sPLT_SUPPORTED) -void PNGAPI -png_set_sPLT(png_structp png_ptr, - png_infop info_ptr, png_sPLT_tp entries, int nentries) -{ - png_sPLT_tp np; - int i; - - if (png_ptr == NULL || info_ptr == NULL) - return; - - np = (png_sPLT_tp)png_malloc_warn(png_ptr, - (info_ptr->splt_palettes_num + nentries) * png_sizeof(png_sPLT_t)); - if (np == NULL) - { - png_warning(png_ptr, "No memory for sPLT palettes."); - return; - } - - png_memcpy(np, info_ptr->splt_palettes, - info_ptr->splt_palettes_num * png_sizeof(png_sPLT_t)); - png_free(png_ptr, info_ptr->splt_palettes); - info_ptr->splt_palettes=NULL; - - for (i = 0; i < nentries; i++) - { - png_sPLT_tp to = np + info_ptr->splt_palettes_num + i; - png_sPLT_tp from = entries + i; - - to->name = (png_charp)png_malloc(png_ptr, - png_strlen(from->name) + 1); - /* TODO: use png_malloc_warn */ - png_strcpy(to->name, from->name); - to->entries = (png_sPLT_entryp)png_malloc(png_ptr, - from->nentries * png_sizeof(png_sPLT_entry)); - /* TODO: use png_malloc_warn */ - png_memcpy(to->entries, from->entries, - from->nentries * png_sizeof(png_sPLT_entry)); - to->nentries = from->nentries; - to->depth = from->depth; - } - - info_ptr->splt_palettes = np; - info_ptr->splt_palettes_num += nentries; - info_ptr->valid |= PNG_INFO_sPLT; -#ifdef PNG_FREE_ME_SUPPORTED - info_ptr->free_me |= PNG_FREE_SPLT; -#endif -} -#endif /* PNG_sPLT_SUPPORTED */ - -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) -void PNGAPI -png_set_unknown_chunks(png_structp png_ptr, - png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns) -{ - png_unknown_chunkp np; - int i; - - if (png_ptr == NULL || info_ptr == NULL || num_unknowns == 0) - return; - - np = (png_unknown_chunkp)png_malloc_warn(png_ptr, - (info_ptr->unknown_chunks_num + num_unknowns) * - png_sizeof(png_unknown_chunk)); - if (np == NULL) - { - png_warning(png_ptr, "Out of memory while processing unknown chunk."); - return; - } - - png_memcpy(np, info_ptr->unknown_chunks, - info_ptr->unknown_chunks_num * png_sizeof(png_unknown_chunk)); - png_free(png_ptr, info_ptr->unknown_chunks); - info_ptr->unknown_chunks=NULL; - - for (i = 0; i < num_unknowns; i++) - { - png_unknown_chunkp to = np + info_ptr->unknown_chunks_num + i; - png_unknown_chunkp from = unknowns + i; - - png_strncpy((png_charp)to->name, (png_charp)from->name, 5); - to->data = (png_bytep)png_malloc_warn(png_ptr, from->size); - if (to->data == NULL) - { - png_warning(png_ptr, "Out of memory processing unknown chunk."); - } - else - { - png_memcpy(to->data, from->data, from->size); - to->size = from->size; - - /* note our location in the read or write sequence */ - to->location = (png_byte)(png_ptr->mode & 0xff); - } - } - - info_ptr->unknown_chunks = np; - info_ptr->unknown_chunks_num += num_unknowns; -#ifdef PNG_FREE_ME_SUPPORTED - info_ptr->free_me |= PNG_FREE_UNKN; -#endif -} -void PNGAPI -png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr, - int chunk, int location) -{ - if(png_ptr != NULL && info_ptr != NULL && chunk >= 0 && chunk < - (int)info_ptr->unknown_chunks_num) - info_ptr->unknown_chunks[chunk].location = (png_byte)location; -} -#endif - -#if defined(PNG_1_0_X) || defined(PNG_1_2_X) -#if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \ - defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED) -void PNGAPI -png_permit_empty_plte (png_structp png_ptr, int empty_plte_permitted) -{ - /* This function is deprecated in favor of png_permit_mng_features() - and will be removed from libpng-1.3.0 */ - png_debug(1, "in png_permit_empty_plte, DEPRECATED.\n"); - if (png_ptr == NULL) - return; - png_ptr->mng_features_permitted = (png_byte) - ((png_ptr->mng_features_permitted & (~(PNG_FLAG_MNG_EMPTY_PLTE))) | - ((empty_plte_permitted & PNG_FLAG_MNG_EMPTY_PLTE))); -} -#endif -#endif - -#if defined(PNG_MNG_FEATURES_SUPPORTED) -png_uint_32 PNGAPI -png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features) -{ - png_debug(1, "in png_permit_mng_features\n"); - if (png_ptr == NULL) - return (png_uint_32)0; - png_ptr->mng_features_permitted = - (png_byte)(mng_features & PNG_ALL_MNG_FEATURES); - return (png_uint_32)png_ptr->mng_features_permitted; -} -#endif - -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) -void PNGAPI -png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep - chunk_list, int num_chunks) -{ - png_bytep new_list, p; - int i, old_num_chunks; - if (png_ptr == NULL) - return; - if (num_chunks == 0) - { - if(keep == PNG_HANDLE_CHUNK_ALWAYS || keep == PNG_HANDLE_CHUNK_IF_SAFE) - png_ptr->flags |= PNG_FLAG_KEEP_UNKNOWN_CHUNKS; - else - png_ptr->flags &= ~PNG_FLAG_KEEP_UNKNOWN_CHUNKS; - - if(keep == PNG_HANDLE_CHUNK_ALWAYS) - png_ptr->flags |= PNG_FLAG_KEEP_UNSAFE_CHUNKS; - else - png_ptr->flags &= ~PNG_FLAG_KEEP_UNSAFE_CHUNKS; - return; - } - if (chunk_list == NULL) - return; - old_num_chunks=png_ptr->num_chunk_list; - new_list=(png_bytep)png_malloc(png_ptr, - (png_uint_32)(5*(num_chunks+old_num_chunks))); - if(png_ptr->chunk_list != NULL) - { - png_memcpy(new_list, png_ptr->chunk_list, - (png_size_t)(5*old_num_chunks)); - png_free(png_ptr, png_ptr->chunk_list); - png_ptr->chunk_list=NULL; - } - png_memcpy(new_list+5*old_num_chunks, chunk_list, - (png_size_t)(5*num_chunks)); - for (p=new_list+5*old_num_chunks+4, i=0; inum_chunk_list=old_num_chunks+num_chunks; - png_ptr->chunk_list=new_list; -#ifdef PNG_FREE_ME_SUPPORTED - png_ptr->free_me |= PNG_FREE_LIST; -#endif -} -#endif - -#if defined(PNG_READ_USER_CHUNKS_SUPPORTED) -void PNGAPI -png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr, - png_user_chunk_ptr read_user_chunk_fn) -{ - png_debug(1, "in png_set_read_user_chunk_fn\n"); - if (png_ptr == NULL) - return; - png_ptr->read_user_chunk_fn = read_user_chunk_fn; - png_ptr->user_chunk_ptr = user_chunk_ptr; -} -#endif - -#if defined(PNG_INFO_IMAGE_SUPPORTED) -void PNGAPI -png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers) -{ - png_debug1(1, "in %s storage function\n", "rows"); - - if (png_ptr == NULL || info_ptr == NULL) - return; - - if(info_ptr->row_pointers && (info_ptr->row_pointers != row_pointers)) - png_free_data(png_ptr, info_ptr, PNG_FREE_ROWS, 0); - info_ptr->row_pointers = row_pointers; - if(row_pointers) - info_ptr->valid |= PNG_INFO_IDAT; -} -#endif - -#ifdef PNG_WRITE_SUPPORTED -void PNGAPI -png_set_compression_buffer_size(png_structp png_ptr, png_uint_32 size) -{ - if (png_ptr == NULL) - return; - if(png_ptr->zbuf) - png_free(png_ptr, png_ptr->zbuf); - png_ptr->zbuf_size = (png_size_t)size; - png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, size); - png_ptr->zstream.next_out = png_ptr->zbuf; - png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; -} -#endif - -void PNGAPI -png_set_invalid(png_structp png_ptr, png_infop info_ptr, int mask) -{ - if (png_ptr && info_ptr) - info_ptr->valid &= ~(mask); -} - - -#ifndef PNG_1_0_X -#ifdef PNG_ASSEMBLER_CODE_SUPPORTED -/* this function was added to libpng 1.2.0 and should always exist by default */ -void PNGAPI -png_set_asm_flags (png_structp png_ptr, png_uint_32 asm_flags) -{ -#ifdef PNG_MMX_CODE_SUPPORTED - png_uint_32 settable_asm_flags; - png_uint_32 settable_mmx_flags; -#endif - if (png_ptr == NULL) - return; -#ifdef PNG_MMX_CODE_SUPPORTED - - settable_mmx_flags = -#ifdef PNG_HAVE_MMX_COMBINE_ROW - PNG_ASM_FLAG_MMX_READ_COMBINE_ROW | -#endif -#ifdef PNG_HAVE_MMX_READ_INTERLACE - PNG_ASM_FLAG_MMX_READ_INTERLACE | -#endif -#ifdef PNG_HAVE_MMX_READ_FILTER_ROW - PNG_ASM_FLAG_MMX_READ_FILTER_SUB | - PNG_ASM_FLAG_MMX_READ_FILTER_UP | - PNG_ASM_FLAG_MMX_READ_FILTER_AVG | - PNG_ASM_FLAG_MMX_READ_FILTER_PAETH | -#endif - 0; - - /* could be some non-MMX ones in the future, but not currently: */ - settable_asm_flags = settable_mmx_flags; - - if (!(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_COMPILED) || - !(png_ptr->asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU)) - { - /* clear all MMX flags if MMX isn't supported */ - settable_asm_flags &= ~settable_mmx_flags; - png_ptr->asm_flags &= ~settable_mmx_flags; - } - - /* we're replacing the settable bits with those passed in by the user, - * so first zero them out of the master copy, then bitwise-OR in the - * allowed subset that was requested */ - - png_ptr->asm_flags &= ~settable_asm_flags; /* zero them */ - png_ptr->asm_flags |= (asm_flags & settable_asm_flags); /* set them */ -#endif /* ?PNG_MMX_CODE_SUPPORTED */ -} - -/* this function was added to libpng 1.2.0 */ -void PNGAPI -png_set_mmx_thresholds (png_structp png_ptr, - png_byte mmx_bitdepth_threshold, - png_uint_32 mmx_rowbytes_threshold) -{ - if (png_ptr == NULL) - return; -#ifdef PNG_MMX_CODE_SUPPORTED - png_ptr->mmx_bitdepth_threshold = mmx_bitdepth_threshold; - png_ptr->mmx_rowbytes_threshold = mmx_rowbytes_threshold; -#endif /* ?PNG_MMX_CODE_SUPPORTED */ -} -#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */ - -#ifdef PNG_SET_USER_LIMITS_SUPPORTED -/* this function was added to libpng 1.2.6 */ -void PNGAPI -png_set_user_limits (png_structp png_ptr, png_uint_32 user_width_max, - png_uint_32 user_height_max) -{ - /* Images with dimensions larger than these limits will be - * rejected by png_set_IHDR(). To accept any PNG datastream - * regardless of dimensions, set both limits to 0x7ffffffL. - */ - if(png_ptr == NULL) return; - png_ptr->user_width_max = user_width_max; - png_ptr->user_height_max = user_height_max; -} -#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */ - -#endif /* ?PNG_1_0_X */ -#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ diff --git a/src/dep/src/irrlicht/libpng/pngtest.c b/src/dep/src/irrlicht/libpng/pngtest.c index cc9286a..3eeb4f8 100644 --- a/src/dep/src/irrlicht/libpng/pngtest.c +++ b/src/dep/src/irrlicht/libpng/pngtest.c @@ -717,7 +717,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) return (1); } - png_debug(0, "Allocating read and write structures"); + png_debug(0, "Allocating read and write structures\n"); #if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG read_ptr = png_create_read_struct_2(PNG_LIBPNG_VER_STRING, png_voidp_NULL, @@ -758,7 +758,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) pngtest_warning); #endif #endif - png_debug(0, "Allocating read_info, write_info and end_info structures"); + png_debug(0, "Allocating read_info, write_info and end_info structures\n"); read_info_ptr = png_create_info_struct(read_ptr); end_info_ptr = png_create_info_struct(read_ptr); #ifdef PNG_WRITE_SUPPORTED @@ -767,7 +767,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) #endif #ifdef PNG_SETJMP_SUPPORTED - png_debug(0, "Setting jmpbuf for read struct"); + png_debug(0, "Setting jmpbuf for read struct\n"); #ifdef USE_FAR_KEYWORD if (setjmp(jmpbuf)) #else @@ -791,7 +791,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) #endif #ifdef PNG_WRITE_SUPPORTED - png_debug(0, "Setting jmpbuf for write struct"); + png_debug(0, "Setting jmpbuf for write struct\n"); #ifdef USE_FAR_KEYWORD if (setjmp(jmpbuf)) #else @@ -814,7 +814,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) #endif #endif - png_debug(0, "Initializing input and output streams"); + png_debug(0, "Initializing input and output streams\n"); #if !defined(PNG_NO_STDIO) png_init_io(read_ptr, fpin); # ifdef PNG_WRITE_SUPPORTED @@ -874,10 +874,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) png_bytep_NULL, 0); #endif - png_debug(0, "Reading info struct"); + png_debug(0, "Reading info struct\n"); png_read_info(read_ptr, read_info_ptr); - png_debug(0, "Transferring info struct"); + png_debug(0, "Transferring info struct\n"); { int interlace_type, compression_type, filter_type; @@ -1077,7 +1077,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) if (png_get_text(read_ptr, read_info_ptr, &text_ptr, &num_text) > 0) { - png_debug1(0, "Handling %d iTXt/tEXt/zTXt chunks", num_text); + png_debug1(0, "Handling %d iTXt/tEXt/zTXt chunks\n", num_text); png_set_text(write_ptr, write_info_ptr, text_ptr, num_text); } } @@ -1145,7 +1145,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) #endif #ifdef PNG_WRITE_SUPPORTED - png_debug(0, "Writing info struct"); + png_debug(0, "\nWriting info struct\n"); /* If we wanted, we could write info in two steps: png_write_info_before_PLTE(write_ptr, write_info_ptr); @@ -1188,12 +1188,12 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) #endif #ifdef SINGLE_ROWBUF_ALLOC - png_debug(0, "Allocating row buffer..."); + png_debug(0, "\nAllocating row buffer..."); row_buf = (png_bytep)png_malloc(read_ptr, png_get_rowbytes(read_ptr, read_info_ptr)); - png_debug1(0, "0x%08lx", (unsigned long)row_buf); + png_debug1(0, "0x%08lx\n\n", (unsigned long)row_buf); #endif /* SINGLE_ROWBUF_ALLOC */ - png_debug(0, "Writing row data"); + png_debug(0, "Writing row data\n"); #if defined(PNG_READ_INTERLACING_SUPPORTED) || \ defined(PNG_WRITE_INTERLACING_SUPPORTED) @@ -1212,14 +1212,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) #endif for (pass = 0; pass < num_pass; pass++) { - png_debug1(0, "Writing row data for pass %d", pass); + png_debug1(0, "Writing row data for pass %d\n", pass); for (y = 0; y < height; y++) { #ifndef SINGLE_ROWBUF_ALLOC - png_debug2(0, "Allocating row buffer (pass %d, y = %ld)...", pass, y); + png_debug2(0, "\nAllocating row buffer (pass %d, y = %ld)...", pass, y); row_buf = (png_bytep)png_malloc(read_ptr, png_get_rowbytes(read_ptr, read_info_ptr)); - png_debug2(0, "0x%08lx (%ld bytes)", (unsigned long)row_buf, + png_debug2(0, "0x%08lx (%ld bytes)\n", (unsigned long)row_buf, png_get_rowbytes(read_ptr, read_info_ptr)); #endif /* !SINGLE_ROWBUF_ALLOC */ png_read_rows(read_ptr, (png_bytepp)&row_buf, png_bytepp_NULL, 1); @@ -1239,7 +1239,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) #endif /* PNG_WRITE_SUPPORTED */ #ifndef SINGLE_ROWBUF_ALLOC - png_debug2(0, "Freeing row buffer (pass %d, y = %ld)", pass, y); + png_debug2(0, "Freeing row buffer (pass %d, y = %ld)\n\n", pass, y); png_free(read_ptr, row_buf); row_buf = NULL; #endif /* !SINGLE_ROWBUF_ALLOC */ @@ -1253,7 +1253,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) png_free_data(write_ptr, write_info_ptr, PNG_FREE_UNKN, -1); #endif - png_debug(0, "Reading and writing end_info data"); + png_debug(0, "Reading and writing end_info data\n"); png_read_end(read_ptr, end_info_ptr); #if defined(PNG_TEXT_SUPPORTED) @@ -1263,7 +1263,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) if (png_get_text(read_ptr, end_info_ptr, &text_ptr, &num_text) > 0) { - png_debug1(0, "Handling %d iTXt/tEXt/zTXt chunks", num_text); + png_debug1(0, "Handling %d iTXt/tEXt/zTXt chunks\n", num_text); png_set_text(write_ptr, write_end_info_ptr, text_ptr, num_text); } } @@ -1323,26 +1323,26 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) } #endif - png_debug(0, "Destroying data structs"); + png_debug(0, "Destroying data structs\n"); #ifdef SINGLE_ROWBUF_ALLOC - png_debug(1, "destroying row_buf for read_ptr"); + png_debug(1, "destroying row_buf for read_ptr\n"); png_free(read_ptr, row_buf); row_buf = NULL; #endif /* SINGLE_ROWBUF_ALLOC */ - png_debug(1, "destroying read_ptr, read_info_ptr, end_info_ptr"); + png_debug(1, "destroying read_ptr, read_info_ptr, end_info_ptr\n"); png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr); #ifdef PNG_WRITE_SUPPORTED - png_debug(1, "destroying write_end_info_ptr"); + png_debug(1, "destroying write_end_info_ptr\n"); png_destroy_info_struct(write_ptr, &write_end_info_ptr); - png_debug(1, "destroying write_ptr, write_info_ptr"); + png_debug(1, "destroying write_ptr, write_info_ptr\n"); png_destroy_write_struct(&write_ptr, &write_info_ptr); #endif - png_debug(0, "Destruction complete."); + png_debug(0, "Destruction complete.\n"); FCLOSE(fpin); FCLOSE(fpout); - png_debug(0, "Opening files for comparison"); + png_debug(0, "Opening files for comparison\n"); #if defined(_WIN32_WCE) MultiByteToWideChar(CP_ACP, 0, inname, -1, path, MAX_PATH); if ((fpin = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE) @@ -1685,1558 +1685,4 @@ main(int argc, char *argv[]) } /* Generate a compiler error if there is an old png.h in the search path. */ -typedef version_1_2_35 your_png_h_is_not_version_1_2_35; - -/* pngtest.c - a simple test program to test libpng - * - * Last changed in libpng 1.2.6 - August 15, 2004 - * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2004 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - * - * This program reads in a PNG image, writes it out again, and then - * compares the two files. If the files are identical, this shows that - * the basic chunk handling, filtering, and (de)compression code is working - * properly. It does not currently test all of the transforms, although - * it probably should. - * - * The program will report "FAIL" in certain legitimate cases: - * 1) when the compression level or filter selection method is changed. - * 2) when the maximum IDAT size (PNG_ZBUF_SIZE in pngconf.h) is not 8192. - * 3) unknown unsafe-to-copy ancillary chunks or unknown critical chunks - * exist in the input file. - * 4) others not listed here... - * In these cases, it is best to check with another tool such as "pngcheck" - * to see what the differences between the two files are. - * - * If a filename is given on the command-line, then this file is used - * for the input, rather than the default "pngtest.png". This allows - * testing a wide variety of files easily. You can also test a number - * of files at once by typing "pngtest -m file1.png file2.png ..." - */ - -#include "png.h" - -#if defined(_WIN32_WCE) -# if _WIN32_WCE < 211 - __error__ (f|w)printf functions are not supported on old WindowsCE.; -# endif -# include -# include -# define READFILE(file, data, length, check) \ - if (ReadFile(file, data, length, &check,NULL)) check = 0 -# define WRITEFILE(file, data, length, check)) \ - if (WriteFile(file, data, length, &check, NULL)) check = 0 -# define FCLOSE(file) CloseHandle(file) -#else -# include -# include -# define READFILE(file, data, length, check) \ - check=(png_size_t)fread(data,(png_size_t)1,length,file) -# define WRITEFILE(file, data, length, check) \ - check=(png_size_t)fwrite(data,(png_size_t)1, length, file) -# define FCLOSE(file) fclose(file) -#endif - -#if defined(PNG_NO_STDIO) -# if defined(_WIN32_WCE) - typedef HANDLE png_FILE_p; -# else - typedef FILE * png_FILE_p; -# endif -#endif - -/* Makes pngtest verbose so we can find problems (needs to be before png.h) */ -#ifndef PNG_DEBUG -# define PNG_DEBUG 0 -#endif - -#if !PNG_DEBUG -# define SINGLE_ROWBUF_ALLOC /* makes buffer overruns easier to nail */ -#endif - -/* Turn on CPU timing -#define PNGTEST_TIMING -*/ - -#ifdef PNG_NO_FLOATING_POINT_SUPPORTED -#undef PNGTEST_TIMING -#endif - -#ifdef PNGTEST_TIMING -static float t_start, t_stop, t_decode, t_encode, t_misc; -#include -#endif - -#if defined(PNG_TIME_RFC1123_SUPPORTED) -static int tIME_chunk_present=0; -static char tIME_string[30] = "no tIME chunk present in file"; -#endif - -static int verbose = 0; - -int test_one_file PNGARG((PNG_CONST char *inname, PNG_CONST char *outname)); - -#ifdef __TURBOC__ -#include -#endif - -/* defined so I can write to a file on gui/windowing platforms */ -/* #define STDERR stderr */ -#define STDERR stdout /* for DOS */ - -/* example of using row callbacks to make a simple progress meter */ -static int status_pass=1; -static int status_dots_requested=0; -static int status_dots=1; - -/* In case a system header (e.g., on AIX) defined jmpbuf */ -#ifdef jmpbuf -# undef jmpbuf -#endif - -/* Define png_jmpbuf() in case we are using a pre-1.0.6 version of libpng */ -#ifndef png_jmpbuf -# define png_jmpbuf(png_ptr) png_ptr->jmpbuf -#endif - -void -#ifdef PNG_1_0_X -PNGAPI -#endif -read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass); -void -#ifdef PNG_1_0_X -PNGAPI -#endif -read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass) -{ - if(png_ptr == NULL || row_number > PNG_UINT_31_MAX) return; - if(status_pass != pass) - { - fprintf(stdout,"\n Pass %d: ",pass); - status_pass = pass; - status_dots = 31; - } - status_dots--; - if(status_dots == 0) - { - fprintf(stdout, "\n "); - status_dots=30; - } - fprintf(stdout, "r"); -} - -void -#ifdef PNG_1_0_X -PNGAPI -#endif -write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass); -void -#ifdef PNG_1_0_X -PNGAPI -#endif -write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass) -{ - if(png_ptr == NULL || row_number > PNG_UINT_31_MAX || pass > 7) return; - fprintf(stdout, "w"); -} - - -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) -/* Example of using user transform callback (we don't transform anything, - but merely examine the row filters. We set this to 256 rather than - 5 in case illegal filter values are present.) */ -static png_uint_32 filters_used[256]; -void -#ifdef PNG_1_0_X -PNGAPI -#endif -count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data); -void -#ifdef PNG_1_0_X -PNGAPI -#endif -count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data) -{ - if(png_ptr != NULL && row_info != NULL) - ++filters_used[*(data-1)]; -} -#endif - -#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) -/* example of using user transform callback (we don't transform anything, - but merely count the zero samples) */ - -static png_uint_32 zero_samples; - -void -#ifdef PNG_1_0_X -PNGAPI -#endif -count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data); -void -#ifdef PNG_1_0_X -PNGAPI -#endif -count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data) -{ - png_bytep dp = data; - if(png_ptr == NULL)return; - - /* contents of row_info: - * png_uint_32 width width of row - * png_uint_32 rowbytes number of bytes in row - * png_byte color_type color type of pixels - * png_byte bit_depth bit depth of samples - * png_byte channels number of channels (1-4) - * png_byte pixel_depth bits per pixel (depth*channels) - */ - - - /* counts the number of zero samples (or zero pixels if color_type is 3 */ - - if(row_info->color_type == 0 || row_info->color_type == 3) - { - int pos=0; - png_uint_32 n, nstop; - for (n=0, nstop=row_info->width; nbit_depth == 1) - { - if(((*dp << pos++ ) & 0x80) == 0) zero_samples++; - if(pos == 8) - { - pos = 0; - dp++; - } - } - if(row_info->bit_depth == 2) - { - if(((*dp << (pos+=2)) & 0xc0) == 0) zero_samples++; - if(pos == 8) - { - pos = 0; - dp++; - } - } - if(row_info->bit_depth == 4) - { - if(((*dp << (pos+=4)) & 0xf0) == 0) zero_samples++; - if(pos == 8) - { - pos = 0; - dp++; - } - } - if(row_info->bit_depth == 8) - if(*dp++ == 0) zero_samples++; - if(row_info->bit_depth == 16) - { - if((*dp | *(dp+1)) == 0) zero_samples++; - dp+=2; - } - } - } - else /* other color types */ - { - png_uint_32 n, nstop; - int channel; - int color_channels = row_info->channels; - if(row_info->color_type > 3)color_channels--; - - for (n=0, nstop=row_info->width; nbit_depth == 8) - if(*dp++ == 0) zero_samples++; - if(row_info->bit_depth == 16) - { - if((*dp | *(dp+1)) == 0) zero_samples++; - dp+=2; - } - } - if(row_info->color_type > 3) - { - dp++; - if(row_info->bit_depth == 16)dp++; - } - } - } -} -#endif /* PNG_WRITE_USER_TRANSFORM_SUPPORTED */ - -static int wrote_question = 0; - -#if defined(PNG_NO_STDIO) -/* START of code to validate stdio-free compilation */ -/* These copies of the default read/write functions come from pngrio.c and */ -/* pngwio.c. They allow "don't include stdio" testing of the library. */ -/* This is the function that does the actual reading of data. If you are - not reading from a standard C stream, you should create a replacement - read_data function and use it at run time with png_set_read_fn(), rather - than changing the library. */ - -#ifndef USE_FAR_KEYWORD -static void -pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length) -{ - png_size_t check; - - /* fread() returns 0 on error, so it is OK to store this in a png_size_t - * instead of an int, which is what fread() actually returns. - */ - READFILE((png_FILE_p)png_ptr->io_ptr, data, length, check); - - if (check != length) - { - png_error(png_ptr, "Read Error!"); - } -} -#else -/* this is the model-independent version. Since the standard I/O library - can't handle far buffers in the medium and small models, we have to copy - the data. -*/ - -#define NEAR_BUF_SIZE 1024 -#define MIN(a,b) (a <= b ? a : b) - -static void -pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length) -{ - int check; - png_byte *n_data; - png_FILE_p io_ptr; - - /* Check if data really is near. If so, use usual code. */ - n_data = (png_byte *)CVT_PTR_NOCHECK(data); - io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr); - if ((png_bytep)n_data == data) - { - READFILE(io_ptr, n_data, length, check); - } - else - { - png_byte buf[NEAR_BUF_SIZE]; - png_size_t read, remaining, err; - check = 0; - remaining = length; - do - { - read = MIN(NEAR_BUF_SIZE, remaining); - READFILE(io_ptr, buf, 1, err); - png_memcpy(data, buf, read); /* copy far buffer to near buffer */ - if(err != read) - break; - else - check += err; - data += read; - remaining -= read; - } - while (remaining != 0); - } - if (check != length) - { - png_error(png_ptr, "read Error"); - } -} -#endif /* USE_FAR_KEYWORD */ - -#if defined(PNG_WRITE_FLUSH_SUPPORTED) -static void -pngtest_flush(png_structp png_ptr) -{ -#if !defined(_WIN32_WCE) - png_FILE_p io_ptr; - io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr)); - if (io_ptr != NULL) - fflush(io_ptr); -#endif -} -#endif - -/* This is the function that does the actual writing of data. If you are - not writing to a standard C stream, you should create a replacement - write_data function and use it at run time with png_set_write_fn(), rather - than changing the library. */ -#ifndef USE_FAR_KEYWORD -static void -pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length) -{ - png_uint_32 check; - - WRITEFILE((png_FILE_p)png_ptr->io_ptr, data, length, check); - if (check != length) - { - png_error(png_ptr, "Write Error"); - } -} -#else -/* this is the model-independent version. Since the standard I/O library - can't handle far buffers in the medium and small models, we have to copy - the data. -*/ - -#define NEAR_BUF_SIZE 1024 -#define MIN(a,b) (a <= b ? a : b) - -static void -pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length) -{ - png_uint_32 check; - png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */ - png_FILE_p io_ptr; - - /* Check if data really is near. If so, use usual code. */ - near_data = (png_byte *)CVT_PTR_NOCHECK(data); - io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr); - if ((png_bytep)near_data == data) - { - WRITEFILE(io_ptr, near_data, length, check); - } - else - { - png_byte buf[NEAR_BUF_SIZE]; - png_size_t written, remaining, err; - check = 0; - remaining = length; - do - { - written = MIN(NEAR_BUF_SIZE, remaining); - png_memcpy(buf, data, written); /* copy far buffer to near buffer */ - WRITEFILE(io_ptr, buf, written, err); - if (err != written) - break; - else - check += err; - data += written; - remaining -= written; - } - while (remaining != 0); - } - if (check != length) - { - png_error(png_ptr, "Write Error"); - } -} - -#endif /* USE_FAR_KEYWORD */ - -/* This function is called when there is a warning, but the library thinks - * it can continue anyway. Replacement functions don't have to do anything - * here if you don't want to. In the default configuration, png_ptr is - * not used, but it is passed in case it may be useful. - */ -static void -pngtest_warning(png_structp png_ptr, png_const_charp message) -{ - PNG_CONST char *name = "UNKNOWN (ERROR!)"; - if (png_ptr != NULL && png_ptr->error_ptr != NULL) - name = png_ptr->error_ptr; - fprintf(STDERR, "%s: libpng warning: %s\n", name, message); -} - -/* This is the default error handling function. Note that replacements for - * this function MUST NOT RETURN, or the program will likely crash. This - * function is used by default, or if the program supplies NULL for the - * error function pointer in png_set_error_fn(). - */ -static void -pngtest_error(png_structp png_ptr, png_const_charp message) -{ - pngtest_warning(png_ptr, message); - /* We can return because png_error calls the default handler, which is - * actually OK in this case. */ -} -#endif /* PNG_NO_STDIO */ -/* END of code to validate stdio-free compilation */ - -/* START of code to validate memory allocation and deallocation */ -#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG - -/* Allocate memory. For reasonable files, size should never exceed - 64K. However, zlib may allocate more then 64K if you don't tell - it not to. See zconf.h and png.h for more information. zlib does - need to allocate exactly 64K, so whatever you call here must - have the ability to do that. - - This piece of code can be compiled to validate max 64K allocations - by setting MAXSEG_64K in zlib zconf.h *or* PNG_MAX_MALLOC_64K. */ -typedef struct memory_information -{ - png_uint_32 size; - png_voidp pointer; - struct memory_information FAR *next; -} memory_information; -typedef memory_information FAR *memory_infop; - -static memory_infop pinformation = NULL; -static int current_allocation = 0; -static int maximum_allocation = 0; -static int total_allocation = 0; -static int num_allocations = 0; - -png_voidp png_debug_malloc PNGARG((png_structp png_ptr, png_uint_32 size)); -void png_debug_free PNGARG((png_structp png_ptr, png_voidp ptr)); - -png_voidp -png_debug_malloc(png_structp png_ptr, png_uint_32 size) -{ - - /* png_malloc has already tested for NULL; png_create_struct calls - png_debug_malloc directly, with png_ptr == NULL which is OK */ - - if (size == 0) - return (NULL); - - /* This calls the library allocator twice, once to get the requested - buffer and once to get a new free list entry. */ - { - /* Disable malloc_fn and free_fn */ - memory_infop pinfo; - png_set_mem_fn(png_ptr, NULL, NULL, NULL); - pinfo = (memory_infop)png_malloc(png_ptr, - (png_uint_32)png_sizeof (*pinfo)); - pinfo->size = size; - current_allocation += size; - total_allocation += size; - num_allocations ++; - if (current_allocation > maximum_allocation) - maximum_allocation = current_allocation; - pinfo->pointer = (png_voidp)png_malloc(png_ptr, size); - /* Restore malloc_fn and free_fn */ - png_set_mem_fn(png_ptr, png_voidp_NULL, (png_malloc_ptr)png_debug_malloc, - (png_free_ptr)png_debug_free); - if (size != 0 && pinfo->pointer == NULL) - { - current_allocation -= size; - total_allocation -= size; - png_error(png_ptr, - "out of memory in pngtest->png_debug_malloc."); - } - pinfo->next = pinformation; - pinformation = pinfo; - /* Make sure the caller isn't assuming zeroed memory. */ - png_memset(pinfo->pointer, 0xdd, pinfo->size); - if(verbose) - printf("png_malloc %lu bytes at %x\n",(unsigned long)size, - pinfo->pointer); - return (png_voidp)(pinfo->pointer); - } -} - -/* Free a pointer. It is removed from the list at the same time. */ -void -png_debug_free(png_structp png_ptr, png_voidp ptr) -{ - if (png_ptr == NULL) - fprintf(STDERR, "NULL pointer to png_debug_free.\n"); - if (ptr == 0) - { -#if 0 /* This happens all the time. */ - fprintf(STDERR, "WARNING: freeing NULL pointer\n"); -#endif - return; - } - - /* Unlink the element from the list. */ - { - memory_infop FAR *ppinfo = &pinformation; - for (;;) - { - memory_infop pinfo = *ppinfo; - if (pinfo->pointer == ptr) - { - *ppinfo = pinfo->next; - current_allocation -= pinfo->size; - if (current_allocation < 0) - fprintf(STDERR, "Duplicate free of memory\n"); - /* We must free the list element too, but first kill - the memory that is to be freed. */ - png_memset(ptr, 0x55, pinfo->size); - png_free_default(png_ptr, pinfo); - pinfo=NULL; - break; - } - if (pinfo->next == NULL) - { - fprintf(STDERR, "Pointer %x not found\n", (unsigned int)ptr); - break; - } - ppinfo = &pinfo->next; - } - } - - /* Finally free the data. */ - if(verbose) - printf("Freeing %x\n",ptr); - png_free_default(png_ptr, ptr); - ptr=NULL; -} -#endif /* PNG_USER_MEM_SUPPORTED && PNG_DEBUG */ -/* END of code to test memory allocation/deallocation */ - -/* Test one file */ -int -test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) -{ - static png_FILE_p fpin; - static png_FILE_p fpout; /* "static" prevents setjmp corruption */ - png_structp read_ptr; - png_infop read_info_ptr, end_info_ptr; -#ifdef PNG_WRITE_SUPPORTED - png_structp write_ptr; - png_infop write_info_ptr; - png_infop write_end_info_ptr; -#else - png_structp write_ptr = NULL; - png_infop write_info_ptr = NULL; - png_infop write_end_info_ptr = NULL; -#endif - png_bytep row_buf; - png_uint_32 y; - png_uint_32 width, height; - int num_pass, pass; - int bit_depth, color_type; -#ifdef PNG_SETJMP_SUPPORTED -#ifdef USE_FAR_KEYWORD - jmp_buf jmpbuf; -#endif -#endif - -#if defined(_WIN32_WCE) - TCHAR path[MAX_PATH]; -#endif - char inbuf[256], outbuf[256]; - - row_buf = NULL; - -#if defined(_WIN32_WCE) - MultiByteToWideChar(CP_ACP, 0, inname, -1, path, MAX_PATH); - if ((fpin = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE) -#else - if ((fpin = fopen(inname, "rb")) == NULL) -#endif - { - fprintf(STDERR, "Could not find input file %s\n", inname); - return (1); - } - -#if defined(_WIN32_WCE) - MultiByteToWideChar(CP_ACP, 0, outname, -1, path, MAX_PATH); - if ((fpout = CreateFile(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL)) == INVALID_HANDLE_VALUE) -#else - if ((fpout = fopen(outname, "wb")) == NULL) -#endif - { - fprintf(STDERR, "Could not open output file %s\n", outname); - FCLOSE(fpin); - return (1); - } - - png_debug(0, "Allocating read and write structures\n"); -#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG - read_ptr = png_create_read_struct_2(PNG_LIBPNG_VER_STRING, png_voidp_NULL, - png_error_ptr_NULL, png_error_ptr_NULL, png_voidp_NULL, - (png_malloc_ptr)png_debug_malloc, (png_free_ptr)png_debug_free); -#else - read_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, png_voidp_NULL, - png_error_ptr_NULL, png_error_ptr_NULL); -#endif -#if defined(PNG_NO_STDIO) - png_set_error_fn(read_ptr, (png_voidp)inname, pngtest_error, - pngtest_warning); -#endif -#ifdef PNG_WRITE_SUPPORTED -#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG - write_ptr = png_create_write_struct_2(PNG_LIBPNG_VER_STRING, png_voidp_NULL, - png_error_ptr_NULL, png_error_ptr_NULL, png_voidp_NULL, - (png_malloc_ptr)png_debug_malloc, (png_free_ptr)png_debug_free); -#else - write_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, png_voidp_NULL, - png_error_ptr_NULL, png_error_ptr_NULL); -#endif -#if defined(PNG_NO_STDIO) - png_set_error_fn(write_ptr, (png_voidp)inname, pngtest_error, - pngtest_warning); -#endif -#endif - png_debug(0, "Allocating read_info, write_info and end_info structures\n"); - read_info_ptr = png_create_info_struct(read_ptr); - end_info_ptr = png_create_info_struct(read_ptr); -#ifdef PNG_WRITE_SUPPORTED - write_info_ptr = png_create_info_struct(write_ptr); - write_end_info_ptr = png_create_info_struct(write_ptr); -#endif - -#ifdef PNG_SETJMP_SUPPORTED - png_debug(0, "Setting jmpbuf for read struct\n"); -#ifdef USE_FAR_KEYWORD - if (setjmp(jmpbuf)) -#else - if (setjmp(png_jmpbuf(read_ptr))) -#endif - { - fprintf(STDERR, "%s -> %s: libpng read error\n", inname, outname); - if (row_buf) - png_free(read_ptr, row_buf); - png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr); -#ifdef PNG_WRITE_SUPPORTED - png_destroy_info_struct(write_ptr, &write_end_info_ptr); - png_destroy_write_struct(&write_ptr, &write_info_ptr); -#endif - FCLOSE(fpin); - FCLOSE(fpout); - return (1); - } -#ifdef USE_FAR_KEYWORD - png_memcpy(png_jmpbuf(read_ptr),jmpbuf,png_sizeof(jmp_buf)); -#endif - -#ifdef PNG_WRITE_SUPPORTED - png_debug(0, "Setting jmpbuf for write struct\n"); -#ifdef USE_FAR_KEYWORD - if (setjmp(jmpbuf)) -#else - if (setjmp(png_jmpbuf(write_ptr))) -#endif - { - fprintf(STDERR, "%s -> %s: libpng write error\n", inname, outname); - png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr); - png_destroy_info_struct(write_ptr, &write_end_info_ptr); -#ifdef PNG_WRITE_SUPPORTED - png_destroy_write_struct(&write_ptr, &write_info_ptr); -#endif - FCLOSE(fpin); - FCLOSE(fpout); - return (1); - } -#ifdef USE_FAR_KEYWORD - png_memcpy(png_jmpbuf(write_ptr),jmpbuf,png_sizeof(jmp_buf)); -#endif -#endif -#endif - - png_debug(0, "Initializing input and output streams\n"); -#if !defined(PNG_NO_STDIO) - png_init_io(read_ptr, fpin); -# ifdef PNG_WRITE_SUPPORTED - png_init_io(write_ptr, fpout); -# endif -#else - png_set_read_fn(read_ptr, (png_voidp)fpin, pngtest_read_data); -# ifdef PNG_WRITE_SUPPORTED - png_set_write_fn(write_ptr, (png_voidp)fpout, pngtest_write_data, -# if defined(PNG_WRITE_FLUSH_SUPPORTED) - pngtest_flush); -# else - NULL); -# endif -# endif -#endif - if(status_dots_requested == 1) - { -#ifdef PNG_WRITE_SUPPORTED - png_set_write_status_fn(write_ptr, write_row_callback); -#endif - png_set_read_status_fn(read_ptr, read_row_callback); - } - else - { -#ifdef PNG_WRITE_SUPPORTED - png_set_write_status_fn(write_ptr, png_write_status_ptr_NULL); -#endif - png_set_read_status_fn(read_ptr, png_read_status_ptr_NULL); - } - -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) - { - int i; - for(i=0; i<256; i++) - filters_used[i]=0; - png_set_read_user_transform_fn(read_ptr, count_filters); - } -#endif -#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) - zero_samples=0; - png_set_write_user_transform_fn(write_ptr, count_zero_samples); -#endif - -#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) -# ifndef PNG_HANDLE_CHUNK_ALWAYS -# define PNG_HANDLE_CHUNK_ALWAYS 3 -# endif - png_set_keep_unknown_chunks(read_ptr, PNG_HANDLE_CHUNK_ALWAYS, - png_bytep_NULL, 0); -#endif -#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED) -# ifndef PNG_HANDLE_CHUNK_IF_SAFE -# define PNG_HANDLE_CHUNK_IF_SAFE 2 -# endif - png_set_keep_unknown_chunks(write_ptr, PNG_HANDLE_CHUNK_IF_SAFE, - png_bytep_NULL, 0); -#endif - - png_debug(0, "Reading info struct\n"); - png_read_info(read_ptr, read_info_ptr); - - png_debug(0, "Transferring info struct\n"); - { - int interlace_type, compression_type, filter_type; - - if (png_get_IHDR(read_ptr, read_info_ptr, &width, &height, &bit_depth, - &color_type, &interlace_type, &compression_type, &filter_type)) - { - png_set_IHDR(write_ptr, write_info_ptr, width, height, bit_depth, -#if defined(PNG_WRITE_INTERLACING_SUPPORTED) - color_type, interlace_type, compression_type, filter_type); -#else - color_type, PNG_INTERLACE_NONE, compression_type, filter_type); -#endif - } - } -#if defined(PNG_FIXED_POINT_SUPPORTED) -#if defined(PNG_cHRM_SUPPORTED) - { - png_fixed_point white_x, white_y, red_x, red_y, green_x, green_y, blue_x, - blue_y; - if (png_get_cHRM_fixed(read_ptr, read_info_ptr, &white_x, &white_y, &red_x, - &red_y, &green_x, &green_y, &blue_x, &blue_y)) - { - png_set_cHRM_fixed(write_ptr, write_info_ptr, white_x, white_y, red_x, - red_y, green_x, green_y, blue_x, blue_y); - } - } -#endif -#if defined(PNG_gAMA_SUPPORTED) - { - png_fixed_point gamma; - - if (png_get_gAMA_fixed(read_ptr, read_info_ptr, &gamma)) - { - png_set_gAMA_fixed(write_ptr, write_info_ptr, gamma); - } - } -#endif -#else /* Use floating point versions */ -#if defined(PNG_FLOATING_POINT_SUPPORTED) -#if defined(PNG_cHRM_SUPPORTED) - { - double white_x, white_y, red_x, red_y, green_x, green_y, blue_x, - blue_y; - if (png_get_cHRM(read_ptr, read_info_ptr, &white_x, &white_y, &red_x, - &red_y, &green_x, &green_y, &blue_x, &blue_y)) - { - png_set_cHRM(write_ptr, write_info_ptr, white_x, white_y, red_x, - red_y, green_x, green_y, blue_x, blue_y); - } - } -#endif -#if defined(PNG_gAMA_SUPPORTED) - { - double gamma; - - if (png_get_gAMA(read_ptr, read_info_ptr, &gamma)) - { - png_set_gAMA(write_ptr, write_info_ptr, gamma); - } - } -#endif -#endif /* floating point */ -#endif /* fixed point */ -#if defined(PNG_iCCP_SUPPORTED) - { - png_charp name; - png_charp profile; - png_uint_32 proflen; - int compression_type; - - if (png_get_iCCP(read_ptr, read_info_ptr, &name, &compression_type, - &profile, &proflen)) - { - png_set_iCCP(write_ptr, write_info_ptr, name, compression_type, - profile, proflen); - } - } -#endif -#if defined(PNG_sRGB_SUPPORTED) - { - int intent; - - if (png_get_sRGB(read_ptr, read_info_ptr, &intent)) - { - png_set_sRGB(write_ptr, write_info_ptr, intent); - } - } -#endif - { - png_colorp palette; - int num_palette; - - if (png_get_PLTE(read_ptr, read_info_ptr, &palette, &num_palette)) - { - png_set_PLTE(write_ptr, write_info_ptr, palette, num_palette); - } - } -#if defined(PNG_bKGD_SUPPORTED) - { - png_color_16p background; - - if (png_get_bKGD(read_ptr, read_info_ptr, &background)) - { - png_set_bKGD(write_ptr, write_info_ptr, background); - } - } -#endif -#if defined(PNG_hIST_SUPPORTED) - { - png_uint_16p hist; - - if (png_get_hIST(read_ptr, read_info_ptr, &hist)) - { - png_set_hIST(write_ptr, write_info_ptr, hist); - } - } -#endif -#if defined(PNG_oFFs_SUPPORTED) - { - png_int_32 offset_x, offset_y; - int unit_type; - - if (png_get_oFFs(read_ptr, read_info_ptr,&offset_x,&offset_y,&unit_type)) - { - png_set_oFFs(write_ptr, write_info_ptr, offset_x, offset_y, unit_type); - } - } -#endif -#if defined(PNG_pCAL_SUPPORTED) - { - png_charp purpose, units; - png_charpp params; - png_int_32 X0, X1; - int type, nparams; - - if (png_get_pCAL(read_ptr, read_info_ptr, &purpose, &X0, &X1, &type, - &nparams, &units, ¶ms)) - { - png_set_pCAL(write_ptr, write_info_ptr, purpose, X0, X1, type, - nparams, units, params); - } - } -#endif -#if defined(PNG_pHYs_SUPPORTED) - { - png_uint_32 res_x, res_y; - int unit_type; - - if (png_get_pHYs(read_ptr, read_info_ptr, &res_x, &res_y, &unit_type)) - { - png_set_pHYs(write_ptr, write_info_ptr, res_x, res_y, unit_type); - } - } -#endif -#if defined(PNG_sBIT_SUPPORTED) - { - png_color_8p sig_bit; - - if (png_get_sBIT(read_ptr, read_info_ptr, &sig_bit)) - { - png_set_sBIT(write_ptr, write_info_ptr, sig_bit); - } - } -#endif -#if defined(PNG_sCAL_SUPPORTED) -#ifdef PNG_FLOATING_POINT_SUPPORTED - { - int unit; - double scal_width, scal_height; - - if (png_get_sCAL(read_ptr, read_info_ptr, &unit, &scal_width, - &scal_height)) - { - png_set_sCAL(write_ptr, write_info_ptr, unit, scal_width, scal_height); - } - } -#else -#ifdef PNG_FIXED_POINT_SUPPORTED - { - int unit; - png_charp scal_width, scal_height; - - if (png_get_sCAL_s(read_ptr, read_info_ptr, &unit, &scal_width, - &scal_height)) - { - png_set_sCAL_s(write_ptr, write_info_ptr, unit, scal_width, scal_height); - } - } -#endif -#endif -#endif -#if defined(PNG_TEXT_SUPPORTED) - { - png_textp text_ptr; - int num_text; - - if (png_get_text(read_ptr, read_info_ptr, &text_ptr, &num_text) > 0) - { - png_debug1(0, "Handling %d iTXt/tEXt/zTXt chunks\n", num_text); - png_set_text(write_ptr, write_info_ptr, text_ptr, num_text); - } - } -#endif -#if defined(PNG_tIME_SUPPORTED) - { - png_timep mod_time; - - if (png_get_tIME(read_ptr, read_info_ptr, &mod_time)) - { - png_set_tIME(write_ptr, write_info_ptr, mod_time); -#if defined(PNG_TIME_RFC1123_SUPPORTED) - /* we have to use png_strcpy instead of "=" because the string - pointed to by png_convert_to_rfc1123() gets free'ed before - we use it */ - png_strcpy(tIME_string,png_convert_to_rfc1123(read_ptr, mod_time)); - tIME_chunk_present++; -#endif /* PNG_TIME_RFC1123_SUPPORTED */ - } - } -#endif -#if defined(PNG_tRNS_SUPPORTED) - { - png_bytep trans; - int num_trans; - png_color_16p trans_values; - - if (png_get_tRNS(read_ptr, read_info_ptr, &trans, &num_trans, - &trans_values)) - { - png_set_tRNS(write_ptr, write_info_ptr, trans, num_trans, - trans_values); - } - } -#endif -#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED) - { - png_unknown_chunkp unknowns; - int num_unknowns = (int)png_get_unknown_chunks(read_ptr, read_info_ptr, - &unknowns); - if (num_unknowns) - { - png_size_t i; - png_set_unknown_chunks(write_ptr, write_info_ptr, unknowns, - num_unknowns); - /* copy the locations from the read_info_ptr. The automatically - generated locations in write_info_ptr are wrong because we - haven't written anything yet */ - for (i = 0; i < (png_size_t)num_unknowns; i++) - png_set_unknown_chunk_location(write_ptr, write_info_ptr, i, - unknowns[i].location); - } - } -#endif - -#ifdef PNG_WRITE_SUPPORTED - png_debug(0, "\nWriting info struct\n"); - -/* If we wanted, we could write info in two steps: - png_write_info_before_PLTE(write_ptr, write_info_ptr); - */ - png_write_info(write_ptr, write_info_ptr); -#endif - -#ifdef SINGLE_ROWBUF_ALLOC - png_debug(0, "\nAllocating row buffer..."); - row_buf = (png_bytep)png_malloc(read_ptr, - png_get_rowbytes(read_ptr, read_info_ptr)); - png_debug1(0, "0x%08lx\n\n", (unsigned long)row_buf); -#endif /* SINGLE_ROWBUF_ALLOC */ - png_debug(0, "Writing row data\n"); - -#if defined(PNG_READ_INTERLACING_SUPPORTED) || \ - defined(PNG_WRITE_INTERLACING_SUPPORTED) - num_pass = png_set_interlace_handling(read_ptr); -# ifdef PNG_WRITE_SUPPORTED - png_set_interlace_handling(write_ptr); -# endif -#else - num_pass=1; -#endif - -#ifdef PNGTEST_TIMING - t_stop = (float)clock(); - t_misc += (t_stop - t_start); - t_start = t_stop; -#endif - for (pass = 0; pass < num_pass; pass++) - { - png_debug1(0, "Writing row data for pass %d\n",pass); - for (y = 0; y < height; y++) - { -#ifndef SINGLE_ROWBUF_ALLOC - png_debug2(0, "\nAllocating row buffer (pass %d, y = %ld)...", pass,y); - row_buf = (png_bytep)png_malloc(read_ptr, - png_get_rowbytes(read_ptr, read_info_ptr)); - png_debug2(0, "0x%08lx (%ld bytes)\n", (unsigned long)row_buf, - png_get_rowbytes(read_ptr, read_info_ptr)); -#endif /* !SINGLE_ROWBUF_ALLOC */ - png_read_rows(read_ptr, (png_bytepp)&row_buf, png_bytepp_NULL, 1); - -#ifdef PNG_WRITE_SUPPORTED -#ifdef PNGTEST_TIMING - t_stop = (float)clock(); - t_decode += (t_stop - t_start); - t_start = t_stop; -#endif - png_write_rows(write_ptr, (png_bytepp)&row_buf, 1); -#ifdef PNGTEST_TIMING - t_stop = (float)clock(); - t_encode += (t_stop - t_start); - t_start = t_stop; -#endif -#endif /* PNG_WRITE_SUPPORTED */ - -#ifndef SINGLE_ROWBUF_ALLOC - png_debug2(0, "Freeing row buffer (pass %d, y = %ld)\n\n", pass, y); - png_free(read_ptr, row_buf); -#endif /* !SINGLE_ROWBUF_ALLOC */ - } - } - -#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) - png_free_data(read_ptr, read_info_ptr, PNG_FREE_UNKN, -1); -#endif -#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED) - png_free_data(write_ptr, write_info_ptr, PNG_FREE_UNKN, -1); -#endif - - png_debug(0, "Reading and writing end_info data\n"); - - png_read_end(read_ptr, end_info_ptr); -#if defined(PNG_TEXT_SUPPORTED) - { - png_textp text_ptr; - int num_text; - - if (png_get_text(read_ptr, end_info_ptr, &text_ptr, &num_text) > 0) - { - png_debug1(0, "Handling %d iTXt/tEXt/zTXt chunks\n", num_text); - png_set_text(write_ptr, write_end_info_ptr, text_ptr, num_text); - } - } -#endif -#if defined(PNG_tIME_SUPPORTED) - { - png_timep mod_time; - - if (png_get_tIME(read_ptr, end_info_ptr, &mod_time)) - { - png_set_tIME(write_ptr, write_end_info_ptr, mod_time); -#if defined(PNG_TIME_RFC1123_SUPPORTED) - /* we have to use png_strcpy instead of "=" because the string - pointed to by png_convert_to_rfc1123() gets free'ed before - we use it */ - png_strcpy(tIME_string,png_convert_to_rfc1123(read_ptr, mod_time)); - tIME_chunk_present++; -#endif /* PNG_TIME_RFC1123_SUPPORTED */ - } - } -#endif -#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED) - { - png_unknown_chunkp unknowns; - int num_unknowns; - num_unknowns = (int)png_get_unknown_chunks(read_ptr, end_info_ptr, - &unknowns); - if (num_unknowns) - { - png_size_t i; - png_set_unknown_chunks(write_ptr, write_end_info_ptr, unknowns, - num_unknowns); - /* copy the locations from the read_info_ptr. The automatically - generated locations in write_end_info_ptr are wrong because we - haven't written the end_info yet */ - for (i = 0; i < (png_size_t)num_unknowns; i++) - png_set_unknown_chunk_location(write_ptr, write_end_info_ptr, i, - unknowns[i].location); - } - } -#endif -#ifdef PNG_WRITE_SUPPORTED - png_write_end(write_ptr, write_end_info_ptr); -#endif - -#ifdef PNG_EASY_ACCESS_SUPPORTED - if(verbose) - { - png_uint_32 iwidth, iheight; - iwidth = png_get_image_width(write_ptr, write_info_ptr); - iheight = png_get_image_height(write_ptr, write_info_ptr); - fprintf(STDERR, "Image width = %lu, height = %lu\n", - (unsigned long)iwidth, (unsigned long)iheight); - } -#endif - - png_debug(0, "Destroying data structs\n"); -#ifdef SINGLE_ROWBUF_ALLOC - png_debug(1, "destroying row_buf for read_ptr\n"); - png_free(read_ptr, row_buf); - row_buf=NULL; -#endif /* SINGLE_ROWBUF_ALLOC */ - png_debug(1, "destroying read_ptr, read_info_ptr, end_info_ptr\n"); - png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr); -#ifdef PNG_WRITE_SUPPORTED - png_debug(1, "destroying write_end_info_ptr\n"); - png_destroy_info_struct(write_ptr, &write_end_info_ptr); - png_debug(1, "destroying write_ptr, write_info_ptr\n"); - png_destroy_write_struct(&write_ptr, &write_info_ptr); -#endif - png_debug(0, "Destruction complete.\n"); - - FCLOSE(fpin); - FCLOSE(fpout); - - png_debug(0, "Opening files for comparison\n"); -#if defined(_WIN32_WCE) - MultiByteToWideChar(CP_ACP, 0, inname, -1, path, MAX_PATH); - if ((fpin = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE) -#else - if ((fpin = fopen(inname, "rb")) == NULL) -#endif - { - fprintf(STDERR, "Could not find file %s\n", inname); - return (1); - } - -#if defined(_WIN32_WCE) - MultiByteToWideChar(CP_ACP, 0, outname, -1, path, MAX_PATH); - if ((fpout = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE) -#else - if ((fpout = fopen(outname, "rb")) == NULL) -#endif - { - fprintf(STDERR, "Could not find file %s\n", outname); - FCLOSE(fpin); - return (1); - } - - for(;;) - { - png_size_t num_in, num_out; - - READFILE(fpin, inbuf, 1, num_in); - READFILE(fpout, outbuf, 1, num_out); - - if (num_in != num_out) - { - fprintf(STDERR, "\nFiles %s and %s are of a different size\n", - inname, outname); - if(wrote_question == 0) - { - fprintf(STDERR, - " Was %s written with the same maximum IDAT chunk size (%d bytes),", - inname,PNG_ZBUF_SIZE); - fprintf(STDERR, - "\n filtering heuristic (libpng default), compression"); - fprintf(STDERR, - " level (zlib default),\n and zlib version (%s)?\n\n", - ZLIB_VERSION); - wrote_question=1; - } - FCLOSE(fpin); - FCLOSE(fpout); - return (0); - } - - if (!num_in) - break; - - if (png_memcmp(inbuf, outbuf, num_in)) - { - fprintf(STDERR, "\nFiles %s and %s are different\n", inname, outname); - if(wrote_question == 0) - { - fprintf(STDERR, - " Was %s written with the same maximum IDAT chunk size (%d bytes),", - inname,PNG_ZBUF_SIZE); - fprintf(STDERR, - "\n filtering heuristic (libpng default), compression"); - fprintf(STDERR, - " level (zlib default),\n and zlib version (%s)?\n\n", - ZLIB_VERSION); - wrote_question=1; - } - FCLOSE(fpin); - FCLOSE(fpout); - return (0); - } - } - - FCLOSE(fpin); - FCLOSE(fpout); - - return (0); -} - -/* input and output filenames */ -#ifdef RISCOS -static PNG_CONST char *inname = "pngtest/png"; -static PNG_CONST char *outname = "pngout/png"; -#else -static PNG_CONST char *inname = "pngtest.png"; -static PNG_CONST char *outname = "pngout.png"; -#endif - -int -main(int argc, char *argv[]) -{ - int multiple = 0; - int ierror = 0; - - fprintf(STDERR, "Testing libpng version %s\n", PNG_LIBPNG_VER_STRING); - fprintf(STDERR, " with zlib version %s\n", ZLIB_VERSION); - fprintf(STDERR,"%s",png_get_copyright(NULL)); - /* Show the version of libpng used in building the library */ - fprintf(STDERR," library (%lu):%s", - (unsigned long)png_access_version_number(), - png_get_header_version(NULL)); - /* Show the version of libpng used in building the application */ - fprintf(STDERR," pngtest (%lu):%s", (unsigned long)PNG_LIBPNG_VER, - PNG_HEADER_VERSION_STRING); - fprintf(STDERR," png_sizeof(png_struct)=%ld, png_sizeof(png_info)=%ld\n", - (long)png_sizeof(png_struct), (long)png_sizeof(png_info)); - - /* Do some consistency checking on the memory allocation settings, I'm - not sure this matters, but it is nice to know, the first of these - tests should be impossible because of the way the macros are set - in pngconf.h */ -#if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K) - fprintf(STDERR, " NOTE: Zlib compiled for max 64k, libpng not\n"); -#endif - /* I think the following can happen. */ -#if !defined(MAXSEG_64K) && defined(PNG_MAX_MALLOC_64K) - fprintf(STDERR, " NOTE: libpng compiled for max 64k, zlib not\n"); -#endif - - if (strcmp(png_libpng_ver, PNG_LIBPNG_VER_STRING)) - { - fprintf(STDERR, - "Warning: versions are different between png.h and png.c\n"); - fprintf(STDERR, " png.h version: %s\n", PNG_LIBPNG_VER_STRING); - fprintf(STDERR, " png.c version: %s\n\n", png_libpng_ver); - ++ierror; - } - - if (argc > 1) - { - if (strcmp(argv[1], "-m") == 0) - { - multiple = 1; - status_dots_requested = 0; - } - else if (strcmp(argv[1], "-mv") == 0 || - strcmp(argv[1], "-vm") == 0 ) - { - multiple = 1; - verbose = 1; - status_dots_requested = 1; - } - else if (strcmp(argv[1], "-v") == 0) - { - verbose = 1; - status_dots_requested = 1; - inname = argv[2]; - } - else - { - inname = argv[1]; - status_dots_requested = 0; - } - } - - if (!multiple && argc == 3+verbose) - outname = argv[2+verbose]; - - if ((!multiple && argc > 3+verbose) || (multiple && argc < 2)) - { - fprintf(STDERR, - "usage: %s [infile.png] [outfile.png]\n\t%s -m {infile.png}\n", - argv[0], argv[0]); - fprintf(STDERR, - " reads/writes one PNG file (without -m) or multiple files (-m)\n"); - fprintf(STDERR, - " with -m %s is used as a temporary file\n", outname); - exit(1); - } - - if (multiple) - { - int i; -#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG - int allocation_now = current_allocation; -#endif - for (i=2; isize, - (unsigned int) pinfo->pointer); - pinfo = pinfo->next; - } - } -#endif - } -#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG - fprintf(STDERR, " Current memory allocation: %10d bytes\n", - current_allocation); - fprintf(STDERR, " Maximum memory allocation: %10d bytes\n", - maximum_allocation); - fprintf(STDERR, " Total memory allocation: %10d bytes\n", - total_allocation); - fprintf(STDERR, " Number of allocations: %10d\n", - num_allocations); -#endif - } - else - { - int i; - for (i=0; i<3; ++i) - { - int kerror; -#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG - int allocation_now = current_allocation; -#endif - if (i == 1) status_dots_requested = 1; - else if(verbose == 0)status_dots_requested = 0; - if (i == 0 || verbose == 1 || ierror != 0) - fprintf(STDERR, "Testing %s:",inname); - kerror = test_one_file(inname, outname); - if(kerror == 0) - { - if(verbose == 1 || i == 2) - { -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) - int k; -#endif -#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) - fprintf(STDERR, "\n PASS (%lu zero samples)\n", - (unsigned long)zero_samples); -#else - fprintf(STDERR, " PASS\n"); -#endif -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) - for (k=0; k<256; k++) - if(filters_used[k]) - fprintf(STDERR, " Filter %d was used %lu times\n", - k,(unsigned long)filters_used[k]); -#endif -#if defined(PNG_TIME_RFC1123_SUPPORTED) - if(tIME_chunk_present != 0) - fprintf(STDERR, " tIME = %s\n",tIME_string); -#endif /* PNG_TIME_RFC1123_SUPPORTED */ - } - } - else - { - if(verbose == 0 && i != 2) - fprintf(STDERR, "Testing %s:",inname); - fprintf(STDERR, " FAIL\n"); - ierror += kerror; - } -#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG - if (allocation_now != current_allocation) - fprintf(STDERR, "MEMORY ERROR: %d bytes lost\n", - current_allocation-allocation_now); - if (current_allocation != 0) - { - memory_infop pinfo = pinformation; - - fprintf(STDERR, "MEMORY ERROR: %d bytes still allocated\n", - current_allocation); - while (pinfo != NULL) - { - fprintf(STDERR," %lu bytes at %x\n", - (unsigned long)pinfo->size, (unsigned int)pinfo->pointer); - pinfo = pinfo->next; - } - } -#endif - } -#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG - fprintf(STDERR, " Current memory allocation: %10d bytes\n", - current_allocation); - fprintf(STDERR, " Maximum memory allocation: %10d bytes\n", - maximum_allocation); - fprintf(STDERR, " Total memory allocation: %10d bytes\n", - total_allocation); - fprintf(STDERR, " Number of allocations: %10d\n", - num_allocations); -#endif - } - -#ifdef PNGTEST_TIMING - t_stop = (float)clock(); - t_misc += (t_stop - t_start); - t_start = t_stop; - fprintf(STDERR," CPU time used = %.3f seconds", - (t_misc+t_decode+t_encode)/(float)CLOCKS_PER_SEC); - fprintf(STDERR," (decoding %.3f,\n", - t_decode/(float)CLOCKS_PER_SEC); - fprintf(STDERR," encoding %.3f ,", - t_encode/(float)CLOCKS_PER_SEC); - fprintf(STDERR," other %.3f seconds)\n\n", - t_misc/(float)CLOCKS_PER_SEC); -#endif - - if (ierror == 0) - fprintf(STDERR, "libpng passes test\n"); - else - fprintf(STDERR, "libpng FAILS test\n"); - return (int)(ierror != 0); -} - -/* Generate a compiler error if there is an old png.h in the search path. */ -typedef version_1_2_18 your_png_h_is_not_version_1_2_18; +typedef version_1_2_32 your_png_h_is_not_version_1_2_32; diff --git a/src/dep/src/irrlicht/libpng/pngtrans.c b/src/dep/src/irrlicht/libpng/pngtrans.c index 6409298..2a02c1e 100644 --- a/src/dep/src/irrlicht/libpng/pngtrans.c +++ b/src/dep/src/irrlicht/libpng/pngtrans.c @@ -17,7 +17,7 @@ void PNGAPI png_set_bgr(png_structp png_ptr) { - png_debug(1, "in png_set_bgr"); + png_debug(1, "in png_set_bgr\n"); if (png_ptr == NULL) return; png_ptr->transformations |= PNG_BGR; } @@ -28,7 +28,7 @@ png_set_bgr(png_structp png_ptr) void PNGAPI png_set_swap(png_structp png_ptr) { - png_debug(1, "in png_set_swap"); + png_debug(1, "in png_set_swap\n"); if (png_ptr == NULL) return; if (png_ptr->bit_depth == 16) png_ptr->transformations |= PNG_SWAP_BYTES; @@ -40,7 +40,7 @@ png_set_swap(png_structp png_ptr) void PNGAPI png_set_packing(png_structp png_ptr) { - png_debug(1, "in png_set_packing"); + png_debug(1, "in png_set_packing\n"); if (png_ptr == NULL) return; if (png_ptr->bit_depth < 8) { @@ -55,7 +55,7 @@ png_set_packing(png_structp png_ptr) void PNGAPI png_set_packswap(png_structp png_ptr) { - png_debug(1, "in png_set_packswap"); + png_debug(1, "in png_set_packswap\n"); if (png_ptr == NULL) return; if (png_ptr->bit_depth < 8) png_ptr->transformations |= PNG_PACKSWAP; @@ -66,7 +66,7 @@ png_set_packswap(png_structp png_ptr) void PNGAPI png_set_shift(png_structp png_ptr, png_color_8p true_bits) { - png_debug(1, "in png_set_shift"); + png_debug(1, "in png_set_shift\n"); if (png_ptr == NULL) return; png_ptr->transformations |= PNG_SHIFT; png_ptr->shift = *true_bits; @@ -78,7 +78,7 @@ png_set_shift(png_structp png_ptr, png_color_8p true_bits) int PNGAPI png_set_interlace_handling(png_structp png_ptr) { - png_debug(1, "in png_set_interlace handling"); + png_debug(1, "in png_set_interlace handling\n"); if (png_ptr && png_ptr->interlaced) { png_ptr->transformations |= PNG_INTERLACE; @@ -98,7 +98,7 @@ png_set_interlace_handling(png_structp png_ptr) void PNGAPI png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc) { - png_debug(1, "in png_set_filler"); + png_debug(1, "in png_set_filler\n"); if (png_ptr == NULL) return; png_ptr->transformations |= PNG_FILLER; png_ptr->filler = (png_byte)filler; @@ -131,7 +131,7 @@ png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc) void PNGAPI png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc) { - png_debug(1, "in png_set_add_alpha"); + png_debug(1, "in png_set_add_alpha\n"); if (png_ptr == NULL) return; png_set_filler(png_ptr, filler, filler_loc); png_ptr->transformations |= PNG_ADD_ALPHA; @@ -145,7 +145,7 @@ png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc) void PNGAPI png_set_swap_alpha(png_structp png_ptr) { - png_debug(1, "in png_set_swap_alpha"); + png_debug(1, "in png_set_swap_alpha\n"); if (png_ptr == NULL) return; png_ptr->transformations |= PNG_SWAP_ALPHA; } @@ -156,7 +156,7 @@ png_set_swap_alpha(png_structp png_ptr) void PNGAPI png_set_invert_alpha(png_structp png_ptr) { - png_debug(1, "in png_set_invert_alpha"); + png_debug(1, "in png_set_invert_alpha\n"); if (png_ptr == NULL) return; png_ptr->transformations |= PNG_INVERT_ALPHA; } @@ -166,7 +166,7 @@ png_set_invert_alpha(png_structp png_ptr) void PNGAPI png_set_invert_mono(png_structp png_ptr) { - png_debug(1, "in png_set_invert_mono"); + png_debug(1, "in png_set_invert_mono\n"); if (png_ptr == NULL) return; png_ptr->transformations |= PNG_INVERT_MONO; } @@ -175,7 +175,7 @@ png_set_invert_mono(png_structp png_ptr) void /* PRIVATE */ png_do_invert(png_row_infop row_info, png_bytep row) { - png_debug(1, "in png_do_invert"); + png_debug(1, "in png_do_invert\n"); /* This test removed from libpng version 1.0.13 and 1.2.0: * if (row_info->bit_depth == 1 && */ @@ -230,7 +230,7 @@ png_do_invert(png_row_infop row_info, png_bytep row) void /* PRIVATE */ png_do_swap(png_row_infop row_info, png_bytep row) { - png_debug(1, "in png_do_swap"); + png_debug(1, "in png_do_swap\n"); if ( #if defined(PNG_USELESS_TESTS_SUPPORTED) row != NULL && row_info != NULL && @@ -357,668 +357,6 @@ static PNG_CONST png_byte fourbppswaptable[256] = { 0x8F, 0x9F, 0xAF, 0xBF, 0xCF, 0xDF, 0xEF, 0xFF }; -/* swaps pixel packing order within bytes */ -void /* PRIVATE */ -png_do_packswap(png_row_infop row_info, png_bytep row) -{ - png_debug(1, "in png_do_packswap"); - if ( -#if defined(PNG_USELESS_TESTS_SUPPORTED) - row != NULL && row_info != NULL && -#endif - row_info->bit_depth < 8) - { - png_bytep rp, end, table; - - end = row + row_info->rowbytes; - - if (row_info->bit_depth == 1) - table = (png_bytep)onebppswaptable; - else if (row_info->bit_depth == 2) - table = (png_bytep)twobppswaptable; - else if (row_info->bit_depth == 4) - table = (png_bytep)fourbppswaptable; - else - return; - - for (rp = row; rp < end; rp++) - *rp = table[*rp]; - } -} -#endif /* PNG_READ_PACKSWAP_SUPPORTED or PNG_WRITE_PACKSWAP_SUPPORTED */ - -#if defined(PNG_WRITE_FILLER_SUPPORTED) || \ - defined(PNG_READ_STRIP_ALPHA_SUPPORTED) -/* remove filler or alpha byte(s) */ -void /* PRIVATE */ -png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags) -{ - png_debug(1, "in png_do_strip_filler"); -#if defined(PNG_USELESS_TESTS_SUPPORTED) - if (row != NULL && row_info != NULL) -#endif - { - png_bytep sp=row; - png_bytep dp=row; - png_uint_32 row_width=row_info->width; - png_uint_32 i; - - if ((row_info->color_type == PNG_COLOR_TYPE_RGB || - (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA && - (flags & PNG_FLAG_STRIP_ALPHA))) && - row_info->channels == 4) - { - if (row_info->bit_depth == 8) - { - /* This converts from RGBX or RGBA to RGB */ - if (flags & PNG_FLAG_FILLER_AFTER) - { - dp+=3; sp+=4; - for (i = 1; i < row_width; i++) - { - *dp++ = *sp++; - *dp++ = *sp++; - *dp++ = *sp++; - sp++; - } - } - /* This converts from XRGB or ARGB to RGB */ - else - { - for (i = 0; i < row_width; i++) - { - sp++; - *dp++ = *sp++; - *dp++ = *sp++; - *dp++ = *sp++; - } - } - row_info->pixel_depth = 24; - row_info->rowbytes = row_width * 3; - } - else /* if (row_info->bit_depth == 16) */ - { - if (flags & PNG_FLAG_FILLER_AFTER) - { - /* This converts from RRGGBBXX or RRGGBBAA to RRGGBB */ - sp += 8; dp += 6; - for (i = 1; i < row_width; i++) - { - /* This could be (although png_memcpy is probably slower): - png_memcpy(dp, sp, 6); - sp += 8; - dp += 6; - */ - - *dp++ = *sp++; - *dp++ = *sp++; - *dp++ = *sp++; - *dp++ = *sp++; - *dp++ = *sp++; - *dp++ = *sp++; - sp += 2; - } - } - else - { - /* This converts from XXRRGGBB or AARRGGBB to RRGGBB */ - for (i = 0; i < row_width; i++) - { - /* This could be (although png_memcpy is probably slower): - png_memcpy(dp, sp, 6); - sp += 8; - dp += 6; - */ - - sp+=2; - *dp++ = *sp++; - *dp++ = *sp++; - *dp++ = *sp++; - *dp++ = *sp++; - *dp++ = *sp++; - *dp++ = *sp++; - } - } - row_info->pixel_depth = 48; - row_info->rowbytes = row_width * 6; - } - row_info->channels = 3; - } - else if ((row_info->color_type == PNG_COLOR_TYPE_GRAY || - (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA && - (flags & PNG_FLAG_STRIP_ALPHA))) && - row_info->channels == 2) - { - if (row_info->bit_depth == 8) - { - /* This converts from GX or GA to G */ - if (flags & PNG_FLAG_FILLER_AFTER) - { - for (i = 0; i < row_width; i++) - { - *dp++ = *sp++; - sp++; - } - } - /* This converts from XG or AG to G */ - else - { - for (i = 0; i < row_width; i++) - { - sp++; - *dp++ = *sp++; - } - } - row_info->pixel_depth = 8; - row_info->rowbytes = row_width; - } - else /* if (row_info->bit_depth == 16) */ - { - if (flags & PNG_FLAG_FILLER_AFTER) - { - /* This converts from GGXX or GGAA to GG */ - sp += 4; dp += 2; - for (i = 1; i < row_width; i++) - { - *dp++ = *sp++; - *dp++ = *sp++; - sp += 2; - } - } - else - { - /* This converts from XXGG or AAGG to GG */ - for (i = 0; i < row_width; i++) - { - sp += 2; - *dp++ = *sp++; - *dp++ = *sp++; - } - } - row_info->pixel_depth = 16; - row_info->rowbytes = row_width * 2; - } - row_info->channels = 1; - } - if (flags & PNG_FLAG_STRIP_ALPHA) - row_info->color_type &= ~PNG_COLOR_MASK_ALPHA; - } -} -#endif - -#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) -/* swaps red and blue bytes within a pixel */ -void /* PRIVATE */ -png_do_bgr(png_row_infop row_info, png_bytep row) -{ - png_debug(1, "in png_do_bgr"); - if ( -#if defined(PNG_USELESS_TESTS_SUPPORTED) - row != NULL && row_info != NULL && -#endif - (row_info->color_type & PNG_COLOR_MASK_COLOR)) - { - png_uint_32 row_width = row_info->width; - if (row_info->bit_depth == 8) - { - if (row_info->color_type == PNG_COLOR_TYPE_RGB) - { - png_bytep rp; - png_uint_32 i; - - for (i = 0, rp = row; i < row_width; i++, rp += 3) - { - png_byte save = *rp; - *rp = *(rp + 2); - *(rp + 2) = save; - } - } - else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) - { - png_bytep rp; - png_uint_32 i; - - for (i = 0, rp = row; i < row_width; i++, rp += 4) - { - png_byte save = *rp; - *rp = *(rp + 2); - *(rp + 2) = save; - } - } - } - else if (row_info->bit_depth == 16) - { - if (row_info->color_type == PNG_COLOR_TYPE_RGB) - { - png_bytep rp; - png_uint_32 i; - - for (i = 0, rp = row; i < row_width; i++, rp += 6) - { - png_byte save = *rp; - *rp = *(rp + 4); - *(rp + 4) = save; - save = *(rp + 1); - *(rp + 1) = *(rp + 5); - *(rp + 5) = save; - } - } - else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) - { - png_bytep rp; - png_uint_32 i; - - for (i = 0, rp = row; i < row_width; i++, rp += 8) - { - png_byte save = *rp; - *rp = *(rp + 4); - *(rp + 4) = save; - save = *(rp + 1); - *(rp + 1) = *(rp + 5); - *(rp + 5) = save; - } - } - } - } -} -#endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */ - -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ - defined(PNG_LEGACY_SUPPORTED) -void PNGAPI -png_set_user_transform_info(png_structp png_ptr, png_voidp - user_transform_ptr, int user_transform_depth, int user_transform_channels) -{ - png_debug(1, "in png_set_user_transform_info"); - if (png_ptr == NULL) return; -#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) - png_ptr->user_transform_ptr = user_transform_ptr; - png_ptr->user_transform_depth = (png_byte)user_transform_depth; - png_ptr->user_transform_channels = (png_byte)user_transform_channels; -#else - if (user_transform_ptr || user_transform_depth || user_transform_channels) - png_warning(png_ptr, - "This version of libpng does not support user transform info"); -#endif -} -#endif - -/* This function returns a pointer to the user_transform_ptr associated with - * the user transform functions. The application should free any memory - * associated with this pointer before png_write_destroy and png_read_destroy - * are called. - */ -png_voidp PNGAPI -png_get_user_transform_ptr(png_structp png_ptr) -{ - if (png_ptr == NULL) return (NULL); -#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) - return ((png_voidp)png_ptr->user_transform_ptr); -#else - return (NULL); -#endif -} -#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ - -/* pngtrans.c - transforms the data in a row (used by both readers and writers) - * - * Last changed in libpng 1.2.13 November 13, 2006 - * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2006 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - */ - -#define PNG_INTERNAL -#include "png.h" - -#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) -#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) -/* turn on BGR-to-RGB mapping */ -void PNGAPI -png_set_bgr(png_structp png_ptr) -{ - png_debug(1, "in png_set_bgr\n"); - if(png_ptr == NULL) return; - png_ptr->transformations |= PNG_BGR; -} -#endif - -#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) -/* turn on 16 bit byte swapping */ -void PNGAPI -png_set_swap(png_structp png_ptr) -{ - png_debug(1, "in png_set_swap\n"); - if(png_ptr == NULL) return; - if (png_ptr->bit_depth == 16) - png_ptr->transformations |= PNG_SWAP_BYTES; -} -#endif - -#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) -/* turn on pixel packing */ -void PNGAPI -png_set_packing(png_structp png_ptr) -{ - png_debug(1, "in png_set_packing\n"); - if(png_ptr == NULL) return; - if (png_ptr->bit_depth < 8) - { - png_ptr->transformations |= PNG_PACK; - png_ptr->usr_bit_depth = 8; - } -} -#endif - -#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED) -/* turn on packed pixel swapping */ -void PNGAPI -png_set_packswap(png_structp png_ptr) -{ - png_debug(1, "in png_set_packswap\n"); - if(png_ptr == NULL) return; - if (png_ptr->bit_depth < 8) - png_ptr->transformations |= PNG_PACKSWAP; -} -#endif - -#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) -void PNGAPI -png_set_shift(png_structp png_ptr, png_color_8p true_bits) -{ - png_debug(1, "in png_set_shift\n"); - if(png_ptr == NULL) return; - png_ptr->transformations |= PNG_SHIFT; - png_ptr->shift = *true_bits; -} -#endif - -#if defined(PNG_READ_INTERLACING_SUPPORTED) || \ - defined(PNG_WRITE_INTERLACING_SUPPORTED) -int PNGAPI -png_set_interlace_handling(png_structp png_ptr) -{ - png_debug(1, "in png_set_interlace handling\n"); - if (png_ptr && png_ptr->interlaced) - { - png_ptr->transformations |= PNG_INTERLACE; - return (7); - } - - return (1); -} -#endif - -#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) -/* Add a filler byte on read, or remove a filler or alpha byte on write. - * The filler type has changed in v0.95 to allow future 2-byte fillers - * for 48-bit input data, as well as to avoid problems with some compilers - * that don't like bytes as parameters. - */ -void PNGAPI -png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc) -{ - png_debug(1, "in png_set_filler\n"); - if(png_ptr == NULL) return; - png_ptr->transformations |= PNG_FILLER; - png_ptr->filler = (png_byte)filler; - if (filler_loc == PNG_FILLER_AFTER) - png_ptr->flags |= PNG_FLAG_FILLER_AFTER; - else - png_ptr->flags &= ~PNG_FLAG_FILLER_AFTER; - - /* This should probably go in the "do_read_filler" routine. - * I attempted to do that in libpng-1.0.1a but that caused problems - * so I restored it in libpng-1.0.2a - */ - - if (png_ptr->color_type == PNG_COLOR_TYPE_RGB) - { - png_ptr->usr_channels = 4; - } - - /* Also I added this in libpng-1.0.2a (what happens when we expand - * a less-than-8-bit grayscale to GA? */ - - if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY && png_ptr->bit_depth >= 8) - { - png_ptr->usr_channels = 2; - } -} - -#if !defined(PNG_1_0_X) -/* Added to libpng-1.2.7 */ -void PNGAPI -png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc) -{ - png_debug(1, "in png_set_add_alpha\n"); - if(png_ptr == NULL) return; - png_set_filler(png_ptr, filler, filler_loc); - png_ptr->transformations |= PNG_ADD_ALPHA; -} -#endif - -#endif - -#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \ - defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) -void PNGAPI -png_set_swap_alpha(png_structp png_ptr) -{ - png_debug(1, "in png_set_swap_alpha\n"); - if(png_ptr == NULL) return; - png_ptr->transformations |= PNG_SWAP_ALPHA; -} -#endif - -#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \ - defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) -void PNGAPI -png_set_invert_alpha(png_structp png_ptr) -{ - png_debug(1, "in png_set_invert_alpha\n"); - if(png_ptr == NULL) return; - png_ptr->transformations |= PNG_INVERT_ALPHA; -} -#endif - -#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) -void PNGAPI -png_set_invert_mono(png_structp png_ptr) -{ - png_debug(1, "in png_set_invert_mono\n"); - if(png_ptr == NULL) return; - png_ptr->transformations |= PNG_INVERT_MONO; -} - -/* invert monochrome grayscale data */ -void /* PRIVATE */ -png_do_invert(png_row_infop row_info, png_bytep row) -{ - png_debug(1, "in png_do_invert\n"); - /* This test removed from libpng version 1.0.13 and 1.2.0: - * if (row_info->bit_depth == 1 && - */ -#if defined(PNG_USELESS_TESTS_SUPPORTED) - if (row == NULL || row_info == NULL) - return; -#endif - if (row_info->color_type == PNG_COLOR_TYPE_GRAY) - { - png_bytep rp = row; - png_uint_32 i; - png_uint_32 istop = row_info->rowbytes; - - for (i = 0; i < istop; i++) - { - *rp = (png_byte)(~(*rp)); - rp++; - } - } - else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA && - row_info->bit_depth == 8) - { - png_bytep rp = row; - png_uint_32 i; - png_uint_32 istop = row_info->rowbytes; - - for (i = 0; i < istop; i+=2) - { - *rp = (png_byte)(~(*rp)); - rp+=2; - } - } - else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA && - row_info->bit_depth == 16) - { - png_bytep rp = row; - png_uint_32 i; - png_uint_32 istop = row_info->rowbytes; - - for (i = 0; i < istop; i+=4) - { - *rp = (png_byte)(~(*rp)); - *(rp+1) = (png_byte)(~(*(rp+1))); - rp+=4; - } - } -} -#endif - -#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) -/* swaps byte order on 16 bit depth images */ -void /* PRIVATE */ -png_do_swap(png_row_infop row_info, png_bytep row) -{ - png_debug(1, "in png_do_swap\n"); - if ( -#if defined(PNG_USELESS_TESTS_SUPPORTED) - row != NULL && row_info != NULL && -#endif - row_info->bit_depth == 16) - { - png_bytep rp = row; - png_uint_32 i; - png_uint_32 istop= row_info->width * row_info->channels; - - for (i = 0; i < istop; i++, rp += 2) - { - png_byte t = *rp; - *rp = *(rp + 1); - *(rp + 1) = t; - } - } -} -#endif - -#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED) -const static PNG_CONST png_byte onebppswaptable[256] = { - 0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, - 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0, - 0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, - 0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8, - 0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4, - 0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4, - 0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC, - 0x1C, 0x9C, 0x5C, 0xDC, 0x3C, 0xBC, 0x7C, 0xFC, - 0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2, - 0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2, - 0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA, - 0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA, - 0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6, - 0x16, 0x96, 0x56, 0xD6, 0x36, 0xB6, 0x76, 0xF6, - 0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE, - 0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE, - 0x01, 0x81, 0x41, 0xC1, 0x21, 0xA1, 0x61, 0xE1, - 0x11, 0x91, 0x51, 0xD1, 0x31, 0xB1, 0x71, 0xF1, - 0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9, - 0x19, 0x99, 0x59, 0xD9, 0x39, 0xB9, 0x79, 0xF9, - 0x05, 0x85, 0x45, 0xC5, 0x25, 0xA5, 0x65, 0xE5, - 0x15, 0x95, 0x55, 0xD5, 0x35, 0xB5, 0x75, 0xF5, - 0x0D, 0x8D, 0x4D, 0xCD, 0x2D, 0xAD, 0x6D, 0xED, - 0x1D, 0x9D, 0x5D, 0xDD, 0x3D, 0xBD, 0x7D, 0xFD, - 0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3, - 0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3, - 0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB, - 0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB, - 0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7, - 0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7, - 0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF, - 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF -}; - -const static PNG_CONST png_byte twobppswaptable[256] = { - 0x00, 0x40, 0x80, 0xC0, 0x10, 0x50, 0x90, 0xD0, - 0x20, 0x60, 0xA0, 0xE0, 0x30, 0x70, 0xB0, 0xF0, - 0x04, 0x44, 0x84, 0xC4, 0x14, 0x54, 0x94, 0xD4, - 0x24, 0x64, 0xA4, 0xE4, 0x34, 0x74, 0xB4, 0xF4, - 0x08, 0x48, 0x88, 0xC8, 0x18, 0x58, 0x98, 0xD8, - 0x28, 0x68, 0xA8, 0xE8, 0x38, 0x78, 0xB8, 0xF8, - 0x0C, 0x4C, 0x8C, 0xCC, 0x1C, 0x5C, 0x9C, 0xDC, - 0x2C, 0x6C, 0xAC, 0xEC, 0x3C, 0x7C, 0xBC, 0xFC, - 0x01, 0x41, 0x81, 0xC1, 0x11, 0x51, 0x91, 0xD1, - 0x21, 0x61, 0xA1, 0xE1, 0x31, 0x71, 0xB1, 0xF1, - 0x05, 0x45, 0x85, 0xC5, 0x15, 0x55, 0x95, 0xD5, - 0x25, 0x65, 0xA5, 0xE5, 0x35, 0x75, 0xB5, 0xF5, - 0x09, 0x49, 0x89, 0xC9, 0x19, 0x59, 0x99, 0xD9, - 0x29, 0x69, 0xA9, 0xE9, 0x39, 0x79, 0xB9, 0xF9, - 0x0D, 0x4D, 0x8D, 0xCD, 0x1D, 0x5D, 0x9D, 0xDD, - 0x2D, 0x6D, 0xAD, 0xED, 0x3D, 0x7D, 0xBD, 0xFD, - 0x02, 0x42, 0x82, 0xC2, 0x12, 0x52, 0x92, 0xD2, - 0x22, 0x62, 0xA2, 0xE2, 0x32, 0x72, 0xB2, 0xF2, - 0x06, 0x46, 0x86, 0xC6, 0x16, 0x56, 0x96, 0xD6, - 0x26, 0x66, 0xA6, 0xE6, 0x36, 0x76, 0xB6, 0xF6, - 0x0A, 0x4A, 0x8A, 0xCA, 0x1A, 0x5A, 0x9A, 0xDA, - 0x2A, 0x6A, 0xAA, 0xEA, 0x3A, 0x7A, 0xBA, 0xFA, - 0x0E, 0x4E, 0x8E, 0xCE, 0x1E, 0x5E, 0x9E, 0xDE, - 0x2E, 0x6E, 0xAE, 0xEE, 0x3E, 0x7E, 0xBE, 0xFE, - 0x03, 0x43, 0x83, 0xC3, 0x13, 0x53, 0x93, 0xD3, - 0x23, 0x63, 0xA3, 0xE3, 0x33, 0x73, 0xB3, 0xF3, - 0x07, 0x47, 0x87, 0xC7, 0x17, 0x57, 0x97, 0xD7, - 0x27, 0x67, 0xA7, 0xE7, 0x37, 0x77, 0xB7, 0xF7, - 0x0B, 0x4B, 0x8B, 0xCB, 0x1B, 0x5B, 0x9B, 0xDB, - 0x2B, 0x6B, 0xAB, 0xEB, 0x3B, 0x7B, 0xBB, 0xFB, - 0x0F, 0x4F, 0x8F, 0xCF, 0x1F, 0x5F, 0x9F, 0xDF, - 0x2F, 0x6F, 0xAF, 0xEF, 0x3F, 0x7F, 0xBF, 0xFF -}; - -const static PNG_CONST png_byte fourbppswaptable[256] = { - 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, - 0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0, - 0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71, - 0x81, 0x91, 0xA1, 0xB1, 0xC1, 0xD1, 0xE1, 0xF1, - 0x02, 0x12, 0x22, 0x32, 0x42, 0x52, 0x62, 0x72, - 0x82, 0x92, 0xA2, 0xB2, 0xC2, 0xD2, 0xE2, 0xF2, - 0x03, 0x13, 0x23, 0x33, 0x43, 0x53, 0x63, 0x73, - 0x83, 0x93, 0xA3, 0xB3, 0xC3, 0xD3, 0xE3, 0xF3, - 0x04, 0x14, 0x24, 0x34, 0x44, 0x54, 0x64, 0x74, - 0x84, 0x94, 0xA4, 0xB4, 0xC4, 0xD4, 0xE4, 0xF4, - 0x05, 0x15, 0x25, 0x35, 0x45, 0x55, 0x65, 0x75, - 0x85, 0x95, 0xA5, 0xB5, 0xC5, 0xD5, 0xE5, 0xF5, - 0x06, 0x16, 0x26, 0x36, 0x46, 0x56, 0x66, 0x76, - 0x86, 0x96, 0xA6, 0xB6, 0xC6, 0xD6, 0xE6, 0xF6, - 0x07, 0x17, 0x27, 0x37, 0x47, 0x57, 0x67, 0x77, - 0x87, 0x97, 0xA7, 0xB7, 0xC7, 0xD7, 0xE7, 0xF7, - 0x08, 0x18, 0x28, 0x38, 0x48, 0x58, 0x68, 0x78, - 0x88, 0x98, 0xA8, 0xB8, 0xC8, 0xD8, 0xE8, 0xF8, - 0x09, 0x19, 0x29, 0x39, 0x49, 0x59, 0x69, 0x79, - 0x89, 0x99, 0xA9, 0xB9, 0xC9, 0xD9, 0xE9, 0xF9, - 0x0A, 0x1A, 0x2A, 0x3A, 0x4A, 0x5A, 0x6A, 0x7A, - 0x8A, 0x9A, 0xAA, 0xBA, 0xCA, 0xDA, 0xEA, 0xFA, - 0x0B, 0x1B, 0x2B, 0x3B, 0x4B, 0x5B, 0x6B, 0x7B, - 0x8B, 0x9B, 0xAB, 0xBB, 0xCB, 0xDB, 0xEB, 0xFB, - 0x0C, 0x1C, 0x2C, 0x3C, 0x4C, 0x5C, 0x6C, 0x7C, - 0x8C, 0x9C, 0xAC, 0xBC, 0xCC, 0xDC, 0xEC, 0xFC, - 0x0D, 0x1D, 0x2D, 0x3D, 0x4D, 0x5D, 0x6D, 0x7D, - 0x8D, 0x9D, 0xAD, 0xBD, 0xCD, 0xDD, 0xED, 0xFD, - 0x0E, 0x1E, 0x2E, 0x3E, 0x4E, 0x5E, 0x6E, 0x7E, - 0x8E, 0x9E, 0xAE, 0xBE, 0xCE, 0xDE, 0xEE, 0xFE, - 0x0F, 0x1F, 0x2F, 0x3F, 0x4F, 0x5F, 0x6F, 0x7F, - 0x8F, 0x9F, 0xAF, 0xBF, 0xCF, 0xDF, 0xEF, 0xFF -}; - /* swaps pixel packing order within bytes */ void /* PRIVATE */ png_do_packswap(png_row_infop row_info, png_bytep row) @@ -1293,13 +631,13 @@ png_set_user_transform_info(png_structp png_ptr, png_voidp user_transform_ptr, int user_transform_depth, int user_transform_channels) { png_debug(1, "in png_set_user_transform_info\n"); - if(png_ptr == NULL) return; + if (png_ptr == NULL) return; #if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) png_ptr->user_transform_ptr = user_transform_ptr; png_ptr->user_transform_depth = (png_byte)user_transform_depth; png_ptr->user_transform_channels = (png_byte)user_transform_channels; #else - if(user_transform_ptr || user_transform_depth || user_transform_channels) + if (user_transform_ptr || user_transform_depth || user_transform_channels) png_warning(png_ptr, "This version of libpng does not support user transform info"); #endif @@ -1314,8 +652,8 @@ png_set_user_transform_info(png_structp png_ptr, png_voidp png_voidp PNGAPI png_get_user_transform_ptr(png_structp png_ptr) { -#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) if (png_ptr == NULL) return (NULL); +#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) return ((png_voidp)png_ptr->user_transform_ptr); #else return (NULL); diff --git a/src/dep/src/irrlicht/libpng/pngvcrd.c b/src/dep/src/irrlicht/libpng/pngvcrd.c index 27b93dc..54fef60 100644 --- a/src/dep/src/irrlicht/libpng/pngvcrd.c +++ b/src/dep/src/irrlicht/libpng/pngvcrd.c @@ -1,3905 +1 @@ /* pnggvrd.c was removed from libpng-1.2.20. */ - -/* pngvcrd.c - mixed C/assembler version of utilities to read a PNG file - * - * For Intel x86 CPU and Microsoft Visual C++ compiler - * - * Last changed in libpng 1.2.6 - August 15, 2004 - * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2004 Glenn Randers-Pehrson - * Copyright (c) 1998, Intel Corporation - * - * Contributed by Nirav Chhatrapati, Intel Corporation, 1998 - * Interface to libpng contributed by Gilles Vollant, 1999 - * - * - * In png_do_read_interlace() in libpng versions 1.0.3a through 1.0.4d, - * a sign error in the post-MMX cleanup code for each pixel_depth resulted - * in bad pixels at the beginning of some rows of some images, and also - * (due to out-of-range memory reads and writes) caused heap corruption - * when compiled with MSVC 6.0. The error was fixed in version 1.0.4e. - * - * [png_read_filter_row_mmx_avg() bpp == 2 bugfix, GRR 20000916] - * - * [runtime MMX configuration, GRR 20010102] - * - */ - -#define PNG_INTERNAL -#include "png.h" - -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && defined(PNG_USE_PNGVCRD) - -static int mmx_supported=2; - - -int PNGAPI -png_mmx_support(void) -{ - int mmx_supported_local = 0; - _asm { - push ebx //CPUID will trash these - push ecx - push edx - - pushfd //Save Eflag to stack - pop eax //Get Eflag from stack into eax - mov ecx, eax //Make another copy of Eflag in ecx - xor eax, 0x200000 //Toggle ID bit in Eflag [i.e. bit(21)] - push eax //Save modified Eflag back to stack - - popfd //Restored modified value back to Eflag reg - pushfd //Save Eflag to stack - pop eax //Get Eflag from stack - push ecx // save original Eflag to stack - popfd // restore original Eflag - xor eax, ecx //Compare the new Eflag with the original Eflag - jz NOT_SUPPORTED //If the same, CPUID instruction is not supported, - //skip following instructions and jump to - //NOT_SUPPORTED label - - xor eax, eax //Set eax to zero - - _asm _emit 0x0f //CPUID instruction (two bytes opcode) - _asm _emit 0xa2 - - cmp eax, 1 //make sure eax return non-zero value - jl NOT_SUPPORTED //If eax is zero, mmx not supported - - xor eax, eax //set eax to zero - inc eax //Now increment eax to 1. This instruction is - //faster than the instruction "mov eax, 1" - - _asm _emit 0x0f //CPUID instruction - _asm _emit 0xa2 - - and edx, 0x00800000 //mask out all bits but mmx bit(24) - cmp edx, 0 // 0 = mmx not supported - jz NOT_SUPPORTED // non-zero = Yes, mmx IS supported - - mov mmx_supported_local, 1 //set return value to 1 - -NOT_SUPPORTED: - mov eax, mmx_supported_local //move return value to eax - pop edx //CPUID trashed these - pop ecx - pop ebx - } - - //mmx_supported_local=0; // test code for force don't support MMX - //printf("MMX : %u (1=MMX supported)\n",mmx_supported_local); - - mmx_supported = mmx_supported_local; - return mmx_supported_local; -} - -/* Combines the row recently read in with the previous row. - This routine takes care of alpha and transparency if requested. - This routine also handles the two methods of progressive display - of interlaced images, depending on the mask value. - The mask value describes which pixels are to be combined with - the row. The pattern always repeats every 8 pixels, so just 8 - bits are needed. A one indicates the pixel is to be combined; a - zero indicates the pixel is to be skipped. This is in addition - to any alpha or transparency value associated with the pixel. If - you want all pixels to be combined, pass 0xff (255) in mask. */ - -/* Use this routine for x86 platform - uses faster MMX routine if machine - supports MMX */ - -void /* PRIVATE */ -png_combine_row(png_structp png_ptr, png_bytep row, int mask) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; -#endif - - png_debug(1,"in png_combine_row_asm\n"); - - if (mmx_supported == 2) { -#if !defined(PNG_1_0_X) - /* this should have happened in png_init_mmx_flags() already */ - png_warning(png_ptr, "asm_flags may not have been initialized"); -#endif - png_mmx_support(); - } - - if (mask == 0xff) - { - png_memcpy(row, png_ptr->row_buf + 1, - (png_size_t)PNG_ROWBYTES(png_ptr->row_info.pixel_depth, - png_ptr->width)); - } - /* GRR: add "else if (mask == 0)" case? - * or does png_combine_row() not even get called in that case? */ - else - { - switch (png_ptr->row_info.pixel_depth) - { - case 1: - { - png_bytep sp; - png_bytep dp; - int s_inc, s_start, s_end; - int m; - int shift; - png_uint_32 i; - - sp = png_ptr->row_buf + 1; - dp = row; - m = 0x80; -#if defined(PNG_READ_PACKSWAP_SUPPORTED) - if (png_ptr->transformations & PNG_PACKSWAP) - { - s_start = 0; - s_end = 7; - s_inc = 1; - } - else -#endif - { - s_start = 7; - s_end = 0; - s_inc = -1; - } - - shift = s_start; - - for (i = 0; i < png_ptr->width; i++) - { - if (m & mask) - { - int value; - - value = (*sp >> shift) & 0x1; - *dp &= (png_byte)((0x7f7f >> (7 - shift)) & 0xff); - *dp |= (png_byte)(value << shift); - } - - if (shift == s_end) - { - shift = s_start; - sp++; - dp++; - } - else - shift += s_inc; - - if (m == 1) - m = 0x80; - else - m >>= 1; - } - break; - } - - case 2: - { - png_bytep sp; - png_bytep dp; - int s_start, s_end, s_inc; - int m; - int shift; - png_uint_32 i; - int value; - - sp = png_ptr->row_buf + 1; - dp = row; - m = 0x80; -#if defined(PNG_READ_PACKSWAP_SUPPORTED) - if (png_ptr->transformations & PNG_PACKSWAP) - { - s_start = 0; - s_end = 6; - s_inc = 2; - } - else -#endif - { - s_start = 6; - s_end = 0; - s_inc = -2; - } - - shift = s_start; - - for (i = 0; i < png_ptr->width; i++) - { - if (m & mask) - { - value = (*sp >> shift) & 0x3; - *dp &= (png_byte)((0x3f3f >> (6 - shift)) & 0xff); - *dp |= (png_byte)(value << shift); - } - - if (shift == s_end) - { - shift = s_start; - sp++; - dp++; - } - else - shift += s_inc; - if (m == 1) - m = 0x80; - else - m >>= 1; - } - break; - } - - case 4: - { - png_bytep sp; - png_bytep dp; - int s_start, s_end, s_inc; - int m; - int shift; - png_uint_32 i; - int value; - - sp = png_ptr->row_buf + 1; - dp = row; - m = 0x80; -#if defined(PNG_READ_PACKSWAP_SUPPORTED) - if (png_ptr->transformations & PNG_PACKSWAP) - { - s_start = 0; - s_end = 4; - s_inc = 4; - } - else -#endif - { - s_start = 4; - s_end = 0; - s_inc = -4; - } - shift = s_start; - - for (i = 0; i < png_ptr->width; i++) - { - if (m & mask) - { - value = (*sp >> shift) & 0xf; - *dp &= (png_byte)((0xf0f >> (4 - shift)) & 0xff); - *dp |= (png_byte)(value << shift); - } - - if (shift == s_end) - { - shift = s_start; - sp++; - dp++; - } - else - shift += s_inc; - if (m == 1) - m = 0x80; - else - m >>= 1; - } - break; - } - - case 8: - { - png_bytep srcptr; - png_bytep dstptr; - png_uint_32 len; - int m; - int diff, unmask; - - __int64 mask0=0x0102040810204080; - -#if !defined(PNG_1_0_X) - if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) - /* && mmx_supported */ ) -#else - if (mmx_supported) -#endif - { - srcptr = png_ptr->row_buf + 1; - dstptr = row; - m = 0x80; - unmask = ~mask; - len = png_ptr->width &~7; //reduce to multiple of 8 - diff = png_ptr->width & 7; //amount lost - - _asm - { - movd mm7, unmask //load bit pattern - psubb mm6,mm6 //zero mm6 - punpcklbw mm7,mm7 - punpcklwd mm7,mm7 - punpckldq mm7,mm7 //fill register with 8 masks - - movq mm0,mask0 - - pand mm0,mm7 //nonzero if keep byte - pcmpeqb mm0,mm6 //zeros->1s, v versa - - mov ecx,len //load length of line (pixels) - mov esi,srcptr //load source - mov ebx,dstptr //load dest - cmp ecx,0 //lcr - je mainloop8end - -mainloop8: - movq mm4,[esi] - pand mm4,mm0 - movq mm6,mm0 - pandn mm6,[ebx] - por mm4,mm6 - movq [ebx],mm4 - - add esi,8 //inc by 8 bytes processed - add ebx,8 - sub ecx,8 //dec by 8 pixels processed - - ja mainloop8 -mainloop8end: - - mov ecx,diff - cmp ecx,0 - jz end8 - - mov edx,mask - sal edx,24 //make low byte the high byte - -secondloop8: - sal edx,1 //move high bit to CF - jnc skip8 //if CF = 0 - mov al,[esi] - mov [ebx],al -skip8: - inc esi - inc ebx - - dec ecx - jnz secondloop8 -end8: - emms - } - } - else /* mmx not supported - use modified C routine */ - { - register unsigned int incr1, initial_val, final_val; - png_size_t pixel_bytes; - png_uint_32 i; - register int disp = png_pass_inc[png_ptr->pass]; - int offset_table[7] = {0, 4, 0, 2, 0, 1, 0}; - - pixel_bytes = (png_ptr->row_info.pixel_depth >> 3); - srcptr = png_ptr->row_buf + 1 + offset_table[png_ptr->pass]* - pixel_bytes; - dstptr = row + offset_table[png_ptr->pass]*pixel_bytes; - initial_val = offset_table[png_ptr->pass]*pixel_bytes; - final_val = png_ptr->width*pixel_bytes; - incr1 = (disp)*pixel_bytes; - for (i = initial_val; i < final_val; i += incr1) - { - png_memcpy(dstptr, srcptr, pixel_bytes); - srcptr += incr1; - dstptr += incr1; - } - } /* end of else */ - - break; - } // end 8 bpp - - case 16: - { - png_bytep srcptr; - png_bytep dstptr; - png_uint_32 len; - int unmask, diff; - __int64 mask1=0x0101020204040808, - mask0=0x1010202040408080; - -#if !defined(PNG_1_0_X) - if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) - /* && mmx_supported */ ) -#else - if (mmx_supported) -#endif - { - srcptr = png_ptr->row_buf + 1; - dstptr = row; - - unmask = ~mask; - len = (png_ptr->width)&~7; - diff = (png_ptr->width)&7; - _asm - { - movd mm7, unmask //load bit pattern - psubb mm6,mm6 //zero mm6 - punpcklbw mm7,mm7 - punpcklwd mm7,mm7 - punpckldq mm7,mm7 //fill register with 8 masks - - movq mm0,mask0 - movq mm1,mask1 - - pand mm0,mm7 - pand mm1,mm7 - - pcmpeqb mm0,mm6 - pcmpeqb mm1,mm6 - - mov ecx,len //load length of line - mov esi,srcptr //load source - mov ebx,dstptr //load dest - cmp ecx,0 //lcr - jz mainloop16end - -mainloop16: - movq mm4,[esi] - pand mm4,mm0 - movq mm6,mm0 - movq mm7,[ebx] - pandn mm6,mm7 - por mm4,mm6 - movq [ebx],mm4 - - movq mm5,[esi+8] - pand mm5,mm1 - movq mm7,mm1 - movq mm6,[ebx+8] - pandn mm7,mm6 - por mm5,mm7 - movq [ebx+8],mm5 - - add esi,16 //inc by 16 bytes processed - add ebx,16 - sub ecx,8 //dec by 8 pixels processed - - ja mainloop16 - -mainloop16end: - mov ecx,diff - cmp ecx,0 - jz end16 - - mov edx,mask - sal edx,24 //make low byte the high byte -secondloop16: - sal edx,1 //move high bit to CF - jnc skip16 //if CF = 0 - mov ax,[esi] - mov [ebx],ax -skip16: - add esi,2 - add ebx,2 - - dec ecx - jnz secondloop16 -end16: - emms - } - } - else /* mmx not supported - use modified C routine */ - { - register unsigned int incr1, initial_val, final_val; - png_size_t pixel_bytes; - png_uint_32 i; - register int disp = png_pass_inc[png_ptr->pass]; - int offset_table[7] = {0, 4, 0, 2, 0, 1, 0}; - - pixel_bytes = (png_ptr->row_info.pixel_depth >> 3); - srcptr = png_ptr->row_buf + 1 + offset_table[png_ptr->pass]* - pixel_bytes; - dstptr = row + offset_table[png_ptr->pass]*pixel_bytes; - initial_val = offset_table[png_ptr->pass]*pixel_bytes; - final_val = png_ptr->width*pixel_bytes; - incr1 = (disp)*pixel_bytes; - for (i = initial_val; i < final_val; i += incr1) - { - png_memcpy(dstptr, srcptr, pixel_bytes); - srcptr += incr1; - dstptr += incr1; - } - } /* end of else */ - - break; - } // end 16 bpp - - case 24: - { - png_bytep srcptr; - png_bytep dstptr; - png_uint_32 len; - int unmask, diff; - - __int64 mask2=0x0101010202020404, //24bpp - mask1=0x0408080810101020, - mask0=0x2020404040808080; - - srcptr = png_ptr->row_buf + 1; - dstptr = row; - - unmask = ~mask; - len = (png_ptr->width)&~7; - diff = (png_ptr->width)&7; - -#if !defined(PNG_1_0_X) - if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) - /* && mmx_supported */ ) -#else - if (mmx_supported) -#endif - { - _asm - { - movd mm7, unmask //load bit pattern - psubb mm6,mm6 //zero mm6 - punpcklbw mm7,mm7 - punpcklwd mm7,mm7 - punpckldq mm7,mm7 //fill register with 8 masks - - movq mm0,mask0 - movq mm1,mask1 - movq mm2,mask2 - - pand mm0,mm7 - pand mm1,mm7 - pand mm2,mm7 - - pcmpeqb mm0,mm6 - pcmpeqb mm1,mm6 - pcmpeqb mm2,mm6 - - mov ecx,len //load length of line - mov esi,srcptr //load source - mov ebx,dstptr //load dest - cmp ecx,0 - jz mainloop24end - -mainloop24: - movq mm4,[esi] - pand mm4,mm0 - movq mm6,mm0 - movq mm7,[ebx] - pandn mm6,mm7 - por mm4,mm6 - movq [ebx],mm4 - - - movq mm5,[esi+8] - pand mm5,mm1 - movq mm7,mm1 - movq mm6,[ebx+8] - pandn mm7,mm6 - por mm5,mm7 - movq [ebx+8],mm5 - - movq mm6,[esi+16] - pand mm6,mm2 - movq mm4,mm2 - movq mm7,[ebx+16] - pandn mm4,mm7 - por mm6,mm4 - movq [ebx+16],mm6 - - add esi,24 //inc by 24 bytes processed - add ebx,24 - sub ecx,8 //dec by 8 pixels processed - - ja mainloop24 - -mainloop24end: - mov ecx,diff - cmp ecx,0 - jz end24 - - mov edx,mask - sal edx,24 //make low byte the high byte -secondloop24: - sal edx,1 //move high bit to CF - jnc skip24 //if CF = 0 - mov ax,[esi] - mov [ebx],ax - xor eax,eax - mov al,[esi+2] - mov [ebx+2],al -skip24: - add esi,3 - add ebx,3 - - dec ecx - jnz secondloop24 - -end24: - emms - } - } - else /* mmx not supported - use modified C routine */ - { - register unsigned int incr1, initial_val, final_val; - png_size_t pixel_bytes; - png_uint_32 i; - register int disp = png_pass_inc[png_ptr->pass]; - int offset_table[7] = {0, 4, 0, 2, 0, 1, 0}; - - pixel_bytes = (png_ptr->row_info.pixel_depth >> 3); - srcptr = png_ptr->row_buf + 1 + offset_table[png_ptr->pass]* - pixel_bytes; - dstptr = row + offset_table[png_ptr->pass]*pixel_bytes; - initial_val = offset_table[png_ptr->pass]*pixel_bytes; - final_val = png_ptr->width*pixel_bytes; - incr1 = (disp)*pixel_bytes; - for (i = initial_val; i < final_val; i += incr1) - { - png_memcpy(dstptr, srcptr, pixel_bytes); - srcptr += incr1; - dstptr += incr1; - } - } /* end of else */ - - break; - } // end 24 bpp - - case 32: - { - png_bytep srcptr; - png_bytep dstptr; - png_uint_32 len; - int unmask, diff; - - __int64 mask3=0x0101010102020202, //32bpp - mask2=0x0404040408080808, - mask1=0x1010101020202020, - mask0=0x4040404080808080; - - srcptr = png_ptr->row_buf + 1; - dstptr = row; - - unmask = ~mask; - len = (png_ptr->width)&~7; - diff = (png_ptr->width)&7; - -#if !defined(PNG_1_0_X) - if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) - /* && mmx_supported */ ) -#else - if (mmx_supported) -#endif - { - _asm - { - movd mm7, unmask //load bit pattern - psubb mm6,mm6 //zero mm6 - punpcklbw mm7,mm7 - punpcklwd mm7,mm7 - punpckldq mm7,mm7 //fill register with 8 masks - - movq mm0,mask0 - movq mm1,mask1 - movq mm2,mask2 - movq mm3,mask3 - - pand mm0,mm7 - pand mm1,mm7 - pand mm2,mm7 - pand mm3,mm7 - - pcmpeqb mm0,mm6 - pcmpeqb mm1,mm6 - pcmpeqb mm2,mm6 - pcmpeqb mm3,mm6 - - mov ecx,len //load length of line - mov esi,srcptr //load source - mov ebx,dstptr //load dest - - cmp ecx,0 //lcr - jz mainloop32end - -mainloop32: - movq mm4,[esi] - pand mm4,mm0 - movq mm6,mm0 - movq mm7,[ebx] - pandn mm6,mm7 - por mm4,mm6 - movq [ebx],mm4 - - movq mm5,[esi+8] - pand mm5,mm1 - movq mm7,mm1 - movq mm6,[ebx+8] - pandn mm7,mm6 - por mm5,mm7 - movq [ebx+8],mm5 - - movq mm6,[esi+16] - pand mm6,mm2 - movq mm4,mm2 - movq mm7,[ebx+16] - pandn mm4,mm7 - por mm6,mm4 - movq [ebx+16],mm6 - - movq mm7,[esi+24] - pand mm7,mm3 - movq mm5,mm3 - movq mm4,[ebx+24] - pandn mm5,mm4 - por mm7,mm5 - movq [ebx+24],mm7 - - add esi,32 //inc by 32 bytes processed - add ebx,32 - sub ecx,8 //dec by 8 pixels processed - - ja mainloop32 - -mainloop32end: - mov ecx,diff - cmp ecx,0 - jz end32 - - mov edx,mask - sal edx,24 //make low byte the high byte -secondloop32: - sal edx,1 //move high bit to CF - jnc skip32 //if CF = 0 - mov eax,[esi] - mov [ebx],eax -skip32: - add esi,4 - add ebx,4 - - dec ecx - jnz secondloop32 - -end32: - emms - } - } - else /* mmx _not supported - Use modified C routine */ - { - register unsigned int incr1, initial_val, final_val; - png_size_t pixel_bytes; - png_uint_32 i; - register int disp = png_pass_inc[png_ptr->pass]; - int offset_table[7] = {0, 4, 0, 2, 0, 1, 0}; - - pixel_bytes = (png_ptr->row_info.pixel_depth >> 3); - srcptr = png_ptr->row_buf + 1 + offset_table[png_ptr->pass]* - pixel_bytes; - dstptr = row + offset_table[png_ptr->pass]*pixel_bytes; - initial_val = offset_table[png_ptr->pass]*pixel_bytes; - final_val = png_ptr->width*pixel_bytes; - incr1 = (disp)*pixel_bytes; - for (i = initial_val; i < final_val; i += incr1) - { - png_memcpy(dstptr, srcptr, pixel_bytes); - srcptr += incr1; - dstptr += incr1; - } - } /* end of else */ - - break; - } // end 32 bpp - - case 48: - { - png_bytep srcptr; - png_bytep dstptr; - png_uint_32 len; - int unmask, diff; - - __int64 mask5=0x0101010101010202, - mask4=0x0202020204040404, - mask3=0x0404080808080808, - mask2=0x1010101010102020, - mask1=0x2020202040404040, - mask0=0x4040808080808080; - -#if !defined(PNG_1_0_X) - if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) - /* && mmx_supported */ ) -#else - if (mmx_supported) -#endif - { - srcptr = png_ptr->row_buf + 1; - dstptr = row; - - unmask = ~mask; - len = (png_ptr->width)&~7; - diff = (png_ptr->width)&7; - _asm - { - movd mm7, unmask //load bit pattern - psubb mm6,mm6 //zero mm6 - punpcklbw mm7,mm7 - punpcklwd mm7,mm7 - punpckldq mm7,mm7 //fill register with 8 masks - - movq mm0,mask0 - movq mm1,mask1 - movq mm2,mask2 - movq mm3,mask3 - movq mm4,mask4 - movq mm5,mask5 - - pand mm0,mm7 - pand mm1,mm7 - pand mm2,mm7 - pand mm3,mm7 - pand mm4,mm7 - pand mm5,mm7 - - pcmpeqb mm0,mm6 - pcmpeqb mm1,mm6 - pcmpeqb mm2,mm6 - pcmpeqb mm3,mm6 - pcmpeqb mm4,mm6 - pcmpeqb mm5,mm6 - - mov ecx,len //load length of line - mov esi,srcptr //load source - mov ebx,dstptr //load dest - - cmp ecx,0 - jz mainloop48end - -mainloop48: - movq mm7,[esi] - pand mm7,mm0 - movq mm6,mm0 - pandn mm6,[ebx] - por mm7,mm6 - movq [ebx],mm7 - - movq mm6,[esi+8] - pand mm6,mm1 - movq mm7,mm1 - pandn mm7,[ebx+8] - por mm6,mm7 - movq [ebx+8],mm6 - - movq mm6,[esi+16] - pand mm6,mm2 - movq mm7,mm2 - pandn mm7,[ebx+16] - por mm6,mm7 - movq [ebx+16],mm6 - - movq mm7,[esi+24] - pand mm7,mm3 - movq mm6,mm3 - pandn mm6,[ebx+24] - por mm7,mm6 - movq [ebx+24],mm7 - - movq mm6,[esi+32] - pand mm6,mm4 - movq mm7,mm4 - pandn mm7,[ebx+32] - por mm6,mm7 - movq [ebx+32],mm6 - - movq mm7,[esi+40] - pand mm7,mm5 - movq mm6,mm5 - pandn mm6,[ebx+40] - por mm7,mm6 - movq [ebx+40],mm7 - - add esi,48 //inc by 32 bytes processed - add ebx,48 - sub ecx,8 //dec by 8 pixels processed - - ja mainloop48 -mainloop48end: - - mov ecx,diff - cmp ecx,0 - jz end48 - - mov edx,mask - sal edx,24 //make low byte the high byte - -secondloop48: - sal edx,1 //move high bit to CF - jnc skip48 //if CF = 0 - mov eax,[esi] - mov [ebx],eax -skip48: - add esi,4 - add ebx,4 - - dec ecx - jnz secondloop48 - -end48: - emms - } - } - else /* mmx _not supported - Use modified C routine */ - { - register unsigned int incr1, initial_val, final_val; - png_size_t pixel_bytes; - png_uint_32 i; - register int disp = png_pass_inc[png_ptr->pass]; - int offset_table[7] = {0, 4, 0, 2, 0, 1, 0}; - - pixel_bytes = (png_ptr->row_info.pixel_depth >> 3); - srcptr = png_ptr->row_buf + 1 + offset_table[png_ptr->pass]* - pixel_bytes; - dstptr = row + offset_table[png_ptr->pass]*pixel_bytes; - initial_val = offset_table[png_ptr->pass]*pixel_bytes; - final_val = png_ptr->width*pixel_bytes; - incr1 = (disp)*pixel_bytes; - for (i = initial_val; i < final_val; i += incr1) - { - png_memcpy(dstptr, srcptr, pixel_bytes); - srcptr += incr1; - dstptr += incr1; - } - } /* end of else */ - - break; - } // end 48 bpp - - default: - { - png_bytep sptr; - png_bytep dp; - png_size_t pixel_bytes; - int offset_table[7] = {0, 4, 0, 2, 0, 1, 0}; - unsigned int i; - register int disp = png_pass_inc[png_ptr->pass]; // get the offset - register unsigned int incr1, initial_val, final_val; - - pixel_bytes = (png_ptr->row_info.pixel_depth >> 3); - sptr = png_ptr->row_buf + 1 + offset_table[png_ptr->pass]* - pixel_bytes; - dp = row + offset_table[png_ptr->pass]*pixel_bytes; - initial_val = offset_table[png_ptr->pass]*pixel_bytes; - final_val = png_ptr->width*pixel_bytes; - incr1 = (disp)*pixel_bytes; - for (i = initial_val; i < final_val; i += incr1) - { - png_memcpy(dp, sptr, pixel_bytes); - sptr += incr1; - dp += incr1; - } - break; - } - } /* end switch (png_ptr->row_info.pixel_depth) */ - } /* end if (non-trivial mask) */ - -} /* end png_combine_row() */ - - -#if defined(PNG_READ_INTERLACING_SUPPORTED) - -void /* PRIVATE */ -png_do_read_interlace(png_structp png_ptr) -{ - png_row_infop row_info = &(png_ptr->row_info); - png_bytep row = png_ptr->row_buf + 1; - int pass = png_ptr->pass; - png_uint_32 transformations = png_ptr->transformations; -#ifdef PNG_USE_LOCAL_ARRAYS - const int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; -#endif - - png_debug(1,"in png_do_read_interlace\n"); - - if (mmx_supported == 2) { -#if !defined(PNG_1_0_X) - /* this should have happened in png_init_mmx_flags() already */ - png_warning(png_ptr, "asm_flags may not have been initialized"); -#endif - png_mmx_support(); - } - - if (row != NULL && row_info != NULL) - { - png_uint_32 final_width; - - final_width = row_info->width * png_pass_inc[pass]; - - switch (row_info->pixel_depth) - { - case 1: - { - png_bytep sp, dp; - int sshift, dshift; - int s_start, s_end, s_inc; - png_byte v; - png_uint_32 i; - int j; - - sp = row + (png_size_t)((row_info->width - 1) >> 3); - dp = row + (png_size_t)((final_width - 1) >> 3); -#if defined(PNG_READ_PACKSWAP_SUPPORTED) - if (transformations & PNG_PACKSWAP) - { - sshift = (int)((row_info->width + 7) & 7); - dshift = (int)((final_width + 7) & 7); - s_start = 7; - s_end = 0; - s_inc = -1; - } - else -#endif - { - sshift = 7 - (int)((row_info->width + 7) & 7); - dshift = 7 - (int)((final_width + 7) & 7); - s_start = 0; - s_end = 7; - s_inc = 1; - } - - for (i = row_info->width; i; i--) - { - v = (png_byte)((*sp >> sshift) & 0x1); - for (j = 0; j < png_pass_inc[pass]; j++) - { - *dp &= (png_byte)((0x7f7f >> (7 - dshift)) & 0xff); - *dp |= (png_byte)(v << dshift); - if (dshift == s_end) - { - dshift = s_start; - dp--; - } - else - dshift += s_inc; - } - if (sshift == s_end) - { - sshift = s_start; - sp--; - } - else - sshift += s_inc; - } - break; - } - - case 2: - { - png_bytep sp, dp; - int sshift, dshift; - int s_start, s_end, s_inc; - png_uint_32 i; - - sp = row + (png_size_t)((row_info->width - 1) >> 2); - dp = row + (png_size_t)((final_width - 1) >> 2); -#if defined(PNG_READ_PACKSWAP_SUPPORTED) - if (transformations & PNG_PACKSWAP) - { - sshift = (png_size_t)(((row_info->width + 3) & 3) << 1); - dshift = (png_size_t)(((final_width + 3) & 3) << 1); - s_start = 6; - s_end = 0; - s_inc = -2; - } - else -#endif - { - sshift = (png_size_t)((3 - ((row_info->width + 3) & 3)) << 1); - dshift = (png_size_t)((3 - ((final_width + 3) & 3)) << 1); - s_start = 0; - s_end = 6; - s_inc = 2; - } - - for (i = row_info->width; i; i--) - { - png_byte v; - int j; - - v = (png_byte)((*sp >> sshift) & 0x3); - for (j = 0; j < png_pass_inc[pass]; j++) - { - *dp &= (png_byte)((0x3f3f >> (6 - dshift)) & 0xff); - *dp |= (png_byte)(v << dshift); - if (dshift == s_end) - { - dshift = s_start; - dp--; - } - else - dshift += s_inc; - } - if (sshift == s_end) - { - sshift = s_start; - sp--; - } - else - sshift += s_inc; - } - break; - } - - case 4: - { - png_bytep sp, dp; - int sshift, dshift; - int s_start, s_end, s_inc; - png_uint_32 i; - - sp = row + (png_size_t)((row_info->width - 1) >> 1); - dp = row + (png_size_t)((final_width - 1) >> 1); -#if defined(PNG_READ_PACKSWAP_SUPPORTED) - if (transformations & PNG_PACKSWAP) - { - sshift = (png_size_t)(((row_info->width + 1) & 1) << 2); - dshift = (png_size_t)(((final_width + 1) & 1) << 2); - s_start = 4; - s_end = 0; - s_inc = -4; - } - else -#endif - { - sshift = (png_size_t)((1 - ((row_info->width + 1) & 1)) << 2); - dshift = (png_size_t)((1 - ((final_width + 1) & 1)) << 2); - s_start = 0; - s_end = 4; - s_inc = 4; - } - - for (i = row_info->width; i; i--) - { - png_byte v; - int j; - - v = (png_byte)((*sp >> sshift) & 0xf); - for (j = 0; j < png_pass_inc[pass]; j++) - { - *dp &= (png_byte)((0xf0f >> (4 - dshift)) & 0xff); - *dp |= (png_byte)(v << dshift); - if (dshift == s_end) - { - dshift = s_start; - dp--; - } - else - dshift += s_inc; - } - if (sshift == s_end) - { - sshift = s_start; - sp--; - } - else - sshift += s_inc; - } - break; - } - - default: // This is the place where the routine is modified - { - __int64 const4 = 0x0000000000FFFFFF; - // __int64 const5 = 0x000000FFFFFF0000; // unused... - __int64 const6 = 0x00000000000000FF; - png_bytep sptr, dp; - png_uint_32 i; - png_size_t pixel_bytes; - int width = row_info->width; - - pixel_bytes = (row_info->pixel_depth >> 3); - - sptr = row + (width - 1) * pixel_bytes; - dp = row + (final_width - 1) * pixel_bytes; - // New code by Nirav Chhatrapati - Intel Corporation - // sign fix by GRR - // NOTE: there is NO MMX code for 48-bit and 64-bit images - - // use MMX routine if machine supports it -#if !defined(PNG_1_0_X) - if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_INTERLACE) - /* && mmx_supported */ ) -#else - if (mmx_supported) -#endif - { - if (pixel_bytes == 3) - { - if (((pass == 0) || (pass == 1)) && width) - { - _asm - { - mov esi, sptr - mov edi, dp - mov ecx, width - sub edi, 21 // (png_pass_inc[pass] - 1)*pixel_bytes -loop_pass0: - movd mm0, [esi] ; X X X X X v2 v1 v0 - pand mm0, const4 ; 0 0 0 0 0 v2 v1 v0 - movq mm1, mm0 ; 0 0 0 0 0 v2 v1 v0 - psllq mm0, 16 ; 0 0 0 v2 v1 v0 0 0 - movq mm2, mm0 ; 0 0 0 v2 v1 v0 0 0 - psllq mm0, 24 ; v2 v1 v0 0 0 0 0 0 - psrlq mm1, 8 ; 0 0 0 0 0 0 v2 v1 - por mm0, mm2 ; v2 v1 v0 v2 v1 v0 0 0 - por mm0, mm1 ; v2 v1 v0 v2 v1 v0 v2 v1 - movq mm3, mm0 ; v2 v1 v0 v2 v1 v0 v2 v1 - psllq mm0, 16 ; v0 v2 v1 v0 v2 v1 0 0 - movq mm4, mm3 ; v2 v1 v0 v2 v1 v0 v2 v1 - punpckhdq mm3, mm0 ; v0 v2 v1 v0 v2 v1 v0 v2 - movq [edi+16] , mm4 - psrlq mm0, 32 ; 0 0 0 0 v0 v2 v1 v0 - movq [edi+8] , mm3 - punpckldq mm0, mm4 ; v1 v0 v2 v1 v0 v2 v1 v0 - sub esi, 3 - movq [edi], mm0 - sub edi, 24 - //sub esi, 3 - dec ecx - jnz loop_pass0 - EMMS - } - } - else if (((pass == 2) || (pass == 3)) && width) - { - _asm - { - mov esi, sptr - mov edi, dp - mov ecx, width - sub edi, 9 // (png_pass_inc[pass] - 1)*pixel_bytes -loop_pass2: - movd mm0, [esi] ; X X X X X v2 v1 v0 - pand mm0, const4 ; 0 0 0 0 0 v2 v1 v0 - movq mm1, mm0 ; 0 0 0 0 0 v2 v1 v0 - psllq mm0, 16 ; 0 0 0 v2 v1 v0 0 0 - movq mm2, mm0 ; 0 0 0 v2 v1 v0 0 0 - psllq mm0, 24 ; v2 v1 v0 0 0 0 0 0 - psrlq mm1, 8 ; 0 0 0 0 0 0 v2 v1 - por mm0, mm2 ; v2 v1 v0 v2 v1 v0 0 0 - por mm0, mm1 ; v2 v1 v0 v2 v1 v0 v2 v1 - movq [edi+4], mm0 ; move to memory - psrlq mm0, 16 ; 0 0 v2 v1 v0 v2 v1 v0 - movd [edi], mm0 ; move to memory - sub esi, 3 - sub edi, 12 - dec ecx - jnz loop_pass2 - EMMS - } - } - else if (width) /* && ((pass == 4) || (pass == 5)) */ - { - int width_mmx = ((width >> 1) << 1) - 8; - if (width_mmx < 0) - width_mmx = 0; - width -= width_mmx; // 8 or 9 pix, 24 or 27 bytes - if (width_mmx) - { - _asm - { - mov esi, sptr - mov edi, dp - mov ecx, width_mmx - sub esi, 3 - sub edi, 9 -loop_pass4: - movq mm0, [esi] ; X X v2 v1 v0 v5 v4 v3 - movq mm7, mm0 ; X X v2 v1 v0 v5 v4 v3 - movq mm6, mm0 ; X X v2 v1 v0 v5 v4 v3 - psllq mm0, 24 ; v1 v0 v5 v4 v3 0 0 0 - pand mm7, const4 ; 0 0 0 0 0 v5 v4 v3 - psrlq mm6, 24 ; 0 0 0 X X v2 v1 v0 - por mm0, mm7 ; v1 v0 v5 v4 v3 v5 v4 v3 - movq mm5, mm6 ; 0 0 0 X X v2 v1 v0 - psllq mm6, 8 ; 0 0 X X v2 v1 v0 0 - movq [edi], mm0 ; move quad to memory - psrlq mm5, 16 ; 0 0 0 0 0 X X v2 - pand mm5, const6 ; 0 0 0 0 0 0 0 v2 - por mm6, mm5 ; 0 0 X X v2 v1 v0 v2 - movd [edi+8], mm6 ; move double to memory - sub esi, 6 - sub edi, 12 - sub ecx, 2 - jnz loop_pass4 - EMMS - } - } - - sptr -= width_mmx*3; - dp -= width_mmx*6; - for (i = width; i; i--) - { - png_byte v[8]; - int j; - - png_memcpy(v, sptr, 3); - for (j = 0; j < png_pass_inc[pass]; j++) - { - png_memcpy(dp, v, 3); - dp -= 3; - } - sptr -= 3; - } - } - } /* end of pixel_bytes == 3 */ - - else if (pixel_bytes == 1) - { - if (((pass == 0) || (pass == 1)) && width) - { - int width_mmx = ((width >> 2) << 2); - width -= width_mmx; - if (width_mmx) - { - _asm - { - mov esi, sptr - mov edi, dp - mov ecx, width_mmx - sub edi, 31 - sub esi, 3 -loop1_pass0: - movd mm0, [esi] ; X X X X v0 v1 v2 v3 - movq mm1, mm0 ; X X X X v0 v1 v2 v3 - punpcklbw mm0, mm0 ; v0 v0 v1 v1 v2 v2 v3 v3 - movq mm2, mm0 ; v0 v0 v1 v1 v2 v2 v3 v3 - punpcklwd mm0, mm0 ; v2 v2 v2 v2 v3 v3 v3 v3 - movq mm3, mm0 ; v2 v2 v2 v2 v3 v3 v3 v3 - punpckldq mm0, mm0 ; v3 v3 v3 v3 v3 v3 v3 v3 - punpckhdq mm3, mm3 ; v2 v2 v2 v2 v2 v2 v2 v2 - movq [edi], mm0 ; move to memory v3 - punpckhwd mm2, mm2 ; v0 v0 v0 v0 v1 v1 v1 v1 - movq [edi+8], mm3 ; move to memory v2 - movq mm4, mm2 ; v0 v0 v0 v0 v1 v1 v1 v1 - punpckldq mm2, mm2 ; v1 v1 v1 v1 v1 v1 v1 v1 - punpckhdq mm4, mm4 ; v0 v0 v0 v0 v0 v0 v0 v0 - movq [edi+16], mm2 ; move to memory v1 - movq [edi+24], mm4 ; move to memory v0 - sub esi, 4 - sub edi, 32 - sub ecx, 4 - jnz loop1_pass0 - EMMS - } - } - - sptr -= width_mmx; - dp -= width_mmx*8; - for (i = width; i; i--) - { - int j; - - /* I simplified this part in version 1.0.4e - * here and in several other instances where - * pixel_bytes == 1 -- GR-P - * - * Original code: - * - * png_byte v[8]; - * png_memcpy(v, sptr, pixel_bytes); - * for (j = 0; j < png_pass_inc[pass]; j++) - * { - * png_memcpy(dp, v, pixel_bytes); - * dp -= pixel_bytes; - * } - * sptr -= pixel_bytes; - * - * Replacement code is in the next three lines: - */ - - for (j = 0; j < png_pass_inc[pass]; j++) - *dp-- = *sptr; - sptr--; - } - } - else if (((pass == 2) || (pass == 3)) && width) - { - int width_mmx = ((width >> 2) << 2); - width -= width_mmx; - if (width_mmx) - { - _asm - { - mov esi, sptr - mov edi, dp - mov ecx, width_mmx - sub edi, 15 - sub esi, 3 -loop1_pass2: - movd mm0, [esi] ; X X X X v0 v1 v2 v3 - punpcklbw mm0, mm0 ; v0 v0 v1 v1 v2 v2 v3 v3 - movq mm1, mm0 ; v0 v0 v1 v1 v2 v2 v3 v3 - punpcklwd mm0, mm0 ; v2 v2 v2 v2 v3 v3 v3 v3 - punpckhwd mm1, mm1 ; v0 v0 v0 v0 v1 v1 v1 v1 - movq [edi], mm0 ; move to memory v2 and v3 - sub esi, 4 - movq [edi+8], mm1 ; move to memory v1 and v0 - sub edi, 16 - sub ecx, 4 - jnz loop1_pass2 - EMMS - } - } - - sptr -= width_mmx; - dp -= width_mmx*4; - for (i = width; i; i--) - { - int j; - - for (j = 0; j < png_pass_inc[pass]; j++) - { - *dp-- = *sptr; - } - sptr --; - } - } - else if (width) /* && ((pass == 4) || (pass == 5))) */ - { - int width_mmx = ((width >> 3) << 3); - width -= width_mmx; - if (width_mmx) - { - _asm - { - mov esi, sptr - mov edi, dp - mov ecx, width_mmx - sub edi, 15 - sub esi, 7 -loop1_pass4: - movq mm0, [esi] ; v0 v1 v2 v3 v4 v5 v6 v7 - movq mm1, mm0 ; v0 v1 v2 v3 v4 v5 v6 v7 - punpcklbw mm0, mm0 ; v4 v4 v5 v5 v6 v6 v7 v7 - //movq mm1, mm0 ; v0 v0 v1 v1 v2 v2 v3 v3 - punpckhbw mm1, mm1 ;v0 v0 v1 v1 v2 v2 v3 v3 - movq [edi+8], mm1 ; move to memory v0 v1 v2 and v3 - sub esi, 8 - movq [edi], mm0 ; move to memory v4 v5 v6 and v7 - //sub esi, 4 - sub edi, 16 - sub ecx, 8 - jnz loop1_pass4 - EMMS - } - } - - sptr -= width_mmx; - dp -= width_mmx*2; - for (i = width; i; i--) - { - int j; - - for (j = 0; j < png_pass_inc[pass]; j++) - { - *dp-- = *sptr; - } - sptr --; - } - } - } /* end of pixel_bytes == 1 */ - - else if (pixel_bytes == 2) - { - if (((pass == 0) || (pass == 1)) && width) - { - int width_mmx = ((width >> 1) << 1); - width -= width_mmx; - if (width_mmx) - { - _asm - { - mov esi, sptr - mov edi, dp - mov ecx, width_mmx - sub esi, 2 - sub edi, 30 -loop2_pass0: - movd mm0, [esi] ; X X X X v1 v0 v3 v2 - punpcklwd mm0, mm0 ; v1 v0 v1 v0 v3 v2 v3 v2 - movq mm1, mm0 ; v1 v0 v1 v0 v3 v2 v3 v2 - punpckldq mm0, mm0 ; v3 v2 v3 v2 v3 v2 v3 v2 - punpckhdq mm1, mm1 ; v1 v0 v1 v0 v1 v0 v1 v0 - movq [edi], mm0 - movq [edi + 8], mm0 - movq [edi + 16], mm1 - movq [edi + 24], mm1 - sub esi, 4 - sub edi, 32 - sub ecx, 2 - jnz loop2_pass0 - EMMS - } - } - - sptr -= (width_mmx*2 - 2); // sign fixed - dp -= (width_mmx*16 - 2); // sign fixed - for (i = width; i; i--) - { - png_byte v[8]; - int j; - sptr -= 2; - png_memcpy(v, sptr, 2); - for (j = 0; j < png_pass_inc[pass]; j++) - { - dp -= 2; - png_memcpy(dp, v, 2); - } - } - } - else if (((pass == 2) || (pass == 3)) && width) - { - int width_mmx = ((width >> 1) << 1) ; - width -= width_mmx; - if (width_mmx) - { - _asm - { - mov esi, sptr - mov edi, dp - mov ecx, width_mmx - sub esi, 2 - sub edi, 14 -loop2_pass2: - movd mm0, [esi] ; X X X X v1 v0 v3 v2 - punpcklwd mm0, mm0 ; v1 v0 v1 v0 v3 v2 v3 v2 - movq mm1, mm0 ; v1 v0 v1 v0 v3 v2 v3 v2 - punpckldq mm0, mm0 ; v3 v2 v3 v2 v3 v2 v3 v2 - punpckhdq mm1, mm1 ; v1 v0 v1 v0 v1 v0 v1 v0 - movq [edi], mm0 - sub esi, 4 - movq [edi + 8], mm1 - //sub esi, 4 - sub edi, 16 - sub ecx, 2 - jnz loop2_pass2 - EMMS - } - } - - sptr -= (width_mmx*2 - 2); // sign fixed - dp -= (width_mmx*8 - 2); // sign fixed - for (i = width; i; i--) - { - png_byte v[8]; - int j; - sptr -= 2; - png_memcpy(v, sptr, 2); - for (j = 0; j < png_pass_inc[pass]; j++) - { - dp -= 2; - png_memcpy(dp, v, 2); - } - } - } - else if (width) // pass == 4 or 5 - { - int width_mmx = ((width >> 1) << 1) ; - width -= width_mmx; - if (width_mmx) - { - _asm - { - mov esi, sptr - mov edi, dp - mov ecx, width_mmx - sub esi, 2 - sub edi, 6 -loop2_pass4: - movd mm0, [esi] ; X X X X v1 v0 v3 v2 - punpcklwd mm0, mm0 ; v1 v0 v1 v0 v3 v2 v3 v2 - sub esi, 4 - movq [edi], mm0 - sub edi, 8 - sub ecx, 2 - jnz loop2_pass4 - EMMS - } - } - - sptr -= (width_mmx*2 - 2); // sign fixed - dp -= (width_mmx*4 - 2); // sign fixed - for (i = width; i; i--) - { - png_byte v[8]; - int j; - sptr -= 2; - png_memcpy(v, sptr, 2); - for (j = 0; j < png_pass_inc[pass]; j++) - { - dp -= 2; - png_memcpy(dp, v, 2); - } - } - } - } /* end of pixel_bytes == 2 */ - - else if (pixel_bytes == 4) - { - if (((pass == 0) || (pass == 1)) && width) - { - int width_mmx = ((width >> 1) << 1) ; - width -= width_mmx; - if (width_mmx) - { - _asm - { - mov esi, sptr - mov edi, dp - mov ecx, width_mmx - sub esi, 4 - sub edi, 60 -loop4_pass0: - movq mm0, [esi] ; v3 v2 v1 v0 v7 v6 v5 v4 - movq mm1, mm0 ; v3 v2 v1 v0 v7 v6 v5 v4 - punpckldq mm0, mm0 ; v7 v6 v5 v4 v7 v6 v5 v4 - punpckhdq mm1, mm1 ; v3 v2 v1 v0 v3 v2 v1 v0 - movq [edi], mm0 - movq [edi + 8], mm0 - movq [edi + 16], mm0 - movq [edi + 24], mm0 - movq [edi+32], mm1 - movq [edi + 40], mm1 - movq [edi+ 48], mm1 - sub esi, 8 - movq [edi + 56], mm1 - sub edi, 64 - sub ecx, 2 - jnz loop4_pass0 - EMMS - } - } - - sptr -= (width_mmx*4 - 4); // sign fixed - dp -= (width_mmx*32 - 4); // sign fixed - for (i = width; i; i--) - { - png_byte v[8]; - int j; - sptr -= 4; - png_memcpy(v, sptr, 4); - for (j = 0; j < png_pass_inc[pass]; j++) - { - dp -= 4; - png_memcpy(dp, v, 4); - } - } - } - else if (((pass == 2) || (pass == 3)) && width) - { - int width_mmx = ((width >> 1) << 1) ; - width -= width_mmx; - if (width_mmx) - { - _asm - { - mov esi, sptr - mov edi, dp - mov ecx, width_mmx - sub esi, 4 - sub edi, 28 -loop4_pass2: - movq mm0, [esi] ; v3 v2 v1 v0 v7 v6 v5 v4 - movq mm1, mm0 ; v3 v2 v1 v0 v7 v6 v5 v4 - punpckldq mm0, mm0 ; v7 v6 v5 v4 v7 v6 v5 v4 - punpckhdq mm1, mm1 ; v3 v2 v1 v0 v3 v2 v1 v0 - movq [edi], mm0 - movq [edi + 8], mm0 - movq [edi+16], mm1 - movq [edi + 24], mm1 - sub esi, 8 - sub edi, 32 - sub ecx, 2 - jnz loop4_pass2 - EMMS - } - } - - sptr -= (width_mmx*4 - 4); // sign fixed - dp -= (width_mmx*16 - 4); // sign fixed - for (i = width; i; i--) - { - png_byte v[8]; - int j; - sptr -= 4; - png_memcpy(v, sptr, 4); - for (j = 0; j < png_pass_inc[pass]; j++) - { - dp -= 4; - png_memcpy(dp, v, 4); - } - } - } - else if (width) // pass == 4 or 5 - { - int width_mmx = ((width >> 1) << 1) ; - width -= width_mmx; - if (width_mmx) - { - _asm - { - mov esi, sptr - mov edi, dp - mov ecx, width_mmx - sub esi, 4 - sub edi, 12 -loop4_pass4: - movq mm0, [esi] ; v3 v2 v1 v0 v7 v6 v5 v4 - movq mm1, mm0 ; v3 v2 v1 v0 v7 v6 v5 v4 - punpckldq mm0, mm0 ; v7 v6 v5 v4 v7 v6 v5 v4 - punpckhdq mm1, mm1 ; v3 v2 v1 v0 v3 v2 v1 v0 - movq [edi], mm0 - sub esi, 8 - movq [edi + 8], mm1 - sub edi, 16 - sub ecx, 2 - jnz loop4_pass4 - EMMS - } - } - - sptr -= (width_mmx*4 - 4); // sign fixed - dp -= (width_mmx*8 - 4); // sign fixed - for (i = width; i; i--) - { - png_byte v[8]; - int j; - sptr -= 4; - png_memcpy(v, sptr, 4); - for (j = 0; j < png_pass_inc[pass]; j++) - { - dp -= 4; - png_memcpy(dp, v, 4); - } - } - } - - } /* end of pixel_bytes == 4 */ - - else if (pixel_bytes == 6) - { - for (i = width; i; i--) - { - png_byte v[8]; - int j; - png_memcpy(v, sptr, 6); - for (j = 0; j < png_pass_inc[pass]; j++) - { - png_memcpy(dp, v, 6); - dp -= 6; - } - sptr -= 6; - } - } /* end of pixel_bytes == 6 */ - - else - { - for (i = width; i; i--) - { - png_byte v[8]; - int j; - png_memcpy(v, sptr, pixel_bytes); - for (j = 0; j < png_pass_inc[pass]; j++) - { - png_memcpy(dp, v, pixel_bytes); - dp -= pixel_bytes; - } - sptr-= pixel_bytes; - } - } - } /* end of mmx_supported */ - - else /* MMX not supported: use modified C code - takes advantage - * of inlining of memcpy for a constant */ - { - if (pixel_bytes == 1) - { - for (i = width; i; i--) - { - int j; - for (j = 0; j < png_pass_inc[pass]; j++) - *dp-- = *sptr; - sptr--; - } - } - else if (pixel_bytes == 3) - { - for (i = width; i; i--) - { - png_byte v[8]; - int j; - png_memcpy(v, sptr, pixel_bytes); - for (j = 0; j < png_pass_inc[pass]; j++) - { - png_memcpy(dp, v, pixel_bytes); - dp -= pixel_bytes; - } - sptr -= pixel_bytes; - } - } - else if (pixel_bytes == 2) - { - for (i = width; i; i--) - { - png_byte v[8]; - int j; - png_memcpy(v, sptr, pixel_bytes); - for (j = 0; j < png_pass_inc[pass]; j++) - { - png_memcpy(dp, v, pixel_bytes); - dp -= pixel_bytes; - } - sptr -= pixel_bytes; - } - } - else if (pixel_bytes == 4) - { - for (i = width; i; i--) - { - png_byte v[8]; - int j; - png_memcpy(v, sptr, pixel_bytes); - for (j = 0; j < png_pass_inc[pass]; j++) - { - png_memcpy(dp, v, pixel_bytes); - dp -= pixel_bytes; - } - sptr -= pixel_bytes; - } - } - else if (pixel_bytes == 6) - { - for (i = width; i; i--) - { - png_byte v[8]; - int j; - png_memcpy(v, sptr, pixel_bytes); - for (j = 0; j < png_pass_inc[pass]; j++) - { - png_memcpy(dp, v, pixel_bytes); - dp -= pixel_bytes; - } - sptr -= pixel_bytes; - } - } - else - { - for (i = width; i; i--) - { - png_byte v[8]; - int j; - png_memcpy(v, sptr, pixel_bytes); - for (j = 0; j < png_pass_inc[pass]; j++) - { - png_memcpy(dp, v, pixel_bytes); - dp -= pixel_bytes; - } - sptr -= pixel_bytes; - } - } - - } /* end of MMX not supported */ - break; - } - } /* end switch (row_info->pixel_depth) */ - - row_info->width = final_width; - - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,final_width); - } - -} - -#endif /* PNG_READ_INTERLACING_SUPPORTED */ - - -// These variables are utilized in the functions below. They are declared -// globally here to ensure alignment on 8-byte boundaries. - -union uAll { - __int64 use; - double align; -} LBCarryMask = {0x0101010101010101}, - HBClearMask = {0x7f7f7f7f7f7f7f7f}, - ActiveMask, ActiveMask2, ActiveMaskEnd, ShiftBpp, ShiftRem; - - -// Optimized code for PNG Average filter decoder -void /* PRIVATE */ -png_read_filter_row_mmx_avg(png_row_infop row_info, png_bytep row - , png_bytep prev_row) -{ - int bpp; - png_uint_32 FullLength; - png_uint_32 MMXLength; - //png_uint_32 len; - int diff; - - bpp = (row_info->pixel_depth + 7) >> 3; // Get # bytes per pixel - FullLength = row_info->rowbytes; // # of bytes to filter - _asm { - // Init address pointers and offset - mov edi, row // edi ==> Avg(x) - xor ebx, ebx // ebx ==> x - mov edx, edi - mov esi, prev_row // esi ==> Prior(x) - sub edx, bpp // edx ==> Raw(x-bpp) - - xor eax, eax - // Compute the Raw value for the first bpp bytes - // Raw(x) = Avg(x) + (Prior(x)/2) -davgrlp: - mov al, [esi + ebx] // Load al with Prior(x) - inc ebx - shr al, 1 // divide by 2 - add al, [edi+ebx-1] // Add Avg(x); -1 to offset inc ebx - cmp ebx, bpp - mov [edi+ebx-1], al // Write back Raw(x); - // mov does not affect flags; -1 to offset inc ebx - jb davgrlp - // get # of bytes to alignment - mov diff, edi // take start of row - add diff, ebx // add bpp - add diff, 0xf // add 7 + 8 to incr past alignment boundary - and diff, 0xfffffff8 // mask to alignment boundary - sub diff, edi // subtract from start ==> value ebx at alignment - jz davggo - // fix alignment - // Compute the Raw value for the bytes upto the alignment boundary - // Raw(x) = Avg(x) + ((Raw(x-bpp) + Prior(x))/2) - xor ecx, ecx -davglp1: - xor eax, eax - mov cl, [esi + ebx] // load cl with Prior(x) - mov al, [edx + ebx] // load al with Raw(x-bpp) - add ax, cx - inc ebx - shr ax, 1 // divide by 2 - add al, [edi+ebx-1] // Add Avg(x); -1 to offset inc ebx - cmp ebx, diff // Check if at alignment boundary - mov [edi+ebx-1], al // Write back Raw(x); - // mov does not affect flags; -1 to offset inc ebx - jb davglp1 // Repeat until at alignment boundary -davggo: - mov eax, FullLength - mov ecx, eax - sub eax, ebx // subtract alignment fix - and eax, 0x00000007 // calc bytes over mult of 8 - sub ecx, eax // drop over bytes from original length - mov MMXLength, ecx - } // end _asm block - // Now do the math for the rest of the row - switch ( bpp ) - { - case 3: - { - ActiveMask.use = 0x0000000000ffffff; - ShiftBpp.use = 24; // == 3 * 8 - ShiftRem.use = 40; // == 64 - 24 - _asm { - // Re-init address pointers and offset - movq mm7, ActiveMask - mov ebx, diff // ebx ==> x = offset to alignment boundary - movq mm5, LBCarryMask - mov edi, row // edi ==> Avg(x) - movq mm4, HBClearMask - mov esi, prev_row // esi ==> Prior(x) - // PRIME the pump (load the first Raw(x-bpp) data set - movq mm2, [edi + ebx - 8] // Load previous aligned 8 bytes - // (we correct position in loop below) -davg3lp: - movq mm0, [edi + ebx] // Load mm0 with Avg(x) - // Add (Prev_row/2) to Average - movq mm3, mm5 - psrlq mm2, ShiftRem // Correct position Raw(x-bpp) data - movq mm1, [esi + ebx] // Load mm1 with Prior(x) - movq mm6, mm7 - pand mm3, mm1 // get lsb for each prev_row byte - psrlq mm1, 1 // divide prev_row bytes by 2 - pand mm1, mm4 // clear invalid bit 7 of each byte - paddb mm0, mm1 // add (Prev_row/2) to Avg for each byte - // Add 1st active group (Raw(x-bpp)/2) to Average with LBCarry - movq mm1, mm3 // now use mm1 for getting LBCarrys - pand mm1, mm2 // get LBCarrys for each byte where both - // lsb's were == 1 (Only valid for active group) - psrlq mm2, 1 // divide raw bytes by 2 - pand mm2, mm4 // clear invalid bit 7 of each byte - paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte - pand mm2, mm6 // Leave only Active Group 1 bytes to add to Avg - paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active - // byte - // Add 2nd active group (Raw(x-bpp)/2) to Average with LBCarry - psllq mm6, ShiftBpp // shift the mm6 mask to cover bytes 3-5 - movq mm2, mm0 // mov updated Raws to mm2 - psllq mm2, ShiftBpp // shift data to position correctly - movq mm1, mm3 // now use mm1 for getting LBCarrys - pand mm1, mm2 // get LBCarrys for each byte where both - // lsb's were == 1 (Only valid for active group) - psrlq mm2, 1 // divide raw bytes by 2 - pand mm2, mm4 // clear invalid bit 7 of each byte - paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte - pand mm2, mm6 // Leave only Active Group 2 bytes to add to Avg - paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active - // byte - - // Add 3rd active group (Raw(x-bpp)/2) to Average with LBCarry - psllq mm6, ShiftBpp // shift the mm6 mask to cover the last two - // bytes - movq mm2, mm0 // mov updated Raws to mm2 - psllq mm2, ShiftBpp // shift data to position correctly - // Data only needs to be shifted once here to - // get the correct x-bpp offset. - movq mm1, mm3 // now use mm1 for getting LBCarrys - pand mm1, mm2 // get LBCarrys for each byte where both - // lsb's were == 1 (Only valid for active group) - psrlq mm2, 1 // divide raw bytes by 2 - pand mm2, mm4 // clear invalid bit 7 of each byte - paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte - pand mm2, mm6 // Leave only Active Group 2 bytes to add to Avg - add ebx, 8 - paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active - // byte - - // Now ready to write back to memory - movq [edi + ebx - 8], mm0 - // Move updated Raw(x) to use as Raw(x-bpp) for next loop - cmp ebx, MMXLength - movq mm2, mm0 // mov updated Raw(x) to mm2 - jb davg3lp - } // end _asm block - } - break; - - case 6: - case 4: - case 7: - case 5: - { - ActiveMask.use = 0xffffffffffffffff; // use shift below to clear - // appropriate inactive bytes - ShiftBpp.use = bpp << 3; - ShiftRem.use = 64 - ShiftBpp.use; - _asm { - movq mm4, HBClearMask - // Re-init address pointers and offset - mov ebx, diff // ebx ==> x = offset to alignment boundary - // Load ActiveMask and clear all bytes except for 1st active group - movq mm7, ActiveMask - mov edi, row // edi ==> Avg(x) - psrlq mm7, ShiftRem - mov esi, prev_row // esi ==> Prior(x) - movq mm6, mm7 - movq mm5, LBCarryMask - psllq mm6, ShiftBpp // Create mask for 2nd active group - // PRIME the pump (load the first Raw(x-bpp) data set - movq mm2, [edi + ebx - 8] // Load previous aligned 8 bytes - // (we correct position in loop below) -davg4lp: - movq mm0, [edi + ebx] - psrlq mm2, ShiftRem // shift data to position correctly - movq mm1, [esi + ebx] - // Add (Prev_row/2) to Average - movq mm3, mm5 - pand mm3, mm1 // get lsb for each prev_row byte - psrlq mm1, 1 // divide prev_row bytes by 2 - pand mm1, mm4 // clear invalid bit 7 of each byte - paddb mm0, mm1 // add (Prev_row/2) to Avg for each byte - // Add 1st active group (Raw(x-bpp)/2) to Average with LBCarry - movq mm1, mm3 // now use mm1 for getting LBCarrys - pand mm1, mm2 // get LBCarrys for each byte where both - // lsb's were == 1 (Only valid for active group) - psrlq mm2, 1 // divide raw bytes by 2 - pand mm2, mm4 // clear invalid bit 7 of each byte - paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte - pand mm2, mm7 // Leave only Active Group 1 bytes to add to Avg - paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active - // byte - // Add 2nd active group (Raw(x-bpp)/2) to Average with LBCarry - movq mm2, mm0 // mov updated Raws to mm2 - psllq mm2, ShiftBpp // shift data to position correctly - add ebx, 8 - movq mm1, mm3 // now use mm1 for getting LBCarrys - pand mm1, mm2 // get LBCarrys for each byte where both - // lsb's were == 1 (Only valid for active group) - psrlq mm2, 1 // divide raw bytes by 2 - pand mm2, mm4 // clear invalid bit 7 of each byte - paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte - pand mm2, mm6 // Leave only Active Group 2 bytes to add to Avg - paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active - // byte - cmp ebx, MMXLength - // Now ready to write back to memory - movq [edi + ebx - 8], mm0 - // Prep Raw(x-bpp) for next loop - movq mm2, mm0 // mov updated Raws to mm2 - jb davg4lp - } // end _asm block - } - break; - case 2: - { - ActiveMask.use = 0x000000000000ffff; - ShiftBpp.use = 16; // == 2 * 8 [BUGFIX] - ShiftRem.use = 48; // == 64 - 16 [BUGFIX] - _asm { - // Load ActiveMask - movq mm7, ActiveMask - // Re-init address pointers and offset - mov ebx, diff // ebx ==> x = offset to alignment boundary - movq mm5, LBCarryMask - mov edi, row // edi ==> Avg(x) - movq mm4, HBClearMask - mov esi, prev_row // esi ==> Prior(x) - // PRIME the pump (load the first Raw(x-bpp) data set - movq mm2, [edi + ebx - 8] // Load previous aligned 8 bytes - // (we correct position in loop below) -davg2lp: - movq mm0, [edi + ebx] - psrlq mm2, ShiftRem // shift data to position correctly [BUGFIX] - movq mm1, [esi + ebx] - // Add (Prev_row/2) to Average - movq mm3, mm5 - pand mm3, mm1 // get lsb for each prev_row byte - psrlq mm1, 1 // divide prev_row bytes by 2 - pand mm1, mm4 // clear invalid bit 7 of each byte - movq mm6, mm7 - paddb mm0, mm1 // add (Prev_row/2) to Avg for each byte - // Add 1st active group (Raw(x-bpp)/2) to Average with LBCarry - movq mm1, mm3 // now use mm1 for getting LBCarrys - pand mm1, mm2 // get LBCarrys for each byte where both - // lsb's were == 1 (Only valid for active group) - psrlq mm2, 1 // divide raw bytes by 2 - pand mm2, mm4 // clear invalid bit 7 of each byte - paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte - pand mm2, mm6 // Leave only Active Group 1 bytes to add to Avg - paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active byte - // Add 2nd active group (Raw(x-bpp)/2) to Average with LBCarry - psllq mm6, ShiftBpp // shift the mm6 mask to cover bytes 2 & 3 - movq mm2, mm0 // mov updated Raws to mm2 - psllq mm2, ShiftBpp // shift data to position correctly - movq mm1, mm3 // now use mm1 for getting LBCarrys - pand mm1, mm2 // get LBCarrys for each byte where both - // lsb's were == 1 (Only valid for active group) - psrlq mm2, 1 // divide raw bytes by 2 - pand mm2, mm4 // clear invalid bit 7 of each byte - paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte - pand mm2, mm6 // Leave only Active Group 2 bytes to add to Avg - paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active byte - - // Add rdd active group (Raw(x-bpp)/2) to Average with LBCarry - psllq mm6, ShiftBpp // shift the mm6 mask to cover bytes 4 & 5 - movq mm2, mm0 // mov updated Raws to mm2 - psllq mm2, ShiftBpp // shift data to position correctly - // Data only needs to be shifted once here to - // get the correct x-bpp offset. - movq mm1, mm3 // now use mm1 for getting LBCarrys - pand mm1, mm2 // get LBCarrys for each byte where both - // lsb's were == 1 (Only valid for active group) - psrlq mm2, 1 // divide raw bytes by 2 - pand mm2, mm4 // clear invalid bit 7 of each byte - paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte - pand mm2, mm6 // Leave only Active Group 2 bytes to add to Avg - paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active byte - - // Add 4th active group (Raw(x-bpp)/2) to Average with LBCarry - psllq mm6, ShiftBpp // shift the mm6 mask to cover bytes 6 & 7 - movq mm2, mm0 // mov updated Raws to mm2 - psllq mm2, ShiftBpp // shift data to position correctly - // Data only needs to be shifted once here to - // get the correct x-bpp offset. - add ebx, 8 - movq mm1, mm3 // now use mm1 for getting LBCarrys - pand mm1, mm2 // get LBCarrys for each byte where both - // lsb's were == 1 (Only valid for active group) - psrlq mm2, 1 // divide raw bytes by 2 - pand mm2, mm4 // clear invalid bit 7 of each byte - paddb mm2, mm1 // add LBCarrys to (Raw(x-bpp)/2) for each byte - pand mm2, mm6 // Leave only Active Group 2 bytes to add to Avg - paddb mm0, mm2 // add (Raw/2) + LBCarrys to Avg for each Active byte - - cmp ebx, MMXLength - // Now ready to write back to memory - movq [edi + ebx - 8], mm0 - // Prep Raw(x-bpp) for next loop - movq mm2, mm0 // mov updated Raws to mm2 - jb davg2lp - } // end _asm block - } - break; - - case 1: // bpp == 1 - { - _asm { - // Re-init address pointers and offset - mov ebx, diff // ebx ==> x = offset to alignment boundary - mov edi, row // edi ==> Avg(x) - cmp ebx, FullLength // Test if offset at end of array - jnb davg1end - // Do Paeth decode for remaining bytes - mov esi, prev_row // esi ==> Prior(x) - mov edx, edi - xor ecx, ecx // zero ecx before using cl & cx in loop below - sub edx, bpp // edx ==> Raw(x-bpp) -davg1lp: - // Raw(x) = Avg(x) + ((Raw(x-bpp) + Prior(x))/2) - xor eax, eax - mov cl, [esi + ebx] // load cl with Prior(x) - mov al, [edx + ebx] // load al with Raw(x-bpp) - add ax, cx - inc ebx - shr ax, 1 // divide by 2 - add al, [edi+ebx-1] // Add Avg(x); -1 to offset inc ebx - cmp ebx, FullLength // Check if at end of array - mov [edi+ebx-1], al // Write back Raw(x); - // mov does not affect flags; -1 to offset inc ebx - jb davg1lp -davg1end: - } // end _asm block - } - return; - - case 8: // bpp == 8 - { - _asm { - // Re-init address pointers and offset - mov ebx, diff // ebx ==> x = offset to alignment boundary - movq mm5, LBCarryMask - mov edi, row // edi ==> Avg(x) - movq mm4, HBClearMask - mov esi, prev_row // esi ==> Prior(x) - // PRIME the pump (load the first Raw(x-bpp) data set - movq mm2, [edi + ebx - 8] // Load previous aligned 8 bytes - // (NO NEED to correct position in loop below) -davg8lp: - movq mm0, [edi + ebx] - movq mm3, mm5 - movq mm1, [esi + ebx] - add ebx, 8 - pand mm3, mm1 // get lsb for each prev_row byte - psrlq mm1, 1 // divide prev_row bytes by 2 - pand mm3, mm2 // get LBCarrys for each byte where both - // lsb's were == 1 - psrlq mm2, 1 // divide raw bytes by 2 - pand mm1, mm4 // clear invalid bit 7 of each byte - paddb mm0, mm3 // add LBCarrys to Avg for each byte - pand mm2, mm4 // clear invalid bit 7 of each byte - paddb mm0, mm1 // add (Prev_row/2) to Avg for each byte - paddb mm0, mm2 // add (Raw/2) to Avg for each byte - cmp ebx, MMXLength - movq [edi + ebx - 8], mm0 - movq mm2, mm0 // reuse as Raw(x-bpp) - jb davg8lp - } // end _asm block - } - break; - default: // bpp greater than 8 - { - _asm { - movq mm5, LBCarryMask - // Re-init address pointers and offset - mov ebx, diff // ebx ==> x = offset to alignment boundary - mov edi, row // edi ==> Avg(x) - movq mm4, HBClearMask - mov edx, edi - mov esi, prev_row // esi ==> Prior(x) - sub edx, bpp // edx ==> Raw(x-bpp) -davgAlp: - movq mm0, [edi + ebx] - movq mm3, mm5 - movq mm1, [esi + ebx] - pand mm3, mm1 // get lsb for each prev_row byte - movq mm2, [edx + ebx] - psrlq mm1, 1 // divide prev_row bytes by 2 - pand mm3, mm2 // get LBCarrys for each byte where both - // lsb's were == 1 - psrlq mm2, 1 // divide raw bytes by 2 - pand mm1, mm4 // clear invalid bit 7 of each byte - paddb mm0, mm3 // add LBCarrys to Avg for each byte - pand mm2, mm4 // clear invalid bit 7 of each byte - paddb mm0, mm1 // add (Prev_row/2) to Avg for each byte - add ebx, 8 - paddb mm0, mm2 // add (Raw/2) to Avg for each byte - cmp ebx, MMXLength - movq [edi + ebx - 8], mm0 - jb davgAlp - } // end _asm block - } - break; - } // end switch ( bpp ) - - _asm { - // MMX acceleration complete now do clean-up - // Check if any remaining bytes left to decode - mov ebx, MMXLength // ebx ==> x = offset bytes remaining after MMX - mov edi, row // edi ==> Avg(x) - cmp ebx, FullLength // Test if offset at end of array - jnb davgend - // Do Paeth decode for remaining bytes - mov esi, prev_row // esi ==> Prior(x) - mov edx, edi - xor ecx, ecx // zero ecx before using cl & cx in loop below - sub edx, bpp // edx ==> Raw(x-bpp) -davglp2: - // Raw(x) = Avg(x) + ((Raw(x-bpp) + Prior(x))/2) - xor eax, eax - mov cl, [esi + ebx] // load cl with Prior(x) - mov al, [edx + ebx] // load al with Raw(x-bpp) - add ax, cx - inc ebx - shr ax, 1 // divide by 2 - add al, [edi+ebx-1] // Add Avg(x); -1 to offset inc ebx - cmp ebx, FullLength // Check if at end of array - mov [edi+ebx-1], al // Write back Raw(x); - // mov does not affect flags; -1 to offset inc ebx - jb davglp2 -davgend: - emms // End MMX instructions; prep for possible FP instrs. - } // end _asm block -} - -// Optimized code for PNG Paeth filter decoder -void /* PRIVATE */ -png_read_filter_row_mmx_paeth(png_row_infop row_info, png_bytep row, - png_bytep prev_row) -{ - png_uint_32 FullLength; - png_uint_32 MMXLength; - //png_uint_32 len; - int bpp; - int diff; - //int ptemp; - int patemp, pbtemp, pctemp; - - bpp = (row_info->pixel_depth + 7) >> 3; // Get # bytes per pixel - FullLength = row_info->rowbytes; // # of bytes to filter - _asm - { - xor ebx, ebx // ebx ==> x offset - mov edi, row - xor edx, edx // edx ==> x-bpp offset - mov esi, prev_row - xor eax, eax - - // Compute the Raw value for the first bpp bytes - // Note: the formula works out to be always - // Paeth(x) = Raw(x) + Prior(x) where x < bpp -dpthrlp: - mov al, [edi + ebx] - add al, [esi + ebx] - inc ebx - cmp ebx, bpp - mov [edi + ebx - 1], al - jb dpthrlp - // get # of bytes to alignment - mov diff, edi // take start of row - add diff, ebx // add bpp - xor ecx, ecx - add diff, 0xf // add 7 + 8 to incr past alignment boundary - and diff, 0xfffffff8 // mask to alignment boundary - sub diff, edi // subtract from start ==> value ebx at alignment - jz dpthgo - // fix alignment -dpthlp1: - xor eax, eax - // pav = p - a = (a + b - c) - a = b - c - mov al, [esi + ebx] // load Prior(x) into al - mov cl, [esi + edx] // load Prior(x-bpp) into cl - sub eax, ecx // subtract Prior(x-bpp) - mov patemp, eax // Save pav for later use - xor eax, eax - // pbv = p - b = (a + b - c) - b = a - c - mov al, [edi + edx] // load Raw(x-bpp) into al - sub eax, ecx // subtract Prior(x-bpp) - mov ecx, eax - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv - add eax, patemp // pcv = pav + pbv - // pc = abs(pcv) - test eax, 0x80000000 - jz dpthpca - neg eax // reverse sign of neg values -dpthpca: - mov pctemp, eax // save pc for later use - // pb = abs(pbv) - test ecx, 0x80000000 - jz dpthpba - neg ecx // reverse sign of neg values -dpthpba: - mov pbtemp, ecx // save pb for later use - // pa = abs(pav) - mov eax, patemp - test eax, 0x80000000 - jz dpthpaa - neg eax // reverse sign of neg values -dpthpaa: - mov patemp, eax // save pa for later use - // test if pa <= pb - cmp eax, ecx - jna dpthabb - // pa > pb; now test if pb <= pc - cmp ecx, pctemp - jna dpthbbc - // pb > pc; Raw(x) = Paeth(x) + Prior(x-bpp) - mov cl, [esi + edx] // load Prior(x-bpp) into cl - jmp dpthpaeth -dpthbbc: - // pb <= pc; Raw(x) = Paeth(x) + Prior(x) - mov cl, [esi + ebx] // load Prior(x) into cl - jmp dpthpaeth -dpthabb: - // pa <= pb; now test if pa <= pc - cmp eax, pctemp - jna dpthabc - // pa > pc; Raw(x) = Paeth(x) + Prior(x-bpp) - mov cl, [esi + edx] // load Prior(x-bpp) into cl - jmp dpthpaeth -dpthabc: - // pa <= pc; Raw(x) = Paeth(x) + Raw(x-bpp) - mov cl, [edi + edx] // load Raw(x-bpp) into cl -dpthpaeth: - inc ebx - inc edx - // Raw(x) = (Paeth(x) + Paeth_Predictor( a, b, c )) mod 256 - add [edi + ebx - 1], cl - cmp ebx, diff - jb dpthlp1 -dpthgo: - mov ecx, FullLength - mov eax, ecx - sub eax, ebx // subtract alignment fix - and eax, 0x00000007 // calc bytes over mult of 8 - sub ecx, eax // drop over bytes from original length - mov MMXLength, ecx - } // end _asm block - // Now do the math for the rest of the row - switch ( bpp ) - { - case 3: - { - ActiveMask.use = 0x0000000000ffffff; - ActiveMaskEnd.use = 0xffff000000000000; - ShiftBpp.use = 24; // == bpp(3) * 8 - ShiftRem.use = 40; // == 64 - 24 - _asm - { - mov ebx, diff - mov edi, row - mov esi, prev_row - pxor mm0, mm0 - // PRIME the pump (load the first Raw(x-bpp) data set - movq mm1, [edi+ebx-8] -dpth3lp: - psrlq mm1, ShiftRem // shift last 3 bytes to 1st 3 bytes - movq mm2, [esi + ebx] // load b=Prior(x) - punpcklbw mm1, mm0 // Unpack High bytes of a - movq mm3, [esi+ebx-8] // Prep c=Prior(x-bpp) bytes - punpcklbw mm2, mm0 // Unpack High bytes of b - psrlq mm3, ShiftRem // shift last 3 bytes to 1st 3 bytes - // pav = p - a = (a + b - c) - a = b - c - movq mm4, mm2 - punpcklbw mm3, mm0 // Unpack High bytes of c - // pbv = p - b = (a + b - c) - b = a - c - movq mm5, mm1 - psubw mm4, mm3 - pxor mm7, mm7 - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv - movq mm6, mm4 - psubw mm5, mm3 - - // pa = abs(p-a) = abs(pav) - // pb = abs(p-b) = abs(pbv) - // pc = abs(p-c) = abs(pcv) - pcmpgtw mm0, mm4 // Create mask pav bytes < 0 - paddw mm6, mm5 - pand mm0, mm4 // Only pav bytes < 0 in mm7 - pcmpgtw mm7, mm5 // Create mask pbv bytes < 0 - psubw mm4, mm0 - pand mm7, mm5 // Only pbv bytes < 0 in mm0 - psubw mm4, mm0 - psubw mm5, mm7 - pxor mm0, mm0 - pcmpgtw mm0, mm6 // Create mask pcv bytes < 0 - pand mm0, mm6 // Only pav bytes < 0 in mm7 - psubw mm5, mm7 - psubw mm6, mm0 - // test pa <= pb - movq mm7, mm4 - psubw mm6, mm0 - pcmpgtw mm7, mm5 // pa > pb? - movq mm0, mm7 - // use mm7 mask to merge pa & pb - pand mm5, mm7 - // use mm0 mask copy to merge a & b - pand mm2, mm0 - pandn mm7, mm4 - pandn mm0, mm1 - paddw mm7, mm5 - paddw mm0, mm2 - // test ((pa <= pb)? pa:pb) <= pc - pcmpgtw mm7, mm6 // pab > pc? - pxor mm1, mm1 - pand mm3, mm7 - pandn mm7, mm0 - paddw mm7, mm3 - pxor mm0, mm0 - packuswb mm7, mm1 - movq mm3, [esi + ebx] // load c=Prior(x-bpp) - pand mm7, ActiveMask - movq mm2, mm3 // load b=Prior(x) step 1 - paddb mm7, [edi + ebx] // add Paeth predictor with Raw(x) - punpcklbw mm3, mm0 // Unpack High bytes of c - movq [edi + ebx], mm7 // write back updated value - movq mm1, mm7 // Now mm1 will be used as Raw(x-bpp) - // Now do Paeth for 2nd set of bytes (3-5) - psrlq mm2, ShiftBpp // load b=Prior(x) step 2 - punpcklbw mm1, mm0 // Unpack High bytes of a - pxor mm7, mm7 - punpcklbw mm2, mm0 // Unpack High bytes of b - // pbv = p - b = (a + b - c) - b = a - c - movq mm5, mm1 - // pav = p - a = (a + b - c) - a = b - c - movq mm4, mm2 - psubw mm5, mm3 - psubw mm4, mm3 - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = - // pav + pbv = pbv + pav - movq mm6, mm5 - paddw mm6, mm4 - - // pa = abs(p-a) = abs(pav) - // pb = abs(p-b) = abs(pbv) - // pc = abs(p-c) = abs(pcv) - pcmpgtw mm0, mm5 // Create mask pbv bytes < 0 - pcmpgtw mm7, mm4 // Create mask pav bytes < 0 - pand mm0, mm5 // Only pbv bytes < 0 in mm0 - pand mm7, mm4 // Only pav bytes < 0 in mm7 - psubw mm5, mm0 - psubw mm4, mm7 - psubw mm5, mm0 - psubw mm4, mm7 - pxor mm0, mm0 - pcmpgtw mm0, mm6 // Create mask pcv bytes < 0 - pand mm0, mm6 // Only pav bytes < 0 in mm7 - psubw mm6, mm0 - // test pa <= pb - movq mm7, mm4 - psubw mm6, mm0 - pcmpgtw mm7, mm5 // pa > pb? - movq mm0, mm7 - // use mm7 mask to merge pa & pb - pand mm5, mm7 - // use mm0 mask copy to merge a & b - pand mm2, mm0 - pandn mm7, mm4 - pandn mm0, mm1 - paddw mm7, mm5 - paddw mm0, mm2 - // test ((pa <= pb)? pa:pb) <= pc - pcmpgtw mm7, mm6 // pab > pc? - movq mm2, [esi + ebx] // load b=Prior(x) - pand mm3, mm7 - pandn mm7, mm0 - pxor mm1, mm1 - paddw mm7, mm3 - pxor mm0, mm0 - packuswb mm7, mm1 - movq mm3, mm2 // load c=Prior(x-bpp) step 1 - pand mm7, ActiveMask - punpckhbw mm2, mm0 // Unpack High bytes of b - psllq mm7, ShiftBpp // Shift bytes to 2nd group of 3 bytes - // pav = p - a = (a + b - c) - a = b - c - movq mm4, mm2 - paddb mm7, [edi + ebx] // add Paeth predictor with Raw(x) - psllq mm3, ShiftBpp // load c=Prior(x-bpp) step 2 - movq [edi + ebx], mm7 // write back updated value - movq mm1, mm7 - punpckhbw mm3, mm0 // Unpack High bytes of c - psllq mm1, ShiftBpp // Shift bytes - // Now mm1 will be used as Raw(x-bpp) - // Now do Paeth for 3rd, and final, set of bytes (6-7) - pxor mm7, mm7 - punpckhbw mm1, mm0 // Unpack High bytes of a - psubw mm4, mm3 - // pbv = p - b = (a + b - c) - b = a - c - movq mm5, mm1 - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv - movq mm6, mm4 - psubw mm5, mm3 - pxor mm0, mm0 - paddw mm6, mm5 - - // pa = abs(p-a) = abs(pav) - // pb = abs(p-b) = abs(pbv) - // pc = abs(p-c) = abs(pcv) - pcmpgtw mm0, mm4 // Create mask pav bytes < 0 - pcmpgtw mm7, mm5 // Create mask pbv bytes < 0 - pand mm0, mm4 // Only pav bytes < 0 in mm7 - pand mm7, mm5 // Only pbv bytes < 0 in mm0 - psubw mm4, mm0 - psubw mm5, mm7 - psubw mm4, mm0 - psubw mm5, mm7 - pxor mm0, mm0 - pcmpgtw mm0, mm6 // Create mask pcv bytes < 0 - pand mm0, mm6 // Only pav bytes < 0 in mm7 - psubw mm6, mm0 - // test pa <= pb - movq mm7, mm4 - psubw mm6, mm0 - pcmpgtw mm7, mm5 // pa > pb? - movq mm0, mm7 - // use mm0 mask copy to merge a & b - pand mm2, mm0 - // use mm7 mask to merge pa & pb - pand mm5, mm7 - pandn mm0, mm1 - pandn mm7, mm4 - paddw mm0, mm2 - paddw mm7, mm5 - // test ((pa <= pb)? pa:pb) <= pc - pcmpgtw mm7, mm6 // pab > pc? - pand mm3, mm7 - pandn mm7, mm0 - paddw mm7, mm3 - pxor mm1, mm1 - packuswb mm1, mm7 - // Step ebx to next set of 8 bytes and repeat loop til done - add ebx, 8 - pand mm1, ActiveMaskEnd - paddb mm1, [edi + ebx - 8] // add Paeth predictor with Raw(x) - - cmp ebx, MMXLength - pxor mm0, mm0 // pxor does not affect flags - movq [edi + ebx - 8], mm1 // write back updated value - // mm1 will be used as Raw(x-bpp) next loop - // mm3 ready to be used as Prior(x-bpp) next loop - jb dpth3lp - } // end _asm block - } - break; - - case 6: - case 7: - case 5: - { - ActiveMask.use = 0x00000000ffffffff; - ActiveMask2.use = 0xffffffff00000000; - ShiftBpp.use = bpp << 3; // == bpp * 8 - ShiftRem.use = 64 - ShiftBpp.use; - _asm - { - mov ebx, diff - mov edi, row - mov esi, prev_row - // PRIME the pump (load the first Raw(x-bpp) data set - movq mm1, [edi+ebx-8] - pxor mm0, mm0 -dpth6lp: - // Must shift to position Raw(x-bpp) data - psrlq mm1, ShiftRem - // Do first set of 4 bytes - movq mm3, [esi+ebx-8] // read c=Prior(x-bpp) bytes - punpcklbw mm1, mm0 // Unpack Low bytes of a - movq mm2, [esi + ebx] // load b=Prior(x) - punpcklbw mm2, mm0 // Unpack Low bytes of b - // Must shift to position Prior(x-bpp) data - psrlq mm3, ShiftRem - // pav = p - a = (a + b - c) - a = b - c - movq mm4, mm2 - punpcklbw mm3, mm0 // Unpack Low bytes of c - // pbv = p - b = (a + b - c) - b = a - c - movq mm5, mm1 - psubw mm4, mm3 - pxor mm7, mm7 - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv - movq mm6, mm4 - psubw mm5, mm3 - // pa = abs(p-a) = abs(pav) - // pb = abs(p-b) = abs(pbv) - // pc = abs(p-c) = abs(pcv) - pcmpgtw mm0, mm4 // Create mask pav bytes < 0 - paddw mm6, mm5 - pand mm0, mm4 // Only pav bytes < 0 in mm7 - pcmpgtw mm7, mm5 // Create mask pbv bytes < 0 - psubw mm4, mm0 - pand mm7, mm5 // Only pbv bytes < 0 in mm0 - psubw mm4, mm0 - psubw mm5, mm7 - pxor mm0, mm0 - pcmpgtw mm0, mm6 // Create mask pcv bytes < 0 - pand mm0, mm6 // Only pav bytes < 0 in mm7 - psubw mm5, mm7 - psubw mm6, mm0 - // test pa <= pb - movq mm7, mm4 - psubw mm6, mm0 - pcmpgtw mm7, mm5 // pa > pb? - movq mm0, mm7 - // use mm7 mask to merge pa & pb - pand mm5, mm7 - // use mm0 mask copy to merge a & b - pand mm2, mm0 - pandn mm7, mm4 - pandn mm0, mm1 - paddw mm7, mm5 - paddw mm0, mm2 - // test ((pa <= pb)? pa:pb) <= pc - pcmpgtw mm7, mm6 // pab > pc? - pxor mm1, mm1 - pand mm3, mm7 - pandn mm7, mm0 - paddw mm7, mm3 - pxor mm0, mm0 - packuswb mm7, mm1 - movq mm3, [esi + ebx - 8] // load c=Prior(x-bpp) - pand mm7, ActiveMask - psrlq mm3, ShiftRem - movq mm2, [esi + ebx] // load b=Prior(x) step 1 - paddb mm7, [edi + ebx] // add Paeth predictor with Raw(x) - movq mm6, mm2 - movq [edi + ebx], mm7 // write back updated value - movq mm1, [edi+ebx-8] - psllq mm6, ShiftBpp - movq mm5, mm7 - psrlq mm1, ShiftRem - por mm3, mm6 - psllq mm5, ShiftBpp - punpckhbw mm3, mm0 // Unpack High bytes of c - por mm1, mm5 - // Do second set of 4 bytes - punpckhbw mm2, mm0 // Unpack High bytes of b - punpckhbw mm1, mm0 // Unpack High bytes of a - // pav = p - a = (a + b - c) - a = b - c - movq mm4, mm2 - // pbv = p - b = (a + b - c) - b = a - c - movq mm5, mm1 - psubw mm4, mm3 - pxor mm7, mm7 - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv - movq mm6, mm4 - psubw mm5, mm3 - // pa = abs(p-a) = abs(pav) - // pb = abs(p-b) = abs(pbv) - // pc = abs(p-c) = abs(pcv) - pcmpgtw mm0, mm4 // Create mask pav bytes < 0 - paddw mm6, mm5 - pand mm0, mm4 // Only pav bytes < 0 in mm7 - pcmpgtw mm7, mm5 // Create mask pbv bytes < 0 - psubw mm4, mm0 - pand mm7, mm5 // Only pbv bytes < 0 in mm0 - psubw mm4, mm0 - psubw mm5, mm7 - pxor mm0, mm0 - pcmpgtw mm0, mm6 // Create mask pcv bytes < 0 - pand mm0, mm6 // Only pav bytes < 0 in mm7 - psubw mm5, mm7 - psubw mm6, mm0 - // test pa <= pb - movq mm7, mm4 - psubw mm6, mm0 - pcmpgtw mm7, mm5 // pa > pb? - movq mm0, mm7 - // use mm7 mask to merge pa & pb - pand mm5, mm7 - // use mm0 mask copy to merge a & b - pand mm2, mm0 - pandn mm7, mm4 - pandn mm0, mm1 - paddw mm7, mm5 - paddw mm0, mm2 - // test ((pa <= pb)? pa:pb) <= pc - pcmpgtw mm7, mm6 // pab > pc? - pxor mm1, mm1 - pand mm3, mm7 - pandn mm7, mm0 - pxor mm1, mm1 - paddw mm7, mm3 - pxor mm0, mm0 - // Step ex to next set of 8 bytes and repeat loop til done - add ebx, 8 - packuswb mm1, mm7 - paddb mm1, [edi + ebx - 8] // add Paeth predictor with Raw(x) - cmp ebx, MMXLength - movq [edi + ebx - 8], mm1 // write back updated value - // mm1 will be used as Raw(x-bpp) next loop - jb dpth6lp - } // end _asm block - } - break; - - case 4: - { - ActiveMask.use = 0x00000000ffffffff; - _asm { - mov ebx, diff - mov edi, row - mov esi, prev_row - pxor mm0, mm0 - // PRIME the pump (load the first Raw(x-bpp) data set - movq mm1, [edi+ebx-8] // Only time should need to read - // a=Raw(x-bpp) bytes -dpth4lp: - // Do first set of 4 bytes - movq mm3, [esi+ebx-8] // read c=Prior(x-bpp) bytes - punpckhbw mm1, mm0 // Unpack Low bytes of a - movq mm2, [esi + ebx] // load b=Prior(x) - punpcklbw mm2, mm0 // Unpack High bytes of b - // pav = p - a = (a + b - c) - a = b - c - movq mm4, mm2 - punpckhbw mm3, mm0 // Unpack High bytes of c - // pbv = p - b = (a + b - c) - b = a - c - movq mm5, mm1 - psubw mm4, mm3 - pxor mm7, mm7 - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv - movq mm6, mm4 - psubw mm5, mm3 - // pa = abs(p-a) = abs(pav) - // pb = abs(p-b) = abs(pbv) - // pc = abs(p-c) = abs(pcv) - pcmpgtw mm0, mm4 // Create mask pav bytes < 0 - paddw mm6, mm5 - pand mm0, mm4 // Only pav bytes < 0 in mm7 - pcmpgtw mm7, mm5 // Create mask pbv bytes < 0 - psubw mm4, mm0 - pand mm7, mm5 // Only pbv bytes < 0 in mm0 - psubw mm4, mm0 - psubw mm5, mm7 - pxor mm0, mm0 - pcmpgtw mm0, mm6 // Create mask pcv bytes < 0 - pand mm0, mm6 // Only pav bytes < 0 in mm7 - psubw mm5, mm7 - psubw mm6, mm0 - // test pa <= pb - movq mm7, mm4 - psubw mm6, mm0 - pcmpgtw mm7, mm5 // pa > pb? - movq mm0, mm7 - // use mm7 mask to merge pa & pb - pand mm5, mm7 - // use mm0 mask copy to merge a & b - pand mm2, mm0 - pandn mm7, mm4 - pandn mm0, mm1 - paddw mm7, mm5 - paddw mm0, mm2 - // test ((pa <= pb)? pa:pb) <= pc - pcmpgtw mm7, mm6 // pab > pc? - pxor mm1, mm1 - pand mm3, mm7 - pandn mm7, mm0 - paddw mm7, mm3 - pxor mm0, mm0 - packuswb mm7, mm1 - movq mm3, [esi + ebx] // load c=Prior(x-bpp) - pand mm7, ActiveMask - movq mm2, mm3 // load b=Prior(x) step 1 - paddb mm7, [edi + ebx] // add Paeth predictor with Raw(x) - punpcklbw mm3, mm0 // Unpack High bytes of c - movq [edi + ebx], mm7 // write back updated value - movq mm1, mm7 // Now mm1 will be used as Raw(x-bpp) - // Do second set of 4 bytes - punpckhbw mm2, mm0 // Unpack Low bytes of b - punpcklbw mm1, mm0 // Unpack Low bytes of a - // pav = p - a = (a + b - c) - a = b - c - movq mm4, mm2 - // pbv = p - b = (a + b - c) - b = a - c - movq mm5, mm1 - psubw mm4, mm3 - pxor mm7, mm7 - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv - movq mm6, mm4 - psubw mm5, mm3 - // pa = abs(p-a) = abs(pav) - // pb = abs(p-b) = abs(pbv) - // pc = abs(p-c) = abs(pcv) - pcmpgtw mm0, mm4 // Create mask pav bytes < 0 - paddw mm6, mm5 - pand mm0, mm4 // Only pav bytes < 0 in mm7 - pcmpgtw mm7, mm5 // Create mask pbv bytes < 0 - psubw mm4, mm0 - pand mm7, mm5 // Only pbv bytes < 0 in mm0 - psubw mm4, mm0 - psubw mm5, mm7 - pxor mm0, mm0 - pcmpgtw mm0, mm6 // Create mask pcv bytes < 0 - pand mm0, mm6 // Only pav bytes < 0 in mm7 - psubw mm5, mm7 - psubw mm6, mm0 - // test pa <= pb - movq mm7, mm4 - psubw mm6, mm0 - pcmpgtw mm7, mm5 // pa > pb? - movq mm0, mm7 - // use mm7 mask to merge pa & pb - pand mm5, mm7 - // use mm0 mask copy to merge a & b - pand mm2, mm0 - pandn mm7, mm4 - pandn mm0, mm1 - paddw mm7, mm5 - paddw mm0, mm2 - // test ((pa <= pb)? pa:pb) <= pc - pcmpgtw mm7, mm6 // pab > pc? - pxor mm1, mm1 - pand mm3, mm7 - pandn mm7, mm0 - pxor mm1, mm1 - paddw mm7, mm3 - pxor mm0, mm0 - // Step ex to next set of 8 bytes and repeat loop til done - add ebx, 8 - packuswb mm1, mm7 - paddb mm1, [edi + ebx - 8] // add Paeth predictor with Raw(x) - cmp ebx, MMXLength - movq [edi + ebx - 8], mm1 // write back updated value - // mm1 will be used as Raw(x-bpp) next loop - jb dpth4lp - } // end _asm block - } - break; - case 8: // bpp == 8 - { - ActiveMask.use = 0x00000000ffffffff; - _asm { - mov ebx, diff - mov edi, row - mov esi, prev_row - pxor mm0, mm0 - // PRIME the pump (load the first Raw(x-bpp) data set - movq mm1, [edi+ebx-8] // Only time should need to read - // a=Raw(x-bpp) bytes -dpth8lp: - // Do first set of 4 bytes - movq mm3, [esi+ebx-8] // read c=Prior(x-bpp) bytes - punpcklbw mm1, mm0 // Unpack Low bytes of a - movq mm2, [esi + ebx] // load b=Prior(x) - punpcklbw mm2, mm0 // Unpack Low bytes of b - // pav = p - a = (a + b - c) - a = b - c - movq mm4, mm2 - punpcklbw mm3, mm0 // Unpack Low bytes of c - // pbv = p - b = (a + b - c) - b = a - c - movq mm5, mm1 - psubw mm4, mm3 - pxor mm7, mm7 - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv - movq mm6, mm4 - psubw mm5, mm3 - // pa = abs(p-a) = abs(pav) - // pb = abs(p-b) = abs(pbv) - // pc = abs(p-c) = abs(pcv) - pcmpgtw mm0, mm4 // Create mask pav bytes < 0 - paddw mm6, mm5 - pand mm0, mm4 // Only pav bytes < 0 in mm7 - pcmpgtw mm7, mm5 // Create mask pbv bytes < 0 - psubw mm4, mm0 - pand mm7, mm5 // Only pbv bytes < 0 in mm0 - psubw mm4, mm0 - psubw mm5, mm7 - pxor mm0, mm0 - pcmpgtw mm0, mm6 // Create mask pcv bytes < 0 - pand mm0, mm6 // Only pav bytes < 0 in mm7 - psubw mm5, mm7 - psubw mm6, mm0 - // test pa <= pb - movq mm7, mm4 - psubw mm6, mm0 - pcmpgtw mm7, mm5 // pa > pb? - movq mm0, mm7 - // use mm7 mask to merge pa & pb - pand mm5, mm7 - // use mm0 mask copy to merge a & b - pand mm2, mm0 - pandn mm7, mm4 - pandn mm0, mm1 - paddw mm7, mm5 - paddw mm0, mm2 - // test ((pa <= pb)? pa:pb) <= pc - pcmpgtw mm7, mm6 // pab > pc? - pxor mm1, mm1 - pand mm3, mm7 - pandn mm7, mm0 - paddw mm7, mm3 - pxor mm0, mm0 - packuswb mm7, mm1 - movq mm3, [esi+ebx-8] // read c=Prior(x-bpp) bytes - pand mm7, ActiveMask - movq mm2, [esi + ebx] // load b=Prior(x) - paddb mm7, [edi + ebx] // add Paeth predictor with Raw(x) - punpckhbw mm3, mm0 // Unpack High bytes of c - movq [edi + ebx], mm7 // write back updated value - movq mm1, [edi+ebx-8] // read a=Raw(x-bpp) bytes - - // Do second set of 4 bytes - punpckhbw mm2, mm0 // Unpack High bytes of b - punpckhbw mm1, mm0 // Unpack High bytes of a - // pav = p - a = (a + b - c) - a = b - c - movq mm4, mm2 - // pbv = p - b = (a + b - c) - b = a - c - movq mm5, mm1 - psubw mm4, mm3 - pxor mm7, mm7 - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv - movq mm6, mm4 - psubw mm5, mm3 - // pa = abs(p-a) = abs(pav) - // pb = abs(p-b) = abs(pbv) - // pc = abs(p-c) = abs(pcv) - pcmpgtw mm0, mm4 // Create mask pav bytes < 0 - paddw mm6, mm5 - pand mm0, mm4 // Only pav bytes < 0 in mm7 - pcmpgtw mm7, mm5 // Create mask pbv bytes < 0 - psubw mm4, mm0 - pand mm7, mm5 // Only pbv bytes < 0 in mm0 - psubw mm4, mm0 - psubw mm5, mm7 - pxor mm0, mm0 - pcmpgtw mm0, mm6 // Create mask pcv bytes < 0 - pand mm0, mm6 // Only pav bytes < 0 in mm7 - psubw mm5, mm7 - psubw mm6, mm0 - // test pa <= pb - movq mm7, mm4 - psubw mm6, mm0 - pcmpgtw mm7, mm5 // pa > pb? - movq mm0, mm7 - // use mm7 mask to merge pa & pb - pand mm5, mm7 - // use mm0 mask copy to merge a & b - pand mm2, mm0 - pandn mm7, mm4 - pandn mm0, mm1 - paddw mm7, mm5 - paddw mm0, mm2 - // test ((pa <= pb)? pa:pb) <= pc - pcmpgtw mm7, mm6 // pab > pc? - pxor mm1, mm1 - pand mm3, mm7 - pandn mm7, mm0 - pxor mm1, mm1 - paddw mm7, mm3 - pxor mm0, mm0 - // Step ex to next set of 8 bytes and repeat loop til done - add ebx, 8 - packuswb mm1, mm7 - paddb mm1, [edi + ebx - 8] // add Paeth predictor with Raw(x) - cmp ebx, MMXLength - movq [edi + ebx - 8], mm1 // write back updated value - // mm1 will be used as Raw(x-bpp) next loop - jb dpth8lp - } // end _asm block - } - break; - - case 1: // bpp = 1 - case 2: // bpp = 2 - default: // bpp > 8 - { - _asm { - mov ebx, diff - cmp ebx, FullLength - jnb dpthdend - mov edi, row - mov esi, prev_row - // Do Paeth decode for remaining bytes - mov edx, ebx - xor ecx, ecx // zero ecx before using cl & cx in loop below - sub edx, bpp // Set edx = ebx - bpp -dpthdlp: - xor eax, eax - // pav = p - a = (a + b - c) - a = b - c - mov al, [esi + ebx] // load Prior(x) into al - mov cl, [esi + edx] // load Prior(x-bpp) into cl - sub eax, ecx // subtract Prior(x-bpp) - mov patemp, eax // Save pav for later use - xor eax, eax - // pbv = p - b = (a + b - c) - b = a - c - mov al, [edi + edx] // load Raw(x-bpp) into al - sub eax, ecx // subtract Prior(x-bpp) - mov ecx, eax - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv - add eax, patemp // pcv = pav + pbv - // pc = abs(pcv) - test eax, 0x80000000 - jz dpthdpca - neg eax // reverse sign of neg values -dpthdpca: - mov pctemp, eax // save pc for later use - // pb = abs(pbv) - test ecx, 0x80000000 - jz dpthdpba - neg ecx // reverse sign of neg values -dpthdpba: - mov pbtemp, ecx // save pb for later use - // pa = abs(pav) - mov eax, patemp - test eax, 0x80000000 - jz dpthdpaa - neg eax // reverse sign of neg values -dpthdpaa: - mov patemp, eax // save pa for later use - // test if pa <= pb - cmp eax, ecx - jna dpthdabb - // pa > pb; now test if pb <= pc - cmp ecx, pctemp - jna dpthdbbc - // pb > pc; Raw(x) = Paeth(x) + Prior(x-bpp) - mov cl, [esi + edx] // load Prior(x-bpp) into cl - jmp dpthdpaeth -dpthdbbc: - // pb <= pc; Raw(x) = Paeth(x) + Prior(x) - mov cl, [esi + ebx] // load Prior(x) into cl - jmp dpthdpaeth -dpthdabb: - // pa <= pb; now test if pa <= pc - cmp eax, pctemp - jna dpthdabc - // pa > pc; Raw(x) = Paeth(x) + Prior(x-bpp) - mov cl, [esi + edx] // load Prior(x-bpp) into cl - jmp dpthdpaeth -dpthdabc: - // pa <= pc; Raw(x) = Paeth(x) + Raw(x-bpp) - mov cl, [edi + edx] // load Raw(x-bpp) into cl -dpthdpaeth: - inc ebx - inc edx - // Raw(x) = (Paeth(x) + Paeth_Predictor( a, b, c )) mod 256 - add [edi + ebx - 1], cl - cmp ebx, FullLength - jb dpthdlp -dpthdend: - } // end _asm block - } - return; // No need to go further with this one - } // end switch ( bpp ) - _asm - { - // MMX acceleration complete now do clean-up - // Check if any remaining bytes left to decode - mov ebx, MMXLength - cmp ebx, FullLength - jnb dpthend - mov edi, row - mov esi, prev_row - // Do Paeth decode for remaining bytes - mov edx, ebx - xor ecx, ecx // zero ecx before using cl & cx in loop below - sub edx, bpp // Set edx = ebx - bpp -dpthlp2: - xor eax, eax - // pav = p - a = (a + b - c) - a = b - c - mov al, [esi + ebx] // load Prior(x) into al - mov cl, [esi + edx] // load Prior(x-bpp) into cl - sub eax, ecx // subtract Prior(x-bpp) - mov patemp, eax // Save pav for later use - xor eax, eax - // pbv = p - b = (a + b - c) - b = a - c - mov al, [edi + edx] // load Raw(x-bpp) into al - sub eax, ecx // subtract Prior(x-bpp) - mov ecx, eax - // pcv = p - c = (a + b - c) -c = (a - c) + (b - c) = pav + pbv - add eax, patemp // pcv = pav + pbv - // pc = abs(pcv) - test eax, 0x80000000 - jz dpthpca2 - neg eax // reverse sign of neg values -dpthpca2: - mov pctemp, eax // save pc for later use - // pb = abs(pbv) - test ecx, 0x80000000 - jz dpthpba2 - neg ecx // reverse sign of neg values -dpthpba2: - mov pbtemp, ecx // save pb for later use - // pa = abs(pav) - mov eax, patemp - test eax, 0x80000000 - jz dpthpaa2 - neg eax // reverse sign of neg values -dpthpaa2: - mov patemp, eax // save pa for later use - // test if pa <= pb - cmp eax, ecx - jna dpthabb2 - // pa > pb; now test if pb <= pc - cmp ecx, pctemp - jna dpthbbc2 - // pb > pc; Raw(x) = Paeth(x) + Prior(x-bpp) - mov cl, [esi + edx] // load Prior(x-bpp) into cl - jmp dpthpaeth2 -dpthbbc2: - // pb <= pc; Raw(x) = Paeth(x) + Prior(x) - mov cl, [esi + ebx] // load Prior(x) into cl - jmp dpthpaeth2 -dpthabb2: - // pa <= pb; now test if pa <= pc - cmp eax, pctemp - jna dpthabc2 - // pa > pc; Raw(x) = Paeth(x) + Prior(x-bpp) - mov cl, [esi + edx] // load Prior(x-bpp) into cl - jmp dpthpaeth2 -dpthabc2: - // pa <= pc; Raw(x) = Paeth(x) + Raw(x-bpp) - mov cl, [edi + edx] // load Raw(x-bpp) into cl -dpthpaeth2: - inc ebx - inc edx - // Raw(x) = (Paeth(x) + Paeth_Predictor( a, b, c )) mod 256 - add [edi + ebx - 1], cl - cmp ebx, FullLength - jb dpthlp2 -dpthend: - emms // End MMX instructions; prep for possible FP instrs. - } // end _asm block -} - -// Optimized code for PNG Sub filter decoder -void /* PRIVATE */ -png_read_filter_row_mmx_sub(png_row_infop row_info, png_bytep row) -{ - //int test; - int bpp; - png_uint_32 FullLength; - png_uint_32 MMXLength; - int diff; - - bpp = (row_info->pixel_depth + 7) >> 3; // Get # bytes per pixel - FullLength = row_info->rowbytes - bpp; // # of bytes to filter - _asm { - mov edi, row - mov esi, edi // lp = row - add edi, bpp // rp = row + bpp - xor eax, eax - // get # of bytes to alignment - mov diff, edi // take start of row - add diff, 0xf // add 7 + 8 to incr past - // alignment boundary - xor ebx, ebx - and diff, 0xfffffff8 // mask to alignment boundary - sub diff, edi // subtract from start ==> value - // ebx at alignment - jz dsubgo - // fix alignment -dsublp1: - mov al, [esi+ebx] - add [edi+ebx], al - inc ebx - cmp ebx, diff - jb dsublp1 -dsubgo: - mov ecx, FullLength - mov edx, ecx - sub edx, ebx // subtract alignment fix - and edx, 0x00000007 // calc bytes over mult of 8 - sub ecx, edx // drop over bytes from length - mov MMXLength, ecx - } // end _asm block - - // Now do the math for the rest of the row - switch ( bpp ) - { - case 3: - { - ActiveMask.use = 0x0000ffffff000000; - ShiftBpp.use = 24; // == 3 * 8 - ShiftRem.use = 40; // == 64 - 24 - _asm { - mov edi, row - movq mm7, ActiveMask // Load ActiveMask for 2nd active byte group - mov esi, edi // lp = row - add edi, bpp // rp = row + bpp - movq mm6, mm7 - mov ebx, diff - psllq mm6, ShiftBpp // Move mask in mm6 to cover 3rd active - // byte group - // PRIME the pump (load the first Raw(x-bpp) data set - movq mm1, [edi+ebx-8] -dsub3lp: - psrlq mm1, ShiftRem // Shift data for adding 1st bpp bytes - // no need for mask; shift clears inactive bytes - // Add 1st active group - movq mm0, [edi+ebx] - paddb mm0, mm1 - // Add 2nd active group - movq mm1, mm0 // mov updated Raws to mm1 - psllq mm1, ShiftBpp // shift data to position correctly - pand mm1, mm7 // mask to use only 2nd active group - paddb mm0, mm1 - // Add 3rd active group - movq mm1, mm0 // mov updated Raws to mm1 - psllq mm1, ShiftBpp // shift data to position correctly - pand mm1, mm6 // mask to use only 3rd active group - add ebx, 8 - paddb mm0, mm1 - cmp ebx, MMXLength - movq [edi+ebx-8], mm0 // Write updated Raws back to array - // Prep for doing 1st add at top of loop - movq mm1, mm0 - jb dsub3lp - } // end _asm block - } - break; - - case 1: - { - // Placed here just in case this is a duplicate of the - // non-MMX code for the SUB filter in png_read_filter_row below - // - // png_bytep rp; - // png_bytep lp; - // png_uint_32 i; - // bpp = (row_info->pixel_depth + 7) >> 3; - // for (i = (png_uint_32)bpp, rp = row + bpp, lp = row; - // i < row_info->rowbytes; i++, rp++, lp++) - // { - // *rp = (png_byte)(((int)(*rp) + (int)(*lp)) & 0xff); - // } - _asm { - mov ebx, diff - mov edi, row - cmp ebx, FullLength - jnb dsub1end - mov esi, edi // lp = row - xor eax, eax - add edi, bpp // rp = row + bpp -dsub1lp: - mov al, [esi+ebx] - add [edi+ebx], al - inc ebx - cmp ebx, FullLength - jb dsub1lp -dsub1end: - } // end _asm block - } - return; - - case 6: - case 7: - case 4: - case 5: - { - ShiftBpp.use = bpp << 3; - ShiftRem.use = 64 - ShiftBpp.use; - _asm { - mov edi, row - mov ebx, diff - mov esi, edi // lp = row - add edi, bpp // rp = row + bpp - // PRIME the pump (load the first Raw(x-bpp) data set - movq mm1, [edi+ebx-8] -dsub4lp: - psrlq mm1, ShiftRem // Shift data for adding 1st bpp bytes - // no need for mask; shift clears inactive bytes - movq mm0, [edi+ebx] - paddb mm0, mm1 - // Add 2nd active group - movq mm1, mm0 // mov updated Raws to mm1 - psllq mm1, ShiftBpp // shift data to position correctly - // there is no need for any mask - // since shift clears inactive bits/bytes - add ebx, 8 - paddb mm0, mm1 - cmp ebx, MMXLength - movq [edi+ebx-8], mm0 - movq mm1, mm0 // Prep for doing 1st add at top of loop - jb dsub4lp - } // end _asm block - } - break; - - case 2: - { - ActiveMask.use = 0x00000000ffff0000; - ShiftBpp.use = 16; // == 2 * 8 - ShiftRem.use = 48; // == 64 - 16 - _asm { - movq mm7, ActiveMask // Load ActiveMask for 2nd active byte group - mov ebx, diff - movq mm6, mm7 - mov edi, row - psllq mm6, ShiftBpp // Move mask in mm6 to cover 3rd active - // byte group - mov esi, edi // lp = row - movq mm5, mm6 - add edi, bpp // rp = row + bpp - psllq mm5, ShiftBpp // Move mask in mm5 to cover 4th active - // byte group - // PRIME the pump (load the first Raw(x-bpp) data set - movq mm1, [edi+ebx-8] -dsub2lp: - // Add 1st active group - psrlq mm1, ShiftRem // Shift data for adding 1st bpp bytes - // no need for mask; shift clears inactive - // bytes - movq mm0, [edi+ebx] - paddb mm0, mm1 - // Add 2nd active group - movq mm1, mm0 // mov updated Raws to mm1 - psllq mm1, ShiftBpp // shift data to position correctly - pand mm1, mm7 // mask to use only 2nd active group - paddb mm0, mm1 - // Add 3rd active group - movq mm1, mm0 // mov updated Raws to mm1 - psllq mm1, ShiftBpp // shift data to position correctly - pand mm1, mm6 // mask to use only 3rd active group - paddb mm0, mm1 - // Add 4th active group - movq mm1, mm0 // mov updated Raws to mm1 - psllq mm1, ShiftBpp // shift data to position correctly - pand mm1, mm5 // mask to use only 4th active group - add ebx, 8 - paddb mm0, mm1 - cmp ebx, MMXLength - movq [edi+ebx-8], mm0 // Write updated Raws back to array - movq mm1, mm0 // Prep for doing 1st add at top of loop - jb dsub2lp - } // end _asm block - } - break; - case 8: - { - _asm { - mov edi, row - mov ebx, diff - mov esi, edi // lp = row - add edi, bpp // rp = row + bpp - mov ecx, MMXLength - movq mm7, [edi+ebx-8] // PRIME the pump (load the first - // Raw(x-bpp) data set - and ecx, 0x0000003f // calc bytes over mult of 64 -dsub8lp: - movq mm0, [edi+ebx] // Load Sub(x) for 1st 8 bytes - paddb mm0, mm7 - movq mm1, [edi+ebx+8] // Load Sub(x) for 2nd 8 bytes - movq [edi+ebx], mm0 // Write Raw(x) for 1st 8 bytes - // Now mm0 will be used as Raw(x-bpp) for - // the 2nd group of 8 bytes. This will be - // repeated for each group of 8 bytes with - // the 8th group being used as the Raw(x-bpp) - // for the 1st group of the next loop. - paddb mm1, mm0 - movq mm2, [edi+ebx+16] // Load Sub(x) for 3rd 8 bytes - movq [edi+ebx+8], mm1 // Write Raw(x) for 2nd 8 bytes - paddb mm2, mm1 - movq mm3, [edi+ebx+24] // Load Sub(x) for 4th 8 bytes - movq [edi+ebx+16], mm2 // Write Raw(x) for 3rd 8 bytes - paddb mm3, mm2 - movq mm4, [edi+ebx+32] // Load Sub(x) for 5th 8 bytes - movq [edi+ebx+24], mm3 // Write Raw(x) for 4th 8 bytes - paddb mm4, mm3 - movq mm5, [edi+ebx+40] // Load Sub(x) for 6th 8 bytes - movq [edi+ebx+32], mm4 // Write Raw(x) for 5th 8 bytes - paddb mm5, mm4 - movq mm6, [edi+ebx+48] // Load Sub(x) for 7th 8 bytes - movq [edi+ebx+40], mm5 // Write Raw(x) for 6th 8 bytes - paddb mm6, mm5 - movq mm7, [edi+ebx+56] // Load Sub(x) for 8th 8 bytes - movq [edi+ebx+48], mm6 // Write Raw(x) for 7th 8 bytes - add ebx, 64 - paddb mm7, mm6 - cmp ebx, ecx - movq [edi+ebx-8], mm7 // Write Raw(x) for 8th 8 bytes - jb dsub8lp - cmp ebx, MMXLength - jnb dsub8lt8 -dsub8lpA: - movq mm0, [edi+ebx] - add ebx, 8 - paddb mm0, mm7 - cmp ebx, MMXLength - movq [edi+ebx-8], mm0 // use -8 to offset early add to ebx - movq mm7, mm0 // Move calculated Raw(x) data to mm1 to - // be the new Raw(x-bpp) for the next loop - jb dsub8lpA -dsub8lt8: - } // end _asm block - } - break; - - default: // bpp greater than 8 bytes - { - _asm { - mov ebx, diff - mov edi, row - mov esi, edi // lp = row - add edi, bpp // rp = row + bpp -dsubAlp: - movq mm0, [edi+ebx] - movq mm1, [esi+ebx] - add ebx, 8 - paddb mm0, mm1 - cmp ebx, MMXLength - movq [edi+ebx-8], mm0 // mov does not affect flags; -8 to offset - // add ebx - jb dsubAlp - } // end _asm block - } - break; - - } // end switch ( bpp ) - - _asm { - mov ebx, MMXLength - mov edi, row - cmp ebx, FullLength - jnb dsubend - mov esi, edi // lp = row - xor eax, eax - add edi, bpp // rp = row + bpp -dsublp2: - mov al, [esi+ebx] - add [edi+ebx], al - inc ebx - cmp ebx, FullLength - jb dsublp2 -dsubend: - emms // End MMX instructions; prep for possible FP instrs. - } // end _asm block -} - -// Optimized code for PNG Up filter decoder -void /* PRIVATE */ -png_read_filter_row_mmx_up(png_row_infop row_info, png_bytep row, - png_bytep prev_row) -{ - png_uint_32 len; - len = row_info->rowbytes; // # of bytes to filter - _asm { - mov edi, row - // get # of bytes to alignment - mov ecx, edi - xor ebx, ebx - add ecx, 0x7 - xor eax, eax - and ecx, 0xfffffff8 - mov esi, prev_row - sub ecx, edi - jz dupgo - // fix alignment -duplp1: - mov al, [edi+ebx] - add al, [esi+ebx] - inc ebx - cmp ebx, ecx - mov [edi + ebx-1], al // mov does not affect flags; -1 to offset inc ebx - jb duplp1 -dupgo: - mov ecx, len - mov edx, ecx - sub edx, ebx // subtract alignment fix - and edx, 0x0000003f // calc bytes over mult of 64 - sub ecx, edx // drop over bytes from length - // Unrolled loop - use all MMX registers and interleave to reduce - // number of branch instructions (loops) and reduce partial stalls -duploop: - movq mm1, [esi+ebx] - movq mm0, [edi+ebx] - movq mm3, [esi+ebx+8] - paddb mm0, mm1 - movq mm2, [edi+ebx+8] - movq [edi+ebx], mm0 - paddb mm2, mm3 - movq mm5, [esi+ebx+16] - movq [edi+ebx+8], mm2 - movq mm4, [edi+ebx+16] - movq mm7, [esi+ebx+24] - paddb mm4, mm5 - movq mm6, [edi+ebx+24] - movq [edi+ebx+16], mm4 - paddb mm6, mm7 - movq mm1, [esi+ebx+32] - movq [edi+ebx+24], mm6 - movq mm0, [edi+ebx+32] - movq mm3, [esi+ebx+40] - paddb mm0, mm1 - movq mm2, [edi+ebx+40] - movq [edi+ebx+32], mm0 - paddb mm2, mm3 - movq mm5, [esi+ebx+48] - movq [edi+ebx+40], mm2 - movq mm4, [edi+ebx+48] - movq mm7, [esi+ebx+56] - paddb mm4, mm5 - movq mm6, [edi+ebx+56] - movq [edi+ebx+48], mm4 - add ebx, 64 - paddb mm6, mm7 - cmp ebx, ecx - movq [edi+ebx-8], mm6 // (+56)movq does not affect flags; - // -8 to offset add ebx - jb duploop - - cmp edx, 0 // Test for bytes over mult of 64 - jz dupend - - - // 2 lines added by lcreeve at netins.net - // (mail 11 Jul 98 in png-implement list) - cmp edx, 8 //test for less than 8 bytes - jb duplt8 - - - add ecx, edx - and edx, 0x00000007 // calc bytes over mult of 8 - sub ecx, edx // drop over bytes from length - jz duplt8 - // Loop using MMX registers mm0 & mm1 to update 8 bytes simultaneously -duplpA: - movq mm1, [esi+ebx] - movq mm0, [edi+ebx] - add ebx, 8 - paddb mm0, mm1 - cmp ebx, ecx - movq [edi+ebx-8], mm0 // movq does not affect flags; -8 to offset add ebx - jb duplpA - cmp edx, 0 // Test for bytes over mult of 8 - jz dupend -duplt8: - xor eax, eax - add ecx, edx // move over byte count into counter - // Loop using x86 registers to update remaining bytes -duplp2: - mov al, [edi + ebx] - add al, [esi + ebx] - inc ebx - cmp ebx, ecx - mov [edi + ebx-1], al // mov does not affect flags; -1 to offset inc ebx - jb duplp2 -dupend: - // Conversion of filtered row completed - emms // End MMX instructions; prep for possible FP instrs. - } // end _asm block -} - - -// Optimized png_read_filter_row routines -void /* PRIVATE */ -png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep - row, png_bytep prev_row, int filter) -{ -#ifdef PNG_DEBUG - char filnm[10]; -#endif - - if (mmx_supported == 2) { -#if !defined(PNG_1_0_X) - /* this should have happened in png_init_mmx_flags() already */ - png_warning(png_ptr, "asm_flags may not have been initialized"); -#endif - png_mmx_support(); - } - -#ifdef PNG_DEBUG - png_debug(1, "in png_read_filter_row\n"); - switch (filter) - { - case 0: sprintf(filnm, "none"); - break; -#if !defined(PNG_1_0_X) - case 1: sprintf(filnm, "sub-%s", - (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)? "MMX" : "x86"); - break; - case 2: sprintf(filnm, "up-%s", - (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP)? "MMX" : "x86"); - break; - case 3: sprintf(filnm, "avg-%s", - (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)? "MMX" : "x86"); - break; - case 4: sprintf(filnm, "Paeth-%s", - (png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)? "MMX":"x86"); - break; -#else - case 1: sprintf(filnm, "sub"); - break; - case 2: sprintf(filnm, "up"); - break; - case 3: sprintf(filnm, "avg"); - break; - case 4: sprintf(filnm, "Paeth"); - break; -#endif - default: sprintf(filnm, "unknw"); - break; - } - png_debug2(0,"row=%5d, %s, ", png_ptr->row_number, filnm); - png_debug2(0, "pd=%2d, b=%d, ", (int)row_info->pixel_depth, - (int)((row_info->pixel_depth + 7) >> 3)); - png_debug1(0,"len=%8d, ", row_info->rowbytes); -#endif /* PNG_DEBUG */ - - switch (filter) - { - case PNG_FILTER_VALUE_NONE: - break; - - case PNG_FILTER_VALUE_SUB: - { -#if !defined(PNG_1_0_X) - if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB) && - (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && - (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold)) -#else - if (mmx_supported) -#endif - { - png_read_filter_row_mmx_sub(row_info, row); - } - else - { - png_uint_32 i; - png_uint_32 istop = row_info->rowbytes; - png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3; - png_bytep rp = row + bpp; - png_bytep lp = row; - - for (i = bpp; i < istop; i++) - { - *rp = (png_byte)(((int)(*rp) + (int)(*lp++)) & 0xff); - rp++; - } - } - break; - } - - case PNG_FILTER_VALUE_UP: - { -#if !defined(PNG_1_0_X) - if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP) && - (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && - (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold)) -#else - if (mmx_supported) -#endif - { - png_read_filter_row_mmx_up(row_info, row, prev_row); - } - else - { - png_uint_32 i; - png_uint_32 istop = row_info->rowbytes; - png_bytep rp = row; - png_bytep pp = prev_row; - - for (i = 0; i < istop; ++i) - { - *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff); - rp++; - } - } - break; - } - - case PNG_FILTER_VALUE_AVG: - { -#if !defined(PNG_1_0_X) - if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG) && - (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && - (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold)) -#else - if (mmx_supported) -#endif - { - png_read_filter_row_mmx_avg(row_info, row, prev_row); - } - else - { - png_uint_32 i; - png_bytep rp = row; - png_bytep pp = prev_row; - png_bytep lp = row; - png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3; - png_uint_32 istop = row_info->rowbytes - bpp; - - for (i = 0; i < bpp; i++) - { - *rp = (png_byte)(((int)(*rp) + - ((int)(*pp++) >> 1)) & 0xff); - rp++; - } - - for (i = 0; i < istop; i++) - { - *rp = (png_byte)(((int)(*rp) + - ((int)(*pp++ + *lp++) >> 1)) & 0xff); - rp++; - } - } - break; - } - - case PNG_FILTER_VALUE_PAETH: - { -#if !defined(PNG_1_0_X) - if ((png_ptr->asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH) && - (row_info->pixel_depth >= png_ptr->mmx_bitdepth_threshold) && - (row_info->rowbytes >= png_ptr->mmx_rowbytes_threshold)) -#else - if (mmx_supported) -#endif - { - png_read_filter_row_mmx_paeth(row_info, row, prev_row); - } - else - { - png_uint_32 i; - png_bytep rp = row; - png_bytep pp = prev_row; - png_bytep lp = row; - png_bytep cp = prev_row; - png_uint_32 bpp = (row_info->pixel_depth + 7) >> 3; - png_uint_32 istop=row_info->rowbytes - bpp; - - for (i = 0; i < bpp; i++) - { - *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff); - rp++; - } - - for (i = 0; i < istop; i++) // use leftover rp,pp - { - int a, b, c, pa, pb, pc, p; - - a = *lp++; - b = *pp++; - c = *cp++; - - p = b - c; - pc = a - c; - -#ifdef PNG_USE_ABS - pa = abs(p); - pb = abs(pc); - pc = abs(p + pc); -#else - pa = p < 0 ? -p : p; - pb = pc < 0 ? -pc : pc; - pc = (p + pc) < 0 ? -(p + pc) : p + pc; -#endif - - /* - if (pa <= pb && pa <= pc) - p = a; - else if (pb <= pc) - p = b; - else - p = c; - */ - - p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c; - - *rp = (png_byte)(((int)(*rp) + p) & 0xff); - rp++; - } - } - break; - } - - default: - png_warning(png_ptr, "Ignoring bad row filter type"); - *row=0; - break; - } -} - -#endif /* PNG_ASSEMBLER_CODE_SUPPORTED && PNG_USE_PNGVCRD */ diff --git a/src/dep/src/irrlicht/libpng/pngwio.c b/src/dep/src/irrlicht/libpng/pngwio.c index a61b9a8..d79b955 100644 --- a/src/dep/src/irrlicht/libpng/pngwio.c +++ b/src/dep/src/irrlicht/libpng/pngwio.c @@ -1,9 +1,9 @@ /* pngwio.c - functions for data output * - * Last changed in libpng 1.2.35 [February 14, 2009] + * Last changed in libpng 1.2.30 [August 15, 2008] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2009 Glenn Randers-Pehrson + * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -137,7 +137,7 @@ png_default_flush(png_structp png_ptr) if (png_ptr == NULL) return; #if !defined(_WIN32_WCE) io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr)); - if (io_ptr != NULL && fileno(io_ptr) != -1) + if (io_ptr != NULL) fflush(io_ptr); #endif } @@ -232,237 +232,3 @@ void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check) # endif # endif #endif /* PNG_WRITE_SUPPORTED */ - -/* pngwio.c - functions for data output - * - * Last changed in libpng 1.2.13 November 13, 2006 - * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2002 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - * - * This file provides a location for all output. Users who need - * special handling are expected to write functions that have the same - * arguments as these and perform similar functions, but that possibly - * use different output methods. Note that you shouldn't change these - * functions, but rather write replacement functions and then change - * them at run time with png_set_write_fn(...). - */ - -#define PNG_INTERNAL -#include "png.h" -#ifdef PNG_WRITE_SUPPORTED - -/* Write the data to whatever output you are using. The default routine - writes to a file pointer. Note that this routine sometimes gets called - with very small lengths, so you should implement some kind of simple - buffering if you are using unbuffered writes. This should never be asked - to write more than 64K on a 16 bit machine. */ - -void /* PRIVATE */ -png_write_data(png_structp png_ptr, png_bytep data, png_size_t length) -{ - if (png_ptr->write_data_fn != NULL ) - (*(png_ptr->write_data_fn))(png_ptr, data, length); - else - png_error(png_ptr, "Call to NULL write function"); -} - -#if !defined(PNG_NO_STDIO) -/* This is the function that does the actual writing of data. If you are - not writing to a standard C stream, you should create a replacement - write_data function and use it at run time with png_set_write_fn(), rather - than changing the library. */ -#ifndef USE_FAR_KEYWORD -void PNGAPI -png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length) -{ - png_uint_32 check; - - if(png_ptr == NULL) return; -#if defined(_WIN32_WCE) - if ( !WriteFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) ) - check = 0; -#else - check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr)); -#endif - if (check != length) - png_error(png_ptr, "Write Error"); -} -#else -/* this is the model-independent version. Since the standard I/O library - can't handle far buffers in the medium and small models, we have to copy - the data. -*/ - -#define NEAR_BUF_SIZE 1024 -#define MIN(a,b) (a <= b ? a : b) - -void PNGAPI -png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length) -{ - png_uint_32 check; - png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */ - png_FILE_p io_ptr; - - if(png_ptr == NULL) return; - /* Check if data really is near. If so, use usual code. */ - near_data = (png_byte *)CVT_PTR_NOCHECK(data); - io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr); - if ((png_bytep)near_data == data) - { -#if defined(_WIN32_WCE) - if ( !WriteFile(io_ptr, near_data, length, &check, NULL) ) - check = 0; -#else - check = fwrite(near_data, 1, length, io_ptr); -#endif - } - else - { - png_byte buf[NEAR_BUF_SIZE]; - png_size_t written, remaining, err; - check = 0; - remaining = length; - do - { - written = MIN(NEAR_BUF_SIZE, remaining); - png_memcpy(buf, data, written); /* copy far buffer to near buffer */ -#if defined(_WIN32_WCE) - if ( !WriteFile(io_ptr, buf, written, &err, NULL) ) - err = 0; -#else - err = fwrite(buf, 1, written, io_ptr); -#endif - if (err != written) - break; - else - check += err; - data += written; - remaining -= written; - } - while (remaining != 0); - } - if (check != length) - png_error(png_ptr, "Write Error"); -} - -#endif -#endif - -/* This function is called to output any data pending writing (normally - to disk). After png_flush is called, there should be no data pending - writing in any buffers. */ -#if defined(PNG_WRITE_FLUSH_SUPPORTED) -void /* PRIVATE */ -png_flush(png_structp png_ptr) -{ - if (png_ptr->output_flush_fn != NULL) - (*(png_ptr->output_flush_fn))(png_ptr); -} - -#if !defined(PNG_NO_STDIO) -void PNGAPI -png_default_flush(png_structp png_ptr) -{ -#if !defined(_WIN32_WCE) - png_FILE_p io_ptr; -#endif - if(png_ptr == NULL) return; -#if !defined(_WIN32_WCE) - io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr)); - if (io_ptr != NULL) - fflush(io_ptr); -#endif -} -#endif -#endif - -/* This function allows the application to supply new output functions for - libpng if standard C streams aren't being used. - - This function takes as its arguments: - png_ptr - pointer to a png output data structure - io_ptr - pointer to user supplied structure containing info about - the output functions. May be NULL. - write_data_fn - pointer to a new output function that takes as its - arguments a pointer to a png_struct, a pointer to - data to be written, and a 32-bit unsigned int that is - the number of bytes to be written. The new write - function should call png_error(png_ptr, "Error msg") - to exit and output any fatal error messages. - flush_data_fn - pointer to a new flush function that takes as its - arguments a pointer to a png_struct. After a call to - the flush function, there should be no data in any buffers - or pending transmission. If the output method doesn't do - any buffering of ouput, a function prototype must still be - supplied although it doesn't have to do anything. If - PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile - time, output_flush_fn will be ignored, although it must be - supplied for compatibility. */ -void PNGAPI -png_set_write_fn(png_structp png_ptr, png_voidp io_ptr, - png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn) -{ - if(png_ptr == NULL) return; - png_ptr->io_ptr = io_ptr; - -#if !defined(PNG_NO_STDIO) - if (write_data_fn != NULL) - png_ptr->write_data_fn = write_data_fn; - else - png_ptr->write_data_fn = png_default_write_data; -#else - png_ptr->write_data_fn = write_data_fn; -#endif - -#if defined(PNG_WRITE_FLUSH_SUPPORTED) -#if !defined(PNG_NO_STDIO) - if (output_flush_fn != NULL) - png_ptr->output_flush_fn = output_flush_fn; - else - png_ptr->output_flush_fn = png_default_flush; -#else - png_ptr->output_flush_fn = output_flush_fn; -#endif -#endif /* PNG_WRITE_FLUSH_SUPPORTED */ - - /* It is an error to read while writing a png file */ - if (png_ptr->read_data_fn != NULL) - { - png_ptr->read_data_fn = NULL; - png_warning(png_ptr, - "Attempted to set both read_data_fn and write_data_fn in"); - png_warning(png_ptr, - "the same structure. Resetting read_data_fn to NULL."); - } -} - -#if defined(USE_FAR_KEYWORD) -#if defined(_MSC_VER) -void *png_far_to_near(png_structp png_ptr,png_voidp ptr, int check) -{ - void *near_ptr; - void FAR *far_ptr; - FP_OFF(near_ptr) = FP_OFF(ptr); - far_ptr = (void FAR *)near_ptr; - if(check != 0) - if(FP_SEG(ptr) != FP_SEG(far_ptr)) - png_error(png_ptr,"segment lost in conversion"); - return(near_ptr); -} -# else -void *png_far_to_near(png_structp png_ptr,png_voidp ptr, int check) -{ - void *near_ptr; - void FAR *far_ptr; - near_ptr = (void FAR *)ptr; - far_ptr = (void FAR *)near_ptr; - if(check != 0) - if(far_ptr != ptr) - png_error(png_ptr,"segment lost in conversion"); - return(near_ptr); -} -# endif -# endif -#endif /* PNG_WRITE_SUPPORTED */ diff --git a/src/dep/src/irrlicht/libpng/pngwrite.c b/src/dep/src/irrlicht/libpng/pngwrite.c index 754f221..e75607b 100644 --- a/src/dep/src/irrlicht/libpng/pngwrite.c +++ b/src/dep/src/irrlicht/libpng/pngwrite.c @@ -1,7 +1,7 @@ /* pngwrite.c - general routines to write a PNG file * - * Last changed in libpng 1.2.34 [December 18, 2008] + * Last changed in libpng 1.2.31 [August 19, 2008] * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -13,1553 +13,6 @@ #include "png.h" #ifdef PNG_WRITE_SUPPORTED -/* Writes all the PNG information. This is the suggested way to use the - * library. If you have a new chunk to add, make a function to write it, - * and put it in the correct location here. If you want the chunk written - * after the image data, put it in png_write_end(). I strongly encourage - * you to supply a PNG_INFO_ flag, and check info_ptr->valid before writing - * the chunk, as that will keep the code from breaking if you want to just - * write a plain PNG file. If you have long comments, I suggest writing - * them in png_write_end(), and compressing them. - */ -void PNGAPI -png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr) -{ - png_debug(1, "in png_write_info_before_PLTE"); - if (png_ptr == NULL || info_ptr == NULL) - return; - if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE)) - { - png_write_sig(png_ptr); /* write PNG signature */ -#if defined(PNG_MNG_FEATURES_SUPPORTED) - if ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)&&(png_ptr->mng_features_permitted)) - { - png_warning(png_ptr, "MNG features are not allowed in a PNG datastream"); - png_ptr->mng_features_permitted=0; - } -#endif - /* write IHDR information. */ - png_write_IHDR(png_ptr, info_ptr->width, info_ptr->height, - info_ptr->bit_depth, info_ptr->color_type, info_ptr->compression_type, - info_ptr->filter_type, -#if defined(PNG_WRITE_INTERLACING_SUPPORTED) - info_ptr->interlace_type); -#else - 0); -#endif - /* the rest of these check to see if the valid field has the appropriate - flag set, and if it does, writes the chunk. */ -#if defined(PNG_WRITE_gAMA_SUPPORTED) - if (info_ptr->valid & PNG_INFO_gAMA) - { -# ifdef PNG_FLOATING_POINT_SUPPORTED - png_write_gAMA(png_ptr, info_ptr->gamma); -#else -#ifdef PNG_FIXED_POINT_SUPPORTED - png_write_gAMA_fixed(png_ptr, info_ptr->int_gamma); -# endif -#endif - } -#endif -#if defined(PNG_WRITE_sRGB_SUPPORTED) - if (info_ptr->valid & PNG_INFO_sRGB) - png_write_sRGB(png_ptr, (int)info_ptr->srgb_intent); -#endif -#if defined(PNG_WRITE_iCCP_SUPPORTED) - if (info_ptr->valid & PNG_INFO_iCCP) - png_write_iCCP(png_ptr, info_ptr->iccp_name, PNG_COMPRESSION_TYPE_BASE, - info_ptr->iccp_profile, (int)info_ptr->iccp_proflen); -#endif -#if defined(PNG_WRITE_sBIT_SUPPORTED) - if (info_ptr->valid & PNG_INFO_sBIT) - png_write_sBIT(png_ptr, &(info_ptr->sig_bit), info_ptr->color_type); -#endif -#if defined(PNG_WRITE_cHRM_SUPPORTED) - if (info_ptr->valid & PNG_INFO_cHRM) - { -#ifdef PNG_FLOATING_POINT_SUPPORTED - png_write_cHRM(png_ptr, - info_ptr->x_white, info_ptr->y_white, - info_ptr->x_red, info_ptr->y_red, - info_ptr->x_green, info_ptr->y_green, - info_ptr->x_blue, info_ptr->y_blue); -#else -# ifdef PNG_FIXED_POINT_SUPPORTED - png_write_cHRM_fixed(png_ptr, - info_ptr->int_x_white, info_ptr->int_y_white, - info_ptr->int_x_red, info_ptr->int_y_red, - info_ptr->int_x_green, info_ptr->int_y_green, - info_ptr->int_x_blue, info_ptr->int_y_blue); -# endif -#endif - } -#endif -#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED) - if (info_ptr->unknown_chunks_num) - { - png_unknown_chunk *up; - - png_debug(5, "writing extra chunks"); - - for (up = info_ptr->unknown_chunks; - up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num; - up++) - { - int keep=png_handle_as_unknown(png_ptr, up->name); - if (keep != PNG_HANDLE_CHUNK_NEVER && - up->location && !(up->location & PNG_HAVE_PLTE) && - !(up->location & PNG_HAVE_IDAT) && - ((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS || - (png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS))) - { - if (up->size == 0) - png_warning(png_ptr, "Writing zero-length unknown chunk"); - png_write_chunk(png_ptr, up->name, up->data, up->size); - } - } - } -#endif - png_ptr->mode |= PNG_WROTE_INFO_BEFORE_PLTE; - } -} - -void PNGAPI -png_write_info(png_structp png_ptr, png_infop info_ptr) -{ -#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED) - int i; -#endif - - png_debug(1, "in png_write_info"); - - if (png_ptr == NULL || info_ptr == NULL) - return; - - png_write_info_before_PLTE(png_ptr, info_ptr); - - if (info_ptr->valid & PNG_INFO_PLTE) - png_write_PLTE(png_ptr, info_ptr->palette, - (png_uint_32)info_ptr->num_palette); - else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) - png_error(png_ptr, "Valid palette required for paletted images"); - -#if defined(PNG_WRITE_tRNS_SUPPORTED) - if (info_ptr->valid & PNG_INFO_tRNS) - { -#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) - /* invert the alpha channel (in tRNS) */ - if ((png_ptr->transformations & PNG_INVERT_ALPHA) && - info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) - { - int j; - for (j=0; j<(int)info_ptr->num_trans; j++) - info_ptr->trans[j] = (png_byte)(255 - info_ptr->trans[j]); - } -#endif - png_write_tRNS(png_ptr, info_ptr->trans, &(info_ptr->trans_values), - info_ptr->num_trans, info_ptr->color_type); - } -#endif -#if defined(PNG_WRITE_bKGD_SUPPORTED) - if (info_ptr->valid & PNG_INFO_bKGD) - png_write_bKGD(png_ptr, &(info_ptr->background), info_ptr->color_type); -#endif -#if defined(PNG_WRITE_hIST_SUPPORTED) - if (info_ptr->valid & PNG_INFO_hIST) - png_write_hIST(png_ptr, info_ptr->hist, info_ptr->num_palette); -#endif -#if defined(PNG_WRITE_oFFs_SUPPORTED) - if (info_ptr->valid & PNG_INFO_oFFs) - png_write_oFFs(png_ptr, info_ptr->x_offset, info_ptr->y_offset, - info_ptr->offset_unit_type); -#endif -#if defined(PNG_WRITE_pCAL_SUPPORTED) - if (info_ptr->valid & PNG_INFO_pCAL) - png_write_pCAL(png_ptr, info_ptr->pcal_purpose, info_ptr->pcal_X0, - info_ptr->pcal_X1, info_ptr->pcal_type, info_ptr->pcal_nparams, - info_ptr->pcal_units, info_ptr->pcal_params); -#endif -#if defined(PNG_WRITE_sCAL_SUPPORTED) - if (info_ptr->valid & PNG_INFO_sCAL) -#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO) - png_write_sCAL(png_ptr, (int)info_ptr->scal_unit, - info_ptr->scal_pixel_width, info_ptr->scal_pixel_height); -#else -#ifdef PNG_FIXED_POINT_SUPPORTED - png_write_sCAL_s(png_ptr, (int)info_ptr->scal_unit, - info_ptr->scal_s_width, info_ptr->scal_s_height); -#else - png_warning(png_ptr, - "png_write_sCAL not supported; sCAL chunk not written."); -#endif -#endif -#endif -#if defined(PNG_WRITE_pHYs_SUPPORTED) - if (info_ptr->valid & PNG_INFO_pHYs) - png_write_pHYs(png_ptr, info_ptr->x_pixels_per_unit, - info_ptr->y_pixels_per_unit, info_ptr->phys_unit_type); -#endif -#if defined(PNG_WRITE_tIME_SUPPORTED) - if (info_ptr->valid & PNG_INFO_tIME) - { - png_write_tIME(png_ptr, &(info_ptr->mod_time)); - png_ptr->mode |= PNG_WROTE_tIME; - } -#endif -#if defined(PNG_WRITE_sPLT_SUPPORTED) - if (info_ptr->valid & PNG_INFO_sPLT) - for (i = 0; i < (int)info_ptr->splt_palettes_num; i++) - png_write_sPLT(png_ptr, info_ptr->splt_palettes + i); -#endif -#if defined(PNG_WRITE_TEXT_SUPPORTED) - /* Check to see if we need to write text chunks */ - for (i = 0; i < info_ptr->num_text; i++) - { - png_debug2(2, "Writing header text chunk %d, type %d", i, - info_ptr->text[i].compression); - /* an internationalized chunk? */ - if (info_ptr->text[i].compression > 0) - { -#if defined(PNG_WRITE_iTXt_SUPPORTED) - /* write international chunk */ - png_write_iTXt(png_ptr, - info_ptr->text[i].compression, - info_ptr->text[i].key, - info_ptr->text[i].lang, - info_ptr->text[i].lang_key, - info_ptr->text[i].text); -#else - png_warning(png_ptr, "Unable to write international text"); -#endif - /* Mark this chunk as written */ - info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; - } - /* If we want a compressed text chunk */ - else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_zTXt) - { -#if defined(PNG_WRITE_zTXt_SUPPORTED) - /* write compressed chunk */ - png_write_zTXt(png_ptr, info_ptr->text[i].key, - info_ptr->text[i].text, 0, - info_ptr->text[i].compression); -#else - png_warning(png_ptr, "Unable to write compressed text"); -#endif - /* Mark this chunk as written */ - info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR; - } - else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE) - { -#if defined(PNG_WRITE_tEXt_SUPPORTED) - /* write uncompressed chunk */ - png_write_tEXt(png_ptr, info_ptr->text[i].key, - info_ptr->text[i].text, - 0); -#else - png_warning(png_ptr, "Unable to write uncompressed text"); -#endif - /* Mark this chunk as written */ - info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; - } - } -#endif -#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED) - if (info_ptr->unknown_chunks_num) - { - png_unknown_chunk *up; - - png_debug(5, "writing extra chunks"); - - for (up = info_ptr->unknown_chunks; - up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num; - up++) - { - int keep=png_handle_as_unknown(png_ptr, up->name); - if (keep != PNG_HANDLE_CHUNK_NEVER && - up->location && (up->location & PNG_HAVE_PLTE) && - !(up->location & PNG_HAVE_IDAT) && - ((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS || - (png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS))) - { - png_write_chunk(png_ptr, up->name, up->data, up->size); - } - } - } -#endif -} - -/* Writes the end of the PNG file. If you don't want to write comments or - * time information, you can pass NULL for info. If you already wrote these - * in png_write_info(), do not write them again here. If you have long - * comments, I suggest writing them here, and compressing them. - */ -void PNGAPI -png_write_end(png_structp png_ptr, png_infop info_ptr) -{ - png_debug(1, "in png_write_end"); - if (png_ptr == NULL) - return; - if (!(png_ptr->mode & PNG_HAVE_IDAT)) - png_error(png_ptr, "No IDATs written into file"); - - /* see if user wants us to write information chunks */ - if (info_ptr != NULL) - { -#if defined(PNG_WRITE_TEXT_SUPPORTED) - int i; /* local index variable */ -#endif -#if defined(PNG_WRITE_tIME_SUPPORTED) - /* check to see if user has supplied a time chunk */ - if ((info_ptr->valid & PNG_INFO_tIME) && - !(png_ptr->mode & PNG_WROTE_tIME)) - png_write_tIME(png_ptr, &(info_ptr->mod_time)); -#endif -#if defined(PNG_WRITE_TEXT_SUPPORTED) - /* loop through comment chunks */ - for (i = 0; i < info_ptr->num_text; i++) - { - png_debug2(2, "Writing trailer text chunk %d, type %d", i, - info_ptr->text[i].compression); - /* an internationalized chunk? */ - if (info_ptr->text[i].compression > 0) - { -#if defined(PNG_WRITE_iTXt_SUPPORTED) - /* write international chunk */ - png_write_iTXt(png_ptr, - info_ptr->text[i].compression, - info_ptr->text[i].key, - info_ptr->text[i].lang, - info_ptr->text[i].lang_key, - info_ptr->text[i].text); -#else - png_warning(png_ptr, "Unable to write international text"); -#endif - /* Mark this chunk as written */ - info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; - } - else if (info_ptr->text[i].compression >= PNG_TEXT_COMPRESSION_zTXt) - { -#if defined(PNG_WRITE_zTXt_SUPPORTED) - /* write compressed chunk */ - png_write_zTXt(png_ptr, info_ptr->text[i].key, - info_ptr->text[i].text, 0, - info_ptr->text[i].compression); -#else - png_warning(png_ptr, "Unable to write compressed text"); -#endif - /* Mark this chunk as written */ - info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR; - } - else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE) - { -#if defined(PNG_WRITE_tEXt_SUPPORTED) - /* write uncompressed chunk */ - png_write_tEXt(png_ptr, info_ptr->text[i].key, - info_ptr->text[i].text, 0); -#else - png_warning(png_ptr, "Unable to write uncompressed text"); -#endif - - /* Mark this chunk as written */ - info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; - } - } -#endif -#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED) - if (info_ptr->unknown_chunks_num) - { - png_unknown_chunk *up; - - png_debug(5, "writing extra chunks"); - - for (up = info_ptr->unknown_chunks; - up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num; - up++) - { - int keep=png_handle_as_unknown(png_ptr, up->name); - if (keep != PNG_HANDLE_CHUNK_NEVER && - up->location && (up->location & PNG_AFTER_IDAT) && - ((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS || - (png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS))) - { - png_write_chunk(png_ptr, up->name, up->data, up->size); - } - } - } -#endif - } - - png_ptr->mode |= PNG_AFTER_IDAT; - - /* write end of PNG file */ - png_write_IEND(png_ptr); - /* This flush, added in libpng-1.0.8, removed from libpng-1.0.9beta03, - * and restored again in libpng-1.2.30, may cause some applications that - * do not set png_ptr->output_flush_fn to crash. If your application - * experiences a problem, please try building libpng with - * PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED defined, and report the event to - * png-mng-implement at lists.sf.net . This kludge will be removed - * from libpng-1.4.0. - */ -#if defined(PNG_WRITE_FLUSH_SUPPORTED) && \ - defined(PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED) - png_flush(png_ptr); -#endif -} - -#if defined(PNG_WRITE_tIME_SUPPORTED) -#if !defined(_WIN32_WCE) -/* "time.h" functions are not supported on WindowsCE */ -void PNGAPI -png_convert_from_struct_tm(png_timep ptime, struct tm FAR * ttime) -{ - png_debug(1, "in png_convert_from_struct_tm"); - ptime->year = (png_uint_16)(1900 + ttime->tm_year); - ptime->month = (png_byte)(ttime->tm_mon + 1); - ptime->day = (png_byte)ttime->tm_mday; - ptime->hour = (png_byte)ttime->tm_hour; - ptime->minute = (png_byte)ttime->tm_min; - ptime->second = (png_byte)ttime->tm_sec; -} - -void PNGAPI -png_convert_from_time_t(png_timep ptime, time_t ttime) -{ - struct tm *tbuf; - - png_debug(1, "in png_convert_from_time_t"); - tbuf = gmtime(&ttime); - png_convert_from_struct_tm(ptime, tbuf); -} -#endif -#endif - -/* Initialize png_ptr structure, and allocate any memory needed */ -png_structp PNGAPI -png_create_write_struct(png_const_charp user_png_ver, png_voidp error_ptr, - png_error_ptr error_fn, png_error_ptr warn_fn) -{ -#ifdef PNG_USER_MEM_SUPPORTED - return (png_create_write_struct_2(user_png_ver, error_ptr, error_fn, - warn_fn, png_voidp_NULL, png_malloc_ptr_NULL, png_free_ptr_NULL)); -} - -/* Alternate initialize png_ptr structure, and allocate any memory needed */ -png_structp PNGAPI -png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, - png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, - png_malloc_ptr malloc_fn, png_free_ptr free_fn) -{ -#endif /* PNG_USER_MEM_SUPPORTED */ -#ifdef PNG_SETJMP_SUPPORTED - volatile -#endif - png_structp png_ptr; -#ifdef PNG_SETJMP_SUPPORTED -#ifdef USE_FAR_KEYWORD - jmp_buf jmpbuf; -#endif -#endif - int i; - png_debug(1, "in png_create_write_struct"); -#ifdef PNG_USER_MEM_SUPPORTED - png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG, - (png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr); -#else - png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG); -#endif /* PNG_USER_MEM_SUPPORTED */ - if (png_ptr == NULL) - return (NULL); - - /* added at libpng-1.2.6 */ -#ifdef PNG_SET_USER_LIMITS_SUPPORTED - png_ptr->user_width_max=PNG_USER_WIDTH_MAX; - png_ptr->user_height_max=PNG_USER_HEIGHT_MAX; -#endif - -#ifdef PNG_SETJMP_SUPPORTED -#ifdef USE_FAR_KEYWORD - if (setjmp(jmpbuf)) -#else - if (setjmp(png_ptr->jmpbuf)) -#endif - { - png_free(png_ptr, png_ptr->zbuf); - png_ptr->zbuf=NULL; - png_destroy_struct(png_ptr); - return (NULL); - } -#ifdef USE_FAR_KEYWORD - png_memcpy(png_ptr->jmpbuf, jmpbuf, png_sizeof(jmp_buf)); -#endif -#endif - -#ifdef PNG_USER_MEM_SUPPORTED - png_set_mem_fn(png_ptr, mem_ptr, malloc_fn, free_fn); -#endif /* PNG_USER_MEM_SUPPORTED */ - png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn); - - if (user_png_ver) - { - i=0; - do - { - if (user_png_ver[i] != png_libpng_ver[i]) - png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; - } while (png_libpng_ver[i++]); - } - - if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH) - { - /* Libpng 0.90 and later are binary incompatible with libpng 0.89, so - * we must recompile any applications that use any older library version. - * For versions after libpng 1.0, we will be compatible, so we need - * only check the first digit. - */ - if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] || - (user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) || - (user_png_ver[0] == '0' && user_png_ver[2] < '9')) - { -#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) - char msg[80]; - if (user_png_ver) - { - png_snprintf(msg, 80, - "Application was compiled with png.h from libpng-%.20s", - user_png_ver); - png_warning(png_ptr, msg); - } - png_snprintf(msg, 80, - "Application is running with png.c from libpng-%.20s", - png_libpng_ver); - png_warning(png_ptr, msg); -#endif -#ifdef PNG_ERROR_NUMBERS_SUPPORTED - png_ptr->flags=0; -#endif - png_error(png_ptr, - "Incompatible libpng version in application and library"); - } - } - - /* initialize zbuf - compression buffer */ - png_ptr->zbuf_size = PNG_ZBUF_SIZE; - png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, - (png_uint_32)png_ptr->zbuf_size); - - png_set_write_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL, - png_flush_ptr_NULL); - -#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) - png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT, - 1, png_doublep_NULL, png_doublep_NULL); -#endif - -#ifdef PNG_SETJMP_SUPPORTED -/* Applications that neglect to set up their own setjmp() and then encounter - a png_error() will longjmp here. Since the jmpbuf is then meaningless we - abort instead of returning. */ -#ifdef USE_FAR_KEYWORD - if (setjmp(jmpbuf)) - PNG_ABORT(); - png_memcpy(png_ptr->jmpbuf, jmpbuf, png_sizeof(jmp_buf)); -#else - if (setjmp(png_ptr->jmpbuf)) - PNG_ABORT(); -#endif -#endif - return (png_ptr); -} - -/* Initialize png_ptr structure, and allocate any memory needed */ -#if defined(PNG_1_0_X) || defined(PNG_1_2_X) -/* Deprecated. */ -#undef png_write_init -void PNGAPI -png_write_init(png_structp png_ptr) -{ - /* We only come here via pre-1.0.7-compiled applications */ - png_write_init_2(png_ptr, "1.0.6 or earlier", 0, 0); -} - -void PNGAPI -png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver, - png_size_t png_struct_size, png_size_t png_info_size) -{ - /* We only come here via pre-1.0.12-compiled applications */ - if (png_ptr == NULL) return; -#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) - if (png_sizeof(png_struct) > png_struct_size || - png_sizeof(png_info) > png_info_size) - { - char msg[80]; - png_ptr->warning_fn=NULL; - if (user_png_ver) - { - png_snprintf(msg, 80, - "Application was compiled with png.h from libpng-%.20s", - user_png_ver); - png_warning(png_ptr, msg); - } - png_snprintf(msg, 80, - "Application is running with png.c from libpng-%.20s", - png_libpng_ver); - png_warning(png_ptr, msg); - } -#endif - if (png_sizeof(png_struct) > png_struct_size) - { - png_ptr->error_fn=NULL; -#ifdef PNG_ERROR_NUMBERS_SUPPORTED - png_ptr->flags=0; -#endif - png_error(png_ptr, - "The png struct allocated by the application for writing is too small."); - } - if (png_sizeof(png_info) > png_info_size) - { - png_ptr->error_fn=NULL; -#ifdef PNG_ERROR_NUMBERS_SUPPORTED - png_ptr->flags=0; -#endif - png_error(png_ptr, - "The info struct allocated by the application for writing is too small."); - } - png_write_init_3(&png_ptr, user_png_ver, png_struct_size); -} -#endif /* PNG_1_0_X || PNG_1_2_X */ - - -void PNGAPI -png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver, - png_size_t png_struct_size) -{ - png_structp png_ptr=*ptr_ptr; -#ifdef PNG_SETJMP_SUPPORTED - jmp_buf tmp_jmp; /* to save current jump buffer */ -#endif - - int i = 0; - - if (png_ptr == NULL) - return; - - do - { - if (user_png_ver[i] != png_libpng_ver[i]) - { -#ifdef PNG_LEGACY_SUPPORTED - png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; -#else - png_ptr->warning_fn=NULL; - png_warning(png_ptr, - "Application uses deprecated png_write_init() and should be recompiled."); - break; -#endif - } - } while (png_libpng_ver[i++]); - - png_debug(1, "in png_write_init_3"); - -#ifdef PNG_SETJMP_SUPPORTED - /* save jump buffer and error functions */ - png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf)); -#endif - - if (png_sizeof(png_struct) > png_struct_size) - { - png_destroy_struct(png_ptr); - png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG); - *ptr_ptr = png_ptr; - } - - /* reset all variables to 0 */ - png_memset(png_ptr, 0, png_sizeof(png_struct)); - - /* added at libpng-1.2.6 */ -#ifdef PNG_SET_USER_LIMITS_SUPPORTED - png_ptr->user_width_max=PNG_USER_WIDTH_MAX; - png_ptr->user_height_max=PNG_USER_HEIGHT_MAX; -#endif - -#ifdef PNG_SETJMP_SUPPORTED - /* restore jump buffer */ - png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof(jmp_buf)); -#endif - - png_set_write_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL, - png_flush_ptr_NULL); - - /* initialize zbuf - compression buffer */ - png_ptr->zbuf_size = PNG_ZBUF_SIZE; - png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, - (png_uint_32)png_ptr->zbuf_size); - -#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) - png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT, - 1, png_doublep_NULL, png_doublep_NULL); -#endif -} - -/* Write a few rows of image data. If the image is interlaced, - * either you will have to write the 7 sub images, or, if you - * have called png_set_interlace_handling(), you will have to - * "write" the image seven times. - */ -void PNGAPI -png_write_rows(png_structp png_ptr, png_bytepp row, - png_uint_32 num_rows) -{ - png_uint_32 i; /* row counter */ - png_bytepp rp; /* row pointer */ - - png_debug(1, "in png_write_rows"); - - if (png_ptr == NULL) - return; - - /* loop through the rows */ - for (i = 0, rp = row; i < num_rows; i++, rp++) - { - png_write_row(png_ptr, *rp); - } -} - -/* Write the image. You only need to call this function once, even - * if you are writing an interlaced image. - */ -void PNGAPI -png_write_image(png_structp png_ptr, png_bytepp image) -{ - png_uint_32 i; /* row index */ - int pass, num_pass; /* pass variables */ - png_bytepp rp; /* points to current row */ - - if (png_ptr == NULL) - return; - - png_debug(1, "in png_write_image"); -#if defined(PNG_WRITE_INTERLACING_SUPPORTED) - /* intialize interlace handling. If image is not interlaced, - this will set pass to 1 */ - num_pass = png_set_interlace_handling(png_ptr); -#else - num_pass = 1; -#endif - /* loop through passes */ - for (pass = 0; pass < num_pass; pass++) - { - /* loop through image */ - for (i = 0, rp = image; i < png_ptr->height; i++, rp++) - { - png_write_row(png_ptr, *rp); - } - } -} - -/* called by user to write a row of image data */ -void PNGAPI -png_write_row(png_structp png_ptr, png_bytep row) -{ - if (png_ptr == NULL) - return; - png_debug2(1, "in png_write_row (row %ld, pass %d)", - png_ptr->row_number, png_ptr->pass); - - /* initialize transformations and other stuff if first time */ - if (png_ptr->row_number == 0 && png_ptr->pass == 0) - { - /* make sure we wrote the header info */ - if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE)) - png_error(png_ptr, - "png_write_info was never called before png_write_row."); - - /* check for transforms that have been set but were defined out */ -#if !defined(PNG_WRITE_INVERT_SUPPORTED) && defined(PNG_READ_INVERT_SUPPORTED) - if (png_ptr->transformations & PNG_INVERT_MONO) - png_warning(png_ptr, "PNG_WRITE_INVERT_SUPPORTED is not defined."); -#endif -#if !defined(PNG_WRITE_FILLER_SUPPORTED) && defined(PNG_READ_FILLER_SUPPORTED) - if (png_ptr->transformations & PNG_FILLER) - png_warning(png_ptr, "PNG_WRITE_FILLER_SUPPORTED is not defined."); -#endif -#if !defined(PNG_WRITE_PACKSWAP_SUPPORTED) && defined(PNG_READ_PACKSWAP_SUPPORTED) - if (png_ptr->transformations & PNG_PACKSWAP) - png_warning(png_ptr, "PNG_WRITE_PACKSWAP_SUPPORTED is not defined."); -#endif -#if !defined(PNG_WRITE_PACK_SUPPORTED) && defined(PNG_READ_PACK_SUPPORTED) - if (png_ptr->transformations & PNG_PACK) - png_warning(png_ptr, "PNG_WRITE_PACK_SUPPORTED is not defined."); -#endif -#if !defined(PNG_WRITE_SHIFT_SUPPORTED) && defined(PNG_READ_SHIFT_SUPPORTED) - if (png_ptr->transformations & PNG_SHIFT) - png_warning(png_ptr, "PNG_WRITE_SHIFT_SUPPORTED is not defined."); -#endif -#if !defined(PNG_WRITE_BGR_SUPPORTED) && defined(PNG_READ_BGR_SUPPORTED) - if (png_ptr->transformations & PNG_BGR) - png_warning(png_ptr, "PNG_WRITE_BGR_SUPPORTED is not defined."); -#endif -#if !defined(PNG_WRITE_SWAP_SUPPORTED) && defined(PNG_READ_SWAP_SUPPORTED) - if (png_ptr->transformations & PNG_SWAP_BYTES) - png_warning(png_ptr, "PNG_WRITE_SWAP_SUPPORTED is not defined."); -#endif - - png_write_start_row(png_ptr); - } - -#if defined(PNG_WRITE_INTERLACING_SUPPORTED) - /* if interlaced and not interested in row, return */ - if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE)) - { - switch (png_ptr->pass) - { - case 0: - if (png_ptr->row_number & 0x07) - { - png_write_finish_row(png_ptr); - return; - } - break; - case 1: - if ((png_ptr->row_number & 0x07) || png_ptr->width < 5) - { - png_write_finish_row(png_ptr); - return; - } - break; - case 2: - if ((png_ptr->row_number & 0x07) != 4) - { - png_write_finish_row(png_ptr); - return; - } - break; - case 3: - if ((png_ptr->row_number & 0x03) || png_ptr->width < 3) - { - png_write_finish_row(png_ptr); - return; - } - break; - case 4: - if ((png_ptr->row_number & 0x03) != 2) - { - png_write_finish_row(png_ptr); - return; - } - break; - case 5: - if ((png_ptr->row_number & 0x01) || png_ptr->width < 2) - { - png_write_finish_row(png_ptr); - return; - } - break; - case 6: - if (!(png_ptr->row_number & 0x01)) - { - png_write_finish_row(png_ptr); - return; - } - break; - } - } -#endif - - /* set up row info for transformations */ - png_ptr->row_info.color_type = png_ptr->color_type; - png_ptr->row_info.width = png_ptr->usr_width; - png_ptr->row_info.channels = png_ptr->usr_channels; - png_ptr->row_info.bit_depth = png_ptr->usr_bit_depth; - png_ptr->row_info.pixel_depth = (png_byte)(png_ptr->row_info.bit_depth * - png_ptr->row_info.channels); - - png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth, - png_ptr->row_info.width); - - png_debug1(3, "row_info->color_type = %d", png_ptr->row_info.color_type); - png_debug1(3, "row_info->width = %lu", png_ptr->row_info.width); - png_debug1(3, "row_info->channels = %d", png_ptr->row_info.channels); - png_debug1(3, "row_info->bit_depth = %d", png_ptr->row_info.bit_depth); - png_debug1(3, "row_info->pixel_depth = %d", png_ptr->row_info.pixel_depth); - png_debug1(3, "row_info->rowbytes = %lu", png_ptr->row_info.rowbytes); - - /* Copy user's row into buffer, leaving room for filter byte. */ - png_memcpy_check(png_ptr, png_ptr->row_buf + 1, row, - png_ptr->row_info.rowbytes); - -#if defined(PNG_WRITE_INTERLACING_SUPPORTED) - /* handle interlacing */ - if (png_ptr->interlaced && png_ptr->pass < 6 && - (png_ptr->transformations & PNG_INTERLACE)) - { - png_do_write_interlace(&(png_ptr->row_info), - png_ptr->row_buf + 1, png_ptr->pass); - /* this should always get caught above, but still ... */ - if (!(png_ptr->row_info.width)) - { - png_write_finish_row(png_ptr); - return; - } - } -#endif - - /* handle other transformations */ - if (png_ptr->transformations) - png_do_write_transformations(png_ptr); - -#if defined(PNG_MNG_FEATURES_SUPPORTED) - /* Write filter_method 64 (intrapixel differencing) only if - * 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and - * 2. Libpng did not write a PNG signature (this filter_method is only - * used in PNG datastreams that are embedded in MNG datastreams) and - * 3. The application called png_permit_mng_features with a mask that - * included PNG_FLAG_MNG_FILTER_64 and - * 4. The filter_method is 64 and - * 5. The color_type is RGB or RGBA - */ - if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) && - (png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING)) - { - /* Intrapixel differencing */ - png_do_write_intrapixel(&(png_ptr->row_info), png_ptr->row_buf + 1); - } -#endif - - /* Find a filter if necessary, filter the row and write it out. */ - png_write_find_filter(png_ptr, &(png_ptr->row_info)); - - if (png_ptr->write_row_fn != NULL) - (*(png_ptr->write_row_fn))(png_ptr, png_ptr->row_number, png_ptr->pass); -} - -#if defined(PNG_WRITE_FLUSH_SUPPORTED) -/* Set the automatic flush interval or 0 to turn flushing off */ -void PNGAPI -png_set_flush(png_structp png_ptr, int nrows) -{ - png_debug(1, "in png_set_flush"); - if (png_ptr == NULL) - return; - png_ptr->flush_dist = (nrows < 0 ? 0 : nrows); -} - -/* flush the current output buffers now */ -void PNGAPI -png_write_flush(png_structp png_ptr) -{ - int wrote_IDAT; - - png_debug(1, "in png_write_flush"); - if (png_ptr == NULL) - return; - /* We have already written out all of the data */ - if (png_ptr->row_number >= png_ptr->num_rows) - return; - - do - { - int ret; - - /* compress the data */ - ret = deflate(&png_ptr->zstream, Z_SYNC_FLUSH); - wrote_IDAT = 0; - - /* check for compression errors */ - if (ret != Z_OK) - { - if (png_ptr->zstream.msg != NULL) - png_error(png_ptr, png_ptr->zstream.msg); - else - png_error(png_ptr, "zlib error"); - } - - if (!(png_ptr->zstream.avail_out)) - { - /* write the IDAT and reset the zlib output buffer */ - png_write_IDAT(png_ptr, png_ptr->zbuf, - png_ptr->zbuf_size); - png_ptr->zstream.next_out = png_ptr->zbuf; - png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; - wrote_IDAT = 1; - } - } while(wrote_IDAT == 1); - - /* If there is any data left to be output, write it into a new IDAT */ - if (png_ptr->zbuf_size != png_ptr->zstream.avail_out) - { - /* write the IDAT and reset the zlib output buffer */ - png_write_IDAT(png_ptr, png_ptr->zbuf, - png_ptr->zbuf_size - png_ptr->zstream.avail_out); - png_ptr->zstream.next_out = png_ptr->zbuf; - png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; - } - png_ptr->flush_rows = 0; - png_flush(png_ptr); -} -#endif /* PNG_WRITE_FLUSH_SUPPORTED */ - -/* free all memory used by the write */ -void PNGAPI -png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr) -{ - png_structp png_ptr = NULL; - png_infop info_ptr = NULL; -#ifdef PNG_USER_MEM_SUPPORTED - png_free_ptr free_fn = NULL; - png_voidp mem_ptr = NULL; -#endif - - png_debug(1, "in png_destroy_write_struct"); - if (png_ptr_ptr != NULL) - { - png_ptr = *png_ptr_ptr; -#ifdef PNG_USER_MEM_SUPPORTED - free_fn = png_ptr->free_fn; - mem_ptr = png_ptr->mem_ptr; -#endif - } - -#ifdef PNG_USER_MEM_SUPPORTED - if (png_ptr != NULL) - { - free_fn = png_ptr->free_fn; - mem_ptr = png_ptr->mem_ptr; - } -#endif - - if (info_ptr_ptr != NULL) - info_ptr = *info_ptr_ptr; - - if (info_ptr != NULL) - { - if (png_ptr != NULL) - { - png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); - -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) - if (png_ptr->num_chunk_list) - { - png_free(png_ptr, png_ptr->chunk_list); - png_ptr->chunk_list=NULL; - png_ptr->num_chunk_list = 0; - } -#endif - } - -#ifdef PNG_USER_MEM_SUPPORTED - png_destroy_struct_2((png_voidp)info_ptr, (png_free_ptr)free_fn, - (png_voidp)mem_ptr); -#else - png_destroy_struct((png_voidp)info_ptr); -#endif - *info_ptr_ptr = NULL; - } - - if (png_ptr != NULL) - { - png_write_destroy(png_ptr); -#ifdef PNG_USER_MEM_SUPPORTED - png_destroy_struct_2((png_voidp)png_ptr, (png_free_ptr)free_fn, - (png_voidp)mem_ptr); -#else - png_destroy_struct((png_voidp)png_ptr); -#endif - *png_ptr_ptr = NULL; - } -} - - -/* Free any memory used in png_ptr struct (old method) */ -void /* PRIVATE */ -png_write_destroy(png_structp png_ptr) -{ -#ifdef PNG_SETJMP_SUPPORTED - jmp_buf tmp_jmp; /* save jump buffer */ -#endif - png_error_ptr error_fn; - png_error_ptr warning_fn; - png_voidp error_ptr; -#ifdef PNG_USER_MEM_SUPPORTED - png_free_ptr free_fn; -#endif - - png_debug(1, "in png_write_destroy"); - /* free any memory zlib uses */ - deflateEnd(&png_ptr->zstream); - - /* free our memory. png_free checks NULL for us. */ - png_free(png_ptr, png_ptr->zbuf); - png_free(png_ptr, png_ptr->row_buf); -#ifndef PNG_NO_WRITE_FILTER - png_free(png_ptr, png_ptr->prev_row); - png_free(png_ptr, png_ptr->sub_row); - png_free(png_ptr, png_ptr->up_row); - png_free(png_ptr, png_ptr->avg_row); - png_free(png_ptr, png_ptr->paeth_row); -#endif - -#if defined(PNG_TIME_RFC1123_SUPPORTED) - png_free(png_ptr, png_ptr->time_buffer); -#endif - -#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) - png_free(png_ptr, png_ptr->prev_filters); - png_free(png_ptr, png_ptr->filter_weights); - png_free(png_ptr, png_ptr->inv_filter_weights); - png_free(png_ptr, png_ptr->filter_costs); - png_free(png_ptr, png_ptr->inv_filter_costs); -#endif - -#ifdef PNG_SETJMP_SUPPORTED - /* reset structure */ - png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf)); -#endif - - error_fn = png_ptr->error_fn; - warning_fn = png_ptr->warning_fn; - error_ptr = png_ptr->error_ptr; -#ifdef PNG_USER_MEM_SUPPORTED - free_fn = png_ptr->free_fn; -#endif - - png_memset(png_ptr, 0, png_sizeof(png_struct)); - - png_ptr->error_fn = error_fn; - png_ptr->warning_fn = warning_fn; - png_ptr->error_ptr = error_ptr; -#ifdef PNG_USER_MEM_SUPPORTED - png_ptr->free_fn = free_fn; -#endif - -#ifdef PNG_SETJMP_SUPPORTED - png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof(jmp_buf)); -#endif -} - -/* Allow the application to select one or more row filters to use. */ -void PNGAPI -png_set_filter(png_structp png_ptr, int method, int filters) -{ - png_debug(1, "in png_set_filter"); - if (png_ptr == NULL) - return; -#if defined(PNG_MNG_FEATURES_SUPPORTED) - if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) && - (method == PNG_INTRAPIXEL_DIFFERENCING)) - method = PNG_FILTER_TYPE_BASE; -#endif - if (method == PNG_FILTER_TYPE_BASE) - { - switch (filters & (PNG_ALL_FILTERS | 0x07)) - { -#ifndef PNG_NO_WRITE_FILTER - case 5: - case 6: - case 7: png_warning(png_ptr, "Unknown row filter for method 0"); -#endif /* PNG_NO_WRITE_FILTER */ - case PNG_FILTER_VALUE_NONE: - png_ptr->do_filter=PNG_FILTER_NONE; break; -#ifndef PNG_NO_WRITE_FILTER - case PNG_FILTER_VALUE_SUB: - png_ptr->do_filter=PNG_FILTER_SUB; break; - case PNG_FILTER_VALUE_UP: - png_ptr->do_filter=PNG_FILTER_UP; break; - case PNG_FILTER_VALUE_AVG: - png_ptr->do_filter=PNG_FILTER_AVG; break; - case PNG_FILTER_VALUE_PAETH: - png_ptr->do_filter=PNG_FILTER_PAETH; break; - default: png_ptr->do_filter = (png_byte)filters; break; -#else - default: png_warning(png_ptr, "Unknown row filter for method 0"); -#endif /* PNG_NO_WRITE_FILTER */ - } - - /* If we have allocated the row_buf, this means we have already started - * with the image and we should have allocated all of the filter buffers - * that have been selected. If prev_row isn't already allocated, then - * it is too late to start using the filters that need it, since we - * will be missing the data in the previous row. If an application - * wants to start and stop using particular filters during compression, - * it should start out with all of the filters, and then add and - * remove them after the start of compression. - */ - if (png_ptr->row_buf != NULL) - { -#ifndef PNG_NO_WRITE_FILTER - if ((png_ptr->do_filter & PNG_FILTER_SUB) && png_ptr->sub_row == NULL) - { - png_ptr->sub_row = (png_bytep)png_malloc(png_ptr, - (png_ptr->rowbytes + 1)); - png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB; - } - - if ((png_ptr->do_filter & PNG_FILTER_UP) && png_ptr->up_row == NULL) - { - if (png_ptr->prev_row == NULL) - { - png_warning(png_ptr, "Can't add Up filter after starting"); - png_ptr->do_filter &= ~PNG_FILTER_UP; - } - else - { - png_ptr->up_row = (png_bytep)png_malloc(png_ptr, - (png_ptr->rowbytes + 1)); - png_ptr->up_row[0] = PNG_FILTER_VALUE_UP; - } - } - - if ((png_ptr->do_filter & PNG_FILTER_AVG) && png_ptr->avg_row == NULL) - { - if (png_ptr->prev_row == NULL) - { - png_warning(png_ptr, "Can't add Average filter after starting"); - png_ptr->do_filter &= ~PNG_FILTER_AVG; - } - else - { - png_ptr->avg_row = (png_bytep)png_malloc(png_ptr, - (png_ptr->rowbytes + 1)); - png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG; - } - } - - if ((png_ptr->do_filter & PNG_FILTER_PAETH) && - png_ptr->paeth_row == NULL) - { - if (png_ptr->prev_row == NULL) - { - png_warning(png_ptr, "Can't add Paeth filter after starting"); - png_ptr->do_filter &= (png_byte)(~PNG_FILTER_PAETH); - } - else - { - png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr, - (png_ptr->rowbytes + 1)); - png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH; - } - } - - if (png_ptr->do_filter == PNG_NO_FILTERS) -#endif /* PNG_NO_WRITE_FILTER */ - png_ptr->do_filter = PNG_FILTER_NONE; - } - } - else - png_error(png_ptr, "Unknown custom filter method"); -} - -/* This allows us to influence the way in which libpng chooses the "best" - * filter for the current scanline. While the "minimum-sum-of-absolute- - * differences metric is relatively fast and effective, there is some - * question as to whether it can be improved upon by trying to keep the - * filtered data going to zlib more consistent, hopefully resulting in - * better compression. - */ -#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* GRR 970116 */ -void PNGAPI -png_set_filter_heuristics(png_structp png_ptr, int heuristic_method, - int num_weights, png_doublep filter_weights, - png_doublep filter_costs) -{ - int i; - - png_debug(1, "in png_set_filter_heuristics"); - if (png_ptr == NULL) - return; - if (heuristic_method >= PNG_FILTER_HEURISTIC_LAST) - { - png_warning(png_ptr, "Unknown filter heuristic method"); - return; - } - - if (heuristic_method == PNG_FILTER_HEURISTIC_DEFAULT) - { - heuristic_method = PNG_FILTER_HEURISTIC_UNWEIGHTED; - } - - if (num_weights < 0 || filter_weights == NULL || - heuristic_method == PNG_FILTER_HEURISTIC_UNWEIGHTED) - { - num_weights = 0; - } - - png_ptr->num_prev_filters = (png_byte)num_weights; - png_ptr->heuristic_method = (png_byte)heuristic_method; - - if (num_weights > 0) - { - if (png_ptr->prev_filters == NULL) - { - png_ptr->prev_filters = (png_bytep)png_malloc(png_ptr, - (png_uint_32)(png_sizeof(png_byte) * num_weights)); - - /* To make sure that the weighting starts out fairly */ - for (i = 0; i < num_weights; i++) - { - png_ptr->prev_filters[i] = 255; - } - } - - if (png_ptr->filter_weights == NULL) - { - png_ptr->filter_weights = (png_uint_16p)png_malloc(png_ptr, - (png_uint_32)(png_sizeof(png_uint_16) * num_weights)); - - png_ptr->inv_filter_weights = (png_uint_16p)png_malloc(png_ptr, - (png_uint_32)(png_sizeof(png_uint_16) * num_weights)); - for (i = 0; i < num_weights; i++) - { - png_ptr->inv_filter_weights[i] = - png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR; - } - } - - for (i = 0; i < num_weights; i++) - { - if (filter_weights[i] < 0.0) - { - png_ptr->inv_filter_weights[i] = - png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR; - } - else - { - png_ptr->inv_filter_weights[i] = - (png_uint_16)((double)PNG_WEIGHT_FACTOR*filter_weights[i]+0.5); - png_ptr->filter_weights[i] = - (png_uint_16)((double)PNG_WEIGHT_FACTOR/filter_weights[i]+0.5); - } - } - } - - /* If, in the future, there are other filter methods, this would - * need to be based on png_ptr->filter. - */ - if (png_ptr->filter_costs == NULL) - { - png_ptr->filter_costs = (png_uint_16p)png_malloc(png_ptr, - (png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST)); - - png_ptr->inv_filter_costs = (png_uint_16p)png_malloc(png_ptr, - (png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST)); - - for (i = 0; i < PNG_FILTER_VALUE_LAST; i++) - { - png_ptr->inv_filter_costs[i] = - png_ptr->filter_costs[i] = PNG_COST_FACTOR; - } - } - - /* Here is where we set the relative costs of the different filters. We - * should take the desired compression level into account when setting - * the costs, so that Paeth, for instance, has a high relative cost at low - * compression levels, while it has a lower relative cost at higher - * compression settings. The filter types are in order of increasing - * relative cost, so it would be possible to do this with an algorithm. - */ - for (i = 0; i < PNG_FILTER_VALUE_LAST; i++) - { - if (filter_costs == NULL || filter_costs[i] < 0.0) - { - png_ptr->inv_filter_costs[i] = - png_ptr->filter_costs[i] = PNG_COST_FACTOR; - } - else if (filter_costs[i] >= 1.0) - { - png_ptr->inv_filter_costs[i] = - (png_uint_16)((double)PNG_COST_FACTOR / filter_costs[i] + 0.5); - png_ptr->filter_costs[i] = - (png_uint_16)((double)PNG_COST_FACTOR * filter_costs[i] + 0.5); - } - } -} -#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ - -void PNGAPI -png_set_compression_level(png_structp png_ptr, int level) -{ - png_debug(1, "in png_set_compression_level"); - if (png_ptr == NULL) - return; - png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_LEVEL; - png_ptr->zlib_level = level; -} - -void PNGAPI -png_set_compression_mem_level(png_structp png_ptr, int mem_level) -{ - png_debug(1, "in png_set_compression_mem_level"); - if (png_ptr == NULL) - return; - png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL; - png_ptr->zlib_mem_level = mem_level; -} - -void PNGAPI -png_set_compression_strategy(png_structp png_ptr, int strategy) -{ - png_debug(1, "in png_set_compression_strategy"); - if (png_ptr == NULL) - return; - png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_STRATEGY; - png_ptr->zlib_strategy = strategy; -} - -void PNGAPI -png_set_compression_window_bits(png_structp png_ptr, int window_bits) -{ - if (png_ptr == NULL) - return; - if (window_bits > 15) - png_warning(png_ptr, "Only compression windows <= 32k supported by PNG"); - else if (window_bits < 8) - png_warning(png_ptr, "Only compression windows >= 256 supported by PNG"); -#ifndef WBITS_8_OK - /* avoid libpng bug with 256-byte windows */ - if (window_bits == 8) - { - png_warning(png_ptr, "Compression window is being reset to 512"); - window_bits=9; - } -#endif - png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS; - png_ptr->zlib_window_bits = window_bits; -} - -void PNGAPI -png_set_compression_method(png_structp png_ptr, int method) -{ - png_debug(1, "in png_set_compression_method"); - if (png_ptr == NULL) - return; - if (method != 8) - png_warning(png_ptr, "Only compression method 8 is supported by PNG"); - png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_METHOD; - png_ptr->zlib_method = method; -} - -void PNGAPI -png_set_write_status_fn(png_structp png_ptr, png_write_status_ptr write_row_fn) -{ - if (png_ptr == NULL) - return; - png_ptr->write_row_fn = write_row_fn; -} - -#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) -void PNGAPI -png_set_write_user_transform_fn(png_structp png_ptr, png_user_transform_ptr - write_user_transform_fn) -{ - png_debug(1, "in png_set_write_user_transform_fn"); - if (png_ptr == NULL) - return; - png_ptr->transformations |= PNG_USER_TRANSFORM; - png_ptr->write_user_transform_fn = write_user_transform_fn; -} -#endif - - -#if defined(PNG_INFO_IMAGE_SUPPORTED) -void PNGAPI -png_write_png(png_structp png_ptr, png_infop info_ptr, - int transforms, voidp params) -{ - if (png_ptr == NULL || info_ptr == NULL) - return; -#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) - /* invert the alpha channel from opacity to transparency */ - if (transforms & PNG_TRANSFORM_INVERT_ALPHA) - png_set_invert_alpha(png_ptr); -#endif - - /* Write the file header information. */ - png_write_info(png_ptr, info_ptr); - - /* ------ these transformations don't touch the info structure ------- */ - -#if defined(PNG_WRITE_INVERT_SUPPORTED) - /* invert monochrome pixels */ - if (transforms & PNG_TRANSFORM_INVERT_MONO) - png_set_invert_mono(png_ptr); -#endif - -#if defined(PNG_WRITE_SHIFT_SUPPORTED) - /* Shift the pixels up to a legal bit depth and fill in - * as appropriate to correctly scale the image. - */ - if ((transforms & PNG_TRANSFORM_SHIFT) - && (info_ptr->valid & PNG_INFO_sBIT)) - png_set_shift(png_ptr, &info_ptr->sig_bit); -#endif - -#if defined(PNG_WRITE_PACK_SUPPORTED) - /* pack pixels into bytes */ - if (transforms & PNG_TRANSFORM_PACKING) - png_set_packing(png_ptr); -#endif - -#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) - /* swap location of alpha bytes from ARGB to RGBA */ - if (transforms & PNG_TRANSFORM_SWAP_ALPHA) - png_set_swap_alpha(png_ptr); -#endif - -#if defined(PNG_WRITE_FILLER_SUPPORTED) - /* Pack XRGB/RGBX/ARGB/RGBA into * RGB (4 channels -> 3 channels) */ - if (transforms & PNG_TRANSFORM_STRIP_FILLER_AFTER) - png_set_filler(png_ptr, 0, PNG_FILLER_AFTER); - else if (transforms & PNG_TRANSFORM_STRIP_FILLER_BEFORE) - png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE); -#endif - -#if defined(PNG_WRITE_BGR_SUPPORTED) - /* flip BGR pixels to RGB */ - if (transforms & PNG_TRANSFORM_BGR) - png_set_bgr(png_ptr); -#endif - -#if defined(PNG_WRITE_SWAP_SUPPORTED) - /* swap bytes of 16-bit files to most significant byte first */ - if (transforms & PNG_TRANSFORM_SWAP_ENDIAN) - png_set_swap(png_ptr); -#endif - -#if defined(PNG_WRITE_PACKSWAP_SUPPORTED) - /* swap bits of 1, 2, 4 bit packed pixel formats */ - if (transforms & PNG_TRANSFORM_PACKSWAP) - png_set_packswap(png_ptr); -#endif - - /* ----------------------- end of transformations ------------------- */ - - /* write the bits */ - if (info_ptr->valid & PNG_INFO_IDAT) - png_write_image(png_ptr, info_ptr->row_pointers); - - /* It is REQUIRED to call this to finish writing the rest of the file */ - png_write_end(png_ptr, info_ptr); - - transforms = transforms; /* quiet compiler warnings */ - params = params; -} -#endif -#endif /* PNG_WRITE_SUPPORTED */ - -/* pngwrite.c - general routines to write a PNG file - * - * Last changed in libpng 1.2.15 January 5, 2007 - * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - */ - -/* get internal access to png.h */ -#define PNG_INTERNAL -#include "png.h" -#ifdef PNG_WRITE_SUPPORTED - /* Writes all the PNG information. This is the suggested way to use the * library. If you have a new chunk to add, make a function to write it, * and put it in the correct location here. If you want the chunk written @@ -1579,9 +32,9 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr) { png_write_sig(png_ptr); /* write PNG signature */ #if defined(PNG_MNG_FEATURES_SUPPORTED) - if((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)&&(png_ptr->mng_features_permitted)) + if ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)&&(png_ptr->mng_features_permitted)) { - png_warning(png_ptr,"MNG features are not allowed in a PNG datastream"); + png_warning(png_ptr, "MNG features are not allowed in a PNG datastream"); png_ptr->mng_features_permitted=0; } #endif @@ -1659,6 +112,8 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr) ((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS || (png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS))) { + if (up->size == 0) + png_warning(png_ptr, "Writing zero-length unknown chunk"); png_write_chunk(png_ptr, up->name, up->data, up->size); } } @@ -1938,9 +393,16 @@ png_write_end(png_structp png_ptr, png_infop info_ptr) /* write end of PNG file */ png_write_IEND(png_ptr); -#if 0 -/* This flush, added in libpng-1.0.8, causes some applications to crash - because they do not set png_ptr->output_flush_fn */ + /* This flush, added in libpng-1.0.8, removed from libpng-1.0.9beta03, + * and restored again in libpng-1.2.30, may cause some applications that + * do not set png_ptr->output_flush_fn to crash. If your application + * experiences a problem, please try building libpng with + * PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED defined, and report the event to + * png-mng-implement at lists.sf.net . This kludge will be removed + * from libpng-1.4.0. + */ +#if defined(PNG_WRITE_FLUSH_SUPPORTED) && \ + defined(PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED) png_flush(png_ptr); #endif } @@ -1989,7 +451,10 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn) { #endif /* PNG_USER_MEM_SUPPORTED */ - png_structp png_ptr; +#ifdef PNG_SETJMP_SUPPORTED + volatile +#endif + png_structp png_ptr; #ifdef PNG_SETJMP_SUPPORTED #ifdef USE_FAR_KEYWORD jmp_buf jmpbuf; @@ -2006,14 +471,6 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, if (png_ptr == NULL) return (NULL); -#if !defined(PNG_1_0_X) -#ifdef PNG_ASSEMBLER_CODE_SUPPORTED -#ifdef PNG_MMX_CODE_SUPPORTED - png_init_mmx_flags(png_ptr); /* 1.2.0 addition */ -#endif -#endif -#endif /* PNG_1_0_X */ - /* added at libpng-1.2.6 */ #ifdef PNG_SET_USER_LIMITS_SUPPORTED png_ptr->user_width_max=PNG_USER_WIDTH_MAX; @@ -2028,12 +485,12 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, #endif { png_free(png_ptr, png_ptr->zbuf); - png_ptr->zbuf=NULL; + png_ptr->zbuf=NULL; png_destroy_struct(png_ptr); return (NULL); } #ifdef USE_FAR_KEYWORD - png_memcpy(png_ptr->jmpbuf,jmpbuf,png_sizeof(jmp_buf)); + png_memcpy(png_ptr->jmpbuf, jmpbuf, png_sizeof(jmp_buf)); #endif #endif @@ -2042,12 +499,15 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, #endif /* PNG_USER_MEM_SUPPORTED */ png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn); - i=0; - do + if (user_png_ver) { - if(user_png_ver[i] != png_libpng_ver[i]) - png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; - } while (png_libpng_ver[i++]); + i=0; + do + { + if (user_png_ver[i] != png_libpng_ver[i]) + png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; + } while (png_libpng_ver[i++]); + } if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH) { @@ -2064,11 +524,13 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, char msg[80]; if (user_png_ver) { - sprintf(msg, "Application was compiled with png.h from libpng-%.20s", + png_snprintf(msg, 80, + "Application was compiled with png.h from libpng-%.20s", user_png_ver); png_warning(png_ptr, msg); } - sprintf(msg, "Application is running with png.c from libpng-%.20s", + png_snprintf(msg, 80, + "Application is running with png.c from libpng-%.20s", png_libpng_ver); png_warning(png_ptr, msg); #endif @@ -2100,7 +562,7 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, #ifdef USE_FAR_KEYWORD if (setjmp(jmpbuf)) PNG_ABORT(); - png_memcpy(png_ptr->jmpbuf,jmpbuf,png_sizeof(jmp_buf)); + png_memcpy(png_ptr->jmpbuf, jmpbuf, png_sizeof(jmp_buf)); #else if (setjmp(png_ptr->jmpbuf)) PNG_ABORT(); @@ -2125,25 +587,27 @@ png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t png_info_size) { /* We only come here via pre-1.0.12-compiled applications */ - if(png_ptr == NULL) return; + if (png_ptr == NULL) return; #if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) - if(png_sizeof(png_struct) > png_struct_size || + if (png_sizeof(png_struct) > png_struct_size || png_sizeof(png_info) > png_info_size) { char msg[80]; png_ptr->warning_fn=NULL; if (user_png_ver) { - sprintf(msg, "Application was compiled with png.h from libpng-%.20s", + png_snprintf(msg, 80, + "Application was compiled with png.h from libpng-%.20s", user_png_ver); png_warning(png_ptr, msg); } - sprintf(msg, "Application is running with png.c from libpng-%.20s", + png_snprintf(msg, 80, + "Application is running with png.c from libpng-%.20s", png_libpng_ver); png_warning(png_ptr, msg); } #endif - if(png_sizeof(png_struct) > png_struct_size) + if (png_sizeof(png_struct) > png_struct_size) { png_ptr->error_fn=NULL; #ifdef PNG_ERROR_NUMBERS_SUPPORTED @@ -2152,7 +616,7 @@ png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver, png_error(png_ptr, "The png struct allocated by the application for writing is too small."); } - if(png_sizeof(png_info) > png_info_size) + if (png_sizeof(png_info) > png_info_size) { png_ptr->error_fn=NULL; #ifdef PNG_ERROR_NUMBERS_SUPPORTED @@ -2189,7 +653,7 @@ png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver, #else png_ptr->warning_fn=NULL; png_warning(png_ptr, - "Application uses deprecated png_write_init() and should be recompiled."); + "Application uses deprecated png_write_init() and should be recompiled."); break; #endif } @@ -2199,7 +663,7 @@ png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver, #ifdef PNG_SETJMP_SUPPORTED /* save jump buffer and error functions */ - png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof (jmp_buf)); + png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf)); #endif if (png_sizeof(png_struct) > png_struct_size) @@ -2210,7 +674,7 @@ png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver, } /* reset all variables to 0 */ - png_memset(png_ptr, 0, png_sizeof (png_struct)); + png_memset(png_ptr, 0, png_sizeof(png_struct)); /* added at libpng-1.2.6 */ #ifdef PNG_SET_USER_LIMITS_SUPPORTED @@ -2218,17 +682,9 @@ png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver, png_ptr->user_height_max=PNG_USER_HEIGHT_MAX; #endif -#if !defined(PNG_1_0_X) -#ifdef PNG_ASSEMBLER_CODE_SUPPORTED -#ifdef PNG_MMX_CODE_SUPPORTED - png_init_mmx_flags(png_ptr); /* 1.2.0 addition */ -#endif -#endif -#endif /* PNG_1_0_X */ - #ifdef PNG_SETJMP_SUPPORTED /* restore jump buffer */ - png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof (jmp_buf)); + png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof(jmp_buf)); #endif png_set_write_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL, @@ -2462,7 +918,7 @@ png_write_row(png_structp png_ptr, png_bytep row) * 4. The filter_method is 64 and * 5. The color_type is RGB or RGBA */ - if((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) && + if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) && (png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING)) { /* Intrapixel differencing */ @@ -2564,21 +1020,32 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr) #endif } +#ifdef PNG_USER_MEM_SUPPORTED + if (png_ptr != NULL) + { + free_fn = png_ptr->free_fn; + mem_ptr = png_ptr->mem_ptr; + } +#endif + if (info_ptr_ptr != NULL) info_ptr = *info_ptr_ptr; if (info_ptr != NULL) { - png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); + if (png_ptr != NULL) + { + png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) - if (png_ptr->num_chunk_list) - { - png_free(png_ptr, png_ptr->chunk_list); - png_ptr->chunk_list=NULL; - png_ptr->num_chunk_list=0; - } + if (png_ptr->num_chunk_list) + { + png_free(png_ptr, png_ptr->chunk_list); + png_ptr->chunk_list=NULL; + png_ptr->num_chunk_list = 0; + } #endif + } #ifdef PNG_USER_MEM_SUPPORTED png_destroy_struct_2((png_voidp)info_ptr, (png_free_ptr)free_fn, @@ -2624,11 +1091,13 @@ png_write_destroy(png_structp png_ptr) /* free our memory. png_free checks NULL for us. */ png_free(png_ptr, png_ptr->zbuf); png_free(png_ptr, png_ptr->row_buf); +#ifndef PNG_NO_WRITE_FILTER png_free(png_ptr, png_ptr->prev_row); png_free(png_ptr, png_ptr->sub_row); png_free(png_ptr, png_ptr->up_row); png_free(png_ptr, png_ptr->avg_row); png_free(png_ptr, png_ptr->paeth_row); +#endif #if defined(PNG_TIME_RFC1123_SUPPORTED) png_free(png_ptr, png_ptr->time_buffer); @@ -2644,7 +1113,7 @@ png_write_destroy(png_structp png_ptr) #ifdef PNG_SETJMP_SUPPORTED /* reset structure */ - png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof (jmp_buf)); + png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf)); #endif error_fn = png_ptr->error_fn; @@ -2654,7 +1123,7 @@ png_write_destroy(png_structp png_ptr) free_fn = png_ptr->free_fn; #endif - png_memset(png_ptr, 0, png_sizeof (png_struct)); + png_memset(png_ptr, 0, png_sizeof(png_struct)); png_ptr->error_fn = error_fn; png_ptr->warning_fn = warning_fn; @@ -2664,7 +1133,7 @@ png_write_destroy(png_structp png_ptr) #endif #ifdef PNG_SETJMP_SUPPORTED - png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof (jmp_buf)); + png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof(jmp_buf)); #endif } @@ -2676,7 +1145,7 @@ png_set_filter(png_structp png_ptr, int method, int filters) if (png_ptr == NULL) return; #if defined(PNG_MNG_FEATURES_SUPPORTED) - if((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) && + if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) && (method == PNG_INTRAPIXEL_DIFFERENCING)) method = PNG_FILTER_TYPE_BASE; #endif @@ -2684,15 +1153,26 @@ png_set_filter(png_structp png_ptr, int method, int filters) { switch (filters & (PNG_ALL_FILTERS | 0x07)) { +#ifndef PNG_NO_WRITE_FILTER case 5: case 6: case 7: png_warning(png_ptr, "Unknown row filter for method 0"); - case PNG_FILTER_VALUE_NONE: png_ptr->do_filter=PNG_FILTER_NONE; break; - case PNG_FILTER_VALUE_SUB: png_ptr->do_filter=PNG_FILTER_SUB; break; - case PNG_FILTER_VALUE_UP: png_ptr->do_filter=PNG_FILTER_UP; break; - case PNG_FILTER_VALUE_AVG: png_ptr->do_filter=PNG_FILTER_AVG; break; - case PNG_FILTER_VALUE_PAETH: png_ptr->do_filter=PNG_FILTER_PAETH;break; +#endif /* PNG_NO_WRITE_FILTER */ + case PNG_FILTER_VALUE_NONE: + png_ptr->do_filter=PNG_FILTER_NONE; break; +#ifndef PNG_NO_WRITE_FILTER + case PNG_FILTER_VALUE_SUB: + png_ptr->do_filter=PNG_FILTER_SUB; break; + case PNG_FILTER_VALUE_UP: + png_ptr->do_filter=PNG_FILTER_UP; break; + case PNG_FILTER_VALUE_AVG: + png_ptr->do_filter=PNG_FILTER_AVG; break; + case PNG_FILTER_VALUE_PAETH: + png_ptr->do_filter=PNG_FILTER_PAETH; break; default: png_ptr->do_filter = (png_byte)filters; break; +#else + default: png_warning(png_ptr, "Unknown row filter for method 0"); +#endif /* PNG_NO_WRITE_FILTER */ } /* If we have allocated the row_buf, this means we have already started @@ -2706,6 +1186,7 @@ png_set_filter(png_structp png_ptr, int method, int filters) */ if (png_ptr->row_buf != NULL) { +#ifndef PNG_NO_WRITE_FILTER if ((png_ptr->do_filter & PNG_FILTER_SUB) && png_ptr->sub_row == NULL) { png_ptr->sub_row = (png_bytep)png_malloc(png_ptr, @@ -2760,6 +1241,7 @@ png_set_filter(png_structp png_ptr, int method, int filters) } if (png_ptr->do_filter == PNG_NO_FILTERS) +#endif /* PNG_NO_WRITE_FILTER */ png_ptr->do_filter = PNG_FILTER_NONE; } } @@ -3058,8 +1540,8 @@ png_write_png(png_structp png_ptr, png_infop info_ptr, /* It is REQUIRED to call this to finish writing the rest of the file */ png_write_end(png_ptr, info_ptr); - if(transforms == 0 || params == NULL) - /* quiet compiler warnings */ return; + transforms = transforms; /* quiet compiler warnings */ + params = params; } #endif #endif /* PNG_WRITE_SUPPORTED */ diff --git a/src/dep/src/irrlicht/libpng/pngwtran.c b/src/dep/src/irrlicht/libpng/pngwtran.c index e6d76a0..8888872 100644 --- a/src/dep/src/irrlicht/libpng/pngwtran.c +++ b/src/dep/src/irrlicht/libpng/pngwtran.c @@ -12,578 +12,6 @@ #include "png.h" #ifdef PNG_WRITE_SUPPORTED -/* Transform the data according to the user's wishes. The order of - * transformations is significant. - */ -void /* PRIVATE */ -png_do_write_transformations(png_structp png_ptr) -{ - png_debug(1, "in png_do_write_transformations"); - - if (png_ptr == NULL) - return; - -#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) - if (png_ptr->transformations & PNG_USER_TRANSFORM) - if (png_ptr->write_user_transform_fn != NULL) - (*(png_ptr->write_user_transform_fn)) /* user write transform function */ - (png_ptr, /* png_ptr */ - &(png_ptr->row_info), /* row_info: */ - /* png_uint_32 width; width of row */ - /* png_uint_32 rowbytes; number of bytes in row */ - /* png_byte color_type; color type of pixels */ - /* png_byte bit_depth; bit depth of samples */ - /* png_byte channels; number of channels (1-4) */ - /* png_byte pixel_depth; bits per pixel (depth*channels) */ - png_ptr->row_buf + 1); /* start of pixel data for row */ -#endif -#if defined(PNG_WRITE_FILLER_SUPPORTED) - if (png_ptr->transformations & PNG_FILLER) - png_do_strip_filler(&(png_ptr->row_info), png_ptr->row_buf + 1, - png_ptr->flags); -#endif -#if defined(PNG_WRITE_PACKSWAP_SUPPORTED) - if (png_ptr->transformations & PNG_PACKSWAP) - png_do_packswap(&(png_ptr->row_info), png_ptr->row_buf + 1); -#endif -#if defined(PNG_WRITE_PACK_SUPPORTED) - if (png_ptr->transformations & PNG_PACK) - png_do_pack(&(png_ptr->row_info), png_ptr->row_buf + 1, - (png_uint_32)png_ptr->bit_depth); -#endif -#if defined(PNG_WRITE_SWAP_SUPPORTED) - if (png_ptr->transformations & PNG_SWAP_BYTES) - png_do_swap(&(png_ptr->row_info), png_ptr->row_buf + 1); -#endif -#if defined(PNG_WRITE_SHIFT_SUPPORTED) - if (png_ptr->transformations & PNG_SHIFT) - png_do_shift(&(png_ptr->row_info), png_ptr->row_buf + 1, - &(png_ptr->shift)); -#endif -#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) - if (png_ptr->transformations & PNG_SWAP_ALPHA) - png_do_write_swap_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1); -#endif -#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) - if (png_ptr->transformations & PNG_INVERT_ALPHA) - png_do_write_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1); -#endif -#if defined(PNG_WRITE_BGR_SUPPORTED) - if (png_ptr->transformations & PNG_BGR) - png_do_bgr(&(png_ptr->row_info), png_ptr->row_buf + 1); -#endif -#if defined(PNG_WRITE_INVERT_SUPPORTED) - if (png_ptr->transformations & PNG_INVERT_MONO) - png_do_invert(&(png_ptr->row_info), png_ptr->row_buf + 1); -#endif -} - -#if defined(PNG_WRITE_PACK_SUPPORTED) -/* Pack pixels into bytes. Pass the true bit depth in bit_depth. The - * row_info bit depth should be 8 (one pixel per byte). The channels - * should be 1 (this only happens on grayscale and paletted images). - */ -void /* PRIVATE */ -png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth) -{ - png_debug(1, "in png_do_pack"); - if (row_info->bit_depth == 8 && -#if defined(PNG_USELESS_TESTS_SUPPORTED) - row != NULL && row_info != NULL && -#endif - row_info->channels == 1) - { - switch ((int)bit_depth) - { - case 1: - { - png_bytep sp, dp; - int mask, v; - png_uint_32 i; - png_uint_32 row_width = row_info->width; - - sp = row; - dp = row; - mask = 0x80; - v = 0; - - for (i = 0; i < row_width; i++) - { - if (*sp != 0) - v |= mask; - sp++; - if (mask > 1) - mask >>= 1; - else - { - mask = 0x80; - *dp = (png_byte)v; - dp++; - v = 0; - } - } - if (mask != 0x80) - *dp = (png_byte)v; - break; - } - case 2: - { - png_bytep sp, dp; - int shift, v; - png_uint_32 i; - png_uint_32 row_width = row_info->width; - - sp = row; - dp = row; - shift = 6; - v = 0; - for (i = 0; i < row_width; i++) - { - png_byte value; - - value = (png_byte)(*sp & 0x03); - v |= (value << shift); - if (shift == 0) - { - shift = 6; - *dp = (png_byte)v; - dp++; - v = 0; - } - else - shift -= 2; - sp++; - } - if (shift != 6) - *dp = (png_byte)v; - break; - } - case 4: - { - png_bytep sp, dp; - int shift, v; - png_uint_32 i; - png_uint_32 row_width = row_info->width; - - sp = row; - dp = row; - shift = 4; - v = 0; - for (i = 0; i < row_width; i++) - { - png_byte value; - - value = (png_byte)(*sp & 0x0f); - v |= (value << shift); - - if (shift == 0) - { - shift = 4; - *dp = (png_byte)v; - dp++; - v = 0; - } - else - shift -= 4; - - sp++; - } - if (shift != 4) - *dp = (png_byte)v; - break; - } - } - row_info->bit_depth = (png_byte)bit_depth; - row_info->pixel_depth = (png_byte)(bit_depth * row_info->channels); - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, - row_info->width); - } -} -#endif - -#if defined(PNG_WRITE_SHIFT_SUPPORTED) -/* Shift pixel values to take advantage of whole range. Pass the - * true number of bits in bit_depth. The row should be packed - * according to row_info->bit_depth. Thus, if you had a row of - * bit depth 4, but the pixels only had values from 0 to 7, you - * would pass 3 as bit_depth, and this routine would translate the - * data to 0 to 15. - */ -void /* PRIVATE */ -png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth) -{ - png_debug(1, "in png_do_shift"); -#if defined(PNG_USELESS_TESTS_SUPPORTED) - if (row != NULL && row_info != NULL && -#else - if ( -#endif - row_info->color_type != PNG_COLOR_TYPE_PALETTE) - { - int shift_start[4], shift_dec[4]; - int channels = 0; - - if (row_info->color_type & PNG_COLOR_MASK_COLOR) - { - shift_start[channels] = row_info->bit_depth - bit_depth->red; - shift_dec[channels] = bit_depth->red; - channels++; - shift_start[channels] = row_info->bit_depth - bit_depth->green; - shift_dec[channels] = bit_depth->green; - channels++; - shift_start[channels] = row_info->bit_depth - bit_depth->blue; - shift_dec[channels] = bit_depth->blue; - channels++; - } - else - { - shift_start[channels] = row_info->bit_depth - bit_depth->gray; - shift_dec[channels] = bit_depth->gray; - channels++; - } - if (row_info->color_type & PNG_COLOR_MASK_ALPHA) - { - shift_start[channels] = row_info->bit_depth - bit_depth->alpha; - shift_dec[channels] = bit_depth->alpha; - channels++; - } - - /* with low row depths, could only be grayscale, so one channel */ - if (row_info->bit_depth < 8) - { - png_bytep bp = row; - png_uint_32 i; - png_byte mask; - png_uint_32 row_bytes = row_info->rowbytes; - - if (bit_depth->gray == 1 && row_info->bit_depth == 2) - mask = 0x55; - else if (row_info->bit_depth == 4 && bit_depth->gray == 3) - mask = 0x11; - else - mask = 0xff; - - for (i = 0; i < row_bytes; i++, bp++) - { - png_uint_16 v; - int j; - - v = *bp; - *bp = 0; - for (j = shift_start[0]; j > -shift_dec[0]; j -= shift_dec[0]) - { - if (j > 0) - *bp |= (png_byte)((v << j) & 0xff); - else - *bp |= (png_byte)((v >> (-j)) & mask); - } - } - } - else if (row_info->bit_depth == 8) - { - png_bytep bp = row; - png_uint_32 i; - png_uint_32 istop = channels * row_info->width; - - for (i = 0; i < istop; i++, bp++) - { - - png_uint_16 v; - int j; - int c = (int)(i%channels); - - v = *bp; - *bp = 0; - for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c]) - { - if (j > 0) - *bp |= (png_byte)((v << j) & 0xff); - else - *bp |= (png_byte)((v >> (-j)) & 0xff); - } - } - } - else - { - png_bytep bp; - png_uint_32 i; - png_uint_32 istop = channels * row_info->width; - - for (bp = row, i = 0; i < istop; i++) - { - int c = (int)(i%channels); - png_uint_16 value, v; - int j; - - v = (png_uint_16)(((png_uint_16)(*bp) << 8) + *(bp + 1)); - value = 0; - for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c]) - { - if (j > 0) - value |= (png_uint_16)((v << j) & (png_uint_16)0xffff); - else - value |= (png_uint_16)((v >> (-j)) & (png_uint_16)0xffff); - } - *bp++ = (png_byte)(value >> 8); - *bp++ = (png_byte)(value & 0xff); - } - } - } -} -#endif - -#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) -void /* PRIVATE */ -png_do_write_swap_alpha(png_row_infop row_info, png_bytep row) -{ - png_debug(1, "in png_do_write_swap_alpha"); -#if defined(PNG_USELESS_TESTS_SUPPORTED) - if (row != NULL && row_info != NULL) -#endif - { - if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) - { - /* This converts from ARGB to RGBA */ - if (row_info->bit_depth == 8) - { - png_bytep sp, dp; - png_uint_32 i; - png_uint_32 row_width = row_info->width; - for (i = 0, sp = dp = row; i < row_width; i++) - { - png_byte save = *(sp++); - *(dp++) = *(sp++); - *(dp++) = *(sp++); - *(dp++) = *(sp++); - *(dp++) = save; - } - } - /* This converts from AARRGGBB to RRGGBBAA */ - else - { - png_bytep sp, dp; - png_uint_32 i; - png_uint_32 row_width = row_info->width; - - for (i = 0, sp = dp = row; i < row_width; i++) - { - png_byte save[2]; - save[0] = *(sp++); - save[1] = *(sp++); - *(dp++) = *(sp++); - *(dp++) = *(sp++); - *(dp++) = *(sp++); - *(dp++) = *(sp++); - *(dp++) = *(sp++); - *(dp++) = *(sp++); - *(dp++) = save[0]; - *(dp++) = save[1]; - } - } - } - else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) - { - /* This converts from AG to GA */ - if (row_info->bit_depth == 8) - { - png_bytep sp, dp; - png_uint_32 i; - png_uint_32 row_width = row_info->width; - - for (i = 0, sp = dp = row; i < row_width; i++) - { - png_byte save = *(sp++); - *(dp++) = *(sp++); - *(dp++) = save; - } - } - /* This converts from AAGG to GGAA */ - else - { - png_bytep sp, dp; - png_uint_32 i; - png_uint_32 row_width = row_info->width; - - for (i = 0, sp = dp = row; i < row_width; i++) - { - png_byte save[2]; - save[0] = *(sp++); - save[1] = *(sp++); - *(dp++) = *(sp++); - *(dp++) = *(sp++); - *(dp++) = save[0]; - *(dp++) = save[1]; - } - } - } - } -} -#endif - -#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) -void /* PRIVATE */ -png_do_write_invert_alpha(png_row_infop row_info, png_bytep row) -{ - png_debug(1, "in png_do_write_invert_alpha"); -#if defined(PNG_USELESS_TESTS_SUPPORTED) - if (row != NULL && row_info != NULL) -#endif - { - if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) - { - /* This inverts the alpha channel in RGBA */ - if (row_info->bit_depth == 8) - { - png_bytep sp, dp; - png_uint_32 i; - png_uint_32 row_width = row_info->width; - for (i = 0, sp = dp = row; i < row_width; i++) - { - /* does nothing - *(dp++) = *(sp++); - *(dp++) = *(sp++); - *(dp++) = *(sp++); - */ - sp+=3; dp = sp; - *(dp++) = (png_byte)(255 - *(sp++)); - } - } - /* This inverts the alpha channel in RRGGBBAA */ - else - { - png_bytep sp, dp; - png_uint_32 i; - png_uint_32 row_width = row_info->width; - - for (i = 0, sp = dp = row; i < row_width; i++) - { - /* does nothing - *(dp++) = *(sp++); - *(dp++) = *(sp++); - *(dp++) = *(sp++); - *(dp++) = *(sp++); - *(dp++) = *(sp++); - *(dp++) = *(sp++); - */ - sp+=6; dp = sp; - *(dp++) = (png_byte)(255 - *(sp++)); - *(dp++) = (png_byte)(255 - *(sp++)); - } - } - } - else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) - { - /* This inverts the alpha channel in GA */ - if (row_info->bit_depth == 8) - { - png_bytep sp, dp; - png_uint_32 i; - png_uint_32 row_width = row_info->width; - - for (i = 0, sp = dp = row; i < row_width; i++) - { - *(dp++) = *(sp++); - *(dp++) = (png_byte)(255 - *(sp++)); - } - } - /* This inverts the alpha channel in GGAA */ - else - { - png_bytep sp, dp; - png_uint_32 i; - png_uint_32 row_width = row_info->width; - - for (i = 0, sp = dp = row; i < row_width; i++) - { - /* does nothing - *(dp++) = *(sp++); - *(dp++) = *(sp++); - */ - sp+=2; dp = sp; - *(dp++) = (png_byte)(255 - *(sp++)); - *(dp++) = (png_byte)(255 - *(sp++)); - } - } - } - } -} -#endif - -#if defined(PNG_MNG_FEATURES_SUPPORTED) -/* undoes intrapixel differencing */ -void /* PRIVATE */ -png_do_write_intrapixel(png_row_infop row_info, png_bytep row) -{ - png_debug(1, "in png_do_write_intrapixel"); - if ( -#if defined(PNG_USELESS_TESTS_SUPPORTED) - row != NULL && row_info != NULL && -#endif - (row_info->color_type & PNG_COLOR_MASK_COLOR)) - { - int bytes_per_pixel; - png_uint_32 row_width = row_info->width; - if (row_info->bit_depth == 8) - { - png_bytep rp; - png_uint_32 i; - - if (row_info->color_type == PNG_COLOR_TYPE_RGB) - bytes_per_pixel = 3; - else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) - bytes_per_pixel = 4; - else - return; - - for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel) - { - *(rp) = (png_byte)((*rp - *(rp+1))&0xff); - *(rp+2) = (png_byte)((*(rp+2) - *(rp+1))&0xff); - } - } - else if (row_info->bit_depth == 16) - { - png_bytep rp; - png_uint_32 i; - - if (row_info->color_type == PNG_COLOR_TYPE_RGB) - bytes_per_pixel = 6; - else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) - bytes_per_pixel = 8; - else - return; - - for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel) - { - png_uint_32 s0 = (*(rp ) << 8) | *(rp+1); - png_uint_32 s1 = (*(rp+2) << 8) | *(rp+3); - png_uint_32 s2 = (*(rp+4) << 8) | *(rp+5); - png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL); - png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL); - *(rp ) = (png_byte)((red >> 8) & 0xff); - *(rp+1) = (png_byte)(red & 0xff); - *(rp+4) = (png_byte)((blue >> 8) & 0xff); - *(rp+5) = (png_byte)(blue & 0xff); - } - } - } -} -#endif /* PNG_MNG_FEATURES_SUPPORTED */ -#endif /* PNG_WRITE_SUPPORTED */ - -/* pngwtran.c - transforms the data in a row for PNG writers - * - * Last changed in libpng 1.2.9 April 14, 2006 - * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2006 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - */ - -#define PNG_INTERNAL -#include "png.h" -#ifdef PNG_WRITE_SUPPORTED - /* Transform the data according to the user's wishes. The order of * transformations is significant. */ @@ -597,7 +25,7 @@ png_do_write_transformations(png_structp png_ptr) #if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) if (png_ptr->transformations & PNG_USER_TRANSFORM) - if(png_ptr->write_user_transform_fn != NULL) + if (png_ptr->write_user_transform_fn != NULL) (*(png_ptr->write_user_transform_fn)) /* user write transform function */ (png_ptr, /* png_ptr */ &(png_ptr->row_info), /* row_info: */ @@ -1130,8 +558,8 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row) png_uint_32 s0 = (*(rp ) << 8) | *(rp+1); png_uint_32 s1 = (*(rp+2) << 8) | *(rp+3); png_uint_32 s2 = (*(rp+4) << 8) | *(rp+5); - png_uint_32 red = (png_uint_32)((s0-s1) & 0xffffL); - png_uint_32 blue = (png_uint_32)((s2-s1) & 0xffffL); + png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL); + png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL); *(rp ) = (png_byte)((red >> 8) & 0xff); *(rp+1) = (png_byte)(red & 0xff); *(rp+4) = (png_byte)((blue >> 8) & 0xff); diff --git a/src/dep/src/irrlicht/libpng/pngwutil.c b/src/dep/src/irrlicht/libpng/pngwutil.c index 79b600d..df243a1 100644 --- a/src/dep/src/irrlicht/libpng/pngwutil.c +++ b/src/dep/src/irrlicht/libpng/pngwutil.c @@ -1,7 +1,7 @@ /* pngwutil.c - utilities to write a PNG file * - * Last changed in libpng 1.2.34 [December 18, 2008] + * Last changed in libpng 1.2.30 [August 15, 2008] * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -96,7 +96,7 @@ png_write_chunk_start(png_structp png_ptr, png_bytep chunk_name, { png_byte buf[8]; - png_debug2(0, "Writing %s chunk, length = %lu", chunk_name, + png_debug2(0, "Writing %s chunk, length = %lu\n", chunk_name, (unsigned long)length); if (png_ptr == NULL) return; @@ -392,7 +392,7 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height, png_byte buf[13]; /* buffer to store the IHDR info */ - png_debug(1, "in png_write_IHDR"); + png_debug(1, "in png_write_IHDR\n"); /* Check that we have valid input data from the application info */ switch (color_type) { @@ -569,7 +569,7 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal) png_colorp pal_ptr; png_byte buf[3]; - png_debug(1, "in png_write_PLTE"); + png_debug(1, "in png_write_PLTE\n"); if (( #if defined(PNG_MNG_FEATURES_SUPPORTED) !(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) && @@ -595,7 +595,7 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal) } png_ptr->num_palette = (png_uint_16)num_pal; - png_debug1(3, "num_palette = %d", png_ptr->num_palette); + png_debug1(3, "num_palette = %d\n", png_ptr->num_palette); png_write_chunk_start(png_ptr, (png_bytep)png_PLTE, (png_uint_32)(num_pal * 3)); @@ -629,7 +629,7 @@ png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length) #ifdef PNG_USE_LOCAL_ARRAYS PNG_IDAT; #endif - png_debug(1, "in png_write_IDAT"); + png_debug(1, "in png_write_IDAT\n"); /* Optimize the CMF field in the zlib stream. */ /* This hack of the zlib stream is compliant to the stream specification. */ @@ -681,7 +681,7 @@ png_write_IEND(png_structp png_ptr) #ifdef PNG_USE_LOCAL_ARRAYS PNG_IEND; #endif - png_debug(1, "in png_write_IEND"); + png_debug(1, "in png_write_IEND\n"); png_write_chunk(png_ptr, (png_bytep)png_IEND, png_bytep_NULL, (png_size_t)0); png_ptr->mode |= PNG_HAVE_IEND; @@ -699,7 +699,7 @@ png_write_gAMA(png_structp png_ptr, double file_gamma) png_uint_32 igamma; png_byte buf[4]; - png_debug(1, "in png_write_gAMA"); + png_debug(1, "in png_write_gAMA\n"); /* file_gamma is saved in 1/100,000ths */ igamma = (png_uint_32)(file_gamma * 100000.0 + 0.5); png_save_uint_32(buf, igamma); @@ -715,7 +715,7 @@ png_write_gAMA_fixed(png_structp png_ptr, png_fixed_point file_gamma) #endif png_byte buf[4]; - png_debug(1, "in png_write_gAMA"); + png_debug(1, "in png_write_gAMA\n"); /* file_gamma is saved in 1/100,000ths */ png_save_uint_32(buf, (png_uint_32)file_gamma); png_write_chunk(png_ptr, (png_bytep)png_gAMA, buf, (png_size_t)4); @@ -733,7 +733,7 @@ png_write_sRGB(png_structp png_ptr, int srgb_intent) #endif png_byte buf[1]; - png_debug(1, "in png_write_sRGB"); + png_debug(1, "in png_write_sRGB\n"); if (srgb_intent >= PNG_sRGB_INTENT_LAST) png_warning(png_ptr, "Invalid sRGB rendering intent specified"); @@ -756,7 +756,7 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type, compression_state comp; int embedded_profile_len = 0; - png_debug(1, "in png_write_iCCP"); + png_debug(1, "in png_write_iCCP\n"); comp.num_output_ptr = 0; comp.max_output_ptr = 0; @@ -764,9 +764,12 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type, comp.input = NULL; comp.input_len = 0; - if ((name_len = png_check_keyword(png_ptr, name, + if (name == NULL || (name_len = png_check_keyword(png_ptr, name, &new_name)) == 0) + { + png_warning(png_ptr, "Empty keyword in iCCP chunk"); return; + } if (compression_type != PNG_COMPRESSION_TYPE_BASE) png_warning(png_ptr, "Unknown compression type in iCCP chunk"); @@ -832,10 +835,13 @@ png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette) int i; #endif - png_debug(1, "in png_write_sPLT"); - if ((name_len = png_check_keyword(png_ptr, + png_debug(1, "in png_write_sPLT\n"); + if (spalette->name == NULL || (name_len = png_check_keyword(png_ptr, spalette->name, &new_name))==0) - return; + { + png_warning(png_ptr, "Empty keyword in sPLT chunk"); + return; + } /* make sure we include the NULL after the name */ png_write_chunk_start(png_ptr, (png_bytep)png_sPLT, @@ -906,7 +912,7 @@ png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type) png_byte buf[4]; png_size_t size; - png_debug(1, "in png_write_sBIT"); + png_debug(1, "in png_write_sBIT\n"); /* make sure we don't depend upon the order of PNG_COLOR_8 */ if (color_type & PNG_COLOR_MASK_COLOR) { @@ -963,42 +969,55 @@ png_write_cHRM(png_structp png_ptr, double white_x, double white_y, PNG_cHRM; #endif png_byte buf[32]; + png_uint_32 itemp; - png_fixed_point int_white_x, int_white_y, int_red_x, int_red_y, - int_green_x, int_green_y, int_blue_x, int_blue_y; - - png_debug(1, "in png_write_cHRM"); - - int_white_x = (png_uint_32)(white_x * 100000.0 + 0.5); - int_white_y = (png_uint_32)(white_y * 100000.0 + 0.5); - int_red_x = (png_uint_32)(red_x * 100000.0 + 0.5); - int_red_y = (png_uint_32)(red_y * 100000.0 + 0.5); - int_green_x = (png_uint_32)(green_x * 100000.0 + 0.5); - int_green_y = (png_uint_32)(green_y * 100000.0 + 0.5); - int_blue_x = (png_uint_32)(blue_x * 100000.0 + 0.5); - int_blue_y = (png_uint_32)(blue_y * 100000.0 + 0.5); - -#if !defined(PNG_NO_CHECK_cHRM) - if (png_check_cHRM_fixed(png_ptr, int_white_x, int_white_y, - int_red_x, int_red_y, int_green_x, int_green_y, int_blue_x, int_blue_y)) -#endif + png_debug(1, "in png_write_cHRM\n"); + /* each value is saved in 1/100,000ths */ + if (white_x < 0 || white_x > 0.8 || white_y < 0 || white_y > 0.8 || + white_x + white_y > 1.0) { - /* each value is saved in 1/100,000ths */ - - png_save_uint_32(buf, int_white_x); - png_save_uint_32(buf + 4, int_white_y); - - png_save_uint_32(buf + 8, int_red_x); - png_save_uint_32(buf + 12, int_red_y); - - png_save_uint_32(buf + 16, int_green_x); - png_save_uint_32(buf + 20, int_green_y); - - png_save_uint_32(buf + 24, int_blue_x); - png_save_uint_32(buf + 28, int_blue_y); - - png_write_chunk(png_ptr, (png_bytep)png_cHRM, buf, (png_size_t)32); + png_warning(png_ptr, "Invalid cHRM white point specified"); +#if !defined(PNG_NO_CONSOLE_IO) + fprintf(stderr, "white_x=%f, white_y=%f\n", white_x, white_y); +#endif + return; } + itemp = (png_uint_32)(white_x * 100000.0 + 0.5); + png_save_uint_32(buf, itemp); + itemp = (png_uint_32)(white_y * 100000.0 + 0.5); + png_save_uint_32(buf + 4, itemp); + + if (red_x < 0 || red_y < 0 || red_x + red_y > 1.0) + { + png_warning(png_ptr, "Invalid cHRM red point specified"); + return; + } + itemp = (png_uint_32)(red_x * 100000.0 + 0.5); + png_save_uint_32(buf + 8, itemp); + itemp = (png_uint_32)(red_y * 100000.0 + 0.5); + png_save_uint_32(buf + 12, itemp); + + if (green_x < 0 || green_y < 0 || green_x + green_y > 1.0) + { + png_warning(png_ptr, "Invalid cHRM green point specified"); + return; + } + itemp = (png_uint_32)(green_x * 100000.0 + 0.5); + png_save_uint_32(buf + 16, itemp); + itemp = (png_uint_32)(green_y * 100000.0 + 0.5); + png_save_uint_32(buf + 20, itemp); + + if (blue_x < 0 || blue_y < 0 || blue_x + blue_y > 1.0) + { + png_warning(png_ptr, "Invalid cHRM blue point specified"); + return; + } + itemp = (png_uint_32)(blue_x * 100000.0 + 0.5); + png_save_uint_32(buf + 24, itemp); + itemp = (png_uint_32)(blue_y * 100000.0 + 0.5); + png_save_uint_32(buf + 28, itemp); + + png_write_chunk(png_ptr, (png_bytep)png_cHRM, buf, (png_size_t)32); } #endif #ifdef PNG_FIXED_POINT_SUPPORTED @@ -1013,27 +1032,45 @@ png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x, #endif png_byte buf[32]; - png_debug(1, "in png_write_cHRM"); + png_debug(1, "in png_write_cHRM\n"); /* each value is saved in 1/100,000ths */ -#if !defined(PNG_NO_CHECK_cHRM) - if (png_check_cHRM_fixed(png_ptr, white_x, white_y, red_x, red_y, - green_x, green_y, blue_x, blue_y)) -#endif + if (white_x > 80000L || white_y > 80000L || white_x + white_y > 100000L) { + png_warning(png_ptr, "Invalid fixed cHRM white point specified"); +#if !defined(PNG_NO_CONSOLE_IO) + fprintf(stderr, "white_x=%ld, white_y=%ld\n", (unsigned long)white_x, + (unsigned long)white_y); +#endif + return; + } png_save_uint_32(buf, (png_uint_32)white_x); png_save_uint_32(buf + 4, (png_uint_32)white_y); + if (red_x + red_y > 100000L) + { + png_warning(png_ptr, "Invalid cHRM fixed red point specified"); + return; + } png_save_uint_32(buf + 8, (png_uint_32)red_x); png_save_uint_32(buf + 12, (png_uint_32)red_y); + if (green_x + green_y > 100000L) + { + png_warning(png_ptr, "Invalid fixed cHRM green point specified"); + return; + } png_save_uint_32(buf + 16, (png_uint_32)green_x); png_save_uint_32(buf + 20, (png_uint_32)green_y); + if (blue_x + blue_y > 100000L) + { + png_warning(png_ptr, "Invalid fixed cHRM blue point specified"); + return; + } png_save_uint_32(buf + 24, (png_uint_32)blue_x); png_save_uint_32(buf + 28, (png_uint_32)blue_y); png_write_chunk(png_ptr, (png_bytep)png_cHRM, buf, (png_size_t)32); - } } #endif #endif @@ -1049,7 +1086,7 @@ png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran, #endif png_byte buf[6]; - png_debug(1, "in png_write_tRNS"); + png_debug(1, "in png_write_tRNS\n"); if (color_type == PNG_COLOR_TYPE_PALETTE) { if (num_trans <= 0 || num_trans > (int)png_ptr->num_palette) @@ -1104,7 +1141,7 @@ png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type) #endif png_byte buf[6]; - png_debug(1, "in png_write_bKGD"); + png_debug(1, "in png_write_bKGD\n"); if (color_type == PNG_COLOR_TYPE_PALETTE) { if ( @@ -1112,7 +1149,7 @@ png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type) (png_ptr->num_palette || (!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE))) && #endif - back->index >= png_ptr->num_palette) + back->index > png_ptr->num_palette) { png_warning(png_ptr, "Invalid background palette index"); return; @@ -1158,10 +1195,10 @@ png_write_hIST(png_structp png_ptr, png_uint_16p hist, int num_hist) int i; png_byte buf[3]; - png_debug(1, "in png_write_hIST"); + png_debug(1, "in png_write_hIST\n"); if (num_hist > (int)png_ptr->num_palette) { - png_debug2(3, "num_hist = %d, num_palette = %d", num_hist, + png_debug2(3, "num_hist = %d, num_palette = %d\n", num_hist, png_ptr->num_palette); png_warning(png_ptr, "Invalid number of histogram entries specified"); return; @@ -1198,7 +1235,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key) int kflag; int kwarn=0; - png_debug(1, "in png_check_keyword"); + png_debug(1, "in png_check_keyword\n"); *new_key = NULL; if (key == NULL || (key_len = png_strlen(key)) == 0) @@ -1207,7 +1244,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key) return ((png_size_t)0); } - png_debug1(2, "Keyword to be checked is '%s'", key); + png_debug1(2, "Keyword to be checked is '%s'\n", key); *new_key = (png_charp)png_malloc_warn(png_ptr, (png_uint_32)(key_len + 2)); if (*new_key == NULL) @@ -1266,7 +1303,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key) } } - png_debug1(2, "Checking for multiple internal spaces in '%s'", kp); + png_debug1(2, "Checking for multiple internal spaces in '%s'\n", kp); /* Remove multiple internal spaces. */ for (kflag = 0, dp = *new_key; *kp != '\0'; kp++) @@ -1301,7 +1338,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key) if (key_len > 79) { png_warning(png_ptr, "keyword length must be 1 - 79 characters"); - (*new_key)[79] = '\0'; + new_key[79] = '\0'; key_len = 79; } @@ -1321,9 +1358,12 @@ png_write_tEXt(png_structp png_ptr, png_charp key, png_charp text, png_size_t key_len; png_charp new_key; - png_debug(1, "in png_write_tEXt"); - if ((key_len = png_check_keyword(png_ptr, key, &new_key))==0) + png_debug(1, "in png_write_tEXt\n"); + if (key == NULL || (key_len = png_check_keyword(png_ptr, key, &new_key))==0) + { + png_warning(png_ptr, "Empty keyword in tEXt chunk"); return; + } if (text == NULL || *text == '\0') text_len = 0; @@ -1363,7 +1403,7 @@ png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text, png_charp new_key; compression_state comp; - png_debug(1, "in png_write_zTXt"); + png_debug(1, "in png_write_zTXt\n"); comp.num_output_ptr = 0; comp.max_output_ptr = 0; @@ -1371,8 +1411,9 @@ png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text, comp.input = NULL; comp.input_len = 0; - if ((key_len = png_check_keyword(png_ptr, key, &new_key))==0) + if (key == NULL || (key_len = png_check_keyword(png_ptr, key, &new_key))==0) { + png_warning(png_ptr, "Empty keyword in zTXt chunk"); png_free(png_ptr, new_key); return; } @@ -1419,22 +1460,23 @@ png_write_iTXt(png_structp png_ptr, int compression, png_charp key, PNG_iTXt; #endif png_size_t lang_len, key_len, lang_key_len, text_len; - png_charp new_lang; - png_charp new_key = NULL; + png_charp new_lang, new_key; png_byte cbuf[2]; compression_state comp; - png_debug(1, "in png_write_iTXt"); + png_debug(1, "in png_write_iTXt\n"); comp.num_output_ptr = 0; comp.max_output_ptr = 0; comp.output_ptr = NULL; comp.input = NULL; - if ((key_len = png_check_keyword(png_ptr, key, &new_key))==0) + if (key == NULL || (key_len = png_check_keyword(png_ptr, key, &new_key))==0) + { + png_warning(png_ptr, "Empty keyword in iTXt chunk"); return; - - if ((lang_len = png_check_keyword(png_ptr, lang, &new_lang))==0) + } + if (lang == NULL || (lang_len = png_check_keyword(png_ptr, lang, &new_lang))==0) { png_warning(png_ptr, "Empty language field in iTXt chunk"); new_lang = NULL; @@ -1510,7 +1552,7 @@ png_write_oFFs(png_structp png_ptr, png_int_32 x_offset, png_int_32 y_offset, #endif png_byte buf[9]; - png_debug(1, "in png_write_oFFs"); + png_debug(1, "in png_write_oFFs\n"); if (unit_type >= PNG_OFFSET_LAST) png_warning(png_ptr, "Unrecognized unit type for oFFs chunk"); @@ -1536,14 +1578,14 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0, png_charp new_purpose; int i; - png_debug1(1, "in png_write_pCAL (%d parameters)", nparams); + png_debug1(1, "in png_write_pCAL (%d parameters)\n", nparams); if (type >= PNG_EQUATION_LAST) png_warning(png_ptr, "Unrecognized equation type for pCAL chunk"); purpose_len = png_check_keyword(png_ptr, purpose, &new_purpose) + 1; - png_debug1(3, "pCAL purpose length = %d", (int)purpose_len); + png_debug1(3, "pCAL purpose length = %d\n", (int)purpose_len); units_len = png_strlen(units) + (nparams == 0 ? 0 : 1); - png_debug1(3, "pCAL units length = %d", (int)units_len); + png_debug1(3, "pCAL units length = %d\n", (int)units_len); total_len = purpose_len + units_len + 10; params_len = (png_uint_32p)png_malloc(png_ptr, @@ -1554,12 +1596,12 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0, for (i = 0; i < nparams; i++) { params_len[i] = png_strlen(params[i]) + (i == nparams - 1 ? 0 : 1); - png_debug2(3, "pCAL parameter %d length = %lu", i, + png_debug2(3, "pCAL parameter %d length = %lu\n", i, (unsigned long) params_len[i]); total_len += (png_size_t)params_len[i]; } - png_debug1(3, "pCAL total length = %d", (int)total_len); + png_debug1(3, "pCAL total length = %d\n", (int)total_len); png_write_chunk_start(png_ptr, (png_bytep)png_pCAL, (png_uint_32)total_len); png_write_chunk_data(png_ptr, (png_bytep)new_purpose, (png_size_t)purpose_len); @@ -1595,7 +1637,7 @@ png_write_sCAL(png_structp png_ptr, int unit, double width, double height) char buf[64]; png_size_t total_len; - png_debug(1, "in png_write_sCAL"); + png_debug(1, "in png_write_sCAL\n"); buf[0] = (char)unit; #if defined(_WIN32_WCE) @@ -1620,7 +1662,7 @@ png_write_sCAL(png_structp png_ptr, int unit, double width, double height) total_len += png_strlen(buf + total_len); #endif - png_debug1(3, "sCAL total length = %u", (unsigned int)total_len); + png_debug1(3, "sCAL total length = %u\n", (unsigned int)total_len); png_write_chunk(png_ptr, (png_bytep)png_sCAL, (png_bytep)buf, total_len); } #else @@ -1635,7 +1677,7 @@ png_write_sCAL_s(png_structp png_ptr, int unit, png_charp width, png_byte buf[64]; png_size_t wlen, hlen, total_len; - png_debug(1, "in png_write_sCAL_s"); + png_debug(1, "in png_write_sCAL_s\n"); wlen = png_strlen(width); hlen = png_strlen(height); @@ -1650,7 +1692,7 @@ png_write_sCAL_s(png_structp png_ptr, int unit, png_charp width, png_memcpy(buf + 1, width, wlen + 1); /* append the '\0' here */ png_memcpy(buf + wlen + 2, height, hlen); /* do NOT append the '\0' here */ - png_debug1(3, "sCAL total length = %u", (unsigned int)total_len); + png_debug1(3, "sCAL total length = %u\n", (unsigned int)total_len); png_write_chunk(png_ptr, (png_bytep)png_sCAL, buf, total_len); } #endif @@ -1669,7 +1711,7 @@ png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit, #endif png_byte buf[9]; - png_debug(1, "in png_write_pHYs"); + png_debug(1, "in png_write_pHYs\n"); if (unit_type >= PNG_RESOLUTION_LAST) png_warning(png_ptr, "Unrecognized unit type for pHYs chunk"); @@ -1693,7 +1735,7 @@ png_write_tIME(png_structp png_ptr, png_timep mod_time) #endif png_byte buf[7]; - png_debug(1, "in png_write_tIME"); + png_debug(1, "in png_write_tIME\n"); if (mod_time->month > 12 || mod_time->month < 1 || mod_time->day > 31 || mod_time->day < 1 || mod_time->hour > 23 || mod_time->second > 60) @@ -1737,7 +1779,7 @@ png_write_start_row(png_structp png_ptr) png_size_t buf_size; - png_debug(1, "in png_write_start_row"); + png_debug(1, "in png_write_start_row\n"); buf_size = (png_size_t)(PNG_ROWBYTES( png_ptr->usr_channels*png_ptr->usr_bit_depth, png_ptr->width) + 1); @@ -1837,7 +1879,7 @@ png_write_finish_row(png_structp png_ptr) int ret; - png_debug(1, "in png_write_finish_row"); + png_debug(1, "in png_write_finish_row\n"); /* next row */ png_ptr->row_number++; @@ -1946,7 +1988,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass) int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; #endif - png_debug(1, "in png_do_write_interlace"); + png_debug(1, "in png_do_write_interlace\n"); /* we don't have to do anything on the last pass (6) */ #if defined(PNG_USELESS_TESTS_SUPPORTED) if (row != NULL && row_info != NULL && pass < 6) @@ -2117,7 +2159,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info) int num_p_filters = (int)png_ptr->num_prev_filters; #endif - png_debug(1, "in png_write_find_filter"); + png_debug(1, "in png_write_find_filter\n"); /* find out how many bytes offset each pixel is */ bpp = (row_info->pixel_depth + 7) >> 3; @@ -2722,2784 +2764,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info) } -/* Do the actual writing of a previously filtered row. */ -void /* PRIVATE */ -png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row) -{ - png_debug(1, "in png_write_filtered_row"); - png_debug1(2, "filter = %d", filtered_row[0]); - /* set up the zlib input buffer */ - - png_ptr->zstream.next_in = filtered_row; - png_ptr->zstream.avail_in = (uInt)png_ptr->row_info.rowbytes + 1; - /* repeat until we have compressed all the data */ - do - { - int ret; /* return of zlib */ - - /* compress the data */ - ret = deflate(&png_ptr->zstream, Z_NO_FLUSH); - /* check for compression errors */ - if (ret != Z_OK) - { - if (png_ptr->zstream.msg != NULL) - png_error(png_ptr, png_ptr->zstream.msg); - else - png_error(png_ptr, "zlib error"); - } - - /* see if it is time to write another IDAT */ - if (!(png_ptr->zstream.avail_out)) - { - /* write the IDAT and reset the zlib output buffer */ - png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size); - png_ptr->zstream.next_out = png_ptr->zbuf; - png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; - } - /* repeat until all data has been compressed */ - } while (png_ptr->zstream.avail_in); - - /* swap the current and previous rows */ - if (png_ptr->prev_row != NULL) - { - png_bytep tptr; - - tptr = png_ptr->prev_row; - png_ptr->prev_row = png_ptr->row_buf; - png_ptr->row_buf = tptr; - } - - /* finish row - updates counters and flushes zlib if last row */ - png_write_finish_row(png_ptr); - -#if defined(PNG_WRITE_FLUSH_SUPPORTED) - png_ptr->flush_rows++; - - if (png_ptr->flush_dist > 0 && - png_ptr->flush_rows >= png_ptr->flush_dist) - { - png_write_flush(png_ptr); - } -#endif -} -#endif /* PNG_WRITE_SUPPORTED */ - -/* pngwutil.c - utilities to write a PNG file - * - * Last changed in libpng 1.2.15 January 5, 2007 - * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson - * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) - * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) - */ - -#define PNG_INTERNAL -#include "png.h" -#ifdef PNG_WRITE_SUPPORTED - -/* Place a 32-bit number into a buffer in PNG byte order. We work - * with unsigned numbers for convenience, although one supported - * ancillary chunk uses signed (two's complement) numbers. - */ -void PNGAPI -png_save_uint_32(png_bytep buf, png_uint_32 i) -{ - buf[0] = (png_byte)((i >> 24) & 0xff); - buf[1] = (png_byte)((i >> 16) & 0xff); - buf[2] = (png_byte)((i >> 8) & 0xff); - buf[3] = (png_byte)(i & 0xff); -} - -/* The png_save_int_32 function assumes integers are stored in two's - * complement format. If this isn't the case, then this routine needs to - * be modified to write data in two's complement format. - */ -void PNGAPI -png_save_int_32(png_bytep buf, png_int_32 i) -{ - buf[0] = (png_byte)((i >> 24) & 0xff); - buf[1] = (png_byte)((i >> 16) & 0xff); - buf[2] = (png_byte)((i >> 8) & 0xff); - buf[3] = (png_byte)(i & 0xff); -} - -/* Place a 16-bit number into a buffer in PNG byte order. - * The parameter is declared unsigned int, not png_uint_16, - * just to avoid potential problems on pre-ANSI C compilers. - */ -void PNGAPI -png_save_uint_16(png_bytep buf, unsigned int i) -{ - buf[0] = (png_byte)((i >> 8) & 0xff); - buf[1] = (png_byte)(i & 0xff); -} - -/* Write a PNG chunk all at once. The type is an array of ASCII characters - * representing the chunk name. The array must be at least 4 bytes in - * length, and does not need to be null terminated. To be safe, pass the - * pre-defined chunk names here, and if you need a new one, define it - * where the others are defined. The length is the length of the data. - * All the data must be present. If that is not possible, use the - * png_write_chunk_start(), png_write_chunk_data(), and png_write_chunk_end() - * functions instead. - */ -void PNGAPI -png_write_chunk(png_structp png_ptr, png_bytep chunk_name, - png_bytep data, png_size_t length) -{ - if(png_ptr == NULL) return; - png_write_chunk_start(png_ptr, chunk_name, (png_uint_32)length); - png_write_chunk_data(png_ptr, data, length); - png_write_chunk_end(png_ptr); -} - -/* Write the start of a PNG chunk. The type is the chunk type. - * The total_length is the sum of the lengths of all the data you will be - * passing in png_write_chunk_data(). - */ -void PNGAPI -png_write_chunk_start(png_structp png_ptr, png_bytep chunk_name, - png_uint_32 length) -{ - png_byte buf[4]; - png_debug2(0, "Writing %s chunk (%lu bytes)\n", chunk_name, length); - if(png_ptr == NULL) return; - - /* write the length */ - png_save_uint_32(buf, length); - png_write_data(png_ptr, buf, (png_size_t)4); - - /* write the chunk name */ - png_write_data(png_ptr, chunk_name, (png_size_t)4); - /* reset the crc and run it over the chunk name */ - png_reset_crc(png_ptr); - png_calculate_crc(png_ptr, chunk_name, (png_size_t)4); -} - -/* Write the data of a PNG chunk started with png_write_chunk_start(). - * Note that multiple calls to this function are allowed, and that the - * sum of the lengths from these calls *must* add up to the total_length - * given to png_write_chunk_start(). - */ -void PNGAPI -png_write_chunk_data(png_structp png_ptr, png_bytep data, png_size_t length) -{ - /* write the data, and run the CRC over it */ - if(png_ptr == NULL) return; - if (data != NULL && length > 0) - { - png_calculate_crc(png_ptr, data, length); - png_write_data(png_ptr, data, length); - } -} - -/* Finish a chunk started with png_write_chunk_start(). */ -void PNGAPI -png_write_chunk_end(png_structp png_ptr) -{ - png_byte buf[4]; - - if(png_ptr == NULL) return; - - /* write the crc */ - png_save_uint_32(buf, png_ptr->crc); - - png_write_data(png_ptr, buf, (png_size_t)4); -} - -/* Simple function to write the signature. If we have already written - * the magic bytes of the signature, or more likely, the PNG stream is - * being embedded into another stream and doesn't need its own signature, - * we should call png_set_sig_bytes() to tell libpng how many of the - * bytes have already been written. - */ -void /* PRIVATE */ -png_write_sig(png_structp png_ptr) -{ - png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10}; - /* write the rest of the 8 byte signature */ - png_write_data(png_ptr, &png_signature[png_ptr->sig_bytes], - (png_size_t)8 - png_ptr->sig_bytes); - if(png_ptr->sig_bytes < 3) - png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE; -} - -#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_iCCP_SUPPORTED) -/* - * This pair of functions encapsulates the operation of (a) compressing a - * text string, and (b) issuing it later as a series of chunk data writes. - * The compression_state structure is shared context for these functions - * set up by the caller in order to make the whole mess thread-safe. - */ - -typedef struct -{ - char *input; /* the uncompressed input data */ - int input_len; /* its length */ - int num_output_ptr; /* number of output pointers used */ - int max_output_ptr; /* size of output_ptr */ - png_charpp output_ptr; /* array of pointers to output */ -} compression_state; - -/* compress given text into storage in the png_ptr structure */ -static int /* PRIVATE */ -png_text_compress(png_structp png_ptr, - png_charp text, png_size_t text_len, int compression, - compression_state *comp) -{ - int ret; - - comp->num_output_ptr = 0; - comp->max_output_ptr = 0; - comp->output_ptr = NULL; - comp->input = NULL; - comp->input_len = 0; - - /* we may just want to pass the text right through */ - if (compression == PNG_TEXT_COMPRESSION_NONE) - { - comp->input = text; - comp->input_len = text_len; - return((int)text_len); - } - - if (compression >= PNG_TEXT_COMPRESSION_LAST) - { -#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) - char msg[50]; - sprintf(msg, "Unknown compression type %d", compression); - png_warning(png_ptr, msg); -#else - png_warning(png_ptr, "Unknown compression type"); -#endif - } - - /* We can't write the chunk until we find out how much data we have, - * which means we need to run the compressor first and save the - * output. This shouldn't be a problem, as the vast majority of - * comments should be reasonable, but we will set up an array of - * malloc'd pointers to be sure. - * - * If we knew the application was well behaved, we could simplify this - * greatly by assuming we can always malloc an output buffer large - * enough to hold the compressed text ((1001 * text_len / 1000) + 12) - * and malloc this directly. The only time this would be a bad idea is - * if we can't malloc more than 64K and we have 64K of random input - * data, or if the input string is incredibly large (although this - * wouldn't cause a failure, just a slowdown due to swapping). - */ - - /* set up the compression buffers */ - png_ptr->zstream.avail_in = (uInt)text_len; - png_ptr->zstream.next_in = (Bytef *)text; - png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; - png_ptr->zstream.next_out = (Bytef *)png_ptr->zbuf; - - /* this is the same compression loop as in png_write_row() */ - do - { - /* compress the data */ - ret = deflate(&png_ptr->zstream, Z_NO_FLUSH); - if (ret != Z_OK) - { - /* error */ - if (png_ptr->zstream.msg != NULL) - png_error(png_ptr, png_ptr->zstream.msg); - else - png_error(png_ptr, "zlib error"); - } - /* check to see if we need more room */ - if (!(png_ptr->zstream.avail_out)) - { - /* make sure the output array has room */ - if (comp->num_output_ptr >= comp->max_output_ptr) - { - int old_max; - - old_max = comp->max_output_ptr; - comp->max_output_ptr = comp->num_output_ptr + 4; - if (comp->output_ptr != NULL) - { - png_charpp old_ptr; - - old_ptr = comp->output_ptr; - comp->output_ptr = (png_charpp)png_malloc(png_ptr, - (png_uint_32)(comp->max_output_ptr * - png_sizeof (png_charpp))); - png_memcpy(comp->output_ptr, old_ptr, old_max - * png_sizeof (png_charp)); - png_free(png_ptr, old_ptr); - } - else - comp->output_ptr = (png_charpp)png_malloc(png_ptr, - (png_uint_32)(comp->max_output_ptr * - png_sizeof (png_charp))); - } - - /* save the data */ - comp->output_ptr[comp->num_output_ptr] = (png_charp)png_malloc(png_ptr, - (png_uint_32)png_ptr->zbuf_size); - png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf, - png_ptr->zbuf_size); - comp->num_output_ptr++; - - /* and reset the buffer */ - png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; - png_ptr->zstream.next_out = png_ptr->zbuf; - } - /* continue until we don't have any more to compress */ - } while (png_ptr->zstream.avail_in); - - /* finish the compression */ - do - { - /* tell zlib we are finished */ - ret = deflate(&png_ptr->zstream, Z_FINISH); - - if (ret == Z_OK) - { - /* check to see if we need more room */ - if (!(png_ptr->zstream.avail_out)) - { - /* check to make sure our output array has room */ - if (comp->num_output_ptr >= comp->max_output_ptr) - { - int old_max; - - old_max = comp->max_output_ptr; - comp->max_output_ptr = comp->num_output_ptr + 4; - if (comp->output_ptr != NULL) - { - png_charpp old_ptr; - - old_ptr = comp->output_ptr; - /* This could be optimized to realloc() */ - comp->output_ptr = (png_charpp)png_malloc(png_ptr, - (png_uint_32)(comp->max_output_ptr * - png_sizeof (png_charpp))); - png_memcpy(comp->output_ptr, old_ptr, - old_max * png_sizeof (png_charp)); - png_free(png_ptr, old_ptr); - } - else - comp->output_ptr = (png_charpp)png_malloc(png_ptr, - (png_uint_32)(comp->max_output_ptr * - png_sizeof (png_charp))); - } - - /* save off the data */ - comp->output_ptr[comp->num_output_ptr] = - (png_charp)png_malloc(png_ptr, (png_uint_32)png_ptr->zbuf_size); - png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf, - png_ptr->zbuf_size); - comp->num_output_ptr++; - - /* and reset the buffer pointers */ - png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; - png_ptr->zstream.next_out = png_ptr->zbuf; - } - } - else if (ret != Z_STREAM_END) - { - /* we got an error */ - if (png_ptr->zstream.msg != NULL) - png_error(png_ptr, png_ptr->zstream.msg); - else - png_error(png_ptr, "zlib error"); - } - } while (ret != Z_STREAM_END); - - /* text length is number of buffers plus last buffer */ - text_len = png_ptr->zbuf_size * comp->num_output_ptr; - if (png_ptr->zstream.avail_out < png_ptr->zbuf_size) - text_len += png_ptr->zbuf_size - (png_size_t)png_ptr->zstream.avail_out; - - return((int)text_len); -} - -/* ship the compressed text out via chunk writes */ -static void /* PRIVATE */ -png_write_compressed_data_out(png_structp png_ptr, compression_state *comp) -{ - int i; - - /* handle the no-compression case */ - if (comp->input) - { - png_write_chunk_data(png_ptr, (png_bytep)comp->input, - (png_size_t)comp->input_len); - return; - } - - /* write saved output buffers, if any */ - for (i = 0; i < comp->num_output_ptr; i++) - { - png_write_chunk_data(png_ptr,(png_bytep)comp->output_ptr[i], - png_ptr->zbuf_size); - png_free(png_ptr, comp->output_ptr[i]); - comp->output_ptr[i]=NULL; - } - if (comp->max_output_ptr != 0) - png_free(png_ptr, comp->output_ptr); - comp->output_ptr=NULL; - /* write anything left in zbuf */ - if (png_ptr->zstream.avail_out < (png_uint_32)png_ptr->zbuf_size) - png_write_chunk_data(png_ptr, png_ptr->zbuf, - png_ptr->zbuf_size - png_ptr->zstream.avail_out); - - /* reset zlib for another zTXt/iTXt or image data */ - deflateReset(&png_ptr->zstream); - png_ptr->zstream.data_type = Z_BINARY; -} -#endif - -/* Write the IHDR chunk, and update the png_struct with the necessary - * information. Note that the rest of this code depends upon this - * information being correct. - */ -void /* PRIVATE */ -png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height, - int bit_depth, int color_type, int compression_type, int filter_type, - int interlace_type) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_IHDR; -#endif - png_byte buf[13]; /* buffer to store the IHDR info */ - - png_debug(1, "in png_write_IHDR\n"); - /* Check that we have valid input data from the application info */ - switch (color_type) - { - case PNG_COLOR_TYPE_GRAY: - switch (bit_depth) - { - case 1: - case 2: - case 4: - case 8: - case 16: png_ptr->channels = 1; break; - default: png_error(png_ptr,"Invalid bit depth for grayscale image"); - } - break; - case PNG_COLOR_TYPE_RGB: - if (bit_depth != 8 && bit_depth != 16) - png_error(png_ptr, "Invalid bit depth for RGB image"); - png_ptr->channels = 3; - break; - case PNG_COLOR_TYPE_PALETTE: - switch (bit_depth) - { - case 1: - case 2: - case 4: - case 8: png_ptr->channels = 1; break; - default: png_error(png_ptr, "Invalid bit depth for paletted image"); - } - break; - case PNG_COLOR_TYPE_GRAY_ALPHA: - if (bit_depth != 8 && bit_depth != 16) - png_error(png_ptr, "Invalid bit depth for grayscale+alpha image"); - png_ptr->channels = 2; - break; - case PNG_COLOR_TYPE_RGB_ALPHA: - if (bit_depth != 8 && bit_depth != 16) - png_error(png_ptr, "Invalid bit depth for RGBA image"); - png_ptr->channels = 4; - break; - default: - png_error(png_ptr, "Invalid image color type specified"); - } - - if (compression_type != PNG_COMPRESSION_TYPE_BASE) - { - png_warning(png_ptr, "Invalid compression type specified"); - compression_type = PNG_COMPRESSION_TYPE_BASE; - } - - /* Write filter_method 64 (intrapixel differencing) only if - * 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and - * 2. Libpng did not write a PNG signature (this filter_method is only - * used in PNG datastreams that are embedded in MNG datastreams) and - * 3. The application called png_permit_mng_features with a mask that - * included PNG_FLAG_MNG_FILTER_64 and - * 4. The filter_method is 64 and - * 5. The color_type is RGB or RGBA - */ - if ( -#if defined(PNG_MNG_FEATURES_SUPPORTED) - !((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) && - ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) == 0) && - (color_type == PNG_COLOR_TYPE_RGB || - color_type == PNG_COLOR_TYPE_RGB_ALPHA) && - (filter_type == PNG_INTRAPIXEL_DIFFERENCING)) && -#endif - filter_type != PNG_FILTER_TYPE_BASE) - { - png_warning(png_ptr, "Invalid filter type specified"); - filter_type = PNG_FILTER_TYPE_BASE; - } - -#ifdef PNG_WRITE_INTERLACING_SUPPORTED - if (interlace_type != PNG_INTERLACE_NONE && - interlace_type != PNG_INTERLACE_ADAM7) - { - png_warning(png_ptr, "Invalid interlace type specified"); - interlace_type = PNG_INTERLACE_ADAM7; - } -#else - interlace_type=PNG_INTERLACE_NONE; -#endif - - /* save off the relevent information */ - png_ptr->bit_depth = (png_byte)bit_depth; - png_ptr->color_type = (png_byte)color_type; - png_ptr->interlaced = (png_byte)interlace_type; -#if defined(PNG_MNG_FEATURES_SUPPORTED) - png_ptr->filter_type = (png_byte)filter_type; -#endif - png_ptr->compression_type = (png_byte)compression_type; - png_ptr->width = width; - png_ptr->height = height; - - png_ptr->pixel_depth = (png_byte)(bit_depth * png_ptr->channels); - png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, width); - /* set the usr info, so any transformations can modify it */ - png_ptr->usr_width = png_ptr->width; - png_ptr->usr_bit_depth = png_ptr->bit_depth; - png_ptr->usr_channels = png_ptr->channels; - - /* pack the header information into the buffer */ - png_save_uint_32(buf, width); - png_save_uint_32(buf + 4, height); - buf[8] = (png_byte)bit_depth; - buf[9] = (png_byte)color_type; - buf[10] = (png_byte)compression_type; - buf[11] = (png_byte)filter_type; - buf[12] = (png_byte)interlace_type; - - /* write the chunk */ - png_write_chunk(png_ptr, (png_bytep)png_IHDR, buf, (png_size_t)13); - - /* initialize zlib with PNG info */ - png_ptr->zstream.zalloc = png_zalloc; - png_ptr->zstream.zfree = png_zfree; - png_ptr->zstream.opaque = (voidpf)png_ptr; - if (!(png_ptr->do_filter)) - { - if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE || - png_ptr->bit_depth < 8) - png_ptr->do_filter = PNG_FILTER_NONE; - else - png_ptr->do_filter = PNG_ALL_FILTERS; - } - if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_STRATEGY)) - { - if (png_ptr->do_filter != PNG_FILTER_NONE) - png_ptr->zlib_strategy = Z_FILTERED; - else - png_ptr->zlib_strategy = Z_DEFAULT_STRATEGY; - } - if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_LEVEL)) - png_ptr->zlib_level = Z_DEFAULT_COMPRESSION; - if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL)) - png_ptr->zlib_mem_level = 8; - if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS)) - png_ptr->zlib_window_bits = 15; - if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_METHOD)) - png_ptr->zlib_method = 8; - if (deflateInit2(&png_ptr->zstream, png_ptr->zlib_level, - png_ptr->zlib_method, png_ptr->zlib_window_bits, - png_ptr->zlib_mem_level, png_ptr->zlib_strategy) != Z_OK) - png_error(png_ptr, "zlib failed to initialize compressor"); - png_ptr->zstream.next_out = png_ptr->zbuf; - png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; - /* libpng is not interested in zstream.data_type */ - /* set it to a predefined value, to avoid its evaluation inside zlib */ - png_ptr->zstream.data_type = Z_BINARY; - - png_ptr->mode = PNG_HAVE_IHDR; -} - -/* write the palette. We are careful not to trust png_color to be in the - * correct order for PNG, so people can redefine it to any convenient - * structure. - */ -void /* PRIVATE */ -png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_PLTE; -#endif - png_uint_32 i; - png_colorp pal_ptr; - png_byte buf[3]; - - png_debug(1, "in png_write_PLTE\n"); - if (( -#if defined(PNG_MNG_FEATURES_SUPPORTED) - !(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) && -#endif - num_pal == 0) || num_pal > 256) - { - if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) - { - png_error(png_ptr, "Invalid number of colors in palette"); - } - else - { - png_warning(png_ptr, "Invalid number of colors in palette"); - return; - } - } - - if (!(png_ptr->color_type&PNG_COLOR_MASK_COLOR)) - { - png_warning(png_ptr, - "Ignoring request to write a PLTE chunk in grayscale PNG"); - return; - } - - png_ptr->num_palette = (png_uint_16)num_pal; - png_debug1(3, "num_palette = %d\n", png_ptr->num_palette); - - png_write_chunk_start(png_ptr, (png_bytep)png_PLTE, num_pal * 3); -#ifndef PNG_NO_POINTER_INDEXING - for (i = 0, pal_ptr = palette; i < num_pal; i++, pal_ptr++) - { - buf[0] = pal_ptr->red; - buf[1] = pal_ptr->green; - buf[2] = pal_ptr->blue; - png_write_chunk_data(png_ptr, buf, (png_size_t)3); - } -#else - /* This is a little slower but some buggy compilers need to do this instead */ - pal_ptr=palette; - for (i = 0; i < num_pal; i++) - { - buf[0] = pal_ptr[i].red; - buf[1] = pal_ptr[i].green; - buf[2] = pal_ptr[i].blue; - png_write_chunk_data(png_ptr, buf, (png_size_t)3); - } -#endif - png_write_chunk_end(png_ptr); - png_ptr->mode |= PNG_HAVE_PLTE; -} - -/* write an IDAT chunk */ -void /* PRIVATE */ -png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_IDAT; -#endif - png_debug(1, "in png_write_IDAT\n"); - - /* Optimize the CMF field in the zlib stream. */ - /* This hack of the zlib stream is compliant to the stream specification. */ - if (!(png_ptr->mode & PNG_HAVE_IDAT) && - png_ptr->compression_type == PNG_COMPRESSION_TYPE_BASE) - { - unsigned int z_cmf = data[0]; /* zlib compression method and flags */ - if ((z_cmf & 0x0f) == 8 && (z_cmf & 0xf0) <= 0x70) - { - /* Avoid memory underflows and multiplication overflows. */ - /* The conditions below are practically always satisfied; - however, they still must be checked. */ - if (length >= 2 && - png_ptr->height < 16384 && png_ptr->width < 16384) - { - png_uint_32 uncompressed_idat_size = png_ptr->height * - ((png_ptr->width * - png_ptr->channels * png_ptr->bit_depth + 15) >> 3); - unsigned int z_cinfo = z_cmf >> 4; - unsigned int half_z_window_size = 1 << (z_cinfo + 7); - while (uncompressed_idat_size <= half_z_window_size && - half_z_window_size >= 256) - { - z_cinfo--; - half_z_window_size >>= 1; - } - z_cmf = (z_cmf & 0x0f) | (z_cinfo << 4); - if (data[0] != (png_byte)z_cmf) - { - data[0] = (png_byte)z_cmf; - data[1] &= 0xe0; - data[1] += (png_byte)(0x1f - ((z_cmf << 8) + data[1]) % 0x1f); - } - } - } - else - png_error(png_ptr, - "Invalid zlib compression method or flags in IDAT"); - } - - png_write_chunk(png_ptr, (png_bytep)png_IDAT, data, length); - png_ptr->mode |= PNG_HAVE_IDAT; -} - -/* write an IEND chunk */ -void /* PRIVATE */ -png_write_IEND(png_structp png_ptr) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_IEND; -#endif - png_debug(1, "in png_write_IEND\n"); - png_write_chunk(png_ptr, (png_bytep)png_IEND, png_bytep_NULL, - (png_size_t)0); - png_ptr->mode |= PNG_HAVE_IEND; -} - -#if defined(PNG_WRITE_gAMA_SUPPORTED) -/* write a gAMA chunk */ -#ifdef PNG_FLOATING_POINT_SUPPORTED -void /* PRIVATE */ -png_write_gAMA(png_structp png_ptr, double file_gamma) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_gAMA; -#endif - png_uint_32 igamma; - png_byte buf[4]; - - png_debug(1, "in png_write_gAMA\n"); - /* file_gamma is saved in 1/100,000ths */ - igamma = (png_uint_32)(file_gamma * 100000.0 + 0.5); - png_save_uint_32(buf, igamma); - png_write_chunk(png_ptr, (png_bytep)png_gAMA, buf, (png_size_t)4); -} -#endif -#ifdef PNG_FIXED_POINT_SUPPORTED -void /* PRIVATE */ -png_write_gAMA_fixed(png_structp png_ptr, png_fixed_point file_gamma) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_gAMA; -#endif - png_byte buf[4]; - - png_debug(1, "in png_write_gAMA\n"); - /* file_gamma is saved in 1/100,000ths */ - png_save_uint_32(buf, (png_uint_32)file_gamma); - png_write_chunk(png_ptr, (png_bytep)png_gAMA, buf, (png_size_t)4); -} -#endif -#endif - -#if defined(PNG_WRITE_sRGB_SUPPORTED) -/* write a sRGB chunk */ -void /* PRIVATE */ -png_write_sRGB(png_structp png_ptr, int srgb_intent) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_sRGB; -#endif - png_byte buf[1]; - - png_debug(1, "in png_write_sRGB\n"); - if(srgb_intent >= PNG_sRGB_INTENT_LAST) - png_warning(png_ptr, - "Invalid sRGB rendering intent specified"); - buf[0]=(png_byte)srgb_intent; - png_write_chunk(png_ptr, (png_bytep)png_sRGB, buf, (png_size_t)1); -} -#endif - -#if defined(PNG_WRITE_iCCP_SUPPORTED) -/* write an iCCP chunk */ -void /* PRIVATE */ -png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type, - png_charp profile, int profile_len) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_iCCP; -#endif - png_size_t name_len; - png_charp new_name; - compression_state comp; - int embedded_profile_len = 0; - - png_debug(1, "in png_write_iCCP\n"); - - comp.num_output_ptr = 0; - comp.max_output_ptr = 0; - comp.output_ptr = NULL; - comp.input = NULL; - comp.input_len = 0; - - if (name == NULL || (name_len = png_check_keyword(png_ptr, name, - &new_name)) == 0) - { - png_warning(png_ptr, "Empty keyword in iCCP chunk"); - return; - } - - if (compression_type != PNG_COMPRESSION_TYPE_BASE) - png_warning(png_ptr, "Unknown compression type in iCCP chunk"); - - if (profile == NULL) - profile_len = 0; - - if (profile_len > 3) - embedded_profile_len = - ((*( (png_bytep)profile ))<<24) | - ((*( (png_bytep)profile+1))<<16) | - ((*( (png_bytep)profile+2))<< 8) | - ((*( (png_bytep)profile+3)) ); - - if (profile_len < embedded_profile_len) - { - png_warning(png_ptr, - "Embedded profile length too large in iCCP chunk"); - return; - } - - if (profile_len > embedded_profile_len) - { - png_warning(png_ptr, - "Truncating profile to actual length in iCCP chunk"); - profile_len = embedded_profile_len; - } - - if (profile_len) - profile_len = png_text_compress(png_ptr, profile, (png_size_t)profile_len, - PNG_COMPRESSION_TYPE_BASE, &comp); - - /* make sure we include the NULL after the name and the compression type */ - png_write_chunk_start(png_ptr, (png_bytep)png_iCCP, - (png_uint_32)name_len+profile_len+2); - new_name[name_len+1]=0x00; - png_write_chunk_data(png_ptr, (png_bytep)new_name, name_len + 2); - - if (profile_len) - png_write_compressed_data_out(png_ptr, &comp); - - png_write_chunk_end(png_ptr); - png_free(png_ptr, new_name); -} -#endif - -#if defined(PNG_WRITE_sPLT_SUPPORTED) -/* write a sPLT chunk */ -void /* PRIVATE */ -png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_sPLT; -#endif - png_size_t name_len; - png_charp new_name; - png_byte entrybuf[10]; - int entry_size = (spalette->depth == 8 ? 6 : 10); - int palette_size = entry_size * spalette->nentries; - png_sPLT_entryp ep; -#ifdef PNG_NO_POINTER_INDEXING - int i; -#endif - - png_debug(1, "in png_write_sPLT\n"); - if (spalette->name == NULL || (name_len = png_check_keyword(png_ptr, - spalette->name, &new_name))==0) - { - png_warning(png_ptr, "Empty keyword in sPLT chunk"); - return; - } - - /* make sure we include the NULL after the name */ - png_write_chunk_start(png_ptr, (png_bytep)png_sPLT, - (png_uint_32)(name_len + 2 + palette_size)); - png_write_chunk_data(png_ptr, (png_bytep)new_name, name_len + 1); - png_write_chunk_data(png_ptr, (png_bytep)&spalette->depth, 1); - - /* loop through each palette entry, writing appropriately */ -#ifndef PNG_NO_POINTER_INDEXING - for (ep = spalette->entries; epentries+spalette->nentries; ep++) - { - if (spalette->depth == 8) - { - entrybuf[0] = (png_byte)ep->red; - entrybuf[1] = (png_byte)ep->green; - entrybuf[2] = (png_byte)ep->blue; - entrybuf[3] = (png_byte)ep->alpha; - png_save_uint_16(entrybuf + 4, ep->frequency); - } - else - { - png_save_uint_16(entrybuf + 0, ep->red); - png_save_uint_16(entrybuf + 2, ep->green); - png_save_uint_16(entrybuf + 4, ep->blue); - png_save_uint_16(entrybuf + 6, ep->alpha); - png_save_uint_16(entrybuf + 8, ep->frequency); - } - png_write_chunk_data(png_ptr, entrybuf, (png_size_t)entry_size); - } -#else - ep=spalette->entries; - for (i=0; i>spalette->nentries; i++) - { - if (spalette->depth == 8) - { - entrybuf[0] = (png_byte)ep[i].red; - entrybuf[1] = (png_byte)ep[i].green; - entrybuf[2] = (png_byte)ep[i].blue; - entrybuf[3] = (png_byte)ep[i].alpha; - png_save_uint_16(entrybuf + 4, ep[i].frequency); - } - else - { - png_save_uint_16(entrybuf + 0, ep[i].red); - png_save_uint_16(entrybuf + 2, ep[i].green); - png_save_uint_16(entrybuf + 4, ep[i].blue); - png_save_uint_16(entrybuf + 6, ep[i].alpha); - png_save_uint_16(entrybuf + 8, ep[i].frequency); - } - png_write_chunk_data(png_ptr, entrybuf, entry_size); - } -#endif - - png_write_chunk_end(png_ptr); - png_free(png_ptr, new_name); -} -#endif - -#if defined(PNG_WRITE_sBIT_SUPPORTED) -/* write the sBIT chunk */ -void /* PRIVATE */ -png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_sBIT; -#endif - png_byte buf[4]; - png_size_t size; - - png_debug(1, "in png_write_sBIT\n"); - /* make sure we don't depend upon the order of PNG_COLOR_8 */ - if (color_type & PNG_COLOR_MASK_COLOR) - { - png_byte maxbits; - - maxbits = (png_byte)(color_type==PNG_COLOR_TYPE_PALETTE ? 8 : - png_ptr->usr_bit_depth); - if (sbit->red == 0 || sbit->red > maxbits || - sbit->green == 0 || sbit->green > maxbits || - sbit->blue == 0 || sbit->blue > maxbits) - { - png_warning(png_ptr, "Invalid sBIT depth specified"); - return; - } - buf[0] = sbit->red; - buf[1] = sbit->green; - buf[2] = sbit->blue; - size = 3; - } - else - { - if (sbit->gray == 0 || sbit->gray > png_ptr->usr_bit_depth) - { - png_warning(png_ptr, "Invalid sBIT depth specified"); - return; - } - buf[0] = sbit->gray; - size = 1; - } - - if (color_type & PNG_COLOR_MASK_ALPHA) - { - if (sbit->alpha == 0 || sbit->alpha > png_ptr->usr_bit_depth) - { - png_warning(png_ptr, "Invalid sBIT depth specified"); - return; - } - buf[size++] = sbit->alpha; - } - - png_write_chunk(png_ptr, (png_bytep)png_sBIT, buf, size); -} -#endif - -#if defined(PNG_WRITE_cHRM_SUPPORTED) -/* write the cHRM chunk */ -#ifdef PNG_FLOATING_POINT_SUPPORTED -void /* PRIVATE */ -png_write_cHRM(png_structp png_ptr, double white_x, double white_y, - double red_x, double red_y, double green_x, double green_y, - double blue_x, double blue_y) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_cHRM; -#endif - png_byte buf[32]; - png_uint_32 itemp; - - png_debug(1, "in png_write_cHRM\n"); - /* each value is saved in 1/100,000ths */ - if (white_x < 0 || white_x > 0.8 || white_y < 0 || white_y > 0.8 || - white_x + white_y > 1.0) - { - png_warning(png_ptr, "Invalid cHRM white point specified"); -#if !defined(PNG_NO_CONSOLE_IO) - fprintf(stderr,"white_x=%f, white_y=%f\n",white_x, white_y); -#endif - return; - } - itemp = (png_uint_32)(white_x * 100000.0 + 0.5); - png_save_uint_32(buf, itemp); - itemp = (png_uint_32)(white_y * 100000.0 + 0.5); - png_save_uint_32(buf + 4, itemp); - - if (red_x < 0 || red_y < 0 || red_x + red_y > 1.0) - { - png_warning(png_ptr, "Invalid cHRM red point specified"); - return; - } - itemp = (png_uint_32)(red_x * 100000.0 + 0.5); - png_save_uint_32(buf + 8, itemp); - itemp = (png_uint_32)(red_y * 100000.0 + 0.5); - png_save_uint_32(buf + 12, itemp); - - if (green_x < 0 || green_y < 0 || green_x + green_y > 1.0) - { - png_warning(png_ptr, "Invalid cHRM green point specified"); - return; - } - itemp = (png_uint_32)(green_x * 100000.0 + 0.5); - png_save_uint_32(buf + 16, itemp); - itemp = (png_uint_32)(green_y * 100000.0 + 0.5); - png_save_uint_32(buf + 20, itemp); - - if (blue_x < 0 || blue_y < 0 || blue_x + blue_y > 1.0) - { - png_warning(png_ptr, "Invalid cHRM blue point specified"); - return; - } - itemp = (png_uint_32)(blue_x * 100000.0 + 0.5); - png_save_uint_32(buf + 24, itemp); - itemp = (png_uint_32)(blue_y * 100000.0 + 0.5); - png_save_uint_32(buf + 28, itemp); - - png_write_chunk(png_ptr, (png_bytep)png_cHRM, buf, (png_size_t)32); -} -#endif -#ifdef PNG_FIXED_POINT_SUPPORTED -void /* PRIVATE */ -png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x, - png_fixed_point white_y, png_fixed_point red_x, png_fixed_point red_y, - png_fixed_point green_x, png_fixed_point green_y, png_fixed_point blue_x, - png_fixed_point blue_y) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_cHRM; -#endif - png_byte buf[32]; - - png_debug(1, "in png_write_cHRM\n"); - /* each value is saved in 1/100,000ths */ - if (white_x > 80000L || white_y > 80000L || white_x + white_y > 100000L) - { - png_warning(png_ptr, "Invalid fixed cHRM white point specified"); -#if !defined(PNG_NO_CONSOLE_IO) - fprintf(stderr,"white_x=%ld, white_y=%ld\n",white_x, white_y); -#endif - return; - } - png_save_uint_32(buf, (png_uint_32)white_x); - png_save_uint_32(buf + 4, (png_uint_32)white_y); - - if (red_x + red_y > 100000L) - { - png_warning(png_ptr, "Invalid cHRM fixed red point specified"); - return; - } - png_save_uint_32(buf + 8, (png_uint_32)red_x); - png_save_uint_32(buf + 12, (png_uint_32)red_y); - - if (green_x + green_y > 100000L) - { - png_warning(png_ptr, "Invalid fixed cHRM green point specified"); - return; - } - png_save_uint_32(buf + 16, (png_uint_32)green_x); - png_save_uint_32(buf + 20, (png_uint_32)green_y); - - if (blue_x + blue_y > 100000L) - { - png_warning(png_ptr, "Invalid fixed cHRM blue point specified"); - return; - } - png_save_uint_32(buf + 24, (png_uint_32)blue_x); - png_save_uint_32(buf + 28, (png_uint_32)blue_y); - - png_write_chunk(png_ptr, (png_bytep)png_cHRM, buf, (png_size_t)32); -} -#endif -#endif - -#if defined(PNG_WRITE_tRNS_SUPPORTED) -/* write the tRNS chunk */ -void /* PRIVATE */ -png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran, - int num_trans, int color_type) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_tRNS; -#endif - png_byte buf[6]; - - png_debug(1, "in png_write_tRNS\n"); - if (color_type == PNG_COLOR_TYPE_PALETTE) - { - if (num_trans <= 0 || num_trans > (int)png_ptr->num_palette) - { - png_warning(png_ptr,"Invalid number of transparent colors specified"); - return; - } - /* write the chunk out as it is */ - png_write_chunk(png_ptr, (png_bytep)png_tRNS, trans, (png_size_t)num_trans); - } - else if (color_type == PNG_COLOR_TYPE_GRAY) - { - /* one 16 bit value */ - if(tran->gray >= (1 << png_ptr->bit_depth)) - { - png_warning(png_ptr, - "Ignoring attempt to write tRNS chunk out-of-range for bit_depth"); - return; - } - png_save_uint_16(buf, tran->gray); - png_write_chunk(png_ptr, (png_bytep)png_tRNS, buf, (png_size_t)2); - } - else if (color_type == PNG_COLOR_TYPE_RGB) - { - /* three 16 bit values */ - png_save_uint_16(buf, tran->red); - png_save_uint_16(buf + 2, tran->green); - png_save_uint_16(buf + 4, tran->blue); - if(png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4])) - { - png_warning(png_ptr, - "Ignoring attempt to write 16-bit tRNS chunk when bit_depth is 8"); - return; - } - png_write_chunk(png_ptr, (png_bytep)png_tRNS, buf, (png_size_t)6); - } - else - { - png_warning(png_ptr, "Can't write tRNS with an alpha channel"); - } -} -#endif - -#if defined(PNG_WRITE_bKGD_SUPPORTED) -/* write the background chunk */ -void /* PRIVATE */ -png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_bKGD; -#endif - png_byte buf[6]; - - png_debug(1, "in png_write_bKGD\n"); - if (color_type == PNG_COLOR_TYPE_PALETTE) - { - if ( -#if defined(PNG_MNG_FEATURES_SUPPORTED) - (png_ptr->num_palette || - (!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE))) && -#endif - back->index > png_ptr->num_palette) - { - png_warning(png_ptr, "Invalid background palette index"); - return; - } - buf[0] = back->index; - png_write_chunk(png_ptr, (png_bytep)png_bKGD, buf, (png_size_t)1); - } - else if (color_type & PNG_COLOR_MASK_COLOR) - { - png_save_uint_16(buf, back->red); - png_save_uint_16(buf + 2, back->green); - png_save_uint_16(buf + 4, back->blue); - if(png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4])) - { - png_warning(png_ptr, - "Ignoring attempt to write 16-bit bKGD chunk when bit_depth is 8"); - return; - } - png_write_chunk(png_ptr, (png_bytep)png_bKGD, buf, (png_size_t)6); - } - else - { - if(back->gray >= (1 << png_ptr->bit_depth)) - { - png_warning(png_ptr, - "Ignoring attempt to write bKGD chunk out-of-range for bit_depth"); - return; - } - png_save_uint_16(buf, back->gray); - png_write_chunk(png_ptr, (png_bytep)png_bKGD, buf, (png_size_t)2); - } -} -#endif - -#if defined(PNG_WRITE_hIST_SUPPORTED) -/* write the histogram */ -void /* PRIVATE */ -png_write_hIST(png_structp png_ptr, png_uint_16p hist, int num_hist) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_hIST; -#endif - int i; - png_byte buf[3]; - - png_debug(1, "in png_write_hIST\n"); - if (num_hist > (int)png_ptr->num_palette) - { - png_debug2(3, "num_hist = %d, num_palette = %d\n", num_hist, - png_ptr->num_palette); - png_warning(png_ptr, "Invalid number of histogram entries specified"); - return; - } - - png_write_chunk_start(png_ptr, (png_bytep)png_hIST, (png_uint_32)(num_hist * 2)); - for (i = 0; i < num_hist; i++) - { - png_save_uint_16(buf, hist[i]); - png_write_chunk_data(png_ptr, buf, (png_size_t)2); - } - png_write_chunk_end(png_ptr); -} -#endif - -#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \ - defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED) -/* Check that the tEXt or zTXt keyword is valid per PNG 1.0 specification, - * and if invalid, correct the keyword rather than discarding the entire - * chunk. The PNG 1.0 specification requires keywords 1-79 characters in - * length, forbids leading or trailing whitespace, multiple internal spaces, - * and the non-break space (0x80) from ISO 8859-1. Returns keyword length. - * - * The new_key is allocated to hold the corrected keyword and must be freed - * by the calling routine. This avoids problems with trying to write to - * static keywords without having to have duplicate copies of the strings. - */ -png_size_t /* PRIVATE */ -png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key) -{ - png_size_t key_len; - png_charp kp, dp; - int kflag; - int kwarn=0; - - png_debug(1, "in png_check_keyword\n"); - *new_key = NULL; - - if (key == NULL || (key_len = png_strlen(key)) == 0) - { - png_warning(png_ptr, "zero length keyword"); - return ((png_size_t)0); - } - - png_debug1(2, "Keyword to be checked is '%s'\n", key); - - *new_key = (png_charp)png_malloc_warn(png_ptr, (png_uint_32)(key_len + 2)); - if (*new_key == NULL) - { - png_warning(png_ptr, "Out of memory while procesing keyword"); - return ((png_size_t)0); - } - - /* Replace non-printing characters with a blank and print a warning */ - for (kp = key, dp = *new_key; *kp != '\0'; kp++, dp++) - { - if (*kp < 0x20 || (*kp > 0x7E && (png_byte)*kp < 0xA1)) - { -#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) - char msg[40]; - - sprintf(msg, "invalid keyword character 0x%02X", *kp); - png_warning(png_ptr, msg); -#else - png_warning(png_ptr, "invalid character in keyword"); -#endif - *dp = ' '; - } - else - { - *dp = *kp; - } - } - *dp = '\0'; - - /* Remove any trailing white space. */ - kp = *new_key + key_len - 1; - if (*kp == ' ') - { - png_warning(png_ptr, "trailing spaces removed from keyword"); - - while (*kp == ' ') - { - *(kp--) = '\0'; - key_len--; - } - } - - /* Remove any leading white space. */ - kp = *new_key; - if (*kp == ' ') - { - png_warning(png_ptr, "leading spaces removed from keyword"); - - while (*kp == ' ') - { - kp++; - key_len--; - } - } - - png_debug1(2, "Checking for multiple internal spaces in '%s'\n", kp); - - /* Remove multiple internal spaces. */ - for (kflag = 0, dp = *new_key; *kp != '\0'; kp++) - { - if (*kp == ' ' && kflag == 0) - { - *(dp++) = *kp; - kflag = 1; - } - else if (*kp == ' ') - { - key_len--; - kwarn=1; - } - else - { - *(dp++) = *kp; - kflag = 0; - } - } - *dp = '\0'; - if(kwarn) - png_warning(png_ptr, "extra interior spaces removed from keyword"); - - if (key_len == 0) - { - png_free(png_ptr, *new_key); - *new_key=NULL; - png_warning(png_ptr, "Zero length keyword"); - } - - if (key_len > 79) - { - png_warning(png_ptr, "keyword length must be 1 - 79 characters"); - new_key[79] = '\0'; - key_len = 79; - } - - return (key_len); -} -#endif - -#if defined(PNG_WRITE_tEXt_SUPPORTED) -/* write a tEXt chunk */ -void /* PRIVATE */ -png_write_tEXt(png_structp png_ptr, png_charp key, png_charp text, - png_size_t text_len) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_tEXt; -#endif - png_size_t key_len; - png_charp new_key; - - png_debug(1, "in png_write_tEXt\n"); - if (key == NULL || (key_len = png_check_keyword(png_ptr, key, &new_key))==0) - { - png_warning(png_ptr, "Empty keyword in tEXt chunk"); - return; - } - - if (text == NULL || *text == '\0') - text_len = 0; - else - text_len = png_strlen(text); - - /* make sure we include the 0 after the key */ - png_write_chunk_start(png_ptr, (png_bytep)png_tEXt, (png_uint_32)key_len+text_len+1); - /* - * We leave it to the application to meet PNG-1.0 requirements on the - * contents of the text. PNG-1.0 through PNG-1.2 discourage the use of - * any non-Latin-1 characters except for NEWLINE. ISO PNG will forbid them. - * The NUL character is forbidden by PNG-1.0 through PNG-1.2 and ISO PNG. - */ - png_write_chunk_data(png_ptr, (png_bytep)new_key, key_len + 1); - if (text_len) - png_write_chunk_data(png_ptr, (png_bytep)text, text_len); - - png_write_chunk_end(png_ptr); - png_free(png_ptr, new_key); -} -#endif - -#if defined(PNG_WRITE_zTXt_SUPPORTED) -/* write a compressed text chunk */ -void /* PRIVATE */ -png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text, - png_size_t text_len, int compression) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_zTXt; -#endif - png_size_t key_len; - char buf[1]; - png_charp new_key; - compression_state comp; - - png_debug(1, "in png_write_zTXt\n"); - - comp.num_output_ptr = 0; - comp.max_output_ptr = 0; - comp.output_ptr = NULL; - comp.input = NULL; - comp.input_len = 0; - - if (key == NULL || (key_len = png_check_keyword(png_ptr, key, &new_key))==0) - { - png_warning(png_ptr, "Empty keyword in zTXt chunk"); - return; - } - - if (text == NULL || *text == '\0' || compression==PNG_TEXT_COMPRESSION_NONE) - { - png_write_tEXt(png_ptr, new_key, text, (png_size_t)0); - png_free(png_ptr, new_key); - return; - } - - text_len = png_strlen(text); - - png_free(png_ptr, new_key); - - /* compute the compressed data; do it now for the length */ - text_len = png_text_compress(png_ptr, text, text_len, compression, - &comp); - - /* write start of chunk */ - png_write_chunk_start(png_ptr, (png_bytep)png_zTXt, (png_uint_32) - (key_len+text_len+2)); - /* write key */ - png_write_chunk_data(png_ptr, (png_bytep)key, key_len + 1); - buf[0] = (png_byte)compression; - /* write compression */ - png_write_chunk_data(png_ptr, (png_bytep)buf, (png_size_t)1); - /* write the compressed data */ - png_write_compressed_data_out(png_ptr, &comp); - - /* close the chunk */ - png_write_chunk_end(png_ptr); -} -#endif - -#if defined(PNG_WRITE_iTXt_SUPPORTED) -/* write an iTXt chunk */ -void /* PRIVATE */ -png_write_iTXt(png_structp png_ptr, int compression, png_charp key, - png_charp lang, png_charp lang_key, png_charp text) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_iTXt; -#endif - png_size_t lang_len, key_len, lang_key_len, text_len; - png_charp new_lang, new_key; - png_byte cbuf[2]; - compression_state comp; - - png_debug(1, "in png_write_iTXt\n"); - - comp.num_output_ptr = 0; - comp.max_output_ptr = 0; - comp.output_ptr = NULL; - comp.input = NULL; - - if (key == NULL || (key_len = png_check_keyword(png_ptr, key, &new_key))==0) - { - png_warning(png_ptr, "Empty keyword in iTXt chunk"); - return; - } - if (lang == NULL || (lang_len = png_check_keyword(png_ptr, lang, &new_lang))==0) - { - png_warning(png_ptr, "Empty language field in iTXt chunk"); - new_lang = NULL; - lang_len = 0; - } - - if (lang_key == NULL) - lang_key_len = 0; - else - lang_key_len = png_strlen(lang_key); - - if (text == NULL) - text_len = 0; - else - text_len = png_strlen(text); - - /* compute the compressed data; do it now for the length */ - text_len = png_text_compress(png_ptr, text, text_len, compression-2, - &comp); - - - /* make sure we include the compression flag, the compression byte, - * and the NULs after the key, lang, and lang_key parts */ - - png_write_chunk_start(png_ptr, (png_bytep)png_iTXt, - (png_uint_32)( - 5 /* comp byte, comp flag, terminators for key, lang and lang_key */ - + key_len - + lang_len - + lang_key_len - + text_len)); - - /* - * We leave it to the application to meet PNG-1.0 requirements on the - * contents of the text. PNG-1.0 through PNG-1.2 discourage the use of - * any non-Latin-1 characters except for NEWLINE. ISO PNG will forbid them. - * The NUL character is forbidden by PNG-1.0 through PNG-1.2 and ISO PNG. - */ - png_write_chunk_data(png_ptr, (png_bytep)new_key, key_len + 1); - - /* set the compression flag */ - if (compression == PNG_ITXT_COMPRESSION_NONE || \ - compression == PNG_TEXT_COMPRESSION_NONE) - cbuf[0] = 0; - else /* compression == PNG_ITXT_COMPRESSION_zTXt */ - cbuf[0] = 1; - /* set the compression method */ - cbuf[1] = 0; - png_write_chunk_data(png_ptr, cbuf, 2); - - cbuf[0] = 0; - png_write_chunk_data(png_ptr, (new_lang ? (png_bytep)new_lang : cbuf), lang_len + 1); - png_write_chunk_data(png_ptr, (lang_key ? (png_bytep)lang_key : cbuf), lang_key_len + 1); - png_write_compressed_data_out(png_ptr, &comp); - - png_write_chunk_end(png_ptr); - png_free(png_ptr, new_key); - if (new_lang) - png_free(png_ptr, new_lang); -} -#endif - -#if defined(PNG_WRITE_oFFs_SUPPORTED) -/* write the oFFs chunk */ -void /* PRIVATE */ -png_write_oFFs(png_structp png_ptr, png_int_32 x_offset, png_int_32 y_offset, - int unit_type) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_oFFs; -#endif - png_byte buf[9]; - - png_debug(1, "in png_write_oFFs\n"); - if (unit_type >= PNG_OFFSET_LAST) - png_warning(png_ptr, "Unrecognized unit type for oFFs chunk"); - - png_save_int_32(buf, x_offset); - png_save_int_32(buf + 4, y_offset); - buf[8] = (png_byte)unit_type; - - png_write_chunk(png_ptr, (png_bytep)png_oFFs, buf, (png_size_t)9); -} -#endif - -#if defined(PNG_WRITE_pCAL_SUPPORTED) -/* write the pCAL chunk (described in the PNG extensions document) */ -void /* PRIVATE */ -png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0, - png_int_32 X1, int type, int nparams, png_charp units, png_charpp params) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_pCAL; -#endif - png_size_t purpose_len, units_len, total_len; - png_uint_32p params_len; - png_byte buf[10]; - png_charp new_purpose; - int i; - - png_debug1(1, "in png_write_pCAL (%d parameters)\n", nparams); - if (type >= PNG_EQUATION_LAST) - png_warning(png_ptr, "Unrecognized equation type for pCAL chunk"); - - purpose_len = png_check_keyword(png_ptr, purpose, &new_purpose) + 1; - png_debug1(3, "pCAL purpose length = %d\n", (int)purpose_len); - units_len = png_strlen(units) + (nparams == 0 ? 0 : 1); - png_debug1(3, "pCAL units length = %d\n", (int)units_len); - total_len = purpose_len + units_len + 10; - - params_len = (png_uint_32p)png_malloc(png_ptr, (png_uint_32)(nparams - *png_sizeof(png_uint_32))); - - /* Find the length of each parameter, making sure we don't count the - null terminator for the last parameter. */ - for (i = 0; i < nparams; i++) - { - params_len[i] = png_strlen(params[i]) + (i == nparams - 1 ? 0 : 1); - png_debug2(3, "pCAL parameter %d length = %lu\n", i, params_len[i]); - total_len += (png_size_t)params_len[i]; - } - - png_debug1(3, "pCAL total length = %d\n", (int)total_len); - png_write_chunk_start(png_ptr, (png_bytep)png_pCAL, (png_uint_32)total_len); - png_write_chunk_data(png_ptr, (png_bytep)new_purpose, purpose_len); - png_save_int_32(buf, X0); - png_save_int_32(buf + 4, X1); - buf[8] = (png_byte)type; - buf[9] = (png_byte)nparams; - png_write_chunk_data(png_ptr, buf, (png_size_t)10); - png_write_chunk_data(png_ptr, (png_bytep)units, (png_size_t)units_len); - - png_free(png_ptr, new_purpose); - - for (i = 0; i < nparams; i++) - { - png_write_chunk_data(png_ptr, (png_bytep)params[i], - (png_size_t)params_len[i]); - } - - png_free(png_ptr, params_len); - png_write_chunk_end(png_ptr); -} -#endif - -#if defined(PNG_WRITE_sCAL_SUPPORTED) -/* write the sCAL chunk */ -#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO) -void /* PRIVATE */ -png_write_sCAL(png_structp png_ptr, int unit, double width, double height) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_sCAL; -#endif - char buf[64]; - png_size_t total_len; - - png_debug(1, "in png_write_sCAL\n"); - - buf[0] = (char)unit; -#if defined(_WIN32_WCE) -/* sprintf() function is not supported on WindowsCE */ - { - wchar_t wc_buf[32]; - size_t wc_len; - swprintf(wc_buf, TEXT("%12.12e"), width); - wc_len = wcslen(wc_buf); - WideCharToMultiByte(CP_ACP, 0, wc_buf, -1, buf + 1, wc_len, NULL, NULL); - total_len = wc_len + 2; - swprintf(wc_buf, TEXT("%12.12e"), height); - wc_len = wcslen(wc_buf); - WideCharToMultiByte(CP_ACP, 0, wc_buf, -1, buf + total_len, wc_len, - NULL, NULL); - total_len += wc_len; - } -#else - sprintf(buf + 1, "%12.12e", width); - total_len = 1 + png_strlen(buf + 1) + 1; - sprintf(buf + total_len, "%12.12e", height); - total_len += png_strlen(buf + total_len); -#endif - - png_debug1(3, "sCAL total length = %u\n", (unsigned int)total_len); - png_write_chunk(png_ptr, (png_bytep)png_sCAL, (png_bytep)buf, total_len); -} -#else -#ifdef PNG_FIXED_POINT_SUPPORTED -void /* PRIVATE */ -png_write_sCAL_s(png_structp png_ptr, int unit, png_charp width, - png_charp height) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_sCAL; -#endif - png_byte buf[64]; - png_size_t wlen, hlen, total_len; - - png_debug(1, "in png_write_sCAL_s\n"); - - wlen = png_strlen(width); - hlen = png_strlen(height); - total_len = wlen + hlen + 2; - if (total_len > 64) - { - png_warning(png_ptr, "Can't write sCAL (buffer too small)"); - return; - } - - buf[0] = (png_byte)unit; - png_memcpy(buf + 1, width, wlen + 1); /* append the '\0' here */ - png_memcpy(buf + wlen + 2, height, hlen); /* do NOT append the '\0' here */ - - png_debug1(3, "sCAL total length = %u\n", (unsigned int)total_len); - png_write_chunk(png_ptr, (png_bytep)png_sCAL, buf, total_len); -} -#endif -#endif -#endif - -#if defined(PNG_WRITE_pHYs_SUPPORTED) -/* write the pHYs chunk */ -void /* PRIVATE */ -png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit, - png_uint_32 y_pixels_per_unit, - int unit_type) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_pHYs; -#endif - png_byte buf[9]; - - png_debug(1, "in png_write_pHYs\n"); - if (unit_type >= PNG_RESOLUTION_LAST) - png_warning(png_ptr, "Unrecognized unit type for pHYs chunk"); - - png_save_uint_32(buf, x_pixels_per_unit); - png_save_uint_32(buf + 4, y_pixels_per_unit); - buf[8] = (png_byte)unit_type; - - png_write_chunk(png_ptr, (png_bytep)png_pHYs, buf, (png_size_t)9); -} -#endif - -#if defined(PNG_WRITE_tIME_SUPPORTED) -/* Write the tIME chunk. Use either png_convert_from_struct_tm() - * or png_convert_from_time_t(), or fill in the structure yourself. - */ -void /* PRIVATE */ -png_write_tIME(png_structp png_ptr, png_timep mod_time) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - PNG_tIME; -#endif - png_byte buf[7]; - - png_debug(1, "in png_write_tIME\n"); - if (mod_time->month > 12 || mod_time->month < 1 || - mod_time->day > 31 || mod_time->day < 1 || - mod_time->hour > 23 || mod_time->second > 60) - { - png_warning(png_ptr, "Invalid time specified for tIME chunk"); - return; - } - - png_save_uint_16(buf, mod_time->year); - buf[2] = mod_time->month; - buf[3] = mod_time->day; - buf[4] = mod_time->hour; - buf[5] = mod_time->minute; - buf[6] = mod_time->second; - - png_write_chunk(png_ptr, (png_bytep)png_tIME, buf, (png_size_t)7); -} -#endif - -/* initializes the row writing capability of libpng */ -void /* PRIVATE */ -png_write_start_row(png_structp png_ptr) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ - - /* start of interlace block */ - int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; - - /* offset to next interlace block */ - int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; - - /* start of interlace block in the y direction */ - int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; - - /* offset to next interlace block in the y direction */ - int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; -#endif - - png_size_t buf_size; - - png_debug(1, "in png_write_start_row\n"); - buf_size = (png_size_t)(PNG_ROWBYTES( - png_ptr->usr_channels*png_ptr->usr_bit_depth,png_ptr->width)+1); - - /* set up row buffer */ - png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, (png_uint_32)buf_size); - png_ptr->row_buf[0] = PNG_FILTER_VALUE_NONE; - - /* set up filtering buffer, if using this filter */ - if (png_ptr->do_filter & PNG_FILTER_SUB) - { - png_ptr->sub_row = (png_bytep)png_malloc(png_ptr, - (png_ptr->rowbytes + 1)); - png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB; - } - - /* We only need to keep the previous row if we are using one of these. */ - if (png_ptr->do_filter & (PNG_FILTER_AVG | PNG_FILTER_UP | PNG_FILTER_PAETH)) - { - /* set up previous row buffer */ - png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)buf_size); - png_memset(png_ptr->prev_row, 0, buf_size); - - if (png_ptr->do_filter & PNG_FILTER_UP) - { - png_ptr->up_row = (png_bytep )png_malloc(png_ptr, - (png_ptr->rowbytes + 1)); - png_ptr->up_row[0] = PNG_FILTER_VALUE_UP; - } - - if (png_ptr->do_filter & PNG_FILTER_AVG) - { - png_ptr->avg_row = (png_bytep)png_malloc(png_ptr, - (png_ptr->rowbytes + 1)); - png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG; - } - - if (png_ptr->do_filter & PNG_FILTER_PAETH) - { - png_ptr->paeth_row = (png_bytep )png_malloc(png_ptr, - (png_ptr->rowbytes + 1)); - png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH; - } - } - -#ifdef PNG_WRITE_INTERLACING_SUPPORTED - /* if interlaced, we need to set up width and height of pass */ - if (png_ptr->interlaced) - { - if (!(png_ptr->transformations & PNG_INTERLACE)) - { - png_ptr->num_rows = (png_ptr->height + png_pass_yinc[0] - 1 - - png_pass_ystart[0]) / png_pass_yinc[0]; - png_ptr->usr_width = (png_ptr->width + png_pass_inc[0] - 1 - - png_pass_start[0]) / png_pass_inc[0]; - } - else - { - png_ptr->num_rows = png_ptr->height; - png_ptr->usr_width = png_ptr->width; - } - } - else -#endif - { - png_ptr->num_rows = png_ptr->height; - png_ptr->usr_width = png_ptr->width; - } - png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; - png_ptr->zstream.next_out = png_ptr->zbuf; -} - -/* Internal use only. Called when finished processing a row of data. */ -void /* PRIVATE */ -png_write_finish_row(png_structp png_ptr) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ - - /* start of interlace block */ - int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; - - /* offset to next interlace block */ - int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; - - /* start of interlace block in the y direction */ - int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; - - /* offset to next interlace block in the y direction */ - int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; -#endif - - int ret; - - png_debug(1, "in png_write_finish_row\n"); - /* next row */ - png_ptr->row_number++; - - /* see if we are done */ - if (png_ptr->row_number < png_ptr->num_rows) - return; - -#ifdef PNG_WRITE_INTERLACING_SUPPORTED - /* if interlaced, go to next pass */ - if (png_ptr->interlaced) - { - png_ptr->row_number = 0; - if (png_ptr->transformations & PNG_INTERLACE) - { - png_ptr->pass++; - } - else - { - /* loop until we find a non-zero width or height pass */ - do - { - png_ptr->pass++; - if (png_ptr->pass >= 7) - break; - png_ptr->usr_width = (png_ptr->width + - png_pass_inc[png_ptr->pass] - 1 - - png_pass_start[png_ptr->pass]) / - png_pass_inc[png_ptr->pass]; - png_ptr->num_rows = (png_ptr->height + - png_pass_yinc[png_ptr->pass] - 1 - - png_pass_ystart[png_ptr->pass]) / - png_pass_yinc[png_ptr->pass]; - if (png_ptr->transformations & PNG_INTERLACE) - break; - } while (png_ptr->usr_width == 0 || png_ptr->num_rows == 0); - - } - - /* reset the row above the image for the next pass */ - if (png_ptr->pass < 7) - { - if (png_ptr->prev_row != NULL) - png_memset(png_ptr->prev_row, 0, - (png_size_t)(PNG_ROWBYTES(png_ptr->usr_channels* - png_ptr->usr_bit_depth,png_ptr->width))+1); - return; - } - } -#endif - - /* if we get here, we've just written the last row, so we need - to flush the compressor */ - do - { - /* tell the compressor we are done */ - ret = deflate(&png_ptr->zstream, Z_FINISH); - /* check for an error */ - if (ret == Z_OK) - { - /* check to see if we need more room */ - if (!(png_ptr->zstream.avail_out)) - { - png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size); - png_ptr->zstream.next_out = png_ptr->zbuf; - png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; - } - } - else if (ret != Z_STREAM_END) - { - if (png_ptr->zstream.msg != NULL) - png_error(png_ptr, png_ptr->zstream.msg); - else - png_error(png_ptr, "zlib error"); - } - } while (ret != Z_STREAM_END); - - /* write any extra space */ - if (png_ptr->zstream.avail_out < png_ptr->zbuf_size) - { - png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size - - png_ptr->zstream.avail_out); - } - - deflateReset(&png_ptr->zstream); - png_ptr->zstream.data_type = Z_BINARY; -} - -#if defined(PNG_WRITE_INTERLACING_SUPPORTED) -/* Pick out the correct pixels for the interlace pass. - * The basic idea here is to go through the row with a source - * pointer and a destination pointer (sp and dp), and copy the - * correct pixels for the pass. As the row gets compacted, - * sp will always be >= dp, so we should never overwrite anything. - * See the default: case for the easiest code to understand. - */ -void /* PRIVATE */ -png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass) -{ -#ifdef PNG_USE_LOCAL_ARRAYS - /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ - - /* start of interlace block */ - int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; - - /* offset to next interlace block */ - int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; -#endif - - png_debug(1, "in png_do_write_interlace\n"); - /* we don't have to do anything on the last pass (6) */ -#if defined(PNG_USELESS_TESTS_SUPPORTED) - if (row != NULL && row_info != NULL && pass < 6) -#else - if (pass < 6) -#endif - { - /* each pixel depth is handled separately */ - switch (row_info->pixel_depth) - { - case 1: - { - png_bytep sp; - png_bytep dp; - int shift; - int d; - int value; - png_uint_32 i; - png_uint_32 row_width = row_info->width; - - dp = row; - d = 0; - shift = 7; - for (i = png_pass_start[pass]; i < row_width; - i += png_pass_inc[pass]) - { - sp = row + (png_size_t)(i >> 3); - value = (int)(*sp >> (7 - (int)(i & 0x07))) & 0x01; - d |= (value << shift); - - if (shift == 0) - { - shift = 7; - *dp++ = (png_byte)d; - d = 0; - } - else - shift--; - - } - if (shift != 7) - *dp = (png_byte)d; - break; - } - case 2: - { - png_bytep sp; - png_bytep dp; - int shift; - int d; - int value; - png_uint_32 i; - png_uint_32 row_width = row_info->width; - - dp = row; - shift = 6; - d = 0; - for (i = png_pass_start[pass]; i < row_width; - i += png_pass_inc[pass]) - { - sp = row + (png_size_t)(i >> 2); - value = (*sp >> ((3 - (int)(i & 0x03)) << 1)) & 0x03; - d |= (value << shift); - - if (shift == 0) - { - shift = 6; - *dp++ = (png_byte)d; - d = 0; - } - else - shift -= 2; - } - if (shift != 6) - *dp = (png_byte)d; - break; - } - case 4: - { - png_bytep sp; - png_bytep dp; - int shift; - int d; - int value; - png_uint_32 i; - png_uint_32 row_width = row_info->width; - - dp = row; - shift = 4; - d = 0; - for (i = png_pass_start[pass]; i < row_width; - i += png_pass_inc[pass]) - { - sp = row + (png_size_t)(i >> 1); - value = (*sp >> ((1 - (int)(i & 0x01)) << 2)) & 0x0f; - d |= (value << shift); - - if (shift == 0) - { - shift = 4; - *dp++ = (png_byte)d; - d = 0; - } - else - shift -= 4; - } - if (shift != 4) - *dp = (png_byte)d; - break; - } - default: - { - png_bytep sp; - png_bytep dp; - png_uint_32 i; - png_uint_32 row_width = row_info->width; - png_size_t pixel_bytes; - - /* start at the beginning */ - dp = row; - /* find out how many bytes each pixel takes up */ - pixel_bytes = (row_info->pixel_depth >> 3); - /* loop through the row, only looking at the pixels that - matter */ - for (i = png_pass_start[pass]; i < row_width; - i += png_pass_inc[pass]) - { - /* find out where the original pixel is */ - sp = row + (png_size_t)i * pixel_bytes; - /* move the pixel */ - if (dp != sp) - png_memcpy(dp, sp, pixel_bytes); - /* next pixel */ - dp += pixel_bytes; - } - break; - } - } - /* set new row width */ - row_info->width = (row_info->width + - png_pass_inc[pass] - 1 - - png_pass_start[pass]) / - png_pass_inc[pass]; - row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, - row_info->width); - } -} -#endif - -/* This filters the row, chooses which filter to use, if it has not already - * been specified by the application, and then writes the row out with the - * chosen filter. - */ -#define PNG_MAXSUM (((png_uint_32)(-1)) >> 1) -#define PNG_HISHIFT 10 -#define PNG_LOMASK ((png_uint_32)0xffffL) -#define PNG_HIMASK ((png_uint_32)(~PNG_LOMASK >> PNG_HISHIFT)) -void /* PRIVATE */ -png_write_find_filter(png_structp png_ptr, png_row_infop row_info) -{ - png_bytep prev_row, best_row, row_buf; - png_uint_32 mins, bpp; - png_byte filter_to_do = png_ptr->do_filter; - png_uint_32 row_bytes = row_info->rowbytes; -#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) - int num_p_filters = (int)png_ptr->num_prev_filters; -#endif - - png_debug(1, "in png_write_find_filter\n"); - /* find out how many bytes offset each pixel is */ - bpp = (row_info->pixel_depth + 7) >> 3; - - prev_row = png_ptr->prev_row; - best_row = row_buf = png_ptr->row_buf; - mins = PNG_MAXSUM; - - /* The prediction method we use is to find which method provides the - * smallest value when summing the absolute values of the distances - * from zero, using anything >= 128 as negative numbers. This is known - * as the "minimum sum of absolute differences" heuristic. Other - * heuristics are the "weighted minimum sum of absolute differences" - * (experimental and can in theory improve compression), and the "zlib - * predictive" method (not implemented yet), which does test compressions - * of lines using different filter methods, and then chooses the - * (series of) filter(s) that give minimum compressed data size (VERY - * computationally expensive). - * - * GRR 980525: consider also - * (1) minimum sum of absolute differences from running average (i.e., - * keep running sum of non-absolute differences & count of bytes) - * [track dispersion, too? restart average if dispersion too large?] - * (1b) minimum sum of absolute differences from sliding average, probably - * with window size <= deflate window (usually 32K) - * (2) minimum sum of squared differences from zero or running average - * (i.e., ~ root-mean-square approach) - */ - - - /* We don't need to test the 'no filter' case if this is the only filter - * that has been chosen, as it doesn't actually do anything to the data. - */ - if ((filter_to_do & PNG_FILTER_NONE) && - filter_to_do != PNG_FILTER_NONE) - { - png_bytep rp; - png_uint_32 sum = 0; - png_uint_32 i; - int v; - - for (i = 0, rp = row_buf + 1; i < row_bytes; i++, rp++) - { - v = *rp; - sum += (v < 128) ? v : 256 - v; - } - -#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) - if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) - { - png_uint_32 sumhi, sumlo; - int j; - sumlo = sum & PNG_LOMASK; - sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; /* Gives us some footroom */ - - /* Reduce the sum if we match any of the previous rows */ - for (j = 0; j < num_p_filters; j++) - { - if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_NONE) - { - sumlo = (sumlo * png_ptr->filter_weights[j]) >> - PNG_WEIGHT_SHIFT; - sumhi = (sumhi * png_ptr->filter_weights[j]) >> - PNG_WEIGHT_SHIFT; - } - } - - /* Factor in the cost of this filter (this is here for completeness, - * but it makes no sense to have a "cost" for the NONE filter, as - * it has the minimum possible computational cost - none). - */ - sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_NONE]) >> - PNG_COST_SHIFT; - sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_NONE]) >> - PNG_COST_SHIFT; - - if (sumhi > PNG_HIMASK) - sum = PNG_MAXSUM; - else - sum = (sumhi << PNG_HISHIFT) + sumlo; - } -#endif - mins = sum; - } - - /* sub filter */ - if (filter_to_do == PNG_FILTER_SUB) - /* it's the only filter so no testing is needed */ - { - png_bytep rp, lp, dp; - png_uint_32 i; - for (i = 0, rp = row_buf + 1, dp = png_ptr->sub_row + 1; i < bpp; - i++, rp++, dp++) - { - *dp = *rp; - } - for (lp = row_buf + 1; i < row_bytes; - i++, rp++, lp++, dp++) - { - *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff); - } - best_row = png_ptr->sub_row; - } - - else if (filter_to_do & PNG_FILTER_SUB) - { - png_bytep rp, dp, lp; - png_uint_32 sum = 0, lmins = mins; - png_uint_32 i; - int v; - -#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) - /* We temporarily increase the "minimum sum" by the factor we - * would reduce the sum of this filter, so that we can do the - * early exit comparison without scaling the sum each time. - */ - if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) - { - int j; - png_uint_32 lmhi, lmlo; - lmlo = lmins & PNG_LOMASK; - lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK; - - for (j = 0; j < num_p_filters; j++) - { - if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_SUB) - { - lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >> - PNG_WEIGHT_SHIFT; - lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >> - PNG_WEIGHT_SHIFT; - } - } - - lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >> - PNG_COST_SHIFT; - lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >> - PNG_COST_SHIFT; - - if (lmhi > PNG_HIMASK) - lmins = PNG_MAXSUM; - else - lmins = (lmhi << PNG_HISHIFT) + lmlo; - } -#endif - - for (i = 0, rp = row_buf + 1, dp = png_ptr->sub_row + 1; i < bpp; - i++, rp++, dp++) - { - v = *dp = *rp; - - sum += (v < 128) ? v : 256 - v; - } - for (lp = row_buf + 1; i < row_bytes; - i++, rp++, lp++, dp++) - { - v = *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff); - - sum += (v < 128) ? v : 256 - v; - - if (sum > lmins) /* We are already worse, don't continue. */ - break; - } - -#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) - if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) - { - int j; - png_uint_32 sumhi, sumlo; - sumlo = sum & PNG_LOMASK; - sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; - - for (j = 0; j < num_p_filters; j++) - { - if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_SUB) - { - sumlo = (sumlo * png_ptr->inv_filter_weights[j]) >> - PNG_WEIGHT_SHIFT; - sumhi = (sumhi * png_ptr->inv_filter_weights[j]) >> - PNG_WEIGHT_SHIFT; - } - } - - sumlo = (sumlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >> - PNG_COST_SHIFT; - sumhi = (sumhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >> - PNG_COST_SHIFT; - - if (sumhi > PNG_HIMASK) - sum = PNG_MAXSUM; - else - sum = (sumhi << PNG_HISHIFT) + sumlo; - } -#endif - - if (sum < mins) - { - mins = sum; - best_row = png_ptr->sub_row; - } - } - - /* up filter */ - if (filter_to_do == PNG_FILTER_UP) - { - png_bytep rp, dp, pp; - png_uint_32 i; - - for (i = 0, rp = row_buf + 1, dp = png_ptr->up_row + 1, - pp = prev_row + 1; i < row_bytes; - i++, rp++, pp++, dp++) - { - *dp = (png_byte)(((int)*rp - (int)*pp) & 0xff); - } - best_row = png_ptr->up_row; - } - - else if (filter_to_do & PNG_FILTER_UP) - { - png_bytep rp, dp, pp; - png_uint_32 sum = 0, lmins = mins; - png_uint_32 i; - int v; - - -#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) - if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) - { - int j; - png_uint_32 lmhi, lmlo; - lmlo = lmins & PNG_LOMASK; - lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK; - - for (j = 0; j < num_p_filters; j++) - { - if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_UP) - { - lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >> - PNG_WEIGHT_SHIFT; - lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >> - PNG_WEIGHT_SHIFT; - } - } - - lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_UP]) >> - PNG_COST_SHIFT; - lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_UP]) >> - PNG_COST_SHIFT; - - if (lmhi > PNG_HIMASK) - lmins = PNG_MAXSUM; - else - lmins = (lmhi << PNG_HISHIFT) + lmlo; - } -#endif - - for (i = 0, rp = row_buf + 1, dp = png_ptr->up_row + 1, - pp = prev_row + 1; i < row_bytes; i++) - { - v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff); - - sum += (v < 128) ? v : 256 - v; - - if (sum > lmins) /* We are already worse, don't continue. */ - break; - } - -#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) - if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) - { - int j; - png_uint_32 sumhi, sumlo; - sumlo = sum & PNG_LOMASK; - sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; - - for (j = 0; j < num_p_filters; j++) - { - if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_UP) - { - sumlo = (sumlo * png_ptr->filter_weights[j]) >> - PNG_WEIGHT_SHIFT; - sumhi = (sumhi * png_ptr->filter_weights[j]) >> - PNG_WEIGHT_SHIFT; - } - } - - sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_UP]) >> - PNG_COST_SHIFT; - sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_UP]) >> - PNG_COST_SHIFT; - - if (sumhi > PNG_HIMASK) - sum = PNG_MAXSUM; - else - sum = (sumhi << PNG_HISHIFT) + sumlo; - } -#endif - - if (sum < mins) - { - mins = sum; - best_row = png_ptr->up_row; - } - } - - /* avg filter */ - if (filter_to_do == PNG_FILTER_AVG) - { - png_bytep rp, dp, pp, lp; - png_uint_32 i; - for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1, - pp = prev_row + 1; i < bpp; i++) - { - *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff); - } - for (lp = row_buf + 1; i < row_bytes; i++) - { - *dp++ = (png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2)) - & 0xff); - } - best_row = png_ptr->avg_row; - } - - else if (filter_to_do & PNG_FILTER_AVG) - { - png_bytep rp, dp, pp, lp; - png_uint_32 sum = 0, lmins = mins; - png_uint_32 i; - int v; - -#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) - if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) - { - int j; - png_uint_32 lmhi, lmlo; - lmlo = lmins & PNG_LOMASK; - lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK; - - for (j = 0; j < num_p_filters; j++) - { - if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_AVG) - { - lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >> - PNG_WEIGHT_SHIFT; - lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >> - PNG_WEIGHT_SHIFT; - } - } - - lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_AVG]) >> - PNG_COST_SHIFT; - lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_AVG]) >> - PNG_COST_SHIFT; - - if (lmhi > PNG_HIMASK) - lmins = PNG_MAXSUM; - else - lmins = (lmhi << PNG_HISHIFT) + lmlo; - } -#endif - - for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1, - pp = prev_row + 1; i < bpp; i++) - { - v = *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff); - - sum += (v < 128) ? v : 256 - v; - } - for (lp = row_buf + 1; i < row_bytes; i++) - { - v = *dp++ = - (png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2)) & 0xff); - - sum += (v < 128) ? v : 256 - v; - - if (sum > lmins) /* We are already worse, don't continue. */ - break; - } - -#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) - if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) - { - int j; - png_uint_32 sumhi, sumlo; - sumlo = sum & PNG_LOMASK; - sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; - - for (j = 0; j < num_p_filters; j++) - { - if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_NONE) - { - sumlo = (sumlo * png_ptr->filter_weights[j]) >> - PNG_WEIGHT_SHIFT; - sumhi = (sumhi * png_ptr->filter_weights[j]) >> - PNG_WEIGHT_SHIFT; - } - } - - sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_AVG]) >> - PNG_COST_SHIFT; - sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_AVG]) >> - PNG_COST_SHIFT; - - if (sumhi > PNG_HIMASK) - sum = PNG_MAXSUM; - else - sum = (sumhi << PNG_HISHIFT) + sumlo; - } -#endif - - if (sum < mins) - { - mins = sum; - best_row = png_ptr->avg_row; - } - } - - /* Paeth filter */ - if (filter_to_do == PNG_FILTER_PAETH) - { - png_bytep rp, dp, pp, cp, lp; - png_uint_32 i; - for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1, - pp = prev_row + 1; i < bpp; i++) - { - *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff); - } - - for (lp = row_buf + 1, cp = prev_row + 1; i < row_bytes; i++) - { - int a, b, c, pa, pb, pc, p; - - b = *pp++; - c = *cp++; - a = *lp++; - - p = b - c; - pc = a - c; - -#ifdef PNG_USE_ABS - pa = abs(p); - pb = abs(pc); - pc = abs(p + pc); -#else - pa = p < 0 ? -p : p; - pb = pc < 0 ? -pc : pc; - pc = (p + pc) < 0 ? -(p + pc) : p + pc; -#endif - - p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c; - - *dp++ = (png_byte)(((int)*rp++ - p) & 0xff); - } - best_row = png_ptr->paeth_row; - } - - else if (filter_to_do & PNG_FILTER_PAETH) - { - png_bytep rp, dp, pp, cp, lp; - png_uint_32 sum = 0, lmins = mins; - png_uint_32 i; - int v; - -#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) - if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) - { - int j; - png_uint_32 lmhi, lmlo; - lmlo = lmins & PNG_LOMASK; - lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK; - - for (j = 0; j < num_p_filters; j++) - { - if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_PAETH) - { - lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >> - PNG_WEIGHT_SHIFT; - lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >> - PNG_WEIGHT_SHIFT; - } - } - - lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_PAETH]) >> - PNG_COST_SHIFT; - lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_PAETH]) >> - PNG_COST_SHIFT; - - if (lmhi > PNG_HIMASK) - lmins = PNG_MAXSUM; - else - lmins = (lmhi << PNG_HISHIFT) + lmlo; - } -#endif - - for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1, - pp = prev_row + 1; i < bpp; i++) - { - v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff); - - sum += (v < 128) ? v : 256 - v; - } - - for (lp = row_buf + 1, cp = prev_row + 1; i < row_bytes; i++) - { - int a, b, c, pa, pb, pc, p; - - b = *pp++; - c = *cp++; - a = *lp++; - -#ifndef PNG_SLOW_PAETH - p = b - c; - pc = a - c; -#ifdef PNG_USE_ABS - pa = abs(p); - pb = abs(pc); - pc = abs(p + pc); -#else - pa = p < 0 ? -p : p; - pb = pc < 0 ? -pc : pc; - pc = (p + pc) < 0 ? -(p + pc) : p + pc; -#endif - p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c; -#else /* PNG_SLOW_PAETH */ - p = a + b - c; - pa = abs(p - a); - pb = abs(p - b); - pc = abs(p - c); - if (pa <= pb && pa <= pc) - p = a; - else if (pb <= pc) - p = b; - else - p = c; -#endif /* PNG_SLOW_PAETH */ - - v = *dp++ = (png_byte)(((int)*rp++ - p) & 0xff); - - sum += (v < 128) ? v : 256 - v; - - if (sum > lmins) /* We are already worse, don't continue. */ - break; - } - -#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) - if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED) - { - int j; - png_uint_32 sumhi, sumlo; - sumlo = sum & PNG_LOMASK; - sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; - - for (j = 0; j < num_p_filters; j++) - { - if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_PAETH) - { - sumlo = (sumlo * png_ptr->filter_weights[j]) >> - PNG_WEIGHT_SHIFT; - sumhi = (sumhi * png_ptr->filter_weights[j]) >> - PNG_WEIGHT_SHIFT; - } - } - - sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_PAETH]) >> - PNG_COST_SHIFT; - sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_PAETH]) >> - PNG_COST_SHIFT; - - if (sumhi > PNG_HIMASK) - sum = PNG_MAXSUM; - else - sum = (sumhi << PNG_HISHIFT) + sumlo; - } -#endif - - if (sum < mins) - { - best_row = png_ptr->paeth_row; - } - } - - /* Do the actual writing of the filtered row data from the chosen filter. */ - - png_write_filtered_row(png_ptr, best_row); - -#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) - /* Save the type of filter we picked this time for future calculations */ - if (png_ptr->num_prev_filters > 0) - { - int j; - for (j = 1; j < num_p_filters; j++) - { - png_ptr->prev_filters[j] = png_ptr->prev_filters[j - 1]; - } - png_ptr->prev_filters[j] = best_row[0]; - } -#endif -} - - /* Do the actual writing of a previously filtered row. */ void /* PRIVATE */ png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row) diff --git a/src/dep/src/irrlicht/libpng/projects/visualc71/libpng.vcproj b/src/dep/src/irrlicht/libpng/projects/visualc71/libpng.vcproj index 19c631f..794e289 100644 --- a/src/dep/src/irrlicht/libpng/projects/visualc71/libpng.vcproj +++ b/src/dep/src/irrlicht/libpng/projects/visualc71/libpng.vcproj @@ -18,7 +18,7 @@ Name="VCCLCompilerTool" InlineFunctionExpansion="1" AdditionalIncludeDirectories="..\..;..\..\..\zlib" - PreprocessorDefinitions="WIN32;NDEBUG;PNG_BUILD_DLL;ZLIB_DLL" + PreprocessorDefinitions="WIN32;PNG_NO_MMX_CODE;NDEBUG;PNG_BUILD_DLL;ZLIB_DLL;_CRT_SECURE_NO_WARNINGS" StringPooling="TRUE" RuntimeLibrary="2" EnableFunctionLevelLinking="TRUE" @@ -43,7 +43,7 @@ Name="VCPreLinkEventTool"/> - - - - - - - - - - - - - - - - - libpng.def # lib /def:libpng.def /machine:x86 + diff --git a/src/dep/src/irrlicht/libpng/scripts/libpng-config-head.in b/src/dep/src/irrlicht/libpng/scripts/libpng-config-head.in index 03a92e9..a517bd4 100644 --- a/src/dep/src/irrlicht/libpng/scripts/libpng-config-head.in +++ b/src/dep/src/irrlicht/libpng/scripts/libpng-config-head.in @@ -8,7 +8,7 @@ # Modeled after libxml-config. -version=1.2.18 +version=1.2.32 prefix="" libdir="" libs="" diff --git a/src/dep/src/irrlicht/libpng/scripts/libpng-config.in b/src/dep/src/irrlicht/libpng/scripts/libpng-config.in index 6ef907b..29af77c 100644 --- a/src/dep/src/irrlicht/libpng/scripts/libpng-config.in +++ b/src/dep/src/irrlicht/libpng/scripts/libpng-config.in @@ -14,7 +14,7 @@ exec_prefix="@exec_prefix@" libdir="@libdir@" includedir="@includedir@/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@" libs="-lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@" -all_libs="-lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ -lz -lm" +all_libs="-lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ @LIBS@" I_opts="-I${includedir}" L_opts="-L${libdir}" R_opts="" diff --git a/src/dep/src/irrlicht/libpng/scripts/libpng.pc-configure.in b/src/dep/src/irrlicht/libpng/scripts/libpng.pc-configure.in index 9b5c546..a8cd10a 100644 --- a/src/dep/src/irrlicht/libpng/scripts/libpng.pc-configure.in +++ b/src/dep/src/irrlicht/libpng/scripts/libpng.pc-configure.in @@ -1,10 +1,11 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ -includedir=@includedir@/libpng12 +includedir=@includedir@/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ Name: libpng Description: Loads and saves PNG files -Version: 1.2.18 -Libs: -L${libdir} -lpng12 +Version: @PNGLIB_VERSION@ +Libs: -L${libdir} -lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ +Libs.private: @LIBS@ Cflags: -I${includedir} @LIBPNG_NO_MMX@ diff --git a/src/dep/src/irrlicht/libpng/scripts/libpng.pc.in b/src/dep/src/irrlicht/libpng/scripts/libpng.pc.in index 494b0fd..9508c8c 100644 --- a/src/dep/src/irrlicht/libpng/scripts/libpng.pc.in +++ b/src/dep/src/irrlicht/libpng/scripts/libpng.pc.in @@ -5,6 +5,6 @@ includedir=@includedir@/libpng12 Name: libpng Description: Loads and saves PNG files -Version: 1.2.18 +Version: 1.2.32 Libs: -L${libdir} -lpng12 Cflags: -I${includedir} diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.32sunu b/src/dep/src/irrlicht/libpng/scripts/makefile.32sunu index 27a2b9a..4686dd5 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.32sunu +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.32sunu @@ -8,7 +8,7 @@ # Library name: LIBNAME=libpng12 PNGMAJ = 0 -PNGMIN = 1.2.18 +PNGMIN = 1.2.32 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: @@ -88,7 +88,11 @@ libpng.a: $(OBJS) $(RANLIB) $@ libpng.pc: - cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc + cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ + -e s!@exec_prefix@!$(exec_prefix)! \ + -e s!@libdir@!$(LIBPATH)! \ + -e s!@includedir@!$(INCPATH)! \ + -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc libpng-config: ( cat scripts/libpng-config-head.in; \ diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.64sunu b/src/dep/src/irrlicht/libpng/scripts/makefile.64sunu index 1bd0c50..b5b4731 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.64sunu +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.64sunu @@ -8,7 +8,7 @@ # Library name: LIBNAME=libpng12 PNGMAJ = 0 -PNGMIN = 1.2.18 +PNGMIN = 1.2.32 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: @@ -88,7 +88,11 @@ libpng.a: $(OBJS) $(RANLIB) $@ libpng.pc: - cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc + cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ + -e s!@exec_prefix@!$(exec_prefix)! \ + -e s!@libdir@!$(LIBPATH)! \ + -e s!@includedir@!$(INCPATH)! \ + -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc libpng-config: ( cat scripts/libpng-config-head.in; \ diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.aix b/src/dep/src/irrlicht/libpng/scripts/makefile.aix index a172f59..855b95b 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.aix +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.aix @@ -1,5 +1,5 @@ # makefile for libpng using gcc (generic, static library) -# Copyright (C) 2002, 2006 Glenn Randers-Pehrson +# Copyright (C) 2002, 2006, 2008 Glenn Randers-Pehrson # Copyright (C) 2000 Cosmin Truta # Copyright (C) 2000 Marc O. Gloor (AIX support added, from makefile.gcc) # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. @@ -20,7 +20,7 @@ LN_SF = ln -f -s LIBNAME=libpng12 PNGMAJ = 0 -PNGMIN = 1.2.18 +PNGMIN = 1.2.32 PNGVER = $(PNGMAJ).$(PNGMIN) prefix=/usr/local @@ -44,7 +44,7 @@ CDEBUG = -g -DPNG_DEBUG=5 LDDEBUG = CRELEASE = -O2 LDRELEASE = -s -WARNMORE=-Wall +WARNMORE=-W -Wall CFLAGS = -I$(ZLIBINC) $(WARNMORE) $(CRELEASE) LDFLAGS = -L. -L$(ZLIBLIB) -lpng12 -lz -lm $(LDRELEASE) diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.beos b/src/dep/src/irrlicht/libpng/scripts/makefile.beos index 4300681..1c0220a 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.beos +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.beos @@ -1,6 +1,6 @@ # makefile for libpng on BeOS x86 ELF with gcc # modified from makefile.linux by Sander Stoks -# Copyright (C) 2002, 2006 Glenn Randers-Pehrson +# Copyright (C) 2002, 2006, 2008 Glenn Randers-Pehrson # Copyright (C) 1999 Greg Roelofs # Copyright (C) 1996, 1997 Andreas Dilger # For conditions of distribution and use, see copyright notice in png.h @@ -8,7 +8,7 @@ # Library name: LIBNAME=libpng12 PNGMAJ = 0 -PNGMIN = 1.2.18 +PNGMIN = 1.2.32 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: @@ -41,7 +41,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ # On BeOS, -O1 is actually better than -O3. This is a known bug but it's # still here in R4.5 -CFLAGS=-I$(ZLIBINC) -Wall -O1 -funroll-loops \ +CFLAGS=-I$(ZLIBINC) -W -Wall -O1 -funroll-loops \ $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5 # LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz LDFLAGS=-L. -Wl,-soname=$(LIBSOMAJ) -L$(ZLIBLIB) -lz @@ -84,7 +84,11 @@ libpng.a: $(OBJS) $(RANLIB) $@ libpng.pc: - cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc + cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ + -e s!@exec_prefix@!$(exec_prefix)! \ + -e s!@libdir@!$(LIBPATH)! \ + -e s!@includedir@!$(INCPATH)! \ + -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc libpng-config: ( cat scripts/libpng-config-head.in; \ diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.cygwin b/src/dep/src/irrlicht/libpng/scripts/makefile.cygwin index ce2c7c2..a40541f 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.cygwin +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.cygwin @@ -3,7 +3,7 @@ # of the library, and builds two copies of pngtest: one # statically linked and one dynamically linked. # -# Copyright (C) 2002, 2006 Soren Anderson, Charles Wilson, +# Copyright (C) 2002, 2006-2008 Soren Anderson, Charles Wilson, # and Glenn Randers-Pehrson, based on makefile for linux-elf w/mmx by: # Copyright (C) 1998-2000 Greg Roelofs # Copyright (C) 1996, 1997 Andreas Dilger @@ -31,10 +31,6 @@ endif DESTDIR= -# To enable assembler optimizations, add '-DPNG_USE_PNGGCCRD' to -# $CFLAGS, and include pnggccrd.o in $OBJS, below, and in the dependency -# list at the bottom of this makefile. - CC=gcc ifdef MINGW MINGW_CCFLAGS=-mno-cygwin -I/usr/include/mingw @@ -62,25 +58,23 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ -Wmissing-declarations -Wtraditional -Wcast-align \ -Wstrict-prototypes -Wmissing-prototypes #-Wconversion -### if you use the asm, add pnggccrd.o to the OBJS list -### ### if you don't need thread safety, but want the asm accel -#CFLAGS= $(strip $(MINGW_CCFLAGS) -DPNG_THREAD_UNSAFE_OK -DPNG_USE_PNGGCCRD \ -# $(addprefix -I,$(ZLIBINC)) -Wall -O3 $(ALIGN) -funroll-loops \ +#CFLAGS= $(strip $(MINGW_CCFLAGS) -DPNG_THREAD_UNSAFE_OK \ +# $(addprefix -I,$(ZLIBINC)) -W -Wall -O $(ALIGN) -funroll-loops \ # -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5 ### if you need thread safety and want (minimal) asm accel -#CFLAGS= $(strip $(MINGW_CCFLAGS) -DPNG_USE_PNGGCCRD $(addprefix -I,$(ZLIBINC)) \ -# -Wall -O3 $(ALIGN) -funroll-loops \ +#CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \ +# -W -Wall -O $(ALIGN) -funroll-loops \ # -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5 ### Normal (non-asm) compilation CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \ - -Wall -O3 $(ALIGN) -funroll-loops \ + -W -Wall -O3 $(ALIGN) -funroll-loops -DPNG_NO_MMX_CODE \ -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5 LIBNAME = libpng12 PNGMAJ = 0 CYGDLL = 12 -PNGMIN = 1.2.18 +PNGMIN = 1.2.32 PNGVER = $(PNGMAJ).$(PNGMIN) SHAREDLIB=cygpng$(CYGDLL).dll @@ -115,7 +109,7 @@ DL =$(D)$(LIBPATH) OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ - pngwtran.o pngmem.o pngerror.o pngpread.o # pnggccrd.o + pngwtran.o pngmem.o pngerror.o pngpread.o OBJSDLL = $(OBJS:.o=.pic.o) @@ -140,8 +134,11 @@ buildsetup-tell: libpng.pc: scripts/libpng.pc.in @echo -e Making pkg-config file for this libpng installation..'\n' \ using PREFIX=\"$(prefix)\"'\n' - cat $(S)/scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! | \ - sed -e s/-lm// > libpng.pc + cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ + -e s!@exec_prefix@!$(exec_prefix)! \ + -e s!@libdir@!$(LIBPATH)! \ + -e s!@includedir@!$(INCPATH)! \ + -e s!-lpng12!-lpng12\ -lz! > libpng.pc libpng-config: scripts/libpng-config-head.in scripts/libpng-config-body.in @echo -e Making $(LIBNAME) libpng-config file for this libpng \ @@ -159,20 +156,6 @@ shared: all-shared all-static: $(STATLIB) pngtest-stat$(EXE) all-shared: $(SHAREDLIB) pngtest$(EXE) -pnggccrd.o: pnggccrd.c png.h pngconf.h - @echo "" - @echo ' You can ignore the "control reaches end of non-void function"' - @echo ' warning and " defined but not used" warnings:' - @echo "" - $(CC) -c $(CFLAGS) -o $@ $< - -pnggccrd.pic.o: pnggccrd.c png.h pngconf.h - @echo "" - @echo ' You can ignore the "control reaches end of non-void function"' - @echo ' warning and " defined but not used" warnings:' - @echo "" - $(CC) -c $(CFLAGS) -DPNG_BUILD_DLL -o $@ $< - $(STATLIB): $(OBJS) ar rc $@ $(OBJS) $(RANLIB) $@ diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.darwin b/src/dep/src/irrlicht/libpng/scripts/makefile.darwin index a5df6c4..4d82b6a 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.darwin +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.darwin @@ -1,5 +1,5 @@ # makefile for libpng on Darwin / Mac OS X -# Copyright (C) 2002, 2004, 2006 Glenn Randers-Pehrson +# Copyright (C) 2002, 2004, 2006, 2008 Glenn Randers-Pehrson # Copyright (C) 2001 Christoph Pfisterer # derived from makefile.linux: # Copyright (C) 1998, 1999 Greg Roelofs @@ -18,8 +18,8 @@ ZLIBINC=../zlib # Library name: LIBNAME = libpng12 -PNGMAJ = 0 -PNGMIN = 1.2.18 +PNGMAJ = 12 +PNGMIN = 1.2.32 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: @@ -38,7 +38,8 @@ LN_SF=ln -sf RANLIB=ranlib RM_F=/bin/rm -f -CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops +# CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE +CFLAGS=-I$(ZLIBINC) -W -Wall -O -funroll-loops LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz INCPATH=$(prefix)/include @@ -79,8 +80,11 @@ libpng.a: $(OBJS) $(RANLIB) $@ libpng.pc: - cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! | \ - sed -e s/-lm// > libpng.pc + cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ + -e s!@exec_prefix@!$(exec_prefix)! \ + -e s!@libdir@!$(LIBPATH)! \ + -e s!@includedir@!$(INCPATH)! \ + -e s!-lpng12!-lpng12\ -lz! > libpng.pc libpng-config: ( cat scripts/libpng-config-head.in; \ @@ -100,14 +104,14 @@ $(LIBSOMAJ): $(LIBSOVER) $(LIBSOVER): $(OBJSDLL) $(CC) -dynamiclib \ -install_name $(LIBPATH)/$(LIBSOMAJ) \ - -current_version $(PNGVER) -compatibility_version $(PNGVER) \ + -current_version $(SONUM) -compatibility_version $(SONUM) \ -o $(LIBSOVER) \ $(OBJSDLL) -L$(ZLIBLIB) -lz $(OLDSOVER): $(OBJSDLL) $(CC) -dynamiclib \ -install_name $(LIBPATH)/$(OLDSOMAJ) \ - -current_version 3 -compatibility_version 3 \ + -current_version %OLDSONUM% -compatibility_version %OLDSONUM% \ -o $(OLDSOVER) \ $(OBJSDLL) -L$(ZLIBLIB) -lz diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.dec b/src/dep/src/irrlicht/libpng/scripts/makefile.dec index 26e4157..5ceea64 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.dec +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.dec @@ -5,7 +5,7 @@ # Library name: PNGMAJ = 0 -PNGMIN = 1.2.18 +PNGMIN = 1.2.32 PNGVER = $(PNGMAJ).$(PNGMIN) LIBNAME = libpng12 @@ -68,7 +68,11 @@ libpng.a: $(OBJS) $(RANLIB) $@ libpng.pc: - cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc + cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ + -e s!@exec_prefix@!$(exec_prefix)! \ + -e s!@libdir@!$(LIBPATH)! \ + -e s!@includedir@!$(INCPATH)! \ + -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc libpng-config: ( cat scripts/libpng-config-head.in; \ diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.elf b/src/dep/src/irrlicht/libpng/scripts/makefile.elf index b728a4e..ead3bcb 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.elf +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.elf @@ -1,5 +1,6 @@ # makefile for libpng.a and libpng12.so on Linux ELF with gcc -# Copyright (C) 1998, 1999, 2002, 2006 Greg Roelofs and Glenn Randers-Pehrson +# Copyright (C) 1998, 1999, 2002, 2006, 2008 Greg Roelofs +# and Glenn Randers-Pehrson # Copyright (C) 1996, 1997 Andreas Dilger # For conditions of distribution and use, see copyright notice in png.h @@ -12,7 +13,7 @@ # Library name: LIBNAME = libpng12 PNGMAJ = 0 -PNGMIN = 1.2.18 +PNGMIN = 1.2.32 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: @@ -53,7 +54,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ # for pgcc version 2.95.1, -O3 is buggy; don't use it. -CFLAGS=-Wall -D_REENTRANT -O2 \ +CFLAGS=-W -Wall -D_REENTRANT -O2 \ $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5 LDFLAGS=-L. -lpng12 @@ -99,7 +100,11 @@ libpng.a: $(OBJS) $(RANLIB) $@ libpng.pc: - cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc + cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ + -e s!@exec_prefix@!$(exec_prefix)! \ + -e s!@libdir@!$(LIBPATH)! \ + -e s!@includedir@!$(INCPATH)! \ + -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc libpng.syms: png.h pngconf.h $(CC) $(CFLAGS) -E -DPNG_BUILDSYMS -DPNG_INTERNAL png.h |\ diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.freebsd b/src/dep/src/irrlicht/libpng/scripts/makefile.freebsd index 8767ce3..9e2a85b 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.freebsd +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.freebsd @@ -24,14 +24,14 @@ SYMLINKS= libpng/png.h ${INCSDIR}/../png.h \ LDADD+= -lm -lz DPADD+= ${LIBM} ${LIBZ} -CFLAGS+= -I. -DPNG_USE_PNGGCCRD +CFLAGS+= -I. .if (${MACHINE_ARCH} != "i386") CFLAGS+= -DPNG_NO_MMX_CODE .endif SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ - pngwtran.c pngmem.c pngerror.c pngpread.c pnggccrd.c + pngwtran.c pngmem.c pngerror.c pngpread.c pngtest: pngtest.o libpng.a ${CC} ${CFLAGS} -L. -static -o pngtest pngtest.o -lpng -lz -lm diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.gcc b/src/dep/src/irrlicht/libpng/scripts/makefile.gcc index 0ca7a86..30a4c72 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.gcc +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.gcc @@ -1,4 +1,5 @@ # makefile for libpng using gcc (generic, static library) +# Copyright (C) 2008 Glenn Randers-Pehrson # Copyright (C) 2000 Cosmin Truta # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # For conditions of distribution and use, see copyright notice in png.h @@ -18,8 +19,8 @@ CDEBUG = -g -DPNG_DEBUG=5 LDDEBUG = CRELEASE = -O2 LDRELEASE = -s -#CFLAGS = -Wall $(CDEBUG) -CFLAGS = -Wall $(CRELEASE) +#CFLAGS = -W -Wall $(CDEBUG) +CFLAGS = -W -Wall $(CRELEASE) #LDFLAGS = $(LDDEBUG) LDFLAGS = $(LDRELEASE) LIBS = -lz -lm diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.gcmmx b/src/dep/src/irrlicht/libpng/scripts/makefile.gcmmx index 1afed82..c5def1d 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.gcmmx +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.gcmmx @@ -1,14 +1,12 @@ # makefile for libpng.a and libpng12.so on Linux ELF with gcc using MMX # assembler code -# Copyright 2002, 2006 Greg Roelofs and Glenn Randers-Pehrson +# Copyright 2002, 2006, 2008 Greg Roelofs and Glenn Randers-Pehrson # Copyright 1998-2001 Greg Roelofs # Copyright 1996-1997 Andreas Dilger # For conditions of distribution and use, see copyright notice in png.h # CAUTION: Do not use this makefile with gcc versions 2.7.2.2 and earlier. -# WARNING: The assembler code in pnggccrd.c may not be thread safe. - # NOTE: When testing MMX performance on a multitasking system, make sure # there are no floating-point programs (e.g., SETI@Home) running in # the background! Context switches between MMX and FPU are expensive. @@ -16,7 +14,7 @@ # Library name: LIBNAME = libpng12 PNGMAJ = 0 -PNGMIN = 1.2.18 +PNGMIN = 1.2.32 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: @@ -60,15 +58,15 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ # Remove -DPNG_THREAD_UNSAFE_OK if you need thread safety ### for generic gcc: -CFLAGS=-DPNG_THREAD_UNSAFE_OK -DPNG_USE_PNGGCCRD -I$(ZLIBINC) -Wall \ - -O3 $(ALIGN) -funroll-loops \ +CFLAGS=-DPNG_THREAD_UNSAFE_OK -I$(ZLIBINC) -W -Wall -O \ + $(ALIGN) -funroll-loops \ -fomit-frame-pointer # $(WARNMORE) -g -DPNG_DEBUG=5 ### for gcc 2.95.2 on 686: -#CFLAGS=-DPNG_THREAD_UNSAFE_OK -DPNG_USE_PNGGCCRD -I$(ZLIBINC) -Wall -O3 \ +#CFLAGS=-DPNG_THREAD_UNSAFE_OK -I$(ZLIBINC) -W -Wall -O \ # -mcpu=i686 -malign-double -ffast-math -fstrict-aliasing \ # $(ALIGN) -funroll-loops -funroll-all-loops -fomit-frame-pointer ### for gcc 2.7.2.3 on 486 and up: -#CFLAGS=-DPNG_THREAD_UNSAFE_OK -DPNG_USE_PNGGCCRD -I$(ZLIBINC) -Wall -O3 \ +#CFLAGS=-DPNG_THREAD_UNSAFE_OK -I$(ZLIBINC) -W -Wall -O \ # -m486 -malign-double -ffast-math \ # $(ALIGN) -funroll-loops -funroll-all-loops -fomit-frame-pointer @@ -98,7 +96,7 @@ DM=$(DESTDIR)$(MANPATH) OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ - pngwtran.o pngmem.o pngerror.o pngpread.o pnggccrd.o + pngwtran.o pngmem.o pngerror.o pngpread.o OBJSDLL = $(OBJS:.o=.pic.o) @@ -114,25 +112,23 @@ libpng.a: $(OBJS) $(RANLIB) $@ libpng.pc: - cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc + cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ + -e s!@exec_prefix@!$(exec_prefix)! \ + -e s!@libdir@!$(LIBPATH)! \ + -e s!@includedir@!$(INCPATH)! \ + -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc libpng-config: ( cat scripts/libpng-config-head.in; \ echo prefix=\"$(prefix)\"; \ echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ - echo cppflags=\"-DPNG_THREAD_UNSAFE_OK -DPNG_USE_PNGGCCRD\"; \ + echo cppflags=\"-DPNG_THREAD_UNSAFE_OK \"; \ echo L_opts=\"-L$(LIBPATH)\"; \ echo R_opts=\"-Wl,-rpath,$(LIBPATH)\"; \ echo libs=\"-lpng12 -lz -lm\"; \ cat scripts/libpng-config-body.in ) > libpng-config chmod +x libpng-config -pnggccrd.o: pnggccrd.c png.h pngconf.h - $(CC) -c $(CFLAGS) -o $@ $*.c - -pnggccrd.pic.o: pnggccrd.c png.h pngconf.h - $(CC) -c $(CFLAGS) -fPIC -o $@ pnggccrd.c - $(LIBSO): $(LIBSOMAJ) $(LN_SF) $(LIBSOMAJ) $(LIBSO) diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.hp64 b/src/dep/src/irrlicht/libpng/scripts/makefile.hp64 index 091367f..c1d5208 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.hp64 +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.hp64 @@ -18,7 +18,7 @@ ZLIBINC=/opt/zlib/include # Library name: LIBNAME = libpng12 PNGMAJ = 0 -PNGMIN = 1.2.18 +PNGMIN = 1.2.32 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: @@ -86,7 +86,11 @@ libpng.a: $(OBJS) $(RANLIB) $@ libpng.pc: - cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc + cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ + -e s!@exec_prefix@!$(exec_prefix)! \ + -e s!@libdir@!$(LIBPATH)! \ + -e s!@includedir@!$(INCPATH)! \ + -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc libpng-config: ( cat scripts/libpng-config-head.in; \ diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.hpgcc b/src/dep/src/irrlicht/libpng/scripts/makefile.hpgcc index 041f5a8..42665b6 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.hpgcc +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.hpgcc @@ -1,5 +1,5 @@ # makefile for libpng on HP-UX using GCC with the HP ANSI/C linker. -# Copyright (C) 2002, 2006 Glenn Randers-Pehrson +# Copyright (C) 2002, 2006-2008 Glenn Randers-Pehrson # Copyright (C) 2001, Laurent faillie # Copyright (C) 1998, 1999 Greg Roelofs # Copyright (C) 1996, 1997 Andreas Dilger @@ -8,7 +8,7 @@ # Library name: LIBNAME = libpng12 PNGMAJ = 0 -PNGMIN = 1.2.18 +PNGMIN = 1.2.32 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: @@ -53,7 +53,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ # for pgcc version 2.95.1, -O3 is buggy; don't use it. -CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \ +CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE \ $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5 #LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz -lm @@ -96,7 +96,11 @@ libpng.a: $(OBJS) $(RANLIB) $@ libpng.pc: - cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc + cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ + -e s!@exec_prefix@!$(exec_prefix)! \ + -e s!@libdir@!$(LIBPATH)! \ + -e s!@includedir@!$(INCPATH)! \ + -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc libpng-config: ( cat scripts/libpng-config-head.in; \ diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.hpux b/src/dep/src/irrlicht/libpng/scripts/makefile.hpux index 975e80b..8210477 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.hpux +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.hpux @@ -18,7 +18,7 @@ ZLIBINC=/opt/zlib/include # Library name: LIBNAME = libpng12 PNGMAJ = 0 -PNGMIN = 1.2.18 +PNGMIN = 1.2.32 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: @@ -45,7 +45,7 @@ LIBPATH=$(exec_prefix)/lib MANPATH=$(prefix)/man BINPATH=$(exec_prefix)/bin -CFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0 +CFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0 -DPNG_NO_MMX_CODE # Caution: be sure you have built zlib with the same CFLAGS. CCFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0 LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm @@ -83,7 +83,11 @@ libpng.a: $(OBJS) $(RANLIB) $@ libpng.pc: - cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc + cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ + -e s!@exec_prefix@!$(exec_prefix)! \ + -e s!@libdir@!$(LIBPATH)! \ + -e s!@includedir@!$(INCPATH)! \ + -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc libpng-config: ( cat scripts/libpng-config-head.in; \ diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.intel b/src/dep/src/irrlicht/libpng/scripts/makefile.intel index 400ca07..4160c99 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.intel +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.intel @@ -8,14 +8,6 @@ # To use, do "nmake /f scripts\makefile.intel" -# ------------------- Intel C/C++ Compiler 4.0 and later ------------------- - -# Caution: the assembler code was introduced at libpng version 1.0.4 and has -# not yet been thoroughly tested. - -# Use assembler code -ASMCODE=-DPNG_USE_PNGVCRD - # Where the zlib library and include files are located ZLIBLIB=..\zlib ZLIBINC=..\zlib @@ -36,7 +28,7 @@ CALLING=r # __fastcall CC=icl -c -CFLAGS=-O2 -G$(CPU)$(CALLING) -Qip -Qunroll4 -I$(ZLIBINC) $(ASMCODE) -nologo +CFLAGS=-O2 -G$(CPU)$(CALLING) -Qip -Qunroll4 -I$(ZLIBINC) -nologo LD=link LDFLAGS=/SUBSYSTEM:CONSOLE /NOLOGO @@ -44,8 +36,7 @@ O=.obj OBJS=png$(O) pngset$(O) pngget$(O) pngrutil$(O) pngtrans$(O) pngwutil$(O) \ pngmem$(O) pngpread$(O) pngread$(O) pngerror$(O) pngwrite$(O) \ -pngrtran$(O) pngwtran$(O) pngrio$(O) pngwio$(O) pngvcrd$(O) - +pngrtran$(O) pngwtran$(O) pngrio$(O) pngwio$(O) all: test @@ -70,9 +61,6 @@ pngrtran$(O): png.h pngconf.h pngrutil$(O): png.h pngconf.h $(CC) $(CFLAGS) $*.c $(ERRFILE) -pngvcrd$(O): png.h pngconf.h - $(CC) $(CFLAGS) $*.c $(ERRFILE) - pngerror$(O): png.h pngconf.h $(CC) $(CFLAGS) $*.c $(ERRFILE) diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.linux b/src/dep/src/irrlicht/libpng/scripts/makefile.linux index e79f32d..1727bf2 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.linux +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.linux @@ -1,12 +1,13 @@ # makefile for libpng.a and libpng12.so on Linux ELF with gcc -# Copyright (C) 1998, 1999, 2002, 2006 Greg Roelofs and Glenn Randers-Pehrson +# Copyright (C) 1998, 1999, 2002, 2006, 2008 Greg Roelofs and +# Glenn Randers-Pehrson # Copyright (C) 1996, 1997 Andreas Dilger # For conditions of distribution and use, see copyright notice in png.h # Library name: LIBNAME = libpng12 PNGMAJ = 0 -PNGMIN = 1.2.18 +PNGMIN = 1.2.32 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: @@ -47,7 +48,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ # for pgcc version 2.95.1, -O3 is buggy; don't use it. -CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \ +CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE \ $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5 LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm @@ -91,7 +92,11 @@ libpng.a: $(OBJS) $(RANLIB) $@ libpng.pc: - cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc + cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ + -e s!@exec_prefix@!$(exec_prefix)! \ + -e s!@libdir@!$(LIBPATH)! \ + -e s!@includedir@!$(INCPATH)! \ + -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc libpng-config: ( cat scripts/libpng-config-head.in; \ diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.mingw b/src/dep/src/irrlicht/libpng/scripts/makefile.mingw index 6b074ac..25f8cfe 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.mingw +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.mingw @@ -4,17 +4,17 @@ # statically linked and one dynamically linked. # # Built from makefile.cygwin -# Copyright (C) 2002, 2006 Soren Anderson, Charles Wilson, +# Copyright (C) 2002, 2006, 2008 Soren Anderson, Charles Wilson, # and Glenn Randers-Pehrson, based on makefile for linux-elf w/mmx by: -# Copyright (C) 1998-2000 Greg Roelofs +# Copyright (C) 1998-2000, 2007 Greg Roelofs # Copyright (C) 1996, 1997 Andreas Dilger # For conditions of distribution and use, see copyright notice in png.h + # This makefile intends to support building outside the src directory # if desired. When invoking it, specify an argument to SRCDIR on the # command line that points to the top of the directory where your source # is located. - ifdef SRCDIR VPATH = $(SRCDIR) else @@ -29,20 +29,20 @@ endif # If you're going to install into a temporary location # via DESTDIR, $(DESTDIR)$(prefix) must already exist before # you execute make install. - DESTDIR= -# To enable assembler optimizations, add '-DPNG_USE_PNGGCCRD' to -# $CFLAGS, and include pnggccrd.o in $OBJS, below, and in the dependency -# list at the bottom of this makefile. - +# If you're using a cross-compiler, add the appropriate prefix (e.g., +# "i386-mingw32msvc-") to the following three commands: CC=gcc +AR=ar +RANLIB=ranlib +MKDIR_P=/bin/mkdir -pv # Where "make install" puts libpng*.a, *png*.dll, png.h, and pngconf.h ifndef prefix prefix=/usr -$(warning You haven't specified a 'prefix=' location. Defaulting to "/usr") +$(warning "You haven't specified a 'prefix=' location. Defaulting to '/usr'") endif exec_prefix=$(prefix) @@ -58,25 +58,23 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ -Wmissing-declarations -Wtraditional -Wcast-align \ -Wstrict-prototypes -Wmissing-prototypes #-Wconversion -### if you use the asm, add pnggccrd.o to the OBJS list -### ### if you don't need thread safety, but want the asm accel -#CFLAGS= $(strip $(MINGW_CCFLAGS) -DPNG_THREAD_UNSAFE_OK -DPNG_USE_PNGGCCRD \ -# $(addprefix -I,$(ZLIBINC)) -Wall -O3 $(ALIGN) -funroll-loops \ +#CFLAGS= $(strip $(MINGW_CCFLAGS) -DPNG_THREAD_UNSAFE_OK \ +# $(addprefix -I,$(ZLIBINC)) -W -Wall -O $(ALIGN) -funroll-loops \ # -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5 ### if you need thread safety and want (minimal) asm accel -#CFLAGS= $(strip $(MINGW_CCFLAGS) -DPNG_USE_PNGGCCRD $(addprefix -I,$(ZLIBINC)) \ -# -Wall -O3 $(ALIGN) -funroll-loops \ +#CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \ +# -W -Wall -O $(ALIGN) -funroll-loops \ # -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5 ### Normal (non-asm) compilation CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \ - -Wall -O3 $(ALIGN) -funroll-loops \ + -W -Wall -O3 $(ALIGN) -funroll-loops -DPNG_NO_MMX_CODE \ -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5 LIBNAME = libpng12 PNGMAJ = 0 MINGDLL = 12 -PNGMIN = 1.2.18 +PNGMIN = 1.2.32 PNGVER = $(PNGMAJ).$(PNGMIN) SHAREDLIB=libpng$(MINGDLL).dll @@ -90,10 +88,6 @@ LDFLAGS=$(strip -L. $(MINGW_LDFLAGS) -lpng $(addprefix -L,$(ZLIBLIB)) -lz) LDSFLAGS=$(strip -shared -L. $(MINGW_LDFLAGS)) LDEXTRA=-Wl,--out-implib=$(IMPLIB) $(addprefix -L,$(ZLIBLIB)) -lz -MKDIR_P=/bin/mkdir -pv -RANLIB=ranlib -#RANLIB=echo - INCPATH=$(prefix)/include LIBPATH=$(exec_prefix)/lib @@ -111,7 +105,7 @@ DL =$(D)$(LIBPATH) OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ - pngwtran.o pngmem.o pngerror.o pngpread.o # pnggccrd.o + pngwtran.o pngmem.o pngerror.o pngpread.o OBJSDLL = $(OBJS:.o=.pic.o) @@ -136,8 +130,12 @@ buildsetup-tell: libpng.pc: scripts/libpng.pc.in @echo -e Making pkg-config file for this libpng installation..'\n' \ using PREFIX=\"$(prefix)\"'\n' - cat $(S)/scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! | \ - sed -e s/-lm// > libpng.pc + cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ + -e s!@exec_prefix@!$(exec_prefix)! \ + -e s!@libdir@!$(LIBPATH)! \ + -e s!@includedir@!$(INCPATH)! \ + -e s!@includedir@!$(INCPATH)! \ + -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc libpng-config: scripts/libpng-config-head.in scripts/libpng-config-body.in @echo -e Making $(LIBNAME) libpng-config file for this libpng \ @@ -155,22 +153,8 @@ shared: all-shared all-static: $(STATLIB) pngtest-stat$(EXE) all-shared: $(SHAREDLIB) pngtest$(EXE) -pnggccrd.o: pnggccrd.c png.h pngconf.h - @echo "" - @echo ' You can ignore the "control reaches end of non-void function"' - @echo ' warning and " defined but not used" warnings:' - @echo "" - $(CC) -c $(CFLAGS) -o $@ $< - -pnggccrd.pic.o: pnggccrd.c png.h pngconf.h - @echo "" - @echo ' You can ignore the "control reaches end of non-void function"' - @echo ' warning and " defined but not used" warnings:' - @echo "" - $(CC) -c $(CFLAGS) -DPNG_BUILD_DLL -o $@ $< - $(STATLIB): $(OBJS) - ar rc $@ $(OBJS) + $(AR) rc $@ $(OBJS) $(RANLIB) $@ $(SHAREDDEF): scripts/pngw32.def @@ -186,12 +170,6 @@ pngtest$(EXE): pngtest.pic.o $(SHAREDLIB) pngtest-stat$(EXE): pngtest.o $(STATLIB) $(CC) -static $(CFLAGS) $< $(LDFLAGS) -o $@ -pngtest.pic.o: pngtest.c - $(CC) $(CFLAGS) -c $< -o $@ - -pngtest.o: pngtest.c - $(CC) $(CFLAGS) -c $< -o $@ - test: test-static test-shared test-static: pngtest-stat$(EXE) @@ -278,8 +256,8 @@ test-installed: clean: /bin/rm -f *.pic.o *.o $(STATLIB) $(IMPLIB) $(SHAREDLIB) \ - pngtest-stat$(EXE) pngtest$(EXE) pngout.png $(SHAREDDEF) \ - libpng-config libpng.pc pngtesti$(EXE) + pngtest-stat$(EXE) pngtest$(EXE) pngout.png $(SHAREDDEF) \ + libpng-config libpng.pc pngtesti$(EXE) DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO writelock: @@ -305,8 +283,7 @@ pngwtran.o pngwtran.pic.o: png.h pngconf.h pngwtran.c pngwutil.o pngwutil.pic.o: png.h pngconf.h pngwutil.c pngpread.o pngpread.pic.o: png.h pngconf.h pngpread.c -pngtest.o: png.h pngconf.h pngtest.c -pngtest-stat.o: png.h pngconf.h pngtest.c +pngtest.o pngtest.pic.o: png.h pngconf.h pngtest.c diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.ne12bsd b/src/dep/src/irrlicht/libpng/scripts/makefile.ne12bsd index 42adaca..733c6be 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.ne12bsd +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.ne12bsd @@ -14,14 +14,14 @@ INCSDIR=${LOCALBASE}/include/libpng12 LIB= png12 SHLIB_MAJOR= 0 -SHLIB_MINOR= 1.2.18 -SRCS= pnggccrd.c png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ - pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ - pngwtran.c pngmem.c pngerror.c pngpread.c +SHLIB_MINOR= 1.2.32 +SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ + pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ + pngwtran.c pngmem.c pngerror.c pngpread.c INCS= png.h pngconf.h MAN= libpng.3 libpngpf.3 png.5 -CPPFLAGS+=-I${.CURDIR} -DPNG_USE_PNGGCCRD +CPPFLAGS+=-I${.CURDIR} # something like this for mmx assembler, but it core dumps for me at the moment # .if ${MACHINE_ARCH} == "i386" diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.netbsd b/src/dep/src/irrlicht/libpng/scripts/makefile.netbsd index 89d6b35..5f18a6f 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.netbsd +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.netbsd @@ -14,14 +14,14 @@ INCSDIR=${LOCALBASE}/include/libpng LIB= png SHLIB_MAJOR= 3 -SHLIB_MINOR= 1.2.18 -SRCS= pnggccrd.c png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ - pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ - pngwtran.c pngmem.c pngerror.c pngpread.c +SHLIB_MINOR= 1.2.32 +SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ + pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ + pngwtran.c pngmem.c pngerror.c pngpread.c INCS= png.h pngconf.h MAN= libpng.3 libpngpf.3 png.5 -CPPFLAGS+=-I${.CURDIR} -DPNG_USE_PNGGCCRD +CPPFLAGS+=-I${.CURDIR} # something like this for mmx assembler, but it core dumps for me at the moment # .if ${MACHINE_ARCH} == "i386" diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.nommx b/src/dep/src/irrlicht/libpng/scripts/makefile.nommx index 30208d4..f49ba7e 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.nommx +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.nommx @@ -1,5 +1,5 @@ # makefile for libpng.a and libpng12.so on Linux ELF with gcc -# Copyright (C) 1998, 1999, 2002, 2006, 2007 Greg Roelofs and +# Copyright (C) 1998, 1999, 2002, 2006-2008 Greg Roelofs and # Glenn Randers-Pehrson # Copyright (C) 1996, 1997 Andreas Dilger # For conditions of distribution and use, see copyright notice in png.h @@ -7,7 +7,7 @@ # Library name: LIBNAME = libpng12 PNGMAJ = 0 -PNGMIN = 1.2.18 +PNGMIN = 1.2.32 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: @@ -48,8 +48,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ # for pgcc version 2.95.1, -O3 is buggy; don't use it. -CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \ - -DPNG_NO_MMX_CODE \ +CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE \ $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5 LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm @@ -93,8 +92,13 @@ libpng.a: $(OBJS) $(RANLIB) $@ libpng.pc: - cat scripts/libpng.pc.in | sed -e s!@PREFIX@!$(prefix)! \ - | sed -e "s!Cflags: !Cflags: -DPNG_NO_MMX_CODE !"> libpng.pc + cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ + -e s!@exec_prefix@!$(exec_prefix)! \ + -e s!@libdir@!$(LIBPATH)! \ + -e s!@includedir@!$(INCPATH)! \ + -e s!@includedir@!$(INCPATH)! \ + -e s!-lpng12!-lpng12\ -lz\ -lm! \ + -e s!Cflags: !Cflags:\ -DPNG_NO_MMX_CODE!> libpng.pc libpng-config: ( cat scripts/libpng-config-head.in; \ diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.openbsd b/src/dep/src/irrlicht/libpng/scripts/makefile.openbsd index 3ff3b0e..48807b5 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.openbsd +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.openbsd @@ -1,6 +1,6 @@ # makefile for libpng # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. -# Copyright (C) 2007 Glenn Randers-Pehrson +# Copyright (C) 2007-2008 Glenn Randers-Pehrson # For conditions of distribution and use, see copyright notice in png.h PREFIX?= /usr/local @@ -8,17 +8,17 @@ LIBDIR= ${PREFIX}/lib MANDIR= ${PREFIX}/man/cat SHLIB_MAJOR= 0 -SHLIB_MINOR= 1.2.18 +SHLIB_MINOR= 1.2.32 LIB= png -SRCS= png.c pngerror.c pnggccrd.c pngget.c pngmem.c pngpread.c \ +SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \ pngread.c pngrio.c pngrtran.c pngrutil.c pngset.c pngtrans.c \ pngwio.c pngwrite.c pngwtran.c pngwutil.c HDRS= png.h pngconf.h -CFLAGS+= -Wall -CPPFLAGS+= -I${.CURDIR} -DPNG_NO_MMX_CODE -DPNG_USE_PNGGCCRD +CFLAGS+= -W -Wall +CPPFLAGS+= -I${.CURDIR} -DPNG_NO_MMX_CODE NOPROFILE= Yes diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.os2 b/src/dep/src/irrlicht/libpng/scripts/makefile.os2 index e2eed69..29be62b 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.os2 +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.os2 @@ -12,7 +12,7 @@ ZLIBINC=../zlib WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ -Wmissing-declarations -Wtraditional -Wcast-align \ -Wstrict-prototypes -Wmissing-prototypes #-Wconversion -CFLAGS=-I$(ZLIBINC) -Wall -O6 -funroll-loops -malign-loops=2 \ +CFLAGS=-I$(ZLIBINC) -W -Wall -O6 -funroll-loops -malign-loops=2 \ -malign-functions=2 #$(WARNMORE) -g -DPNG_DEBUG=5 LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lzdll -Zcrtdll AR=emxomfar diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.sco b/src/dep/src/irrlicht/libpng/scripts/makefile.sco index d2cb1d1..685560b 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.sco +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.sco @@ -9,7 +9,7 @@ # Library name: LIBNAME = libpng12 PNGMAJ = 0 -PNGMIN = 1.2.18 +PNGMIN = 1.2.32 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: @@ -38,7 +38,7 @@ exec_prefix=$(prefix) ZLIBLIB=../zlib ZLIBINC=../zlib -CFLAGS= -dy -belf -I$(ZLIBINC) -O3 +CFLAGS= -dy -belf -I$(ZLIBINC) -O3 -DPNG_NO_MMX_CODE LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz -lm INCPATH=$(prefix)/include/libpng @@ -79,7 +79,11 @@ libpng.a: $(OBJS) $(RANLIB) $@ libpng.pc: - cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc + cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ + -e s!@exec_prefix@!$(exec_prefix)! \ + -e s!@libdir@!$(LIBPATH)! \ + -e s!@includedir@!$(INCPATH)! \ + -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc libpng-config: ( cat scripts/libpng-config-head.in; \ diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.sggcc b/src/dep/src/irrlicht/libpng/scripts/makefile.sggcc index b4c1a4b..f1e62e1 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.sggcc +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.sggcc @@ -6,7 +6,7 @@ # Library name: LIBNAME=libpng12 PNGMAJ = 0 -PNGMIN = 1.2.18 +PNGMIN = 1.2.32 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: @@ -44,7 +44,7 @@ ZLIBINC=../zlib ABI= WARNMORE= # -g -DPNG_DEBUG=5 -CFLAGS=$(ABI) -I$(ZLIBINC) -O2 $(WARNMORE) -fPIC -mabi=n32 +CFLAGS=$(ABI) -I$(ZLIBINC) -O $(WARNMORE) -fPIC -mabi=n32 -DPNG_NO_MMX_CODE LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm LDSHARED=cc $(ABI) -shared -soname $(LIBSOMAJ) \ -set_version sgi$(PNGMAJ).0 @@ -73,7 +73,7 @@ DI=$(DESTDIR)$(INCPATH) DL=$(DESTDIR)$(LIBPATH) DM=$(DESTDIR)$(MANPATH) -OBJS = pnggccrd.o png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ +OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngwtran.o pngmem.o pngerror.o pngpread.o @@ -86,13 +86,18 @@ libpng.a: $(OBJS) shared: $(LIBSOVER) libpng.pc: - cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc + cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ + -e s!@exec_prefix@!$(exec_prefix)! \ + -e s!@libdir@!$(LIBPATH)! \ + -e s!@includedir@!$(INCPATH)! \ + -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc libpng-config: ( cat scripts/libpng-config-head.in; \ echo prefix=\"$(prefix)\"; \ echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ echo ccopts=\"$(ABI)\"; \ + echo cppflags=\"-DPNG_NO_MMX_CODE\"; \ echo ldopts=\"$(ABI)\"; \ echo L_opts=\"-L$(LIBPATH)\"; \ echo libdir=\"$(LIBPATH)\"; \ @@ -234,5 +239,4 @@ pngwrite.o: png.h pngconf.h pngwtran.o: png.h pngconf.h pngwutil.o: png.h pngconf.h pngpread.o: png.h pngconf.h -pnggccrd.o: png.h pngconf.h diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.sgi b/src/dep/src/irrlicht/libpng/scripts/makefile.sgi index 1811914..94a8129 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.sgi +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.sgi @@ -6,7 +6,7 @@ # Library name: LIBNAME=libpng12 PNGMAJ = 0 -PNGMIN = 1.2.18 +PNGMIN = 1.2.32 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: @@ -45,9 +45,8 @@ ABI= WARNMORE=-fullwarn # Note: -KPIC is the default anyhow -#CFLAGS= $(ABI) -I$(ZLIBINC) -O $(WARNMORE) -KPIC -DPNG_USE_PNGGCCRD # -g -DPNG_DEBUG=5 -CFLAGS=$(ABI) -I$(ZLIBINC) -O $(WARNMORE) -DPNG_USE_PNGGCCRD \ - -DPNG_NO_MMX_CODE +#CFLAGS= $(ABI) -I$(ZLIBINC) -O $(WARNMORE) -KPIC -DPNG_NO_MMX_CODE # -g -DPNG_DEBUG=5 +CFLAGS=$(ABI) -I$(ZLIBINC) -O $(WARNMORE) -DPNG_NO_MMX_CODE LDFLAGS_A=$(ABI) -L. -L$(ZLIBLIB) -lpng12 -lz -lm LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm LDSHARED=cc $(ABI) -shared -soname $(LIBSOMAJ) \ @@ -77,7 +76,7 @@ DI=$(DESTDIR)$(INCPATH) DL=$(DESTDIR)$(LIBPATH) DM=$(DESTDIR)$(MANPATH) -OBJS = pnggccrd.o png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ +OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngwtran.o pngmem.o pngerror.o pngpread.o @@ -90,13 +89,17 @@ libpng.a: $(OBJS) shared: $(LIBSOVER) libpng.pc: - cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc + cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ + -e s!@exec_prefix@!$(exec_prefix)! \ + -e s!@libdir@!$(LIBPATH)! \ + -e s!@includedir@!$(INCPATH)! \ + -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc libpng-config: ( cat scripts/libpng-config-head.in; \ echo prefix=\"$(prefix)\"; \ echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ - echo cppflags=\"-DPNG_USE_PNGGCCRD -DPNG_NO_MMX_CODE\"; \ + echo cppflags=\"-DPNG_NO_MMX_CODE\"; \ echo ccopts=\"$(ABI)\"; \ echo ldopts=\"$(ABI)\"; \ echo L_opts=\"-L$(LIBPATH)\"; \ @@ -239,5 +242,4 @@ pngwrite.o: png.h pngconf.h pngwtran.o: png.h pngconf.h pngwutil.o: png.h pngconf.h pngpread.o: png.h pngconf.h -pnggccrd.o: png.h pngconf.h diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.so9 b/src/dep/src/irrlicht/libpng/scripts/makefile.so9 index 5128fbd..3c76c11 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.so9 +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.so9 @@ -1,14 +1,14 @@ # makefile for libpng on Solaris 9 (beta) with Forte cc # Updated by Chad Schrock for Solaris 9 # Contributed by William L. Sebok, based on makefile.linux -# Copyright (C) 2002, 2006 Glenn Randers-Pehrson +# Copyright (C) 2002, 2006, 2008 Glenn Randers-Pehrson # Copyright (C) 1998-2001 Greg Roelofs # Copyright (C) 1996-1997 Andreas Dilger # For conditions of distribution and use, see copyright notice in png.h # Library name: PNGMAJ = 0 -PNGMIN = 1.2.18 +PNGMIN = 1.2.32 PNGVER = $(PNGMAJ).$(PNGMIN) LIBNAME = libpng12 @@ -47,8 +47,8 @@ ZLIBINC=/usr/include #WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ -Wmissing-declarations -Wtraditional -Wcast-align \ -Wstrict-prototypes -Wmissing-prototypes #-Wconversion -#CFLAGS=-I$(ZLIBINC) -Wall -O3 $(WARNMORE) -g -DPNG_DEBUG=5 -CFLAGS=-I$(ZLIBINC) -O3 +#CFLAGS=-I$(ZLIBINC) -W -Wall -O3 $(WARNMORE) -g -DPNG_DEBUG=5 -DPNG_NO_MMX_CODE +CFLAGS=-I$(ZLIBINC) -O3 -DPNG_NO_MMX_CODE LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng12 -lz -lm INCPATH=$(prefix)/include @@ -89,7 +89,11 @@ libpng.a: $(OBJS) $(RANLIB) $@ libpng.pc: - cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc + cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ + -e s!@exec_prefix@!$(exec_prefix)! \ + -e s!@libdir@!$(LIBPATH)! \ + -e s!@includedir@!$(INCPATH)! \ + -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc libpng-config: ( cat scripts/libpng-config-head.in; \ diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.solaris b/src/dep/src/irrlicht/libpng/scripts/makefile.solaris index 0c6857b..b9dfb6b 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.solaris +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.solaris @@ -1,5 +1,5 @@ # makefile for libpng on Solaris 2.x with gcc -# Copyright (C) 2004, 2006, 2007 Glenn Randers-Pehrson +# Copyright (C) 2004, 2006-2008 Glenn Randers-Pehrson # Contributed by William L. Sebok, based on makefile.linux # Copyright (C) 1998 Greg Roelofs # Copyright (C) 1996, 1997 Andreas Dilger @@ -8,7 +8,7 @@ # Library name: LIBNAME = libpng12 PNGMAJ = 0 -PNGMIN = 1.2.18 +PNGMIN = 1.2.32 PNGVER = $(PNGMAJ).$(PNGMIN) # Shared library names: @@ -43,7 +43,8 @@ ZLIBINC=/usr/local/include WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ -Wmissing-declarations -Wtraditional -Wcast-align \ -Wstrict-prototypes -Wmissing-prototypes #-Wconversion -CFLAGS=-I$(ZLIBINC) -Wall -O \ +CFLAGS=-I$(ZLIBINC) -W -Wall -O \ + -DPNG_NO_MMX_CODE; \ # $(WARNMORE) -g -DPNG_DEBUG=5 LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng12 -lz -lm @@ -85,13 +86,17 @@ libpng.a: $(OBJS) $(RANLIB) $@ libpng.pc: - cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc + cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ + -e s!@exec_prefix@!$(exec_prefix)! \ + -e s!@libdir@!$(LIBPATH)! \ + -e s!@includedir@!$(INCPATH)! \ + -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc libpng-config: ( cat scripts/libpng-config-head.in; \ echo prefix=\"$(prefix)\"; \ echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ - echo cppflags=\"-DPNG_USE_PNGGCCRD -DPNG_NO_MMX_CODE\"; \ + echo cppflags=\"-DPNG_NO_MMX_CODE\"; \ echo L_opts=\"-L$(LIBPATH)\"; \ echo R_opts=\"-R$(LIBPATH)\"; \ echo libs=\"-lpng12 -lz -lm\"; \ diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.vcawin32 b/src/dep/src/irrlicht/libpng/scripts/makefile.vcawin32 index 89effe5..51d5d77 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.vcawin32 +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.vcawin32 @@ -26,8 +26,7 @@ O=.obj OBJS1 = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) OBJS2 = pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) pngset$(O) OBJS3 = pngtrans$(O) pngwio$(O) pngwrite$(O) pngwtran$(O) pngwutil$(O) -OBJS4 = pngvcrd$(O) -OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) +OBJS = $(OBJS1) $(OBJS2) $(OBJS3) # Targets all: libpng.lib @@ -80,9 +79,6 @@ pngwtran$(O): png.h pngconf.h pngwutil$(O): png.h pngconf.h $(CC) -c $(CFLAGS) $*.c $(ERRFILE) -pngvcrd$(O): png.h pngconf.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - libpng.lib: $(OBJS) -$(RM) $@ $(AR) $(ARFLAGS) -out:$@ $(OBJS) $(ERRFILE) diff --git a/src/dep/src/irrlicht/libpng/scripts/makefile.vcwin32 b/src/dep/src/irrlicht/libpng/scripts/makefile.vcwin32 index 6148c83..058f6d3 100644 --- a/src/dep/src/irrlicht/libpng/scripts/makefile.vcwin32 +++ b/src/dep/src/irrlicht/libpng/scripts/makefile.vcwin32 @@ -11,7 +11,7 @@ CC = cl LD = link AR = lib -CFLAGS = -nologo -MD -O2 -W3 -I..\zlib +CFLAGS = -nologo -DPNG_NO_MMX_CODE -MD -O2 -W3 -I..\zlib LDFLAGS = -nologo ARFLAGS = -nologo RM = del diff --git a/src/dep/src/irrlicht/libpng/scripts/pngos2.def b/src/dep/src/irrlicht/libpng/scripts/pngos2.def index 4e7f073..bfabffe 100644 --- a/src/dep/src/irrlicht/libpng/scripts/pngos2.def +++ b/src/dep/src/irrlicht/libpng/scripts/pngos2.def @@ -2,7 +2,7 @@ ; PNG.LIB module definition file for OS/2 ;---------------------------------------- -; Version 1.2.18 +; Version 1.2.32 LIBRARY PNG DESCRIPTION "PNG image compression library for OS/2" @@ -224,7 +224,6 @@ EXPORTS png_set_expand_gray_1_2_4_to_8 ; These are not present when libpng is compiled with PNG_NO_GLOBAL_ARRAYS - png_libpng_ver png_pass_start png_pass_inc png_pass_ystart diff --git a/src/dep/src/irrlicht/libpng/scripts/pngw32.def b/src/dep/src/irrlicht/libpng/scripts/pngw32.def index f66d9c2..fdded74 100644 --- a/src/dep/src/irrlicht/libpng/scripts/pngw32.def +++ b/src/dep/src/irrlicht/libpng/scripts/pngw32.def @@ -5,7 +5,7 @@ LIBRARY EXPORTS -;Version 1.2.18 +;Version 1.2.32 png_build_grayscale_palette @1 png_check_sig @2 png_chunk_error @3 @@ -45,7 +45,7 @@ EXPORTS png_get_image_width @37 png_get_interlace_type @38 png_get_io_ptr @39 - png_get_libpng_ver @40 + ; png_get_libpng_ver @40 png_get_oFFs @41 png_get_pCAL @42 png_get_pHYs @43 @@ -180,7 +180,9 @@ EXPORTS png_write_init_2 @167 png_access_version_number @168 ; png_sig_bytes @169 - png_libpng_ver @170 +; Removed from version 1.2.20 +; png_libpng_ver @170 +; png_init_io @171 png_convert_to_rfc1123 @172 png_set_invalid @173 diff --git a/src/dep/src/irrlicht/os.cpp b/src/dep/src/irrlicht/os.cpp index dcb307e..5ecf59a 100644 --- a/src/dep/src/irrlicht/os.cpp +++ b/src/dep/src/irrlicht/os.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h @@ -69,9 +69,11 @@ namespace os void Printer::print(const c8* message) { #if !defined (_WIN32_WCE ) - OutputDebugString(message); - OutputDebugString("\n"); - printf("%s\n", message); + c8* tmp = new c8[strlen(message) + 2]; + sprintf(tmp, "%s\n", message); + OutputDebugString(tmp); + printf(tmp); + delete [] tmp; #endif } diff --git a/src/dep/src/irrlicht/os.h b/src/dep/src/irrlicht/os.h index 0aa9cfa..84496a3 100644 --- a/src/dep/src/irrlicht/os.h +++ b/src/dep/src/irrlicht/os.h @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2009 Nikolaus Gebhardt +// Copyright (C) 2002-2008 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h diff --git a/src/dep/src/irrlicht/wglext.h b/src/dep/src/irrlicht/wglext.h new file mode 100644 index 0000000..0286a91 --- /dev/null +++ b/src/dep/src/irrlicht/wglext.h @@ -0,0 +1,776 @@ +#ifndef __wglext_h_ +#define __wglext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2007 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +#ifndef GLAPI +#define GLAPI extern +#endif + +/*************************************************************/ + +/* Header file version number */ +/* wglext.h last updated 2008/10/07 */ +/* Current version at http://www.opengl.org/registry/ */ +#define WGL_WGLEXT_VERSION 11 + +#ifndef WGL_ARB_buffer_region +#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001 +#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002 +#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004 +#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008 +#endif + +#ifndef WGL_ARB_multisample +#define WGL_SAMPLE_BUFFERS_ARB 0x2041 +#define WGL_SAMPLES_ARB 0x2042 +#endif + +#ifndef WGL_ARB_extensions_string +#endif + +#ifndef WGL_ARB_pixel_format +#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 +#define WGL_DRAW_TO_WINDOW_ARB 0x2001 +#define WGL_DRAW_TO_BITMAP_ARB 0x2002 +#define WGL_ACCELERATION_ARB 0x2003 +#define WGL_NEED_PALETTE_ARB 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 +#define WGL_SWAP_METHOD_ARB 0x2007 +#define WGL_NUMBER_OVERLAYS_ARB 0x2008 +#define WGL_NUMBER_UNDERLAYS_ARB 0x2009 +#define WGL_TRANSPARENT_ARB 0x200A +#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 +#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 +#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 +#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A +#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B +#define WGL_SHARE_DEPTH_ARB 0x200C +#define WGL_SHARE_STENCIL_ARB 0x200D +#define WGL_SHARE_ACCUM_ARB 0x200E +#define WGL_SUPPORT_GDI_ARB 0x200F +#define WGL_SUPPORT_OPENGL_ARB 0x2010 +#define WGL_DOUBLE_BUFFER_ARB 0x2011 +#define WGL_STEREO_ARB 0x2012 +#define WGL_PIXEL_TYPE_ARB 0x2013 +#define WGL_COLOR_BITS_ARB 0x2014 +#define WGL_RED_BITS_ARB 0x2015 +#define WGL_RED_SHIFT_ARB 0x2016 +#define WGL_GREEN_BITS_ARB 0x2017 +#define WGL_GREEN_SHIFT_ARB 0x2018 +#define WGL_BLUE_BITS_ARB 0x2019 +#define WGL_BLUE_SHIFT_ARB 0x201A +#define WGL_ALPHA_BITS_ARB 0x201B +#define WGL_ALPHA_SHIFT_ARB 0x201C +#define WGL_ACCUM_BITS_ARB 0x201D +#define WGL_ACCUM_RED_BITS_ARB 0x201E +#define WGL_ACCUM_GREEN_BITS_ARB 0x201F +#define WGL_ACCUM_BLUE_BITS_ARB 0x2020 +#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 +#define WGL_DEPTH_BITS_ARB 0x2022 +#define WGL_STENCIL_BITS_ARB 0x2023 +#define WGL_AUX_BUFFERS_ARB 0x2024 +#define WGL_NO_ACCELERATION_ARB 0x2025 +#define WGL_GENERIC_ACCELERATION_ARB 0x2026 +#define WGL_FULL_ACCELERATION_ARB 0x2027 +#define WGL_SWAP_EXCHANGE_ARB 0x2028 +#define WGL_SWAP_COPY_ARB 0x2029 +#define WGL_SWAP_UNDEFINED_ARB 0x202A +#define WGL_TYPE_RGBA_ARB 0x202B +#define WGL_TYPE_COLORINDEX_ARB 0x202C +#endif + +#ifndef WGL_ARB_make_current_read +#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043 +#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054 +#endif + +#ifndef WGL_ARB_pbuffer +#define WGL_DRAW_TO_PBUFFER_ARB 0x202D +#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E +#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F +#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030 +#define WGL_PBUFFER_LARGEST_ARB 0x2033 +#define WGL_PBUFFER_WIDTH_ARB 0x2034 +#define WGL_PBUFFER_HEIGHT_ARB 0x2035 +#define WGL_PBUFFER_LOST_ARB 0x2036 +#endif + +#ifndef WGL_ARB_render_texture +#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070 +#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071 +#define WGL_TEXTURE_FORMAT_ARB 0x2072 +#define WGL_TEXTURE_TARGET_ARB 0x2073 +#define WGL_MIPMAP_TEXTURE_ARB 0x2074 +#define WGL_TEXTURE_RGB_ARB 0x2075 +#define WGL_TEXTURE_RGBA_ARB 0x2076 +#define WGL_NO_TEXTURE_ARB 0x2077 +#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078 +#define WGL_TEXTURE_1D_ARB 0x2079 +#define WGL_TEXTURE_2D_ARB 0x207A +#define WGL_MIPMAP_LEVEL_ARB 0x207B +#define WGL_CUBE_MAP_FACE_ARB 0x207C +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080 +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081 +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082 +#define WGL_FRONT_LEFT_ARB 0x2083 +#define WGL_FRONT_RIGHT_ARB 0x2084 +#define WGL_BACK_LEFT_ARB 0x2085 +#define WGL_BACK_RIGHT_ARB 0x2086 +#define WGL_AUX0_ARB 0x2087 +#define WGL_AUX1_ARB 0x2088 +#define WGL_AUX2_ARB 0x2089 +#define WGL_AUX3_ARB 0x208A +#define WGL_AUX4_ARB 0x208B +#define WGL_AUX5_ARB 0x208C +#define WGL_AUX6_ARB 0x208D +#define WGL_AUX7_ARB 0x208E +#define WGL_AUX8_ARB 0x208F +#define WGL_AUX9_ARB 0x2090 +#endif + +#ifndef WGL_ARB_pixel_format_float +#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0 +#endif + +#ifndef WGL_ARB_create_context +#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001 +#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 +#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 +#define WGL_CONTEXT_FLAGS_ARB 0x2094 +#define ERROR_INVALID_VERSION_ARB 0x2095 +#endif + +#ifndef WGL_EXT_make_current_read +#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043 +#endif + +#ifndef WGL_EXT_pixel_format +#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000 +#define WGL_DRAW_TO_WINDOW_EXT 0x2001 +#define WGL_DRAW_TO_BITMAP_EXT 0x2002 +#define WGL_ACCELERATION_EXT 0x2003 +#define WGL_NEED_PALETTE_EXT 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006 +#define WGL_SWAP_METHOD_EXT 0x2007 +#define WGL_NUMBER_OVERLAYS_EXT 0x2008 +#define WGL_NUMBER_UNDERLAYS_EXT 0x2009 +#define WGL_TRANSPARENT_EXT 0x200A +#define WGL_TRANSPARENT_VALUE_EXT 0x200B +#define WGL_SHARE_DEPTH_EXT 0x200C +#define WGL_SHARE_STENCIL_EXT 0x200D +#define WGL_SHARE_ACCUM_EXT 0x200E +#define WGL_SUPPORT_GDI_EXT 0x200F +#define WGL_SUPPORT_OPENGL_EXT 0x2010 +#define WGL_DOUBLE_BUFFER_EXT 0x2011 +#define WGL_STEREO_EXT 0x2012 +#define WGL_PIXEL_TYPE_EXT 0x2013 +#define WGL_COLOR_BITS_EXT 0x2014 +#define WGL_RED_BITS_EXT 0x2015 +#define WGL_RED_SHIFT_EXT 0x2016 +#define WGL_GREEN_BITS_EXT 0x2017 +#define WGL_GREEN_SHIFT_EXT 0x2018 +#define WGL_BLUE_BITS_EXT 0x2019 +#define WGL_BLUE_SHIFT_EXT 0x201A +#define WGL_ALPHA_BITS_EXT 0x201B +#define WGL_ALPHA_SHIFT_EXT 0x201C +#define WGL_ACCUM_BITS_EXT 0x201D +#define WGL_ACCUM_RED_BITS_EXT 0x201E +#define WGL_ACCUM_GREEN_BITS_EXT 0x201F +#define WGL_ACCUM_BLUE_BITS_EXT 0x2020 +#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021 +#define WGL_DEPTH_BITS_EXT 0x2022 +#define WGL_STENCIL_BITS_EXT 0x2023 +#define WGL_AUX_BUFFERS_EXT 0x2024 +#define WGL_NO_ACCELERATION_EXT 0x2025 +#define WGL_GENERIC_ACCELERATION_EXT 0x2026 +#define WGL_FULL_ACCELERATION_EXT 0x2027 +#define WGL_SWAP_EXCHANGE_EXT 0x2028 +#define WGL_SWAP_COPY_EXT 0x2029 +#define WGL_SWAP_UNDEFINED_EXT 0x202A +#define WGL_TYPE_RGBA_EXT 0x202B +#define WGL_TYPE_COLORINDEX_EXT 0x202C +#endif + +#ifndef WGL_EXT_pbuffer +#define WGL_DRAW_TO_PBUFFER_EXT 0x202D +#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E +#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F +#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030 +#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031 +#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032 +#define WGL_PBUFFER_LARGEST_EXT 0x2033 +#define WGL_PBUFFER_WIDTH_EXT 0x2034 +#define WGL_PBUFFER_HEIGHT_EXT 0x2035 +#endif + +#ifndef WGL_EXT_depth_float +#define WGL_DEPTH_FLOAT_EXT 0x2040 +#endif + +#ifndef WGL_3DFX_multisample +#define WGL_SAMPLE_BUFFERS_3DFX 0x2060 +#define WGL_SAMPLES_3DFX 0x2061 +#endif + +#ifndef WGL_EXT_multisample +#define WGL_SAMPLE_BUFFERS_EXT 0x2041 +#define WGL_SAMPLES_EXT 0x2042 +#endif + +#ifndef WGL_I3D_digital_video_control +#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050 +#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051 +#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052 +#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053 +#endif + +#ifndef WGL_I3D_gamma +#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E +#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F +#endif + +#ifndef WGL_I3D_genlock +#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044 +#define WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D 0x2045 +#define WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D 0x2046 +#define WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D 0x2047 +#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048 +#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049 +#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A +#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B +#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C +#endif + +#ifndef WGL_I3D_image_buffer +#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001 +#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002 +#endif + +#ifndef WGL_I3D_swap_frame_lock +#endif + +#ifndef WGL_NV_render_depth_texture +#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4 +#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5 +#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6 +#define WGL_DEPTH_COMPONENT_NV 0x20A7 +#endif + +#ifndef WGL_NV_render_texture_rectangle +#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1 +#define WGL_TEXTURE_RECTANGLE_NV 0x20A2 +#endif + +#ifndef WGL_ATI_pixel_format_float +#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0 +#endif + +#ifndef WGL_NV_float_buffer +#define WGL_FLOAT_COMPONENTS_NV 0x20B0 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4 +#define WGL_TEXTURE_FLOAT_R_NV 0x20B5 +#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6 +#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7 +#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8 +#endif + +#ifndef WGL_3DL_stereo_control +#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055 +#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056 +#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057 +#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058 +#endif + +#ifndef WGL_EXT_pixel_format_packed_float +#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8 +#endif + +#ifndef WGL_EXT_framebuffer_sRGB +#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9 +#endif + +#ifndef WGL_NV_present_video +#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0 +#endif + +#ifndef WGL_NV_video_out +#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0 +#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1 +#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2 +#define WGL_VIDEO_OUT_COLOR_NV 0x20C3 +#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4 +#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5 +#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6 +#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7 +#define WGL_VIDEO_OUT_FRAME 0x20C8 +#define WGL_VIDEO_OUT_FIELD_1 0x20C9 +#define WGL_VIDEO_OUT_FIELD_2 0x20CA +#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB +#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC +#endif + +#ifndef WGL_NV_swap_group +#endif + +#ifndef WGL_NV_gpu_affinity +#define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0 +#define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1 +#endif + + +/*************************************************************/ + +#ifndef WGL_ARB_pbuffer +DECLARE_HANDLE(HPBUFFERARB); +#endif +#ifndef WGL_EXT_pbuffer +DECLARE_HANDLE(HPBUFFEREXT); +#endif +#ifndef WGL_NV_present_video +DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV); +#endif +#ifndef WGL_NV_video_out +DECLARE_HANDLE(HPVIDEODEV); +#endif +#ifndef WGL_NV_gpu_affinity +DECLARE_HANDLE(HPGPUNV); +DECLARE_HANDLE(HGPUNV); + +typedef struct _GPU_DEVICE { + DWORD cb; + CHAR DeviceName[32]; + CHAR DeviceString[128]; + DWORD Flags; + RECT rcVirtualScreen; +} GPU_DEVICE, *PGPU_DEVICE; +#endif + +#ifndef WGL_ARB_buffer_region +#define WGL_ARB_buffer_region 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern HANDLE WINAPI wglCreateBufferRegionARB (HDC, int, UINT); +extern VOID WINAPI wglDeleteBufferRegionARB (HANDLE); +extern BOOL WINAPI wglSaveBufferRegionARB (HANDLE, int, int, int, int); +extern BOOL WINAPI wglRestoreBufferRegionARB (HANDLE, int, int, int, int, int, int); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType); +typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion); +typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height); +typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc); +#endif + +#ifndef WGL_ARB_multisample +#define WGL_ARB_multisample 1 +#endif + +#ifndef WGL_ARB_extensions_string +#define WGL_ARB_extensions_string 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern const char * WINAPI wglGetExtensionsStringARB (HDC); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc); +#endif + +#ifndef WGL_ARB_pixel_format +#define WGL_ARB_pixel_format 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetPixelFormatAttribivARB (HDC, int, int, UINT, const int *, int *); +extern BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC, int, int, UINT, const int *, FLOAT *); +extern BOOL WINAPI wglChoosePixelFormatARB (HDC, const int *, const FLOAT *, UINT, int *, UINT *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues); +typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +#endif + +#ifndef WGL_ARB_make_current_read +#define WGL_ARB_make_current_read 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglMakeContextCurrentARB (HDC, HDC, HGLRC); +extern HDC WINAPI wglGetCurrentReadDCARB (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); +typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void); +#endif + +#ifndef WGL_ARB_pbuffer +#define WGL_ARB_pbuffer 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern HPBUFFERARB WINAPI wglCreatePbufferARB (HDC, int, int, int, const int *); +extern HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB); +extern int WINAPI wglReleasePbufferDCARB (HPBUFFERARB, HDC); +extern BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB); +extern BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB, int, int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); +typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer); +typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC); +typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer); +typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue); +#endif + +#ifndef WGL_ARB_render_texture +#define WGL_ARB_render_texture 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglBindTexImageARB (HPBUFFERARB, int); +extern BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB, int); +extern BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB, const int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); +typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); +typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList); +#endif + +#ifndef WGL_ARB_pixel_format_float +#define WGL_ARB_pixel_format_float 1 +#endif + +#ifndef WGL_ARB_create_context +#define WGL_ARB_create_context 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern HGLRC WINAPI wglCreateContextAttribsARB (HDC, HGLRC, const int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList); +#endif + +#ifndef WGL_EXT_display_color_table +#define WGL_EXT_display_color_table 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort); +extern GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *, GLuint); +extern GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort); +extern VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id); +typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length); +typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id); +typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id); +#endif + +#ifndef WGL_EXT_extensions_string +#define WGL_EXT_extensions_string 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern const char * WINAPI wglGetExtensionsStringEXT (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void); +#endif + +#ifndef WGL_EXT_make_current_read +#define WGL_EXT_make_current_read 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglMakeContextCurrentEXT (HDC, HDC, HGLRC); +extern HDC WINAPI wglGetCurrentReadDCEXT (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); +typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void); +#endif + +#ifndef WGL_EXT_pbuffer +#define WGL_EXT_pbuffer 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC, int, int, int, const int *); +extern HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT); +extern int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT, HDC); +extern BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT); +extern BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT, int, int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); +typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer); +typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC); +typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer); +typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue); +#endif + +#ifndef WGL_EXT_pixel_format +#define WGL_EXT_pixel_format 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC, int, int, UINT, int *, int *); +extern BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC, int, int, UINT, int *, FLOAT *); +extern BOOL WINAPI wglChoosePixelFormatEXT (HDC, const int *, const FLOAT *, UINT, int *, UINT *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues); +typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +#endif + +#ifndef WGL_EXT_swap_control +#define WGL_EXT_swap_control 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglSwapIntervalEXT (int); +extern int WINAPI wglGetSwapIntervalEXT (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); +typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void); +#endif + +#ifndef WGL_EXT_depth_float +#define WGL_EXT_depth_float 1 +#endif + +#ifndef WGL_NV_vertex_array_range +#define WGL_NV_vertex_array_range 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern void* WINAPI wglAllocateMemoryNV (GLsizei, GLfloat, GLfloat, GLfloat); +extern void WINAPI wglFreeMemoryNV (void *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef void* (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); +typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer); +#endif + +#ifndef WGL_3DFX_multisample +#define WGL_3DFX_multisample 1 +#endif + +#ifndef WGL_EXT_multisample +#define WGL_EXT_multisample 1 +#endif + +#ifndef WGL_OML_sync_control +#define WGL_OML_sync_control 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetSyncValuesOML (HDC, INT64 *, INT64 *, INT64 *); +extern BOOL WINAPI wglGetMscRateOML (HDC, INT32 *, INT32 *); +extern INT64 WINAPI wglSwapBuffersMscOML (HDC, INT64, INT64, INT64); +extern INT64 WINAPI wglSwapLayerBuffersMscOML (HDC, int, INT64, INT64, INT64); +extern BOOL WINAPI wglWaitForMscOML (HDC, INT64, INT64, INT64, INT64 *, INT64 *, INT64 *); +extern BOOL WINAPI wglWaitForSbcOML (HDC, INT64, INT64 *, INT64 *, INT64 *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc); +typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator); +typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); +typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); +typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc); +typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc); +#endif + +#ifndef WGL_I3D_digital_video_control +#define WGL_I3D_digital_video_control 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC, int, int *); +extern BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC, int, const int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue); +typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue); +#endif + +#ifndef WGL_I3D_gamma +#define WGL_I3D_gamma 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetGammaTableParametersI3D (HDC, int, int *); +extern BOOL WINAPI wglSetGammaTableParametersI3D (HDC, int, const int *); +extern BOOL WINAPI wglGetGammaTableI3D (HDC, int, USHORT *, USHORT *, USHORT *); +extern BOOL WINAPI wglSetGammaTableI3D (HDC, int, const USHORT *, const USHORT *, const USHORT *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue); +typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue); +typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue); +typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue); +#endif + +#ifndef WGL_I3D_genlock +#define WGL_I3D_genlock 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglEnableGenlockI3D (HDC); +extern BOOL WINAPI wglDisableGenlockI3D (HDC); +extern BOOL WINAPI wglIsEnabledGenlockI3D (HDC, BOOL *); +extern BOOL WINAPI wglGenlockSourceI3D (HDC, UINT); +extern BOOL WINAPI wglGetGenlockSourceI3D (HDC, UINT *); +extern BOOL WINAPI wglGenlockSourceEdgeI3D (HDC, UINT); +extern BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC, UINT *); +extern BOOL WINAPI wglGenlockSampleRateI3D (HDC, UINT); +extern BOOL WINAPI wglGetGenlockSampleRateI3D (HDC, UINT *); +extern BOOL WINAPI wglGenlockSourceDelayI3D (HDC, UINT); +extern BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC, UINT *); +extern BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC, UINT *, UINT *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC); +typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC); +typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge); +typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay); +typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay); +#endif + +#ifndef WGL_I3D_image_buffer +#define WGL_I3D_image_buffer 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern LPVOID WINAPI wglCreateImageBufferI3D (HDC, DWORD, UINT); +extern BOOL WINAPI wglDestroyImageBufferI3D (HDC, LPVOID); +extern BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC, const HANDLE *, const LPVOID *, const DWORD *, UINT); +extern BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC, const LPVOID *, UINT); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags); +typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress); +typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count); +typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count); +#endif + +#ifndef WGL_I3D_swap_frame_lock +#define WGL_I3D_swap_frame_lock 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglEnableFrameLockI3D (void); +extern BOOL WINAPI wglDisableFrameLockI3D (void); +extern BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *); +extern BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag); +#endif + +#ifndef WGL_I3D_swap_frame_usage +#define WGL_I3D_swap_frame_usage 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetFrameUsageI3D (float *); +extern BOOL WINAPI wglBeginFrameTrackingI3D (void); +extern BOOL WINAPI wglEndFrameTrackingI3D (void); +extern BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *, DWORD *, float *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage); +typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage); +#endif + +#ifndef WGL_ATI_pixel_format_float +#define WGL_ATI_pixel_format_float 1 +#endif + +#ifndef WGL_NV_float_buffer +#define WGL_NV_float_buffer 1 +#endif + +#ifndef WGL_EXT_pixel_format_packed_float +#define WGL_EXT_pixel_format_packed_float 1 +#endif + +#ifndef WGL_EXT_framebuffer_sRGB +#define WGL_EXT_framebuffer_sRGB 1 +#endif + +#ifndef WGL_NV_present_video +#define WGL_NV_present_video 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern int WINAPI wglEnumerateVideoDevicesNV (HDC, HVIDEOOUTPUTDEVICENV *); +extern BOOL WINAPI wglBindVideoDeviceNV (HDC, unsigned int, HVIDEOOUTPUTDEVICENV, const int *); +extern BOOL WINAPI wglQueryCurrentContextNV (int, int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList); +typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList); +typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue); +#endif + +#ifndef WGL_NV_video_out +#define WGL_NV_video_out 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetVideoDeviceNV (HDC, int, HPVIDEODEV *); +extern BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV); +extern BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV, HPBUFFERARB, int); +extern BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB, int); +extern BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB, int, unsigned long *, BOOL); +extern BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV, unsigned long *, unsigned long *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice); +typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice); +typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer); +typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer); +typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock); +typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); +#endif + +#ifndef WGL_NV_swap_group +#define WGL_NV_swap_group 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglJoinSwapGroupNV (HDC, GLuint); +extern BOOL WINAPI wglBindSwapBarrierNV (GLuint, GLuint); +extern BOOL WINAPI wglQuerySwapGroupNV (HDC, GLuint *, GLuint *); +extern BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC, GLuint *, GLuint *); +extern BOOL WINAPI wglQueryFrameCountNV (HDC, GLuint *); +extern BOOL WINAPI wglResetFrameCountNV (HDC); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group); +typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier); +typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier); +typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count); +typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC); +#endif + +#ifndef WGL_NV_gpu_affinity +#define WGL_NV_gpu_affinity 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglEnumGpusNV (UINT, HGPUNV *); +extern BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV, UINT, PGPU_DEVICE); +extern HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *); +extern BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC, UINT, HGPUNV *); +extern BOOL WINAPI wglDeleteDCNV (HDC); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu); +typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice); +typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList); +typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu); +typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc); +#endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/dep/src/irrlicht/zlib/ChangeLog b/src/dep/src/irrlicht/zlib/ChangeLog index e69de29..1ac9463 100644 --- a/src/dep/src/irrlicht/zlib/ChangeLog +++ b/src/dep/src/irrlicht/zlib/ChangeLog @@ -0,0 +1,855 @@ + + ChangeLog file for zlib + +Changes in 1.2.3 (18 July 2005) +- Apply security vulnerability fixes to contrib/infback9 as well +- Clean up some text files (carriage returns, trailing space) +- Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant] + +Changes in 1.2.2.4 (11 July 2005) +- Add inflatePrime() function for starting inflation at bit boundary +- Avoid some Visual C warnings in deflate.c +- Avoid more silly Visual C warnings in inflate.c and inftrees.c for 64-bit + compile +- Fix some spelling errors in comments [Betts] +- Correct inflateInit2() error return documentation in zlib.h +- Added zran.c example of compressed data random access to examples + directory, shows use of inflatePrime() +- Fix cast for assignments to strm->state in inflate.c and infback.c +- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer] +- Move declarations of gf2 functions to right place in crc32.c [Oberhumer] +- Add cast in trees.c t avoid a warning [Oberhumer] +- Avoid some warnings in fitblk.c, gun.c, gzjoin.c in examples [Oberhumer] +- Update make_vms.com [Zinser] +- Initialize state->write in inflateReset() since copied in inflate_fast() +- Be more strict on incomplete code sets in inflate_table() and increase + ENOUGH and MAXD -- this repairs a possible security vulnerability for + invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for + discovering the vulnerability and providing test cases. +- Add ia64 support to configure for HP-UX [Smith] +- Add error return to gzread() for format or i/o error [Levin] +- Use malloc.h for OS/2 [Necasek] + +Changes in 1.2.2.3 (27 May 2005) +- Replace 1U constants in inflate.c and inftrees.c for 64-bit compile +- Typecast fread() return values in gzio.c [Vollant] +- Remove trailing space in minigzip.c outmode (VC++ can't deal with it) +- Fix crc check bug in gzread() after gzungetc() [Heiner] +- Add the deflateTune() function to adjust internal compression parameters +- Add a fast gzip decompressor, gun.c, to examples (use of inflateBack) +- Remove an incorrect assertion in examples/zpipe.c +- Add C++ wrapper in infback9.h [Donais] +- Fix bug in inflateCopy() when decoding fixed codes +- Note in zlib.h how much deflateSetDictionary() actually uses +- Remove USE_DICT_HEAD in deflate.c (would mess up inflate if used) +- Add _WIN32_WCE to define WIN32 in zconf.in.h [Spencer] +- Don't include stderr.h or errno.h for _WIN32_WCE in zutil.h [Spencer] +- Add gzdirect() function to indicate transparent reads +- Update contrib/minizip [Vollant] +- Fix compilation of deflate.c when both ASMV and FASTEST [Oberhumer] +- Add casts in crc32.c to avoid warnings [Oberhumer] +- Add contrib/masmx64 [Vollant] +- Update contrib/asm586, asm686, masmx86, testzlib, vstudio [Vollant] + +Changes in 1.2.2.2 (30 December 2004) +- Replace structure assignments in deflate.c and inflate.c with zmemcpy to + avoid implicit memcpy calls (portability for no-library compilation) +- Increase sprintf() buffer size in gzdopen() to allow for large numbers +- Add INFLATE_STRICT to check distances against zlib header +- Improve WinCE errno handling and comments [Chang] +- Remove comment about no gzip header processing in FAQ +- Add Z_FIXED strategy option to deflateInit2() to force fixed trees +- Add updated make_vms.com [Coghlan], update README +- Create a new "examples" directory, move gzappend.c there, add zpipe.c, + fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html. +- Add FAQ entry and comments in deflate.c on uninitialized memory access +- Add Solaris 9 make options in configure [Gilbert] +- Allow strerror() usage in gzio.c for STDC +- Fix DecompressBuf in contrib/delphi/ZLib.pas [ManChesTer] +- Update contrib/masmx86/inffas32.asm and gvmat32.asm [Vollant] +- Use z_off_t for adler32_combine() and crc32_combine() lengths +- Make adler32() much faster for small len +- Use OS_CODE in deflate() default gzip header + +Changes in 1.2.2.1 (31 October 2004) +- Allow inflateSetDictionary() call for raw inflate +- Fix inflate header crc check bug for file names and comments +- Add deflateSetHeader() and gz_header structure for custom gzip headers +- Add inflateGetheader() to retrieve gzip headers +- Add crc32_combine() and adler32_combine() functions +- Add alloc_func, free_func, in_func, out_func to Z_PREFIX list +- Use zstreamp consistently in zlib.h (inflate_back functions) +- Remove GUNZIP condition from definition of inflate_mode in inflate.h + and in contrib/inflate86/inffast.S [Truta, Anderson] +- Add support for AMD64 in contrib/inflate86/inffas86.c [Anderson] +- Update projects/README.projects and projects/visualc6 [Truta] +- Update win32/DLL_FAQ.txt [Truta] +- Avoid warning under NO_GZCOMPRESS in gzio.c; fix typo [Truta] +- Deprecate Z_ASCII; use Z_TEXT instead [Truta] +- Use a new algorithm for setting strm->data_type in trees.c [Truta] +- Do not define an exit() prototype in zutil.c unless DEBUG defined +- Remove prototype of exit() from zutil.c, example.c, minigzip.c [Truta] +- Add comment in zlib.h for Z_NO_FLUSH parameter to deflate() +- Fix Darwin build version identification [Peterson] + +Changes in 1.2.2 (3 October 2004) +- Update zlib.h comments on gzip in-memory processing +- Set adler to 1 in inflateReset() to support Java test suite [Walles] +- Add contrib/dotzlib [Ravn] +- Update win32/DLL_FAQ.txt [Truta] +- Update contrib/minizip [Vollant] +- Move contrib/visual-basic.txt to old/ [Truta] +- Fix assembler builds in projects/visualc6/ [Truta] + +Changes in 1.2.1.2 (9 September 2004) +- Update INDEX file +- Fix trees.c to update strm->data_type (no one ever noticed!) +- Fix bug in error case in inflate.c, infback.c, and infback9.c [Brown] +- Add "volatile" to crc table flag declaration (for DYNAMIC_CRC_TABLE) +- Add limited multitasking protection to DYNAMIC_CRC_TABLE +- Add NO_vsnprintf for VMS in zutil.h [Mozilla] +- Don't declare strerror() under VMS [Mozilla] +- Add comment to DYNAMIC_CRC_TABLE to use get_crc_table() to initialize +- Update contrib/ada [Anisimkov] +- Update contrib/minizip [Vollant] +- Fix configure to not hardcode directories for Darwin [Peterson] +- Fix gzio.c to not return error on empty files [Brown] +- Fix indentation; update version in contrib/delphi/ZLib.pas and + contrib/pascal/zlibpas.pas [Truta] +- Update mkasm.bat in contrib/masmx86 [Truta] +- Update contrib/untgz [Truta] +- Add projects/README.projects [Truta] +- Add project for MS Visual C++ 6.0 in projects/visualc6 [Cadieux, Truta] +- Update win32/DLL_FAQ.txt [Truta] +- Update list of Z_PREFIX symbols in zconf.h [Randers-Pehrson, Truta] +- Remove an unnecessary assignment to curr in inftrees.c [Truta] +- Add OS/2 to exe builds in configure [Poltorak] +- Remove err dummy parameter in zlib.h [Kientzle] + +Changes in 1.2.1.1 (9 January 2004) +- Update email address in README +- Several FAQ updates +- Fix a big fat bug in inftrees.c that prevented decoding valid + dynamic blocks with only literals and no distance codes -- + Thanks to "Hot Emu" for the bug report and sample file +- Add a note to puff.c on no distance codes case. + +Changes in 1.2.1 (17 November 2003) +- Remove a tab in contrib/gzappend/gzappend.c +- Update some interfaces in contrib for new zlib functions +- Update zlib version number in some contrib entries +- Add Windows CE definition for ptrdiff_t in zutil.h [Mai, Truta] +- Support shared libraries on Hurd and KFreeBSD [Brown] +- Fix error in NO_DIVIDE option of adler32.c + +Changes in 1.2.0.8 (4 November 2003) +- Update version in contrib/delphi/ZLib.pas and contrib/pascal/zlibpas.pas +- Add experimental NO_DIVIDE #define in adler32.c + - Possibly faster on some processors (let me know if it is) +- Correct Z_BLOCK to not return on first inflate call if no wrap +- Fix strm->data_type on inflate() return to correctly indicate EOB +- Add deflatePrime() function for appending in the middle of a byte +- Add contrib/gzappend for an example of appending to a stream +- Update win32/DLL_FAQ.txt [Truta] +- Delete Turbo C comment in README [Truta] +- Improve some indentation in zconf.h [Truta] +- Fix infinite loop on bad input in configure script [Church] +- Fix gzeof() for concatenated gzip files [Johnson] +- Add example to contrib/visual-basic.txt [Michael B.] +- Add -p to mkdir's in Makefile.in [vda] +- Fix configure to properly detect presence or lack of printf functions +- Add AS400 support [Monnerat] +- Add a little Cygwin support [Wilson] + +Changes in 1.2.0.7 (21 September 2003) +- Correct some debug formats in contrib/infback9 +- Cast a type in a debug statement in trees.c +- Change search and replace delimiter in configure from % to # [Beebe] +- Update contrib/untgz to 0.2 with various fixes [Truta] +- Add build support for Amiga [Nikl] +- Remove some directories in old that have been updated to 1.2 +- Add dylib building for Mac OS X in configure and Makefile.in +- Remove old distribution stuff from Makefile +- Update README to point to DLL_FAQ.txt, and add comment on Mac OS X +- Update links in README + +Changes in 1.2.0.6 (13 September 2003) +- Minor FAQ updates +- Update contrib/minizip to 1.00 [Vollant] +- Remove test of gz functions in example.c when GZ_COMPRESS defined [Truta] +- Update POSTINC comment for 68060 [Nikl] +- Add contrib/infback9 with deflate64 decoding (unsupported) +- For MVS define NO_vsnprintf and undefine FAR [van Burik] +- Add pragma for fdopen on MVS [van Burik] + +Changes in 1.2.0.5 (8 September 2003) +- Add OF to inflateBackEnd() declaration in zlib.h +- Remember start when using gzdopen in the middle of a file +- Use internal off_t counters in gz* functions to properly handle seeks +- Perform more rigorous check for distance-too-far in inffast.c +- Add Z_BLOCK flush option to return from inflate at block boundary +- Set strm->data_type on return from inflate + - Indicate bits unused, if at block boundary, and if in last block +- Replace size_t with ptrdiff_t in crc32.c, and check for correct size +- Add condition so old NO_DEFLATE define still works for compatibility +- FAQ update regarding the Windows DLL [Truta] +- INDEX update: add qnx entry, remove aix entry [Truta] +- Install zlib.3 into mandir [Wilson] +- Move contrib/zlib_dll_FAQ.txt to win32/DLL_FAQ.txt; update [Truta] +- Adapt the zlib interface to the new DLL convention guidelines [Truta] +- Introduce ZLIB_WINAPI macro to allow the export of functions using + the WINAPI calling convention, for Visual Basic [Vollant, Truta] +- Update msdos and win32 scripts and makefiles [Truta] +- Export symbols by name, not by ordinal, in win32/zlib.def [Truta] +- Add contrib/ada [Anisimkov] +- Move asm files from contrib/vstudio/vc70_32 to contrib/asm386 [Truta] +- Rename contrib/asm386 to contrib/masmx86 [Truta, Vollant] +- Add contrib/masm686 [Truta] +- Fix offsets in contrib/inflate86 and contrib/masmx86/inffas32.asm + [Truta, Vollant] +- Update contrib/delphi; rename to contrib/pascal; add example [Truta] +- Remove contrib/delphi2; add a new contrib/delphi [Truta] +- Avoid inclusion of the nonstandard in contrib/iostream, + and fix some method prototypes [Truta] +- Fix the ZCR_SEED2 constant to avoid warnings in contrib/minizip + [Truta] +- Avoid the use of backslash (\) in contrib/minizip [Vollant] +- Fix file time handling in contrib/untgz; update makefiles [Truta] +- Update contrib/vstudio/vc70_32 to comply with the new DLL guidelines + [Vollant] +- Remove contrib/vstudio/vc15_16 [Vollant] +- Rename contrib/vstudio/vc70_32 to contrib/vstudio/vc7 [Truta] +- Update README.contrib [Truta] +- Invert the assignment order of match_head and s->prev[...] in + INSERT_STRING [Truta] +- Compare TOO_FAR with 32767 instead of 32768, to avoid 16-bit warnings + [Truta] +- Compare function pointers with 0, not with NULL or Z_NULL [Truta] +- Fix prototype of syncsearch in inflate.c [Truta] +- Introduce ASMINF macro to be enabled when using an ASM implementation + of inflate_fast [Truta] +- Change NO_DEFLATE to NO_GZCOMPRESS [Truta] +- Modify test_gzio in example.c to take a single file name as a + parameter [Truta] +- Exit the example.c program if gzopen fails [Truta] +- Add type casts around strlen in example.c [Truta] +- Remove casting to sizeof in minigzip.c; give a proper type + to the variable compared with SUFFIX_LEN [Truta] +- Update definitions of STDC and STDC99 in zconf.h [Truta] +- Synchronize zconf.h with the new Windows DLL interface [Truta] +- Use SYS16BIT instead of __32BIT__ to distinguish between + 16- and 32-bit platforms [Truta] +- Use far memory allocators in small 16-bit memory models for + Turbo C [Truta] +- Add info about the use of ASMV, ASMINF and ZLIB_WINAPI in + zlibCompileFlags [Truta] +- Cygwin has vsnprintf [Wilson] +- In Windows16, OS_CODE is 0, as in MSDOS [Truta] +- In Cygwin, OS_CODE is 3 (Unix), not 11 (Windows32) [Wilson] + +Changes in 1.2.0.4 (10 August 2003) +- Minor FAQ updates +- Be more strict when checking inflateInit2's windowBits parameter +- Change NO_GUNZIP compile option to NO_GZIP to cover deflate as well +- Add gzip wrapper option to deflateInit2 using windowBits +- Add updated QNX rule in configure and qnx directory [Bonnefoy] +- Make inflate distance-too-far checks more rigorous +- Clean up FAR usage in inflate +- Add casting to sizeof() in gzio.c and minigzip.c + +Changes in 1.2.0.3 (19 July 2003) +- Fix silly error in gzungetc() implementation [Vollant] +- Update contrib/minizip and contrib/vstudio [Vollant] +- Fix printf format in example.c +- Correct cdecl support in zconf.in.h [Anisimkov] +- Minor FAQ updates + +Changes in 1.2.0.2 (13 July 2003) +- Add ZLIB_VERNUM in zlib.h for numerical preprocessor comparisons +- Attempt to avoid warnings in crc32.c for pointer-int conversion +- Add AIX to configure, remove aix directory [Bakker] +- Add some casts to minigzip.c +- Improve checking after insecure sprintf() or vsprintf() calls +- Remove #elif's from crc32.c +- Change leave label to inf_leave in inflate.c and infback.c to avoid + library conflicts +- Remove inflate gzip decoding by default--only enable gzip decoding by + special request for stricter backward compatibility +- Add zlibCompileFlags() function to return compilation information +- More typecasting in deflate.c to avoid warnings +- Remove leading underscore from _Capital #defines [Truta] +- Fix configure to link shared library when testing +- Add some Windows CE target adjustments [Mai] +- Remove #define ZLIB_DLL in zconf.h [Vollant] +- Add zlib.3 [Rodgers] +- Update RFC URL in deflate.c and algorithm.txt [Mai] +- Add zlib_dll_FAQ.txt to contrib [Truta] +- Add UL to some constants [Truta] +- Update minizip and vstudio [Vollant] +- Remove vestigial NEED_DUMMY_RETURN from zconf.in.h +- Expand use of NO_DUMMY_DECL to avoid all dummy structures +- Added iostream3 to contrib [Schwardt] +- Replace rewind() with fseek() for WinCE [Truta] +- Improve setting of zlib format compression level flags + - Report 0 for huffman and rle strategies and for level == 0 or 1 + - Report 2 only for level == 6 +- Only deal with 64K limit when necessary at compile time [Truta] +- Allow TOO_FAR check to be turned off at compile time [Truta] +- Add gzclearerr() function [Souza] +- Add gzungetc() function + +Changes in 1.2.0.1 (17 March 2003) +- Add Z_RLE strategy for run-length encoding [Truta] + - When Z_RLE requested, restrict matches to distance one + - Update zlib.h, minigzip.c, gzopen(), gzdopen() for Z_RLE +- Correct FASTEST compilation to allow level == 0 +- Clean up what gets compiled for FASTEST +- Incorporate changes to zconf.in.h [Vollant] + - Refine detection of Turbo C need for dummy returns + - Refine ZLIB_DLL compilation + - Include additional header file on VMS for off_t typedef +- Try to use _vsnprintf where it supplants vsprintf [Vollant] +- Add some casts in inffast.c +- Enchance comments in zlib.h on what happens if gzprintf() tries to + write more than 4095 bytes before compression +- Remove unused state from inflateBackEnd() +- Remove exit(0) from minigzip.c, example.c +- Get rid of all those darn tabs +- Add "check" target to Makefile.in that does the same thing as "test" +- Add "mostlyclean" and "maintainer-clean" targets to Makefile.in +- Update contrib/inflate86 [Anderson] +- Update contrib/testzlib, contrib/vstudio, contrib/minizip [Vollant] +- Add msdos and win32 directories with makefiles [Truta] +- More additions and improvements to the FAQ + +Changes in 1.2.0 (9 March 2003) +- New and improved inflate code + - About 20% faster + - Does not allocate 32K window unless and until needed + - Automatically detects and decompresses gzip streams + - Raw inflate no longer needs an extra dummy byte at end + - Added inflateBack functions using a callback interface--even faster + than inflate, useful for file utilities (gzip, zip) + - Added inflateCopy() function to record state for random access on + externally generated deflate streams (e.g. in gzip files) + - More readable code (I hope) +- New and improved crc32() + - About 50% faster, thanks to suggestions from Rodney Brown +- Add deflateBound() and compressBound() functions +- Fix memory leak in deflateInit2() +- Permit setting dictionary for raw deflate (for parallel deflate) +- Fix const declaration for gzwrite() +- Check for some malloc() failures in gzio.c +- Fix bug in gzopen() on single-byte file 0x1f +- Fix bug in gzread() on concatenated file with 0x1f at end of buffer + and next buffer doesn't start with 0x8b +- Fix uncompress() to return Z_DATA_ERROR on truncated input +- Free memory at end of example.c +- Remove MAX #define in trees.c (conflicted with some libraries) +- Fix static const's in deflate.c, gzio.c, and zutil.[ch] +- Declare malloc() and free() in gzio.c if STDC not defined +- Use malloc() instead of calloc() in zutil.c if int big enough +- Define STDC for AIX +- Add aix/ with approach for compiling shared library on AIX +- Add HP-UX support for shared libraries in configure +- Add OpenUNIX support for shared libraries in configure +- Use $cc instead of gcc to build shared library +- Make prefix directory if needed when installing +- Correct Macintosh avoidance of typedef Byte in zconf.h +- Correct Turbo C memory allocation when under Linux +- Use libz.a instead of -lz in Makefile (assure use of compiled library) +- Update configure to check for snprintf or vsnprintf functions and their + return value, warn during make if using an insecure function +- Fix configure problem with compile-time knowledge of HAVE_UNISTD_H that + is lost when library is used--resolution is to build new zconf.h +- Documentation improvements (in zlib.h): + - Document raw deflate and inflate + - Update RFCs URL + - Point out that zlib and gzip formats are different + - Note that Z_BUF_ERROR is not fatal + - Document string limit for gzprintf() and possible buffer overflow + - Note requirement on avail_out when flushing + - Note permitted values of flush parameter of inflate() +- Add some FAQs (and even answers) to the FAQ +- Add contrib/inflate86/ for x86 faster inflate +- Add contrib/blast/ for PKWare Data Compression Library decompression +- Add contrib/puff/ simple inflate for deflate format description + +Changes in 1.1.4 (11 March 2002) +- ZFREE was repeated on same allocation on some error conditions. + This creates a security problem described in + http://www.zlib.org/advisory-2002-03-11.txt +- Returned incorrect error (Z_MEM_ERROR) on some invalid data +- Avoid accesses before window for invalid distances with inflate window + less than 32K. +- force windowBits > 8 to avoid a bug in the encoder for a window size + of 256 bytes. (A complete fix will be available in 1.1.5). + +Changes in 1.1.3 (9 July 1998) +- fix "an inflate input buffer bug that shows up on rare but persistent + occasions" (Mark) +- fix gzread and gztell for concatenated .gz files (Didier Le Botlan) +- fix gzseek(..., SEEK_SET) in write mode +- fix crc check after a gzeek (Frank Faubert) +- fix miniunzip when the last entry in a zip file is itself a zip file + (J Lillge) +- add contrib/asm586 and contrib/asm686 (Brian Raiter) + See http://www.muppetlabs.com/~breadbox/software/assembly.html +- add support for Delphi 3 in contrib/delphi (Bob Dellaca) +- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti) +- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren) +- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks) +- added a FAQ file + +- Support gzdopen on Mac with Metrowerks (Jason Linhart) +- Do not redefine Byte on Mac (Brad Pettit & Jason Linhart) +- define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young) +- avoid some warnings with Borland C (Tom Tanner) +- fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant) +- emulate utime() for WIN32 in contrib/untgz (Gilles Vollant) +- allow several arguments to configure (Tim Mooney, Frodo Looijaard) +- use libdir and includedir in Makefile.in (Tim Mooney) +- support shared libraries on OSF1 V4 (Tim Mooney) +- remove so_locations in "make clean" (Tim Mooney) +- fix maketree.c compilation error (Glenn, Mark) +- Python interface to zlib now in Python 1.5 (Jeremy Hylton) +- new Makefile.riscos (Rich Walker) +- initialize static descriptors in trees.c for embedded targets (Nick Smith) +- use "foo-gz" in example.c for RISCOS and VMS (Nick Smith) +- add the OS/2 files in Makefile.in too (Andrew Zabolotny) +- fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane) +- fix maketree.c to allow clean compilation of inffixed.h (Mark) +- fix parameter check in deflateCopy (Gunther Nikl) +- cleanup trees.c, use compressed_len only in debug mode (Christian Spieler) +- Many portability patches by Christian Spieler: + . zutil.c, zutil.h: added "const" for zmem* + . Make_vms.com: fixed some typos + . Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists + . msdos/Makefile.msc: remove "default rtl link library" info from obj files + . msdos/Makefile.*: use model-dependent name for the built zlib library + . msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc: + new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT) +- use define instead of typedef for Bytef also for MSC small/medium (Tom Lane) +- replace __far with _far for better portability (Christian Spieler, Tom Lane) +- fix test for errno.h in configure (Tim Newsham) + +Changes in 1.1.2 (19 March 98) +- added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant) + See http://www.winimage.com/zLibDll/unzip.html +- preinitialize the inflate tables for fixed codes, to make the code + completely thread safe (Mark) +- some simplifications and slight speed-up to the inflate code (Mark) +- fix gzeof on non-compressed files (Allan Schrum) +- add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs) +- use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn) +- added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny) +- add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori) +- do not wrap extern "C" around system includes (Tom Lane) +- mention zlib binding for TCL in README (Andreas Kupries) +- added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert) +- allow "make install prefix=..." even after configure (Glenn Randers-Pehrson) +- allow "configure --prefix $HOME" (Tim Mooney) +- remove warnings in example.c and gzio.c (Glenn Randers-Pehrson) +- move Makefile.sas to amiga/Makefile.sas + +Changes in 1.1.1 (27 Feb 98) +- fix macros _tr_tally_* in deflate.h for debug mode (Glenn Randers-Pehrson) +- remove block truncation heuristic which had very marginal effect for zlib + (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the + compression ratio on some files. This also allows inlining _tr_tally for + matches in deflate_slow. +- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier) + +Changes in 1.1.0 (24 Feb 98) +- do not return STREAM_END prematurely in inflate (John Bowler) +- revert to the zlib 1.0.8 inflate to avoid the gcc 2.8.0 bug (Jeremy Buhler) +- compile with -DFASTEST to get compression code optimized for speed only +- in minigzip, try mmap'ing the input file first (Miguel Albrecht) +- increase size of I/O buffers in minigzip.c and gzio.c (not a big gain + on Sun but significant on HP) + +- add a pointer to experimental unzip library in README (Gilles Vollant) +- initialize variable gcc in configure (Chris Herborth) + +Changes in 1.0.9 (17 Feb 1998) +- added gzputs and gzgets functions +- do not clear eof flag in gzseek (Mark Diekhans) +- fix gzseek for files in transparent mode (Mark Diekhans) +- do not assume that vsprintf returns the number of bytes written (Jens Krinke) +- replace EXPORT with ZEXPORT to avoid conflict with other programs +- added compress2 in zconf.h, zlib.def, zlib.dnt +- new asm code from Gilles Vollant in contrib/asm386 +- simplify the inflate code (Mark): + . Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new() + . ZALLOC the length list in inflate_trees_fixed() instead of using stack + . ZALLOC the value area for huft_build() instead of using stack + . Simplify Z_FINISH check in inflate() + +- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8 +- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi) +- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with + the declaration of FAR (Gilles VOllant) +- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann) +- read_buf buf parameter of type Bytef* instead of charf* +- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout) +- do not redeclare unlink in minigzip.c for WIN32 (John Bowler) +- fix check for presence of directories in "make install" (Ian Willis) + +Changes in 1.0.8 (27 Jan 1998) +- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant) +- fix gzgetc and gzputc for big endian systems (Markus Oberhumer) +- added compress2() to allow setting the compression level +- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong) +- use constant arrays for the static trees in trees.c instead of computing + them at run time (thanks to Ken Raeburn for this suggestion). To create + trees.h, compile with GEN_TREES_H and run "make test". +- check return code of example in "make test" and display result +- pass minigzip command line options to file_compress +- simplifying code of inflateSync to avoid gcc 2.8 bug + +- support CC="gcc -Wall" in configure -s (QingLong) +- avoid a flush caused by ftell in gzopen for write mode (Ken Raeburn) +- fix test for shared library support to avoid compiler warnings +- zlib.lib -> zlib.dll in msdos/zlib.rc (Gilles Vollant) +- check for TARGET_OS_MAC in addition to MACOS (Brad Pettit) +- do not use fdopen for Metrowerks on Mac (Brad Pettit)) +- add checks for gzputc and gzputc in example.c +- avoid warnings in gzio.c and deflate.c (Andreas Kleinert) +- use const for the CRC table (Ken Raeburn) +- fixed "make uninstall" for shared libraries +- use Tracev instead of Trace in infblock.c +- in example.c use correct compressed length for test_sync +- suppress +vnocompatwarnings in configure for HPUX (not always supported) + +Changes in 1.0.7 (20 Jan 1998) +- fix gzseek which was broken in write mode +- return error for gzseek to negative absolute position +- fix configure for Linux (Chun-Chung Chen) +- increase stack space for MSC (Tim Wegner) +- get_crc_table and inflateSyncPoint are EXPORTed (Gilles Vollant) +- define EXPORTVA for gzprintf (Gilles Vollant) +- added man page zlib.3 (Rick Rodgers) +- for contrib/untgz, fix makedir() and improve Makefile + +- check gzseek in write mode in example.c +- allocate extra buffer for seeks only if gzseek is actually called +- avoid signed/unsigned comparisons (Tim Wegner, Gilles Vollant) +- add inflateSyncPoint in zconf.h +- fix list of exported functions in nt/zlib.dnt and mdsos/zlib.def + +Changes in 1.0.6 (19 Jan 1998) +- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and + gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code) +- Fix a deflate bug occurring only with compression level 0 (thanks to + Andy Buckler for finding this one). +- In minigzip, pass transparently also the first byte for .Z files. +- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress() +- check Z_FINISH in inflate (thanks to Marc Schluper) +- Implement deflateCopy (thanks to Adam Costello) +- make static libraries by default in configure, add --shared option. +- move MSDOS or Windows specific files to directory msdos +- suppress the notion of partial flush to simplify the interface + (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4) +- suppress history buffer provided by application to simplify the interface + (this feature was not implemented anyway in 1.0.4) +- next_in and avail_in must be initialized before calling inflateInit or + inflateInit2 +- add EXPORT in all exported functions (for Windows DLL) +- added Makefile.nt (thanks to Stephen Williams) +- added the unsupported "contrib" directory: + contrib/asm386/ by Gilles Vollant + 386 asm code replacing longest_match(). + contrib/iostream/ by Kevin Ruland + A C++ I/O streams interface to the zlib gz* functions + contrib/iostream2/ by Tyge Løvset + Another C++ I/O streams interface + contrib/untgz/ by "Pedro A. Aranda Guti\irrez" + A very simple tar.gz file extractor using zlib + contrib/visual-basic.txt by Carlos Rios + How to use compress(), uncompress() and the gz* functions from VB. +- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression + level) in minigzip (thanks to Tom Lane) + +- use const for rommable constants in deflate +- added test for gzseek and gztell in example.c +- add undocumented function inflateSyncPoint() (hack for Paul Mackerras) +- add undocumented function zError to convert error code to string + (for Tim Smithers) +- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code. +- Use default memcpy for Symantec MSDOS compiler. +- Add EXPORT keyword for check_func (needed for Windows DLL) +- add current directory to LD_LIBRARY_PATH for "make test" +- create also a link for libz.so.1 +- added support for FUJITSU UXP/DS (thanks to Toshiaki Nomura) +- use $(SHAREDLIB) instead of libz.so in Makefile.in (for HPUX) +- added -soname for Linux in configure (Chun-Chung Chen, +- assign numbers to the exported functions in zlib.def (for Windows DLL) +- add advice in zlib.h for best usage of deflateSetDictionary +- work around compiler bug on Atari (cast Z_NULL in call of s->checkfn) +- allow compilation with ANSI keywords only enabled for TurboC in large model +- avoid "versionString"[0] (Borland bug) +- add NEED_DUMMY_RETURN for Borland +- use variable z_verbose for tracing in debug mode (L. Peter Deutsch). +- allow compilation with CC +- defined STDC for OS/2 (David Charlap) +- limit external names to 8 chars for MVS (Thomas Lund) +- in minigzip.c, use static buffers only for 16-bit systems +- fix suffix check for "minigzip -d foo.gz" +- do not return an error for the 2nd of two consecutive gzflush() (Felix Lee) +- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau) +- added makelcc.bat for lcc-win32 (Tom St Denis) +- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe) +- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion. +- check for unistd.h in configure (for off_t) +- remove useless check parameter in inflate_blocks_free +- avoid useless assignment of s->check to itself in inflate_blocks_new +- do not flush twice in gzclose (thanks to Ken Raeburn) +- rename FOPEN as F_OPEN to avoid clash with /usr/include/sys/file.h +- use NO_ERRNO_H instead of enumeration of operating systems with errno.h +- work around buggy fclose on pipes for HP/UX +- support zlib DLL with BORLAND C++ 5.0 (thanks to Glenn Randers-Pehrson) +- fix configure if CC is already equal to gcc + +Changes in 1.0.5 (3 Jan 98) +- Fix inflate to terminate gracefully when fed corrupted or invalid data +- Use const for rommable constants in inflate +- Eliminate memory leaks on error conditions in inflate +- Removed some vestigial code in inflate +- Update web address in README + +Changes in 1.0.4 (24 Jul 96) +- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF + bit, so the decompressor could decompress all the correct data but went + on to attempt decompressing extra garbage data. This affected minigzip too. +- zlibVersion and gzerror return const char* (needed for DLL) +- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno) +- use z_error only for DEBUG (avoid problem with DLLs) + +Changes in 1.0.3 (2 Jul 96) +- use z_streamp instead of z_stream *, which is now a far pointer in MSDOS + small and medium models; this makes the library incompatible with previous + versions for these models. (No effect in large model or on other systems.) +- return OK instead of BUF_ERROR if previous deflate call returned with + avail_out as zero but there is nothing to do +- added memcmp for non STDC compilers +- define NO_DUMMY_DECL for more Mac compilers (.h files merged incorrectly) +- define __32BIT__ if __386__ or i386 is defined (pb. with Watcom and SCO) +- better check for 16-bit mode MSC (avoids problem with Symantec) + +Changes in 1.0.2 (23 May 96) +- added Windows DLL support +- added a function zlibVersion (for the DLL support) +- fixed declarations using Bytef in infutil.c (pb with MSDOS medium model) +- Bytef is define's instead of typedef'd only for Borland C +- avoid reading uninitialized memory in example.c +- mention in README that the zlib format is now RFC1950 +- updated Makefile.dj2 +- added algorithm.doc + +Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion] +- fix array overlay in deflate.c which sometimes caused bad compressed data +- fix inflate bug with empty stored block +- fix MSDOS medium model which was broken in 0.99 +- fix deflateParams() which could generated bad compressed data. +- Bytef is define'd instead of typedef'ed (work around Borland bug) +- added an INDEX file +- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32), + Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas) +- speed up adler32 for modern machines without auto-increment +- added -ansi for IRIX in configure +- static_init_done in trees.c is an int +- define unlink as delete for VMS +- fix configure for QNX +- add configure branch for SCO and HPUX +- avoid many warnings (unused variables, dead assignments, etc...) +- no fdopen for BeOS +- fix the Watcom fix for 32 bit mode (define FAR as empty) +- removed redefinition of Byte for MKWERKS +- work around an MWKERKS bug (incorrect merge of all .h files) + +Changes in 0.99 (27 Jan 96) +- allow preset dictionary shared between compressor and decompressor +- allow compression level 0 (no compression) +- add deflateParams in zlib.h: allow dynamic change of compression level + and compression strategy. +- test large buffers and deflateParams in example.c +- add optional "configure" to build zlib as a shared library +- suppress Makefile.qnx, use configure instead +- fixed deflate for 64-bit systems (detected on Cray) +- fixed inflate_blocks for 64-bit systems (detected on Alpha) +- declare Z_DEFLATED in zlib.h (possible parameter for deflateInit2) +- always return Z_BUF_ERROR when deflate() has nothing to do +- deflateInit and inflateInit are now macros to allow version checking +- prefix all global functions and types with z_ with -DZ_PREFIX +- make falloc completely reentrant (inftrees.c) +- fixed very unlikely race condition in ct_static_init +- free in reverse order of allocation to help memory manager +- use zlib-1.0/* instead of zlib/* inside the tar.gz +- make zlib warning-free with "gcc -O3 -Wall -Wwrite-strings -Wpointer-arith + -Wconversion -Wstrict-prototypes -Wmissing-prototypes" +- allow gzread on concatenated .gz files +- deflateEnd now returns Z_DATA_ERROR if it was premature +- deflate is finally (?) fully deterministic (no matches beyond end of input) +- Document Z_SYNC_FLUSH +- add uninstall in Makefile +- Check for __cpluplus in zlib.h +- Better test in ct_align for partial flush +- avoid harmless warnings for Borland C++ +- initialize hash_head in deflate.c +- avoid warning on fdopen (gzio.c) for HP cc -Aa +- include stdlib.h for STDC compilers +- include errno.h for Cray +- ignore error if ranlib doesn't exist +- call ranlib twice for NeXTSTEP +- use exec_prefix instead of prefix for libz.a +- renamed ct_* as _tr_* to avoid conflict with applications +- clear z->msg in inflateInit2 before any error return +- initialize opaque in example.c, gzio.c, deflate.c and inflate.c +- fixed typo in zconf.h (_GNUC__ => __GNUC__) +- check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode) +- fix typo in Make_vms.com (f$trnlnm -> f$getsyi) +- in fcalloc, normalize pointer if size > 65520 bytes +- don't use special fcalloc for 32 bit Borland C++ +- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc... +- use Z_BINARY instead of BINARY +- document that gzclose after gzdopen will close the file +- allow "a" as mode in gzopen. +- fix error checking in gzread +- allow skipping .gz extra-field on pipes +- added reference to Perl interface in README +- put the crc table in FAR data (I dislike more and more the medium model :) +- added get_crc_table +- added a dimension to all arrays (Borland C can't count). +- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast +- guard against multiple inclusion of *.h (for precompiled header on Mac) +- Watcom C pretends to be Microsoft C small model even in 32 bit mode. +- don't use unsized arrays to avoid silly warnings by Visual C++: + warning C4746: 'inflate_mask' : unsized array treated as '__far' + (what's wrong with far data in far model?). +- define enum out of inflate_blocks_state to allow compilation with C++ + +Changes in 0.95 (16 Aug 95) +- fix MSDOS small and medium model (now easier to adapt to any compiler) +- inlined send_bits +- fix the final (:-) bug for deflate with flush (output was correct but + not completely flushed in rare occasions). +- default window size is same for compression and decompression + (it's now sufficient to set MAX_WBITS in zconf.h). +- voidp -> voidpf and voidnp -> voidp (for consistency with other + typedefs and because voidnp was not near in large model). + +Changes in 0.94 (13 Aug 95) +- support MSDOS medium model +- fix deflate with flush (could sometimes generate bad output) +- fix deflateReset (zlib header was incorrectly suppressed) +- added support for VMS +- allow a compression level in gzopen() +- gzflush now calls fflush +- For deflate with flush, flush even if no more input is provided. +- rename libgz.a as libz.a +- avoid complex expression in infcodes.c triggering Turbo C bug +- work around a problem with gcc on Alpha (in INSERT_STRING) +- don't use inline functions (problem with some gcc versions) +- allow renaming of Byte, uInt, etc... with #define. +- avoid warning about (unused) pointer before start of array in deflate.c +- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c +- avoid reserved word 'new' in trees.c + +Changes in 0.93 (25 June 95) +- temporarily disable inline functions +- make deflate deterministic +- give enough lookahead for PARTIAL_FLUSH +- Set binary mode for stdin/stdout in minigzip.c for OS/2 +- don't even use signed char in inflate (not portable enough) +- fix inflate memory leak for segmented architectures + +Changes in 0.92 (3 May 95) +- don't assume that char is signed (problem on SGI) +- Clear bit buffer when starting a stored block +- no memcpy on Pyramid +- suppressed inftest.c +- optimized fill_window, put longest_match inline for gcc +- optimized inflate on stored blocks. +- untabify all sources to simplify patches + +Changes in 0.91 (2 May 95) +- Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h +- Document the memory requirements in zconf.h +- added "make install" +- fix sync search logic in inflateSync +- deflate(Z_FULL_FLUSH) now works even if output buffer too short +- after inflateSync, don't scare people with just "lo world" +- added support for DJGPP + +Changes in 0.9 (1 May 95) +- don't assume that zalloc clears the allocated memory (the TurboC bug + was Mark's bug after all :) +- let again gzread copy uncompressed data unchanged (was working in 0.71) +- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented +- added a test of inflateSync in example.c +- moved MAX_WBITS to zconf.h because users might want to change that. +- document explicitly that zalloc(64K) on MSDOS must return a normalized + pointer (zero offset) +- added Makefiles for Microsoft C, Turbo C, Borland C++ +- faster crc32() + +Changes in 0.8 (29 April 95) +- added fast inflate (inffast.c) +- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this + is incompatible with previous versions of zlib which returned Z_OK. +- work around a TurboC compiler bug (bad code for b << 0, see infutil.h) + (actually that was not a compiler bug, see 0.81 above) +- gzread no longer reads one extra byte in certain cases +- In gzio destroy(), don't reference a freed structure +- avoid many warnings for MSDOS +- avoid the ERROR symbol which is used by MS Windows + +Changes in 0.71 (14 April 95) +- Fixed more MSDOS compilation problems :( There is still a bug with + TurboC large model. + +Changes in 0.7 (14 April 95) +- Added full inflate support. +- Simplified the crc32() interface. The pre- and post-conditioning + (one's complement) is now done inside crc32(). WARNING: this is + incompatible with previous versions; see zlib.h for the new usage. + +Changes in 0.61 (12 April 95) +- workaround for a bug in TurboC. example and minigzip now work on MSDOS. + +Changes in 0.6 (11 April 95) +- added minigzip.c +- added gzdopen to reopen a file descriptor as gzFile +- added transparent reading of non-gziped files in gzread. +- fixed bug in gzread (don't read crc as data) +- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose). +- don't allocate big arrays in the stack (for MSDOS) +- fix some MSDOS compilation problems + +Changes in 0.5: +- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but + not yet Z_FULL_FLUSH. +- support decompression but only in a single step (forced Z_FINISH) +- added opaque object for zalloc and zfree. +- added deflateReset and inflateReset +- added a variable zlib_version for consistency checking. +- renamed the 'filter' parameter of deflateInit2 as 'strategy'. + Added Z_FILTERED and Z_HUFFMAN_ONLY constants. + +Changes in 0.4: +- avoid "zip" everywhere, use zlib instead of ziplib. +- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush + if compression method == 8. +- added adler32 and crc32 +- renamed deflateOptions as deflateInit2, call one or the other but not both +- added the method parameter for deflateInit2. +- added inflateInit2 +- simplied considerably deflateInit and inflateInit by not supporting + user-provided history buffer. This is supported only in deflateInit2 + and inflateInit2. + +Changes in 0.3: +- prefix all macro names with Z_ +- use Z_FINISH instead of deflateEnd to finish compression. +- added Z_HUFFMAN_ONLY +- added gzerror() diff --git a/src/dep/src/irrlicht/zlib/FAQ b/src/dep/src/irrlicht/zlib/FAQ index e69de29..15d0436 100644 --- a/src/dep/src/irrlicht/zlib/FAQ +++ b/src/dep/src/irrlicht/zlib/FAQ @@ -0,0 +1,339 @@ + + Frequently Asked Questions about zlib + + +If your question is not there, please check the zlib home page +http://www.zlib.org which may have more recent information. +The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html + + + 1. Is zlib Y2K-compliant? + + Yes. zlib doesn't handle dates. + + 2. Where can I get a Windows DLL version? + + The zlib sources can be compiled without change to produce a DLL. + See the file win32/DLL_FAQ.txt in the zlib distribution. + Pointers to the precompiled DLL are found in the zlib web site at + http://www.zlib.org. + + 3. Where can I get a Visual Basic interface to zlib? + + See + * http://www.dogma.net/markn/articles/zlibtool/zlibtool.htm + * contrib/visual-basic.txt in the zlib distribution + * win32/DLL_FAQ.txt in the zlib distribution + + 4. compress() returns Z_BUF_ERROR. + + Make sure that before the call of compress, the length of the compressed + buffer is equal to the total size of the compressed buffer and not + zero. For Visual Basic, check that this parameter is passed by reference + ("as any"), not by value ("as long"). + + 5. deflate() or inflate() returns Z_BUF_ERROR. + + Before making the call, make sure that avail_in and avail_out are not + zero. When setting the parameter flush equal to Z_FINISH, also make sure + that avail_out is big enough to allow processing all pending input. + Note that a Z_BUF_ERROR is not fatal--another call to deflate() or + inflate() can be made with more input or output space. A Z_BUF_ERROR + may in fact be unavoidable depending on how the functions are used, since + it is not possible to tell whether or not there is more output pending + when strm.avail_out returns with zero. + + 6. Where's the zlib documentation (man pages, etc.)? + + It's in zlib.h for the moment, and Francis S. Lin has converted it to a + web page zlib.html. Volunteers to transform this to Unix-style man pages, + please contact us (zlib@gzip.org). Examples of zlib usage are in the files + example.c and minigzip.c. + + 7. Why don't you use GNU autoconf or libtool or ...? + + Because we would like to keep zlib as a very small and simple + package. zlib is rather portable and doesn't need much configuration. + + 8. I found a bug in zlib. + + Most of the time, such problems are due to an incorrect usage of + zlib. Please try to reproduce the problem with a small program and send + the corresponding source to us at zlib@gzip.org . Do not send + multi-megabyte data files without prior agreement. + + 9. Why do I get "undefined reference to gzputc"? + + If "make test" produces something like + + example.o(.text+0x154): undefined reference to `gzputc' + + check that you don't have old files libz.* in /usr/lib, /usr/local/lib or + /usr/X11R6/lib. Remove any old versions, then do "make install". + +10. I need a Delphi interface to zlib. + + See the contrib/delphi directory in the zlib distribution. + +11. Can zlib handle .zip archives? + + Not by itself, no. See the directory contrib/minizip in the zlib + distribution. + +12. Can zlib handle .Z files? + + No, sorry. You have to spawn an uncompress or gunzip subprocess, or adapt + the code of uncompress on your own. + +13. How can I make a Unix shared library? + + make clean + ./configure -s + make + +14. How do I install a shared zlib library on Unix? + + After the above, then: + + make install + + However, many flavors of Unix come with a shared zlib already installed. + Before going to the trouble of compiling a shared version of zlib and + trying to install it, you may want to check if it's already there! If you + can #include , it's there. The -lz option will probably link to it. + +15. I have a question about OttoPDF. + + We are not the authors of OttoPDF. The real author is on the OttoPDF web + site: Joel Hainley, jhainley@myndkryme.com. + +16. Can zlib decode Flate data in an Adobe PDF file? + + Yes. See http://www.fastio.com/ (ClibPDF), or http://www.pdflib.com/ . + To modify PDF forms, see http://sourceforge.net/projects/acroformtool/ . + +17. Why am I getting this "register_frame_info not found" error on Solaris? + + After installing zlib 1.1.4 on Solaris 2.6, running applications using zlib + generates an error such as: + + ld.so.1: rpm: fatal: relocation error: file /usr/local/lib/libz.so: + symbol __register_frame_info: referenced symbol not found + + The symbol __register_frame_info is not part of zlib, it is generated by + the C compiler (cc or gcc). You must recompile applications using zlib + which have this problem. This problem is specific to Solaris. See + http://www.sunfreeware.com for Solaris versions of zlib and applications + using zlib. + +18. Why does gzip give an error on a file I make with compress/deflate? + + The compress and deflate functions produce data in the zlib format, which + is different and incompatible with the gzip format. The gz* functions in + zlib on the other hand use the gzip format. Both the zlib and gzip + formats use the same compressed data format internally, but have different + headers and trailers around the compressed data. + +19. Ok, so why are there two different formats? + + The gzip format was designed to retain the directory information about + a single file, such as the name and last modification date. The zlib + format on the other hand was designed for in-memory and communication + channel applications, and has a much more compact header and trailer and + uses a faster integrity check than gzip. + +20. Well that's nice, but how do I make a gzip file in memory? + + You can request that deflate write the gzip format instead of the zlib + format using deflateInit2(). You can also request that inflate decode + the gzip format using inflateInit2(). Read zlib.h for more details. + +21. Is zlib thread-safe? + + Yes. However any library routines that zlib uses and any application- + provided memory allocation routines must also be thread-safe. zlib's gz* + functions use stdio library routines, and most of zlib's functions use the + library memory allocation routines by default. zlib's Init functions allow + for the application to provide custom memory allocation routines. + + Of course, you should only operate on any given zlib or gzip stream from a + single thread at a time. + +22. Can I use zlib in my commercial application? + + Yes. Please read the license in zlib.h. + +23. Is zlib under the GNU license? + + No. Please read the license in zlib.h. + +24. The license says that altered source versions must be "plainly marked". So + what exactly do I need to do to meet that requirement? + + You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In + particular, the final version number needs to be changed to "f", and an + identification string should be appended to ZLIB_VERSION. Version numbers + x.x.x.f are reserved for modifications to zlib by others than the zlib + maintainers. For example, if the version of the base zlib you are altering + is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and + ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also + update the version strings in deflate.c and inftrees.c. + + For altered source distributions, you should also note the origin and + nature of the changes in zlib.h, as well as in ChangeLog and README, along + with the dates of the alterations. The origin should include at least your + name (or your company's name), and an email address to contact for help or + issues with the library. + + Note that distributing a compiled zlib library along with zlib.h and + zconf.h is also a source distribution, and so you should change + ZLIB_VERSION and ZLIB_VERNUM and note the origin and nature of the changes + in zlib.h as you would for a full source distribution. + +25. Will zlib work on a big-endian or little-endian architecture, and can I + exchange compressed data between them? + + Yes and yes. + +26. Will zlib work on a 64-bit machine? + + It should. It has been tested on 64-bit machines, and has no dependence + on any data types being limited to 32-bits in length. If you have any + difficulties, please provide a complete problem report to zlib@gzip.org + +27. Will zlib decompress data from the PKWare Data Compression Library? + + No. The PKWare DCL uses a completely different compressed data format + than does PKZIP and zlib. However, you can look in zlib's contrib/blast + directory for a possible solution to your problem. + +28. Can I access data randomly in a compressed stream? + + No, not without some preparation. If when compressing you periodically + use Z_FULL_FLUSH, carefully write all the pending data at those points, + and keep an index of those locations, then you can start decompression + at those points. You have to be careful to not use Z_FULL_FLUSH too + often, since it can significantly degrade compression. + +29. Does zlib work on MVS, OS/390, CICS, etc.? + + We don't know for sure. We have heard occasional reports of success on + these systems. If you do use it on one of these, please provide us with + a report, instructions, and patches that we can reference when we get + these questions. Thanks. + +30. Is there some simpler, easier to read version of inflate I can look at + to understand the deflate format? + + First off, you should read RFC 1951. Second, yes. Look in zlib's + contrib/puff directory. + +31. Does zlib infringe on any patents? + + As far as we know, no. In fact, that was originally the whole point behind + zlib. Look here for some more information: + + http://www.gzip.org/#faq11 + +32. Can zlib work with greater than 4 GB of data? + + Yes. inflate() and deflate() will process any amount of data correctly. + Each call of inflate() or deflate() is limited to input and output chunks + of the maximum value that can be stored in the compiler's "unsigned int" + type, but there is no limit to the number of chunks. Note however that the + strm.total_in and strm_total_out counters may be limited to 4 GB. These + counters are provided as a convenience and are not used internally by + inflate() or deflate(). The application can easily set up its own counters + updated after each call of inflate() or deflate() to count beyond 4 GB. + compress() and uncompress() may be limited to 4 GB, since they operate in a + single call. gzseek() and gztell() may be limited to 4 GB depending on how + zlib is compiled. See the zlibCompileFlags() function in zlib.h. + + The word "may" appears several times above since there is a 4 GB limit + only if the compiler's "long" type is 32 bits. If the compiler's "long" + type is 64 bits, then the limit is 16 exabytes. + +33. Does zlib have any security vulnerabilities? + + The only one that we are aware of is potentially in gzprintf(). If zlib + is compiled to use sprintf() or vsprintf(), then there is no protection + against a buffer overflow of a 4K string space, other than the caller of + gzprintf() assuring that the output will not exceed 4K. On the other + hand, if zlib is compiled to use snprintf() or vsnprintf(), which should + normally be the case, then there is no vulnerability. The ./configure + script will display warnings if an insecure variation of sprintf() will + be used by gzprintf(). Also the zlibCompileFlags() function will return + information on what variant of sprintf() is used by gzprintf(). + + If you don't have snprintf() or vsnprintf() and would like one, you can + find a portable implementation here: + + http://www.ijs.si/software/snprintf/ + + Note that you should be using the most recent version of zlib. Versions + 1.1.3 and before were subject to a double-free vulnerability. + +34. Is there a Java version of zlib? + + Probably what you want is to use zlib in Java. zlib is already included + as part of the Java SDK in the java.util.zip package. If you really want + a version of zlib written in the Java language, look on the zlib home + page for links: http://www.zlib.org/ + +35. I get this or that compiler or source-code scanner warning when I crank it + up to maximally-pedantic. Can't you guys write proper code? + + Many years ago, we gave up attempting to avoid warnings on every compiler + in the universe. It just got to be a waste of time, and some compilers + were downright silly. So now, we simply make sure that the code always + works. + +36. Valgrind (or some similar memory access checker) says that deflate is + performing a conditional jump that depends on an uninitialized value. + Isn't that a bug? + + No. That is intentional for performance reasons, and the output of + deflate is not affected. This only started showing up recently since + zlib 1.2.x uses malloc() by default for allocations, whereas earlier + versions used calloc(), which zeros out the allocated memory. + +37. Will zlib read the (insert any ancient or arcane format here) compressed + data format? + + Probably not. Look in the comp.compression FAQ for pointers to various + formats and associated software. + +38. How can I encrypt/decrypt zip files with zlib? + + zlib doesn't support encryption. The original PKZIP encryption is very weak + and can be broken with freely available programs. To get strong encryption, + use GnuPG, http://www.gnupg.org/ , which already includes zlib compression. + For PKZIP compatible "encryption", look at http://www.info-zip.org/ + +39. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings? + + "gzip" is the gzip format, and "deflate" is the zlib format. They should + probably have called the second one "zlib" instead to avoid confusion + with the raw deflate compressed data format. While the HTTP 1.1 RFC 2616 + correctly points to the zlib specification in RFC 1950 for the "deflate" + transfer encoding, there have been reports of servers and browsers that + incorrectly produce or expect raw deflate data per the deflate + specficiation in RFC 1951, most notably Microsoft. So even though the + "deflate" transfer encoding using the zlib format would be the more + efficient approach (and in fact exactly what the zlib format was designed + for), using the "gzip" transfer encoding is probably more reliable due to + an unfortunate choice of name on the part of the HTTP 1.1 authors. + + Bottom line: use the gzip format for HTTP 1.1 encoding. + +40. Does zlib support the new "Deflate64" format introduced by PKWare? + + No. PKWare has apparently decided to keep that format proprietary, since + they have not documented it as they have previous compression formats. + In any case, the compression improvements are so modest compared to other + more modern approaches, that it's not worth the effort to implement. + +41. Can you please sign these lengthy legal documents and fax them back to us + so that we can use your software in our product? + + No. Go away. Shoo. diff --git a/src/dep/src/irrlicht/zlib/INDEX b/src/dep/src/irrlicht/zlib/INDEX index e69de29..4d7eac4 100644 --- a/src/dep/src/irrlicht/zlib/INDEX +++ b/src/dep/src/irrlicht/zlib/INDEX @@ -0,0 +1,51 @@ +ChangeLog history of changes +FAQ Frequently Asked Questions about zlib +INDEX this file +Makefile makefile for Unix (generated by configure) +Makefile.in makefile for Unix (template for configure) +README guess what +algorithm.txt description of the (de)compression algorithm +configure configure script for Unix +zconf.in.h template for zconf.h (used by configure) + +amiga/ makefiles for Amiga SAS C +as400/ makefiles for IBM AS/400 +msdos/ makefiles for MSDOS +old/ makefiles for various architectures and zlib documentation + files that have not yet been updated for zlib 1.2.x +projects/ projects for various Integrated Development Environments +qnx/ makefiles for QNX +win32/ makefiles for Windows + + zlib public header files (must be kept): +zconf.h +zlib.h + + private source files used to build the zlib library: +adler32.c +compress.c +crc32.c +crc32.h +deflate.c +deflate.h +gzio.c +infback.c +inffast.c +inffast.h +inffixed.h +inflate.c +inflate.h +inftrees.c +inftrees.h +trees.c +trees.h +uncompr.c +zutil.c +zutil.h + + source files for sample programs: +example.c +minigzip.c + + unsupported contribution by third parties +See contrib/README.contrib diff --git a/src/dep/src/irrlicht/zlib/README b/src/dep/src/irrlicht/zlib/README index e69de29..80f71ae 100644 --- a/src/dep/src/irrlicht/zlib/README +++ b/src/dep/src/irrlicht/zlib/README @@ -0,0 +1,125 @@ +ZLIB DATA COMPRESSION LIBRARY + +zlib 1.2.3 is a general purpose data compression library. All the code is +thread safe. The data format used by the zlib library is described by RFCs +(Request for Comments) 1950 to 1952 in the files +http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) +and rfc1952.txt (gzip format). These documents are also available in other +formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html + +All functions of the compression library are documented in the file zlib.h +(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example +of the library is given in the file example.c which also tests that the library +is working correctly. Another example is given in the file minigzip.c. The +compression library itself is composed of all source files except example.c and +minigzip.c. + +To compile all files and run the test program, follow the instructions given at +the top of Makefile. In short "make test; make install" should work for most +machines. For Unix: "./configure; make test; make install". For MSDOS, use one +of the special makefiles such as Makefile.msc. For VMS, use make_vms.com. + +Questions about zlib should be sent to , or to Gilles Vollant + for the Windows DLL version. The zlib home page is +http://www.zlib.org or http://www.gzip.org/zlib/ Before reporting a problem, +please check this site to verify that you have the latest version of zlib; +otherwise get the latest version and check whether the problem still exists or +not. + +PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html before asking +for help. + +Mark Nelson wrote an article about zlib for the Jan. 1997 +issue of Dr. Dobb's Journal; a copy of the article is available in +http://dogma.net/markn/articles/zlibtool/zlibtool.htm + +The changes made in version 1.2.3 are documented in the file ChangeLog. + +Unsupported third party contributions are provided in directory "contrib". + +A Java implementation of zlib is available in the Java Development Kit +http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/package-summary.html +See the zlib home page http://www.zlib.org for details. + +A Perl interface to zlib written by Paul Marquess is in the +CPAN (Comprehensive Perl Archive Network) sites +http://www.cpan.org/modules/by-module/Compress/ + +A Python interface to zlib written by A.M. Kuchling is +available in Python 1.5 and later versions, see +http://www.python.org/doc/lib/module-zlib.html + +A zlib binding for TCL written by Andreas Kupries is +availlable at http://www.oche.de/~akupries/soft/trf/trf_zip.html + +An experimental package to read and write files in .zip format, written on top +of zlib by Gilles Vollant , is available in the +contrib/minizip directory of zlib. + + +Notes for some targets: + +- For Windows DLL versions, please see win32/DLL_FAQ.txt + +- For 64-bit Irix, deflate.c must be compiled without any optimization. With + -O, one libpng test fails. The test works in 32 bit mode (with the -n32 + compiler flag). The compiler bug has been reported to SGI. + +- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works + when compiled with cc. + +- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is + necessary to get gzprintf working correctly. This is done by configure. + +- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with + other compilers. Use "make test" to check your compiler. + +- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers. + +- For PalmOs, see http://palmzlib.sourceforge.net/ + +- When building a shared, i.e. dynamic library on Mac OS X, the library must be + installed before testing (do "make install" before "make test"), since the + library location is specified in the library. + + +Acknowledgments: + + The deflate format used by zlib was defined by Phil Katz. The deflate + and zlib specifications were written by L. Peter Deutsch. Thanks to all the + people who reported problems and suggested various improvements in zlib; + they are too numerous to cite here. + +Copyright notice: + + (C) 1995-2004 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + +If you use the zlib library in a product, we would appreciate *not* +receiving lengthy legal documents to sign. The sources are provided +for free but without warranty of any kind. The library has been +entirely written by Jean-loup Gailly and Mark Adler; it does not +include third-party code. + +If you redistribute modified sources, we would appreciate that you include +in the file ChangeLog history information documenting your changes. Please +read the FAQ for more information on the distribution of modified source +versions.