MCPcopy Create free account
hub / github.com/defold/defold / DefaultEncode

Function DefaultEncode

engine/texc/src/texc_enc_default.cpp:20–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18namespace dmTexc
19{
20 bool DefaultEncode(DefaultEncodeSettings* settings, uint8_t** out, uint32_t* out_size)
21 {
22 uint32_t size = GetDataSize(settings->m_OutPixelFormat, settings->m_Width, settings->m_Height);
23 if (!size)
24 return false; // Unsupported format
25
26 uint8_t* packed_data = (uint8_t*)malloc(size);
27 ConvertRGBA8888ToPf(settings->m_Data, settings->m_Width, settings->m_Height, settings->m_OutPixelFormat, packed_data);
28
29 *out = packed_data;
30 *out_size = size;
31 return true;
32 }
33}

Callers 2

DoEncodeFunction · 0.85

Calls 3

GetDataSizeFunction · 0.85
mallocFunction · 0.85
ConvertRGBA8888ToPfFunction · 0.85

Tested by

no test coverage detected