2019-08-23 11:56:54 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../Common.h"
|
|
|
|
|
|
|
|
NS_BF_BEGIN;
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
HWBITS_UNKNOWN,
|
|
|
|
HWBITS_PVRTC_2BPPV1,
|
|
|
|
HWBITS_PVRTC_4BPPV1,
|
|
|
|
HWBITS_PVRTC_2X4BPPV1
|
|
|
|
};
|
|
|
|
|
|
|
|
class ImageData
|
|
|
|
{
|
|
|
|
public:
|
2022-11-03 10:58:24 -07:00
|
|
|
int mRefCount;
|
2019-08-23 11:56:54 -07:00
|
|
|
int mX;
|
|
|
|
int mY;
|
|
|
|
int mWidth;
|
|
|
|
int mHeight;
|
2025-01-26 07:04:26 -08:00
|
|
|
int mStride;
|
2019-08-23 11:56:54 -07:00
|
|
|
void* mHWBits;
|
|
|
|
int mHWBitsLength;
|
|
|
|
int mHWBitsType;
|
|
|
|
uint32* mBits;
|
|
|
|
uint8* mSrcData;
|
|
|
|
int mSrcDataLen;
|
|
|
|
bool mKeepSrcDataValid;
|
2022-11-03 10:58:24 -07:00
|
|
|
bool mOwnsSrcData;
|
2019-08-23 11:56:54 -07:00
|
|
|
|
|
|
|
bool mWantsAlphaPremultiplied;
|
|
|
|
bool mAlphaPremultiplied;
|
2022-11-03 10:58:24 -07:00
|
|
|
bool mIsAdditive;
|
|
|
|
|
|
|
|
public:
|
2019-08-23 11:56:54 -07:00
|
|
|
ImageData();
|
|
|
|
virtual ~ImageData();
|
2022-11-03 10:58:24 -07:00
|
|
|
|
|
|
|
void AddRef();
|
|
|
|
void Deref();
|
2019-08-23 11:56:54 -07:00
|
|
|
void SwapRAndB();
|
|
|
|
void CreateNew(int x, int y, int width, int height, bool clear = true);
|
|
|
|
void CreateNew(int width, int height, bool clear = true);
|
2020-08-09 10:12:52 -07:00
|
|
|
void CopyFrom(ImageData* img, int x, int y);
|
2019-08-23 11:56:54 -07:00
|
|
|
void Fill(uint32 color);
|
|
|
|
virtual ImageData* Duplicate();
|
2022-11-03 10:58:24 -07:00
|
|
|
void SetSrcData(uint8* data, int dataLen);
|
2021-04-12 17:23:18 -04:00
|
|
|
virtual bool LoadFromMemory(void* ptr, int size);
|
2019-08-23 11:56:54 -07:00
|
|
|
virtual bool LoadFromFile(const StringImpl& path);
|
|
|
|
virtual bool ReadData() { return false; }
|
|
|
|
virtual void PremultiplyAlpha();
|
2020-10-05 14:25:55 -07:00
|
|
|
virtual void UnPremultiplyAlpha();
|
2019-08-23 11:56:54 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
NS_BF_END;
|