mirror of https://github.com/mgba-emu/mgba.git
Util: Fix non-USE_PNG build
This commit is contained in:
parent
3c353b572b
commit
7ef8cd961f
|
@ -39,6 +39,7 @@ struct mImage* mImageLoad(const char* path) {
|
|||
return image;
|
||||
}
|
||||
|
||||
#ifdef USE_PNG
|
||||
static struct mImage* mImageLoadPNG(struct VFile* vf) {
|
||||
png_structp png = PNGReadOpen(vf, PNG_HEADER_BYTES);
|
||||
png_infop info = png_create_info_struct(png);
|
||||
|
@ -92,13 +93,16 @@ static struct mImage* mImageLoadPNG(struct VFile* vf) {
|
|||
}
|
||||
return image;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct mImage* mImageLoadVF(struct VFile* vf) {
|
||||
vf->seek(vf, 0, SEEK_SET);
|
||||
#ifdef USE_PNG
|
||||
if (isPNG(vf)) {
|
||||
return mImageLoadPNG(vf);
|
||||
}
|
||||
vf->seek(vf, 0, SEEK_SET);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -441,6 +441,7 @@ M_TEST_DEFINE(oobWrite) {
|
|||
assert_memory_equal(buffer, (&(uint8_t[8]) { 0xFF, 0xFF, 0xFF, 0xFF }), sizeof(buffer));
|
||||
}
|
||||
|
||||
#ifdef USE_PNG
|
||||
M_TEST_DEFINE(loadPng24) {
|
||||
const uint8_t data[] = {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
|
||||
|
@ -499,6 +500,7 @@ M_TEST_DEFINE(loadPng32) {
|
|||
|
||||
mImageDestroy(image);
|
||||
}
|
||||
#endif
|
||||
|
||||
M_TEST_SUITE_DEFINE(Image,
|
||||
cmocka_unit_test(pitchRead),
|
||||
|
@ -507,6 +509,8 @@ M_TEST_SUITE_DEFINE(Image,
|
|||
cmocka_unit_test(pitchWrite),
|
||||
cmocka_unit_test(strideWrite),
|
||||
cmocka_unit_test(oobWrite),
|
||||
#ifdef USE_PNG
|
||||
cmocka_unit_test(loadPng24),
|
||||
cmocka_unit_test(loadPng32),
|
||||
#endif
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue