Commit 34e56b16 authored by hybrid's avatar hybrid

Move getBitsPerPixelFromFormat from CImage to IImage to make it accessible for...

Move getBitsPerPixelFromFormat from CImage to IImage to make it accessible for external use. Also added support for the float formats there.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2492 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 727d0980
...@@ -142,6 +142,35 @@ public: ...@@ -142,6 +142,35 @@ public:
//! fills the surface with black or white //! fills the surface with black or white
virtual void fill(const SColor &color) =0; virtual void fill(const SColor &color) =0;
static u32 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;
case ECF_R16F:
return 16;
case ECF_G16R16F:
return 32;
case ECF_A16B16G16R16F:
return 64;
case ECF_R32F:
return 32;
case ECF_G32R32F:
return 64;
case ECF_A32B32G32R32F:
return 128;
default:
return 0;
}
}
}; };
} // end namespace video } // end namespace video
......
...@@ -1227,23 +1227,6 @@ void CImage::setBitMasks() ...@@ -1227,23 +1227,6 @@ void CImage::setBitMasks()
} }
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 //! sets a pixel
void CImage::setPixel(u32 x, u32 y, const SColor &color, bool blend ) void CImage::setPixel(u32 x, u32 y, const SColor &color, bool blend )
{ {
......
...@@ -116,8 +116,6 @@ public: ...@@ -116,8 +116,6 @@ public:
//! draws a line from to //! draws a line from to
void drawLine(const core::position2d<s32>& from, const core::position2d<s32>& to, const SColor &color); void drawLine(const core::position2d<s32>& from, const core::position2d<s32>& to, const SColor &color);
static u32 getBitsPerPixelFromFormat(ECOLOR_FORMAT format);
private: private:
//! assumes format and size has been set and creates the rest //! assumes format and size has been set and creates the rest
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment