/**
 * @file  BCNativeImage.cpp
 *
 * AstroNav TQTVD Implementation of BCNativeImage class.
 *
 */

#include "BCNativeImageDirectFB.h"

namespace BAL {

BCNativeImage::BCNativeImage(IDirectFBSurface* surface)
	: m_surface(surface)
	, m_ownArray(NULL)
	, m_hasAlpha(true)
{
	int ret_width, ret_height;

	surface->GetSize(surface, &ret_width, &ret_height);	
	m_size = IntSize(ret_width, ret_height);
}

BCNativeImage::BCNativeImage(IDirectFBSurface* surface, RGBA32Array* array)
	: m_surface(surface)
	, m_ownArray(array)
	, m_hasAlpha(true)
{
        int ret_width, ret_height;

        surface->GetSize(surface, &ret_width, &ret_height);
        m_size = IntSize(ret_width, ret_height);
}

BCNativeImage::~BCNativeImage()
{
	if (m_surface)
	{
		m_surface->Release (m_surface);
		m_surface = NULL;
	}

	if (m_ownArray)
	{
		delete m_ownArray;
		m_ownArray = NULL;
	}
}

IntSize BCNativeImage::size() const
{
	return m_size;
}

bool BCNativeImage::hasAlpha()
{
	return m_hasAlpha;
}

}

