mirror of
https://github.com/minetest/irrlicht.git
synced 2024-12-25 18:20:30 +01:00
Merging r6383 through r6403 from trunk to ogl-es branch
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@6404 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
ec38b153da
commit
ddc14ea87e
@ -11,6 +11,11 @@ Changes in ogl-es (not yet released - will be merged with trunk at some point)
|
||||
--------------------------
|
||||
Changes in 1.9 (not yet released)
|
||||
|
||||
- core::array::linear_search and linear_reverse_search can now work with any types as long as corresponding operator== is implemented.
|
||||
- Add checks for sane image sizes in some image loaders (so far: bmp, jpg, tga, png).
|
||||
Thanks @sfan5 for the original patch (got modified a bit): https://github.com/minetest/irrlicht/commit/dbd39120e7ed8c0c97e48e2df62347627f3c1d42
|
||||
- Add IImage::checkDataSizeLimit and make IImage getDataSizeFromFormat return size_t so image loaders can check if sizes are sane.
|
||||
- Fix crash with large jpg files. Based somewhat on a patch in Minetest from sfan5 https://github.com/minetest/irrlicht/commit/594de9915346a87f67cd94e28c7933993efb5d3b
|
||||
- COSOperator::getSystemMemory now returns some value on OSX (thought same for total and available).
|
||||
Thanks @sfan5 for patch https://irrlicht.sourceforge.io/forum/viewtopic.php?f=2&t=52819 and https://github.com/minetest/irrlicht/commit/e469c54f76f6d24f92389b4e8a27b9cce7152888
|
||||
- Fix CVertexBuffer::setType switching types for non-empty arrays. Before we had some bad casts which could result in random initializing of some vertex data.
|
||||
|
@ -186,7 +186,7 @@ namespace scene
|
||||
SMD3QuaternionTag* get(const core::stringc& name)
|
||||
{
|
||||
SMD3QuaternionTag search ( name );
|
||||
s32 index = Container.linear_search ( search );
|
||||
const s32 index = Container.linear_search ( search );
|
||||
if ( index >= 0 )
|
||||
return &Container[index];
|
||||
return 0;
|
||||
@ -199,7 +199,7 @@ namespace scene
|
||||
|
||||
void set_used(u32 new_size)
|
||||
{
|
||||
s32 diff = (s32) new_size - (s32) Container.allocated_size();
|
||||
const s32 diff = (s32) new_size - (s32) Container.allocated_size();
|
||||
if ( diff > 0 )
|
||||
{
|
||||
SMD3QuaternionTag e("");
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
{
|
||||
const core::rect<s32>& r2 = Parent->getAbsolutePosition();
|
||||
|
||||
core::dimension2df d((f32)(r2.getSize().Width), (f32)(r2.getSize().Height));
|
||||
const core::dimension2df d((f32)(r2.getSize().Width), (f32)(r2.getSize().Height));
|
||||
|
||||
if (AlignLeft == EGUIA_SCALE)
|
||||
ScaleRect.UpperLeftCorner.X = (f32)r.UpperLeftCorner.X / d.Width;
|
||||
@ -194,9 +194,8 @@ public:
|
||||
|
||||
if (Parent)
|
||||
{
|
||||
core::rect<s32> r(Parent->getAbsolutePosition());
|
||||
|
||||
core::dimension2df d((f32)r.getSize().Width, (f32)r.getSize().Height);
|
||||
const core::rect<s32> r(Parent->getAbsolutePosition());
|
||||
const core::dimension2df d((f32)r.getSize().Width, (f32)r.getSize().Height);
|
||||
|
||||
if (AlignLeft == EGUIA_SCALE)
|
||||
ScaleRect.UpperLeftCorner.X = (f32)DesiredRect.UpperLeftCorner.X / d.Width;
|
||||
|
@ -49,14 +49,18 @@ namespace gui
|
||||
//! returns string of a list item. the may id be a value from 0 to itemCount-1
|
||||
virtual const wchar_t* getListItem(u32 id) const = 0;
|
||||
|
||||
//! adds an list item, returns id of item
|
||||
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 */
|
||||
virtual u32 addItem(const wchar_t* text, s32 icon) = 0;
|
||||
virtual u32 addItem(const wchar_t* text, s32 icon=-1) = 0;
|
||||
|
||||
//! 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=-1) = 0;
|
||||
|
||||
//! set the item at the given index
|
||||
virtual void setItem(u32 index, const wchar_t* text, s32 icon=-1) = 0;
|
||||
|
||||
//! Removes an item from the list
|
||||
virtual void removeItem(u32 index) = 0;
|
||||
@ -114,13 +118,6 @@ namespace gui
|
||||
//! return the default color which is used for the given colorType
|
||||
virtual video::SColor getItemDefaultColor(EGUI_LISTBOX_COLOR colorType) const = 0;
|
||||
|
||||
//! set the item at the given index
|
||||
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. */
|
||||
virtual s32 insertItem(u32 index, const wchar_t* text, s32 icon) = 0;
|
||||
|
||||
//! Swap the items at the given indices
|
||||
virtual void swapItems(u32 index1, u32 index2) = 0;
|
||||
|
||||
|
@ -84,7 +84,7 @@ public:
|
||||
}
|
||||
|
||||
//! Returns image data size in bytes
|
||||
u32 getImageDataSizeInBytes() const
|
||||
size_t getImageDataSizeInBytes() const
|
||||
{
|
||||
return getDataSizeFromFormat(Format, Size.Width, Size.Height);
|
||||
}
|
||||
@ -295,7 +295,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
u32 dataSize = 0;
|
||||
size_t dataSize = 0;
|
||||
u32 width = Size.Width;
|
||||
u32 height = Size.Height;
|
||||
|
||||
@ -445,43 +445,57 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
//! calculate image data size in bytes for selected format, width and height.
|
||||
static u32 getDataSizeFromFormat(ECOLOR_FORMAT format, u32 width, u32 height)
|
||||
//! You should not create images where the result of getDataSizeFromFormat doesn't pass this function
|
||||
/** Note that CImage does not yet check for this, but going beyond this limit is not supported well.
|
||||
Image loaders should check for this.
|
||||
If you don't have the format yet then checking width*height*bytes_per_pixel is mostly fine, but make
|
||||
sure to work with size_t so it doesn't clip the result to u32 too early.
|
||||
\return true when dataSize is small enough that it should be fine. */
|
||||
static bool checkDataSizeLimit(size_t dataSize)
|
||||
{
|
||||
u32 imageSize = 0;
|
||||
// 2gb for now. Could be we could do more on some platforms, but we still will run into
|
||||
// problems right now then for example in then color converter (which currently still uses
|
||||
// s32 for sizes).
|
||||
return (size_t)(s32)(dataSize) == dataSize;
|
||||
}
|
||||
|
||||
//! calculate image data size in bytes for selected format, width and height.
|
||||
static size_t getDataSizeFromFormat(ECOLOR_FORMAT format, u32 width, u32 height)
|
||||
{
|
||||
size_t imageSize = 0;
|
||||
|
||||
switch (format)
|
||||
{
|
||||
case ECF_DXT1:
|
||||
imageSize = ((width + 3) / 4) * ((height + 3) / 4) * 8;
|
||||
imageSize = (size_t)((width + 3) / 4) * ((height + 3) / 4) * 8;
|
||||
break;
|
||||
case ECF_DXT2:
|
||||
case ECF_DXT3:
|
||||
case ECF_DXT4:
|
||||
case ECF_DXT5:
|
||||
imageSize = ((width + 3) / 4) * ((height + 3) / 4) * 16;
|
||||
imageSize = (size_t)((width + 3) / 4) * ((height + 3) / 4) * 16;
|
||||
break;
|
||||
case ECF_PVRTC_RGB2:
|
||||
case ECF_PVRTC_ARGB2:
|
||||
imageSize = (core::max_<u32>(width, 16) * core::max_<u32>(height, 8) * 2 + 7) / 8;
|
||||
imageSize = ((size_t)core::max_<u32>(width, 16) * core::max_<u32>(height, 8) * 2 + 7) / 8;
|
||||
break;
|
||||
case ECF_PVRTC_RGB4:
|
||||
case ECF_PVRTC_ARGB4:
|
||||
imageSize = (core::max_<u32>(width, 8) * core::max_<u32>(height, 8) * 4 + 7) / 8;
|
||||
imageSize = ((size_t)core::max_<u32>(width, 8) * core::max_<u32>(height, 8) * 4 + 7) / 8;
|
||||
break;
|
||||
case ECF_PVRTC2_ARGB2:
|
||||
imageSize = core::ceil32(width / 8.0f) * core::ceil32(height / 4.0f) * 8;
|
||||
imageSize = (size_t)core::ceil32(width / 8.0f) * core::ceil32(height / 4.0f) * 8;
|
||||
break;
|
||||
case ECF_PVRTC2_ARGB4:
|
||||
case ECF_ETC1:
|
||||
case ECF_ETC2_RGB:
|
||||
imageSize = core::ceil32(width / 4.0f) * core::ceil32(height / 4.0f) * 8;
|
||||
imageSize = (size_t)core::ceil32(width / 4.0f) * core::ceil32(height / 4.0f) * 8;
|
||||
break;
|
||||
case ECF_ETC2_ARGB:
|
||||
imageSize = core::ceil32(width / 4.0f) * core::ceil32(height / 4.0f) * 16;
|
||||
imageSize = (size_t)core::ceil32(width / 4.0f) * core::ceil32(height / 4.0f) * 16;
|
||||
break;
|
||||
default: // uncompressed formats
|
||||
imageSize = getBitsPerPixelFromFormat(format) / 8 * width;
|
||||
imageSize = (size_t)getBitsPerPixelFromFormat(format) / 8 * width;
|
||||
imageSize *= height;
|
||||
break;
|
||||
}
|
||||
|
@ -293,8 +293,8 @@ void IProfiler::stop(s32 id)
|
||||
{
|
||||
if ( Timer )
|
||||
{
|
||||
u32 timeNow = Timer->getRealTime();
|
||||
s32 idx = ProfileDatas.binary_search(SProfileData(id));
|
||||
const u32 timeNow = Timer->getRealTime();
|
||||
const s32 idx = ProfileDatas.binary_search(SProfileData(id));
|
||||
if ( idx >= 0 )
|
||||
{
|
||||
SProfileData &data = ProfileDatas[idx];
|
||||
@ -303,7 +303,7 @@ void IProfiler::stop(s32 id)
|
||||
{
|
||||
// update data for this id
|
||||
++data.CountCalls;
|
||||
u32 diffTime = timeNow - data.LastTimeStarted;
|
||||
const u32 diffTime = timeNow - data.LastTimeStarted;
|
||||
data.TimeSum += diffTime;
|
||||
if ( diffTime > data.LongestTime )
|
||||
data.LongestTime = diffTime;
|
||||
@ -336,7 +336,7 @@ s32 IProfiler::add(const core::stringw &name, const core::stringw &groupName)
|
||||
}
|
||||
else
|
||||
{
|
||||
s32 id = NextAutoId;
|
||||
const s32 id = NextAutoId;
|
||||
--NextAutoId;
|
||||
add( id, name, groupName );
|
||||
return id;
|
||||
@ -400,7 +400,7 @@ bool IProfiler::findDataIndex(u32 & result, const core::stringw &name) const
|
||||
const SProfileData* IProfiler::getProfileDataById(u32 id)
|
||||
{
|
||||
SProfileData data(id);
|
||||
s32 idx = ProfileDatas.binary_search(data);
|
||||
const s32 idx = ProfileDatas.binary_search(data);
|
||||
if ( idx >= 0 )
|
||||
return &ProfileDatas[idx];
|
||||
return NULL;
|
||||
|
@ -30,7 +30,7 @@ namespace scene
|
||||
core::triangle3df Triangle;
|
||||
|
||||
//! Triangle selector which contained the colliding triangle (useful when having MetaTriangleSelector)
|
||||
ITriangleSelector* TriangleSelector;
|
||||
const ITriangleSelector* TriangleSelector;
|
||||
|
||||
//! Node which contained the triangle (is 0 when selector doesn't have that information)
|
||||
ISceneNode* Node;
|
||||
|
@ -736,7 +736,7 @@ namespace scene
|
||||
IsVisible = in->getAttributeAsBool("Visible", IsVisible);
|
||||
if (in->existsAttribute("AutomaticCulling"))
|
||||
{
|
||||
s32 tmpState = in->getAttributeAsEnumeration("AutomaticCulling",
|
||||
const s32 tmpState = in->getAttributeAsEnumeration("AutomaticCulling",
|
||||
scene::AutomaticCullingNames);
|
||||
if (tmpState != -1)
|
||||
AutomaticCullingState = (u32)tmpState;
|
||||
|
@ -49,7 +49,7 @@ struct SCollisionTriangleRange
|
||||
irr::u32 RangeSize;
|
||||
|
||||
//! Real selector which contained those triangles (useful when working with MetaTriangleSelector)
|
||||
ITriangleSelector* Selector;
|
||||
const ITriangleSelector* Selector;
|
||||
|
||||
//! SceneNode from which the triangles are from
|
||||
ISceneNode* SceneNode;
|
||||
|
@ -460,7 +460,7 @@ namespace video
|
||||
/** Return value is the number of visible pixels/fragments.
|
||||
The value is a safe approximation, i.e. can be larger than the
|
||||
actual value of pixels. */
|
||||
virtual u32 getOcclusionQueryResult(scene::ISceneNode* node) const =0;
|
||||
virtual u32 getOcclusionQueryResult(const scene::ISceneNode* node) const =0;
|
||||
|
||||
//! Create render target.
|
||||
virtual IRenderTarget* addRenderTarget() = 0;
|
||||
|
@ -618,6 +618,7 @@ namespace video
|
||||
PolygonOffsetDirection = EPO_BACK;
|
||||
PolygonOffsetSlopeScale = value?1.f:0.f;
|
||||
PolygonOffsetDepthBias = value?1.f:0.f;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ inline bool hasFileExtension(const io::path& filename, const io::path& ext0,
|
||||
//! cut the filename extension from a source file path and store it in a dest file path
|
||||
inline io::path& cutFilenameExtension ( io::path &dest, const io::path &source )
|
||||
{
|
||||
s32 endPos = source.findLast ( '.' );
|
||||
const s32 endPos = source.findLast ( '.' );
|
||||
dest = source.subString ( 0, endPos < 0 ? source.size () : endPos );
|
||||
return dest;
|
||||
}
|
||||
@ -55,7 +55,7 @@ inline io::path& cutFilenameExtension ( io::path &dest, const io::path &source )
|
||||
//! get the filename extension from a file path
|
||||
inline io::path& getFileNameExtension ( io::path &dest, const io::path &source )
|
||||
{
|
||||
s32 endPos = source.findLast ( '.' );
|
||||
const s32 endPos = source.findLast ( '.' );
|
||||
if ( endPos < 0 )
|
||||
dest = "";
|
||||
else
|
||||
@ -176,7 +176,7 @@ static inline io::path mergeFilename(const io::path& path, const io::path& filen
|
||||
|
||||
if ( !result.empty() )
|
||||
{
|
||||
fschar_t last = result.lastChar();
|
||||
const fschar_t last = result.lastChar();
|
||||
if ( last != IRR_TEXT('/') && last != IRR_TEXT('\\') )
|
||||
result += IRR_TEXT('/');
|
||||
}
|
||||
|
@ -526,29 +526,31 @@ public:
|
||||
}
|
||||
|
||||
|
||||
//! Finds an element in linear time, which is very slow.
|
||||
/** Use binary_search for faster finding. Only works if ==operator is
|
||||
implemented.
|
||||
\param element Element to search for.
|
||||
//! Finds an element by searching linearly from array start to end
|
||||
/** Can be slow with large arrays, try binary_search for those.
|
||||
Only works if corresponding operator== is implemented.
|
||||
\param element Element to search for.
|
||||
\return Position of the searched element if it was found, otherwise -1
|
||||
is returned. */
|
||||
s32 linear_search(const T& element) const
|
||||
template <class E>
|
||||
s32 linear_search(const E& element) const
|
||||
{
|
||||
for (u32 i=0; i<used; ++i)
|
||||
if (element == data[i])
|
||||
if (data[i] == element)
|
||||
return (s32)i;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
//! Finds an element in linear time, which is very slow.
|
||||
/** Use binary_search for faster finding. Only works if ==operator is
|
||||
implemented.
|
||||
\param element: Element to search for.
|
||||
//! Finds an element by searching linearly from array end to start.
|
||||
/** Can be slow with large arrays, try binary_search for those.
|
||||
Only works if corresponding operator== is implemented.
|
||||
\param element Element to search for.
|
||||
\return Position of the searched element if it was found, otherwise -1
|
||||
is returned. */
|
||||
s32 linear_reverse_search(const T& element) const
|
||||
template <class E>
|
||||
s32 linear_reverse_search(const E& element) const
|
||||
{
|
||||
for (s32 i=used-1; i>=0; --i)
|
||||
if (data[i] == element)
|
||||
|
@ -211,7 +211,7 @@ IMesh* CAnimatedMeshMD3::getMesh(s32 frame, s32 detailLevel, s32 startFrameLoop,
|
||||
|
||||
//! create a Irrlicht MeshBuffer for a MD3 MeshBuffer
|
||||
IMeshBuffer * CAnimatedMeshMD3::createMeshBuffer(const SMD3MeshBuffer* source,
|
||||
io::IFileSystem* fs, video::IVideoDriver * driver)
|
||||
const io::IFileSystem* fs, video::IVideoDriver * driver)
|
||||
{
|
||||
SMeshBufferLightMap * dest = new SMeshBufferLightMap();
|
||||
dest->Vertices.set_used(source->MeshHeader.numVertices);
|
||||
|
@ -117,7 +117,7 @@ namespace scene
|
||||
SMD3QuaternionTagList TagListIPol;
|
||||
|
||||
IMeshBuffer* createMeshBuffer(const SMD3MeshBuffer* source,
|
||||
io::IFileSystem* fs, video::IVideoDriver* driver);
|
||||
const io::IFileSystem* fs, video::IVideoDriver* driver);
|
||||
|
||||
void buildVertexArray(u32 frameA, u32 frameB, f32 interpolate,
|
||||
const SMD3MeshBuffer* source,
|
||||
|
@ -98,7 +98,7 @@ bool CB3DMeshWriter::writeMesh(io::IWriteFile* file, IMesh* const mesh, s32 flag
|
||||
u32 numTexture = texs.size();
|
||||
for (u32 i = 0; i < numTexture; i++)
|
||||
{
|
||||
file->write(texs[i].TextureName.c_str(), texs[i].TextureName.size() + 1);
|
||||
file->write(texs[i].TextureName.c_str(), (size_t)texs[i].TextureName.size() + 1);
|
||||
file->write(&texs[i].Flags, 7*4);
|
||||
}
|
||||
|
||||
@ -498,7 +498,7 @@ core::array<ISkinnedMesh::SJoint*> CB3DMeshWriter::getRootJoints(const ISkinnedM
|
||||
return roots;
|
||||
}
|
||||
|
||||
u32 CB3DMeshWriter::getUVlayerCount(IMesh* mesh)
|
||||
u32 CB3DMeshWriter::getUVlayerCount(const IMesh* mesh)
|
||||
{
|
||||
const u32 numBeshBuffers = mesh->getMeshBufferCount();
|
||||
for (u32 i = 0; i < numBeshBuffers; i++)
|
||||
|
@ -37,7 +37,7 @@ private:
|
||||
u32 getJointChunkSize(const ISkinnedMesh* mesh, ISkinnedMesh::SJoint* joint);
|
||||
core::array<ISkinnedMesh::SJoint*> getRootJoints(const ISkinnedMesh* mesh);
|
||||
|
||||
u32 getUVlayerCount(IMesh *mesh);
|
||||
u32 getUVlayerCount(const IMesh *mesh);
|
||||
ISkinnedMesh* getSkinned (IMesh *mesh);
|
||||
|
||||
inline void writeVector2(io::IWriteFile* file, const core::vector2df& vec);
|
||||
|
@ -13,21 +13,21 @@ namespace video
|
||||
{
|
||||
|
||||
//! converts a monochrome bitmap to A1R5G5B5 data
|
||||
void CColorConverter::convert1BitTo16Bit(const u8* in, s16* out, s32 width, s32 height, s32 linepad, bool flip)
|
||||
void CColorConverter::convert1BitTo16Bit(const u8* in, s16* out, u32 width, u32 height, u32 linepad, bool flip)
|
||||
{
|
||||
if (!in || !out)
|
||||
return;
|
||||
|
||||
if (flip)
|
||||
out += width * height;
|
||||
out += (size_t)width * height;
|
||||
|
||||
for (s32 y=0; y<height; ++y)
|
||||
for (u32 y=0; y<height; ++y)
|
||||
{
|
||||
s32 shift = 7;
|
||||
if (flip)
|
||||
out -= width;
|
||||
|
||||
for (s32 x=0; x<width; ++x)
|
||||
for (u32 x=0; x<width; ++x)
|
||||
{
|
||||
out[x] = *in>>shift & 0x01 ? (s16)0xffff : (s16)0x8000;
|
||||
|
||||
@ -50,21 +50,21 @@ void CColorConverter::convert1BitTo16Bit(const u8* in, s16* out, s32 width, s32
|
||||
|
||||
|
||||
//! converts a 4 bit palettized image to A1R5G5B5
|
||||
void CColorConverter::convert4BitTo16Bit(const u8* in, s16* out, s32 width, s32 height, const s32* palette, s32 linepad, bool flip)
|
||||
void CColorConverter::convert4BitTo16Bit(const u8* in, s16* out, u32 width, u32 height, const s32* palette, u32 linepad, bool flip)
|
||||
{
|
||||
if (!in || !out || !palette)
|
||||
return;
|
||||
|
||||
if (flip)
|
||||
out += width*height;
|
||||
out += (size_t)width*height;
|
||||
|
||||
for (s32 y=0; y<height; ++y)
|
||||
for (u32 y=0; y<height; ++y)
|
||||
{
|
||||
s32 shift = 4;
|
||||
if (flip)
|
||||
out -= width;
|
||||
|
||||
for (s32 x=0; x<width; ++x)
|
||||
for (u32 x=0; x<width; ++x)
|
||||
{
|
||||
out[x] = X8R8G8B8toA1R5G5B5(palette[(u8)((*in >> shift) & 0xf)]);
|
||||
|
||||
@ -89,19 +89,19 @@ void CColorConverter::convert4BitTo16Bit(const u8* in, s16* out, s32 width, s32
|
||||
|
||||
|
||||
//! converts a 8 bit palettized image into A1R5G5B5
|
||||
void CColorConverter::convert8BitTo16Bit(const u8* in, s16* out, s32 width, s32 height, const s32* palette, s32 linepad, bool flip)
|
||||
void CColorConverter::convert8BitTo16Bit(const u8* in, s16* out, u32 width, u32 height, const s32* palette, u32 linepad, bool flip)
|
||||
{
|
||||
if (!in || !out || !palette)
|
||||
return;
|
||||
|
||||
if (flip)
|
||||
out += width * height;
|
||||
out += (size_t)width * height;
|
||||
|
||||
for (s32 y=0; y<height; ++y)
|
||||
for (u32 y=0; y<height; ++y)
|
||||
{
|
||||
if (flip)
|
||||
out -= width; // one line back
|
||||
for (s32 x=0; x<width; ++x)
|
||||
for (u32 x=0; x<width; ++x)
|
||||
{
|
||||
out[x] = X8R8G8B8toA1R5G5B5(palette[(u8)(*in)]);
|
||||
++in;
|
||||
@ -113,20 +113,20 @@ void CColorConverter::convert8BitTo16Bit(const u8* in, s16* out, s32 width, s32
|
||||
}
|
||||
|
||||
//! converts a 8 bit palettized or non palettized image (A8) into R8G8B8
|
||||
void CColorConverter::convert8BitTo24Bit(const u8* in, u8* out, s32 width, s32 height, const u8* palette, s32 linepad, bool flip)
|
||||
void CColorConverter::convert8BitTo24Bit(const u8* in, u8* out, u32 width, u32 height, const u8* palette, u32 linepad, bool flip)
|
||||
{
|
||||
if (!in || !out )
|
||||
return;
|
||||
|
||||
const s32 lineWidth = 3 * width;
|
||||
const u32 lineWidth = 3 * width;
|
||||
if (flip)
|
||||
out += lineWidth * height;
|
||||
out += (size_t)lineWidth * height;
|
||||
|
||||
for (s32 y=0; y<height; ++y)
|
||||
for (u32 y=0; y<height; ++y)
|
||||
{
|
||||
if (flip)
|
||||
out -= lineWidth; // one line back
|
||||
for (s32 x=0; x< lineWidth; x += 3)
|
||||
for (u32 x=0; x< lineWidth; x += 3)
|
||||
{
|
||||
if ( palette )
|
||||
{
|
||||
@ -155,25 +155,25 @@ void CColorConverter::convert8BitTo24Bit(const u8* in, u8* out, s32 width, s32 h
|
||||
}
|
||||
|
||||
//! converts a 8 bit palettized or non palettized image (A8) into R8G8B8
|
||||
void CColorConverter::convert8BitTo32Bit(const u8* in, u8* out, s32 width, s32 height, const u8* palette, s32 linepad, bool flip)
|
||||
void CColorConverter::convert8BitTo32Bit(const u8* in, u8* out, u32 width, u32 height, const u8* palette, u32 linepad, bool flip)
|
||||
{
|
||||
if (!in || !out )
|
||||
return;
|
||||
|
||||
const u32 lineWidth = 4 * width;
|
||||
if (flip)
|
||||
out += lineWidth * height;
|
||||
out += (size_t)lineWidth * height;
|
||||
|
||||
u32 x;
|
||||
u32 c;
|
||||
for (u32 y=0; y < (u32) height; ++y)
|
||||
for (u32 y=0; y < height; ++y)
|
||||
{
|
||||
if (flip)
|
||||
out -= lineWidth; // one line back
|
||||
|
||||
if ( palette )
|
||||
{
|
||||
for (x=0; x < (u32) width; x += 1)
|
||||
for (x=0; x < width; x += 1)
|
||||
{
|
||||
c = in[x];
|
||||
((u32*)out)[x] = ((u32*)palette)[ c ];
|
||||
@ -181,7 +181,7 @@ void CColorConverter::convert8BitTo32Bit(const u8* in, u8* out, s32 width, s32 h
|
||||
}
|
||||
else
|
||||
{
|
||||
for (x=0; x < (u32) width; x += 1)
|
||||
for (x=0; x < width; x += 1)
|
||||
{
|
||||
c = in[x];
|
||||
#ifdef __BIG_ENDIAN__
|
||||
@ -202,20 +202,20 @@ void CColorConverter::convert8BitTo32Bit(const u8* in, u8* out, s32 width, s32 h
|
||||
|
||||
|
||||
//! converts 16bit data to 16bit data
|
||||
void CColorConverter::convert16BitTo16Bit(const s16* in, s16* out, s32 width, s32 height, s32 linepad, bool flip)
|
||||
void CColorConverter::convert16BitTo16Bit(const s16* in, s16* out, u32 width, u32 height, u32 linepad, bool flip)
|
||||
{
|
||||
if (!in || !out)
|
||||
return;
|
||||
|
||||
if (flip)
|
||||
out += width * height;
|
||||
out += (size_t)width * height;
|
||||
|
||||
for (s32 y=0; y<height; ++y)
|
||||
for (u32 y=0; y<height; ++y)
|
||||
{
|
||||
if (flip)
|
||||
out -= width;
|
||||
#ifdef __BIG_ENDIAN__
|
||||
for (s32 x=0; x<width; ++x)
|
||||
for (u32 x=0; x<width; ++x)
|
||||
out[x]=os::Byteswap::byteswap(in[x]);
|
||||
#else
|
||||
memcpy(out, in, width*sizeof(s16));
|
||||
@ -230,22 +230,22 @@ void CColorConverter::convert16BitTo16Bit(const s16* in, s16* out, s32 width, s3
|
||||
|
||||
|
||||
//! copies R8G8B8 24bit data to 24bit data
|
||||
void CColorConverter::convert24BitTo24Bit(const u8* in, u8* out, s32 width, s32 height, s32 linepad, bool flip, bool bgr)
|
||||
void CColorConverter::convert24BitTo24Bit(const u8* in, u8* out, u32 width, u32 height, u32 linepad, bool flip, bool bgr)
|
||||
{
|
||||
if (!in || !out)
|
||||
return;
|
||||
|
||||
const s32 lineWidth = 3 * width;
|
||||
const u32 lineWidth = 3 * width;
|
||||
if (flip)
|
||||
out += lineWidth * height;
|
||||
out += (size_t)lineWidth * height;
|
||||
|
||||
for (s32 y=0; y<height; ++y)
|
||||
for (u32 y=0; y<height; ++y)
|
||||
{
|
||||
if (flip)
|
||||
out -= lineWidth;
|
||||
if (bgr)
|
||||
{
|
||||
for (s32 x=0; x<lineWidth; x+=3)
|
||||
for (u32 x=0; x<lineWidth; x+=3)
|
||||
{
|
||||
out[x+0] = in[x+2];
|
||||
out[x+1] = in[x+1];
|
||||
@ -267,7 +267,7 @@ void CColorConverter::convert24BitTo24Bit(const u8* in, u8* out, s32 width, s32
|
||||
|
||||
//! Resizes the surface to a new size and converts it at the same time
|
||||
//! to an A8R8G8B8 format, returning the pointer to the new buffer.
|
||||
void CColorConverter::convert16bitToA8R8G8B8andResize(const s16* in, s32* out, s32 newWidth, s32 newHeight, s32 currentWidth, s32 currentHeight)
|
||||
void CColorConverter::convert16bitToA8R8G8B8andResize(const s16* in, s32* out, u32 newWidth, u32 newHeight, u32 currentWidth, u32 currentHeight)
|
||||
{
|
||||
if (!newWidth || !newHeight)
|
||||
return;
|
||||
@ -280,11 +280,11 @@ void CColorConverter::convert16bitToA8R8G8B8andResize(const s16* in, s32* out, s
|
||||
f32 sy;
|
||||
s32 t;
|
||||
|
||||
for (s32 x=0; x<newWidth; ++x)
|
||||
for (u32 x=0; x<newWidth; ++x)
|
||||
{
|
||||
sy = 0.0f;
|
||||
|
||||
for (s32 y=0; y<newHeight; ++y)
|
||||
for (u32 y=0; y<newHeight; ++y)
|
||||
{
|
||||
t = in[(s32)(((s32)sy)*currentWidth + x*sourceXStep)];
|
||||
t = (((t >> 15)&0x1)<<31) | (((t >> 10)&0x1F)<<19) |
|
||||
@ -299,20 +299,20 @@ void CColorConverter::convert16bitToA8R8G8B8andResize(const s16* in, s32* out, s
|
||||
|
||||
|
||||
//! copies X8R8G8B8 32 bit data
|
||||
void CColorConverter::convert32BitTo32Bit(const s32* in, s32* out, s32 width, s32 height, s32 linepad, bool flip)
|
||||
void CColorConverter::convert32BitTo32Bit(const s32* in, s32* out, u32 width, u32 height, u32 linepad, bool flip)
|
||||
{
|
||||
if (!in || !out)
|
||||
return;
|
||||
|
||||
if (flip)
|
||||
out += width * height;
|
||||
out += (size_t)width * height;
|
||||
|
||||
for (s32 y=0; y<height; ++y)
|
||||
for (u32 y=0; y<height; ++y)
|
||||
{
|
||||
if (flip)
|
||||
out -= width;
|
||||
#ifdef __BIG_ENDIAN__
|
||||
for (s32 x=0; x<width; ++x)
|
||||
for (u32 x=0; x<width; ++x)
|
||||
out[x]=os::Byteswap::byteswap(in[x]);
|
||||
#else
|
||||
memcpy(out, in, width*sizeof(s32));
|
||||
@ -326,12 +326,12 @@ void CColorConverter::convert32BitTo32Bit(const s32* in, s32* out, s32 width, s3
|
||||
|
||||
|
||||
|
||||
void CColorConverter::convert_A1R5G5B5toR8G8B8(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_A1R5G5B5toR8G8B8(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
u16* sB = (u16*)sP;
|
||||
u8 * dB = (u8 *)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
for (u32 x = 0; x < sN; ++x)
|
||||
{
|
||||
dB[2] = (*sB & 0x7c00) >> 7;
|
||||
dB[1] = (*sB & 0x03e0) >> 2;
|
||||
@ -342,12 +342,12 @@ void CColorConverter::convert_A1R5G5B5toR8G8B8(const void* sP, s32 sN, void* dP)
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_A1R5G5B5toB8G8R8(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_A1R5G5B5toB8G8R8(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
u16* sB = (u16*)sP;
|
||||
u8 * dB = (u8 *)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
for (u32 x = 0; x < sN; ++x)
|
||||
{
|
||||
dB[0] = (*sB & 0x7c00) >> 7;
|
||||
dB[1] = (*sB & 0x03e0) >> 2;
|
||||
@ -358,47 +358,47 @@ void CColorConverter::convert_A1R5G5B5toB8G8R8(const void* sP, s32 sN, void* dP)
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_A1R5G5B5toR5G5B5A1(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_A1R5G5B5toR5G5B5A1(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
const u16* sB = (const u16*)sP;
|
||||
u16* dB = (u16*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
for (u32 x = 0; x < sN; ++x)
|
||||
{
|
||||
*dB = (*sB<<1)|(*sB>>15);
|
||||
++sB; ++dB;
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_A1R5G5B5toA8R8G8B8(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_A1R5G5B5toA8R8G8B8(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
u16* sB = (u16*)sP;
|
||||
u32* dB = (u32*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
for (u32 x = 0; x < sN; ++x)
|
||||
*dB++ = A1R5G5B5toA8R8G8B8(*sB++);
|
||||
}
|
||||
|
||||
void CColorConverter::convert_A1R5G5B5toA1R5G5B5(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_A1R5G5B5toA1R5G5B5(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
memcpy(dP, sP, sN * 2);
|
||||
}
|
||||
|
||||
void CColorConverter::convert_A1R5G5B5toR5G6B5(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_A1R5G5B5toR5G6B5(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
u16* sB = (u16*)sP;
|
||||
u16* dB = (u16*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
for (u32 x = 0; x < sN; ++x)
|
||||
*dB++ = A1R5G5B5toR5G6B5(*sB++);
|
||||
}
|
||||
|
||||
void CColorConverter::convert_A8R8G8B8toR8G8B8(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_A8R8G8B8toR8G8B8(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
u8* sB = (u8*)sP;
|
||||
u8* dB = (u8*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
for (u32 x = 0; x < sN; ++x)
|
||||
{
|
||||
// sB[3] is alpha
|
||||
dB[0] = sB[2];
|
||||
@ -410,12 +410,12 @@ void CColorConverter::convert_A8R8G8B8toR8G8B8(const void* sP, s32 sN, void* dP)
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_A8R8G8B8toB8G8R8(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_A8R8G8B8toB8G8R8(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
u8* sB = (u8*)sP;
|
||||
u8* dB = (u8*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
for (u32 x = 0; x < sN; ++x)
|
||||
{
|
||||
// sB[3] is alpha
|
||||
dB[0] = sB[0];
|
||||
@ -427,26 +427,26 @@ void CColorConverter::convert_A8R8G8B8toB8G8R8(const void* sP, s32 sN, void* dP)
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_A8R8G8B8toA8R8G8B8(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_A8R8G8B8toA8R8G8B8(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
memcpy(dP, sP, sN * 4);
|
||||
}
|
||||
|
||||
void CColorConverter::convert_A8R8G8B8toA1R5G5B5(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_A8R8G8B8toA1R5G5B5(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
u32* sB = (u32*)sP;
|
||||
u16* dB = (u16*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
for (u32 x = 0; x < sN; ++x)
|
||||
*dB++ = A8R8G8B8toA1R5G5B5(*sB++);
|
||||
}
|
||||
|
||||
void CColorConverter::convert_A8R8G8B8toA1B5G5R5(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_A8R8G8B8toA1B5G5R5(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
u8 * sB = (u8 *)sP;
|
||||
u16* dB = (u16*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
for (u32 x = 0; x < sN; ++x)
|
||||
{
|
||||
s32 r = sB[0] >> 3;
|
||||
s32 g = sB[1] >> 3;
|
||||
@ -460,12 +460,12 @@ void CColorConverter::convert_A8R8G8B8toA1B5G5R5(const void* sP, s32 sN, void* d
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_A8R8G8B8toR5G6B5(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_A8R8G8B8toR5G6B5(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
u8 * sB = (u8 *)sP;
|
||||
u16* dB = (u16*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
for (u32 x = 0; x < sN; ++x)
|
||||
{
|
||||
s32 r = sB[2] >> 3;
|
||||
s32 g = sB[1] >> 2;
|
||||
@ -478,12 +478,12 @@ void CColorConverter::convert_A8R8G8B8toR5G6B5(const void* sP, s32 sN, void* dP)
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_A8R8G8B8toR3G3B2(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_A8R8G8B8toR3G3B2(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
u8* sB = (u8*)sP;
|
||||
u8* dB = (u8*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
for (u32 x = 0; x < sN; ++x)
|
||||
{
|
||||
u8 r = sB[2] & 0xe0;
|
||||
u8 g = (sB[1] & 0xe0) >> 3;
|
||||
@ -496,17 +496,17 @@ void CColorConverter::convert_A8R8G8B8toR3G3B2(const void* sP, s32 sN, void* dP)
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_R8G8B8toR8G8B8(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_R8G8B8toR8G8B8(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
memcpy(dP, sP, sN * 3);
|
||||
}
|
||||
|
||||
void CColorConverter::convert_R8G8B8toA8R8G8B8(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_R8G8B8toA8R8G8B8(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
u8* sB = (u8* )sP;
|
||||
u32* dB = (u32*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
for (u32 x = 0; x < sN; ++x)
|
||||
{
|
||||
*dB = 0xff000000 | (sB[0]<<16) | (sB[1]<<8) | sB[2];
|
||||
|
||||
@ -515,12 +515,12 @@ void CColorConverter::convert_R8G8B8toA8R8G8B8(const void* sP, s32 sN, void* dP)
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_R8G8B8toA1R5G5B5(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_R8G8B8toA1R5G5B5(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
u8 * sB = (u8 *)sP;
|
||||
u16* dB = (u16*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
for (u32 x = 0; x < sN; ++x)
|
||||
{
|
||||
s32 r = sB[0] >> 3;
|
||||
s32 g = sB[1] >> 3;
|
||||
@ -533,12 +533,12 @@ void CColorConverter::convert_R8G8B8toA1R5G5B5(const void* sP, s32 sN, void* dP)
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_B8G8R8toA8R8G8B8(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_B8G8R8toA8R8G8B8(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
u8* sB = (u8* )sP;
|
||||
u32* dB = (u32*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
for (u32 x = 0; x < sN; ++x)
|
||||
{
|
||||
*dB = 0xff000000 | (sB[2]<<16) | (sB[1]<<8) | sB[0];
|
||||
|
||||
@ -547,36 +547,36 @@ void CColorConverter::convert_B8G8R8toA8R8G8B8(const void* sP, s32 sN, void* dP)
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_A8R8G8B8toR8G8B8A8(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_A8R8G8B8toR8G8B8A8(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
const u32* sB = (const u32*)sP;
|
||||
u32* dB = (u32*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
for (u32 x = 0; x < sN; ++x)
|
||||
{
|
||||
*dB++ = (*sB<<8) | (*sB>>24);
|
||||
++sB;
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_A8R8G8B8toA8B8G8R8(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_A8R8G8B8toA8B8G8R8(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
const u32* sB = (const u32*)sP;
|
||||
u32* dB = (u32*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
for (u32 x = 0; x < sN; ++x)
|
||||
{
|
||||
*dB++ = (*sB&0xff00ff00)|((*sB&0x00ff0000)>>16)|((*sB&0x000000ff)<<16);
|
||||
++sB;
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_B8G8R8A8toA8R8G8B8(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_B8G8R8A8toA8R8G8B8(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
u8* sB = (u8*)sP;
|
||||
u8* dB = (u8*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
for (u32 x = 0; x < sN; ++x)
|
||||
{
|
||||
dB[0] = sB[3];
|
||||
dB[1] = sB[2];
|
||||
@ -589,12 +589,12 @@ void CColorConverter::convert_B8G8R8A8toA8R8G8B8(const void* sP, s32 sN, void* d
|
||||
|
||||
}
|
||||
|
||||
void CColorConverter::convert_R8G8B8toB8G8R8(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_R8G8B8toB8G8R8(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
u8* sB = (u8*)sP;
|
||||
u8* dB = (u8*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
for (u32 x = 0; x < sN; ++x)
|
||||
{
|
||||
dB[2] = sB[0];
|
||||
dB[1] = sB[1];
|
||||
@ -605,12 +605,12 @@ void CColorConverter::convert_R8G8B8toB8G8R8(const void* sP, s32 sN, void* dP)
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_R8G8B8toR5G6B5(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_R8G8B8toR5G6B5(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
u8 * sB = (u8 *)sP;
|
||||
u16* dB = (u16*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
for (u32 x = 0; x < sN; ++x)
|
||||
{
|
||||
s32 r = sB[0] >> 3;
|
||||
s32 g = sB[1] >> 2;
|
||||
@ -623,17 +623,17 @@ void CColorConverter::convert_R8G8B8toR5G6B5(const void* sP, s32 sN, void* dP)
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_R5G6B5toR5G6B5(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_R5G6B5toR5G6B5(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
memcpy(dP, sP, sN * 2);
|
||||
}
|
||||
|
||||
void CColorConverter::convert_R5G6B5toR8G8B8(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_R5G6B5toR8G8B8(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
u16* sB = (u16*)sP;
|
||||
u8 * dB = (u8 *)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
for (u32 x = 0; x < sN; ++x)
|
||||
{
|
||||
dB[0] = (*sB & 0xf800) >> 8;
|
||||
dB[1] = (*sB & 0x07e0) >> 3;
|
||||
@ -644,12 +644,12 @@ void CColorConverter::convert_R5G6B5toR8G8B8(const void* sP, s32 sN, void* dP)
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_R5G6B5toB8G8R8(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_R5G6B5toB8G8R8(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
u16* sB = (u16*)sP;
|
||||
u8 * dB = (u8 *)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
for (u32 x = 0; x < sN; ++x)
|
||||
{
|
||||
dB[2] = (*sB & 0xf800) >> 8;
|
||||
dB[1] = (*sB & 0x07e0) >> 3;
|
||||
@ -660,21 +660,21 @@ void CColorConverter::convert_R5G6B5toB8G8R8(const void* sP, s32 sN, void* dP)
|
||||
}
|
||||
}
|
||||
|
||||
void CColorConverter::convert_R5G6B5toA8R8G8B8(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_R5G6B5toA8R8G8B8(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
u16* sB = (u16*)sP;
|
||||
u32* dB = (u32*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
for (u32 x = 0; x < sN; ++x)
|
||||
*dB++ = R5G6B5toA8R8G8B8(*sB++);
|
||||
}
|
||||
|
||||
void CColorConverter::convert_R5G6B5toA1R5G5B5(const void* sP, s32 sN, void* dP)
|
||||
void CColorConverter::convert_R5G6B5toA1R5G5B5(const void* sP, u32 sN, void* dP)
|
||||
{
|
||||
u16* sB = (u16*)sP;
|
||||
u16* dB = (u16*)dP;
|
||||
|
||||
for (s32 x = 0; x < sN; ++x)
|
||||
for (u32 x = 0; x < sN; ++x)
|
||||
*dB++ = R5G6B5toA1R5G5B5(*sB++);
|
||||
}
|
||||
|
||||
@ -736,7 +736,7 @@ bool CColorConverter::canConvertFormat(ECOLOR_FORMAT sourceFormat, ECOLOR_FORMAT
|
||||
return false;
|
||||
}
|
||||
|
||||
void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN,
|
||||
void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, u32 sN,
|
||||
void* dP, ECOLOR_FORMAT dF)
|
||||
{
|
||||
// please also update can_convert_viaFormat when adding new conversions
|
||||
|
@ -18,34 +18,34 @@ class CColorConverter
|
||||
public:
|
||||
|
||||
//! converts a monochrome bitmap to A1R5G5B5
|
||||
static void convert1BitTo16Bit(const u8* in, s16* out, s32 width, s32 height, s32 linepad=0, bool flip=false);
|
||||
static void convert1BitTo16Bit(const u8* in, s16* out, u32 width, u32 height, u32 linepad=0, bool flip=false);
|
||||
|
||||
//! converts a 4 bit palettized image to A1R5G5B5
|
||||
static void convert4BitTo16Bit(const u8* in, s16* out, s32 width, s32 height, const s32* palette, s32 linepad=0, bool flip=false);
|
||||
static void convert4BitTo16Bit(const u8* in, s16* out, u32 width, u32 height, const s32* palette, u32 linepad=0, bool flip=false);
|
||||
|
||||
//! converts a 8 bit palettized image to A1R5G5B5
|
||||
static void convert8BitTo16Bit(const u8* in, s16* out, s32 width, s32 height, const s32* palette, s32 linepad=0, bool flip=false);
|
||||
static void convert8BitTo16Bit(const u8* in, s16* out, u32 width, u32 height, const s32* palette, u32 linepad=0, bool flip=false);
|
||||
|
||||
//! converts a 8 bit palettized or non palettized image (A8) into R8G8B8
|
||||
static void convert8BitTo24Bit(const u8* in, u8* out, s32 width, s32 height, const u8* palette, s32 linepad = 0, bool flip=false);
|
||||
static void convert8BitTo24Bit(const u8* in, u8* out, u32 width, u32 height, const u8* palette, u32 linepad = 0, bool flip=false);
|
||||
|
||||
//! converts a 8 bit palettized or non palettized image (A8) into A8R8G8B8
|
||||
static void convert8BitTo32Bit(const u8* in, u8* out, s32 width, s32 height, const u8* palette, s32 linepad = 0, bool flip=false);
|
||||
static void convert8BitTo32Bit(const u8* in, u8* out, u32 width, u32 height, const u8* palette, u32 linepad = 0, bool flip=false);
|
||||
|
||||
//! converts R8G8B8 16 bit data to A1R5G5B5 data
|
||||
static void convert16BitTo16Bit(const s16* in, s16* out, s32 width, s32 height, s32 linepad=0, bool flip=false);
|
||||
static void convert16BitTo16Bit(const s16* in, s16* out, u32 width, u32 height, u32 linepad=0, bool flip=false);
|
||||
|
||||
//! copies R8G8B8 24 bit data to 24 data, and flips and
|
||||
//! mirrors the image during the process.
|
||||
static void convert24BitTo24Bit(const u8* in, u8* out, s32 width, s32 height, s32 linepad=0, bool flip=false, bool bgr=false);
|
||||
static void convert24BitTo24Bit(const u8* in, u8* out, u32 width, u32 height, u32 linepad=0, bool flip=false, bool bgr=false);
|
||||
|
||||
//! Resizes the surface to a new size and converts it at the same time
|
||||
//! to an A8R8G8B8 format, returning the pointer to the new buffer.
|
||||
static void convert16bitToA8R8G8B8andResize(const s16* in, s32* out, s32 newWidth, s32 newHeight, s32 currentWidth, s32 currentHeight);
|
||||
static void convert16bitToA8R8G8B8andResize(const s16* in, s32* out, u32 newWidth, u32 newHeight, u32 currentWidth, u32 currentHeight);
|
||||
|
||||
//! copies X8R8G8B8 32 bit data, and flips and
|
||||
//! mirrors the image during the process.
|
||||
static void convert32BitTo32Bit(const s32* in, s32* out, s32 width, s32 height, s32 linepad, bool flip=false);
|
||||
static void convert32BitTo32Bit(const s32* in, s32* out, u32 width, u32 height, u32 linepad, bool flip=false);
|
||||
|
||||
|
||||
//! Functions for converting one image format to another efficiently
|
||||
@ -57,37 +57,37 @@ public:
|
||||
//! \param sN number of source pixels to copy
|
||||
//! \param dP pointer to destination data buffer. must be big enough
|
||||
//! to hold sN pixels in the output format.
|
||||
static void convert_A1R5G5B5toR8G8B8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_A1R5G5B5toB8G8R8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_A1R5G5B5toA8R8G8B8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_A1R5G5B5toA1R5G5B5(const void* sP, s32 sN, void* dP);
|
||||
static void convert_A1R5G5B5toR5G5B5A1(const void* sP, s32 sN, void* dP);
|
||||
static void convert_A1R5G5B5toR5G6B5(const void* sP, s32 sN, void* dP);
|
||||
static void convert_A1R5G5B5toR8G8B8(const void* sP, u32 sN, void* dP);
|
||||
static void convert_A1R5G5B5toB8G8R8(const void* sP, u32 sN, void* dP);
|
||||
static void convert_A1R5G5B5toA8R8G8B8(const void* sP, u32 sN, void* dP);
|
||||
static void convert_A1R5G5B5toA1R5G5B5(const void* sP, u32 sN, void* dP);
|
||||
static void convert_A1R5G5B5toR5G6B5(const void* sP, u32 sN, void* dP);
|
||||
static void convert_A1R5G5B5toR5G5B5A1(const void* sP, u32 sN, void* dP);
|
||||
|
||||
static void convert_A8R8G8B8toR8G8B8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_A8R8G8B8toB8G8R8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_A8R8G8B8toA8R8G8B8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_A8R8G8B8toA1R5G5B5(const void* sP, s32 sN, void* dP);
|
||||
static void convert_A8R8G8B8toA1B5G5R5(const void* sP, s32 sN, void* dP);
|
||||
static void convert_A8R8G8B8toR5G6B5(const void* sP, s32 sN, void* dP);
|
||||
static void convert_A8R8G8B8toR8G8B8(const void* sP, u32 sN, void* dP);
|
||||
static void convert_A8R8G8B8toB8G8R8(const void* sP, u32 sN, void* dP);
|
||||
static void convert_A8R8G8B8toA8R8G8B8(const void* sP, u32 sN, void* dP);
|
||||
static void convert_A8R8G8B8toA1R5G5B5(const void* sP, u32 sN, void* dP);
|
||||
static void convert_A8R8G8B8toA1B5G5R5(const void* sP, u32 sN, void* dP);
|
||||
static void convert_A8R8G8B8toR5G6B5(const void* sP, u32 sN, void* dP);
|
||||
|
||||
static void convert_A8R8G8B8toR3G3B2(const void* sP, s32 sN, void* dP);
|
||||
static void convert_R8G8B8toR8G8B8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_R8G8B8toA8R8G8B8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_R8G8B8toA1R5G5B5(const void* sP, s32 sN, void* dP);
|
||||
static void convert_R8G8B8toB8G8R8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_R8G8B8toR5G6B5(const void* sP, s32 sN, void* dP);
|
||||
static void convert_B8G8R8toA8R8G8B8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_B8G8R8A8toA8R8G8B8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_A8R8G8B8toR8G8B8A8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_A8R8G8B8toA8B8G8R8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_A8R8G8B8toR3G3B2(const void* sP, u32 sN, void* dP);
|
||||
static void convert_R8G8B8toR8G8B8(const void* sP, u32 sN, void* dP);
|
||||
static void convert_R8G8B8toA8R8G8B8(const void* sP, u32 sN, void* dP);
|
||||
static void convert_R8G8B8toA1R5G5B5(const void* sP, u32 sN, void* dP);
|
||||
static void convert_R8G8B8toB8G8R8(const void* sP, u32 sN, void* dP);
|
||||
static void convert_R8G8B8toR5G6B5(const void* sP, u32 sN, void* dP);
|
||||
static void convert_B8G8R8toA8R8G8B8(const void* sP, u32 sN, void* dP);
|
||||
static void convert_B8G8R8A8toA8R8G8B8(const void* sP, u32 sN, void* dP);
|
||||
static void convert_A8R8G8B8toR8G8B8A8(const void* sP, u32 sN, void* dP);
|
||||
static void convert_A8R8G8B8toA8B8G8R8(const void* sP, u32 sN, void* dP);
|
||||
|
||||
static void convert_R5G6B5toR5G6B5(const void* sP, s32 sN, void* dP);
|
||||
static void convert_R5G6B5toR8G8B8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_R5G6B5toB8G8R8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_R5G6B5toA8R8G8B8(const void* sP, s32 sN, void* dP);
|
||||
static void convert_R5G6B5toA1R5G5B5(const void* sP, s32 sN, void* dP);
|
||||
static void convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN,
|
||||
static void convert_R5G6B5toR5G6B5(const void* sP, u32 sN, void* dP);
|
||||
static void convert_R5G6B5toR8G8B8(const void* sP, u32 sN, void* dP);
|
||||
static void convert_R5G6B5toB8G8R8(const void* sP, u32 sN, void* dP);
|
||||
static void convert_R5G6B5toA8R8G8B8(const void* sP, u32 sN, void* dP);
|
||||
static void convert_R5G6B5toA1R5G5B5(const void* sP, u32 sN, void* dP);
|
||||
static void convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, u32 sN,
|
||||
void* dP, ECOLOR_FORMAT dF);
|
||||
// Check if convert_viaFormat is usable
|
||||
static bool canConvertFormat(ECOLOR_FORMAT sourceFormat, ECOLOR_FORMAT destFormat);
|
||||
|
@ -1253,13 +1253,10 @@ void CD3D9Driver::updateOcclusionQuery(scene::ISceneNode* node, bool block)
|
||||
/** Return value is the number of visible pixels/fragments.
|
||||
The value is a safe approximation, i.e. can be larger than the
|
||||
actual value of pixels. */
|
||||
u32 CD3D9Driver::getOcclusionQueryResult(scene::ISceneNode* node) const
|
||||
u32 CD3D9Driver::getOcclusionQueryResult(const scene::ISceneNode* node) const
|
||||
{
|
||||
const s32 index = OcclusionQueries.linear_search(SOccQuery(node));
|
||||
if (index != -1)
|
||||
return OcclusionQueries[index].Result;
|
||||
else
|
||||
return ~0;
|
||||
const s32 index = OcclusionQueries.linear_search(node);
|
||||
return index < 0 ? ~0 : OcclusionQueries[index].Result;
|
||||
}
|
||||
|
||||
|
||||
|
@ -115,7 +115,7 @@ namespace video
|
||||
/** Return value is the number of visible pixels/fragments.
|
||||
The value is a safe approximation, i.e. can be larger then the
|
||||
actual value of pixels. */
|
||||
virtual u32 getOcclusionQueryResult(scene::ISceneNode* node) const IRR_OVERRIDE;
|
||||
virtual u32 getOcclusionQueryResult(const scene::ISceneNode* node) const IRR_OVERRIDE;
|
||||
|
||||
//! Create render target.
|
||||
virtual IRenderTarget* addRenderTarget() IRR_OVERRIDE;
|
||||
|
@ -335,7 +335,7 @@ void CD3D9Texture::regenerateMipMapLevels(void* data, u32 layer)
|
||||
u32 width = Size.Width;
|
||||
u32 height = Size.Height;
|
||||
u8* tmpData = static_cast<u8*>(data);
|
||||
u32 dataSize = 0;
|
||||
size_t dataSize = 0;
|
||||
u32 level = 0;
|
||||
|
||||
do
|
||||
@ -714,7 +714,7 @@ void CD3D9Texture::uploadTexture(void* data, u32 mipmapLevel, u32 layer)
|
||||
u32 width = Size.Width >> mipmapLevel;
|
||||
u32 height = Size.Height >> mipmapLevel;
|
||||
|
||||
u32 dataSize = IImage::getDataSizeFromFormat(ColorFormat, width, height);
|
||||
size_t dataSize = IImage::getDataSizeFromFormat(ColorFormat, width, height);
|
||||
|
||||
HRESULT hr = 0;
|
||||
|
||||
|
@ -97,13 +97,6 @@ s32 CGUIListBox::getIcon(u32 id) const
|
||||
}
|
||||
|
||||
|
||||
//! adds a list item, returns id of item
|
||||
u32 CGUIListBox::addItem(const wchar_t* text)
|
||||
{
|
||||
return addItem(text, -1);
|
||||
}
|
||||
|
||||
|
||||
//! adds a list item, returns id of item
|
||||
void CGUIListBox::removeItem(u32 id)
|
||||
{
|
||||
|
@ -36,9 +36,6 @@ namespace gui
|
||||
//! returns string of a list item. the id may be a value from 0 to itemCount-1
|
||||
virtual const wchar_t* getListItem(u32 id) const IRR_OVERRIDE;
|
||||
|
||||
//! adds an list item, returns id of item
|
||||
virtual u32 addItem(const wchar_t* text) IRR_OVERRIDE;
|
||||
|
||||
//! clears the list
|
||||
virtual void clear() IRR_OVERRIDE;
|
||||
|
||||
@ -62,7 +59,14 @@ namespace gui
|
||||
//! \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) IRR_OVERRIDE;
|
||||
virtual u32 addItem(const wchar_t* text, s32 icon=-1) IRR_OVERRIDE;
|
||||
|
||||
//! 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=-1) IRR_OVERRIDE;
|
||||
|
||||
//! set the item at the given index
|
||||
virtual void setItem(u32 index, const wchar_t* text, s32 icon=-1) IRR_OVERRIDE;
|
||||
|
||||
//! Returns the icon of an item
|
||||
virtual s32 getIcon(u32 id) const IRR_OVERRIDE;
|
||||
@ -115,13 +119,6 @@ namespace gui
|
||||
//! return the default color which is used for the given colorType
|
||||
virtual video::SColor getItemDefaultColor(EGUI_LISTBOX_COLOR colorType) const IRR_OVERRIDE;
|
||||
|
||||
//! set the item at the given index
|
||||
virtual void setItem(u32 index, const wchar_t* text, s32 icon) IRR_OVERRIDE;
|
||||
|
||||
//! 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) IRR_OVERRIDE;
|
||||
|
||||
//! Swap the items at the given indices
|
||||
virtual void swapItems(u32 index1, u32 index2) IRR_OVERRIDE;
|
||||
|
||||
|
@ -42,6 +42,9 @@ void CGUIMenu::draw()
|
||||
return;
|
||||
|
||||
IGUISkin* skin = Environment->getSkin();
|
||||
if ( !skin )
|
||||
return;
|
||||
|
||||
IGUIFont* font = skin->getFont(EGDF_MENU);
|
||||
|
||||
if (font != LastFont)
|
||||
@ -199,6 +202,8 @@ void CGUIMenu::recalculateSize()
|
||||
|
||||
|
||||
IGUISkin* skin = Environment->getSkin();
|
||||
if ( !skin )
|
||||
return;
|
||||
IGUIFont* font = skin->getFont(EGDF_MENU);
|
||||
|
||||
if (!font)
|
||||
|
@ -24,8 +24,7 @@ CImage::CImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size, void* d
|
||||
}
|
||||
else
|
||||
{
|
||||
const u32 dataSize = getDataSizeFromFormat(Format, Size.Width, Size.Height);
|
||||
|
||||
const size_t dataSize = getDataSizeFromFormat(Format, Size.Width, Size.Height);
|
||||
Data = new u8[align_next(dataSize,16)];
|
||||
memcpy(Data, data, dataSize);
|
||||
DeleteMemory = true;
|
||||
@ -36,7 +35,8 @@ CImage::CImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size, void* d
|
||||
//! Constructor of empty image
|
||||
CImage::CImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size) : IImage(format, size, true)
|
||||
{
|
||||
Data = new u8[align_next(getDataSizeFromFormat(Format, Size.Width, Size.Height),16)];
|
||||
const size_t dataSize = getDataSizeFromFormat(Format, Size.Width, Size.Height);
|
||||
Data = new u8[align_next(dataSize,16)];
|
||||
DeleteMemory = true;
|
||||
}
|
||||
|
||||
@ -194,7 +194,7 @@ void CImage::copyToScaling(void* target, u32 width, u32 height, ECOLOR_FORMAT fo
|
||||
{
|
||||
if (pitch==Pitch)
|
||||
{
|
||||
memcpy(target, Data, height*pitch);
|
||||
memcpy(target, Data, (size_t)height*pitch);
|
||||
return;
|
||||
}
|
||||
else
|
||||
@ -332,8 +332,8 @@ void CImage::fill(const SColor &color)
|
||||
{
|
||||
u8 rgb[3];
|
||||
CColorConverter::convert_A8R8G8B8toR8G8B8(&color, 1, rgb);
|
||||
const u32 size = getImageDataSizeInBytes();
|
||||
for (u32 i=0; i<size; i+=3)
|
||||
const size_t size = getImageDataSizeInBytes();
|
||||
for (size_t i=0; i<size; i+=3)
|
||||
{
|
||||
memcpy(Data+i, rgb, 3);
|
||||
}
|
||||
|
@ -313,6 +313,13 @@ IImage* CImageLoaderBMP::loadImage(io::IReadFile* file) const
|
||||
dim.Height = header.Height;
|
||||
|
||||
IImage* image = 0;
|
||||
|
||||
if ( !IImage::checkDataSizeLimit( (size_t)header.Width*header.Height*header.BPP) )
|
||||
{
|
||||
os::Printer::log("Image dimensions too large for file", file->getFileName(), ELL_WARNING);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
switch(header.BPP)
|
||||
{
|
||||
case 1:
|
||||
@ -348,7 +355,7 @@ IImage* CImageLoaderBMP::loadImage(io::IReadFile* file) const
|
||||
};
|
||||
|
||||
// clean up
|
||||
|
||||
cleanup:
|
||||
delete [] paletteData;
|
||||
delete [] bmpData;
|
||||
|
||||
|
@ -693,8 +693,8 @@ IImage* CImageLoaderDDS::loadImage(io::IReadFile* file) const
|
||||
s32 width, height;
|
||||
eDDSPixelFormat pixelFormat;
|
||||
ECOLOR_FORMAT format = ECF_UNKNOWN;
|
||||
u32 dataSize = 0;
|
||||
u32 mipMapsDataSize = 0;
|
||||
size_t dataSize = 0;
|
||||
size_t mipMapsDataSize = 0;
|
||||
bool is3D = false;
|
||||
bool useAlpha = false;
|
||||
u32 mipMapCount = 0;
|
||||
|
@ -145,10 +145,13 @@ IImage* CImageLoaderJPG::loadImage(io::IReadFile* file) const
|
||||
return 0;
|
||||
|
||||
core::stringc filename = file->getFileName();
|
||||
long fileSize = file->getSize();
|
||||
if ( fileSize < 3 )
|
||||
return 0;
|
||||
|
||||
u8 **rowPtr=0;
|
||||
u8* input = new u8[file->getSize()];
|
||||
file->read(input, file->getSize());
|
||||
u8* input = new u8[fileSize];
|
||||
file->read(input, fileSize);
|
||||
|
||||
// allocate and initialize JPEG decompression object
|
||||
struct jpeg_decompress_struct cinfo;
|
||||
@ -188,7 +191,7 @@ IImage* CImageLoaderJPG::loadImage(io::IReadFile* file) const
|
||||
jpeg_source_mgr jsrc;
|
||||
|
||||
// Set up data pointer
|
||||
jsrc.bytes_in_buffer = file->getSize();
|
||||
jsrc.bytes_in_buffer = fileSize;
|
||||
jsrc.next_input_byte = (JOCTET*)input;
|
||||
cinfo.src = &jsrc;
|
||||
|
||||
@ -225,10 +228,19 @@ IImage* CImageLoaderJPG::loadImage(io::IReadFile* file) const
|
||||
jpeg_start_decompress(&cinfo);
|
||||
|
||||
// Get image data
|
||||
u16 rowspan = cinfo.image_width * cinfo.out_color_components;
|
||||
u32 rowspan = cinfo.image_width * cinfo.out_color_components;
|
||||
u32 width = cinfo.image_width;
|
||||
u32 height = cinfo.image_height;
|
||||
|
||||
if ( width > JPEG_MAX_DIMENSION || height > JPEG_MAX_DIMENSION
|
||||
|| !IImage::checkDataSizeLimit(IImage::getDataSizeFromFormat(ECF_R8G8B8, width, height))
|
||||
)
|
||||
{
|
||||
os::Printer::log("Image dimensions too large in file", filename, ELL_ERROR);
|
||||
longjmp(jerr.setjmp_buffer, 1);
|
||||
}
|
||||
|
||||
|
||||
// Allocate memory for buffer
|
||||
u8* output = new u8[rowspan * height];
|
||||
|
||||
@ -237,7 +249,7 @@ IImage* CImageLoaderJPG::loadImage(io::IReadFile* file) const
|
||||
// Create array of row pointers for lib
|
||||
rowPtr = new u8* [height];
|
||||
|
||||
for( u32 i = 0; i < height; i++ )
|
||||
for( size_t i = 0; i < height; i++ )
|
||||
rowPtr[i] = &output[ i * rowspan ];
|
||||
|
||||
u32 rowsRead = 0;
|
||||
@ -246,6 +258,7 @@ IImage* CImageLoaderJPG::loadImage(io::IReadFile* file) const
|
||||
rowsRead += jpeg_read_scanlines( &cinfo, &rowPtr[rowsRead], cinfo.output_height - rowsRead );
|
||||
|
||||
delete [] rowPtr;
|
||||
rowPtr = 0;
|
||||
// Finish decompression
|
||||
|
||||
jpeg_finish_decompress(&cinfo);
|
||||
|
@ -158,6 +158,9 @@ IImage* CImageLoaderPng::loadImage(io::IReadFile* file) const
|
||||
Height=h;
|
||||
}
|
||||
|
||||
if (!IImage::checkDataSizeLimit((size_t)Width* Height * (BitDepth/8)))
|
||||
png_cpexcept_error(png_ptr, "Image dimensions too large");
|
||||
|
||||
// Convert palette color to true color
|
||||
if (ColorType==PNG_COLOR_TYPE_PALETTE)
|
||||
png_set_palette_to_rgb(png_ptr);
|
||||
|
@ -69,7 +69,7 @@ core::array<IImage*> CImageLoaderPVR::loadImages(io::IReadFile* file, E_TEXTURE_
|
||||
core::array<u8*> mipMapsDataArray;
|
||||
|
||||
ECOLOR_FORMAT format = ECF_UNKNOWN;
|
||||
u32 dataSize = 0;
|
||||
size_t dataSize = 0;
|
||||
|
||||
file->seek(0);
|
||||
file->read(&header, sizeof(SPVRHeader));
|
||||
@ -216,7 +216,7 @@ core::array<IImage*> CImageLoaderPVR::loadImages(io::IReadFile* file, E_TEXTURE_
|
||||
// read texture
|
||||
|
||||
dataSize = 0;
|
||||
long offset = 0;
|
||||
size_t offset = 0;
|
||||
|
||||
for (u32 i = 0; i < header.MipMapCount; ++i)
|
||||
{
|
||||
|
@ -106,6 +106,12 @@ IImage* CImageLoaderTGA::loadImage(io::IReadFile* file) const
|
||||
header.ImageHeight = os::Byteswap::byteswap(header.ImageHeight);
|
||||
#endif
|
||||
|
||||
if (!IImage::checkDataSizeLimit((size_t)header.ImageWidth* header.ImageHeight * (header.PixelDepth/8)))
|
||||
{
|
||||
os::Printer::log("Image dimensions too large in file.", file->getFileName(), ELL_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// skip image identification field
|
||||
if (header.IdLength)
|
||||
file->seek(header.IdLength, true);
|
||||
|
@ -62,7 +62,7 @@ bool CImageWriterBMP::writeImage(io::IWriteFile* file, IImage* image, u32 param)
|
||||
imageHeader.FileSize = imageHeader.BitmapDataOffset + imageHeader.BitmapDataSize;
|
||||
|
||||
// bitmaps are stored upside down and padded so we always do this
|
||||
void (*CColorConverter_convertFORMATtoFORMAT)(const void*, s32, void*) = 0;
|
||||
void (*CColorConverter_convertFORMATtoFORMAT)(const void*, u32, void*) = 0;
|
||||
switch(image->getColorFormat())
|
||||
{
|
||||
case ECF_R8G8B8:
|
||||
|
@ -107,7 +107,7 @@ static void jpeg_file_dest(j_compress_ptr cinfo, io::IWriteFile* file)
|
||||
*/
|
||||
static bool writeJPEGFile(io::IWriteFile* file, IImage* image, u32 quality)
|
||||
{
|
||||
void (*format)(const void*, s32, void*) = 0;
|
||||
void (*format)(const void*, u32, void*) = 0;
|
||||
switch( image->getColorFormat () )
|
||||
{
|
||||
case ECF_R8G8B8:
|
||||
|
@ -55,10 +55,10 @@ bool CImageWriterTGA::writeImage(io::IWriteFile *file, IImage *image,u32 param)
|
||||
// be fixed to only swap/flip
|
||||
imageHeader.ImageDescriptor = (1 << 5);
|
||||
|
||||
// chances are good we'll need to swizzle data, so i'm going
|
||||
// chances are good we'll need to swizzle data, so I'm going
|
||||
// to convert and write one scan line at a time. it's also
|
||||
// a bit cleaner this way
|
||||
void (*CColorConverter_convertFORMATtoFORMAT)(const void*, s32, void*) = 0;
|
||||
void (*CColorConverter_convertFORMATtoFORMAT)(const void*, u32, void*) = 0;
|
||||
switch(image->getColorFormat())
|
||||
{
|
||||
case ECF_A8R8G8B8:
|
||||
|
@ -1579,7 +1579,6 @@ typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD);
|
||||
void CIrrDeviceWin32::getWindowsVersion(core::stringc& out)
|
||||
{
|
||||
OSVERSIONINFOEX osvi;
|
||||
PGPI pGPI;
|
||||
BOOL bOsVersionInfoEx;
|
||||
|
||||
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
|
||||
@ -1631,9 +1630,14 @@ void CIrrDeviceWin32::getWindowsVersion(core::stringc& out)
|
||||
{
|
||||
if (osvi.dwMajorVersion == 6)
|
||||
{
|
||||
DWORD dwType;
|
||||
pGPI = (PGPI)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetProductInfo");
|
||||
pGPI(osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType);
|
||||
DWORD dwType = 0; // (PRODUCT_UNDEFINED not available on MinGW)
|
||||
HMODULE hmKernel32 = GetModuleHandle(TEXT("kernel32.dll"));
|
||||
if ( hmKernel32 )
|
||||
{
|
||||
PGPI pGPI = (PGPI)GetProcAddress(hmKernel32, "GetProductInfo");
|
||||
if ( pGPI )
|
||||
pGPI(osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType);
|
||||
}
|
||||
|
||||
switch (dwType)
|
||||
{
|
||||
|
@ -276,13 +276,13 @@ void CIrrMeshFileLoader::readIndices(io::IXMLReader* reader, int indexCount, IIn
|
||||
|
||||
void CIrrMeshFileLoader::readMeshBuffer(io::IXMLReader* reader, int vertexCount, CDynamicMeshBuffer* sbuffer)
|
||||
{
|
||||
core::stringc data = reader->getNodeData();
|
||||
const c8* p = &data[0];
|
||||
scene::IVertexBuffer& Vertices = sbuffer->getVertexBuffer();
|
||||
video::E_VERTEX_TYPE vType = Vertices.getType();
|
||||
|
||||
if (sbuffer)
|
||||
{
|
||||
core::stringc data = reader->getNodeData();
|
||||
const c8* p = &data[0];
|
||||
scene::IVertexBuffer& Vertices = sbuffer->getVertexBuffer();
|
||||
video::E_VERTEX_TYPE vType = Vertices.getType();
|
||||
|
||||
for (int i=0; i<vertexCount && *p; ++i)
|
||||
{
|
||||
switch(vType)
|
||||
|
@ -1998,7 +1998,7 @@ void CNullDriver::updateAllOcclusionQueries(bool block)
|
||||
/** Return value is the number of visible pixels/fragments.
|
||||
The value is a safe approximation, i.e. can be larger then the
|
||||
actual value of pixels. */
|
||||
u32 CNullDriver::getOcclusionQueryResult(scene::ISceneNode* node) const
|
||||
u32 CNullDriver::getOcclusionQueryResult(const scene::ISceneNode* node) const
|
||||
{
|
||||
return ~0;
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ namespace video
|
||||
/** Return value is the number of visible pixels/fragments.
|
||||
The value is a safe approximation, i.e. can be larger than the
|
||||
actual value of pixels. */
|
||||
virtual u32 getOcclusionQueryResult(scene::ISceneNode* node) const IRR_OVERRIDE;
|
||||
virtual u32 getOcclusionQueryResult(const scene::ISceneNode* node) const IRR_OVERRIDE;
|
||||
|
||||
//! Create render target.
|
||||
virtual IRenderTarget* addRenderTarget() IRR_OVERRIDE;
|
||||
@ -835,6 +835,11 @@ namespace video
|
||||
return other.Node==Node;
|
||||
}
|
||||
|
||||
bool operator==(const scene::ISceneNode* other) const
|
||||
{
|
||||
return other==Node;
|
||||
}
|
||||
|
||||
scene::ISceneNode* Node;
|
||||
const scene::IMesh* Mesh;
|
||||
union
|
||||
|
@ -2715,7 +2715,7 @@ COGLES2Driver::~COGLES2Driver()
|
||||
}
|
||||
|
||||
bool COGLES2Driver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& internalFormat, GLenum& pixelFormat,
|
||||
GLenum& pixelType, void(**converter)(const void*, s32, void*)) const
|
||||
GLenum& pixelType, void(**converter)(const void*, u32, void*)) const
|
||||
{
|
||||
bool supported = false;
|
||||
pixelFormat = GL_RGBA;
|
||||
@ -2981,7 +2981,7 @@ COGLES2Driver::~COGLES2Driver()
|
||||
GLint dummyInternalFormat;
|
||||
GLenum dummyPixelFormat;
|
||||
GLenum dummyPixelType;
|
||||
void (*dummyConverter)(const void*, s32, void*);
|
||||
void (*dummyConverter)(const void*, u32, void*);
|
||||
return getColorFormatParameters(format, dummyInternalFormat, dummyPixelFormat, dummyPixelType, &dummyConverter);
|
||||
}
|
||||
|
||||
|
@ -327,7 +327,7 @@ namespace video
|
||||
virtual GLenum getZBufferBits() const;
|
||||
|
||||
virtual bool getColorFormatParameters(ECOLOR_FORMAT format, GLint& internalFormat, GLenum& pixelFormat,
|
||||
GLenum& pixelType, void(**converter)(const void*, s32, void*)) const;
|
||||
GLenum& pixelType, void(**converter)(const void*, u32, void*)) const;
|
||||
|
||||
//! Get current material.
|
||||
const SMaterial& getCurrentMaterial() const;
|
||||
|
@ -3049,7 +3049,7 @@ GLenum COGLES1Driver::getZBufferBits() const
|
||||
}
|
||||
|
||||
bool COGLES1Driver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& internalFormat, GLenum& pixelFormat,
|
||||
GLenum& pixelType, void(**converter)(const void*, s32, void*)) const
|
||||
GLenum& pixelType, void(**converter)(const void*, u32, void*)) const
|
||||
{
|
||||
bool supported = false;
|
||||
internalFormat = GL_RGBA;
|
||||
@ -3258,7 +3258,7 @@ bool COGLES1Driver::queryTextureFormat(ECOLOR_FORMAT format) const
|
||||
GLint dummyInternalFormat;
|
||||
GLenum dummyPixelFormat;
|
||||
GLenum dummyPixelType;
|
||||
void (*dummyConverter)(const void*, s32, void*);
|
||||
void (*dummyConverter)(const void*, u32, void*);
|
||||
return getColorFormatParameters(format, dummyInternalFormat, dummyPixelFormat, dummyPixelType, &dummyConverter);
|
||||
}
|
||||
|
||||
|
@ -306,7 +306,7 @@ namespace video
|
||||
GLenum getZBufferBits() const;
|
||||
|
||||
bool getColorFormatParameters(ECOLOR_FORMAT format, GLint& internalFormat, GLenum& pixelFormat,
|
||||
GLenum& pixelType, void(**converter)(const void*, s32, void*)) const;
|
||||
GLenum& pixelType, void(**converter)(const void*, u32, void*)) const;
|
||||
|
||||
COGLES1CacheHandler* getCacheHandler() const;
|
||||
|
||||
|
@ -180,7 +180,7 @@ void COctreeTriangleSelector::getTriangles(core::triangle3df* triangles,
|
||||
{
|
||||
SCollisionTriangleRange triRange;
|
||||
triRange.RangeSize = trianglesWritten;
|
||||
triRange.Selector = const_cast<COctreeTriangleSelector*>(this);
|
||||
triRange.Selector = this;
|
||||
triRange.SceneNode = SceneNode;
|
||||
triRange.MeshBuffer = MeshBuffer;
|
||||
triRange.MaterialIndex = MaterialIndex;
|
||||
@ -272,7 +272,7 @@ void COctreeTriangleSelector::getTriangles(core::triangle3df* triangles, s32 arr
|
||||
{
|
||||
SCollisionTriangleRange triRange;
|
||||
triRange.RangeSize = trianglesWritten;
|
||||
triRange.Selector = const_cast<COctreeTriangleSelector*>(this);
|
||||
triRange.Selector = this;
|
||||
triRange.SceneNode = SceneNode;
|
||||
triRange.MeshBuffer = MeshBuffer;
|
||||
triRange.MaterialIndex = MaterialIndex;
|
||||
|
@ -411,7 +411,7 @@ public:
|
||||
u32 width = Size.Width;
|
||||
u32 height = Size.Height;
|
||||
u8* tmpData = static_cast<u8*>(data);
|
||||
u32 dataSize = 0;
|
||||
size_t dataSize = 0;
|
||||
u32 level = 0;
|
||||
|
||||
do
|
||||
@ -612,7 +612,7 @@ protected:
|
||||
}
|
||||
else
|
||||
{
|
||||
u32 dataSize = IImage::getDataSizeFromFormat(ColorFormat, width, height);
|
||||
GLsizei dataSize = (GLsizei)IImage::getDataSizeFromFormat(ColorFormat, width, height);
|
||||
|
||||
switch (TextureType)
|
||||
{
|
||||
@ -651,7 +651,7 @@ protected:
|
||||
GLint InternalFormat;
|
||||
GLenum PixelFormat;
|
||||
GLenum PixelType;
|
||||
void (*Converter)(const void*, s32, void*);
|
||||
void (*Converter)(const void*, u32, void*);
|
||||
|
||||
bool LockReadOnly;
|
||||
IImage* LockImage;
|
||||
|
@ -788,13 +788,10 @@ void COpenGLDriver::updateOcclusionQuery(scene::ISceneNode* node, bool block)
|
||||
/** Return value is the number of visible pixels/fragments.
|
||||
The value is a safe approximation, i.e. can be larger than the
|
||||
actual value of pixels. */
|
||||
u32 COpenGLDriver::getOcclusionQueryResult(scene::ISceneNode* node) const
|
||||
u32 COpenGLDriver::getOcclusionQueryResult(const scene::ISceneNode* node) const
|
||||
{
|
||||
const s32 index = OcclusionQueries.linear_search(SOccQuery(node));
|
||||
if (index != -1)
|
||||
return OcclusionQueries[index].Result;
|
||||
else
|
||||
return ~0;
|
||||
const s32 index = OcclusionQueries.linear_search(node);
|
||||
return index < 0 ? ~0 : OcclusionQueries[index].Result;
|
||||
}
|
||||
|
||||
|
||||
@ -3618,7 +3615,7 @@ bool COpenGLDriver::queryTextureFormat(ECOLOR_FORMAT format) const
|
||||
GLint dummyInternalFormat;
|
||||
GLenum dummyPixelFormat;
|
||||
GLenum dummyPixelType;
|
||||
void (*dummyConverter)(const void*, s32, void*);
|
||||
void (*dummyConverter)(const void*, u32, void*);
|
||||
return getColorFormatParameters(format, dummyInternalFormat, dummyPixelFormat, dummyPixelType, &dummyConverter);
|
||||
}
|
||||
|
||||
@ -4208,7 +4205,7 @@ GLenum COpenGLDriver::getZBufferBits() const
|
||||
}
|
||||
|
||||
bool COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& internalFormat, GLenum& pixelFormat,
|
||||
GLenum& pixelType, void(**converter)(const void*, s32, void*)) const
|
||||
GLenum& pixelType, void(**converter)(const void*, u32, void*)) const
|
||||
{
|
||||
// NOTE: Converter variable not used here, but don't remove, it's used in the OGL-ES drivers.
|
||||
|
||||
|
@ -111,7 +111,7 @@ namespace video
|
||||
/** Return value is the number of visible pixels/fragments.
|
||||
The value is a safe approximation, i.e. can be larger then the
|
||||
actual value of pixels. */
|
||||
virtual u32 getOcclusionQueryResult(scene::ISceneNode* node) const IRR_OVERRIDE;
|
||||
virtual u32 getOcclusionQueryResult(const scene::ISceneNode* node) const IRR_OVERRIDE;
|
||||
|
||||
//! Create render target.
|
||||
virtual IRenderTarget* addRenderTarget() IRR_OVERRIDE;
|
||||
@ -405,7 +405,7 @@ namespace video
|
||||
GLenum getZBufferBits() const;
|
||||
|
||||
bool getColorFormatParameters(ECOLOR_FORMAT format, GLint& internalFormat, GLenum& pixelFormat,
|
||||
GLenum& pixelType, void(**converter)(const void*, s32, void*)) const;
|
||||
GLenum& pixelType, void(**converter)(const void*, u32, void*)) const;
|
||||
|
||||
//! Return info about fixed pipeline state.
|
||||
E_OPENGL_FIXED_PIPELINE_STATE getFixedPipelineState() const;
|
||||
|
@ -1247,7 +1247,7 @@ bool CSceneManager::isCulled(const ISceneNode* node) const
|
||||
// has occlusion query information
|
||||
if (node->getAutomaticCulling() & scene::EAC_OCC_QUERY)
|
||||
{
|
||||
result = (Driver->getOcclusionQueryResult(const_cast<ISceneNode*>(node))==0);
|
||||
result = (Driver->getOcclusionQueryResult(node)==0);
|
||||
}
|
||||
|
||||
// can be seen by a bounding box ?
|
||||
|
@ -4810,9 +4810,9 @@ void CBurningVideoDriver::updateOcclusionQuery(scene::ISceneNode* node, bool blo
|
||||
/** Return value is the number of visible pixels/fragments.
|
||||
The value is a safe approximation, i.e. can be larger than the
|
||||
actual value of pixels. */
|
||||
u32 CBurningVideoDriver::getOcclusionQueryResult(scene::ISceneNode* node) const
|
||||
u32 CBurningVideoDriver::getOcclusionQueryResult(const scene::ISceneNode* node) const
|
||||
{
|
||||
const s32 index = OcclusionQueries.linear_search(SOccQuery(node));
|
||||
const s32 index = OcclusionQueries.linear_search(node);
|
||||
return index < 0 ? ~0 : OcclusionQueries[index].Result;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ namespace video
|
||||
/** Return value is the number of visible pixels/fragments.
|
||||
The value is a safe approximation, i.e. can be larger then the
|
||||
actual value of pixels. */
|
||||
virtual u32 getOcclusionQueryResult(scene::ISceneNode* node) const IRR_OVERRIDE;
|
||||
virtual u32 getOcclusionQueryResult(const scene::ISceneNode* node) const IRR_OVERRIDE;
|
||||
|
||||
//! sets transformation
|
||||
virtual void setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat) IRR_OVERRIDE;
|
||||
|
@ -115,7 +115,7 @@ void CTerrainTriangleSelector::getTriangles(core::triangle3df* triangles,
|
||||
{
|
||||
SCollisionTriangleRange triRange;
|
||||
triRange.RangeSize = tIndex;
|
||||
triRange.Selector = const_cast<CTerrainTriangleSelector*>(this);
|
||||
triRange.Selector = this;
|
||||
triRange.SceneNode = SceneNode;
|
||||
outTriangleInfo->push_back(triRange);
|
||||
}
|
||||
@ -163,7 +163,7 @@ void CTerrainTriangleSelector::getTriangles(core::triangle3df* triangles,
|
||||
{
|
||||
SCollisionTriangleRange triRange;
|
||||
triRange.RangeSize = tIndex;
|
||||
triRange.Selector = const_cast<CTerrainTriangleSelector*>(this);
|
||||
triRange.Selector = this;
|
||||
triRange.SceneNode = SceneNode;
|
||||
outTriangleInfo->push_back(triRange);
|
||||
}
|
||||
@ -209,7 +209,7 @@ void CTerrainTriangleSelector::getTriangles(core::triangle3df* triangles,
|
||||
{
|
||||
SCollisionTriangleRange triRange;
|
||||
triRange.RangeSize = tIndex;
|
||||
triRange.Selector = const_cast<CTerrainTriangleSelector*>(this);
|
||||
triRange.Selector = this;
|
||||
triRange.SceneNode = SceneNode;
|
||||
outTriangleInfo->push_back(triRange);
|
||||
}
|
||||
|
@ -215,9 +215,18 @@ void CBillboardTextSceneNode::setText(const wchar_t* text)
|
||||
u32 rectno = sprites[spriteno].Frames[0].rectNumber;
|
||||
u32 texno = sprites[spriteno].Frames[0].textureNumber;
|
||||
|
||||
const core::dimension2d<u32>& texSize = Font->getSpriteBank()->getTexture(texno)->getOriginalSize();
|
||||
dim[0] = core::reciprocal((f32)texSize.Width);
|
||||
dim[1] = core::reciprocal((f32)texSize.Height);
|
||||
video::ITexture* texture = Font->getSpriteBank()->getTexture(texno);
|
||||
if (texture)
|
||||
{
|
||||
const core::dimension2d<u32>& texSize = texture->getOriginalSize();
|
||||
dim[0] = core::reciprocal((f32)texSize.Width);
|
||||
dim[1] = core::reciprocal((f32)texSize.Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
dim[0] = 0;
|
||||
dim[1] = 0;
|
||||
}
|
||||
|
||||
const core::rect<s32>& s = sourceRects[rectno];
|
||||
|
||||
|
@ -293,7 +293,7 @@ void CTriangleSelector::getTriangles(core::triangle3df* triangles,
|
||||
|
||||
triRange.RangeStart = 0;
|
||||
triRange.RangeSize = cnt;
|
||||
triRange.Selector = const_cast<CTriangleSelector*>(this);
|
||||
triRange.Selector = this;
|
||||
triRange.SceneNode = SceneNode;
|
||||
triRange.MeshBuffer = MeshBuffer;
|
||||
triRange.MaterialIndex = MaterialIndex;
|
||||
@ -313,7 +313,7 @@ void CTriangleSelector::getTriangles(core::triangle3df* triangles,
|
||||
triRange.MeshBuffer = BufferRanges[rangeIndex].MeshBuffer;
|
||||
triRange.RangeStart = BufferRanges[rangeIndex].RangeStart;
|
||||
triRange.RangeSize = core::min_( cnt-BufferRanges[rangeIndex].RangeStart, BufferRanges[rangeIndex].RangeSize);
|
||||
triRange.Selector = const_cast<CTriangleSelector*>(this);
|
||||
triRange.Selector = this;
|
||||
triRange.SceneNode = SceneNode;
|
||||
outTriangleInfo->push_back(triRange);
|
||||
|
||||
@ -370,7 +370,7 @@ void CTriangleSelector::getTriangles(core::triangle3df* triangles,
|
||||
{
|
||||
irr::u32 activeRange = 0;
|
||||
SCollisionTriangleRange triRange;
|
||||
triRange.Selector = const_cast<CTriangleSelector*>(this);
|
||||
triRange.Selector = this;
|
||||
triRange.SceneNode = SceneNode;
|
||||
triRange.RangeStart = triangleCount;
|
||||
triRange.MeshBuffer = BufferRanges[activeRange].MeshBuffer;
|
||||
@ -433,7 +433,7 @@ void CTriangleSelector::getTriangles(core::triangle3df* triangles,
|
||||
{
|
||||
SCollisionTriangleRange triRange;
|
||||
triRange.RangeSize = triangleCount;
|
||||
triRange.Selector = const_cast<CTriangleSelector*>(this);
|
||||
triRange.Selector = this;
|
||||
triRange.SceneNode = SceneNode;
|
||||
triRange.MeshBuffer = MeshBuffer;
|
||||
triRange.MaterialIndex = MaterialIndex;
|
||||
|
@ -750,7 +750,7 @@ GLenum CWebGL1Driver::getZBufferBits() const
|
||||
}
|
||||
|
||||
bool CWebGL1Driver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& internalFormat, GLenum& pixelFormat,
|
||||
GLenum& pixelType, void(**converter)(const void*, s32, void*)) const
|
||||
GLenum& pixelType, void(**converter)(const void*, u32, void*)) const
|
||||
{
|
||||
bool supported = false;
|
||||
pixelFormat = GL_RGBA;
|
||||
|
@ -118,7 +118,7 @@ namespace video
|
||||
virtual GLenum getZBufferBits() const IRR_OVERRIDE;
|
||||
|
||||
virtual bool getColorFormatParameters(ECOLOR_FORMAT format, GLint& internalFormat, GLenum& pixelFormat,
|
||||
GLenum& pixelType, void(**converter)(const void*, s32, void*)) const IRR_OVERRIDE;
|
||||
GLenum& pixelType, void(**converter)(const void*, u32, void*)) const IRR_OVERRIDE;
|
||||
|
||||
protected:
|
||||
// create a meshbuffer which has as many vertices as indices
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RuleSet Name="Rules for Irrlicht" Description="Code analysis rules for Irrlicht15.0.vcxproj." ToolsVersion="15.0">
|
||||
<RuleSet Name="Rules for Irrlicht" Description="Code analysis rules for Irrlicht15.0.vcxproj." ToolsVersion="17.0">
|
||||
<IncludeAll Action="Warning" />
|
||||
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
|
||||
<Rule Id="CA1000" Action="None" />
|
||||
@ -273,6 +273,7 @@
|
||||
<Rule Id="C26495" Action="None" />
|
||||
<Rule Id="C26496" Action="Warning" />
|
||||
<Rule Id="C26497" Action="None" />
|
||||
<Rule Id="C26814" Action="None" />
|
||||
<Rule Id="C28204" Action="None" />
|
||||
<Rule Id="C28205" Action="None" />
|
||||
<Rule Id="C28209" Action="None" />
|
||||
|
@ -1,4 +1,4 @@
|
||||
Tests finished. 72 tests of 72 passed.
|
||||
Compiled as RELEASE
|
||||
Test suite pass at GMT Wed May 4 10:25:42 2022
|
||||
Compiled as DEBUG
|
||||
Test suite pass at GMT Sat May 14 18:16:57 2022
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user