summaryrefslogtreecommitdiffstats
path: root/src/emu
diff options
context:
space:
mode:
author Robbbert <Robbbert@users.noreply.github.com>2019-07-16 20:37:47 +1000
committer Robbbert <Robbbert@users.noreply.github.com>2019-07-16 20:37:47 +1000
commit24e227510d8ec61b7086a727ca80449d886799bf (patch)
treeeebb8c6245cab7edf83b5405808eb32027c3eafb /src/emu
parentbce49a8e554f76400176d373285ac8d606d3271e (diff)
parent2d8207f9178b01f45fec6c08ffd35bc7dafa5772 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/video.cpp40
-rw-r--r--src/emu/video.h2
2 files changed, 38 insertions, 4 deletions
diff --git a/src/emu/video.cpp b/src/emu/video.cpp
index 8732fa9307e..c4ade5f7948 100644
--- a/src/emu/video.cpp
+++ b/src/emu/video.cpp
@@ -1261,10 +1261,8 @@ void video_manager::create_snapshot_bitmap(screen_device *screen)
}
// get the minimum width/height and set it on the target
- s32 width = m_snap_width;
- s32 height = m_snap_height;
- if (width == 0 || height == 0)
- m_snap_target->compute_minimum_size(width, height);
+ s32 width, height;
+ compute_snapshot_size(width, height);
m_snap_target->set_bounds(width, height);
// if we don't have a bitmap, or if it's not the right size, allocate a new one
@@ -1283,6 +1281,40 @@ void video_manager::create_snapshot_bitmap(screen_device *screen)
//-------------------------------------------------
+// compute_snapshot_size - computes width and
+// height of the current snapshot target
+// accounting for OPTION_SNAPSIZE
+//-------------------------------------------------
+
+void video_manager::compute_snapshot_size(s32 &width, s32 &height)
+{
+ width = m_snap_width;
+ height = m_snap_height;
+ if (width == 0 || height == 0)
+ m_snap_target->compute_minimum_size(width, height);
+}
+
+
+//-------------------------------------------------
+// pixels - fills the specified buffer with the
+// RGB values of each pixel in the snapshot target
+//-------------------------------------------------
+
+void video_manager::pixels(u32 *buffer)
+{
+ create_snapshot_bitmap(nullptr);
+ for (int y = 0; y < m_snap_bitmap.height(); y++)
+ {
+ const u32 *src = &m_snap_bitmap.pix(y, 0);
+ for (int x = 0; x < m_snap_bitmap.width(); x++)
+ {
+ *buffer++ = *src++;
+ }
+ }
+}
+
+
+//-------------------------------------------------
// open_next - open the next non-existing file of
// type filetype according to our numbering
// scheme
diff --git a/src/emu/video.h b/src/emu/video.h
index 725107e7db2..a5f76fa81f1 100644
--- a/src/emu/video.h
+++ b/src/emu/video.h
@@ -74,6 +74,8 @@ public:
void toggle_record_mng() { toggle_record_movie(MF_MNG); }
void toggle_record_avi() { toggle_record_movie(MF_AVI); }
osd_file::error open_next(emu_file &file, const char *extension, uint32_t index = 0);
+ void compute_snapshot_size(s32 &width, s32 &height);
+ void pixels(u32 *buffer);
// render a frame
void frame_update(bool from_debugger = false);