1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
// license:BSD-3-Clause
// copyright-holders:R. Belmont
/*********************************************************************
picture.cpp
Image device for still pictures.
*********************************************************************/
#include "emu.h"
#include "picture.h"
#include "rendutil.h"
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
// device type definition
DEFINE_DEVICE_TYPE(IMAGE_PICTURE, picture_image_device, "picture_image", "Still Image")
//-------------------------------------------------
// picture_image_device - constructor
//-------------------------------------------------
picture_image_device::picture_image_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock) :
device_t(mconfig, IMAGE_PICTURE, tag, owner, clock),
device_image_interface(mconfig, *this)
{
}
//-------------------------------------------------
// picture_image_device - destructor
//-------------------------------------------------
picture_image_device::~picture_image_device()
{
}
void picture_image_device::device_start()
{
}
image_init_result picture_image_device::call_load()
{
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 m_picture.valid() ? image_init_result::PASS : image_init_result::FAIL;
}
void picture_image_device::call_unload()
{
if (m_picture.valid())
{
m_picture.reset();
}
}
|