Some cleanup.

svn path=/trunk/; revision=4036
This commit is contained in:
Eugene Ingerman 2003-01-19 01:01:00 +00:00
parent 58c9054f3f
commit 898f490858

View file

@ -1,4 +1,4 @@
/* $Id: dc.c,v 1.43 2002/10/01 06:41:55 ei Exp $ /* $Id: dc.c,v 1.44 2003/01/19 01:01:00 ei Exp $
* *
* DC.C - Device context functions * DC.C - Device context functions
* *
@ -7,6 +7,7 @@
#undef WIN32_LEAN_AND_MEAN #undef WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <ddk/ntddvid.h>
#include <win32k/bitmaps.h> #include <win32k/bitmaps.h>
#include <win32k/coord.h> #include <win32k/coord.h>
@ -22,6 +23,8 @@
//#define NDEBUG //#define NDEBUG
#include <win32k/debug1.h> #include <win32k/debug1.h>
static GDIDEVICE PrimarySurface;
static BOOL PrimarySurfaceCreated = FALSE;
/* FIXME: DCs should probably be thread safe */ /* FIXME: DCs should probably be thread safe */
@ -156,8 +159,6 @@ HDC STDCALL W32kCreateCompatableDC(HDC hDC)
NewDC->vportExtY = OrigDC->vportExtY; NewDC->vportExtY = OrigDC->vportExtY;
} }
DC_InitDC(hNewDC);
/* Create default bitmap */ /* Create default bitmap */
if (!(hBitmap = W32kCreateBitmap( 1, 1, 1, 1, NULL ))) if (!(hBitmap = W32kCreateBitmap( 1, 1, 1, 1, NULL )))
{ {
@ -178,15 +179,11 @@ HDC STDCALL W32kCreateCompatableDC(HDC hDC)
} }
DC_ReleasePtr( hDC ); DC_ReleasePtr( hDC );
DC_ReleasePtr( hNewDC ); DC_ReleasePtr( hNewDC );
DC_InitDC(hNewDC);
return hNewDC; return hNewDC;
} }
#include <ddk/ntddvid.h>
static GDIDEVICE PrimarySurface;
static BOOL PrimarySurfaceCreated = FALSE;
BOOL STDCALL W32kCreatePrimarySurface(LPCWSTR Driver, BOOL STDCALL W32kCreatePrimarySurface(LPCWSTR Driver,
LPCWSTR Device) LPCWSTR Device)
{ {
@ -338,13 +335,13 @@ HDC STDCALL W32kCreateDC(LPCWSTR Driver,
DPRINT("Bits per pel: %u\n", NewDC->w.bitsPerPixel); DPRINT("Bits per pel: %u\n", NewDC->w.bitsPerPixel);
NewDC->w.hVisRgn = W32kCreateRectRgn(0, 0, 640, 480);
DC_ReleasePtr( hNewDC );
/* Initialize the DC state */ /* Initialize the DC state */
DC_InitDC(hNewDC); DC_InitDC(hNewDC);
NewDC->w.hVisRgn = W32kCreateRectRgn(0, 0, 640, 480);
W32kSetTextColor(hNewDC, RGB(0, 0, 0)); W32kSetTextColor(hNewDC, RGB(0, 0, 0));
W32kSetTextAlign(hNewDC, TA_TOP); W32kSetTextAlign(hNewDC, TA_TOP);
DC_ReleasePtr( hNewDC );
return hNewDC; return hNewDC;
} }
@ -1217,20 +1214,19 @@ HDC DC_FindOpenDC(LPCWSTR Driver)
return NULL; return NULL;
} }
/*!
* Initialize some common fields in the Device Context structure.
*/
void DC_InitDC(HDC DCHandle) void DC_InitDC(HDC DCHandle)
{ {
// W32kRealizeDefaultPalette(DCHandle); // W32kRealizeDefaultPalette(DCHandle);
PDC DCToInit;
if( (DCToInit = DC_HandleToPtr( DCHandle ) ) ){ W32kSelectObject(DCHandle, W32kGetStockObject( WHITE_BRUSH ));
W32kSetTextColor(DCHandle, DCToInit->w.textColor); //W32kSelectObject(DCHandle, hPen);
W32kSetBkColor(DCHandle, DCToInit->w.backgroundColor); //W32kSelectObject(DCHandle, hFont);
W32kSelectObject(DCHandle, DCToInit->w.hPen);
W32kSelectObject(DCHandle, W32kGetStockObject( GRAY_BRUSH )); //FIXME: default should be WHITE_BRUSH
W32kSelectObject(DCHandle, DCToInit->w.hFont);
}
else
DPRINT("DC_InitDC: can't get dc for handle %d\n", DCHandle );
// CLIPPING_UpdateGCRegion(DCToInit); // CLIPPING_UpdateGCRegion(DCToInit);
} }
void DC_FreeDC(HDC DCToFree) void DC_FreeDC(HDC DCToFree)