summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/imagedev/picture.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2020-10-08 02:04:31 +1100
committer Vas Crabb <vas@vastheman.com>2020-10-08 02:04:31 +1100
commitb90fd355150a0f56e368bb33619459b19ec92bee (patch)
tree41ac320a4199b0856a485c9d75458dbc98aa168e /src/devices/imagedev/picture.cpp
parent4b0903bfdbe88d4e220fc2c2f140e7b503060909 (diff)
Various improvements to image file handling:
Moved MS DIB parser out of ICO file reader and made it available for artwork and layout images. Added more efficient I/O and better error checking for JPEG file loading (MAME will no longer exit immediately on a bad JPEG file). Made caller responsible for opening files for loading images, to avoid decompressing images used in ZIP/7z artwork multiple times. Added support for JPEG and Windows DIB to picture_image_device. Added support for SVG image files in external artwork. Added support for using I/O port value for animation state and masking animation state values. Made bounds elements more flexible in layouts. Reworked headers to reduce dependencies. Updated layout file format documentation.
Diffstat (limited to 'src/devices/imagedev/picture.cpp')
-rw-r--r--src/devices/imagedev/picture.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/devices/imagedev/picture.cpp b/src/devices/imagedev/picture.cpp
index e50f2c0d4c6..e6736fb10c9 100644
--- a/src/devices/imagedev/picture.cpp
+++ b/src/devices/imagedev/picture.cpp
@@ -10,7 +10,7 @@
#include "emu.h"
#include "picture.h"
-#include "png.h"
+#include "rendutil.h"
/***************************************************************************
TYPE DEFINITIONS
@@ -44,15 +44,25 @@ void picture_image_device::device_start()
image_init_result picture_image_device::call_load()
{
- if (png_read_bitmap(image_core_file(), m_picture) != PNGERR_NONE)
- {
- m_picture.reset();
-
- // todo: try JPEG here.
- return image_init_result::FAIL;
+ switch (render_detect_image(image_core_file()))
+ {
+ case RENDUTIL_IMGFORMAT_PNG:
+ render_load_png(m_picture, image_core_file());
+ break;
+
+ case RENDUTIL_IMGFORMAT_JPEG:
+ render_load_jpeg(m_picture, image_core_file());
+ break;
+
+ case RENDUTIL_IMGFORMAT_MSDIB:
+ render_load_msdib(m_picture, image_core_file());
+ break;
+
+ default:
+ m_picture.reset();
}
- return image_init_result::PASS;
+ return m_picture.valid() ? image_init_result::PASS : image_init_result::FAIL;
}
void picture_image_device::call_unload()