mirror of
https://github.com/whoahq/whoa.git
synced 2026-11-06 22:59:53 +03:00
feat(component): add TextureCacheGetPal
This commit is contained in:
2 files changed
+20
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user