mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-12-22 09:30:15 +00:00
Improved debugger video performance (#800)
Removed very slow BitBlt() GDI calls in PrintGlyph() - now 18x faster in Release config! . Replaced GDI call FillRect() with new FillBackground() . Added missing bitmap declarations in GetDebuggerMemDC() Fixed AdditionalIncludeDirectories for Debugger source files
This commit is contained in:
parent
e5ccf26d4f
commit
af9568cbbf
@ -372,7 +372,7 @@
|
|||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;NO_DSHOW_STRSAFE;YAML_DECLARE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;NO_DSHOW_STRSAFE;YAML_DECLARE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>source\cpu;source\emulator;source\debugger;zlib;zip_lib;libyaml\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>source;source\cpu;source\debugger;zlib;zip_lib;libyaml\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||||
@ -399,7 +399,7 @@
|
|||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;NO_DSHOW_STRSAFE;NO_DIRECT_X;YAML_DECLARE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;NO_DSHOW_STRSAFE;NO_DIRECT_X;YAML_DECLARE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>source\cpu;source\emulator;source\debugger;zlib;zip_lib;libyaml\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>source;source\cpu;source\debugger;zlib;zip_lib;libyaml\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@ -427,7 +427,7 @@
|
|||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;NO_DSHOW_STRSAFE;YAML_DECLARE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;NO_DSHOW_STRSAFE;YAML_DECLARE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>source\cpu;source\emulator;source\debugger;zlib;zip_lib;libyaml\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>source;source\cpu;source\debugger;zlib;zip_lib;libyaml\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||||
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||||
@ -459,7 +459,7 @@
|
|||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;NO_DSHOW_STRSAFE;NO_DIRECT_X;YAML_DECLARE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;NO_DSHOW_STRSAFE;NO_DIRECT_X;YAML_DECLARE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>source\cpu;source\emulator;source\debugger;zlib;zip_lib;libyaml\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>source;source\cpu;source\debugger;zlib;zip_lib;libyaml\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||||
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
@ -8890,67 +8890,13 @@ void DebugInitialize ()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Must select a bitmap into the temp DC !
|
// Must select a bitmap into the temp DC !
|
||||||
HDC hTmpDC = CreateCompatibleDC( FrameGetDC() );
|
// HDC hTmpDC = CreateCompatibleDC( FrameGetDC() );
|
||||||
|
|
||||||
#if _DEBUG
|
#if _DEBUG
|
||||||
nError = GetLastError();
|
nError = GetLastError();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_hConsoleFontDC = CreateCompatibleDC( FrameGetDC() );
|
GetConsoleFontDC(); // Load font
|
||||||
#if _DEBUG
|
|
||||||
nError = GetLastError();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if APPLE_FONT_NEW
|
|
||||||
// Pre-scaled bitmap
|
|
||||||
g_hConsoleFontBitmap = LoadBitmap(g_hInstance,TEXT("IDB_DEBUG_FONT_7x8"));
|
|
||||||
SelectObject( g_hConsoleFontDC, g_hConsoleFontBitmap );
|
|
||||||
#else
|
|
||||||
// Scale at run-time
|
|
||||||
|
|
||||||
// Black = Transparent
|
|
||||||
// White = Opaque
|
|
||||||
HBITMAP hTmpBitamp = LoadBitmap(g_hInstance,TEXT("CHARSET40"));
|
|
||||||
#if _DEBUG
|
|
||||||
nError = GetLastError();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SelectObject( hTmpDC ,hTmpBitamp);
|
|
||||||
#if _DEBUG
|
|
||||||
nError = GetLastError();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_hConsoleFontBrush = GetStockBrush( WHITE_BRUSH );
|
|
||||||
SelectObject(g_hConsoleFontDC, g_hConsoleFontBrush );
|
|
||||||
|
|
||||||
// SelectObject(hTmpDC, g_hDebugFontBrush );
|
|
||||||
|
|
||||||
#if _DEBUG
|
|
||||||
nError = GetLastError();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_hConsoleFontBitmap = CreateCompatibleBitmap(
|
|
||||||
hTmpDC,
|
|
||||||
APPLE_FONT_X_REGIONSIZE/2, APPLE_FONT_Y_REGIONSIZE/2
|
|
||||||
);
|
|
||||||
#if _DEBUG
|
|
||||||
nError = GetLastError();
|
|
||||||
#endif
|
|
||||||
SelectObject( g_hConsoleFontDC, g_hConsoleFontBitmap );
|
|
||||||
|
|
||||||
StretchBlt(
|
|
||||||
g_hConsoleFontDC, // HDC hdcDest, // handle to destination DC
|
|
||||||
0, 0, // int nXOriginDest, int nYOriginDest, // y-coord of destination upper-left corner
|
|
||||||
APPLE_FONT_X_REGIONSIZE/2, APPLE_FONT_Y_REGIONSIZE/2, // int nWidthDest, int nHeightDest,
|
|
||||||
hTmpDC, // HDC hdcSrc, // handle to source DC
|
|
||||||
0, APPLE_FONT_Y_APPLE_80COL, // int nXOriginSrc, int nYOriginSrc,
|
|
||||||
APPLE_FONT_X_REGIONSIZE, APPLE_FONT_Y_REGIONSIZE, // int nWidthSrc, int nHeightSrc,
|
|
||||||
SRCCOPY // DWORD dwRop // raster operation code
|
|
||||||
);
|
|
||||||
|
|
||||||
DeleteObject( hTmpBitamp );
|
|
||||||
DeleteObject( hTmpDC );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ZeroMemory( g_aConsoleDisplay, sizeof( g_aConsoleDisplay ) ); // CONSOLE_WIDTH * CONSOLE_HEIGHT );
|
ZeroMemory( g_aConsoleDisplay, sizeof( g_aConsoleDisplay ) ); // CONSOLE_WIDTH * CONSOLE_HEIGHT );
|
||||||
ConsoleInputReset();
|
ConsoleInputReset();
|
||||||
|
@ -4,7 +4,8 @@ AppleWin : An Apple //e emulator for Windows
|
|||||||
Copyright (C) 1994-1996, Michael O'Brien
|
Copyright (C) 1994-1996, Michael O'Brien
|
||||||
Copyright (C) 1999-2001, Oliver Schmidt
|
Copyright (C) 1999-2001, Oliver Schmidt
|
||||||
Copyright (C) 2002-2005, Tom Charlesworth
|
Copyright (C) 2002-2005, Tom Charlesworth
|
||||||
Copyright (C) 2006-2014, Tom Charlesworth, Michael Pohoreski
|
Copyright (C) 2006-2019, Tom Charlesworth, Michael Pohoreski
|
||||||
|
Copyright (C) 2020, Tom Charlesworth, Michael Pohoreski, Cyril Lambin
|
||||||
|
|
||||||
AppleWin is free software; you can redistribute it and/or modify
|
AppleWin is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -23,7 +24,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
|
|
||||||
/* Description: Debugger
|
/* Description: Debugger
|
||||||
*
|
*
|
||||||
* Author: Copyright (C) 2006-2010 Michael Pohoreski
|
* Author: Copyright (C) 2006-2020 Michael Pohoreski, (C) 2020 Cyril Lambin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "StdAfx.h"
|
#include "StdAfx.h"
|
||||||
@ -79,10 +80,21 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
// Display - Win32
|
// Display - Win32
|
||||||
static HDC g_hDebuggerMemDC = NULL;
|
static HDC g_hDebuggerMemDC = NULL;
|
||||||
static HBITMAP g_hDebuggerMemBM = NULL;
|
static HBITMAP g_hDebuggerMemBM = NULL;
|
||||||
|
static LPBITMAPINFO g_pDebuggerMemFramebufferinfo = NULL;
|
||||||
|
static bgra_t* g_pDebuggerMemFramebits = NULL;
|
||||||
|
|
||||||
HDC g_hConsoleFontDC = NULL;
|
HDC g_hConsoleFontDC = NULL;
|
||||||
HBRUSH g_hConsoleFontBrush = NULL;
|
HBRUSH g_hConsoleFontBrush = NULL;
|
||||||
HBITMAP g_hConsoleFontBitmap = NULL;
|
HBITMAP g_hConsoleFontBitmap = NULL;
|
||||||
|
LPBITMAPINFO g_hConsoleFontFramebufferinfo;
|
||||||
|
bgra_t* g_hConsoleFontFramebits;
|
||||||
|
|
||||||
|
char g_cConsoleBrushFG_r;
|
||||||
|
char g_cConsoleBrushFG_g;
|
||||||
|
char g_cConsoleBrushFG_b;
|
||||||
|
char g_cConsoleBrushBG_r;
|
||||||
|
char g_cConsoleBrushBG_g;
|
||||||
|
char g_cConsoleBrushBG_b;
|
||||||
|
|
||||||
HBRUSH g_hConsoleBrushFG = NULL;
|
HBRUSH g_hConsoleBrushFG = NULL;
|
||||||
HBRUSH g_hConsoleBrushBG = NULL;
|
HBRUSH g_hConsoleBrushBG = NULL;
|
||||||
@ -164,7 +176,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
const int DISPLAY_MINIMEM_COLUMN = INFO_COL_3;
|
const int DISPLAY_MINIMEM_COLUMN = INFO_COL_3;
|
||||||
const int DISPLAY_VIDEO_SCANNER_COLUMN = INFO_COL_3;
|
const int DISPLAY_VIDEO_SCANNER_COLUMN = INFO_COL_3;
|
||||||
#else
|
#else
|
||||||
const int DISPLAY_CPU_INFO_LEFT_COLUMN = SCREENSPLIT1 // TC: SCREENSPLIT1 is not defined anywhere in the .sln!
|
const int DISPLAY_CPU_INFO_LEFT_COLUMN = SCREENSPLIT1; // TC: SCREENSPLIT1 is not defined anywhere in the .sln!
|
||||||
|
|
||||||
const int DISPLAY_REGS_COLUMN = DISPLAY_CPU_INFO_LEFT_COLUMN;
|
const int DISPLAY_REGS_COLUMN = DISPLAY_CPU_INFO_LEFT_COLUMN;
|
||||||
const int DISPLAY_FLAG_COLUMN = DISPLAY_CPU_INFO_LEFT_COLUMN;
|
const int DISPLAY_FLAG_COLUMN = DISPLAY_CPU_INFO_LEFT_COLUMN;
|
||||||
@ -214,6 +226,7 @@ static char ColorizeSpecialChar( char * sText, BYTE nData, const MemoryView_e iV
|
|||||||
void DrawSubWindow_Symbols (Update_t bUpdate);
|
void DrawSubWindow_Symbols (Update_t bUpdate);
|
||||||
void DrawSubWindow_ZeroPage (Update_t bUpdate);
|
void DrawSubWindow_ZeroPage (Update_t bUpdate);
|
||||||
|
|
||||||
|
|
||||||
void DrawWindowBottom ( Update_t bUpdate, int iWindow );
|
void DrawWindowBottom ( Update_t bUpdate, int iWindow );
|
||||||
|
|
||||||
char* FormatCharCopy( char *pDst, const char *pSrc, const int nLen );
|
char* FormatCharCopy( char *pDst, const char *pSrc, const int nLen );
|
||||||
@ -541,7 +554,31 @@ HDC GetDebuggerMemDC(void)
|
|||||||
{
|
{
|
||||||
HDC hFrameDC = FrameGetDC();
|
HDC hFrameDC = FrameGetDC();
|
||||||
g_hDebuggerMemDC = CreateCompatibleDC(hFrameDC);
|
g_hDebuggerMemDC = CreateCompatibleDC(hFrameDC);
|
||||||
g_hDebuggerMemBM = CreateCompatibleBitmap(hFrameDC, GetFrameBufferWidth(), GetFrameBufferHeight());
|
|
||||||
|
// CREATE A BITMAPINFO STRUCTURE FOR THE FRAME BUFFER
|
||||||
|
g_pDebuggerMemFramebufferinfo = (LPBITMAPINFO)VirtualAlloc(
|
||||||
|
NULL,
|
||||||
|
sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD),
|
||||||
|
MEM_COMMIT,
|
||||||
|
PAGE_READWRITE);
|
||||||
|
|
||||||
|
ZeroMemory(g_pDebuggerMemFramebufferinfo, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
|
||||||
|
g_pDebuggerMemFramebufferinfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||||
|
g_pDebuggerMemFramebufferinfo->bmiHeader.biWidth = 560;
|
||||||
|
g_pDebuggerMemFramebufferinfo->bmiHeader.biHeight = 384;
|
||||||
|
g_pDebuggerMemFramebufferinfo->bmiHeader.biPlanes = 1;
|
||||||
|
g_pDebuggerMemFramebufferinfo->bmiHeader.biBitCount = 32;
|
||||||
|
g_pDebuggerMemFramebufferinfo->bmiHeader.biCompression = BI_RGB;
|
||||||
|
g_pDebuggerMemFramebufferinfo->bmiHeader.biClrUsed = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// CREATE THE FRAME BUFFER DIB SECTION
|
||||||
|
g_hDebuggerMemBM = CreateDIBSection(
|
||||||
|
hFrameDC,
|
||||||
|
g_pDebuggerMemFramebufferinfo,
|
||||||
|
DIB_RGB_COLORS,
|
||||||
|
(LPVOID*)&g_pDebuggerMemFramebits, 0, 0
|
||||||
|
);
|
||||||
SelectObject(g_hDebuggerMemDC, g_hDebuggerMemBM);
|
SelectObject(g_hDebuggerMemDC, g_hDebuggerMemBM);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -558,9 +595,63 @@ void ReleaseDebuggerMemDC(void)
|
|||||||
DeleteDC(g_hDebuggerMemDC);
|
DeleteDC(g_hDebuggerMemDC);
|
||||||
g_hDebuggerMemDC = NULL;
|
g_hDebuggerMemDC = NULL;
|
||||||
FrameReleaseDC();
|
FrameReleaseDC();
|
||||||
|
DeleteObject(g_pDebuggerMemFramebufferinfo);
|
||||||
|
g_pDebuggerMemFramebits = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HDC GetConsoleFontDC(void)
|
||||||
|
{
|
||||||
|
if (!g_hConsoleFontDC)
|
||||||
|
{
|
||||||
|
HDC hFrameDC = FrameGetDC();
|
||||||
|
g_hConsoleFontDC = CreateCompatibleDC(hFrameDC);
|
||||||
|
|
||||||
|
// CREATE A BITMAPINFO STRUCTURE FOR THE FRAME BUFFER
|
||||||
|
g_hConsoleFontFramebufferinfo = (LPBITMAPINFO)VirtualAlloc(
|
||||||
|
NULL,
|
||||||
|
sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD),
|
||||||
|
MEM_COMMIT,
|
||||||
|
PAGE_READWRITE);
|
||||||
|
|
||||||
|
ZeroMemory(g_hConsoleFontFramebufferinfo, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
|
||||||
|
g_hConsoleFontFramebufferinfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||||
|
g_hConsoleFontFramebufferinfo->bmiHeader.biWidth = 112;
|
||||||
|
g_hConsoleFontFramebufferinfo->bmiHeader.biHeight = 128;
|
||||||
|
g_hConsoleFontFramebufferinfo->bmiHeader.biPlanes = 1;
|
||||||
|
g_hConsoleFontFramebufferinfo->bmiHeader.biBitCount = 32;
|
||||||
|
g_hConsoleFontFramebufferinfo->bmiHeader.biCompression = BI_RGB;
|
||||||
|
g_hConsoleFontFramebufferinfo->bmiHeader.biClrUsed = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// CREATE THE FRAME BUFFER DIB SECTION
|
||||||
|
g_hConsoleFontBitmap = CreateDIBSection(
|
||||||
|
hFrameDC,
|
||||||
|
g_hConsoleFontFramebufferinfo,
|
||||||
|
DIB_RGB_COLORS,
|
||||||
|
(LPVOID*)&g_hConsoleFontFramebits, 0, 0
|
||||||
|
);
|
||||||
|
SelectObject(g_hConsoleFontDC, g_hConsoleFontBitmap);
|
||||||
|
|
||||||
|
// DRAW THE SOURCE IMAGE INTO THE SOURCE BIT BUFFER
|
||||||
|
HDC tmpDC = CreateCompatibleDC(hFrameDC);
|
||||||
|
// Pre-scaled bitmap
|
||||||
|
HBITMAP tmpFont = LoadBitmap(g_hInstance, TEXT("IDB_DEBUG_FONT_7x8")); // Bitmap must be 112x128 as defined above
|
||||||
|
SelectObject(tmpDC, tmpFont);
|
||||||
|
BitBlt(g_hConsoleFontDC, 0, 0, 112, 128,
|
||||||
|
tmpDC, 0, 0,
|
||||||
|
SRCCOPY);
|
||||||
|
DeleteDC(tmpDC);
|
||||||
|
DeleteObject(tmpFont);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
_ASSERT(g_hConsoleFontDC);
|
||||||
|
return g_hConsoleFontDC;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void StretchBltMemToFrameDC(void)
|
void StretchBltMemToFrameDC(void)
|
||||||
{
|
{
|
||||||
int nViewportCX, nViewportCY;
|
int nViewportCX, nViewportCY;
|
||||||
@ -594,7 +685,12 @@ void DebuggerSetColorFG( COLORREF nRGB )
|
|||||||
g_hConsoleBrushFG = NULL;
|
g_hConsoleBrushFG = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_hConsoleBrushFG = CreateSolidBrush( nRGB );
|
g_hConsoleBrushFG = CreateSolidBrush(nRGB);
|
||||||
|
|
||||||
|
g_cConsoleBrushFG_r = nRGB & 0xFF;
|
||||||
|
g_cConsoleBrushFG_g = (nRGB>>8) & 0xFF;
|
||||||
|
g_cConsoleBrushFG_b = (nRGB>>16) & 0xFF;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
SetTextColor( GetDebuggerMemDC(), nRGB );
|
SetTextColor( GetDebuggerMemDC(), nRGB );
|
||||||
#endif
|
#endif
|
||||||
@ -615,6 +711,12 @@ void DebuggerSetColorBG( COLORREF nRGB, bool bTransparent )
|
|||||||
{
|
{
|
||||||
g_hConsoleBrushBG = CreateSolidBrush( nRGB );
|
g_hConsoleBrushBG = CreateSolidBrush( nRGB );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Transparency seems to be never used...
|
||||||
|
g_cConsoleBrushBG_r = nRGB & 0xFF;
|
||||||
|
g_cConsoleBrushBG_g = (nRGB >> 8) & 0xFF;
|
||||||
|
g_cConsoleBrushBG_b = (nRGB >> 16) & 0xFF;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
SetBkColor( GetDebuggerMemDC(), nRGB );
|
SetBkColor( GetDebuggerMemDC(), nRGB );
|
||||||
#endif
|
#endif
|
||||||
@ -630,8 +732,8 @@ void PrintGlyph( const int x, const int y, const int glyph )
|
|||||||
int yDst = y;
|
int yDst = y;
|
||||||
|
|
||||||
// 16x8 chars in bitmap
|
// 16x8 chars in bitmap
|
||||||
int xSrc = (glyph & 0x0F) * CONSOLE_FONT_GRID_X;
|
int xSrc = (glyph & 0x0F) *CONSOLE_FONT_GRID_X;
|
||||||
int ySrc = (glyph >> 4) * CONSOLE_FONT_GRID_Y;
|
int ySrc = (glyph >> 4) *CONSOLE_FONT_GRID_Y;
|
||||||
|
|
||||||
// BUG #239 - (Debugger) Save debugger "text screen" to clipboard / file
|
// BUG #239 - (Debugger) Save debugger "text screen" to clipboard / file
|
||||||
// if( g_bDebuggerVirtualTextCapture )
|
// if( g_bDebuggerVirtualTextCapture )
|
||||||
@ -654,74 +756,21 @@ void PrintGlyph( const int x, const int y, const int glyph )
|
|||||||
g_aDebuggerVirtualTextScreen[ row ][ col ] = glyph;
|
g_aDebuggerVirtualTextScreen[ row ][ col ] = glyph;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !DEBUG_FONT_NO_BACKGROUND_CHAR
|
// Manual print of character. A lot faster than BitBlt, which must be avoided.
|
||||||
// Background color
|
int index_src = (127-ySrc) * 16 * CONSOLE_FONT_GRID_X + xSrc; // font bitmap
|
||||||
if (g_hConsoleBrushBG)
|
int index_dst = (383-yDst) * 80 * CONSOLE_FONT_GRID_X + xDst; // debugger bitmap
|
||||||
|
for (int yy = 0; yy < CONSOLE_FONT_GRID_Y; yy++)
|
||||||
{
|
{
|
||||||
SelectObject( hDstDC, g_hConsoleBrushBG );
|
for (int xx = 0; xx < CONSOLE_FONT_GRID_X; xx++)
|
||||||
|
{
|
||||||
// Draw Background (solid pattern)
|
char fontpx = g_hConsoleFontFramebits[index_src + xx].g; // Should be same for R/G/B anyway (greyscale)
|
||||||
BitBlt(
|
g_pDebuggerMemFramebits[index_dst + xx].r = (g_cConsoleBrushBG_r & ~fontpx) | (g_cConsoleBrushFG_r & fontpx);
|
||||||
hDstDC, // hdcDest
|
g_pDebuggerMemFramebits[index_dst + xx].g = (g_cConsoleBrushBG_g & ~fontpx) | (g_cConsoleBrushFG_g & fontpx);
|
||||||
xDst, yDst, // nXDest, nYDest
|
g_pDebuggerMemFramebits[index_dst + xx].b = (g_cConsoleBrushBG_b & ~fontpx) | (g_cConsoleBrushFG_b & fontpx);
|
||||||
CONSOLE_FONT_WIDTH, CONSOLE_FONT_HEIGHT, // nWidth, nHeight
|
}
|
||||||
g_hConsoleFontDC, // hdcSrc
|
index_src -= 16 * CONSOLE_FONT_GRID_X;
|
||||||
0, CONSOLE_FONT_GRID_Y * 2, // nXSrc, nYSrc // FontTexture[2][0] = Solid (Filled) Space
|
index_dst -= 80 * CONSOLE_FONT_GRID_X;
|
||||||
PATCOPY // dwRop
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// SelectObject( hDstDC, GetStockBrush( WHITE_BRUSH ) );
|
|
||||||
|
|
||||||
// http://kkow.net/etep/docs/rop.html
|
|
||||||
// P 1 1 1 1 0 0 0 0 (Pen/Pattern)
|
|
||||||
// S 1 1 0 0 1 1 0 0 (Source)
|
|
||||||
// D 1 0 1 0 1 0 1 0 (Destination)
|
|
||||||
// =================
|
|
||||||
// 0 0 1 0 0 0 1 0 0x22 DSna
|
|
||||||
// 1 1 1 0 1 0 1 0 0xEA DPSao
|
|
||||||
|
|
||||||
// Black = Transparent (DC Background)
|
|
||||||
// White = Opaque (DC Text color)
|
|
||||||
|
|
||||||
#if DEBUG_FONT_ROP
|
|
||||||
SelectObject( hDstDC, g_hConsoleBrushFG );
|
|
||||||
BitBlt(
|
|
||||||
hDstDC,
|
|
||||||
xDst, yDst,
|
|
||||||
DEBUG_FONT_WIDTH, DEBUG_FONT_HEIGHT,
|
|
||||||
g_hDebugFontDC,
|
|
||||||
xSrc, ySrc,
|
|
||||||
aROP4[ iRop4 ]
|
|
||||||
);
|
|
||||||
#else
|
|
||||||
// Use inverted source as mask (AND)
|
|
||||||
// D & ~S -> DSna
|
|
||||||
BitBlt(
|
|
||||||
hDstDC,
|
|
||||||
xDst, yDst,
|
|
||||||
CONSOLE_FONT_WIDTH, CONSOLE_FONT_HEIGHT,
|
|
||||||
g_hConsoleFontDC,
|
|
||||||
xSrc, ySrc,
|
|
||||||
DSna
|
|
||||||
);
|
|
||||||
|
|
||||||
SelectObject( hDstDC, g_hConsoleBrushFG );
|
|
||||||
|
|
||||||
// Use Source as mask to make color Pattern mask (AND), then apply to dest (OR)
|
|
||||||
// D | (P & S) -> DPSao
|
|
||||||
BitBlt(
|
|
||||||
hDstDC,
|
|
||||||
xDst, yDst,
|
|
||||||
CONSOLE_FONT_WIDTH, CONSOLE_FONT_HEIGHT,
|
|
||||||
g_hConsoleFontDC,
|
|
||||||
xSrc, ySrc,
|
|
||||||
DPSao
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SelectObject( hDstDC, GetStockObject(NULL_BRUSH) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -814,7 +863,7 @@ int PrintText ( const char * pText, RECT & rRect )
|
|||||||
int nLen = strlen( pText );
|
int nLen = strlen( pText );
|
||||||
|
|
||||||
#if !DEBUG_FONT_NO_BACKGROUND_TEXT
|
#if !DEBUG_FONT_NO_BACKGROUND_TEXT
|
||||||
FillRect( GetDebuggerMemDC(), &rRect, g_hConsoleBrushBG );
|
FillBackground(rRect.left, rRect.top, rRect.right, rRect.bottom);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DebuggerPrint( rRect.left, rRect.top, pText );
|
DebuggerPrint( rRect.left, rRect.top, pText );
|
||||||
@ -825,12 +874,37 @@ int PrintText ( const char * pText, RECT & rRect )
|
|||||||
void PrintTextColor ( const conchar_t *pText, RECT & rRect )
|
void PrintTextColor ( const conchar_t *pText, RECT & rRect )
|
||||||
{
|
{
|
||||||
#if !DEBUG_FONT_NO_BACKGROUND_TEXT
|
#if !DEBUG_FONT_NO_BACKGROUND_TEXT
|
||||||
FillRect( GetDebuggerMemDC(), &rRect, g_hConsoleBrushBG );
|
FillBackground(rRect.left, rRect.top, rRect.right, rRect.bottom);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DebuggerPrintColor( rRect.left, rRect.top, pText );
|
DebuggerPrintColor( rRect.left, rRect.top, pText );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
void FillBackground(long left, long top, long right, long bottom)
|
||||||
|
{
|
||||||
|
long index_dst = (384-bottom) * 80 * CONSOLE_FONT_GRID_X;
|
||||||
|
|
||||||
|
for (long x = left; x < right; x++)
|
||||||
|
{
|
||||||
|
g_pDebuggerMemFramebits[index_dst + x].r = g_cConsoleBrushBG_r;
|
||||||
|
g_pDebuggerMemFramebits[index_dst + x].g = g_cConsoleBrushBG_g;
|
||||||
|
g_pDebuggerMemFramebits[index_dst + x].b = g_cConsoleBrushBG_b;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (top != bottom)
|
||||||
|
{
|
||||||
|
bgra_t* src = g_pDebuggerMemFramebits + (index_dst + left);
|
||||||
|
bgra_t* dst = src + (80 * CONSOLE_FONT_GRID_X);
|
||||||
|
size_t size = (right - left) * sizeof(bgra_t);
|
||||||
|
for (int i = 0; i < bottom - top - 1; i++)
|
||||||
|
{
|
||||||
|
memcpy((void*)dst, (void*)src, size);
|
||||||
|
dst += 80 * CONSOLE_FONT_GRID_X ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Updates the horizontal cursor
|
// Updates the horizontal cursor
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
int PrintTextCursorX ( const char * pText, RECT & rRect )
|
int PrintTextCursorX ( const char * pText, RECT & rRect )
|
||||||
|
@ -7,19 +7,9 @@
|
|||||||
#define DEBUG_APPLE_FONT 0
|
#define DEBUG_APPLE_FONT 0
|
||||||
|
|
||||||
// Win32 Debugger Font
|
// Win32 Debugger Font
|
||||||
// 1 = Use Debugger_Font.BMP (7x8)
|
|
||||||
// 0 = Use CHARSET40.bmp (fg & bg colors aren't proper)
|
|
||||||
#define APPLE_FONT_NEW 1
|
|
||||||
|
|
||||||
#if APPLE_FONT_NEW
|
|
||||||
#define APPLE_FONT_BITMAP_PADDED 0
|
|
||||||
#else
|
|
||||||
#define APPLE_FONT_BITMAP_PADDED 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum ConsoleFontSize_e
|
enum ConsoleFontSize_e
|
||||||
{
|
{
|
||||||
#if APPLE_FONT_NEW
|
|
||||||
// Grid Alignment
|
// Grid Alignment
|
||||||
CONSOLE_FONT_GRID_X = 7,
|
CONSOLE_FONT_GRID_X = 7,
|
||||||
CONSOLE_FONT_GRID_Y = 8,
|
CONSOLE_FONT_GRID_Y = 8,
|
||||||
@ -27,14 +17,7 @@
|
|||||||
// Font Char Width/Height in pixels
|
// Font Char Width/Height in pixels
|
||||||
CONSOLE_FONT_WIDTH = 7,
|
CONSOLE_FONT_WIDTH = 7,
|
||||||
CONSOLE_FONT_HEIGHT = 8,
|
CONSOLE_FONT_HEIGHT = 8,
|
||||||
#else
|
|
||||||
CONSOLE_FONT_GRID_X = 8,
|
|
||||||
CONSOLE_FONT_GRID_Y = 8,
|
|
||||||
|
|
||||||
// Font Char Width/Height in pixels
|
|
||||||
CONSOLE_FONT_WIDTH = 7,
|
|
||||||
CONSOLE_FONT_HEIGHT = 8,
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern HBRUSH g_hConsoleBrushFG;
|
extern HBRUSH g_hConsoleBrushFG;
|
||||||
@ -57,6 +40,8 @@
|
|||||||
void DebuggerSetColorFG( COLORREF nRGB );
|
void DebuggerSetColorFG( COLORREF nRGB );
|
||||||
void DebuggerSetColorBG( COLORREF nRGB, bool bTransparent = false );
|
void DebuggerSetColorBG( COLORREF nRGB, bool bTransparent = false );
|
||||||
|
|
||||||
|
void FillBackground(long left, long top, long right, long bottom);
|
||||||
|
|
||||||
void PrintGlyph ( const int x, const int y, const int iChar );
|
void PrintGlyph ( const int x, const int y, const int iChar );
|
||||||
int PrintText ( const char * pText, RECT & rRect );
|
int PrintText ( const char * pText, RECT & rRect );
|
||||||
int PrintTextCursorX( const char * pText, RECT & rRect );
|
int PrintTextCursorX( const char * pText, RECT & rRect );
|
||||||
@ -86,6 +71,8 @@
|
|||||||
extern HDC GetDebuggerMemDC(void);
|
extern HDC GetDebuggerMemDC(void);
|
||||||
extern void ReleaseDebuggerMemDC(void);
|
extern void ReleaseDebuggerMemDC(void);
|
||||||
extern void StretchBltMemToFrameDC(void);
|
extern void StretchBltMemToFrameDC(void);
|
||||||
|
extern HDC GetConsoleFontDC(void);
|
||||||
|
extern void ReleaseConsoleFontDC(void);
|
||||||
|
|
||||||
enum DebugVirtualTextScreen_e
|
enum DebugVirtualTextScreen_e
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user