Added A8 pixel format

PixelFormat::GetBytesPerPixel() will no longer warn with
less-than-one-byte formats

Former-commit-id: af41f0c2bc7a35c2ee617980878628ff1c8bf868
This commit is contained in:
Lynix
2014-12-07 03:09:39 +01:00
parent 4b2e3370d9
commit d22c4a5ac9
5 changed files with 121 additions and 19 deletions

View File

@@ -168,6 +168,9 @@ inline nzUInt8 NzPixelFormat::GetBitsPerPixel(nzPixelFormat format)
{
switch (format)
{
case nzPixelFormat_A8:
return 8;
case nzPixelFormat_BGR8:
return 24;
@@ -287,20 +290,14 @@ inline nzUInt8 NzPixelFormat::GetBitsPerPixel(nzPixelFormat format)
inline nzUInt8 NzPixelFormat::GetBytesPerPixel(nzPixelFormat format)
{
nzUInt8 bytesPerPixel = GetBitsPerPixel(format)/8;
#if NAZARA_UTILITY_SAFE
if (bytesPerPixel == 0)
NazaraWarning("This format is either invalid or using less than one byte per pixel");
#endif
return bytesPerPixel;
return GetBitsPerPixel(format)/8;
}
inline nzPixelFormatType NzPixelFormat::GetType(nzPixelFormat format)
{
switch (format)
{
case nzPixelFormat_A8:
case nzPixelFormat_BGR8:
case nzPixelFormat_BGRA8:
case nzPixelFormat_DXT1:
@@ -372,6 +369,7 @@ inline bool NzPixelFormat::HasAlpha(nzPixelFormat format)
{
switch (format)
{
case nzPixelFormat_A8:
case nzPixelFormat_BGRA8:
case nzPixelFormat_DXT3:
case nzPixelFormat_DXT5:
@@ -444,6 +442,7 @@ inline bool NzPixelFormat::IsCompressed(nzPixelFormat format)
case nzPixelFormat_DXT5:
return true;
case nzPixelFormat_A8:
case nzPixelFormat_BGR8:
case nzPixelFormat_BGRA8:
case nzPixelFormat_L8:
@@ -529,6 +528,9 @@ inline NzString NzPixelFormat::ToString(nzPixelFormat format)
{
switch (format)
{
case nzPixelFormat_A8:
return "A8";
case nzPixelFormat_BGR8:
return "BGR8";