diff options
author | 2019-07-16 20:37:47 +1000 | |
---|---|---|
committer | 2019-07-16 20:37:47 +1000 | |
commit | 24e227510d8ec61b7086a727ca80449d886799bf (patch) | |
tree | eebb8c6245cab7edf83b5405808eb32027c3eafb /src/emu | |
parent | bce49a8e554f76400176d373285ac8d606d3271e (diff) | |
parent | 2d8207f9178b01f45fec6c08ffd35bc7dafa5772 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/emu')
-rw-r--r-- | src/emu/video.cpp | 40 | ||||
-rw-r--r-- | src/emu/video.h | 2 |
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); |