summaryrefslogtreecommitdiffstats
path: root/src/emu/rendfont.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/rendfont.cpp')
-rw-r--r--src/emu/rendfont.cpp56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/emu/rendfont.cpp b/src/emu/rendfont.cpp
index af4580cc9c1..aa43342958c 100644
--- a/src/emu/rendfont.cpp
+++ b/src/emu/rendfont.cpp
@@ -22,7 +22,7 @@
#include <cstring>
-const UINT64 render_font::CACHED_BDF_HASH_SIZE;
+const uint64_t render_font::CACHED_BDF_HASH_SIZE;
//**************************************************************************
// INLINE FUNCTIONS
@@ -234,11 +234,11 @@ void render_font::char_expand(char32_t chnum, glyph &gl)
// extract the data
const char *ptr = gl.rawdata;
- UINT8 accum = 0, accumbit = 7;
+ uint8_t accum = 0, accumbit = 7;
for (int y = 0; y < gl.bmheight; y++)
{
int desty = y + m_height_cmd + m_yoffs_cmd - gl.yoffs - gl.bmheight;
- UINT32 *dest = (desty >= 0 && desty < m_height_cmd) ? &gl.bitmap.pix32(desty, 0) : nullptr;
+ uint32_t *dest = (desty >= 0 && desty < m_height_cmd) ? &gl.bitmap.pix32(desty, 0) : nullptr;
{
for (int x = 0; x < gl.bmwidth; x++)
{
@@ -283,11 +283,11 @@ void render_font::char_expand(char32_t chnum, glyph &gl)
// extract the data
const char *ptr = gl.rawdata;
- UINT8 accum = 0, accumbit = 7;
+ uint8_t accum = 0, accumbit = 7;
for (int y = 0; y < gl.bmheight; y++)
{
int desty = y + m_height + m_yoffs - gl.yoffs - gl.bmheight;
- UINT32 *dest = (desty >= 0 && desty < m_height) ? &gl.bitmap.pix32(desty) : nullptr;
+ uint32_t *dest = (desty >= 0 && desty < m_height) ? &gl.bitmap.pix32(desty) : nullptr;
// text format
if (m_format == FF_TEXT)
@@ -454,7 +454,7 @@ float render_font::utf8string_width(float height, float aspect, const char *utf8
// loop over the string and accumulate widths
int count;
- INT32 totwidth = 0;
+ int32_t totwidth = 0;
for (std::size_t offset = 0U; offset < length; offset += unsigned(count))
{
char32_t uchar;
@@ -490,12 +490,12 @@ bool render_font::load_cached_bdf(const char *filename)
m_rawdata.resize(m_rawsize + 1);
// read the first chunk
- UINT32 bytes = file.read(&m_rawdata[0], std::min(CACHED_BDF_HASH_SIZE, m_rawsize));
+ uint32_t bytes = file.read(&m_rawdata[0], std::min(CACHED_BDF_HASH_SIZE, m_rawsize));
if (bytes != std::min(CACHED_BDF_HASH_SIZE, m_rawsize))
return false;
// has the chunk
- UINT32 hash = core_crc32(0, (const UINT8 *)&m_rawdata[0], bytes) ^ (UINT32)m_rawsize;
+ uint32_t hash = core_crc32(0, (const uint8_t *)&m_rawdata[0], bytes) ^ (uint32_t)m_rawsize;
// create the cached filename, changing the 'F' to a 'C' on the extension
std::string cachedname(filename);
@@ -523,7 +523,7 @@ bool render_font::load_cached_bdf(const char *filename)
// read in the rest of the font
if (bytes < m_rawsize)
{
- UINT32 read = file.read(&m_rawdata[bytes], m_rawsize - bytes);
+ uint32_t read = file.read(&m_rawdata[bytes], m_rawsize - bytes);
if (read != m_rawsize - bytes)
{
m_rawdata.clear();
@@ -664,26 +664,26 @@ bool render_font::load_bdf()
// load_cached - load a font in cached format
//-------------------------------------------------
-bool render_font::load_cached(emu_file &file, UINT32 hash)
+bool render_font::load_cached(emu_file &file, uint32_t hash)
{
// get the file size
- UINT64 filesize = file.size();
+ uint64_t filesize = file.size();
// first read the header
- UINT8 header[CACHED_HEADER_SIZE];
- UINT32 bytes_read = file.read(header, CACHED_HEADER_SIZE);
+ uint8_t header[CACHED_HEADER_SIZE];
+ uint32_t bytes_read = file.read(header, CACHED_HEADER_SIZE);
if (bytes_read != CACHED_HEADER_SIZE)
return false;
// validate the header
if (header[0] != 'f' || header[1] != 'o' || header[2] != 'n' || header[3] != 't')
return false;
- if (hash && (header[4] != (UINT8)(hash >> 24) || header[5] != (UINT8)(hash >> 16) || header[6] != (UINT8)(hash >> 8) || header[7] != (UINT8)hash))
+ if (hash && (header[4] != (uint8_t)(hash >> 24) || header[5] != (uint8_t)(hash >> 16) || header[6] != (uint8_t)(hash >> 8) || header[7] != (uint8_t)hash))
return false;
m_height = (header[8] << 8) | header[9];
m_scale = 1.0f / (float)m_height;
- m_yoffs = (INT16)((header[10] << 8) | header[11]);
- UINT32 numchars = (header[12] << 24) | (header[13] << 16) | (header[14] << 8) | header[15];
+ m_yoffs = (int16_t)((header[10] << 8) | header[11]);
+ uint32_t numchars = (header[12] << 24) | (header[13] << 16) | (header[14] << 8) | header[15];
if (filesize - CACHED_HEADER_SIZE < numchars * CACHED_CHAR_SIZE)
return false;
@@ -697,10 +697,10 @@ bool render_font::load_cached(emu_file &file, UINT32 hash)
}
// extract the data from the data
- UINT64 offset = numchars * CACHED_CHAR_SIZE;
+ uint64_t offset = numchars * CACHED_CHAR_SIZE;
for (int chindex = 0; chindex < numchars; chindex++)
{
- const UINT8 *info = reinterpret_cast<UINT8 *>(&m_rawdata[chindex * CACHED_CHAR_SIZE]);
+ const uint8_t *info = reinterpret_cast<uint8_t *>(&m_rawdata[chindex * CACHED_CHAR_SIZE]);
int chnum = (info[0] << 8) | info[1];
// if we don't have a subtable yet, make one
@@ -710,8 +710,8 @@ bool render_font::load_cached(emu_file &file, UINT32 hash)
// fill in the entry
glyph &gl = m_glyphs[chnum / 256][chnum % 256];
gl.width = (info[2] << 8) | info[3];
- gl.xoffs = (INT16)((info[4] << 8) | info[5]);
- gl.yoffs = (INT16)((info[6] << 8) | info[7]);
+ gl.xoffs = (int16_t)((info[4] << 8) | info[5]);
+ gl.yoffs = (int16_t)((info[6] << 8) | info[7]);
gl.bmwidth = (info[8] << 8) | info[9];
gl.bmheight = (info[10] << 8) | info[11];
gl.rawdata = &m_rawdata[offset];
@@ -735,7 +735,7 @@ bool render_font::load_cached(emu_file &file, UINT32 hash)
// save_cached - save a font in cached format
//-------------------------------------------------
-bool render_font::save_cached(const char *filename, UINT32 hash)
+bool render_font::save_cached(const char *filename, uint32_t hash)
{
osd_printf_warning("Generating cached BDF font...\n");
@@ -760,13 +760,13 @@ bool render_font::save_cached(const char *filename, UINT32 hash)
try
{
// allocate an array to hold the character data
- std::vector<UINT8> chartable(numchars * CACHED_CHAR_SIZE, 0);
+ std::vector<uint8_t> chartable(numchars * CACHED_CHAR_SIZE, 0);
// allocate a temp buffer to compress into
- std::vector<UINT8> tempbuffer(65536);
+ std::vector<uint8_t> tempbuffer(65536);
// write the header
- UINT8 *dest = &tempbuffer[0];
+ uint8_t *dest = &tempbuffer[0];
*dest++ = 'f';
*dest++ = 'o';
*dest++ = 'n';
@@ -784,7 +784,7 @@ bool render_font::save_cached(const char *filename, UINT32 hash)
*dest++ = numchars >> 8;
*dest++ = numchars & 0xff;
assert(dest == &tempbuffer[CACHED_HEADER_SIZE]);
- UINT32 bytes_written = file.write(&tempbuffer[0], CACHED_HEADER_SIZE);
+ uint32_t bytes_written = file.write(&tempbuffer[0], CACHED_HEADER_SIZE);
if (bytes_written != dest - &tempbuffer[0])
throw emu_fatalerror("Error writing cached file");
@@ -805,14 +805,14 @@ bool render_font::save_cached(const char *filename, UINT32 hash)
{
// write the data to the tempbuffer
dest = &tempbuffer[0];
- UINT8 accum = 0;
- UINT8 accbit = 7;
+ uint8_t accum = 0;
+ uint8_t accbit = 7;
// bit-encode the character data
for (int y = 0; y < gl.bmheight; y++)
{
int desty = y + m_height + m_yoffs - gl.yoffs - gl.bmheight;
- const UINT32 *src = (desty >= 0 && desty < m_height) ? &gl.bitmap.pix32(desty) : nullptr;
+ const uint32_t *src = (desty >= 0 && desty < m_height) ? &gl.bitmap.pix32(desty) : nullptr;
for (int x = 0; x < gl.bmwidth; x++)
{
if (src != nullptr && rgb_t(src[x]).a() != 0)