MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / ComputeDataSize

Function ComputeDataSize

engine/Poseidon/Graphics/Textures/Image.cpp:34–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32// --- Data size computation ---
33
34size_t ComputeDataSize(int width, int height, PixelFormat fmt)
35{
36 const auto& info = PixelFormatRegistry::Get(fmt);
37 if (info.isCompressed)
38 {
39 int bw = (width + 3) / 4;
40 int bh = (height + 3) / 4;
41 int blockBytes = (fmt == PixelFormat::DXT1) ? 8 : 16;
42 return static_cast<size_t>(bw) * bh * blockBytes;
43 }
44 return static_cast<size_t>(width) * height * info.bitsPerPixel / 8;
45}
46
47// --- RGBA8888 → format converters ---
48

Callers 5

encodeLevelFunction · 0.85
ConvertPixelsFunction · 0.85
ToRGBAMethod · 0.85
ConvertToMethod · 0.85
test_image.cppFile · 0.85

Calls 1

GetFunction · 0.50

Tested by

no test coverage detected