summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/imagedev/picture.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/imagedev/picture.cpp')
-rw-r--r--src/devices/imagedev/picture.cpp19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/devices/imagedev/picture.cpp b/src/devices/imagedev/picture.cpp
index f80bfb2885e..e50f2c0d4c6 100644
--- a/src/devices/imagedev/picture.cpp
+++ b/src/devices/imagedev/picture.cpp
@@ -25,8 +25,7 @@ DEFINE_DEVICE_TYPE(IMAGE_PICTURE, picture_image_device, "picture_image", "Still
picture_image_device::picture_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, IMAGE_PICTURE, tag, owner, clock),
- device_image_interface(mconfig, *this),
- m_picture(nullptr)
+ device_image_interface(mconfig, *this)
{
}
@@ -36,11 +35,6 @@ picture_image_device::picture_image_device(const machine_config &mconfig, const
picture_image_device::~picture_image_device()
{
- if (m_picture)
- {
- delete m_picture;
- m_picture = nullptr;
- }
}
@@ -50,11 +44,9 @@ void picture_image_device::device_start()
image_init_result picture_image_device::call_load()
{
- m_picture = new bitmap_argb32;
- if (png_read_bitmap(image_core_file(), *m_picture) != PNGERR_NONE)
+ if (png_read_bitmap(image_core_file(), m_picture) != PNGERR_NONE)
{
- delete m_picture;
- m_picture = nullptr;
+ m_picture.reset();
// todo: try JPEG here.
return image_init_result::FAIL;
@@ -65,9 +57,8 @@ image_init_result picture_image_device::call_load()
void picture_image_device::call_unload()
{
- if (m_picture)
+ if (m_picture.valid())
{
- delete m_picture;
- m_picture = nullptr;
+ m_picture.reset();
}
}