9 return reinterpret_cast<TglD3DRMIMAGE*
>(pTexture->GetAppData());
42 pObject->SetAppData(0);
72 if (pBuffer !=
NULL) {
75 if (pEntries !=
NULL) {
89inline static int IsPowerOfTwo(
int v)
93 while (v > 2 && m == 0) {
98 return v == 2 && m == 0;
104 if (!(IsPowerOfTwo(width) && IsPowerOfTwo(height) && width % 4 == 0)) {
150 if (paletteSize > 0) {
155 if (paletteSize > 0) {
156 for (
int i = 0; i < paletteSize; i++) {
187 return ResultVal(m_data->Changed(texelsChanged, paletteChanged));
230 return reinterpret_cast<void*
>(&m_data);
static Result SetImage(IDirect3DRMTexture *pSelf, TglD3DRMIMAGE *pImage)
Copies palette/texel data from TglD3DRMIMAGE to Direct3DRMTexture [AI].
void FillRowsOfTexture(int y, int height, void *pBuffer) override
Fills rows of the texture [AI].
void * ImplementationDataPtr() override
Returns implementation pointer for texture [AI].
Result GetBufferAndPalette(int *pWidth, int *pHeight, int *pDepth, void **ppBuffer, int *ppPaletteSize, PaletteEntry **ppPalette) override
Returns current buffer and palette [AI].
Result SetPalette(int entryCount, PaletteEntry *entries) override
Sets the palette entries for the texture [AI].
Result Changed(int texelsChanged, int paletteChanged) override
Notifies that texels or palette have changed [AI].
Result SetTexels(int width, int height, int bitsPerTexel, void *pTexels) override
Sets texel data for the texture [AI].
[AI] Simple wrapper for D3DRMIMAGE; manages pixel buffer and palette for Direct3DRM textures [AI]
TglD3DRMIMAGE(int width, int height, int depth, void *pBuffer, int useBuffer, int paletteSize, PaletteEntry *pEntries)
Constructs an image buffer for use with Direct3DRM textures [AI].
void Destroy()
Destroys any buffers/palette managed by the image [AI].
D3DRMIMAGE m_image
[AI] Underlying D3DRM image struct [AI]
Result FillRowsOfTexture(int y, int height, char *content)
Writes pixel rows into texture [AI].
Result InitializePalette(int paletteSize, PaletteEntry *pEntries)
Initializes palette for image [AI].
int m_texelsAllocatedByClient
[AI] Flag for texel memory ownership (by client) [AI]
Result CreateBuffer(int width, int height, int depth, void *pBuffer, int useBuffer)
Creates or reallocates image buffer as necessary [AI].
#define DECOMP_SIZE_ASSERT(T, S)
LPVOID LPD3DRM_APPDATA
[AI] Application data type varies by DirectX version [AI]
#define NULL
[AI] Null pointer value (C/C++ semantics).
[AI] Forward declaration for Direct3DRMTexture interface [AI]
Result ResultVal(HRESULT result)
Returns a Tgl Result value for HRESULT [AI].
int Succeeded(Result result)
[AI] Returns whether a Tgl::Result indicates success.
Result
[AI] Result type used throughout the Tgl API to report operation success or failure.
@ Success
[AI] Operation succeeded. [AI]
@ Error
[AI] Operation failed. [AI]
[AI] Represents a single color entry in a palette.
unsigned char m_blue
[AI] Blue component. [AI]
unsigned char m_green
[AI] Green component. [AI]
unsigned char m_red
[AI] Red component. [AI]
D3DRMPALETTEENTRY * palette
TglD3DRMIMAGE * TextureGetImage(IDirect3DRMTexture *pTexture)
void TextureDestroyCallback(IDirect3DRMObject *pObject, void *pArg)