diff options
Diffstat (limited to 'src/frontend/mame/ui/widgets.cpp')
-rw-r--r-- | src/frontend/mame/ui/widgets.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/frontend/mame/ui/widgets.cpp b/src/frontend/mame/ui/widgets.cpp index d8907303b36..59fda0f203c 100644 --- a/src/frontend/mame/ui/widgets.cpp +++ b/src/frontend/mame/ui/widgets.cpp @@ -36,7 +36,7 @@ widgets_manager::widgets_manager(running_machine &machine) for (unsigned x = 0; x < 256; ++x) { unsigned const alpha((x < 25) ? (0xff * x / 25) : (x >(256 - 25)) ? (0xff * (255 - x) / 25) : 0xff); - m_hilight_bitmap->pix32(0, x) = rgb_t(alpha, 0xff, 0xff, 0xff); + m_hilight_bitmap->pix(0, x) = rgb_t(alpha, 0xff, 0xff, 0xff); } m_hilight_texture.reset(render.texture_alloc()); m_hilight_texture->set_bitmap(*m_hilight_bitmap, m_hilight_bitmap->cliprect(), TEXFORMAT_ARGB32); @@ -49,7 +49,7 @@ widgets_manager::widgets_manager(running_machine &machine) unsigned const r = r1 + (y * (r2 - r1) / 128); unsigned const g = g1 + (y * (g2 - g1) / 128); unsigned const b = b1 + (y * (b2 - b1) / 128); - m_hilight_main_bitmap->pix32(y, 0) = rgb_t(r, g, b); + m_hilight_main_bitmap->pix(y, 0) = rgb_t(r, g, b); } m_hilight_main_texture.reset(render.texture_alloc()); m_hilight_main_texture->set_bitmap(*m_hilight_main_bitmap, m_hilight_main_bitmap->cliprect(), TEXFORMAT_ARGB32); @@ -67,18 +67,17 @@ widgets_manager::widgets_manager(running_machine &machine) void widgets_manager::render_triangle(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param) { - int halfwidth = dest.width() / 2; - int height = dest.height(); - int x, y; + int const halfwidth = dest.width() / 2; + int const height = dest.height(); // start with all-transparent dest.fill(rgb_t(0x00, 0x00, 0x00, 0x00)); // render from the tip to the bottom - for (y = 0; y < height; y++) + for (int y = 0; y < height; y++) { int linewidth = (y * (halfwidth - 1) + (height / 2)) * 255 * 2 / height; - uint32_t *target = &dest.pix32(y, halfwidth); + uint32_t *const target = &dest.pix(y, halfwidth); // don't antialias if height < 12 if (dest.height() < 12) @@ -89,25 +88,23 @@ void widgets_manager::render_triangle(bitmap_argb32 &dest, bitmap_argb32 &source } // loop while we still have data to generate - for (x = 0; linewidth > 0; x++) + for (int x = 0; linewidth > 0; x++) { int dalpha; - - // first column we only consume one pixel if (x == 0) { + // first column we only consume one pixel dalpha = std::min(0xff, linewidth); target[x] = rgb_t(dalpha, 0xff, 0xff, 0xff); } - - // remaining columns consume two pixels, one on each side else { + // remaining columns consume two pixels, one on each side dalpha = std::min(0x1fe, linewidth); target[x] = target[-x] = rgb_t(dalpha / 2, 0xff, 0xff, 0xff); } - // account for the weight we consumed */ + // account for the weight we consumed linewidth -= dalpha; } } |