MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / GetConsoleFontDC

Function GetConsoleFontDC

source/Debugger/Debugger_Display.cpp:562–607  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

560
561
562HDC GetConsoleFontDC(void)
563{
564 if (!g_hConsoleFontDC)
565 {
566 Win32Frame& win32Frame = Win32Frame::GetWin32Frame();
567 HDC hFrameDC = win32Frame.FrameGetDC();
568 g_hConsoleFontDC = CreateCompatibleDC(hFrameDC);
569
570 // CREATE A BITMAPINFO STRUCTURE FOR THE FRAME BUFFER
571 g_hConsoleFontFramebufferinfo = (LPBITMAPINFO) new BYTE[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)];
572
573 memset(g_hConsoleFontFramebufferinfo, 0, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
574 g_hConsoleFontFramebufferinfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
575 g_hConsoleFontFramebufferinfo->bmiHeader.biWidth = CONSOLE_FONT_BITMAP_WIDTH;
576 g_hConsoleFontFramebufferinfo->bmiHeader.biHeight = CONSOLE_FONT_BITMAP_HEIGHT;
577 g_hConsoleFontFramebufferinfo->bmiHeader.biPlanes = 1;
578 g_hConsoleFontFramebufferinfo->bmiHeader.biBitCount = 32;
579 g_hConsoleFontFramebufferinfo->bmiHeader.biCompression = BI_RGB;
580 g_hConsoleFontFramebufferinfo->bmiHeader.biClrUsed = 0;
581
582
583 // CREATE THE FRAME BUFFER DIB SECTION
584 g_hConsoleFontBitmap = CreateDIBSection(
585 hFrameDC,
586 g_hConsoleFontFramebufferinfo,
587 DIB_RGB_COLORS,
588 (LPVOID*)&g_hConsoleFontFramebits, 0, 0
589 );
590 SelectObject(g_hConsoleFontDC, g_hConsoleFontBitmap);
591
592 // DRAW THE SOURCE IMAGE INTO THE SOURCE BIT BUFFER
593 HDC tmpDC = CreateCompatibleDC(hFrameDC);
594 // Pre-scaled bitmap
595 HBITMAP tmpFont = LoadBitmap(win32Frame.g_hInstance, MAKEINTRESOURCE(IDB_DEBUG_FONT_7_by_8)); // Bitmap must be 112x128 as defined above
596 SelectObject(tmpDC, tmpFont);
597 BitBlt(g_hConsoleFontDC, 0, 0, CONSOLE_FONT_BITMAP_WIDTH, CONSOLE_FONT_BITMAP_HEIGHT,
598 tmpDC, 0, 0,
599 SRCCOPY);
600 DeleteDC(tmpDC);
601 DeleteObject(tmpFont);
602
603 }
604
605 _ASSERT(g_hConsoleFontDC);
606 return g_hConsoleFontDC;
607}
608
609void ReleaseConsoleFontDC(void)
610{

Callers 1

DebugInitializeFunction · 0.85

Calls 1

FrameGetDCMethod · 0.80

Tested by

no test coverage detected