mirror of
https://github.com/holub/mame
synced 2025-06-27 14:49:11 +03:00
Changed osd_font to struct osd_font and removed unnecessary osdepend.h
includes.
This commit is contained in:
parent
4a7c1200bd
commit
18d5da6b0b
@ -24,6 +24,8 @@
|
||||
|
||||
#include "drivenum.h"
|
||||
|
||||
#include "osdepend.h"
|
||||
|
||||
#include <new>
|
||||
#include <ctype.h>
|
||||
|
||||
|
@ -15,8 +15,9 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "cliopts.h"
|
||||
#include "osdepend.h"
|
||||
|
||||
// don't include osd_interface in header files
|
||||
class osd_interface;
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
|
@ -99,6 +99,8 @@
|
||||
#include "uiinput.h"
|
||||
#include "debug/debugcon.h"
|
||||
|
||||
#include "osdepend.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
|
||||
|
@ -106,6 +106,11 @@ static char giant_string_buffer[65536] = { 0 };
|
||||
// RUNNING MACHINE
|
||||
//**************************************************************************
|
||||
|
||||
osd_interface &running_machine::osd() const
|
||||
{
|
||||
return m_manager.osd();
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// running_machine - constructor
|
||||
//-------------------------------------------------
|
||||
|
@ -19,7 +19,8 @@
|
||||
|
||||
#include <time.h>
|
||||
|
||||
|
||||
// forward declaration instead of osdepend.h
|
||||
class osd_interface;
|
||||
|
||||
//**************************************************************************
|
||||
// CONSTANTS
|
||||
@ -157,7 +158,7 @@ public:
|
||||
const machine_config &config() const { return m_config; }
|
||||
device_t &root_device() const { return m_config.root_device(); }
|
||||
const game_driver &system() const { return m_system; }
|
||||
osd_interface &osd() const { return m_manager.osd(); }
|
||||
osd_interface &osd() const;
|
||||
machine_manager &manager() const { return m_manager; }
|
||||
resource_pool &respool() { return m_respool; }
|
||||
device_scheduler &scheduler() { return m_scheduler; }
|
||||
|
@ -92,6 +92,12 @@
|
||||
|
||||
machine_manager* machine_manager::m_manager = NULL;
|
||||
|
||||
osd_interface &machine_manager::osd() const
|
||||
{
|
||||
return m_osd;
|
||||
}
|
||||
|
||||
|
||||
machine_manager* machine_manager::instance(emu_options &options,osd_interface &osd)
|
||||
{
|
||||
if(!m_manager)
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "webengine.h"
|
||||
|
||||
class osd_interface;
|
||||
|
||||
//**************************************************************************
|
||||
// CONSTANTS
|
||||
@ -88,7 +89,7 @@ public:
|
||||
static machine_manager *instance();
|
||||
~machine_manager();
|
||||
|
||||
osd_interface &osd() const { return m_osd; }
|
||||
osd_interface &osd() const;
|
||||
emu_options &options() const { return m_options; }
|
||||
web_engine *web() { return &m_web; }
|
||||
lua_engine *lua() { return &m_lua; }
|
||||
|
@ -46,7 +46,7 @@
|
||||
#ifndef __RENDER_H__
|
||||
#define __RENDER_H__
|
||||
|
||||
#include "osdepend.h"
|
||||
//#include "osdepend.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "emuopts.h"
|
||||
#include <zlib.h>
|
||||
|
||||
#include "osdepend.h"
|
||||
#include "uismall.fh"
|
||||
|
||||
|
||||
|
@ -13,6 +13,8 @@
|
||||
|
||||
#include "render.h"
|
||||
|
||||
// forward instead of include
|
||||
class osd_font;
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
@ -91,7 +93,7 @@ private:
|
||||
dynamic_array<glyph> m_glyphs[256]; // array of glyph subtables
|
||||
dynamic_array<char> m_rawdata; // pointer to the raw data for the font
|
||||
UINT64 m_rawsize; // size of the raw font data
|
||||
osd_font m_osdfont; // handle to the OSD font
|
||||
osd_font *m_osdfont; // handle to the OSD font
|
||||
|
||||
// constants
|
||||
static const int CACHED_CHAR_SIZE = 12;
|
||||
|
@ -12,7 +12,6 @@
|
||||
#ifndef __RENDUTIL_H__
|
||||
#define __RENDUTIL_H__
|
||||
|
||||
#include "osdepend.h"
|
||||
#include "render.h"
|
||||
|
||||
#include <math.h>
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "ui/miscmenu.h"
|
||||
#include "ui/filemngr.h"
|
||||
|
||||
#include "osdepend.h"
|
||||
|
||||
/*-------------------------------------------------
|
||||
ui_slider_ui_handler - pushes the slider
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "snap.lh"
|
||||
|
||||
|
||||
#include "osdepend.h"
|
||||
|
||||
//**************************************************************************
|
||||
// DEBUGGING
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "webengine.h"
|
||||
#include "lua.hpp"
|
||||
|
||||
|
||||
#include "osdepend.h"
|
||||
|
||||
//**************************************************************************
|
||||
// WEB ENGINE
|
||||
|
@ -14,7 +14,6 @@
|
||||
#define __COREFILE_H__
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "osdcore.h"
|
||||
#include "astring.h"
|
||||
#include "coretmpl.h"
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
#ifndef __OPTIONS_H__
|
||||
#define __OPTIONS_H__
|
||||
|
||||
#include "osdcore.h"
|
||||
#include "corefile.h"
|
||||
#include "tagmap.h"
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "formats/basicdsk.h"
|
||||
#include "formats/fmsx_cas.h"
|
||||
#include "formats/msx_dsk.h"
|
||||
//#include "osdepend.h"
|
||||
#include "hashfile.h"
|
||||
#include "machine/wd_fdc.h"
|
||||
#include "imagedev/floppy.h"
|
||||
|
@ -346,7 +346,7 @@ void osd_common_t::customize_input_type_list(simple_list<input_type_entry> &type
|
||||
// font with the given name
|
||||
//-------------------------------------------------
|
||||
|
||||
osd_font osd_common_t::font_open(const char *name, int &height)
|
||||
osd_font *osd_common_t::font_open(const char *name, int &height)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@ -357,7 +357,7 @@ osd_font osd_common_t::font_open(const char *name, int &height)
|
||||
// a given OSD font
|
||||
//-------------------------------------------------
|
||||
|
||||
void osd_common_t::font_close(osd_font font)
|
||||
void osd_common_t::font_close(osd_font *font)
|
||||
{
|
||||
}
|
||||
|
||||
@ -370,7 +370,7 @@ void osd_common_t::font_close(osd_font font)
|
||||
// pixel of a black & white font
|
||||
//-------------------------------------------------
|
||||
|
||||
bool osd_common_t::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
|
||||
bool osd_common_t::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -153,9 +153,9 @@ public:
|
||||
virtual void customize_input_type_list(simple_list<input_type_entry> &typelist);
|
||||
|
||||
// font overridables
|
||||
virtual osd_font font_open(const char *name, int &height);
|
||||
virtual void font_close(osd_font font);
|
||||
virtual bool font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
|
||||
virtual osd_font *font_open(const char *name, int &height);
|
||||
virtual void font_close(osd_font *font);
|
||||
virtual bool font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
|
||||
|
||||
// video overridables
|
||||
virtual void *get_slider_list();
|
||||
|
@ -53,8 +53,10 @@ static output_delegate output_cb[OSD_OUTPUT_CHANNEL_COUNT] =
|
||||
|
||||
output_delegate osd_set_output_channel(output_channel channel, output_delegate callback)
|
||||
{
|
||||
assert(channel < OSD_OUTPUT_CHANNEL_COUNT);
|
||||
assert(!callback.isnull());
|
||||
if (!(channel < OSD_OUTPUT_CHANNEL_COUNT) || callback.isnull())
|
||||
{
|
||||
throw std::exception();
|
||||
}
|
||||
|
||||
/* return the originals if requested */
|
||||
output_delegate prevcb = output_cb[channel];
|
||||
|
@ -27,7 +27,7 @@ class input_type_entry; // FIXME: including emu.h does not work because emu.
|
||||
//============================================================
|
||||
|
||||
// FIXME: We can do better than this
|
||||
typedef void *osd_font;
|
||||
class osd_font;
|
||||
|
||||
// ======================> osd_interface
|
||||
|
||||
@ -53,9 +53,9 @@ public:
|
||||
virtual void customize_input_type_list(simple_list<input_type_entry> &typelist) = 0;
|
||||
|
||||
// font overridables
|
||||
virtual osd_font font_open(const char *name, int &height) = 0;
|
||||
virtual void font_close(osd_font font) = 0;
|
||||
virtual bool font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) = 0;
|
||||
virtual osd_font *font_open(const char *name, int &height) = 0;
|
||||
virtual void font_close(osd_font *font) = 0;
|
||||
virtual bool font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) = 0;
|
||||
|
||||
// video overridables
|
||||
virtual void *get_slider_list() = 0; // FIXME: returns slider_state *
|
||||
|
@ -134,11 +134,12 @@ public:
|
||||
const HashT hash() const { return m_hash; }
|
||||
const UINT32 flags() const { return m_flags; }
|
||||
const bool is_pixels_owned() const { // do we own / allocated it ?
|
||||
return m_sdl_access == SDL_TEXTUREACCESS_STATIC
|
||||
&& m_copyinfo->func != NULL ;
|
||||
return false && ((m_sdl_access == SDL_TEXTUREACCESS_STATIC)
|
||||
&& (m_copyinfo->func != NULL)) ;
|
||||
}
|
||||
|
||||
private:
|
||||
Uint32 m_sdl_access;
|
||||
SDL_Renderer * m_renderer;
|
||||
render_texinfo m_texinfo; // copy of the texture info
|
||||
HashT m_hash; // hash value for the texture (must be >= pointer size)
|
||||
@ -149,7 +150,6 @@ private:
|
||||
|
||||
int m_format; // texture format
|
||||
SDL_BlendMode m_sdl_blendmode;
|
||||
Uint32 m_sdl_access;
|
||||
|
||||
texture_info * m_next; // next texture in the list
|
||||
};
|
||||
@ -490,6 +490,7 @@ static void expand_copy_info(copy_info_t *list)
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: machine only used to access options.
|
||||
int drawsdl2_init(running_machine &machine, sdl_draw_info *callbacks)
|
||||
{
|
||||
const char *stemp;
|
||||
@ -1007,9 +1008,9 @@ texture_info::texture_info(SDL_Renderer *renderer, const render_texinfo &texsour
|
||||
|
||||
texture_info::~texture_info()
|
||||
{
|
||||
SDL_DestroyTexture(m_texture_id);
|
||||
if ( is_pixels_owned() && m_pixels != NULL )
|
||||
if ( is_pixels_owned() && (m_pixels != NULL) )
|
||||
free(m_pixels);
|
||||
SDL_DestroyTexture(m_texture_id);
|
||||
}
|
||||
|
||||
//============================================================
|
||||
|
@ -111,12 +111,6 @@
|
||||
#endif
|
||||
|
||||
|
||||
//============================================================
|
||||
// TYPE DEFINITIONS
|
||||
//============================================================
|
||||
|
||||
typedef void *osd_font;
|
||||
|
||||
//============================================================
|
||||
// TYPE DEFINITIONS
|
||||
//============================================================
|
||||
@ -193,9 +187,9 @@ public:
|
||||
virtual void customize_input_type_list(simple_list<input_type_entry> &typelist);
|
||||
|
||||
// font overridables
|
||||
virtual osd_font font_open(const char *name, int &height);
|
||||
virtual void font_close(osd_font font);
|
||||
virtual bool font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
|
||||
virtual osd_font *font_open(const char *name, int &height);
|
||||
virtual void font_close(osd_font *font);
|
||||
virtual bool font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
|
||||
|
||||
virtual void video_register();
|
||||
virtual void sound_register();
|
||||
|
@ -717,7 +717,13 @@ void sdl_osd_interface::init(running_machine &machine)
|
||||
// font with the given name
|
||||
//-------------------------------------------------
|
||||
|
||||
osd_font sdl_osd_interface::font_open(const char *_name, int &height)
|
||||
class osd_font
|
||||
{
|
||||
public:
|
||||
CTFontRef m_font;
|
||||
};
|
||||
|
||||
osd_font *sdl_osd_interface::font_open(const char *_name, int &height)
|
||||
{
|
||||
CFStringRef font_name = NULL;
|
||||
CTFontRef ct_font = NULL;
|
||||
@ -770,7 +776,9 @@ osd_font sdl_osd_interface::font_open(const char *_name, int &height)
|
||||
line_height += CTFontGetLeading(ct_font);
|
||||
height = ceilf(line_height * EXTRA_HEIGHT);
|
||||
|
||||
return (osd_font)ct_font;
|
||||
osd_font *ret = global_alloc(osd_font);
|
||||
ret->m_font = ct_font;
|
||||
return ret;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -778,14 +786,15 @@ osd_font sdl_osd_interface::font_open(const char *_name, int &height)
|
||||
// a given OSD font
|
||||
//-------------------------------------------------
|
||||
|
||||
void sdl_osd_interface::font_close(osd_font font)
|
||||
void sdl_osd_interface::font_close(osd_font *font)
|
||||
{
|
||||
CTFontRef ct_font = (CTFontRef)font;
|
||||
CTFontRef ct_font = font->m_font;
|
||||
|
||||
if( ct_font != NULL )
|
||||
{
|
||||
CFRelease( ct_font );
|
||||
}
|
||||
global_free(font);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -796,11 +805,11 @@ void sdl_osd_interface::font_close(osd_font font)
|
||||
// pixel of a black & white font
|
||||
//-------------------------------------------------
|
||||
|
||||
bool sdl_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
|
||||
bool sdl_osd_interface::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
|
||||
{
|
||||
UniChar uni_char;
|
||||
CGGlyph glyph;
|
||||
CTFontRef ct_font = (CTFontRef)font;
|
||||
CTFontRef ct_font = font->m_font;
|
||||
const CFIndex count = 1;
|
||||
CGRect bounding_rect, success_rect;
|
||||
CGContextRef context_ref;
|
||||
@ -1009,7 +1018,13 @@ static TTF_Font *search_font_config(astring name, bool bold, bool italic, bool u
|
||||
// font with the given name
|
||||
//-------------------------------------------------
|
||||
|
||||
osd_font sdl_osd_interface::font_open(const char *_name, int &height)
|
||||
class osd_font
|
||||
{
|
||||
public:
|
||||
TTF_Font *m_font;
|
||||
};
|
||||
|
||||
osd_font *sdl_osd_interface::font_open(const char *_name, int &height)
|
||||
{
|
||||
TTF_Font *font = (TTF_Font *)NULL;
|
||||
bool bakedstyles = false;
|
||||
@ -1081,7 +1096,9 @@ osd_font sdl_osd_interface::font_open(const char *_name, int &height)
|
||||
|
||||
height = TTF_FontLineSkip(font);
|
||||
|
||||
return (osd_font)font;
|
||||
osd_font *ret = global_alloc(osd_font);
|
||||
ret->m_font = font;
|
||||
return ret;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -1089,13 +1106,10 @@ osd_font sdl_osd_interface::font_open(const char *_name, int &height)
|
||||
// a given OSD font
|
||||
//-------------------------------------------------
|
||||
|
||||
void sdl_osd_interface::font_close(osd_font font)
|
||||
void sdl_osd_interface::font_close(osd_font *font)
|
||||
{
|
||||
TTF_Font *ttffont;
|
||||
|
||||
ttffont = (TTF_Font *)font;
|
||||
|
||||
TTF_CloseFont(ttffont);
|
||||
TTF_CloseFont(font->m_font);
|
||||
global_free(font);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -1106,14 +1120,14 @@ void sdl_osd_interface::font_close(osd_font font)
|
||||
// pixel of a black & white font
|
||||
//-------------------------------------------------
|
||||
|
||||
bool sdl_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
|
||||
bool sdl_osd_interface::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
|
||||
{
|
||||
TTF_Font *ttffont;
|
||||
SDL_Surface *drawsurf;
|
||||
SDL_Color fcol = { 0xff, 0xff, 0xff };
|
||||
UINT16 ustr[16];
|
||||
|
||||
ttffont = (TTF_Font *)font;
|
||||
ttffont = font->m_font;
|
||||
|
||||
memset(ustr,0,sizeof(ustr));
|
||||
ustr[0] = (UINT16)chnum;
|
||||
|
@ -719,7 +719,7 @@ void windows_osd_interface::osd_exit()
|
||||
// font with the given name
|
||||
//-------------------------------------------------
|
||||
|
||||
osd_font windows_osd_interface::font_open(const char *_name, int &height)
|
||||
osd_font *windows_osd_interface::font_open(const char *_name, int &height)
|
||||
{
|
||||
// accept qualifiers from the name
|
||||
astring name(_name);
|
||||
@ -751,7 +751,7 @@ osd_font windows_osd_interface::font_open(const char *_name, int &height)
|
||||
|
||||
// create the font
|
||||
height = logfont.lfHeight;
|
||||
osd_font font = reinterpret_cast<osd_font>(CreateFontIndirect(&logfont));
|
||||
osd_font *font = reinterpret_cast<osd_font *>(CreateFontIndirect(&logfont));
|
||||
if (font == NULL)
|
||||
return NULL;
|
||||
|
||||
@ -783,7 +783,7 @@ osd_font windows_osd_interface::font_open(const char *_name, int &height)
|
||||
// a given OSD font
|
||||
//-------------------------------------------------
|
||||
|
||||
void windows_osd_interface::font_close(osd_font font)
|
||||
void windows_osd_interface::font_close(osd_font *font)
|
||||
{
|
||||
// delete the font ojbect
|
||||
if (font != NULL)
|
||||
@ -799,7 +799,7 @@ void windows_osd_interface::font_close(osd_font font)
|
||||
// pixel of a black & white font
|
||||
//-------------------------------------------------
|
||||
|
||||
bool windows_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
|
||||
bool windows_osd_interface::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
|
||||
{
|
||||
// create a dummy DC to work with
|
||||
HDC dummyDC = CreateCompatibleDC(NULL);
|
||||
|
@ -253,9 +253,9 @@ public:
|
||||
virtual void customize_input_type_list(simple_list<input_type_entry> &typelist);
|
||||
|
||||
// font overridables
|
||||
virtual osd_font font_open(const char *name, int &height);
|
||||
virtual void font_close(osd_font font);
|
||||
virtual bool font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
|
||||
virtual osd_font *font_open(const char *name, int &height);
|
||||
virtual void font_close(osd_font *font);
|
||||
virtual bool font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
|
||||
|
||||
virtual void video_register();
|
||||
virtual void sound_register();
|
||||
|
Loading…
Reference in New Issue
Block a user