diff options
Diffstat (limited to 'src/emu')
-rw-r--r-- | src/emu/crsshair.cpp | 9 | ||||
-rw-r--r-- | src/emu/device.h | 4 | ||||
-rw-r--r-- | src/emu/disound.cpp | 18 | ||||
-rw-r--r-- | src/emu/disound.h | 2 | ||||
-rw-r--r-- | src/emu/emucore.h | 3 | ||||
-rw-r--r-- | src/emu/render.cpp | 6 | ||||
-rw-r--r-- | src/emu/rendfont.cpp | 6 | ||||
-rw-r--r-- | src/emu/rendlay.cpp | 42 | ||||
-rw-r--r-- | src/emu/rendutil.cpp | 16 | ||||
-rw-r--r-- | src/emu/screen.cpp | 32 | ||||
-rw-r--r-- | src/emu/sound.cpp | 88 | ||||
-rw-r--r-- | src/emu/sound.h | 17 | ||||
-rw-r--r-- | src/emu/tilemap.cpp | 30 | ||||
-rw-r--r-- | src/emu/video.cpp | 4 |
14 files changed, 79 insertions, 198 deletions
diff --git a/src/emu/crsshair.cpp b/src/emu/crsshair.cpp index 6145e668a23..eb8bd09d440 100644 --- a/src/emu/crsshair.cpp +++ b/src/emu/crsshair.cpp @@ -168,7 +168,6 @@ void render_crosshair::set_default_bitmap() void render_crosshair::create_bitmap() { - int x, y; rgb_t color = m_player < ARRAY_LENGTH(crosshair_colors) ? crosshair_colors[m_player] : rgb_t::white(); // if we have a bitmap and texture for this player, kill it @@ -204,14 +203,14 @@ void render_crosshair::create_bitmap() m_bitmap->fill(rgb_t(0x00,0xff,0xff,0xff)); /* extract the raw source data to it */ - for (y = 0; y < CROSSHAIR_RAW_SIZE / 2; y++) + for (int y = 0; y < CROSSHAIR_RAW_SIZE / 2; y++) { /* assume it is mirrored vertically */ - u32 *dest0 = &m_bitmap->pix32(y); - u32 *dest1 = &m_bitmap->pix32(CROSSHAIR_RAW_SIZE - 1 - y); + u32 *const dest0 = &m_bitmap->pix(y); + u32 *const dest1 = &m_bitmap->pix(CROSSHAIR_RAW_SIZE - 1 - y); /* extract to two rows simultaneously */ - for (x = 0; x < CROSSHAIR_RAW_SIZE; x++) + for (int x = 0; x < CROSSHAIR_RAW_SIZE; x++) if ((crosshair_raw_top[y * CROSSHAIR_RAW_ROWBYTES + x / 8] << (x % 8)) & 0x80) dest0[x] = dest1[x] = rgb_t(0xff,0x00,0x00,0x00) | color; } diff --git a/src/emu/device.h b/src/emu/device.h index 55c3641f678..53534fe60d5 100644 --- a/src/emu/device.h +++ b/src/emu/device.h @@ -205,7 +205,7 @@ private: template <typename DeviceClass> static std::unique_ptr<device_t> create_device(device_type_impl_base const &type, machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) { - return make_unique_clear<DeviceClass>(mconfig, tag, owner, clock); + return std::make_unique<DeviceClass>(mconfig, tag, owner, clock); } template <typename DriverClass> @@ -298,7 +298,7 @@ public: template <typename... Params> std::unique_ptr<DeviceClass> create(machine_config &mconfig, char const *tag, device_t *owner, Params &&... args) const { - return make_unique_clear<DeviceClass>(mconfig, tag, owner, std::forward<Params>(args)...); + return std::make_unique<DeviceClass>(mconfig, tag, owner, std::forward<Params>(args)...); } template <typename... Params> DeviceClass &operator()(machine_config &mconfig, char const *tag, Params &&... args) const; diff --git a/src/emu/disound.cpp b/src/emu/disound.cpp index d2c063ff205..10d16150b76 100644 --- a/src/emu/disound.cpp +++ b/src/emu/disound.cpp @@ -66,15 +66,10 @@ device_sound_interface &device_sound_interface::add_route(u32 output, device_t & //------------------------------------------------- -// stream_alloc_legacy - allocate a stream implicitly +// stream_alloc - allocate a stream implicitly // associated with this device //------------------------------------------------- -sound_stream *device_sound_interface::stream_alloc_legacy(int inputs, int outputs, int sample_rate) -{ - return device().machine().sound().stream_alloc_legacy(*this, inputs, outputs, sample_rate, stream_update_legacy_delegate(&device_sound_interface::sound_stream_update_legacy, this)); -} - sound_stream *device_sound_interface::stream_alloc(int inputs, int outputs, int sample_rate) { return device().machine().sound().stream_alloc(*this, inputs, outputs, sample_rate, stream_update_delegate(&device_sound_interface::sound_stream_update, this), STREAM_DEFAULT_FLAGS); @@ -382,17 +377,6 @@ void device_sound_interface::interface_pre_reset() //------------------------------------------------- -// sound_stream_update_legacy - implementation -// that should be overridden by legacy devices -//------------------------------------------------- - -void device_sound_interface::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) -{ - throw emu_fatalerror("sound_stream_update_legacy called but not overridden by owning class"); -} - - -//------------------------------------------------- // sound_stream_update - default implementation // that should be overridden //------------------------------------------------- diff --git a/src/emu/disound.h b/src/emu/disound.h index db6456dfc9a..2e4546da52c 100644 --- a/src/emu/disound.h +++ b/src/emu/disound.h @@ -77,11 +77,9 @@ public: device_sound_interface &reset_routes() { m_route_list.clear(); return *this; } // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples); virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs); // stream creation - sound_stream *stream_alloc_legacy(int inputs, int outputs, int sample_rate); sound_stream *stream_alloc(int inputs, int outputs, int sample_rate); sound_stream *stream_alloc(int inputs, int outputs, int sample_rate, sound_stream_flags flags); diff --git a/src/emu/emucore.h b/src/emu/emucore.h index b03612512cd..5a2446637c8 100644 --- a/src/emu/emucore.h +++ b/src/emu/emucore.h @@ -85,9 +85,6 @@ typedef void genf(void); // pen_t is used to represent pixel values in bitmaps typedef u32 pen_t; -// stream_sample_t is used to represent a single sample in a sound stream -typedef s32 stream_sample_t; - //************************************************************************** diff --git a/src/emu/render.cpp b/src/emu/render.cpp index 46123a02b3f..817ae6e14cc 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -483,7 +483,7 @@ void render_texture::get_scaled(u32 dwidth, u32 dheight, render_texinfo &texinfo // finally fill out the new info primlist.add_reference(scaled->bitmap); - texinfo.base = &scaled->bitmap->pix32(0); + texinfo.base = &scaled->bitmap->pix(0); texinfo.rowpixels = scaled->bitmap->rowpixels(); texinfo.width = dwidth; texinfo.height = dheight; @@ -718,8 +718,8 @@ void render_container::overlay_scale(bitmap_argb32 &dest, bitmap_argb32 &source, // simply replicate the source bitmap over the target for (int y = 0; y < dest.height(); y++) { - u32 *src = &source.pix32(y % source.height()); - u32 *dst = &dest.pix32(y); + u32 const *const src = &source.pix(y % source.height()); + u32 *dst = &dest.pix(y); int sx = 0; // loop over columns diff --git a/src/emu/rendfont.cpp b/src/emu/rendfont.cpp index 7b69a6e97e5..13249a083fc 100644 --- a/src/emu/rendfont.cpp +++ b/src/emu/rendfont.cpp @@ -664,7 +664,7 @@ void render_font::char_expand(char32_t chnum, glyph &gl) for (int y = 0; y < gl.bmheight; y++) { int desty = y + m_height_cmd + m_yoffs_cmd - gl.yoffs - gl.bmheight; - u32 *dest = (desty >= 0 && desty < m_height_cmd) ? &gl.bitmap.pix32(desty, 0) : nullptr; + u32 *dest = (desty >= 0 && desty < m_height_cmd) ? &gl.bitmap.pix(desty, 0) : nullptr; { for (int x = 0; x < gl.bmwidth; x++) { @@ -723,7 +723,7 @@ void render_font::char_expand(char32_t chnum, glyph &gl) for (int y = 0; y < gl.bmheight; ++y) { int const desty(y + m_height + m_yoffs - gl.yoffs - gl.bmheight); - u32 *dest(((0 <= desty) && (m_height > desty)) ? &gl.bitmap.pix32(desty) : nullptr); + u32 *dest(((0 <= desty) && (m_height > desty)) ? &gl.bitmap.pix(desty) : nullptr); if (m_format == format::TEXT) { @@ -1531,7 +1531,7 @@ bool render_font::save_cached(const char *filename, u64 length, u32 hash) for (int y = 0; y < gl.bmheight; y++) { int desty = y + m_height + m_yoffs - gl.yoffs - gl.bmheight; - const u32 *src = (desty >= 0 && desty < m_height) ? &gl.bitmap.pix32(desty) : nullptr; + u32 const *const src = (desty >= 0 && desty < m_height) ? &gl.bitmap.pix(desty) : nullptr; for (int x = 0; x < gl.bmwidth; x++) { if (src != nullptr && rgb_t(src[x]).a() != 0) diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp index 46502185e29..de64a98bf30 100644 --- a/src/emu/rendlay.cpp +++ b/src/emu/rendlay.cpp @@ -1432,7 +1432,7 @@ private: m_bitmap.fill(0); for (int step = 0; step < 100; step += 25) for (int line = 0; line < 100; line++) - m_bitmap.pix32((step + line) % 100, line % 100) = rgb_t(0xff,0xff,0xff,0xff); + m_bitmap.pix((step + line) % 100, line % 100) = rgb_t(0xff,0xff,0xff,0xff); // log an error if (m_alphafile.empty()) @@ -2437,8 +2437,8 @@ protected: if (effy >= bounds.top() && effy <= bounds.bottom()) { - u32 *src = &tempbitmap2.pix32(y); - u32 *d = &dest.pix32(effy); + u32 const *const src = &tempbitmap2.pix(y); + u32 *const d = &dest.pix(effy); for (int x = 0; x < dest.width(); x++) { int effx = x; @@ -2484,8 +2484,8 @@ protected: if (effy >= bounds.top() && effy <= bounds.bottom()) { - u32 *src = &tempbitmap.pix32(y); - u32 *d = &dest.pix32(effy); + u32 const *const src = &tempbitmap.pix(y); + u32 *const d = &dest.pix(effy); for (int x = 0; x < chbounds.width(); x++) { int effx = curx + x + chbounds.left(); @@ -2597,8 +2597,8 @@ private: if (effy >= bounds.top() && effy <= bounds.bottom()) { - u32 *src = &tempbitmap2.pix32(y); - u32 *d = &dest.pix32(effy); + u32 const *const src = &tempbitmap2.pix(y); + u32 *const d = &dest.pix(effy); for (int x = 0; x < ourwidth/num_shown; x++) { int effx = basex + x; @@ -2645,8 +2645,8 @@ private: if (effy >= bounds.top() && effy <= bounds.bottom()) { - u32 *src = &tempbitmap.pix32(y); - u32 *d = &dest.pix32(effy); + u32 const *const src = &tempbitmap.pix(y); + u32 *const d = &dest.pix(effy); for (int x = 0; x < chbounds.width(); x++) { int effx = basex + curx + x; @@ -3109,8 +3109,8 @@ void layout_element::component::draw_text( int effy = bounds.top() + y; if (effy >= bounds.top() && effy <= bounds.bottom()) { - u32 *src = &tempbitmap.pix32(y); - u32 *d = &dest.pix32(effy); + u32 const *const src = &tempbitmap.pix(y); + u32 *const d = &dest.pix(effy); for (int x = 0; x < chbounds.width(); x++) { int effx = curx + x + chbounds.left(); @@ -3149,8 +3149,8 @@ void layout_element::component::draw_segment_horizontal_caps(bitmap_argb32 &dest // loop over the width of the segment for (int y = 0; y < width / 2; y++) { - u32 *d0 = &dest.pix32(midy - y); - u32 *d1 = &dest.pix32(midy + y); + u32 *const d0 = &dest.pix(midy - y); + u32 *const d1 = &dest.pix(midy + y); int ty = (y < width / 8) ? width / 8 : y; // loop over the length of the segment @@ -3182,8 +3182,8 @@ void layout_element::component::draw_segment_vertical_caps(bitmap_argb32 &dest, // loop over the width of the segment for (int x = 0; x < width / 2; x++) { - u32 *d0 = &dest.pix32(0, midx - x); - u32 *d1 = &dest.pix32(0, midx + x); + u32 *const d0 = &dest.pix(0, midx - x); + u32 *const d1 = &dest.pix(0, midx + x); int tx = (x < width / 8) ? width / 8 : x; // loop over the length of the segment @@ -3219,7 +3219,7 @@ void layout_element::component::draw_segment_diagonal_1(bitmap_argb32 &dest, int for (int x = minx; x < maxx; x++) if (x >= 0 && x < dest.width()) { - u32 *d = &dest.pix32(0, x); + u32 *const d = &dest.pix(0, x); int step = (x - minx) * ratio; for (int y = maxy - width - step; y < maxy - step; y++) @@ -3244,7 +3244,7 @@ void layout_element::component::draw_segment_diagonal_2(bitmap_argb32 &dest, int for (int x = minx; x < maxx; x++) if (x >= 0 && x < dest.width()) { - u32 *d = &dest.pix32(0, x); + u32 *const d = &dest.pix(0, x); int step = (x - minx) * ratio; for (int y = miny + step; y < miny + step + width; y++) @@ -3267,8 +3267,8 @@ void layout_element::component::draw_segment_decimal(bitmap_argb32 &dest, int mi // iterate over y for (u32 y = 0; y <= width; y++) { - u32 *d0 = &dest.pix32(midy - y); - u32 *d1 = &dest.pix32(midy + y); + u32 *const d0 = &dest.pix(midy - y); + u32 *const d1 = &dest.pix(midy + y); float xval = width * sqrt(1.0f - (float)(y * y) * ooradius2); s32 left, right; @@ -3296,7 +3296,7 @@ void layout_element::component::draw_segment_comma(bitmap_argb32 &dest, int minx // draw line for (int x = minx; x < maxx; x++) { - u32 *d = &dest.pix32(0, x); + u32 *const d = &dest.pix(0, x); int step = (x - minx) * ratio; for (int y = maxy; y < maxy - width - step; y--) @@ -3313,7 +3313,7 @@ void layout_element::component::apply_skew(bitmap_argb32 &dest, int skewwidth) { for (int y = 0; y < dest.height(); y++) { - u32 *destrow = &dest.pix32(y); + u32 *const destrow = &dest.pix(y); int offs = skewwidth * (dest.height() - y) / dest.height(); for (int x = dest.width() - skewwidth - 1; x >= 0; x--) destrow[x + offs] = destrow[x]; diff --git a/src/emu/rendutil.cpp b/src/emu/rendutil.cpp index f3e4950f598..18755ffb340 100644 --- a/src/emu/rendutil.cpp +++ b/src/emu/rendutil.cpp @@ -42,7 +42,7 @@ void render_resample_argb_bitmap_hq(bitmap_argb32 &dest, bitmap_argb32 &source, return; /* adjust the source base */ - const u32 *sbase = &source.pix32(0); + const u32 *sbase = &source.pix(0); /* determine the steppings */ u32 swidth = source.width(); @@ -599,11 +599,11 @@ void render_load_jpeg(bitmap_argb32 &bitmap, emu_file &file, const char *dirname if (s == 1) for (int i = 0; i < w; ++i) - bitmap.pix32(j, i) = rgb_t(0xFF, buffer[0][i], buffer[0][i], buffer[0][i]); + bitmap.pix(j, i) = rgb_t(0xFF, buffer[0][i], buffer[0][i], buffer[0][i]); else if (s == 3) for (int i = 0; i < w; ++i) - bitmap.pix32(j, i) = rgb_t(0xFF, buffer[0][i * s], buffer[0][i * s + 1], buffer[0][i * s + 2]); + bitmap.pix(j, i) = rgb_t(0xFF, buffer[0][i * s], buffer[0][i * s + 1], buffer[0][i * s + 2]); else { osd_printf_error("Cannot read JPEG data from %s file.\n", fname); @@ -726,7 +726,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info &png) { for (u32 x = 0; width > x; ++x, ++src) { - bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix32(y_trans(y), x_trans(x)) : bitmap.pix32(y, x)); + bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix(y_trans(y), x_trans(x)) : bitmap.pix(y, x)); rgb_t const pixel(dest); u8 const alpha(rgb_t(png.palette[*src * 3], png.palette[*src * 3 + 1], png.palette[*src * 3 + 2]).brightness()); accumalpha &= alpha; @@ -741,7 +741,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info &png) { for (u32 x = 0; width > x; ++x, ++src) { - bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix32(y_trans(y), x_trans(x)) : bitmap.pix32(y, x)); + bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix(y_trans(y), x_trans(x)) : bitmap.pix(y, x)); rgb_t const pixel(dest); accumalpha &= *src; dest = rgb_t(*src, pixel.r(), pixel.g(), pixel.b()); @@ -755,7 +755,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info &png) { for (u32 x = 0; width > x; ++x, src += 2) { - bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix32(y_trans(y), x_trans(x)) : bitmap.pix32(y, x)); + bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix(y_trans(y), x_trans(x)) : bitmap.pix(y, x)); rgb_t const pixel(dest); accumalpha &= *src; dest = rgb_t(*src, pixel.r(), pixel.g(), pixel.b()); @@ -769,7 +769,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info &png) { for (u32 x = 0; width > x; ++x, src += 3) { - bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix32(y_trans(y), x_trans(x)) : bitmap.pix32(y, x)); + bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix(y_trans(y), x_trans(x)) : bitmap.pix(y, x)); rgb_t const pixel(dest); u8 const alpha(rgb_t(src[0], src[1], src[2]).brightness()); accumalpha &= alpha; @@ -784,7 +784,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info &png) { for (u32 x = 0; width > x; ++x, src += 4) { - bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix32(y_trans(y), x_trans(x)) : bitmap.pix32(y, x)); + bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix(y_trans(y), x_trans(x)) : bitmap.pix(y, x)); rgb_t const pixel(dest); u8 const alpha(rgb_t(src[0], src[1], src[2]).brightness()); accumalpha &= alpha; diff --git a/src/emu/screen.cpp b/src/emu/screen.cpp index 8c6e69c0059..cacd16d5982 100644 --- a/src/emu/screen.cpp +++ b/src/emu/screen.cpp @@ -1730,9 +1730,9 @@ void screen_device::create_composited_bitmap() { for (int y = 0; y < dstheight; y++) { - bitmap_ind16 &srcbitmap = *(bitmap_ind16 *)m_scan_bitmaps[m_curbitmap][y]; - u16 *dst = &curbitmap.as_ind16().pix16(y); - const u16 *src = &srcbitmap.pix16(0); + const bitmap_ind16 &srcbitmap = *(bitmap_ind16 *)m_scan_bitmaps[m_curbitmap][y]; + u16 *dst = &curbitmap.as_ind16().pix(y); + const u16 *src = &srcbitmap.pix(0); const int dx = (m_scan_widths[y] << 15) / dstwidth; for (int x = 0; x < m_scan_widths[y]; x += dx) { @@ -1746,9 +1746,9 @@ void screen_device::create_composited_bitmap() { for (int y = 0; y < dstheight; y++) { - bitmap_rgb32 &srcbitmap = *(bitmap_rgb32 *)m_scan_bitmaps[m_curbitmap][y]; - u32 *dst = &curbitmap.as_rgb32().pix32(y); - const u32 *src = &srcbitmap.pix32(0); + const bitmap_rgb32 &srcbitmap = *(bitmap_rgb32 *)m_scan_bitmaps[m_curbitmap][y]; + u32 *dst = &curbitmap.as_rgb32().pix(y); + const u32 *src = &srcbitmap.pix(0); const int dx = (m_scan_widths[y] << 15) / dstwidth; for (int x = 0; x < dstwidth << 15; x += dx) { @@ -1837,10 +1837,10 @@ void screen_device::update_burnin() // iterate over rows in the destination for (int y = 0, srcy = ystart; y < dstheight; y++, srcy += ystep) { - bitmap_ind16 &srcbitmap = per_scanline ? *(bitmap_ind16 *)m_scan_bitmaps[m_curbitmap][y] : curbitmap.as_ind16(); - u64 *dst = &m_burnin.pix64(y); - const u16 *src = &srcbitmap.pix16(per_scanline ? 0 : (srcy >> 16)); - const rgb_t *palette = m_palette->palette()->entry_list_adjusted(); + const bitmap_ind16 &srcbitmap = per_scanline ? *(bitmap_ind16 *)m_scan_bitmaps[m_curbitmap][y] : curbitmap.as_ind16(); + u64 *const dst = &m_burnin.pix(y); + u16 const *const src = &srcbitmap.pix(per_scanline ? 0 : (srcy >> 16)); + rgb_t const *const palette = m_palette->palette()->entry_list_adjusted(); for (int x = 0, srcx = xstart; x < dstwidth; x++, srcx += xstep) { rgb_t pixel = palette[src[srcx >> 16]]; @@ -1855,9 +1855,9 @@ void screen_device::update_burnin() // iterate over rows in the destination for (int y = 0, srcy = ystart; y < dstheight; y++, srcy += ystep) { - bitmap_rgb32 &srcbitmap = per_scanline ? *(bitmap_rgb32 *)m_scan_bitmaps[m_curbitmap][y] : curbitmap.as_rgb32(); - u64 *dst = &m_burnin.pix64(y); - const u32 *src = &srcbitmap.pix32(per_scanline ? 0 : (srcy >> 16)); + const bitmap_rgb32 &srcbitmap = per_scanline ? *(bitmap_rgb32 *)m_scan_bitmaps[m_curbitmap][y] : curbitmap.as_rgb32(); + u64 *const dst = &m_burnin.pix(y); + u32 const *const src = &srcbitmap.pix(per_scanline ? 0 : (srcy >> 16)); for (int x = 0, srcx = xstart; x < dstwidth; x++, srcx += xstep) { rgb_t pixel = src[srcx >> 16]; @@ -1900,7 +1900,7 @@ void screen_device::finalize_burnin() u64 maxval = 0; for (int y = 0; y < srcheight; y++) { - u64 *src = &m_burnin.pix64(y); + u64 const *const src = &m_burnin.pix(y); for (int x = 0; x < srcwidth; x++) { minval = std::min(minval, src[x]); @@ -1914,8 +1914,8 @@ void screen_device::finalize_burnin() // now normalize and convert to RGB for (int y = 0, srcy = 0; y < dstheight; y++, srcy += ystep) { - u64 *src = &m_burnin.pix64(srcy >> 16); - u32 *dst = &finalmap.pix32(y); + u64 const *const src = &m_burnin.pix(srcy >> 16); + u32 *const dst = &finalmap.pix(y); for (int x = 0, srcx = 0; x < dstwidth; x++, srcx += xstep) { int brightness = u64(maxval - src[srcx >> 16]) * 255 / (maxval - minval); diff --git a/src/emu/sound.cpp b/src/emu/sound.cpp index 1c33166524f..8063db03959 100644 --- a/src/emu/sound.cpp +++ b/src/emu/sound.cpp @@ -578,12 +578,10 @@ sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output m_resampling_disabled((flags & STREAM_DISABLE_INPUT_RESAMPLING) != 0), m_sync_timer(nullptr), m_input(inputs), - m_input_array(inputs), m_input_view(inputs), m_empty_buffer(100), m_output_base(output_base), m_output(outputs), - m_output_array(outputs), m_output_view(outputs) { sound_assert(outputs > 0); @@ -628,21 +626,7 @@ sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output //------------------------------------------------- -// sound_stream - constructor with old-style -// callback -//------------------------------------------------- - -sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, stream_update_legacy_delegate callback, sound_stream_flags flags) : - sound_stream(device, inputs, outputs, output_base, sample_rate, flags) -{ - m_callback = std::move(callback); - m_callback_ex = stream_update_delegate(&sound_stream::stream_update_legacy, this); -} - - -//------------------------------------------------- -// sound_stream - constructor with new-style -// callback +// sound_stream - constructor //------------------------------------------------- sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags) : @@ -847,7 +831,7 @@ void sound_stream::apply_sample_rate_changes(u32 updatenum, u32 downstream_rate) #if (SOUND_DEBUG) void sound_stream::print_graph_recursive(int indent, int index) { - osd_printf_info("%c %*s%s Ch.%d @ %d\n", m_callback.isnull() ? ' ' : '!', indent, "", name().c_str(), index + m_output_base, sample_rate()); + osd_printf_info("%*s%s Ch.%d @ %d\n", indent, "", name().c_str(), index + m_output_base, sample_rate()); for (int index = 0; index < m_input.size(); index++) if (m_input[index].valid()) { @@ -924,57 +908,6 @@ void sound_stream::sync_update(void *, s32) //------------------------------------------------- -// stream_update_legacy - new-style callback which -// forwards on to the old-style traditional -// callback, converting to/from floats -//------------------------------------------------- - -void sound_stream::stream_update_legacy(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) -{ - // temporary buffer to hold stream_sample_t inputs and outputs - stream_sample_t temp_buffer[1024]; - int chunksize = ARRAY_LENGTH(temp_buffer) / (inputs.size() + outputs.size()); - int chunknum = 0; - - // create the arrays to pass to the callback - stream_sample_t **inputptr = m_input.empty() ? nullptr : &m_input_array[0]; - stream_sample_t **outputptr = &m_output_array[0]; - for (unsigned int inputnum = 0; inputnum < inputs.size(); inputnum++) - inputptr[inputnum] = &temp_buffer[chunksize * chunknum++]; - for (unsigned int outputnum = 0; outputnum < m_output.size(); outputnum++) - outputptr[outputnum] = &temp_buffer[chunksize * chunknum++]; - - // loop until all chunks done - for (int baseindex = 0; baseindex < outputs[0].samples(); baseindex += chunksize) - { - // determine the number of samples to process this time - int cursamples = outputs[0].samples() - baseindex; - if (cursamples > chunksize) - cursamples = chunksize; - - // copy in the input data - for (unsigned int inputnum = 0; inputnum < inputs.size(); inputnum++) - { - stream_sample_t *dest = inputptr[inputnum]; - for (int index = 0; index < cursamples; index++) - dest[index] = stream_sample_t(inputs[inputnum].get(baseindex + index) * stream_buffer::sample_t(32768.0)); - } - - // run the callback - m_callback(*this, inputptr, outputptr, cursamples); - - // copy out the output data - for (unsigned int outputnum = 0; outputnum < m_output.size(); outputnum++) - { - stream_sample_t *src = outputptr[outputnum]; - for (int index = 0; index < cursamples; index++) - outputs[outputnum].put(baseindex + index, stream_buffer::sample_t(src[index]) * stream_buffer::sample_t(1.0 / 32768.0)); - } - } -} - - -//------------------------------------------------- // empty_view - return an empty view covering the // given time period as a substitute for invalid // inputs @@ -1200,23 +1133,6 @@ sound_manager::~sound_manager() //------------------------------------------------- -// stream_alloc_legacy - allocate a new stream -//------------------------------------------------- - -sound_stream *sound_manager::stream_alloc_legacy(device_t &device, u32 inputs, u32 outputs, u32 sample_rate, stream_update_legacy_delegate callback) -{ - // determine output base - u32 output_base = 0; - for (auto &stream : m_stream_list) - if (&stream->device() == &device) - output_base += stream->output_count(); - - m_stream_list.push_back(std::make_unique<sound_stream>(device, inputs, outputs, output_base, sample_rate, callback)); - return m_stream_list.back().get(); -} - - -//------------------------------------------------- // stream_alloc - allocate a new stream with the // new-style callback and flags //------------------------------------------------- diff --git a/src/emu/sound.h b/src/emu/sound.h index f592c0f9f3c..25944847565 100644 --- a/src/emu/sound.h +++ b/src/emu/sound.h @@ -576,10 +576,7 @@ private: }; -// ======================> stream_update_legacy_delegate/stream_update_delegate - -// old-style callback; eventually should be deprecated -using stream_update_legacy_delegate = delegate<void (sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)>; +// ======================> stream_update_delegate // new-style callback using stream_update_delegate = delegate<void (sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)>; @@ -614,7 +611,6 @@ class sound_stream public: // construction/destruction - sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, stream_update_legacy_delegate callback, sound_stream_flags flags = STREAM_DEFAULT_FLAGS); sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags = STREAM_DEFAULT_FLAGS); virtual ~sound_stream(); @@ -680,9 +676,6 @@ private: // timer callback for synchronous streams void sync_update(void *, s32); - // new callback which wrapps calls through to the old-style callbacks - void stream_update_legacy(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs); - // return a view of 0 data covering the given time period read_stream_view empty_view(attotime start, attotime end); @@ -702,7 +695,6 @@ private: // input information std::vector<sound_stream_input> m_input; // list of streams we directly depend upon - std::vector<stream_sample_t *> m_input_array; // array of inputs for passing to the callback std::vector<read_stream_view> m_input_view; // array of output views for passing to the callback std::vector<std::unique_ptr<sound_stream>> m_resampler_list; // internal list of resamplers stream_buffer m_empty_buffer; // empty buffer for invalid inputs @@ -710,12 +702,10 @@ private: // output information u32 m_output_base; // base index of our outputs, relative to our device std::vector<sound_stream_output> m_output; // list of streams which directly depend upon us - std::vector<stream_sample_t *> m_output_array; // array of outputs for passing to the callback std::vector<write_stream_view> m_output_view; // array of output views for passing to the callback // callback information - stream_update_legacy_delegate m_callback; // callback function - stream_update_delegate m_callback_ex; // extended callback function + stream_update_delegate m_callback_ex; // extended callback function }; @@ -774,9 +764,6 @@ public: int sample_count() const { return m_samples_this_update; } int unique_id() { return m_unique_id++; } - // allocate a new stream with the old-style callback - sound_stream *stream_alloc_legacy(device_t &device, u32 inputs, u32 outputs, u32 sample_rate, stream_update_legacy_delegate callback); - // allocate a new stream with a new-style callback sound_stream *stream_alloc(device_t &device, u32 inputs, u32 outputs, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags); diff --git a/src/emu/tilemap.cpp b/src/emu/tilemap.cpp index fab04e8f162..4252b9259a2 100644 --- a/src/emu/tilemap.cpp +++ b/src/emu/tilemap.cpp @@ -860,8 +860,8 @@ u8 tilemap_t::tile_draw(const u8 *pendata, u32 x0, u32 y0, u32 palette_base, u8 u8 andmask = ~0, ormask = 0; for (u16 ty = 0; ty < m_tileheight; ty++) { - u16 *pixptr = &m_pixmap.pix16(y0, x0); - u8 *flagsptr = &m_flagsmap.pix8(y0, x0); + u16 *pixptr = &m_pixmap.pix(y0, x0); + u8 *flagsptr = &m_flagsmap.pix(y0, x0); // pre-advance to the next row y0 += dy0; @@ -913,7 +913,7 @@ u8 tilemap_t::tile_apply_bitmask(const u8 *maskdata, u32 x0, u32 y0, u8 category for (u16 ty = 0; ty < m_tileheight; ty++) { // pre-advance to the next row - u8 *flagsptr = &m_flagsmap.pix8(y0, x0); + u8 *flagsptr = &m_flagsmap.pix(y0, x0); y0 += dy0; // anywhere the bitmask is 0 should be transparent @@ -1182,7 +1182,7 @@ void tilemap_t::draw_instance(screen_device &screen, _BitmapClass &dest, const b // look up priority and destination base addresses for y1 bitmap_ind8 &priority_bitmap = *blit.priority; - u8 *priority_baseaddr = &priority_bitmap.pix8(y1, xpos); + u8 *priority_baseaddr = &priority_bitmap.pix(y1, xpos); typename _BitmapClass::pixel_t *dest_baseaddr = nullptr; int dest_rowpixels = 0; if (dest.valid()) @@ -1198,8 +1198,8 @@ void tilemap_t::draw_instance(screen_device &screen, _BitmapClass &dest, const b y2 -= ypos; // get tilemap pixels - const u16 *source_baseaddr = &m_pixmap.pix16(y1); - const u8 *mask_baseaddr = &m_flagsmap.pix8(y1); + const u16 *source_baseaddr = &m_pixmap.pix(y1); + const u8 *mask_baseaddr = &m_flagsmap.pix(y1); // get start/stop columns, rounding outward int mincol = x1 / m_tilewidth; @@ -1396,9 +1396,9 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c u32 cy = starty >> 16; // get source and priority pointers - u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix8(sy, sx) : nullptr; - const u16 *src = &m_pixmap.pix16(cy); - const u8 *maskptr = &m_flagsmap.pix8(cy); + u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix(sy, sx) : nullptr; + const u16 *src = &m_pixmap.pix(cy); + const u8 *maskptr = &m_flagsmap.pix(cy); typename _BitmapClass::pixel_t *dest = &destbitmap.pix(sy, sx); // loop over columns @@ -1440,15 +1440,15 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c // get dest and priority pointers typename _BitmapClass::pixel_t *dest = &destbitmap.pix(sy, sx); - u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix8(sy, sx) : nullptr; + u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix(sy, sx) : nullptr; // loop over columns while (x <= ex) { // plot if we match the mask - if ((m_flagsmap.pix8((cy >> 16) & ymask, (cx >> 16) & xmask) & mask) == value) + if ((m_flagsmap.pix((cy >> 16) & ymask, (cx >> 16) & xmask) & mask) == value) { - ROZ_PLOT_PIXEL(m_pixmap.pix16((cy >> 16) & ymask, (cx >> 16) & xmask)); + ROZ_PLOT_PIXEL(m_pixmap.pix((cy >> 16) & ymask, (cx >> 16) & xmask)); if (priority != 0xff00) *pri = (*pri & (priority >> 8)) | priority; } @@ -1482,16 +1482,16 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c // get dest and priority pointers typename _BitmapClass::pixel_t *dest = &destbitmap.pix(sy, sx); - u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix8(sy, sx) : nullptr; + u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix(sy, sx) : nullptr; // loop over columns while (x <= ex) { // plot if we're within the bitmap and we match the mask if (cx < widthshifted && cy < heightshifted) - if ((m_flagsmap.pix8(cy >> 16, cx >> 16) & mask) == value) + if ((m_flagsmap.pix(cy >> 16, cx >> 16) & mask) == value) { - ROZ_PLOT_PIXEL(m_pixmap.pix16(cy >> 16, cx >> 16)); + ROZ_PLOT_PIXEL(m_pixmap.pix(cy >> 16, cx >> 16)); if (priority != 0xff00) *pri = (*pri & (priority >> 8)) | priority; } diff --git a/src/emu/video.cpp b/src/emu/video.cpp index e28e6aa1bae..6f88d9ae03d 100644 --- a/src/emu/video.cpp +++ b/src/emu/video.cpp @@ -1075,9 +1075,9 @@ void video_manager::create_snapshot_bitmap(screen_device *screen) render_primitive_list &primlist = m_snap_target->get_primitives(); primlist.acquire_lock(); if (machine().options().snap_bilinear()) - snap_renderer_bilinear::draw_primitives(primlist, &m_snap_bitmap.pix32(0), width, height, m_snap_bitmap.rowpixels()); + snap_renderer_bilinear::draw_primitives(primlist, &m_snap_bitmap.pix(0), width, height, m_snap_bitmap.rowpixels()); else - snap_renderer::draw_primitives(primlist, &m_snap_bitmap.pix32(0), width, height, m_snap_bitmap.rowpixels()); + snap_renderer::draw_primitives(primlist, &m_snap_bitmap.pix(0), width, height, m_snap_bitmap.rowpixels()); primlist.release_lock(); } |