From 92b3dd111fff846e8dfdf115fa0d07890ce5870b Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Mon, 8 Nov 2010 09:08:55 +0000 Subject: Cleanup & version bump. --- src/osd/windows/winmain.c | 28 ++++++++++++++-------------- src/osd/windows/winmain.h | 12 ++++++------ 2 files changed, 20 insertions(+), 20 deletions(-) (limited to 'src/osd/windows') diff --git a/src/osd/windows/winmain.c b/src/osd/windows/winmain.c index 440243b8895..d0adc0344ab 100644 --- a/src/osd/windows/winmain.c +++ b/src/osd/windows/winmain.c @@ -693,13 +693,13 @@ osd_font windows_osd_interface::font_open(const char *_name, int &height) _tcsncpy(logfont.lfFaceName, face, sizeof(logfont.lfFaceName) / sizeof(TCHAR)); logfont.lfFaceName[sizeof(logfont.lfFaceName) / sizeof(TCHAR) - 1] = 0; osd_free(face); - + // create the font height = logfont.lfHeight; osd_font font = reinterpret_cast(CreateFontIndirect(&logfont)); if (font == NULL) return NULL; - + // select it into a temp DC and get the real font name HDC dummyDC = CreateCompatibleDC(NULL); HGDIOBJ oldfont = SelectObject(dummyDC, reinterpret_cast(font)); @@ -707,13 +707,13 @@ osd_font windows_osd_interface::font_open(const char *_name, int &height) GetTextFace(dummyDC, ARRAY_LENGTH(realname), realname); SelectObject(dummyDC, oldfont); DeleteDC(dummyDC); - + // if it doesn't match our request, fail char *utf = utf8_from_tstring(realname); int result = mame_stricmp(utf, name); osd_free(utf); - // if we didn't match, nuke our font and fall back + // if we didn't match, nuke our font and fall back if (result != 0) { DeleteObject(reinterpret_cast(font)); @@ -739,7 +739,7 @@ void windows_osd_interface::font_close(osd_font font) //------------------------------------------------- // font_get_bitmap - allocate and populate a // BITMAP_FORMAT_ARGB32 bitmap containing the -// pixel values MAKE_ARGB(0xff,0xff,0xff,0xff) +// pixel values MAKE_ARGB(0xff,0xff,0xff,0xff) // or MAKE_ARGB(0x00,0xff,0xff,0xff) for each // pixel of a black & white font //------------------------------------------------- @@ -749,7 +749,7 @@ bitmap_t *windows_osd_interface::font_get_bitmap(osd_font font, unicode_char chn // create a dummy DC to work with HDC dummyDC = CreateCompatibleDC(NULL); HGDIOBJ oldfont = SelectObject(dummyDC, reinterpret_cast(font)); - + // get the text metrics TEXTMETRIC metrics = { 0 }; GetTextMetrics(dummyDC, &metrics); @@ -763,11 +763,11 @@ bitmap_t *windows_osd_interface::font_get_bitmap(osd_font font, unicode_char chn GetCharWidth32(dummyDC, chnum, chnum, reinterpret_cast(&abc.abcB)); } width = abc.abcA + abc.abcB + abc.abcC; - + // determine desired bitmap size int bmwidth = (50 + abc.abcA + abc.abcB + abc.abcC + 50 + 31) & ~31; int bmheight = 50 + metrics.tmHeight + 50; - + // describe the bitmap we want BYTE bitmapinfodata[sizeof(BITMAPINFOHEADER) + 2 * sizeof(RGBQUAD)] = { 0 }; BITMAPINFO &info = *reinterpret_cast(bitmapinfodata); @@ -784,7 +784,7 @@ bitmap_t *windows_osd_interface::font_get_bitmap(osd_font font, unicode_char chn info.bmiHeader.biClrImportant = 0; info.bmiColors[0].rgbBlue = info.bmiColors[0].rgbGreen = info.bmiColors[0].rgbRed = 0x00; info.bmiColors[1].rgbBlue = info.bmiColors[1].rgbGreen = info.bmiColors[1].rgbRed = 0xff; - + // create a DIB to render to BYTE *bits; HBITMAP dib = CreateDIBSection(dummyDC, &info, DIB_RGB_COLORS, reinterpret_cast(&bits), NULL, 0); @@ -793,7 +793,7 @@ bitmap_t *windows_osd_interface::font_get_bitmap(osd_font font, unicode_char chn // clear the bitmap int rowbytes = bmwidth / 8; memset(bits, 0, rowbytes * bmheight); - + // now draw the character WCHAR tempchar = chnum; SetTextColor(dummyDC, RGB(0xff,0xff,0xff)); @@ -804,7 +804,7 @@ bitmap_t *windows_osd_interface::font_get_bitmap(osd_font font, unicode_char chn rectangle actbounds; actbounds.min_y = 50; actbounds.max_y = 50 + metrics.tmHeight - 1; - + // determine the actual left of the character for (actbounds.min_x = 0; actbounds.min_x < rowbytes; actbounds.min_x++) { @@ -825,7 +825,7 @@ bitmap_t *windows_osd_interface::font_get_bitmap(osd_font font, unicode_char chn break; } } - + // determine the actual right of the character for (actbounds.max_x = rowbytes - 1; actbounds.max_x >= 0; actbounds.max_x--) { @@ -846,7 +846,7 @@ bitmap_t *windows_osd_interface::font_get_bitmap(osd_font font, unicode_char chn break; } } - + // allocate a new bitmap bitmap_t *bitmap = NULL; if (actbounds.max_x >= actbounds.min_x && actbounds.max_y >= actbounds.min_y) @@ -864,7 +864,7 @@ bitmap_t *windows_osd_interface::font_get_bitmap(osd_font font, unicode_char chn dstrow[x] = ((srcrow[effx / 8] << (effx % 8)) & 0x80) ? MAKE_ARGB(0xff,0xff,0xff,0xff) : MAKE_ARGB(0x00,0xff,0xff,0xff); } } - + // set the final offset values xoffs = actbounds.min_x - (50 + abc.abcA); yoffs = actbounds.max_y - (50 + metrics.tmAscent); diff --git a/src/osd/windows/winmain.h b/src/osd/windows/winmain.h index c3b3eb4b975..a3695c99ba0 100644 --- a/src/osd/windows/winmain.h +++ b/src/osd/windows/winmain.h @@ -140,30 +140,30 @@ public: // construction/destruction windows_osd_interface(); virtual ~windows_osd_interface(); - + // general overridables virtual void init(running_machine &machine); virtual void update(bool skip_redraw); // debugger overridables -// virtual void init_debugger(); +// virtual void init_debugger(); virtual void wait_for_debugger(device_t &device, bool firststop); - + // audio overridables virtual void update_audio_stream(const INT16 *buffer, int samples_this_frame); virtual void set_mastervolume(int attenuation); // input overridables virtual void customize_input_type_list(input_type_desc *typelist); - + // font overridables virtual osd_font font_open(const char *name, int &height); virtual void font_close(osd_font font); virtual bitmap_t *font_get_bitmap(osd_font font, unicode_char chnum, INT32 &width, INT32 &xoffs, INT32 &yoffs); - + private: static void osd_exit(running_machine &machine); - + static const int DEFAULT_FONT_HEIGHT = 200; }; -- cgit v1.2.3