[CARDS]: Code formatting only (tabs --> spaces).

svn path=/trunk/; revision=62496
This commit is contained in:
Hermès Bélusca-Maïto 2014-03-14 20:59:02 +00:00
parent fa3242a619
commit f78a04d720
2 changed files with 153 additions and 152 deletions

View file

@ -1,7 +1,7 @@
/* /*
* ReactOS Cards * ReactOS Cards
* *
* Copyright (C) 2003 Filip Navara <xnavara@volny.org> * Copyright (C) 2003 Filip Navara <xnavara@volny.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -33,8 +33,8 @@ HINSTANCE g_hModule = 0;
*/ */
BOOL WINAPI WEP(DWORD Unknown) BOOL WINAPI WEP(DWORD Unknown)
{ {
UNREFERENCED_PARAMETER(Unknown); UNREFERENCED_PARAMETER(Unknown);
return TRUE; return TRUE;
} }
/* /*
@ -45,15 +45,15 @@ BOOL WINAPI cdtInit(INT *Width, INT *Height)
DWORD dwIndex; DWORD dwIndex;
/* Report card width and height to user */ /* Report card width and height to user */
*Width = CARD_WIDTH; *Width = CARD_WIDTH;
*Height = CARD_HEIGHT; *Height = CARD_HEIGHT;
/* Load images */ /* Load images */
for (dwIndex = 0; dwIndex < MAX_CARD_BITMAPS; ++dwIndex) for (dwIndex = 0; dwIndex < MAX_CARD_BITMAPS; ++dwIndex)
g_CardBitmaps[dwIndex] = g_CardBitmaps[dwIndex] =
(HBITMAP)LoadBitmapA(g_hModule, MAKEINTRESOURCEA(dwIndex + 1)); (HBITMAP)LoadBitmapA(g_hModule, MAKEINTRESOURCEA(dwIndex + 1));
return TRUE; return TRUE;
} }
/* /*
@ -64,8 +64,8 @@ VOID WINAPI cdtTerm(VOID)
DWORD dwIndex; DWORD dwIndex;
/* Unload images */ /* Unload images */
for (dwIndex = 0; dwIndex < MAX_CARD_BITMAPS; dwIndex++) for (dwIndex = 0; dwIndex < MAX_CARD_BITMAPS; dwIndex++)
DeleteObject(g_CardBitmaps[dwIndex]); DeleteObject(g_CardBitmaps[dwIndex]);
} }
/* /*
@ -73,7 +73,7 @@ VOID WINAPI cdtTerm(VOID)
*/ */
BOOL WINAPI cdtDraw(HDC hdc, INT x, INT y, INT card, INT type, COLORREF color) BOOL WINAPI cdtDraw(HDC hdc, INT x, INT y, INT card, INT type, COLORREF color)
{ {
return cdtDrawExt(hdc, x, y, CARD_WIDTH, CARD_HEIGHT, card, type, color); return cdtDrawExt(hdc, x, y, CARD_WIDTH, CARD_HEIGHT, card, type, color);
} }
/* /*
@ -81,30 +81,31 @@ BOOL WINAPI cdtDraw(HDC hdc, INT x, INT y, INT card, INT type, COLORREF color)
*/ */
static __inline VOID BltCard(HDC hdc, INT x, INT y, INT dx, INT dy, HDC hdcCard, DWORD dwRasterOp, BOOL bStretch) static __inline VOID BltCard(HDC hdc, INT x, INT y, INT dx, INT dy, HDC hdcCard, DWORD dwRasterOp, BOOL bStretch)
{ {
if (bStretch) if (bStretch)
{ {
StretchBlt(hdc, x, y, dx, dy, hdcCard, 0, 0, CARD_WIDTH, CARD_HEIGHT, dwRasterOp); StretchBlt(hdc, x, y, dx, dy, hdcCard, 0, 0, CARD_WIDTH, CARD_HEIGHT, dwRasterOp);
} else }
{ else
BitBlt(hdc, x, y, dx, dy, hdcCard, 0, 0, dwRasterOp); {
BitBlt(hdc, x, y, dx, dy, hdcCard, 0, 0, dwRasterOp);
/* /*
* This is need when using Microsoft images, because they use two-color red/white images for * This is need when using Microsoft images, because they use two-color red/white images for
* red cards and thus needs fix-up of the edge to black color. * red cards and thus needs fix-up of the edge to black color.
*/ */
#if 0 #if 0
if (ISREDCARD(card)) if (ISREDCARD(card))
{ {
PatBlt(hdc, x, y + 2, 1, dy - 4, BLACKNESS); PatBlt(hdc, x, y + 2, 1, dy - 4, BLACKNESS);
PatBlt(hdc, x + dx - 1, y + 2, 1, dy - 4, BLACKNESS); PatBlt(hdc, x + dx - 1, y + 2, 1, dy - 4, BLACKNESS);
PatBlt(hdc, x + 2, y, dx - 4, 1, BLACKNESS); PatBlt(hdc, x + 2, y, dx - 4, 1, BLACKNESS);
PatBlt(hdc, x + 2, y + dy - 1, dx - 4, 1, BLACKNESS); PatBlt(hdc, x + 2, y + dy - 1, dx - 4, 1, BLACKNESS);
SetPixel(hdc, x + 1, y + 1, 0); SetPixel(hdc, x + 1, y + 1, 0);
SetPixel(hdc, x + dx - 2, y + 1, 0); SetPixel(hdc, x + dx - 2, y + 1, 0);
SetPixel(hdc, x + 1, y + dy - 2, 0); SetPixel(hdc, x + 1, y + dy - 2, 0);
SetPixel(hdc, x + dx - 2, y + dy - 2, 0); SetPixel(hdc, x + dx - 2, y + dy - 2, 0);
} }
#endif #endif
} }
} }
/* /*
@ -122,106 +123,106 @@ static __inline VOID BltCard(HDC hdc, INT x, INT y, INT dx, INT dy, HDC hdcCard,
*/ */
BOOL WINAPI cdtDrawExt(HDC hdc, INT x, INT y, INT dx, INT dy, INT card, INT type, COLORREF color) BOOL WINAPI cdtDrawExt(HDC hdc, INT x, INT y, INT dx, INT dy, INT card, INT type, COLORREF color)
{ {
HDC hdcCard; HDC hdcCard;
DWORD dwRasterOp = SRCCOPY, OldBkColor; DWORD dwRasterOp = SRCCOPY, OldBkColor;
BOOL bSaveEdges = TRUE; BOOL bSaveEdges = TRUE;
BOOL bStretch = FALSE; BOOL bStretch = FALSE;
if (type & ectSAVEEDGESMASK) if (type & ectSAVEEDGESMASK)
{ {
type &= ~ectSAVEEDGESMASK; type &= ~ectSAVEEDGESMASK;
bSaveEdges = FALSE; bSaveEdges = FALSE;
} }
if (dx != CARD_WIDTH || dy != CARD_HEIGHT) if (dx != CARD_WIDTH || dy != CARD_HEIGHT)
{ {
bStretch = TRUE; bStretch = TRUE;
bSaveEdges = FALSE; bSaveEdges = FALSE;
} }
switch (type) switch (type)
{ {
case ectINVERTED: case ectINVERTED:
dwRasterOp = NOTSRCCOPY; dwRasterOp = NOTSRCCOPY;
case ectFACES: case ectFACES:
card = (card % 4) * 13 + (card / 4); card = (card % 4) * 13 + (card / 4);
break; break;
case ectBACKS: case ectBACKS:
--card; --card;
break; break;
case ectEMPTYNOBG: case ectEMPTYNOBG:
dwRasterOp = SRCAND; dwRasterOp = SRCAND;
case ectEMPTY: case ectEMPTY:
card = 52; card = 52;
break; break;
case ectERASE: case ectERASE:
break; break;
case ectREDX: case ectREDX:
card = 66; card = 66;
break; break;
case ectGREENO: case ectGREENO:
card = 67; card = 67;
break; break;
default: default:
return FALSE; return FALSE;
} }
if (type == ectEMPTY || type == ectERASE) if (type == ectEMPTY || type == ectERASE)
{ {
POINT pPoint; POINT pPoint;
HBRUSH hBrush; HBRUSH hBrush;
hBrush = CreateSolidBrush(color); hBrush = CreateSolidBrush(color);
GetDCOrgEx(hdc, &pPoint); GetDCOrgEx(hdc, &pPoint);
SetBrushOrgEx(hdc, pPoint.x, pPoint.y, 0); SetBrushOrgEx(hdc, pPoint.x, pPoint.y, 0);
SelectObject(hdc, hBrush); SelectObject(hdc, hBrush);
PatBlt(hdc, x, y, dx, dy, PATCOPY); PatBlt(hdc, x, y, dx, dy, PATCOPY);
} }
if (type != ectERASE) if (type != ectERASE)
{ {
hdcCard = CreateCompatibleDC(hdc); hdcCard = CreateCompatibleDC(hdc);
SelectObject(hdcCard, g_CardBitmaps[card]); SelectObject(hdcCard, g_CardBitmaps[card]);
OldBkColor = SetBkColor(hdc, (type == ectFACES) ? 0xFFFFFF : color); OldBkColor = SetBkColor(hdc, (type == ectFACES) ? 0xFFFFFF : color);
if (bSaveEdges) if (bSaveEdges)
{ {
COLORREF SavedPixels[12]; COLORREF SavedPixels[12];
SavedPixels[0] = GetPixel(hdc, x, y); SavedPixels[0] = GetPixel(hdc, x, y);
SavedPixels[1] = GetPixel(hdc, x + 1, y); SavedPixels[1] = GetPixel(hdc, x + 1, y);
SavedPixels[2] = GetPixel(hdc, x, y + 1); SavedPixels[2] = GetPixel(hdc, x, y + 1);
SavedPixels[3] = GetPixel(hdc, x + dx - 1, y); SavedPixels[3] = GetPixel(hdc, x + dx - 1, y);
SavedPixels[4] = GetPixel(hdc, x + dx - 2, y); SavedPixels[4] = GetPixel(hdc, x + dx - 2, y);
SavedPixels[5] = GetPixel(hdc, x + dx - 1, y + 1); SavedPixels[5] = GetPixel(hdc, x + dx - 1, y + 1);
SavedPixels[6] = GetPixel(hdc, x, y + dy - 1); SavedPixels[6] = GetPixel(hdc, x, y + dy - 1);
SavedPixels[7] = GetPixel(hdc, x + 1, y + dy - 1); SavedPixels[7] = GetPixel(hdc, x + 1, y + dy - 1);
SavedPixels[8] = GetPixel(hdc, x, y + dy - 2); SavedPixels[8] = GetPixel(hdc, x, y + dy - 2);
SavedPixels[9] = GetPixel(hdc, x + dx - 1, y + dy - 1); SavedPixels[9] = GetPixel(hdc, x + dx - 1, y + dy - 1);
SavedPixels[10] = GetPixel(hdc, x + dx - 2, y + dy - 1); SavedPixels[10] = GetPixel(hdc, x + dx - 2, y + dy - 1);
SavedPixels[11] = GetPixel(hdc, x + dx - 1, y + dy - 2); SavedPixels[11] = GetPixel(hdc, x + dx - 1, y + dy - 2);
BltCard(hdc, x, y, dx, dy, hdcCard, dwRasterOp, bStretch); BltCard(hdc, x, y, dx, dy, hdcCard, dwRasterOp, bStretch);
SetPixel(hdc, x, y, SavedPixels[0]); SetPixel(hdc, x, y, SavedPixels[0]);
SetPixel(hdc, x + 1, y, SavedPixels[1]); SetPixel(hdc, x + 1, y, SavedPixels[1]);
SetPixel(hdc, x, y + 1, SavedPixels[2]); SetPixel(hdc, x, y + 1, SavedPixels[2]);
SetPixel(hdc, x + dx - 1, y, SavedPixels[3]); SetPixel(hdc, x + dx - 1, y, SavedPixels[3]);
SetPixel(hdc, x + dx - 2, y, SavedPixels[4]); SetPixel(hdc, x + dx - 2, y, SavedPixels[4]);
SetPixel(hdc, x + dx - 1, y + 1, SavedPixels[5]); SetPixel(hdc, x + dx - 1, y + 1, SavedPixels[5]);
SetPixel(hdc, x, y + dy - 1, SavedPixels[6]); SetPixel(hdc, x, y + dy - 1, SavedPixels[6]);
SetPixel(hdc, x + 1, y + dy - 1, SavedPixels[7]); SetPixel(hdc, x + 1, y + dy - 1, SavedPixels[7]);
SetPixel(hdc, x, y + dy - 2, SavedPixels[8]); SetPixel(hdc, x, y + dy - 2, SavedPixels[8]);
SetPixel(hdc, x + dx - 1, y + dy - 1, SavedPixels[9]); SetPixel(hdc, x + dx - 1, y + dy - 1, SavedPixels[9]);
SetPixel(hdc, x + dx - 2, y + dy - 1, SavedPixels[10]); SetPixel(hdc, x + dx - 2, y + dy - 1, SavedPixels[10]);
SetPixel(hdc, x + dx - 1, y + dy - 2, SavedPixels[11]); SetPixel(hdc, x + dx - 1, y + dy - 2, SavedPixels[11]);
} }
else else
{ {
BltCard(hdc, x, y, dx, dy, hdcCard, dwRasterOp, bStretch); BltCard(hdc, x, y, dx, dy, hdcCard, dwRasterOp, bStretch);
} }
SetBkColor(hdc, OldBkColor); SetBkColor(hdc, OldBkColor);
DeleteDC(hdcCard); DeleteDC(hdcCard);
} }
return TRUE; return TRUE;
} }
@ -232,19 +233,19 @@ BOOL WINAPI cdtDrawExt(HDC hdc, INT x, INT y, INT dx, INT dy, INT card, INT type
*/ */
BOOL WINAPI cdtAnimate(HDC hdc, int cardback, int x, int y, int frame) BOOL WINAPI cdtAnimate(HDC hdc, int cardback, int x, int y, int frame)
{ {
UNREFERENCED_PARAMETER(frame); UNREFERENCED_PARAMETER(frame);
UNREFERENCED_PARAMETER(y); UNREFERENCED_PARAMETER(y);
UNREFERENCED_PARAMETER(x); UNREFERENCED_PARAMETER(x);
UNREFERENCED_PARAMETER(cardback); UNREFERENCED_PARAMETER(cardback);
UNREFERENCED_PARAMETER(hdc); UNREFERENCED_PARAMETER(hdc);
return TRUE; return TRUE;
} }
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{ {
UNREFERENCED_PARAMETER(lpvReserved); UNREFERENCED_PARAMETER(lpvReserved);
if (fdwReason == DLL_PROCESS_ATTACH) if (fdwReason == DLL_PROCESS_ATTACH)
g_hModule = hinstDLL; g_hModule = hinstDLL;
return TRUE; return TRUE;
} }

View file

@ -1,7 +1,7 @@
/* /*
* ReactOS Cards * ReactOS Cards
* *
* Copyright (C) 2003 Filip Navara <xnavara@volny.org> * Copyright (C) 2003 Filip Navara <xnavara@volny.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -28,29 +28,29 @@
* FreeCard + * FreeCard +
* Joker * Joker
*/ */
#define MAX_CARD_BITMAPS 68 #define MAX_CARD_BITMAPS 68
#define ectFACES 0 #define ectFACES 0
#define ectBACKS 1 #define ectBACKS 1
#define ectINVERTED 2 #define ectINVERTED 2
#define ectEMPTY 3 #define ectEMPTY 3
#define ectERASE 4 #define ectERASE 4
#define ectEMPTYNOBG 5 #define ectEMPTYNOBG 5
#define ectREDX 6 #define ectREDX 6
#define ectGREENO 7 #define ectGREENO 7
#define ectSAVEEDGESMASK 0x80000000 #define ectSAVEEDGESMASK 0x80000000
#if defined(CARDSTYLE_DEFAULT) #if defined(CARDSTYLE_DEFAULT)
# define CARD_WIDTH 72 // The original Microsoft cards are 71px wide, but ours are taken from MacSolitaireX # define CARD_WIDTH 72 // The original Microsoft cards are 71px wide, but ours are taken from MacSolitaireX
# define CARD_HEIGHT 96 # define CARD_HEIGHT 96
#elif defined(CARDSTYLE_BAVARIAN) #elif defined(CARDSTYLE_BAVARIAN)
# define CARD_WIDTH 110 # define CARD_WIDTH 110
# define CARD_HEIGHT 198 # define CARD_HEIGHT 198
#else #else
# error No or unsupported cardstyle defined # error No or unsupported cardstyle defined
#endif #endif
#define ISREDCARD(x) (x >= 13 && x <= 39) #define ISREDCARD(x) (x >= 13 && x <= 39)
BOOL WINAPI cdtInit(int *width, int *height); BOOL WINAPI cdtInit(int *width, int *height);
BOOL WINAPI cdtDraw(HDC hdc, int x, int y, int card, int type, DWORD color); BOOL WINAPI cdtDraw(HDC hdc, int x, int y, int card, int type, DWORD color);