Replace GRAPH_ functions with Win SDK equivalents.
diff --git a/controls/button.c b/controls/button.c
index 9f988db..7ab8c33 100644
--- a/controls/button.c
+++ b/controls/button.c
@@ -6,7 +6,6 @@
*/
#include "win.h"
-#include "graphics.h"
#include "button.h"
#include "windows.h"
#include "tweak.h"
@@ -306,9 +305,12 @@
PatBlt32(hDC, rc.left, rc.top, rc.right-rc.left, 1, PATCOPY );
rc.left += 2; /* To position the text down and right */
rc.top += 2;
+ } else {
+ rc.right++, rc.bottom++;
+ DrawEdge32( hDC, &rc, EDGE_RAISED, BF_RECT );
+ rc.right--, rc.bottom--;
}
- else GRAPH_DrawReliefRect( hDC, &rc, 2, 2, FALSE );
-
+
/* draw button label, if any: */
if (wndPtr->text && wndPtr->text[0])
{
@@ -425,6 +427,7 @@
if (wndPtr->text) textlen = strlen( wndPtr->text );
if (action == ODA_DRAWENTIRE || action == ODA_SELECT)
{
+ HDC32 hMemDC = CreateCompatibleDC32( hDC );
int x = 0, y = 0;
delta = (rbox.bottom - rbox.top - checkBoxHeight) >> 1;
@@ -437,8 +440,11 @@
((wndPtr->dwStyle & 0x0f) == BS_AUTORADIOBUTTON)) y += checkBoxHeight;
else if (infoPtr->state & BUTTON_3STATE) y += 2 * checkBoxHeight;
- GRAPH_DrawBitmap( hDC, hbitmapCheckBoxes, rbox.left, rbox.top + delta,
- x, y, checkBoxWidth, checkBoxHeight, FALSE );
+ SelectObject32( hMemDC, hbitmapCheckBoxes );
+ BitBlt32( hDC, rbox.left, rbox.top + delta, checkBoxWidth,
+ checkBoxHeight, hMemDC, x, y, SRCCOPY );
+ DeleteDC32( hMemDC );
+
if( textlen && action != ODA_SELECT )
{
if (wndPtr->dwStyle & WS_DISABLED)
@@ -506,10 +512,16 @@
BUTTON_SEND_CTLCOLOR( wndPtr, hDC );
GetClientRect32( wndPtr->hwndSelf, &rc);
- if (TWEAK_WineLook == WIN31_LOOK)
- GRAPH_DrawRectangle( hDC, rc.left, rc.top + 2, rc.right - 1, rc.bottom - 1,
- GetSysColorPen32(COLOR_WINDOWFRAME) );
- else {
+ if (TWEAK_WineLook == WIN31_LOOK) {
+ HPEN32 hPrevPen = SelectObject32( hDC,
+ GetSysColorPen32(COLOR_WINDOWFRAME));
+ HBRUSH32 hPrevBrush = SelectObject32( hDC,
+ GetStockObject32(NULL_BRUSH) );
+
+ Rectangle32( hDC, rc.left, rc.top + 2, rc.right - 1, rc.bottom - 1 );
+ SelectObject32( hDC, hPrevBrush );
+ SelectObject32( hDC, hPrevPen );
+ } else {
TEXTMETRIC32A tm;
rcFrame = rc;
diff --git a/controls/combo.c b/controls/combo.c
index fc5aade..8276351 100644
--- a/controls/combo.c
+++ b/controls/combo.c
@@ -13,7 +13,6 @@
#include "win.h"
#include "spy.h"
#include "user.h"
-#include "graphics.h"
#include "heap.h"
#include "combo.h"
#include "drive.h"
@@ -377,37 +376,44 @@
static void CBPaintButton(LPHEADCOMBO lphc, HDC32 hdc)
{
RECT32 r;
- HBRUSH32 hPrevBrush;
UINT32 x, y;
BOOL32 bBool;
+ HDC32 hMemDC;
+ HBRUSH32 hPrevBrush;
+ COLORREF oldTextColor, oldBkColor;
if( lphc->wState & CBF_NOREDRAW ) return;
- hPrevBrush = (HBRUSH32)SelectObject32(hdc, GetSysColorBrush32(COLOR_BTNFACE));
+ hPrevBrush = SelectObject32(hdc, GetSysColorBrush32(COLOR_BTNFACE));
CONV_RECT16TO32( &lphc->RectButton, &r );
Rectangle32(hdc, r.left, r.top, r.right, r.bottom );
- InflateRect32( &r, -1, -1 );
if( (bBool = lphc->wState & CBF_BUTTONDOWN) )
{
- GRAPH_DrawReliefRect(hdc, &r, 1, 0, TRUE);
+ DrawEdge32( hdc, &r, EDGE_SUNKEN, BF_RECT );
OffsetRect32( &r, 1, 1 );
- } else GRAPH_DrawReliefRect(hdc, &r, 1, 2, FALSE);
+ } else {
+ r.top++, r.left++;
+ DrawEdge32( hdc, &r, EDGE_RAISED, BF_RECT );
+ r.top--, r.left--;
+ }
+
+ InflateRect32( &r, -1, -1 );
x = (r.left + r.right - CBitWidth) >> 1;
y = (r.top + r.bottom - CBitHeight) >> 1;
InflateRect32( &r, -3, -3 );
- if( (bBool = CB_DISABLED(lphc)) )
- {
- GRAPH_SelectClipMask(hdc, hComboBmp, x + 1, y + 1 );
- FillRect32(hdc, &r, (HBRUSH32)GetStockObject32(WHITE_BRUSH));
- }
- GRAPH_SelectClipMask(hdc, hComboBmp, x, y );
- FillRect32(hdc, &r, (HBRUSH32)GetStockObject32((bBool) ? GRAY_BRUSH : BLACK_BRUSH));
-
- GRAPH_SelectClipMask(hdc, (HBITMAP32)0, 0, 0);
+ hMemDC = CreateCompatibleDC32( hdc );
+ SelectObject32( hMemDC, hComboBmp );
+ oldTextColor = SetTextColor32( hdc, GetSysColor32(COLOR_BTNFACE) );
+ oldBkColor = SetBkColor32( hdc, CB_DISABLED(lphc) ? RGB(128,128,128) :
+ RGB(0,0,0) );
+ BitBlt32( hdc, x, y, 8, 8, hMemDC, 0, 0, SRCCOPY );
+ SetBkColor32( hdc, oldBkColor );
+ SetTextColor32( hdc, oldTextColor );
+ DeleteDC32( hMemDC );
SelectObject32( hdc, hPrevBrush );
}
@@ -553,11 +559,13 @@
if( !(lphc->wState & CBF_EDIT) )
{
/* paint text field */
+
+ HPEN32 hPrevPen = SelectObject32( hDC, GetSysColorPen32(
+ COLOR_WINDOWFRAME) );
- GRAPH_DrawRectangle( hDC, lphc->RectEdit.left, lphc->RectEdit.top,
- lphc->RectEdit.right - lphc->RectEdit.left,
- lphc->RectButton.bottom - lphc->RectButton.top,
- GetSysColorPen32(COLOR_WINDOWFRAME) );
+ Rectangle32( hDC, lphc->RectEdit.left, lphc->RectEdit.top,
+ lphc->RectEdit.right, lphc->RectButton.bottom );
+ SelectObject32( hDC, hPrevPen );
CBPaintText( lphc, hDC );
}
if( hPrevBrush ) SelectObject32( hDC, hPrevBrush );
diff --git a/controls/desktop.c b/controls/desktop.c
index 52add8a..73baa5a 100644
--- a/controls/desktop.c
+++ b/controls/desktop.c
@@ -9,7 +9,6 @@
#include <unistd.h>
#include "win.h"
#include "desktop.h"
-#include "graphics.h"
#include "heap.h"
@@ -101,15 +100,16 @@
if (infoPtr->hbitmapWallPaper)
{
INT32 x, y;
+ HDC32 hMemDC = CreateCompatibleDC32( hdc );
+
+ SelectObject32( hMemDC, infoPtr->hbitmapWallPaper );
if (infoPtr->fTileWallPaper)
{
for (y = 0; y < rect.bottom; y += infoPtr->bitmapSize.cy)
for (x = 0; x < rect.right; x += infoPtr->bitmapSize.cx)
- GRAPH_DrawBitmap( hdc, infoPtr->hbitmapWallPaper,
- x, y, 0, 0,
- infoPtr->bitmapSize.cx,
- infoPtr->bitmapSize.cy, FALSE );
+ BitBlt32( hdc, x, y, infoPtr->bitmapSize.cx,
+ infoPtr->bitmapSize.cy, hMemDC, 0, 0, SRCCOPY );
}
else
{
@@ -117,10 +117,10 @@
y = (rect.top + rect.bottom - infoPtr->bitmapSize.cy) / 2;
if (x < 0) x = 0;
if (y < 0) y = 0;
- GRAPH_DrawBitmap( hdc, infoPtr->hbitmapWallPaper,
- x, y, 0, 0, infoPtr->bitmapSize.cx,
- infoPtr->bitmapSize.cy, FALSE );
+ BitBlt32( hdc, x, y, infoPtr->bitmapSize.cx,
+ infoPtr->bitmapSize.cy, hMemDC, 0, 0, SRCCOPY );
}
+ DeleteDC32( hMemDC );
}
return 1;
diff --git a/controls/icontitle.c b/controls/icontitle.c
index ae337af..3ea9656 100644
--- a/controls/icontitle.c
+++ b/controls/icontitle.c
@@ -11,7 +11,6 @@
#include "sysmetrics.h"
#include "win.h"
#include "desktop.h"
-#include "graphics.h"
#include "heap.h"
static LPCSTR emptyTitleText = "<...>";
diff --git a/controls/menu.c b/controls/menu.c
index a6110aa..aaa3d23 100644
--- a/controls/menu.c
+++ b/controls/menu.c
@@ -23,13 +23,11 @@
#include "task.h"
#include "win.h"
#include "heap.h"
-#include "menu.h"
#include "module.h"
#include "neexe.h"
#include "nonclient.h"
#include "user.h"
#include "message.h"
-#include "graphics.h"
#include "resource.h"
#include "tweak.h"
#include "debug.h"
@@ -952,9 +950,8 @@
/* Draw the check mark
*
+ * FIXME:
* Custom checkmark bitmaps are monochrome but not always 1bpp.
- * In this case we want GRAPH_DrawBitmap() to copy a plane which
- * is 1 for a white pixel and 0 for a black one.
*/
if (lpitem->fState & MF_CHECKED)
@@ -963,23 +960,35 @@
lpitem->hCheckBit ? lpitem->hCheckBit :
((lpitem->fType & MFT_RADIOCHECK)
? hStdRadioCheck : hStdCheck);
- GRAPH_DrawBitmap( hdc, bm, rect.left,
- (y - check_bitmap_height) / 2,
- 0, 0, check_bitmap_width,
- check_bitmap_height, TRUE );
- } else if (lpitem->hUnCheckBit)
- GRAPH_DrawBitmap( hdc, lpitem->hUnCheckBit, rect.left,
- (y - check_bitmap_height) / 2, 0, 0,
- check_bitmap_width, check_bitmap_height, TRUE );
+ HDC32 hdcMem = CreateCompatibleDC32( hdc );
+
+ SelectObject32( hdcMem, bm );
+ BitBlt32( hdc, rect.left, (y - check_bitmap_height) / 2,
+ check_bitmap_width, check_bitmap_height,
+ hdcMem, 0, 0, SRCCOPY );
+ DeleteDC32( hdcMem );
+ } else if (lpitem->hUnCheckBit) {
+ HDC32 hdcMem = CreateCompatibleDC32( hdc );
+
+ SelectObject32( hdcMem, lpitem->hUnCheckBit );
+ BitBlt32( hdc, rect.left, (y - check_bitmap_height) / 2,
+ check_bitmap_width, check_bitmap_height,
+ hdcMem, 0, 0, SRCCOPY );
+ DeleteDC32( hdcMem );
+ }
/* Draw the popup-menu arrow */
if (lpitem->fType & MF_POPUP)
{
- GRAPH_DrawBitmap( hdc, hStdMnArrow,
- rect.right-arrow_bitmap_width-1,
- (y - arrow_bitmap_height) / 2, 0, 0,
- arrow_bitmap_width, arrow_bitmap_height, FALSE );
+ HDC32 hdcMem = CreateCompatibleDC32( hdc );
+
+ SelectObject32( hdcMem, hStdMnArrow );
+ BitBlt32( hdc, rect.right - arrow_bitmap_width - 1,
+ (y - arrow_bitmap_height) / 2,
+ arrow_bitmap_width, arrow_bitmap_height,
+ hdcMem, 0, 0, SRCCOPY );
+ DeleteDC32( hdcMem );
}
rect.left += check_bitmap_width;
@@ -990,9 +999,12 @@
if (lpitem->fType & MF_BITMAP)
{
- GRAPH_DrawBitmap( hdc, (HBITMAP32)lpitem->text,
- rect.left, rect.top, 0, 0,
- rect.right-rect.left, rect.bottom-rect.top, FALSE );
+ HDC32 hdcMem = CreateCompatibleDC32( hdc );
+
+ SelectObject32( hdcMem, (HBITMAP32)lpitem->text );
+ BitBlt32( hdc, rect.left, rect.top, rect.right - rect.left,
+ rect.bottom - rect.top, hdcMem, 0, 0, SRCCOPY );
+ DeleteDC32( hdcMem );
return;
}
/* No bitmap - process text if present */
diff --git a/controls/scroll.c b/controls/scroll.c
index f824cdd..0ae3713 100644
--- a/controls/scroll.c
+++ b/controls/scroll.c
@@ -11,7 +11,6 @@
#include "windows.h"
#include "sysmetrics.h"
#include "scroll.h"
-#include "graphics.h"
#include "heap.h"
#include "win.h"
#include "debug.h"
@@ -494,7 +493,7 @@
/* Draw the scroll bar frame */
- GRAPH_DrawRectangle( hdc, r.left, r.top, r.right - r.left, r.bottom - r.top, 0);
+ Rectangle32( hdc, r.left, r.top, r.right, r.bottom );
/* Draw the scroll rectangles and thumb */
@@ -536,8 +535,8 @@
SelectObject32( hdc, GetSysColorBrush32(COLOR_BTNFACE) );
Rectangle32( hdc, r.left, r.top, r.right, r.bottom );
- InflateRect32( &r, -1, -1 );
- GRAPH_DrawReliefRect( hdc, &r, 1, 2, FALSE );
+ r.top++, r.left++;
+ DrawEdge32( hdc, &r, EDGE_RAISED, BF_RECT );
if (SCROLL_MovingThumb &&
(SCROLL_TrackingWin == hwnd) &&
(SCROLL_TrackingBar == nBar))