Commit 2d617be0 authored by Huw D M Davies's avatar Huw D M Davies Committed by Alexandre Julliard

Replace GRAPH_ functions with Win SDK equivalents.

parent 2772a67c
......@@ -6,7 +6,6 @@
*/
#include "win.h"
#include "graphics.h"
#include "button.h"
#include "windows.h"
#include "tweak.h"
......@@ -306,9 +305,12 @@ static void PB_Paint( WND *wndPtr, HDC32 hDC, WORD action )
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 @@ static void CB_Paint( WND *wndPtr, HDC32 hDC, WORD action )
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 @@ static void CB_Paint( WND *wndPtr, HDC32 hDC, WORD action )
((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 @@ static void GB_Paint( WND *wndPtr, HDC32 hDC, WORD action )
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;
......
......@@ -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 LRESULT COMBO_Create( LPHEADCOMBO lphc, WND* wnd, LPARAM lParam)
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 @@ static LRESULT COMBO_Paint(LPHEADCOMBO lphc, HDC32 hParamDC)
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 );
......
......@@ -9,7 +9,6 @@
#include <unistd.h>
#include "win.h"
#include "desktop.h"
#include "graphics.h"
#include "heap.h"
......@@ -101,15 +100,16 @@ static LRESULT DESKTOP_DoEraseBkgnd( HWND32 hwnd, HDC32 hdc,
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 @@ static LRESULT DESKTOP_DoEraseBkgnd( HWND32 hwnd, HDC32 hdc,
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;
......
......@@ -11,7 +11,6 @@
#include "sysmetrics.h"
#include "win.h"
#include "desktop.h"
#include "graphics.h"
#include "heap.h"
static LPCSTR emptyTitleText = "<...>";
......
......@@ -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 @@ static void MENU_DrawMenuItem( HWND32 hwnd, HDC32 hdc, MENUITEM *lpitem,
/* 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 @@ static void MENU_DrawMenuItem( HWND32 hwnd, HDC32 hdc, MENUITEM *lpitem,
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 @@ static void MENU_DrawMenuItem( HWND32 hwnd, HDC32 hdc, MENUITEM *lpitem,
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 */
......
......@@ -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 @@ static void SCROLL_DrawInterior( HWND32 hwnd, HDC32 hdc, INT32 nBar,
/* 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 @@ static void SCROLL_DrawInterior( HWND32 hwnd, HDC32 hdc, INT32 nBar,
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))
......
......@@ -32,7 +32,6 @@
#include "winnls.h"
#include "sysmetrics.h"
#include "updown.h"
#include "graphics.h"
#include "win.h"
#include "debug.h"
......
......@@ -19,7 +19,6 @@
#include "resource.h"
#include "dlgs.h"
#include "win.h"
#include "graphics.h"
#include "cursoricon.h"
#include "interfaces.h"
#include "sysmetrics.h"
......@@ -690,8 +689,11 @@ LRESULT WINAPI AboutDlgProc32( HWND32 hWnd, UINT32 msg, WPARAM32 wParam,
PAINTSTRUCT32 ps;
HDC32 hDC = BeginPaint32( hWnd, &ps );
if( __get_dropline( hWnd, &rect ) )
GRAPH_DrawLines( hDC, (LPPOINT32)&rect, 1, GetStockObject32( BLACK_PEN ) );
if( __get_dropline( hWnd, &rect ) ) {
SelectObject32( hDC, GetStockObject32( BLACK_PEN ) );
MoveToEx32( hDC, rect.left, rect.top, NULL );
LineTo32( hDC, rect.right, rect.bottom );
}
EndPaint32( hWnd, &ps );
}
break;
......
......@@ -24,7 +24,6 @@
#include "resource.h"
#include "dlgs.h"
#include "win.h"
#include "graphics.h"
#include "cursoricon.h"
#include "interfaces.h"
#include "shlobj.h"
......
......@@ -5,7 +5,6 @@
*/
#include <stdlib.h>
#include "graphics.h"
#include "gdi.h"
#include "dc.h"
#include "metafile.h"
......
......@@ -27,7 +27,6 @@
#include "x11font.h"
#include "bitmap.h"
#include "gdi.h"
#include "graphics.h"
#include "dc.h"
#include "bitmap.h"
#include "callback.h"
......@@ -326,7 +325,7 @@ X11DRV_LineTo( DC *dc, INT32 x, INT32 y )
/***********************************************************************
* GRAPH_DrawArc
* X11DRV_DrawArc
*
* Helper functions for Arc(), Chord() and Pie().
* 'lines' is the number of lines to draw: 0 for Arc, 1 for Chord, 2 for Pie.
......
/*
* Internal graphics functions prototypes
*
* Copyright 1994 Alexandre Julliard
*
*/
#ifndef __WINE_GRAPHICS_H
#define __WINE_GRAPHICS_H
#include "windows.h"
extern void GRAPH_DrawReliefRect( HDC32 hdc, const RECT32 *rect,
INT32 highlight_size, INT32 shadow_size,
BOOL32 pressed );
extern void GRAPH_DrawGenericReliefRect( HDC32 hdc, const RECT32 *rect,
INT32 highlight_size,
INT32 shadow_size, HBRUSH32 highlight,
HBRUSH32 shadow );
extern BOOL32 GRAPH_DrawLines( HDC32 hdc, LPPOINT32 pXY, INT32 N, HPEN32 hPen);
extern void GRAPH_DrawRectangle( HDC32 hdc, INT32 x, INT32 y,
INT32 width, INT32 height, HPEN32 hPen);
extern BOOL32 GRAPH_DrawBitmap( HDC32 hdc, HBITMAP32 hbitmap,
INT32 xdest, INT32 ydest, INT32 xsrc,
INT32 ysrc, INT32 width, INT32 height, BOOL32 bMono );
extern BOOL32 GRAPH_SelectClipMask( HDC32 hdc, HBITMAP32 hMono,
INT32 x, INT32 y );
#endif /* __WINE_GRAPHICS_H */
......@@ -18,7 +18,6 @@
#include "resource.h"
#include "dlgs.h"
#include "win.h"
#include "graphics.h"
#include "cursoricon.h"
#include "interfaces.h"
#include "sysmetrics.h"
......
......@@ -18,7 +18,6 @@ C_SRCS = \
driver.c \
event.c \
focus.c \
graphics.c \
hook.c \
input.c \
keyboard.c \
......
/*
* X-specific shortcuts to speed up WM code.
* No coordinate transformations except origin translation.
*
* Copyright 1993, 1994 Alexandre Julliard
*/
#include <assert.h>
#include <stdlib.h>
#include "ts_xlib.h"
#include "ts_xutil.h"
#include <X11/Intrinsic.h>
#include "graphics.h"
#include "color.h"
#include "bitmap.h"
#include "gdi.h"
#include "dc.h"
#include "x11drv.h"
#define MAX_DRAWLINES 8
/**********************************************************************
* GRAPH_DrawLines
*
* Draw multiple unconnected lines (limited by MAX_DRAWLINES).
*/
BOOL32 GRAPH_DrawLines( HDC32 hdc, LPPOINT32 pXY, INT32 N, HPEN32 hPen )
{
BOOL32 bRet = FALSE;
DC* dc;
assert( N <= MAX_DRAWLINES );
if( (dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC )) )
{
HPEN32 hPrevPen = 0;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if( hPen ) hPrevPen = SelectObject32( hdc, hPen );
if( X11DRV_SetupGCForPen( dc ) )
{
XSegment l[MAX_DRAWLINES];
INT32 i, j;
for( i = 0; i < N; i++ )
{
j = 2 * i;
l[i].x1 = pXY[j].x + dc->w.DCOrgX;
l[i].x2 = pXY[j + 1].x + dc->w.DCOrgX;
l[i].y1 = pXY[j].y + dc->w.DCOrgY;
l[i].y2 = pXY[j + 1].y + dc->w.DCOrgY;
}
TSXDrawSegments( display, physDev->drawable, physDev->gc, l, N );
bRet = TRUE;
}
if( hPrevPen ) SelectObject32( hdc, hPrevPen );
GDI_HEAP_UNLOCK( hdc );
}
return bRet;
}
/**********************************************************************
*
* GRAPH_DrawBitmap
*
* Short-cut function to blit a bitmap into a device.
* Faster than CreateCompatibleDC() + SelectBitmap() + BitBlt() + DeleteDC().
*/
BOOL32 GRAPH_DrawBitmap( HDC32 hdc, HBITMAP32 hbitmap,
INT32 xdest, INT32 ydest, INT32 xsrc, INT32 ysrc,
INT32 width, INT32 height, BOOL32 bMono )
{
BITMAPOBJ *bmp;
DC *dc;
BOOL32 ret = TRUE;
X11DRV_PHYSBITMAP *pbitmap;
X11DRV_PDEVICE *physDev;
if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return FALSE;
if (!(bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC )))
{
GDI_HEAP_UNLOCK( hdc );
return FALSE;
}
physDev = (X11DRV_PDEVICE *)dc->physDev;
/* HACK for now */
if(!bmp->DDBitmap)
X11DRV_CreateBitmap( hbitmap );
pbitmap = bmp->DDBitmap->physBitmap;
xdest += dc->w.DCOrgX; ydest += dc->w.DCOrgY;
TSXSetFunction( display, physDev->gc, GXcopy );
if (bmp->bitmap.bmBitsPixel == 1)
{
TSXSetForeground( display, physDev->gc, physDev->backgroundPixel );
TSXSetBackground( display, physDev->gc, physDev->textPixel );
TSXCopyPlane( display, pbitmap->pixmap, physDev->drawable, physDev->gc,
xsrc, ysrc, width, height, xdest, ydest, 1 );
}
else if (bmp->bitmap.bmBitsPixel == dc->w.bitsPerPixel)
{
if( bMono )
{
INT32 plane;
if( COLOR_GetMonoPlane(&plane) )
{
TSXSetForeground( display, physDev->gc,
physDev->backgroundPixel );
TSXSetBackground( display, physDev->gc, physDev->textPixel );
}
else
{
TSXSetForeground( display, physDev->gc, physDev->textPixel );
TSXSetBackground( display, physDev->gc,
physDev->backgroundPixel );
}
TSXCopyPlane( display, pbitmap->pixmap, physDev->drawable,
physDev->gc, xsrc, ysrc, width, height, xdest, ydest,
plane );
}
else
{
TSXCopyArea( display, pbitmap->pixmap, physDev->drawable,
physDev->gc, xsrc, ysrc, width, height, xdest,
ydest );
}
}
else
{
ret = FALSE;
}
GDI_HEAP_UNLOCK( hdc );
GDI_HEAP_UNLOCK( hbitmap );
return ret;
}
/**********************************************************************
* GRAPH_DrawReliefRect
*
* Used in the standard control code for button edge drawing.
*/
void GRAPH_DrawReliefRect( HDC32 hdc, const RECT32 *rect, INT32 highlight_size,
INT32 shadow_size, BOOL32 pressed )
{
if(pressed)
GRAPH_DrawGenericReliefRect(hdc, rect, highlight_size, shadow_size,
GetSysColorBrush32(COLOR_BTNSHADOW),
GetSysColorBrush32(COLOR_BTNHIGHLIGHT));
else
GRAPH_DrawGenericReliefRect(hdc, rect, highlight_size, shadow_size,
GetSysColorBrush32(COLOR_BTNHIGHLIGHT),
GetSysColorBrush32(COLOR_BTNSHADOW));
return;
}
/******************************************************************************
* GRAPH_DrawGenericReliefRect
*
* Creates a rectangle with the specified highlight and shadow colors.
* Adapted from DrawReliefRect (which is somewhat misnamed).
*/
void GRAPH_DrawGenericReliefRect(
HDC32 hdc,
const RECT32 *rect,
INT32 highlight_size,
INT32 shadow_size,
HBRUSH32 highlight,
HBRUSH32 shadow )
{
DC* dc;
HBRUSH32 hPrevBrush;
INT32 w, h;
RECT32 r = *rect;
X11DRV_PDEVICE *physDev;
if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return;
physDev = (X11DRV_PDEVICE *)dc->physDev;
OffsetRect32( &r, dc->w.DCOrgX, dc->w.DCOrgY);
h = rect->bottom - rect->top; w = rect->right - rect->left;
hPrevBrush = SelectObject32(hdc, highlight);
if ( X11DRV_SetupGCForBrush( dc ) )
{
INT32 i;
TSXSetFunction( display, physDev->gc, GXcopy );
for (i = 0; i < highlight_size; i++)
{
TSXFillRectangle( display, physDev->drawable, physDev->gc,
r.left + i, r.top, 1, h - i );
TSXFillRectangle( display, physDev->drawable, physDev->gc,
r.left, r.top + i, w - i, 1 );
}
}
SelectObject32( hdc, shadow );
if ( X11DRV_SetupGCForBrush( dc ) )
{
INT32 i;
TSXSetFunction( display, physDev->gc, GXcopy );
for (i = 0; i < shadow_size; i++)
{
TSXFillRectangle( display, physDev->drawable, physDev->gc,
r.right - i - 1, r.top + i, 1, h - i );
TSXFillRectangle( display, physDev->drawable, physDev->gc,
r.left + i, r.bottom - i - 1, w - i, 1 );
}
}
SelectObject32( hdc, hPrevBrush );
GDI_HEAP_UNLOCK( hdc );
}
/**********************************************************************
* GRAPH_DrawRectangle
*/
void GRAPH_DrawRectangle( HDC32 hdc, INT32 x, INT32 y,
INT32 w, INT32 h, HPEN32 hPen )
{
DC* dc;
if( (dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC )) )
{
HPEN32 hPrevPen = 0;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if( hPen ) hPrevPen = SelectObject32( hdc, hPen );
if( X11DRV_SetupGCForPen( dc ) )
TSXDrawRectangle( display, physDev->drawable, physDev->gc,
x + dc->w.DCOrgX, y + dc->w.DCOrgY, w - 1, h - 1);
if( hPrevPen ) SelectObject32( hdc, hPrevPen );
GDI_HEAP_UNLOCK( hdc );
}
}
/**********************************************************************
* GRAPH_SelectClipMask
*/
BOOL32 GRAPH_SelectClipMask( HDC32 hdc, HBITMAP32 hMonoBitmap, INT32 x, INT32 y)
{
BITMAPOBJ *bmp = NULL;
DC *dc;
X11DRV_PHYSBITMAP *pbitmap = NULL;
X11DRV_PDEVICE *physDev;
if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return FALSE;
physDev = (X11DRV_PDEVICE *)dc->physDev;
if ( hMonoBitmap )
{
if ( !(bmp = (BITMAPOBJ *) GDI_GetObjPtr( hMonoBitmap, BITMAP_MAGIC))
|| bmp->bitmap.bmBitsPixel != 1 )
{
GDI_HEAP_UNLOCK( hdc );
return FALSE;
}
/* HACK for now */
if(!bmp->DDBitmap)
X11DRV_CreateBitmap( hMonoBitmap );
pbitmap = bmp->DDBitmap->physBitmap;
TSXSetClipOrigin( display, physDev->gc, dc->w.DCOrgX + x,
dc->w.DCOrgY + y );
}
TSXSetClipMask( display, physDev->gc, (bmp) ? pbitmap->pixmap : None );
GDI_HEAP_UNLOCK( hdc );
GDI_HEAP_UNLOCK( hMonoBitmap );
return TRUE;
}
......@@ -18,7 +18,6 @@
#include "hook.h"
#include "scroll.h"
#include "nonclient.h"
#include "graphics.h"
#include "queue.h"
#include "selectors.h"
#include "tweak.h"
......@@ -950,15 +949,19 @@ static void NC_DrawMaxButton( HWND32 hwnd, HDC16 hdc, BOOL32 down )
{
RECT32 rect;
WND *wndPtr = WIN_FindWndPtr( hwnd );
HDC32 hdcMem;
if( !(wndPtr->flags & WIN_MANAGED) )
{
NC_GetInsideRect( hwnd, &rect );
GRAPH_DrawBitmap( hdc, (IsZoomed32(hwnd)
hdcMem = CreateCompatibleDC32( hdc );
SelectObject32( hdcMem, (IsZoomed32(hwnd)
? (down ? hbitmapRestoreD : hbitmapRestore)
: (down ? hbitmapMaximizeD : hbitmapMaximize)),
rect.right - SYSMETRICS_CXSIZE - 1, rect.top,
0, 0, SYSMETRICS_CXSIZE+1, SYSMETRICS_CYSIZE, FALSE );
: (down ? hbitmapMaximizeD : hbitmapMaximize)) );
BitBlt32( hdc, rect.right - SYSMETRICS_CXSIZE - 1, rect.top,
SYSMETRICS_CXSIZE + 1, SYSMETRICS_CYSIZE, hdcMem, 0, 0,
SRCCOPY );
DeleteDC32( hdcMem );
}
}
......@@ -970,14 +973,18 @@ static void NC_DrawMinButton( HWND32 hwnd, HDC16 hdc, BOOL32 down )
{
RECT32 rect;
WND *wndPtr = WIN_FindWndPtr( hwnd );
HDC32 hdcMem;
if( !(wndPtr->flags & WIN_MANAGED) )
{
NC_GetInsideRect( hwnd, &rect );
hdcMem = CreateCompatibleDC32( hdc );
SelectObject32( hdcMem, (down ? hbitmapMinimizeD : hbitmapMinimize) );
if (wndPtr->dwStyle & WS_MAXIMIZEBOX) rect.right -= SYSMETRICS_CXSIZE+1;
GRAPH_DrawBitmap( hdc, (down ? hbitmapMinimizeD : hbitmapMinimize),
rect.right - SYSMETRICS_CXSIZE - 1, rect.top,
0, 0, SYSMETRICS_CXSIZE+1, SYSMETRICS_CYSIZE, FALSE );
BitBlt32( hdc, rect.right - SYSMETRICS_CXSIZE - 1, rect.top,
SYSMETRICS_CXSIZE + 1, SYSMETRICS_CYSIZE, hdcMem, 0, 0,
SRCCOPY );
DeleteDC32( hdcMem );
}
}
......@@ -1100,6 +1107,7 @@ static void NC_DrawMaxButton95(
WND *wndPtr = WIN_FindWndPtr( hwnd );
SIZE32 bmsz;
HBITMAP32 bm;
HDC32 hdcMem;
if( !(wndPtr->flags & WIN_MANAGED) &&
GetBitmapDimensionEx32((bm = IsZoomed32(hwnd) ?
......@@ -1112,10 +1120,12 @@ static void NC_DrawMaxButton95(
if (wndPtr->dwStyle & WS_SYSMENU)
rect.right -= sysMetrics[SM_CYCAPTION] + 1;
GRAPH_DrawBitmap( hdc, bm, rect.right -
(sysMetrics[SM_CXSIZE] + bmsz.cx) / 2,
rect.top + (sysMetrics[SM_CYCAPTION] - 1 - bmsz.cy) / 2,
0, 0, bmsz.cx, bmsz.cy, FALSE );
hdcMem = CreateCompatibleDC32( hdc );
SelectObject32( hdc, bm );
BitBlt32( hdc, rect.right - (sysMetrics[SM_CXSIZE] + bmsz.cx) / 2,
rect.top + (sysMetrics[SM_CYCAPTION] - 1 - bmsz.cy) / 2,
bmsz.cx, bmsz.cy, hdcMem, 0, 0, SRCCOPY );
DeleteDC32( hdcMem );
}
return;
......@@ -1150,6 +1160,7 @@ static void NC_DrawMinButton95(
WND *wndPtr = WIN_FindWndPtr( hwnd );
SIZE32 bmsz;
HBITMAP32 bm;
HDC32 hdcMem;
if( !(wndPtr->flags & WIN_MANAGED) &&
GetBitmapDimensionEx32((bm = down ? hbitmapMinimizeD :
......@@ -1164,10 +1175,12 @@ static void NC_DrawMinButton95(
rect.right += -1 -
(sysMetrics[SM_CXSIZE] + bmsz.cx) / 2;
GRAPH_DrawBitmap( hdc, bm, rect.right -
(sysMetrics[SM_CXSIZE] + bmsz.cx) / 2,
rect.top + (sysMetrics[SM_CYCAPTION] - 1 - bmsz.cy) / 2,
0, 0, bmsz.cx, bmsz.cy, FALSE );
hdcMem = CreateCompatibleDC32( hdc );
SelectObject32( hdc, bm );
BitBlt32( hdc, rect.right - (sysMetrics[SM_CXSIZE] + bmsz.cx) / 2,
rect.top + (sysMetrics[SM_CYCAPTION] - 1 - bmsz.cy) / 2,
bmsz.cx, bmsz.cy, hdcMem, 0, 0, SRCCOPY );
DeleteDC32( hdcMem );
}
return;
......@@ -1219,39 +1232,35 @@ static void NC_DrawFrame( HDC32 hdc, RECT32 *rect, BOOL32 dlgFrame,
}
else
{
POINT32 lpt[16];
INT32 decYOff = SYSMETRICS_CXFRAME + SYSMETRICS_CXSIZE;
INT32 decXOff = SYSMETRICS_CYFRAME + SYSMETRICS_CYSIZE;
/* Draw inner rectangle */
GRAPH_DrawRectangle( hdc, rect->left + width,
rect->top + height,
rect->right - rect->left - 2*width ,
rect->bottom - rect->top - 2*height,
(HPEN32)0 );
SelectObject32( hdc, GetStockObject32(NULL_BRUSH) );
Rectangle32( hdc, rect->left + width, rect->top + height,
rect->right - width , rect->bottom - height );
/* Draw the decorations */
lpt[4].x = lpt[0].x = rect->left;
lpt[5].x = lpt[1].x = rect->left + width;
lpt[6].x = lpt[2].x = rect->right - 1;
lpt[7].x = lpt[3].x = rect->right - width - 1;
lpt[0].y = lpt[1].y = lpt[2].y = lpt[3].y =
rect->top + SYSMETRICS_CYFRAME + SYSMETRICS_CYSIZE;
lpt[4].y = lpt[5].y = lpt[6].y = lpt[7].y =
rect->bottom - SYSMETRICS_CYFRAME - SYSMETRICS_CYSIZE;
lpt[8].x = lpt[9].x = lpt[10].x = lpt[11].x =
rect->left + SYSMETRICS_CXFRAME + SYSMETRICS_CXSIZE;
lpt[12].x = lpt[13].x = lpt[14].x = lpt[15].x =
rect->right - SYSMETRICS_CXFRAME - SYSMETRICS_CYSIZE;
lpt[12].y = lpt[8].y = rect->top;
lpt[13].y = lpt[9].y = rect->top + height;
lpt[14].y = lpt[10].y = rect->bottom - 1;
lpt[15].y = lpt[11].y = rect->bottom - height - 1;
MoveToEx32( hdc, rect->left, rect->top + decYOff, NULL );
LineTo32( hdc, rect->left + width, rect->top + decYOff );
MoveToEx32( hdc, rect->right - 1, rect->top + decYOff, NULL );
LineTo32( hdc, rect->right - width - 1, rect->top + decYOff );
MoveToEx32( hdc, rect->left, rect->bottom - decYOff, NULL );
LineTo32( hdc, rect->left + width, rect->bottom - decYOff );
MoveToEx32( hdc, rect->right - 1, rect->bottom - decYOff, NULL );
LineTo32( hdc, rect->right - width - 1, rect->bottom - decYOff );
MoveToEx32( hdc, rect->left + decXOff, rect->top, NULL );
LineTo32( hdc, rect->left + decXOff, rect->top + height);
MoveToEx32( hdc, rect->left + decXOff, rect->bottom - 1, NULL );
LineTo32( hdc, rect->left + decXOff, rect->bottom - height - 1 );
MoveToEx32( hdc, rect->right - decXOff, rect->top, NULL );
LineTo32( hdc, rect->right - decXOff, rect->top + height );
MoveToEx32( hdc, rect->right - decXOff, rect->bottom - 1, NULL );
LineTo32( hdc, rect->right - decXOff, rect->bottom - height - 1 );
GRAPH_DrawLines( hdc, lpt, 8, (HPEN32)0 ); /* 8 is the maximum */
InflateRect32( rect, -width - 1, -height - 1 );
}
}
......@@ -1453,12 +1462,14 @@ static void NC_DrawCaption95(
RECT32 r = *rect;
WND *wndPtr = WIN_FindWndPtr( hwnd );
char buffer[256];
POINT32 sep[2] = { { r.left, r.bottom - 1 },
{ r.right, r.bottom - 1 } };
HPEN32 hPrevPen;
if (wndPtr->flags & WIN_MANAGED) return;
GRAPH_DrawLines( hdc, sep, 1, GetSysColorPen32(COLOR_3DFACE) );
hPrevPen = SelectObject32( hdc, GetSysColorPen32(COLOR_3DFACE) );
MoveToEx32( hdc, r.left, r.bottom - 1, NULL );
LineTo32( hdc, r.right, r.bottom - 1 );
SelectObject32( hdc, hPrevPen );
r.bottom--;
FillRect32( hdc, &r, GetSysColorBrush32(active ? COLOR_ACTIVECAPTION :
......@@ -1556,8 +1567,8 @@ void NC_DoNCPaint( WND* wndPtr, HRGN32 clip, BOOL32 suppress_menupaint )
if ((wndPtr->dwStyle & WS_BORDER) || (wndPtr->dwStyle & WS_DLGFRAME) ||
(wndPtr->dwExStyle & WS_EX_DLGMODALFRAME))
{
GRAPH_DrawRectangle( hdc, 0, 0,
rect.right, rect.bottom, (HPEN32)0 );
SelectObject32( hdc, GetStockObject32(NULL_BRUSH) );
Rectangle32( hdc, 0, 0, rect.right, rect.bottom );
InflateRect32( &rect, -1, -1 );
}
......
......@@ -15,7 +15,6 @@
#include "gdi.h"
#include "dce.h"
#include "region.h"
#include "graphics.h"
#include "sysmetrics.h"
#include "debug.h"
#include "x11drv.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment