trunk/src/osd/modules/lib/osdobj_common.c
| r242949 | r242950 | |
| 346 | 346 | // font with the given name |
| 347 | 347 | //------------------------------------------------- |
| 348 | 348 | |
| 349 | | osd_font osd_common_t::font_open(const char *name, int &height) |
| 349 | osd_font *osd_common_t::font_open(const char *name, int &height) |
| 350 | 350 | { |
| 351 | 351 | return NULL; |
| 352 | 352 | } |
| r242949 | r242950 | |
| 357 | 357 | // a given OSD font |
| 358 | 358 | //------------------------------------------------- |
| 359 | 359 | |
| 360 | | void osd_common_t::font_close(osd_font font) |
| 360 | void osd_common_t::font_close(osd_font *font) |
| 361 | 361 | { |
| 362 | 362 | } |
| 363 | 363 | |
| r242949 | r242950 | |
| 370 | 370 | // pixel of a black & white font |
| 371 | 371 | //------------------------------------------------- |
| 372 | 372 | |
| 373 | | bool osd_common_t::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) |
| 373 | bool osd_common_t::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) |
| 374 | 374 | { |
| 375 | 375 | return false; |
| 376 | 376 | } |
trunk/src/osd/modules/lib/osdobj_common.h
| r242949 | r242950 | |
| 153 | 153 | virtual void customize_input_type_list(simple_list<input_type_entry> &typelist); |
| 154 | 154 | |
| 155 | 155 | // font overridables |
| 156 | | virtual osd_font font_open(const char *name, int &height); |
| 157 | | virtual void font_close(osd_font font); |
| 158 | | virtual bool font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs); |
| 156 | virtual osd_font *font_open(const char *name, int &height); |
| 157 | virtual void font_close(osd_font *font); |
| 158 | virtual bool font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs); |
| 159 | 159 | |
| 160 | 160 | // video overridables |
| 161 | 161 | virtual void *get_slider_list(); |
trunk/src/osd/osdepend.h
| r242949 | r242950 | |
| 27 | 27 | //============================================================ |
| 28 | 28 | |
| 29 | 29 | // FIXME: We can do better than this |
| 30 | | typedef void *osd_font; |
| 30 | class osd_font; |
| 31 | 31 | |
| 32 | 32 | // ======================> osd_interface |
| 33 | 33 | |
| r242949 | r242950 | |
| 53 | 53 | virtual void customize_input_type_list(simple_list<input_type_entry> &typelist) = 0; |
| 54 | 54 | |
| 55 | 55 | // font overridables |
| 56 | | virtual osd_font font_open(const char *name, int &height) = 0; |
| 57 | | virtual void font_close(osd_font font) = 0; |
| 58 | | virtual bool font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) = 0; |
| 56 | virtual osd_font *font_open(const char *name, int &height) = 0; |
| 57 | virtual void font_close(osd_font *font) = 0; |
| 58 | virtual bool font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) = 0; |
| 59 | 59 | |
| 60 | 60 | // video overridables |
| 61 | 61 | virtual void *get_slider_list() = 0; // FIXME: returns slider_state * |
trunk/src/osd/sdl/draw13.c
| r242949 | r242950 | |
| 134 | 134 | const HashT hash() const { return m_hash; } |
| 135 | 135 | const UINT32 flags() const { return m_flags; } |
| 136 | 136 | const bool is_pixels_owned() const { // do we own / allocated it ? |
| 137 | | return m_sdl_access == SDL_TEXTUREACCESS_STATIC |
| 138 | | && m_copyinfo->func != NULL ; |
| 137 | return false && ((m_sdl_access == SDL_TEXTUREACCESS_STATIC) |
| 138 | && (m_copyinfo->func != NULL)) ; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | private: |
| 142 | Uint32 m_sdl_access; |
| 142 | 143 | SDL_Renderer * m_renderer; |
| 143 | 144 | render_texinfo m_texinfo; // copy of the texture info |
| 144 | 145 | HashT m_hash; // hash value for the texture (must be >= pointer size) |
| r242949 | r242950 | |
| 149 | 150 | |
| 150 | 151 | int m_format; // texture format |
| 151 | 152 | SDL_BlendMode m_sdl_blendmode; |
| 152 | | Uint32 m_sdl_access; |
| 153 | 153 | |
| 154 | 154 | texture_info * m_next; // next texture in the list |
| 155 | 155 | }; |
| r242949 | r242950 | |
| 490 | 490 | } |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | // FIXME: machine only used to access options. |
| 493 | 494 | int drawsdl2_init(running_machine &machine, sdl_draw_info *callbacks) |
| 494 | 495 | { |
| 495 | 496 | const char *stemp; |
| r242949 | r242950 | |
| 1007 | 1008 | |
| 1008 | 1009 | texture_info::~texture_info() |
| 1009 | 1010 | { |
| 1011 | if ( is_pixels_owned() && (m_pixels != NULL) ) |
| 1012 | free(m_pixels); |
| 1010 | 1013 | SDL_DestroyTexture(m_texture_id); |
| 1011 | | if ( is_pixels_owned() && m_pixels != NULL ) |
| 1012 | | free(m_pixels); |
| 1013 | 1014 | } |
| 1014 | 1015 | |
| 1015 | 1016 | //============================================================ |
trunk/src/osd/sdl/osdsdl.h
| r242949 | r242950 | |
| 115 | 115 | // TYPE DEFINITIONS |
| 116 | 116 | //============================================================ |
| 117 | 117 | |
| 118 | | typedef void *osd_font; |
| 119 | | |
| 120 | | //============================================================ |
| 121 | | // TYPE DEFINITIONS |
| 122 | | //============================================================ |
| 123 | | |
| 124 | 118 | class sdl_options : public osd_options |
| 125 | 119 | { |
| 126 | 120 | public: |
| r242949 | r242950 | |
| 193 | 187 | virtual void customize_input_type_list(simple_list<input_type_entry> &typelist); |
| 194 | 188 | |
| 195 | 189 | // font overridables |
| 196 | | virtual osd_font font_open(const char *name, int &height); |
| 197 | | virtual void font_close(osd_font font); |
| 198 | | virtual bool font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs); |
| 190 | virtual osd_font *font_open(const char *name, int &height); |
| 191 | virtual void font_close(osd_font *font); |
| 192 | virtual bool font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs); |
| 199 | 193 | |
| 200 | 194 | virtual void video_register(); |
| 201 | 195 | virtual void sound_register(); |
trunk/src/osd/sdl/sdlmain.c
| r242949 | r242950 | |
| 717 | 717 | // font with the given name |
| 718 | 718 | //------------------------------------------------- |
| 719 | 719 | |
| 720 | | osd_font sdl_osd_interface::font_open(const char *_name, int &height) |
| 720 | class osd_font |
| 721 | 721 | { |
| 722 | public: |
| 723 | CTFontRef m_font; |
| 724 | }; |
| 725 | |
| 726 | osd_font *sdl_osd_interface::font_open(const char *_name, int &height) |
| 727 | { |
| 722 | 728 | CFStringRef font_name = NULL; |
| 723 | 729 | CTFontRef ct_font = NULL; |
| 724 | 730 | CTFontDescriptorRef font_descriptor; |
| r242949 | r242950 | |
| 770 | 776 | line_height += CTFontGetLeading(ct_font); |
| 771 | 777 | height = ceilf(line_height * EXTRA_HEIGHT); |
| 772 | 778 | |
| 773 | | return (osd_font)ct_font; |
| 779 | osd_font *ret = global_alloc(osd_font); |
| 780 | ret->m_font = ct_font; |
| 781 | return ret; |
| 774 | 782 | } |
| 775 | 783 | |
| 776 | 784 | //------------------------------------------------- |
| r242949 | r242950 | |
| 778 | 786 | // a given OSD font |
| 779 | 787 | //------------------------------------------------- |
| 780 | 788 | |
| 781 | | void sdl_osd_interface::font_close(osd_font font) |
| 789 | void sdl_osd_interface::font_close(osd_font *font) |
| 782 | 790 | { |
| 783 | | CTFontRef ct_font = (CTFontRef)font; |
| 791 | CTFontRef ct_font = font->m_font; |
| 784 | 792 | |
| 785 | 793 | if( ct_font != NULL ) |
| 786 | 794 | { |
| 787 | 795 | CFRelease( ct_font ); |
| 788 | 796 | } |
| 797 | global_free(font); |
| 789 | 798 | } |
| 790 | 799 | |
| 791 | 800 | //------------------------------------------------- |
| r242949 | r242950 | |
| 796 | 805 | // pixel of a black & white font |
| 797 | 806 | //------------------------------------------------- |
| 798 | 807 | |
| 799 | | bool sdl_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) |
| 808 | bool sdl_osd_interface::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) |
| 800 | 809 | { |
| 801 | 810 | UniChar uni_char; |
| 802 | 811 | CGGlyph glyph; |
| 803 | | CTFontRef ct_font = (CTFontRef)font; |
| 812 | CTFontRef ct_font = font->m_font; |
| 804 | 813 | const CFIndex count = 1; |
| 805 | 814 | CGRect bounding_rect, success_rect; |
| 806 | 815 | CGContextRef context_ref; |
| r242949 | r242950 | |
| 1009 | 1018 | // font with the given name |
| 1010 | 1019 | //------------------------------------------------- |
| 1011 | 1020 | |
| 1012 | | osd_font sdl_osd_interface::font_open(const char *_name, int &height) |
| 1021 | class osd_font |
| 1013 | 1022 | { |
| 1023 | public: |
| 1024 | TTF_Font *m_font; |
| 1025 | }; |
| 1026 | |
| 1027 | osd_font *sdl_osd_interface::font_open(const char *_name, int &height) |
| 1028 | { |
| 1014 | 1029 | TTF_Font *font = (TTF_Font *)NULL; |
| 1015 | 1030 | bool bakedstyles = false; |
| 1016 | 1031 | int style = 0; |
| r242949 | r242950 | |
| 1081 | 1096 | |
| 1082 | 1097 | height = TTF_FontLineSkip(font); |
| 1083 | 1098 | |
| 1084 | | return (osd_font)font; |
| 1099 | osd_font *ret = global_alloc(osd_font); |
| 1100 | ret->m_font = font; |
| 1101 | return ret; |
| 1085 | 1102 | } |
| 1086 | 1103 | |
| 1087 | 1104 | //------------------------------------------------- |
| r242949 | r242950 | |
| 1089 | 1106 | // a given OSD font |
| 1090 | 1107 | //------------------------------------------------- |
| 1091 | 1108 | |
| 1092 | | void sdl_osd_interface::font_close(osd_font font) |
| 1109 | void sdl_osd_interface::font_close(osd_font *font) |
| 1093 | 1110 | { |
| 1094 | | TTF_Font *ttffont; |
| 1095 | | |
| 1096 | | ttffont = (TTF_Font *)font; |
| 1097 | | |
| 1098 | | TTF_CloseFont(ttffont); |
| 1111 | TTF_CloseFont(font->m_font); |
| 1112 | global_free(font); |
| 1099 | 1113 | } |
| 1100 | 1114 | |
| 1101 | 1115 | //------------------------------------------------- |
| r242949 | r242950 | |
| 1106 | 1120 | // pixel of a black & white font |
| 1107 | 1121 | //------------------------------------------------- |
| 1108 | 1122 | |
| 1109 | | bool sdl_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) |
| 1123 | bool sdl_osd_interface::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) |
| 1110 | 1124 | { |
| 1111 | 1125 | TTF_Font *ttffont; |
| 1112 | 1126 | SDL_Surface *drawsurf; |
| 1113 | 1127 | SDL_Color fcol = { 0xff, 0xff, 0xff }; |
| 1114 | 1128 | UINT16 ustr[16]; |
| 1115 | 1129 | |
| 1116 | | ttffont = (TTF_Font *)font; |
| 1130 | ttffont = font->m_font; |
| 1117 | 1131 | |
| 1118 | 1132 | memset(ustr,0,sizeof(ustr)); |
| 1119 | 1133 | ustr[0] = (UINT16)chnum; |
trunk/src/osd/windows/winmain.c
| r242949 | r242950 | |
| 719 | 719 | // font with the given name |
| 720 | 720 | //------------------------------------------------- |
| 721 | 721 | |
| 722 | | osd_font windows_osd_interface::font_open(const char *_name, int &height) |
| 722 | osd_font *windows_osd_interface::font_open(const char *_name, int &height) |
| 723 | 723 | { |
| 724 | 724 | // accept qualifiers from the name |
| 725 | 725 | astring name(_name); |
| r242949 | r242950 | |
| 751 | 751 | |
| 752 | 752 | // create the font |
| 753 | 753 | height = logfont.lfHeight; |
| 754 | | osd_font font = reinterpret_cast<osd_font>(CreateFontIndirect(&logfont)); |
| 754 | osd_font *font = reinterpret_cast<osd_font *>(CreateFontIndirect(&logfont)); |
| 755 | 755 | if (font == NULL) |
| 756 | 756 | return NULL; |
| 757 | 757 | |
| r242949 | r242950 | |
| 783 | 783 | // a given OSD font |
| 784 | 784 | //------------------------------------------------- |
| 785 | 785 | |
| 786 | | void windows_osd_interface::font_close(osd_font font) |
| 786 | void windows_osd_interface::font_close(osd_font *font) |
| 787 | 787 | { |
| 788 | 788 | // delete the font ojbect |
| 789 | 789 | if (font != NULL) |
| r242949 | r242950 | |
| 799 | 799 | // pixel of a black & white font |
| 800 | 800 | //------------------------------------------------- |
| 801 | 801 | |
| 802 | | bool windows_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) |
| 802 | bool windows_osd_interface::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) |
| 803 | 803 | { |
| 804 | 804 | // create a dummy DC to work with |
| 805 | 805 | HDC dummyDC = CreateCompatibleDC(NULL); |
trunk/src/osd/windows/winmain.h
| r242949 | r242950 | |
| 253 | 253 | virtual void customize_input_type_list(simple_list<input_type_entry> &typelist); |
| 254 | 254 | |
| 255 | 255 | // font overridables |
| 256 | | virtual osd_font font_open(const char *name, int &height); |
| 257 | | virtual void font_close(osd_font font); |
| 258 | | virtual bool font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs); |
| 256 | virtual osd_font *font_open(const char *name, int &height); |
| 257 | virtual void font_close(osd_font *font); |
| 258 | virtual bool font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs); |
| 259 | 259 | |
| 260 | 260 | virtual void video_register(); |
| 261 | 261 | virtual void sound_register(); |