Skip to content

Commit 8779ab1

Browse files
committed
Remove dead CreateBMPFile function replaced by compressed screenshot
1 parent 7704e08 commit 8779ab1

File tree

2 files changed

+0
-158
lines changed
  • GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient
  • Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient

2 files changed

+0
-158
lines changed

Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -2802,85 +2802,6 @@ void W3DDisplay::setShroudLevel( Int x, Int y, CellShroudStatus setting )
28022802
}
28032803
}
28042804

2805-
//=============================================================================
2806-
///Utility function to dump data into a .BMP file
2807-
static void CreateBMPFile(LPTSTR pszFile, char *image, Int width, Int height)
2808-
{
2809-
HANDLE hf; // file handle
2810-
BITMAPFILEHEADER hdr; // bitmap file-header
2811-
PBITMAPINFOHEADER pbih; // bitmap info-header
2812-
LPBYTE lpBits; // memory pointer
2813-
DWORD dwTotal; // total count of bytes
2814-
DWORD cb; // incremental count of bytes
2815-
BYTE *hp; // byte pointer
2816-
DWORD dwTmp;
2817-
2818-
PBITMAPINFO pbmi;
2819-
2820-
pbmi = (PBITMAPINFO) LocalAlloc(LPTR,sizeof(BITMAPINFOHEADER));
2821-
if (pbmi == nullptr)
2822-
return;
2823-
2824-
pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
2825-
pbmi->bmiHeader.biWidth = width;
2826-
pbmi->bmiHeader.biHeight = height;
2827-
pbmi->bmiHeader.biPlanes = 1;
2828-
pbmi->bmiHeader.biBitCount = 24;
2829-
pbmi->bmiHeader.biCompression = BI_RGB;
2830-
pbmi->bmiHeader.biSizeImage = (pbmi->bmiHeader.biWidth + 7) /8 * pbmi->bmiHeader.biHeight * 24;
2831-
pbmi->bmiHeader.biClrImportant = 0;
2832-
2833-
pbih = (PBITMAPINFOHEADER) pbmi;
2834-
lpBits = (LPBYTE) image;
2835-
2836-
// Create the .BMP file.
2837-
hf = CreateFile(pszFile,
2838-
GENERIC_READ | GENERIC_WRITE,
2839-
(DWORD) 0,
2840-
nullptr,
2841-
CREATE_ALWAYS,
2842-
FILE_ATTRIBUTE_NORMAL,
2843-
(HANDLE) nullptr);
2844-
2845-
if (hf != INVALID_HANDLE_VALUE)
2846-
{
2847-
hdr.bfType = 0x4d42; // 0x42 = "B" 0x4d = "M"
2848-
// Compute the size of the entire file.
2849-
hdr.bfSize = (DWORD) (sizeof(BITMAPFILEHEADER) +
2850-
pbih->biSize + pbih->biClrUsed
2851-
* sizeof(RGBQUAD) + pbih->biSizeImage);
2852-
hdr.bfReserved1 = 0;
2853-
hdr.bfReserved2 = 0;
2854-
2855-
// Compute the offset to the array of color indices.
2856-
hdr.bfOffBits = (DWORD) sizeof(BITMAPFILEHEADER) +
2857-
pbih->biSize + pbih->biClrUsed
2858-
* sizeof (RGBQUAD);
2859-
2860-
// Copy the BITMAPFILEHEADER into the .BMP file.
2861-
if (WriteFile(hf, (LPVOID) &hdr, sizeof(BITMAPFILEHEADER),
2862-
(LPDWORD) &dwTmp, nullptr))
2863-
{
2864-
// Copy the BITMAPINFOHEADER and RGBQUAD array into the file.
2865-
if (WriteFile(hf, (LPVOID) pbih, sizeof(BITMAPINFOHEADER) + pbih->biClrUsed * sizeof (RGBQUAD),(LPDWORD) &dwTmp, nullptr))
2866-
{
2867-
// Copy the array of color indices into the .BMP file.
2868-
dwTotal = cb = pbih->biSizeImage;
2869-
hp = lpBits;
2870-
WriteFile(hf, (LPSTR) hp, (int) cb, (LPDWORD) &dwTmp, nullptr);
2871-
}
2872-
}
2873-
2874-
// Close the .BMP file.
2875-
CloseHandle(hf);
2876-
}
2877-
2878-
// Free memory.
2879-
LocalFree( (HLOCAL) pbmi);
2880-
}
2881-
2882-
///Save Screen Capture to a file
2883-
28842805
/** Start/Stop capturing an AVI movie*/
28852806
void W3DDisplay::toggleMovieCapture(void)
28862807
{

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -2914,85 +2914,6 @@ void W3DDisplay::setShroudLevel( Int x, Int y, CellShroudStatus setting )
29142914
}
29152915
}
29162916

