mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-02 00:32:45 +03:00
feat(component): add TextureCacheGetPal
This commit is contained in:
parent
a7d5417a3b
commit
15deaf2ce0
@ -164,6 +164,22 @@ int32_t TextureCacheGetInfo(void* handle, TCTEXTUREINFO& info, int32_t force) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
BlpPalPixel* TextureCacheGetPal(void* handle) {
|
||||
auto entry = static_cast<CACHEENTRY*>(handle);
|
||||
|
||||
if (entry->IsMissing() || !entry->m_data) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto blpHeader = static_cast<BLPHeader*>(entry->m_data);
|
||||
|
||||
if (blpHeader->colorEncoding != COLOR_PAL) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return blpHeader->extended.palette;
|
||||
}
|
||||
|
||||
int32_t TextureCacheHasMips(void* handle) {
|
||||
auto entry = static_cast<CACHEENTRY*>(handle);
|
||||
return entry && entry->m_data && !entry->IsMissing();
|
||||
|
||||
@ -5,6 +5,8 @@
|
||||
|
||||
class CAsyncObject;
|
||||
|
||||
struct BlpPalPixel;
|
||||
|
||||
struct TCTEXTUREINFO {
|
||||
uint16_t width;
|
||||
uint16_t height;
|
||||
@ -44,6 +46,8 @@ void TextureCacheDestroyTexture(void* texture);
|
||||
|
||||
int32_t TextureCacheGetInfo(void* handle, TCTEXTUREINFO& info, int32_t a3);
|
||||
|
||||
BlpPalPixel* TextureCacheGetPal(void* handle);
|
||||
|
||||
int32_t TextureCacheHasMips(void* handle);
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user