MCPcopy Create free account
hub / github.com/DaedalusX64/daedalus / ConvertIA8

Function ConvertIA8

Source/HLEGraphics/ConvertTile.cpp:384–422  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382}
383
384static void ConvertIA8(const TileDestInfo & dsti, const TextureInfo & ti)
385{
386 u32 width {dsti.Width};
387 u32 height {dsti.Height};
388
389 u8 * dst {static_cast<u8*>(dsti.Data)};
390 u32 dst_row_stride {dsti.Pitch};
391 u32 dst_row_offset {};
392
393 const u8 * src {gTMEM};
394 u32 src_row_stride {ti.GetLine()<<3};
395 u32 src_row_offset {ti.GetTmemAddress()<<3};
396
397 u32 row_swizzle {};
398 for (u32 y {}; y < height; ++y)
399 {
400 u32 src_offset {src_row_offset};
401 u32 dst_offset {dst_row_offset};
402 for (u32 x {}; x < width; ++x)
403 {
404 u8 src_pixel {src[src_offset^row_swizzle]};
405
406 u8 i {FourToEight[(src_pixel>>4)&0xf]};
407 u8 a {FourToEight[(src_pixel )&0xf]};
408
409 dst[dst_offset+0] = i;
410 dst[dst_offset+1] = i;
411 dst[dst_offset+2] = i;
412 dst[dst_offset+3] = a;
413
414 src_offset += 1;
415 dst_offset += 4;
416 }
417 src_row_offset += src_row_stride;
418 dst_row_offset += dst_row_stride;
419
420 row_swizzle ^= 0x4; // Alternate lines are word-swapped
421 }
422}
423
424static void ConvertIA4(const TileDestInfo & dsti, const TextureInfo & ti)
425{

Callers

nothing calls this directly

Calls 2

GetLineMethod · 0.80
GetTmemAddressMethod · 0.80

Tested by

no test coverage detected