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

Function PrintGlyph

source/Debugger/Debugger_Display.cpp:704–749  ·  view source on GitHub ↗

@param glyph Specifies a native glyph from the 16x16 chars Apple Font Texture. ===========================================================================

Source from the content-addressed store, hash-verified

702// @param glyph Specifies a native glyph from the 16x16 chars Apple Font Texture.
703//===========================================================================
704static void PrintGlyph( const int xDst, const int yDst, const int glyph )
705{
706 HDC hDstDC = GetDebuggerMemDC();
707
708 int xSrc = (glyph % CONSOLE_FONT_NUM_CHARS_PER_ROW) * CONSOLE_FONT_GRID_X;
709 int ySrc = (glyph / CONSOLE_FONT_NUM_CHARS_PER_ROW) * CONSOLE_FONT_GRID_Y;
710 _ASSERT(ySrc < CONSOLE_FONT_BITMAP_HEIGHT);
711
712 // BUG #239 - (Debugger) Save debugger "text screen" to clipboard / file
713 // if ( g_bDebuggerVirtualTextCapture )
714 //
715 {
716#if _DEBUG
717 if ((xDst < 0) || (yDst < 0))
718 GetFrame().FrameMessageBox("X or Y out of bounds!", "PrintGlyph()", MB_OK );
719#endif
720 int col = xDst / CONSOLE_FONT_WIDTH ;
721 int row = yDst / CONSOLE_FONT_HEIGHT;
722
723 // if ( !g_bDebuggerCopyInfoPane )
724 // if ( col < 50
725 if (xDst > DISPLAY_DISASM_RIGHT) // INFO_COL_2 // DISPLAY_CPU_INFO_LEFT_COLUMN
726 col++;
727
728 if ((col < DEBUG_VIRTUAL_TEXT_WIDTH)
729 && (row < DEBUG_VIRTUAL_TEXT_HEIGHT))
730 g_aDebuggerVirtualTextScreen[ row ][ col ] = glyph;
731 }
732
733 // Manual print of character. A lot faster than BitBlt, which must be avoided.
734 int index_src = (CONSOLE_FONT_BITMAP_HEIGHT - 1 - ySrc) * CONSOLE_FONT_NUM_CHARS_PER_ROW * CONSOLE_FONT_GRID_X + xSrc; // font bitmap
735 int index_dst = (DISPLAY_HEIGHT - 1 - yDst) * DEBUG_VIRTUAL_TEXT_WIDTH * CONSOLE_FONT_GRID_X + xDst; // debugger bitmap
736
737 for (int yy = 0; yy < CONSOLE_FONT_GRID_Y; yy++)
738 {
739 for (int xx = 0; xx < CONSOLE_FONT_GRID_X; xx++)
740 {
741 char fontpx = g_hConsoleFontFramebits[index_src + xx].g; // Should be same for R/G/B anyway (greyscale)
742 g_pDebuggerMemFramebits[index_dst + xx].r = (g_cConsoleBrushBG_r & ~fontpx) | (g_cConsoleBrushFG_r & fontpx);
743 g_pDebuggerMemFramebits[index_dst + xx].g = (g_cConsoleBrushBG_g & ~fontpx) | (g_cConsoleBrushFG_g & fontpx);
744 g_pDebuggerMemFramebits[index_dst + xx].b = (g_cConsoleBrushBG_b & ~fontpx) | (g_cConsoleBrushFG_b & fontpx);
745 }
746 index_src -= CONSOLE_FONT_NUM_CHARS_PER_ROW * CONSOLE_FONT_GRID_X;
747 index_dst -= DEBUG_VIRTUAL_TEXT_WIDTH * CONSOLE_FONT_GRID_X;
748 }
749}
750
751
752//===========================================================================

Callers 5

DebuggerPrintFunction · 0.85
DebuggerPrintColorFunction · 0.85
DrawDisassemblyLineFunction · 0.85
DrawMemoryFunction · 0.85

Calls 2

GetDebuggerMemDCFunction · 0.85
FrameMessageBoxMethod · 0.80

Tested by

no test coverage detected