55 e.
add(
"Failed reading SBM file");
61 if ((sbm.
size() % 1024) != 0)
64 const size_t rowCount = (sbm.
size() / 1024);
79 static const int masks [4] = { 0x03, 0x0C, 0x30, 0xC0 };
80 static const int shifts[4] = { 0, 2, 4, 6 };
84 for (
size_t c = 0; c < rowCount; c++) {
86 if (sbm.
read(buffer, 1024) != 1024)
89 for (
int y = 0; y < 32; y++) {
90 for (
int plane = 0; plane < 4; plane++) {
91 for (
int x = 0; x < 32; x++) {
94 const byte a = ((buffer[offset] & masks[plane]) >> shifts[plane]) * 0x55;
106 std::memset(data, 0, dataEnd - data);
void load(Common::SeekableReadStream &sbm, bool deswizzle)
void add(const char *s,...) GCC_PRINTF(2
static uint32 NEXTPOWER2(uint32 x)
Round up to the next power of 2.
Exception that provides a stack of explanations.
SBM(Common::SeekableReadStream &sbm, bool deswizzle=false)
Read an SBM image out of a stream.
void readData(Common::SeekableReadStream &sbm, bool deswizzle)
Basic exceptions to throw.
static uint32 deSwizzleOffset(uint32 x, uint32 y, uint32 width, uint32 height)
De-"swizzle" a texture pixel offset.
Utility templates and functions.
PixelFormatRaw _formatRaw
virtual size_t read(void *dataPtr, size_t dataSize)=0
Read data from the stream.
Image related utility functions.
const Exception kReadError("Read error")
Exception when reading from a stream failed.
virtual size_t size() const =0
Obtains the total size of the stream, measured in bytes.
Basic reading stream interfaces.
Decoding SBM (font bitmap data).
Interface for a seekable & readable data stream.