mirror of
https://github.com/holub/mame
synced 2025-04-26 02:07:14 +03:00
Make bitmaps movable, allowing them to be used in vectors and emplaced easily.
You're still responsible for ensuring you don't move a bitmap while a texture refers to it.
This commit is contained in:
parent
2a1643a824
commit
23df89c965
@ -78,8 +78,8 @@ menu_select_launch::cache::cache(running_machine &machine)
|
||||
, m_snapx_texture()
|
||||
, m_snapx_driver(nullptr)
|
||||
, m_snapx_software(nullptr)
|
||||
, m_no_avail_bitmap(std::make_unique<bitmap_argb32>(256, 256))
|
||||
, m_star_bitmap(std::make_unique<bitmap_argb32>(32, 32))
|
||||
, m_no_avail_bitmap(256, 256)
|
||||
, m_star_bitmap(32, 32)
|
||||
, m_star_texture()
|
||||
, m_toolbar_bitmap()
|
||||
, m_sw_toolbar_bitmap()
|
||||
@ -92,11 +92,11 @@ menu_select_launch::cache::cache(running_machine &machine)
|
||||
// create a texture for snapshot
|
||||
m_snapx_texture = texture_ptr(render.texture_alloc(render_texture::hq_scale), texture_free);
|
||||
|
||||
std::memcpy(&m_no_avail_bitmap->pix32(0), no_avail_bmp, 256 * 256 * sizeof(uint32_t));
|
||||
std::memcpy(&m_no_avail_bitmap.pix32(0), no_avail_bmp, 256 * 256 * sizeof(uint32_t));
|
||||
|
||||
std::memcpy(&m_star_bitmap->pix32(0), favorite_star_bmp, 32 * 32 * sizeof(uint32_t));
|
||||
std::memcpy(&m_star_bitmap.pix32(0), favorite_star_bmp, 32 * 32 * sizeof(uint32_t));
|
||||
m_star_texture = texture_ptr(render.texture_alloc(), texture_free);
|
||||
m_star_texture->set_bitmap(*m_star_bitmap, m_star_bitmap->cliprect(), TEXFORMAT_ARGB32);
|
||||
m_star_texture->set_bitmap(m_star_bitmap, m_star_bitmap.cliprect(), TEXFORMAT_ARGB32);
|
||||
|
||||
m_toolbar_bitmap.reserve(UI_TOOLBAR_BUTTONS);
|
||||
m_sw_toolbar_bitmap.reserve(UI_TOOLBAR_BUTTONS);
|
||||
@ -105,28 +105,28 @@ menu_select_launch::cache::cache(running_machine &machine)
|
||||
|
||||
for (std::size_t i = 0; i < UI_TOOLBAR_BUTTONS; ++i)
|
||||
{
|
||||
m_toolbar_bitmap.emplace_back(std::make_unique<bitmap_argb32>(32, 32));
|
||||
m_sw_toolbar_bitmap.emplace_back(std::make_unique<bitmap_argb32>(32, 32));
|
||||
m_toolbar_bitmap.emplace_back(32, 32);
|
||||
m_sw_toolbar_bitmap.emplace_back(32, 32);
|
||||
m_toolbar_texture.emplace_back(texture_ptr(render.texture_alloc(), texture_free));
|
||||
m_sw_toolbar_texture.emplace_back(texture_ptr(render.texture_alloc(), texture_free));
|
||||
|
||||
std::memcpy(&m_toolbar_bitmap.back()->pix32(0), toolbar_bitmap_bmp[i], 32 * 32 * sizeof(uint32_t));
|
||||
if (m_toolbar_bitmap.back()->valid())
|
||||
m_toolbar_texture.back()->set_bitmap(*m_toolbar_bitmap.back(), m_toolbar_bitmap.back()->cliprect(), TEXFORMAT_ARGB32);
|
||||
std::memcpy(&m_toolbar_bitmap.back().pix32(0), toolbar_bitmap_bmp[i], 32 * 32 * sizeof(uint32_t));
|
||||
if (m_toolbar_bitmap.back().valid())
|
||||
m_toolbar_texture.back()->set_bitmap(m_toolbar_bitmap.back(), m_toolbar_bitmap.back().cliprect(), TEXFORMAT_ARGB32);
|
||||
else
|
||||
m_toolbar_bitmap.back()->reset();
|
||||
m_toolbar_bitmap.back().reset();
|
||||
|
||||
if ((i == 0U) || (i == 2U))
|
||||
{
|
||||
std::memcpy(&m_sw_toolbar_bitmap.back()->pix32(0), toolbar_bitmap_bmp[i], 32 * 32 * sizeof(uint32_t));
|
||||
if (m_sw_toolbar_bitmap.back()->valid())
|
||||
m_sw_toolbar_texture.back()->set_bitmap(*m_sw_toolbar_bitmap.back(), m_sw_toolbar_bitmap.back()->cliprect(), TEXFORMAT_ARGB32);
|
||||
std::memcpy(&m_sw_toolbar_bitmap.back().pix32(0), toolbar_bitmap_bmp[i], 32 * 32 * sizeof(uint32_t));
|
||||
if (m_sw_toolbar_bitmap.back().valid())
|
||||
m_sw_toolbar_texture.back()->set_bitmap(m_sw_toolbar_bitmap.back(), m_sw_toolbar_bitmap.back().cliprect(), TEXFORMAT_ARGB32);
|
||||
else
|
||||
m_sw_toolbar_bitmap.back()->reset();
|
||||
m_sw_toolbar_bitmap.back().reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sw_toolbar_bitmap.back()->reset();
|
||||
m_sw_toolbar_bitmap.back().reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -534,9 +534,9 @@ void menu_select_launch::draw_toolbar(float x1, float y1, float x2, float y2)
|
||||
y2 -= UI_BOX_TB_BORDER;
|
||||
|
||||
texture_ptr_vector const &t_texture(m_is_swlist ? m_cache->sw_toolbar_texture() : m_cache->toolbar_texture());
|
||||
bitmap_ptr_vector const &t_bitmap(m_is_swlist ? m_cache->sw_toolbar_bitmap() : m_cache->toolbar_bitmap());
|
||||
bitmap_vector const &t_bitmap(m_is_swlist ? m_cache->sw_toolbar_bitmap() : m_cache->toolbar_bitmap());
|
||||
|
||||
auto const num_valid(std::count_if(std::begin(t_bitmap), std::end(t_bitmap), [](bitmap_ptr const &e) { return e && e->valid(); }));
|
||||
auto const num_valid(std::count_if(std::begin(t_bitmap), std::end(t_bitmap), [](bitmap_argb32 const &e) { return e.valid(); }));
|
||||
|
||||
float const space_x = (y2 - y1) * container().manager().ui_aspect(&container());
|
||||
float const total = (float(num_valid) * space_x) + (float(num_valid - 1) * 0.001f);
|
||||
@ -545,7 +545,7 @@ void menu_select_launch::draw_toolbar(float x1, float y1, float x2, float y2)
|
||||
|
||||
for (int z = 0; z < UI_TOOLBAR_BUTTONS; ++z)
|
||||
{
|
||||
if (t_bitmap[z] && t_bitmap[z]->valid())
|
||||
if (t_bitmap[z].valid())
|
||||
{
|
||||
rgb_t color(0xEFEFEFEF);
|
||||
if (mouse_in_rect(x1, y1, x2, y2))
|
||||
@ -613,8 +613,10 @@ float menu_select_launch::draw_icon(int linenum, void *selectedref, float x0, fl
|
||||
if (m_icons.end() == icon)
|
||||
{
|
||||
texture_ptr texture(machine().render().texture_alloc(), [&render = machine().render()] (render_texture *texture) { render.texture_free(texture); });
|
||||
bitmap_ptr bitmap(std::make_unique<bitmap_argb32>());
|
||||
icon = m_icons.emplace(std::piecewise_construct, std::forward_as_tuple(driver), std::forward_as_tuple(std::move(texture), std::move(bitmap))).first;
|
||||
icon = m_icons.emplace(
|
||||
std::piecewise_construct,
|
||||
std::forward_as_tuple(driver),
|
||||
std::forward_as_tuple(std::piecewise_construct, std::forward_as_tuple(std::move(texture)), std::tuple<>())).first;
|
||||
}
|
||||
|
||||
// set clone status
|
||||
@ -646,7 +648,7 @@ float menu_select_launch::draw_icon(int linenum, void *selectedref, float x0, fl
|
||||
render_load_ico(*tmp, snapfile, nullptr, fullname.c_str());
|
||||
}
|
||||
|
||||
bitmap_argb32 &bitmap(*icon->second.second);
|
||||
bitmap_argb32 &bitmap(icon->second.second);
|
||||
if (tmp->valid())
|
||||
{
|
||||
float panel_width = x1 - x0;
|
||||
@ -704,7 +706,7 @@ float menu_select_launch::draw_icon(int linenum, void *selectedref, float x0, fl
|
||||
auto_free(machine(), tmp);
|
||||
}
|
||||
|
||||
if (icon->second.second->valid())
|
||||
if (icon->second.second.valid())
|
||||
container().add_quad(x0, y0, x1, y1, rgb_t::white(), icon->second.first.get(), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
|
||||
|
||||
return ud_arrow_width * 1.5f;
|
||||
|
@ -62,7 +62,7 @@ protected:
|
||||
bool m_ui_error;
|
||||
|
||||
private:
|
||||
using bitmap_ptr_vector = std::vector<bitmap_ptr>;
|
||||
using bitmap_vector = std::vector<bitmap_argb32>;
|
||||
using texture_ptr_vector = std::vector<texture_ptr>;
|
||||
|
||||
class cache
|
||||
@ -78,11 +78,11 @@ private:
|
||||
void set_snapx_driver(game_driver const *value) { m_snapx_driver = value; }
|
||||
void set_snapx_software(ui_software_info const *software) { m_snapx_software = software; }
|
||||
|
||||
bitmap_argb32 &no_avail_bitmap() { return *m_no_avail_bitmap; }
|
||||
bitmap_argb32 &no_avail_bitmap() { return m_no_avail_bitmap; }
|
||||
render_texture *star_texture() { return m_star_texture.get(); }
|
||||
|
||||
bitmap_ptr_vector const &toolbar_bitmap() { return m_toolbar_bitmap; }
|
||||
bitmap_ptr_vector const &sw_toolbar_bitmap() { return m_sw_toolbar_bitmap; }
|
||||
bitmap_vector const &toolbar_bitmap() { return m_toolbar_bitmap; }
|
||||
bitmap_vector const &sw_toolbar_bitmap() { return m_sw_toolbar_bitmap; }
|
||||
texture_ptr_vector const &toolbar_texture() { return m_toolbar_texture; }
|
||||
texture_ptr_vector const &sw_toolbar_texture() { return m_sw_toolbar_texture; }
|
||||
|
||||
@ -92,19 +92,19 @@ private:
|
||||
game_driver const *m_snapx_driver;
|
||||
ui_software_info const *m_snapx_software;
|
||||
|
||||
bitmap_ptr m_no_avail_bitmap;
|
||||
bitmap_ptr m_star_bitmap;
|
||||
bitmap_argb32 m_no_avail_bitmap;
|
||||
bitmap_argb32 m_star_bitmap;
|
||||
texture_ptr m_star_texture;
|
||||
|
||||
bitmap_ptr_vector m_toolbar_bitmap;
|
||||
bitmap_ptr_vector m_sw_toolbar_bitmap;
|
||||
bitmap_vector m_toolbar_bitmap;
|
||||
bitmap_vector m_sw_toolbar_bitmap;
|
||||
texture_ptr_vector m_toolbar_texture;
|
||||
texture_ptr_vector m_sw_toolbar_texture;
|
||||
};
|
||||
using cache_ptr = std::shared_ptr<cache>;
|
||||
using cache_ptr_map = std::map<running_machine *, cache_ptr>;
|
||||
|
||||
using icon_cache = util::lru_cache_map<game_driver const *, std::pair<texture_ptr, bitmap_ptr> >;
|
||||
using icon_cache = util::lru_cache_map<game_driver const *, std::pair<texture_ptr, bitmap_argb32> >;
|
||||
|
||||
static constexpr std::size_t MAX_ICONS_RENDER = 128;
|
||||
|
||||
|
@ -37,7 +37,7 @@ inline int32_t bitmap_t::compute_rowpixels(int width, int xslop)
|
||||
|
||||
inline void bitmap_t::compute_base(int xslop, int yslop)
|
||||
{
|
||||
m_base = m_alloc + (m_rowpixels * yslop + xslop) * (m_bpp / 8);
|
||||
m_base = m_alloc.get() + (m_rowpixels * yslop + xslop) * (m_bpp / 8);
|
||||
}
|
||||
|
||||
|
||||
@ -46,8 +46,24 @@ inline void bitmap_t::compute_base(int xslop, int yslop)
|
||||
// BITMAP ALLOCATION/CONFIGURATION
|
||||
//**************************************************************************
|
||||
|
||||
bitmap_t::bitmap_t(bitmap_t &&that)
|
||||
: m_alloc(std::move(that.m_alloc))
|
||||
, m_allocbytes(that.m_allocbytes)
|
||||
, m_base(that.m_base)
|
||||
, m_rowpixels(that.m_rowpixels)
|
||||
, m_width(that.m_width)
|
||||
, m_height(that.m_height)
|
||||
, m_format(that.m_format)
|
||||
, m_bpp(that.m_bpp)
|
||||
, m_palette(nullptr)
|
||||
, m_cliprect(that.m_cliprect)
|
||||
{
|
||||
set_palette(that.m_palette);
|
||||
that.reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* @fn bitmap_t::bitmap_t(bitmap_format format, int bpp, int width, int height, int xslop, int yslop)
|
||||
* @fn bitmap_t::bitmap_t(bitmap_format format, uint8_t bpp, int width, int height, int xslop, int yslop)
|
||||
*
|
||||
* @brief -------------------------------------------------
|
||||
* bitmap_t - basic constructor
|
||||
@ -61,19 +77,19 @@ inline void bitmap_t::compute_base(int xslop, int yslop)
|
||||
* @param yslop The yslop.
|
||||
*/
|
||||
|
||||
bitmap_t::bitmap_t(bitmap_format format, int bpp, int width, int height, int xslop, int yslop)
|
||||
: m_alloc(nullptr),
|
||||
m_allocbytes(0),
|
||||
m_format(format),
|
||||
m_bpp(bpp),
|
||||
m_palette(nullptr)
|
||||
bitmap_t::bitmap_t(bitmap_format format, uint8_t bpp, int width, int height, int xslop, int yslop)
|
||||
: m_alloc()
|
||||
, m_allocbytes(0)
|
||||
, m_format(format)
|
||||
, m_bpp(bpp)
|
||||
, m_palette(nullptr)
|
||||
{
|
||||
// allocate intializes all other fields
|
||||
allocate(width, height, xslop, yslop);
|
||||
}
|
||||
|
||||
/**
|
||||
* @fn bitmap_t::bitmap_t(bitmap_format format, int bpp, void *base, int width, int height, int rowpixels)
|
||||
* @fn bitmap_t::bitmap_t(bitmap_format format, uint8_t bpp, void *base, int width, int height, int rowpixels)
|
||||
*
|
||||
* @brief Constructor.
|
||||
*
|
||||
@ -85,22 +101,22 @@ bitmap_t::bitmap_t(bitmap_format format, int bpp, int width, int height, int xsl
|
||||
* @param rowpixels The rowpixels.
|
||||
*/
|
||||
|
||||
bitmap_t::bitmap_t(bitmap_format format, int bpp, void *base, int width, int height, int rowpixels)
|
||||
: m_alloc(nullptr),
|
||||
m_allocbytes(0),
|
||||
m_base(base),
|
||||
m_rowpixels(rowpixels),
|
||||
m_width(width),
|
||||
m_height(height),
|
||||
m_format(format),
|
||||
m_bpp(bpp),
|
||||
m_palette(nullptr),
|
||||
m_cliprect(0, width - 1, 0, height - 1)
|
||||
bitmap_t::bitmap_t(bitmap_format format, uint8_t bpp, void *base, int width, int height, int rowpixels)
|
||||
: m_alloc()
|
||||
, m_allocbytes(0)
|
||||
, m_base(base)
|
||||
, m_rowpixels(rowpixels)
|
||||
, m_width(width)
|
||||
, m_height(height)
|
||||
, m_format(format)
|
||||
, m_bpp(bpp)
|
||||
, m_palette(nullptr)
|
||||
, m_cliprect(0, width - 1, 0, height - 1)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @fn bitmap_t::bitmap_t(bitmap_format format, int bpp, bitmap_t &source, const rectangle &subrect)
|
||||
* @fn bitmap_t::bitmap_t(bitmap_format format, uint8_t bpp, bitmap_t &source, const rectangle &subrect)
|
||||
*
|
||||
* @brief Constructor.
|
||||
*
|
||||
@ -110,17 +126,17 @@ bitmap_t::bitmap_t(bitmap_format format, int bpp, void *base, int width, int hei
|
||||
* @param subrect The subrect.
|
||||
*/
|
||||
|
||||
bitmap_t::bitmap_t(bitmap_format format, int bpp, bitmap_t &source, const rectangle &subrect)
|
||||
: m_alloc(nullptr),
|
||||
m_allocbytes(0),
|
||||
m_base(source.raw_pixptr(subrect.min_y, subrect.min_x)),
|
||||
m_rowpixels(source.m_rowpixels),
|
||||
m_width(subrect.width()),
|
||||
m_height(subrect.height()),
|
||||
m_format(format),
|
||||
m_bpp(bpp),
|
||||
m_palette(nullptr),
|
||||
m_cliprect(0, subrect.width() - 1, 0, subrect.height() - 1)
|
||||
bitmap_t::bitmap_t(bitmap_format format, uint8_t bpp, bitmap_t &source, const rectangle &subrect)
|
||||
: m_alloc()
|
||||
, m_allocbytes(0)
|
||||
, m_base(source.raw_pixptr(subrect.min_y, subrect.min_x))
|
||||
, m_rowpixels(source.m_rowpixels)
|
||||
, m_width(subrect.width())
|
||||
, m_height(subrect.height())
|
||||
, m_format(format)
|
||||
, m_bpp(bpp)
|
||||
, m_palette(nullptr)
|
||||
, m_cliprect(0, subrect.width() - 1, 0, subrect.height() - 1)
|
||||
{
|
||||
assert(format == source.m_format);
|
||||
assert(bpp == source.m_bpp);
|
||||
@ -141,6 +157,22 @@ bitmap_t::~bitmap_t()
|
||||
reset();
|
||||
}
|
||||
|
||||
bitmap_t &bitmap_t::operator=(bitmap_t &&that)
|
||||
{
|
||||
m_alloc = std::move(that.m_alloc);
|
||||
m_allocbytes = that.m_allocbytes;
|
||||
m_base = that.m_base;
|
||||
m_rowpixels = that.m_rowpixels;
|
||||
m_width = that.m_width;
|
||||
m_height = that.m_height;
|
||||
m_format = that.m_format;
|
||||
m_bpp = that.m_bpp;
|
||||
set_palette(that.m_palette);
|
||||
m_cliprect = that.m_cliprect;
|
||||
that.reset();
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @fn void bitmap_t::allocate(int width, int height, int xslop, int yslop)
|
||||
*
|
||||
@ -175,10 +207,10 @@ void bitmap_t::allocate(int width, int height, int xslop, int yslop)
|
||||
|
||||
// allocate memory for the bitmap itself
|
||||
m_allocbytes = m_rowpixels * (m_height + 2 * yslop) * m_bpp / 8;
|
||||
m_alloc = new uint8_t[m_allocbytes];
|
||||
m_alloc.reset(new uint8_t[m_allocbytes]);
|
||||
|
||||
// clear to 0 by default
|
||||
memset(m_alloc, 0, m_allocbytes);
|
||||
memset(m_alloc.get(), 0, m_allocbytes);
|
||||
|
||||
// compute the base
|
||||
compute_base(xslop, yslop);
|
||||
@ -242,8 +274,7 @@ void bitmap_t::reset()
|
||||
{
|
||||
// delete any existing stuff
|
||||
set_palette(nullptr);
|
||||
delete[] m_alloc;
|
||||
m_alloc = nullptr;
|
||||
m_alloc.reset();
|
||||
m_base = nullptr;
|
||||
|
||||
// reset all fields
|
||||
|
@ -8,10 +8,10 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#ifndef MAME_UTIL_BITMAP_H
|
||||
#define MAME_UTIL_BITMAP_H
|
||||
|
||||
#ifndef __BITMAP_H__
|
||||
#define __BITMAP_H__
|
||||
#pragma once
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "palette.h"
|
||||
@ -106,10 +106,10 @@ public:
|
||||
void offsety(int32_t delta) { min_y += delta; max_y += delta; }
|
||||
|
||||
// internal state
|
||||
int32_t min_x; // minimum X, or left coordinate
|
||||
int32_t max_x; // maximum X, or right coordinate (inclusive)
|
||||
int32_t min_y; // minimum Y, or top coordinate
|
||||
int32_t max_y; // maximum Y, or bottom coordinate (inclusive)
|
||||
int32_t min_x; // minimum X, or left coordinate
|
||||
int32_t max_x; // maximum X, or right coordinate (inclusive)
|
||||
int32_t min_y; // minimum Y, or top coordinate
|
||||
int32_t max_y; // maximum Y, or bottom coordinate (inclusive)
|
||||
};
|
||||
|
||||
|
||||
@ -118,18 +118,19 @@ public:
|
||||
// bitmaps describe a rectangular array of pixels
|
||||
class bitmap_t
|
||||
{
|
||||
private:
|
||||
// prevent implicit copying
|
||||
bitmap_t(const bitmap_t &);
|
||||
bitmap_t &operator=(const bitmap_t &);
|
||||
|
||||
protected:
|
||||
// construction/destruction -- subclasses only to ensure type correctness
|
||||
bitmap_t(bitmap_format format, int bpp, int width = 0, int height = 0, int xslop = 0, int yslop = 0);
|
||||
bitmap_t(bitmap_format format, int bpp, void *base, int width, int height, int rowpixels);
|
||||
bitmap_t(bitmap_format format, int bpp, bitmap_t &source, const rectangle &subrect);
|
||||
bitmap_t(const bitmap_t &) = delete;
|
||||
bitmap_t(bitmap_t &&that);
|
||||
bitmap_t(bitmap_format format, uint8_t bpp, int width = 0, int height = 0, int xslop = 0, int yslop = 0);
|
||||
bitmap_t(bitmap_format format, uint8_t bpp, void *base, int width, int height, int rowpixels);
|
||||
bitmap_t(bitmap_format format, uint8_t bpp, bitmap_t &source, const rectangle &subrect);
|
||||
virtual ~bitmap_t();
|
||||
|
||||
// prevent implicit copying
|
||||
bitmap_t &operator=(const bitmap_t &) = delete;
|
||||
bitmap_t &operator=(bitmap_t &&that);
|
||||
|
||||
public:
|
||||
// allocation/deallocation
|
||||
void reset();
|
||||
@ -175,16 +176,16 @@ private:
|
||||
void compute_base(int xslop, int yslop);
|
||||
|
||||
// internal state
|
||||
uint8_t * m_alloc; // pointer to allocated pixel memory
|
||||
uint32_t m_allocbytes; // size of our allocation
|
||||
void * m_base; // pointer to pixel (0,0) (adjusted for padding)
|
||||
int32_t m_rowpixels; // pixels per row (including padding)
|
||||
int32_t m_width; // width of the bitmap
|
||||
int32_t m_height; // height of the bitmap
|
||||
bitmap_format m_format; // format of the bitmap
|
||||
uint8_t m_bpp; // bits per pixel
|
||||
palette_t * m_palette; // optional palette
|
||||
rectangle m_cliprect; // a clipping rectangle covering the full bitmap
|
||||
std::unique_ptr<uint8_t []> m_alloc; // pointer to allocated pixel memory
|
||||
uint32_t m_allocbytes; // size of our allocation
|
||||
void * m_base; // pointer to pixel (0,0) (adjusted for padding)
|
||||
int32_t m_rowpixels; // pixels per row (including padding)
|
||||
int32_t m_width; // width of the bitmap
|
||||
int32_t m_height; // height of the bitmap
|
||||
bitmap_format m_format; // format of the bitmap
|
||||
uint8_t m_bpp; // bits per pixel
|
||||
palette_t * m_palette; // optional palette
|
||||
rectangle m_cliprect; // a clipping rectangle covering the full bitmap
|
||||
};
|
||||
|
||||
|
||||
@ -199,10 +200,13 @@ private:
|
||||
|
||||
protected:
|
||||
// construction/destruction -- subclasses only
|
||||
bitmap8_t(bitmap8_t &&) = default;
|
||||
bitmap8_t(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, 8, width, height, xslop, yslop) { }
|
||||
bitmap8_t(bitmap_format format, uint8_t *base, int width, int height, int rowpixels) : bitmap_t(format, 8, base, width, height, rowpixels) { assert(valid_format(format)); }
|
||||
bitmap8_t(bitmap_format format, bitmap8_t &source, const rectangle &subrect) : bitmap_t(format, 8, source, subrect) { }
|
||||
|
||||
bitmap8_t &operator=(bitmap8_t &&) = default;
|
||||
|
||||
public:
|
||||
// getters
|
||||
uint8_t bpp() const { return 8; }
|
||||
@ -222,10 +226,13 @@ private:
|
||||
|
||||
protected:
|
||||
// construction/destruction -- subclasses only
|
||||
bitmap16_t(bitmap16_t &&) = default;
|
||||
bitmap16_t(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, 16, width, height, xslop, yslop) { assert(valid_format(format)); }
|
||||
bitmap16_t(bitmap_format format, uint16_t *base, int width, int height, int rowpixels) : bitmap_t(format, 16, base, width, height, rowpixels) { assert(valid_format(format)); }
|
||||
bitmap16_t(bitmap_format format, bitmap16_t &source, const rectangle &subrect) : bitmap_t(format, 16, source, subrect) { }
|
||||
|
||||
bitmap16_t &operator=(bitmap16_t &&) = default;
|
||||
|
||||
public:
|
||||
// getters
|
||||
uint8_t bpp() const { return 16; }
|
||||
@ -245,10 +252,13 @@ private:
|
||||
|
||||
protected:
|
||||
// construction/destruction -- subclasses only
|
||||
bitmap32_t(bitmap32_t &&) = default;
|
||||
bitmap32_t(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, 32, width, height, xslop, yslop) { assert(valid_format(format)); }
|
||||
bitmap32_t(bitmap_format format, uint32_t *base, int width, int height, int rowpixels) : bitmap_t(format, 32, base, width, height, rowpixels) { assert(valid_format(format)); }
|
||||
bitmap32_t(bitmap_format format, bitmap32_t &source, const rectangle &subrect) : bitmap_t(format, 32, source, subrect) { }
|
||||
|
||||
bitmap32_t &operator=(bitmap32_t &&) = default;
|
||||
|
||||
public:
|
||||
// getters
|
||||
uint8_t bpp() const { return 32; }
|
||||
@ -268,10 +278,13 @@ private:
|
||||
|
||||
protected:
|
||||
// construction/destruction -- subclasses only
|
||||
bitmap64_t(bitmap64_t &&) = default;
|
||||
bitmap64_t(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, 64, width, height, xslop, yslop) { assert(valid_format(format)); }
|
||||
bitmap64_t(bitmap_format format, uint64_t *base, int width, int height, int rowpixels) : bitmap_t(format, 64, base, width, height, rowpixels) { assert(valid_format(format)); }
|
||||
bitmap64_t(bitmap_format format, bitmap64_t &source, const rectangle &subrect) : bitmap_t(format, 64, source, subrect) { }
|
||||
|
||||
bitmap64_t &operator=(bitmap64_t &&) = default;
|
||||
|
||||
public:
|
||||
// getters
|
||||
uint8_t bpp() const { return 64; }
|
||||
@ -292,6 +305,7 @@ class bitmap_ind8 : public bitmap8_t
|
||||
|
||||
public:
|
||||
// construction/destruction
|
||||
bitmap_ind8(bitmap_ind8 &&) = default;
|
||||
bitmap_ind8(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap8_t(k_bitmap_format, width, height, xslop, yslop) { }
|
||||
bitmap_ind8(uint8_t *base, int width, int height, int rowpixels) : bitmap8_t(k_bitmap_format, base, width, height, rowpixels) { }
|
||||
bitmap_ind8(bitmap_ind8 &source, const rectangle &subrect) : bitmap8_t(k_bitmap_format, source, subrect) { }
|
||||
@ -300,6 +314,8 @@ public:
|
||||
|
||||
// getters
|
||||
bitmap_format format() const { return k_bitmap_format; }
|
||||
|
||||
bitmap_ind8 &operator=(bitmap_ind8 &&) = default;
|
||||
};
|
||||
|
||||
// BITMAP_FORMAT_IND16 bitmaps
|
||||
@ -309,6 +325,7 @@ class bitmap_ind16 : public bitmap16_t
|
||||
|
||||
public:
|
||||
// construction/destruction
|
||||
bitmap_ind16(bitmap_ind16 &&) = default;
|
||||
bitmap_ind16(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap16_t(k_bitmap_format, width, height, xslop, yslop) { }
|
||||
bitmap_ind16(uint16_t *base, int width, int height, int rowpixels) : bitmap16_t(k_bitmap_format, base, width, height, rowpixels) { }
|
||||
bitmap_ind16(bitmap_ind16 &source, const rectangle &subrect) : bitmap16_t(k_bitmap_format, source, subrect) { }
|
||||
@ -317,6 +334,8 @@ public:
|
||||
|
||||
// getters
|
||||
bitmap_format format() const { return k_bitmap_format; }
|
||||
|
||||
bitmap_ind16 &operator=(bitmap_ind16 &&) = default;
|
||||
};
|
||||
|
||||
// BITMAP_FORMAT_IND32 bitmaps
|
||||
@ -326,6 +345,7 @@ class bitmap_ind32 : public bitmap32_t
|
||||
|
||||
public:
|
||||
// construction/destruction
|
||||
bitmap_ind32(bitmap_ind32 &&) = default;
|
||||
bitmap_ind32(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap32_t(k_bitmap_format, width, height, xslop, yslop) { }
|
||||
bitmap_ind32(uint32_t *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { }
|
||||
bitmap_ind32(bitmap_ind32 &source, const rectangle &subrect) : bitmap32_t(k_bitmap_format, source, subrect) { }
|
||||
@ -334,6 +354,8 @@ public:
|
||||
|
||||
// getters
|
||||
bitmap_format format() const { return k_bitmap_format; }
|
||||
|
||||
bitmap_ind32 &operator=(bitmap_ind32 &&) = default;
|
||||
};
|
||||
|
||||
// BITMAP_FORMAT_IND64 bitmaps
|
||||
@ -343,6 +365,7 @@ class bitmap_ind64 : public bitmap64_t
|
||||
|
||||
public:
|
||||
// construction/destruction
|
||||
bitmap_ind64(bitmap_ind64 &&) = default;
|
||||
bitmap_ind64(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap64_t(k_bitmap_format, width, height, xslop, yslop) { }
|
||||
bitmap_ind64(uint64_t *base, int width, int height, int rowpixels) : bitmap64_t(k_bitmap_format, base, width, height, rowpixels) { }
|
||||
bitmap_ind64(bitmap_ind64 &source, const rectangle &subrect) : bitmap64_t(k_bitmap_format, source, subrect) { }
|
||||
@ -351,6 +374,8 @@ public:
|
||||
|
||||
// getters
|
||||
bitmap_format format() const { return k_bitmap_format; }
|
||||
|
||||
bitmap_ind64 &operator=(bitmap_ind64 &&) = default;
|
||||
};
|
||||
|
||||
|
||||
@ -363,6 +388,7 @@ class bitmap_yuy16 : public bitmap16_t
|
||||
|
||||
public:
|
||||
// construction/destruction
|
||||
bitmap_yuy16(bitmap_yuy16 &&) = default;
|
||||
bitmap_yuy16(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap16_t(k_bitmap_format, width, height, xslop, yslop) { }
|
||||
bitmap_yuy16(uint16_t *base, int width, int height, int rowpixels) : bitmap16_t(k_bitmap_format, base, width, height, rowpixels) { }
|
||||
bitmap_yuy16(bitmap_yuy16 &source, const rectangle &subrect) : bitmap16_t(k_bitmap_format, source, subrect) { }
|
||||
@ -371,6 +397,8 @@ public:
|
||||
|
||||
// getters
|
||||
bitmap_format format() const { return k_bitmap_format; }
|
||||
|
||||
bitmap_yuy16 &operator=(bitmap_yuy16 &&) = default;
|
||||
};
|
||||
|
||||
// BITMAP_FORMAT_RGB32 bitmaps
|
||||
@ -380,6 +408,7 @@ class bitmap_rgb32 : public bitmap32_t
|
||||
|
||||
public:
|
||||
// construction/destruction
|
||||
bitmap_rgb32(bitmap_rgb32 &&) = default;
|
||||
bitmap_rgb32(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap32_t(k_bitmap_format, width, height, xslop, yslop) { }
|
||||
bitmap_rgb32(uint32_t *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { }
|
||||
bitmap_rgb32(bitmap_rgb32 &source, const rectangle &subrect) : bitmap32_t(k_bitmap_format, source, subrect) { }
|
||||
@ -388,6 +417,8 @@ public:
|
||||
|
||||
// getters
|
||||
bitmap_format format() const { return k_bitmap_format; }
|
||||
|
||||
bitmap_rgb32 &operator=(bitmap_rgb32 &&) = default;
|
||||
};
|
||||
|
||||
// BITMAP_FORMAT_ARGB32 bitmaps
|
||||
@ -397,6 +428,7 @@ class bitmap_argb32 : public bitmap32_t
|
||||
|
||||
public:
|
||||
// construction/destruction
|
||||
bitmap_argb32(bitmap_argb32 &&) = default;
|
||||
bitmap_argb32(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap32_t(k_bitmap_format, width, height, xslop, yslop) { }
|
||||
bitmap_argb32(uint32_t *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { }
|
||||
bitmap_argb32(bitmap_argb32 &source, const rectangle &subrect) : bitmap32_t(k_bitmap_format, source, subrect) { }
|
||||
@ -405,7 +437,9 @@ public:
|
||||
|
||||
// getters
|
||||
bitmap_format format() const { return k_bitmap_format; }
|
||||
|
||||
bitmap_argb32 &operator=(bitmap_argb32 &&) = default;
|
||||
};
|
||||
|
||||
|
||||
#endif // __BITMAP_H__
|
||||
#endif // MAME_UTIL_BITMAP_H
|
||||
|
@ -444,6 +444,7 @@ private:
|
||||
|
||||
// LRU cache that behaves like std::map with differences:
|
||||
// * drops least-recently used items if necessary on insert to prevent size from exceeding max_size
|
||||
// * operator[], at, insert, emplace and find freshen existing entries
|
||||
// * iterates from least- to most-recently used rather than in order by key
|
||||
// * iterators to dropped items are invalidated
|
||||
// * not all map interfaces implemented
|
||||
|
Loading…
Reference in New Issue
Block a user