diff options
Diffstat (limited to 'src/emu/screen.cpp')
-rw-r--r-- | src/emu/screen.cpp | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/src/emu/screen.cpp b/src/emu/screen.cpp index f1a47766c87..bb172ad7a13 100644 --- a/src/emu/screen.cpp +++ b/src/emu/screen.cpp @@ -35,7 +35,7 @@ const device_type SCREEN = &device_creator<screen_device>; const attotime screen_device::DEFAULT_FRAME_PERIOD(attotime::from_hz(DEFAULT_FRAME_RATE)); -UINT32 screen_device::m_id_counter = 0; +uint32_t screen_device::m_id_counter = 0; class screen_device_svg_renderer { public: @@ -47,7 +47,7 @@ public: int render(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - static void output_notifier(const char *outname, INT32 value, void *param); + static void output_notifier(const char *outname, int32_t value, void *param); private: struct paired_entry { @@ -58,7 +58,7 @@ private: struct cached_bitmap { int x, y, sx, sy; - std::vector<UINT32> image; + std::vector<uint32_t> image; std::vector<paired_entry> pairs; }; @@ -75,16 +75,16 @@ private: int m_sx, m_sy; double m_scale; - std::vector<UINT32> m_background; + std::vector<uint32_t> m_background; std::vector<cached_bitmap> m_cache; - void output_change(const char *outname, INT32 value); - void render_state(std::vector<UINT32> &dest, const std::vector<bool> &state); + void output_change(const char *outname, int32_t value); + void render_state(std::vector<uint32_t> &dest, const std::vector<bool> &state); void compute_initial_bboxes(std::vector<bbox> &bboxes); bool compute_mask_intersection_bbox(int key1, int key2, bbox &bb) const; - void compute_diff_image(const std::vector<UINT32> &rend, const bbox &bb, cached_bitmap &dest) const; - void compute_dual_diff_image(const std::vector<UINT32> &rend, const bbox &bb, const cached_bitmap &src1, const cached_bitmap &src2, cached_bitmap &dest) const; + void compute_diff_image(const std::vector<uint32_t> &rend, const bbox &bb, cached_bitmap &dest) const; + void compute_dual_diff_image(const std::vector<uint32_t> &rend, const bbox &bb, const cached_bitmap &src1, const cached_bitmap &src2, cached_bitmap &dest) const; void rebuild_cache(); void blit(bitmap_rgb32 &bitmap, const cached_bitmap &src) const; }; @@ -153,7 +153,7 @@ int screen_device_svg_renderer::height() const return int(m_image->height + 0.5); } -void screen_device_svg_renderer::render_state(std::vector<UINT32> &dest, const std::vector<bool> &state) +void screen_device_svg_renderer::render_state(std::vector<uint32_t> &dest, const std::vector<bool> &state) { for(int key = 0; key != m_key_count; key++) { if (state[key]) @@ -170,30 +170,30 @@ void screen_device_svg_renderer::render_state(std::vector<UINT32> &dest, const s // alpha to "blend" against a black background. Plus align the // channel order to what we do. - UINT8 *image = (UINT8 *)&dest[0]; + uint8_t *image = (uint8_t *)&dest[0]; for(unsigned int pixel=0; pixel != m_sy*m_sx; pixel++) { - UINT8 r = image[0]; - UINT8 g = image[1]; - UINT8 b = image[2]; - UINT8 a = image[3]; + uint8_t r = image[0]; + uint8_t g = image[1]; + uint8_t b = image[2]; + uint8_t a = image[3]; if(a != 0xff) { r = r*a/255; g = g*a/255; b = b*a/255; } - UINT32 color = 0xff000000 | (r << 16) | (g << 8) | (b << 0); - *(UINT32 *)image = color; + uint32_t color = 0xff000000 | (r << 16) | (g << 8) | (b << 0); + *(uint32_t *)image = color; image += 4; } } void screen_device_svg_renderer::blit(bitmap_rgb32 &bitmap, const cached_bitmap &src) const { - const UINT32 *s = &src.image[0]; + const uint32_t *s = &src.image[0]; for(int y=0; y<src.sy; y++) { - UINT32 *d = &bitmap.pix(y + src.y, src.x); + uint32_t *d = &bitmap.pix(y + src.y, src.x); for(int x=0; x<src.sx; x++) { - UINT32 c = *s++; + uint32_t c = *s++; if(c) *d = c; d++; @@ -236,12 +236,12 @@ int screen_device_svg_renderer::render(screen_device &screen, bitmap_rgb32 &bitm return 0; } -void screen_device_svg_renderer::output_notifier(const char *outname, INT32 value, void *param) +void screen_device_svg_renderer::output_notifier(const char *outname, int32_t value, void *param) { static_cast<screen_device_svg_renderer *>(param)->output_change(outname, value); } -void screen_device_svg_renderer::output_change(const char *outname, INT32 value) +void screen_device_svg_renderer::output_change(const char *outname, int32_t value) { auto l = m_key_ids.find(outname); if (l == m_key_ids.end()) @@ -300,13 +300,13 @@ void screen_device_svg_renderer::compute_initial_bboxes(std::vector<bbox> &bboxe } } -void screen_device_svg_renderer::compute_diff_image(const std::vector<UINT32> &rend, const bbox &bb, cached_bitmap &dest) const +void screen_device_svg_renderer::compute_diff_image(const std::vector<uint32_t> &rend, const bbox &bb, cached_bitmap &dest) const { int x0, y0, x1, y1; x0 = y0 = x1 = y1 = -1; for(int y = bb.y0; y != bb.y1; y++) { - const UINT32 *src1 = &m_background[bb.x0 + y * m_sx]; - const UINT32 *src2 = &rend[bb.x0 + y * m_sx]; + const uint32_t *src1 = &m_background[bb.x0 + y * m_sx]; + const uint32_t *src2 = &rend[bb.x0 + y * m_sx]; for(int x = bb.x0; x != bb.x1; x++) { if(*src1 != *src2) { if(x0 == -1) { @@ -337,10 +337,10 @@ void screen_device_svg_renderer::compute_diff_image(const std::vector<UINT32> &r dest.sx = x1+1-x0; dest.sy = y1+1-y0; dest.image.resize(dest.sx * dest.sy); - UINT32 *dst = &dest.image[0]; + uint32_t *dst = &dest.image[0]; for(int y = 0; y != dest.sy; y++) { - const UINT32 *src1 = &m_background[dest.x + (y + dest.y) * m_sx]; - const UINT32 *src2 = &rend[dest.x + (y + dest.y) * m_sx]; + const uint32_t *src1 = &m_background[dest.x + (y + dest.y) * m_sx]; + const uint32_t *src2 = &rend[dest.x + (y + dest.y) * m_sx]; for(int x = 0; x != dest.sx; x++) { if(*src1 != *src2) *dst = *src2; @@ -372,8 +372,8 @@ bool screen_device_svg_renderer::compute_mask_intersection_bbox(int key1, int ke x0 = y0 = x1 = y1 = -1; for(int y = cy0; y < cy1; y++) { - const UINT32 *src1 = &c1.image[(cx0 - c1.x) + c1.sx * (y - c1.y)]; - const UINT32 *src2 = &c2.image[(cx0 - c2.x) + c2.sx * (y - c2.y)]; + const uint32_t *src1 = &c1.image[(cx0 - c1.x) + c1.sx * (y - c1.y)]; + const uint32_t *src2 = &c2.image[(cx0 - c2.x) + c2.sx * (y - c2.y)]; for(int x = cx0; x < cx1; x++) { if(*src1 && *src2 && *src1 != *src2) { if(x0 == -1) { @@ -403,7 +403,7 @@ bool screen_device_svg_renderer::compute_mask_intersection_bbox(int key1, int ke return true; } -void screen_device_svg_renderer::compute_dual_diff_image(const std::vector<UINT32> &rend, const bbox &bb, const cached_bitmap &src1, const cached_bitmap &src2, cached_bitmap &dest) const +void screen_device_svg_renderer::compute_dual_diff_image(const std::vector<uint32_t> &rend, const bbox &bb, const cached_bitmap &src1, const cached_bitmap &src2, cached_bitmap &dest) const { dest.x = bb.x0; dest.y = bb.y0; @@ -411,10 +411,10 @@ void screen_device_svg_renderer::compute_dual_diff_image(const std::vector<UINT3 dest.sy = bb.y1 - bb.y0 + 1; dest.image.resize(dest.sx*dest.sy); for(int y = 0; y != dest.sy; y++) { - const UINT32 *psrc1 = &src1.image[(dest.x - src1.x) + src1.sx * (y + dest.y - src1.y)]; - const UINT32 *psrc2 = &src2.image[(dest.x - src2.x) + src2.sx * (y + dest.y - src2.y)]; - const UINT32 *psrcr = &rend [ dest.x + m_sx * (y + dest.y )]; - UINT32 *pdest = &dest.image[ dest.sx * y ]; + const uint32_t *psrc1 = &src1.image[(dest.x - src1.x) + src1.sx * (y + dest.y - src1.y)]; + const uint32_t *psrc2 = &src2.image[(dest.x - src2.x) + src2.sx * (y + dest.y - src2.y)]; + const uint32_t *psrcr = &rend [ dest.x + m_sx * (y + dest.y )]; + uint32_t *pdest = &dest.image[ dest.sx * y ]; for(int x = 0; x != dest.sx; x++) { if(*psrc1 && *psrc2 && *psrc1 != *psrc2) *pdest = *psrcr; @@ -429,7 +429,7 @@ void screen_device_svg_renderer::compute_dual_diff_image(const std::vector<UINT3 void screen_device_svg_renderer::rebuild_cache() { m_cache.clear(); - std::vector<UINT32> rend(m_sx*m_sy); + std::vector<uint32_t> rend(m_sx*m_sy); // Render the background, e.g. with everything off std::vector<bool> state(m_key_count); @@ -544,7 +544,7 @@ void screen_device_svg_renderer::rebuild_cache() // screen_device - constructor //------------------------------------------------- -screen_device::screen_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) +screen_device::screen_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SCREEN, "Video Screen", tag, owner, clock, "screen", __FILE__), m_type(SCREEN_TYPE_RASTER), m_oldstyle_vblank_supplied(false), @@ -619,7 +619,7 @@ void screen_device::static_set_svg_region(device_t &device, const char *region) // to set the raw screen parameters //------------------------------------------------- -void screen_device::static_set_raw(device_t &device, UINT32 pixclock, UINT16 htotal, UINT16 hbend, UINT16 hbstart, UINT16 vtotal, UINT16 vbend, UINT16 vbstart) +void screen_device::static_set_raw(device_t &device, uint32_t pixclock, uint16_t htotal, uint16_t hbend, uint16_t hbstart, uint16_t vtotal, uint16_t vbend, uint16_t vbstart) { screen_device &screen = downcast<screen_device &>(device); screen.m_clock = pixclock; @@ -660,7 +660,7 @@ void screen_device::static_set_vblank_time(device_t &device, attoseconds_t time) // the width/height of the screen //------------------------------------------------- -void screen_device::static_set_size(device_t &device, UINT16 width, UINT16 height) +void screen_device::static_set_size(device_t &device, uint16_t width, uint16_t height) { screen_device &screen = downcast<screen_device &>(device); screen.m_width = width; @@ -673,7 +673,7 @@ void screen_device::static_set_size(device_t &device, UINT16 width, UINT16 heigh // set the visible area of the screen //------------------------------------------------- -void screen_device::static_set_visarea(device_t &device, INT16 minx, INT16 maxx, INT16 miny, INT16 maxy) +void screen_device::static_set_visarea(device_t &device, int16_t minx, int16_t maxx, int16_t miny, int16_t maxy) { downcast<screen_device &>(device).m_visarea.set(minx, maxx, miny, maxy); } @@ -743,7 +743,7 @@ void screen_device::static_set_palette(device_t &device, const char *tag) // video attributes //------------------------------------------------- -void screen_device::static_set_video_attributes(device_t &device, UINT32 flags) +void screen_device::static_set_video_attributes(device_t &device, uint32_t flags) { screen_device &screen = downcast<screen_device &>(device); screen.m_video_attributes = flags; @@ -844,9 +844,9 @@ void screen_device::device_start() // allocate raw textures m_texture[0] = machine().render().texture_alloc(); - m_texture[0]->set_osd_data((UINT64)((m_unique_id << 1) | 0)); + m_texture[0]->set_osd_data((uint64_t)((m_unique_id << 1) | 0)); m_texture[1] = machine().render().texture_alloc(); - m_texture[1]->set_osd_data((UINT64)((m_unique_id << 1) | 1)); + m_texture[1]->set_osd_data((uint64_t)((m_unique_id << 1) | 1)); // configure the default cliparea render_container::user_settings settings; @@ -1091,8 +1091,8 @@ void screen_device::realloc_screen_bitmaps() return; // determine effective size to allocate - INT32 effwidth = std::max(m_width, m_visarea.max_x + 1); - INT32 effheight = std::max(m_height, m_visarea.max_y + 1); + int32_t effwidth = std::max(m_width, m_visarea.max_x + 1); + int32_t effheight = std::max(m_height, m_visarea.max_y + 1); // reize all registered screen bitmaps for (auto &item : m_auto_bitmap_list) @@ -1177,7 +1177,7 @@ bool screen_device::update_partial(int scanline) LOG_PARTIAL_UPDATES(("updating %d-%d\n", clip.min_y, clip.max_y)); g_profiler.start(PROFILER_VIDEO); - UINT32 flags; + uint32_t flags; if (m_type != SCREEN_TYPE_SVG) { screen_bitmap &curbitmap = m_bitmap[m_curbitmap]; @@ -1242,7 +1242,7 @@ void screen_device::update_now() // if the line before us was incomplete, we must do it in two pieces if (m_partial_scan_hpos > 0) { - INT32 save_scan = m_partial_scan_hpos; + int32_t save_scan = m_partial_scan_hpos; update_partial(current_vpos - 2); m_partial_scan_hpos = save_scan; @@ -1301,7 +1301,7 @@ void screen_device::update_now() LOG_PARTIAL_UPDATES(("doing scanline partial draw: Y %d X %d-%d\n", clip.max_y, clip.min_x, clip.max_x)); - UINT32 flags; + uint32_t flags; screen_bitmap &curbitmap = m_bitmap[m_curbitmap]; switch (curbitmap.format()) { @@ -1585,8 +1585,8 @@ void screen_device::update_burnin() int dstheight = m_burnin.height(); int xstep = (srcwidth << 16) / dstwidth; int ystep = (srcheight << 16) / dstheight; - int xstart = ((UINT32)rand() % 32767) * xstep / 32767; - int ystart = ((UINT32)rand() % 32767) * ystep / 32767; + int xstart = ((uint32_t)rand() % 32767) * xstep / 32767; + int ystart = ((uint32_t)rand() % 32767) * ystep / 32767; int srcx, srcy; int x, y; @@ -1599,8 +1599,8 @@ void screen_device::update_burnin() bitmap_ind16 &srcbitmap = curbitmap.as_ind16(); for (y = 0, srcy = ystart; y < dstheight; y++, srcy += ystep) { - UINT64 *dst = &m_burnin.pix64(y); - const UINT16 *src = &srcbitmap.pix16(srcy >> 16); + uint64_t *dst = &m_burnin.pix64(y); + const uint16_t *src = &srcbitmap.pix16(srcy >> 16); const rgb_t *palette = m_palette->palette()->entry_list_adjusted(); for (x = 0, srcx = xstart; x < dstwidth; x++, srcx += xstep) { @@ -1617,8 +1617,8 @@ void screen_device::update_burnin() bitmap_rgb32 &srcbitmap = curbitmap.as_rgb32(); for (y = 0, srcy = ystart; y < dstheight; y++, srcy += ystep) { - UINT64 *dst = &m_burnin.pix64(y); - const UINT32 *src = &srcbitmap.pix32(srcy >> 16); + uint64_t *dst = &m_burnin.pix64(y); + const uint32_t *src = &srcbitmap.pix32(srcy >> 16); for (x = 0, srcx = xstart; x < dstwidth; x++, srcx += xstep) { rgb_t pixel = src[srcx >> 16]; @@ -1657,11 +1657,11 @@ void screen_device::finalize_burnin() int ystep = (srcheight << 16) / dstheight; // find the maximum value - UINT64 minval = ~(UINT64)0; - UINT64 maxval = 0; + uint64_t minval = ~(uint64_t)0; + uint64_t maxval = 0; for (int y = 0; y < srcheight; y++) { - UINT64 *src = &m_burnin.pix64(y); + uint64_t *src = &m_burnin.pix64(y); for (int x = 0; x < srcwidth; x++) { minval = std::min(minval, src[x]); @@ -1675,11 +1675,11 @@ void screen_device::finalize_burnin() // now normalize and convert to RGB for (int y = 0, srcy = 0; y < dstheight; y++, srcy += ystep) { - UINT64 *src = &m_burnin.pix64(srcy >> 16); - UINT32 *dst = &finalmap.pix32(y); + uint64_t *src = &m_burnin.pix64(srcy >> 16); + uint32_t *dst = &finalmap.pix32(y); for (int x = 0, srcx = 0; x < dstwidth; x++, srcx += xstep) { - int brightness = (UINT64)(maxval - src[srcx >> 16]) * 255 / (maxval - minval); + int brightness = (uint64_t)(maxval - src[srcx >> 16]) * 255 / (maxval - minval); dst[x] = rgb_t(0xff, brightness, brightness, brightness); } } |