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:
@@ -130,6 +130,7 @@ enum nzPixelFormat
|
||||
{
|
||||
nzPixelFormat_Undefined = -1,
|
||||
|
||||
nzPixelFormat_A8, // 1*uint8
|
||||
nzPixelFormat_BGR8, // 3*uint8
|
||||
nzPixelFormat_BGRA8, // 4*uint8
|
||||
nzPixelFormat_DXT1,
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user