1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

SDL/OGL platform improvements

This commit is contained in:
Brian Fiete 2022-11-03 10:58:24 -07:00
parent 213aea8c82
commit 258a6653f9
16 changed files with 711 additions and 1141 deletions

View file

@ -19,15 +19,28 @@ ImageData::ImageData()
mWantsAlphaPremultiplied = true;
mAlphaPremultiplied = false;
mIsAdditive = false;
mSrcDataLen = 0;
mSrcDataLen = 0;
mRefCount = 1;
}
ImageData::~ImageData()
{
{
BF_ASSERT(mRefCount <= 1); // Allow direct delete if we only have one reference
delete [] mBits;
delete [] mSrcData;
}
void ImageData::AddRef()
{
mRefCount++;
}
void ImageData::Deref()
{
if (--mRefCount == 0)
delete this;
}
void ImageData::SwapRAndB()
{
int aSize = mWidth*mHeight;
@ -101,15 +114,15 @@ ImageData* ImageData::Duplicate()
}
bool ImageData::LoadFromMemory(void* ptr, int size)
{
{
SetSrcData((uint8*)ptr, size);
bool result = ReadData();
mSrcData = NULL;
bool result = ReadData();
mSrcData = NULL;
return result;
}
bool ImageData::LoadFromFile(const StringImpl& path)
{
{
int size = 0;
uint8* aData = LoadBinaryData(path, &size);
if (aData == NULL)