2917-
//=============================================================================
2918-
///Utility function to dump data into a .BMP file
2919-
static void CreateBMPFile(LPTSTR pszFile, char *image, Int width, Int height)
2920-
{
2921-
HANDLE hf; // file handle
2922-
BITMAPFILEHEADER hdr; // bitmap file-header
2923-
PBITMAPINFOHEADER pbih; // bitmap info-header
2924-
LPBYTE lpBits; // memory pointer
2925-
DWORD dwTotal; // total count of bytes
2926-
DWORD cb; // incremental count of bytes
2927-
BYTE *hp; // byte pointer
2928-
DWORD dwTmp;
2929-
2930-
PBITMAPINFO pbmi;
2931-
2932-
pbmi = (PBITMAPINFO) LocalAlloc(LPTR,sizeof(BITMAPINFOHEADER));
2933-
if (pbmi == nullptr)
2934-
return;
2935-
2936-
pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
2937-
pbmi->bmiHeader.biWidth = width;
2938-
pbmi->bmiHeader.biHeight = height;
2939-
pbmi->bmiHeader.biPlanes = 1;
2940-
pbmi->bmiHeader.biBitCount = 24;
2941-
pbmi->bmiHeader.biCompression = BI_RGB;
2942-
pbmi->bmiHeader.biSizeImage = (pbmi->bmiHeader.biWidth + 7) /8 * pbmi->bmiHeader.biHeight * 24;
2943-
pbmi->bmiHeader.biClrImportant = 0;
2944-
2945-
pbih = (PBITMAPINFOHEADER) pbmi;
2946-
lpBits = (LPBYTE) image;
2947-
2948-
// Create the .BMP file.
2949-
hf = CreateFile(pszFile,
2950-
GENERIC_READ | GENERIC_WRITE,
2951-
(DWORD) 0,
2952-
nullptr,
2953-
CREATE_ALWAYS,
2954-
FILE_ATTRIBUTE_NORMAL,
2955-
(HANDLE) nullptr);
2956-
2957-
if (hf != INVALID_HANDLE_VALUE)
2958-
{
2959-
hdr.bfType = 0x4d42; // 0x42 = "B" 0x4d = "M"
2960-
// Compute the size of the entire file.
2961-
hdr.bfSize = (DWORD) (sizeof(BITMAPFILEHEADER) +
2962-
pbih->biSize + pbih->biClrUsed
2963-
* sizeof(RGBQUAD) + pbih->biSizeImage);
2964-
hdr.bfReserved1 = 0;
2965-
hdr.bfReserved2 = 0;
2966-
2967-
// Compute the offset to the array of color indices.
2968-
hdr.bfOffBits = (DWORD) sizeof(BITMAPFILEHEADER) +
2969-
pbih->biSize + pbih->biClrUsed
2970-
* sizeof (RGBQUAD);
2971-
2972-
// Copy the BITMAPFILEHEADER into the .BMP file.
2973-
if (WriteFile(hf, (LPVOID) &hdr, sizeof(BITMAPFILEHEADER),
2974-
(LPDWORD) &dwTmp, nullptr))
2975-
{
2976-
// Copy the BITMAPINFOHEADER and RGBQUAD array into the file.
2977-
if (WriteFile(hf, (LPVOID) pbih, sizeof(BITMAPINFOHEADER) + pbih->biClrUsed * sizeof (RGBQUAD),(LPDWORD) &dwTmp, nullptr))
2978-
{
2979-
// Copy the array of color indices into the .BMP file.
2980-
dwTotal = cb = pbih->biSizeImage;
2981-
hp = lpBits;
2982-
WriteFile(hf, (LPSTR) hp, (int) cb, (LPDWORD) &dwTmp, nullptr);
2983-
}
2984-
}
2985-
2986-
// Close the .BMP file.
2987-
CloseHandle(hf);
2988-
}
2989-
2990-
// Free memory.
2991-
LocalFree( (HLOCAL) pbmi);
2992-
}
2993-
2994-
///Save Screen Capture to a file
2995-
29962917
/** Start/Stop capturing an AVI movie*/
29972918
void W3DDisplay::toggleMovieCapture(void)
29982919
{

0 commit comments

Comments
 (0)