#include "Salamander.h"
#include "PixelFormat.h"

namespace Salamander
{

PixelFormat::PixelFormat(contentType content, 
						 byteMask mask) :
	contentType_(content),
	byteMask_(mask)
{
	
}

PixelFormat::~PixelFormat()
{
}

unsigned int PixelFormat::bytesPerPixel() const
{
	switch(byteMask_)
	{
		case Unsigned8:
		case Signed8:
		case R3G3B2:
		case B2G3R3:

			return 1;

		case Unsigned16:
		case Signed16:
		case R5G6B5:
		case B5G6R5:
		case R5G5B5A1:
		case B5G5R5A1:

			return 2;

		case R8G8B8:
		case B8G8R8:

			return 3;

		case R8G8B8A8:
		case B8G8R8A8:
		case R10G10B10A2:
		case B10G10R10A2:

			return 4;

		default:
			// unsupported mask
			return 0;
	}

}

}
