Author: tkreuzer
Date: Thu Mar 26 01:14:20 2009
New Revision: 40242
URL:
http://svn.reactos.org/svn/reactos?rev=40242&view=rev
Log:
Move NtGdiSelectClipPath, Nt/IntGdiSelectBrush, Nt/IntGdiSelectpen to dcobj.c, improve
formatting, no code change.
Modified:
trunk/reactos/subsystems/win32/win32k/objects/brush.c
trunk/reactos/subsystems/win32/win32k/objects/dcobjs.c
trunk/reactos/subsystems/win32/win32k/objects/path.c
trunk/reactos/subsystems/win32/win32k/objects/pen.c
Modified: trunk/reactos/subsystems/win32/win32k/objects/brush.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/brush.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/brush.c [iso-8859-1] Thu Mar 26 01:14:20
2009
@@ -482,50 +482,6 @@
BRUSH_UnlockBrush(pbrush);
return hBrush;
-}
-
-HBRUSH
-FASTCALL
-IntGdiSelectBrush(
- PDC pDC,
- HBRUSH hBrush)
-{
- PDC_ATTR pdcattr;
- HBRUSH hOrgBrush;
- PBRUSH pbrush;
- XLATEOBJ *XlateObj;
- BOOLEAN bFailed;
-
- if (pDC == NULL || hBrush == NULL) return NULL;
-
- pdcattr = pDC->pdcattr;
-
- pbrush = BRUSH_LockBrush(hBrush);
- if (pbrush == NULL)
- {
- SetLastWin32Error(ERROR_INVALID_HANDLE);
- return NULL;
- }
-
- XlateObj = IntGdiCreateBrushXlate(pDC, pbrush, &bFailed);
- BRUSH_UnlockBrush(pbrush);
- if(bFailed)
- {
- return NULL;
- }
-
- hOrgBrush = pdcattr->hbrush;
- pdcattr->hbrush = hBrush;
-
- if (pDC->rosdc.XlateBrush != NULL)
- {
- EngDeleteXlate(pDC->rosdc.XlateBrush);
- }
- pDC->rosdc.XlateBrush = XlateObj;
-
- pdcattr->ulDirty_ &= ~DC_BRUSH_DIRTY;
-
- return hOrgBrush;
}
@@ -675,31 +631,4 @@
BRUSH_UnlockBrush(pbrush);
}
- /*
- * @implemented
- */
-HBRUSH
-APIENTRY
-NtGdiSelectBrush(
- IN HDC hDC,
- IN HBRUSH hBrush)
-{
- PDC pDC;
- HBRUSH hOrgBrush;
-
- if (hDC == NULL || hBrush == NULL) return NULL;
-
- pDC = DC_LockDc(hDC);
- if (!pDC)
- {
- return NULL;
- }
-
- hOrgBrush = IntGdiSelectBrush(pDC,hBrush);
-
- DC_UnlockDc(pDC);
-
- return hOrgBrush;
-}
-
/* EOF */
Modified: trunk/reactos/subsystems/win32/win32k/objects/dcobjs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dcobjs.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dcobjs.c [iso-8859-1] Thu Mar 26
01:14:20 2009
@@ -164,8 +164,309 @@
}
}
-
-
+HPALETTE
+FASTCALL
+GdiSelectPalette(
+ HDC hDC,
+ HPALETTE hpal,
+ BOOL ForceBackground)
+{
+ PDC pdc;
+ HPALETTE oldPal = NULL;
+ PPALGDI ppal;
+
+ // FIXME: mark the palette as a [fore\back]ground pal
+ pdc = DC_LockDc(hDC);
+ if (!pdc)
+ {
+ return NULL;
+ }
+
+ /* Check if this is a valid palette handle */
+ ppal = PALETTE_LockPalette(hpal);
+ if (!ppal)
+ {
+ DC_UnlockDc(pdc);
+ return NULL;
+ }
+
+ /* Is this a valid palette for this depth? */
+ if ((pdc->rosdc.bitsPerPixel <= 8 && ppal->Mode == PAL_INDEXED) ||
+ (pdc->rosdc.bitsPerPixel > 8 && ppal->Mode != PAL_INDEXED))
+ {
+ oldPal = pdc->dclevel.hpal;
+ pdc->dclevel.hpal = hpal;
+ }
+ else if (pdc->rosdc.bitsPerPixel > 8 && ppal->Mode == PAL_INDEXED)
+ {
+ oldPal = pdc->dclevel.hpal;
+ pdc->dclevel.hpal = hpal;
+ }
+
+ PALETTE_UnlockPalette(ppal);
+ DC_UnlockDc(pdc);
+
+ return oldPal;
+}
+
+HBRUSH
+FASTCALL
+IntGdiSelectBrush(
+ PDC pDC,
+ HBRUSH hBrush)
+{
+ PDC_ATTR pdcattr;
+ HBRUSH hOrgBrush;
+ PBRUSH pbrush;
+ XLATEOBJ *XlateObj;
+ BOOLEAN bFailed;
+
+ if (pDC == NULL || hBrush == NULL) return NULL;
+
+ pdcattr = pDC->pdcattr;
+
+ pbrush = BRUSH_LockBrush(hBrush);
+ if (pbrush == NULL)
+ {
+ SetLastWin32Error(ERROR_INVALID_HANDLE);
+ return NULL;
+ }
+
+ XlateObj = IntGdiCreateBrushXlate(pDC, pbrush, &bFailed);
+ BRUSH_UnlockBrush(pbrush);
+ if(bFailed)
+ {
+ return NULL;
+ }
+
+ hOrgBrush = pdcattr->hbrush;
+ pdcattr->hbrush = hBrush;
+
+ if (pDC->rosdc.XlateBrush != NULL)
+ {
+ EngDeleteXlate(pDC->rosdc.XlateBrush);
+ }
+ pDC->rosdc.XlateBrush = XlateObj;
+
+ pdcattr->ulDirty_ &= ~DC_BRUSH_DIRTY;
+
+ return hOrgBrush;
+}
+
+HPEN
+FASTCALL
+IntGdiSelectPen(
+ PDC pDC,
+ HPEN hPen)
+{
+ PDC_ATTR pdcattr;
+ HPEN hOrgPen = NULL;
+ PBRUSH pbrushPen;
+ XLATEOBJ *XlateObj;
+ BOOLEAN bFailed;
+
+ if (pDC == NULL || hPen == NULL) return NULL;
+
+ pdcattr = pDC->pdcattr;
+
+ pbrushPen = PEN_LockPen(hPen);
+ if (pbrushPen == NULL)
+ {
+ return NULL;
+ }
+
+ XlateObj = IntGdiCreateBrushXlate(pDC, pbrushPen, &bFailed);
+ PEN_UnlockPen(pbrushPen);
+ if (bFailed)
+ {
+ SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES);
+ return NULL;
+ }
+
+ hOrgPen = pdcattr->hpen;
+ pdcattr->hpen = hPen;
+
+ if (pDC->rosdc.XlatePen != NULL)
+ {
+ EngDeleteXlate(pDC->rosdc.XlatePen);
+ }
+ pdcattr->ulDirty_ &= ~DC_PEN_DIRTY;
+
+ pDC->rosdc.XlatePen = XlateObj;
+
+ return hOrgPen;
+}
+
+
+ /*
+ * @implemented
+ */
+HBRUSH
+APIENTRY
+NtGdiSelectBrush(
+ IN HDC hDC,
+ IN HBRUSH hBrush)
+{
+ PDC pDC;
+ HBRUSH hOrgBrush;
+
+ if (hDC == NULL || hBrush == NULL) return NULL;
+
+ pDC = DC_LockDc(hDC);
+ if (!pDC)
+ {
+ return NULL;
+ }
+
+ hOrgBrush = IntGdiSelectBrush(pDC,hBrush);
+
+ DC_UnlockDc(pDC);
+
+ return hOrgBrush;
+}
+
+ /*
+ * @implemented
+ */
+HPEN
+APIENTRY
+NtGdiSelectPen(
+ IN HDC hDC,
+ IN HPEN hPen)
+{
+ PDC pDC;
+ HPEN hOrgPen;
+
+ if (hDC == NULL || hPen == NULL) return NULL;
+
+ pDC = DC_LockDc(hDC);
+ if (!pDC)
+ {
+ return NULL;
+ }
+
+ hOrgPen = IntGdiSelectPen(pDC, hPen);
+
+ DC_UnlockDc(pDC);
+
+ return hOrgPen;
+}
+
+BOOL
+APIENTRY
+NtGdiSelectClipPath(
+ HDC hDC,
+ int Mode)
+{
+ HRGN hrgnPath;
+ PPATH pPath;
+ BOOL success = FALSE;
+ PDC_ATTR pdcattr;
+ PDC pdc;
+
+ pdc = DC_LockDc(hDC);
+ if (!pdc)
+ {
+ SetLastWin32Error(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+ pdcattr = pdc->pdcattr;
+
+ pPath = PATH_LockPath(pdc->dclevel.hPath);
+ if (!pPath)
+ {
+ DC_UnlockDc(pdc);
+ return FALSE;
+ }
+
+ /* Check that path is closed */
+ if (pPath->state != PATH_Closed)
+ {
+ SetLastWin32Error(ERROR_CAN_NOT_COMPLETE);
+ return FALSE;
+ }
+
+ /* Construct a region from the path */
+ else if (PATH_PathToRegion(pPath, pdcattr->jFillMode, &hrgnPath))
+ {
+ success = GdiExtSelectClipRgn(pdc, hrgnPath, Mode) != ERROR;
+ GreDeleteObject( hrgnPath );
+
+ /* Empty the path */
+ if (success)
+ PATH_EmptyPath(pPath);
+
+ /* FIXME: Should this function delete the path even if it failed? */
+ }
+
+ PATH_UnlockPath(pPath);
+ DC_UnlockDc(pdc);
+
+ return success;
+}
+
+HANDLE
+APIENTRY
+NtGdiGetDCObject(HDC hDC, INT ObjectType)
+{
+ HGDIOBJ SelObject;
+ DC *pdc;
+ PDC_ATTR pdcattr;
+
+ /* From Wine: GetCurrentObject does not SetLastError() on a null object */
+ if(!hDC) return NULL;
+
+ if(!(pdc = DC_LockDc(hDC)))
+ {
+ SetLastWin32Error(ERROR_INVALID_HANDLE);
+ return NULL;
+ }
+ pdcattr = pdc->pdcattr;
+
+ if (pdcattr->ulDirty_ & DC_BRUSH_DIRTY)
+ IntGdiSelectBrush(pdc, pdcattr->hbrush);
+
+ if (pdcattr->ulDirty_ & DC_PEN_DIRTY)
+ IntGdiSelectPen(pdc, pdcattr->hpen);
+
+ switch(ObjectType)
+ {
+ case GDI_OBJECT_TYPE_EXTPEN:
+ case GDI_OBJECT_TYPE_PEN:
+ SelObject = pdcattr->hpen;
+ break;
+
+ case GDI_OBJECT_TYPE_BRUSH:
+ SelObject = pdcattr->hbrush;
+ break;
+
+ case GDI_OBJECT_TYPE_PALETTE:
+ SelObject = pdc->dclevel.hpal;
+ break;
+
+ case GDI_OBJECT_TYPE_FONT:
+ SelObject = pdcattr->hlfntNew;
+ break;
+
+ case GDI_OBJECT_TYPE_BITMAP:
+ SelObject = pdc->rosdc.hBitmap;
+ break;
+
+ case GDI_OBJECT_TYPE_COLORSPACE:
+ DPRINT1("FIXME: NtGdiGetCurrentObject() ObjectType OBJ_COLORSPACE not
supported yet!\n");
+ // SelObject = dc->dclevel.pColorSpace.BaseObject.hHmgr; ?
+ SelObject = NULL;
+ break;
+
+ default:
+ SelObject = NULL;
+ SetLastWin32Error(ERROR_INVALID_PARAMETER);
+ break;
+ }
+
+ DC_UnlockDc(pdc);
+ return SelObject;
+}
ULONG
APIENTRY
@@ -175,107 +476,7 @@
IN ULONG cjBuf,
OUT OPTIONAL PVOID pvBuf)
{
- UNIMPLEMENTED;
- return 0;
-}
-
-HANDLE
-APIENTRY
-NtGdiGetDCObject(HDC hDC, INT ObjectType)
-{
- HGDIOBJ SelObject;
- DC *dc;
- PDC_ATTR pdcattr;
-
- /* From Wine: GetCurrentObject does not SetLastError() on a null object */
- if(!hDC) return NULL;
-
- if(!(dc = DC_LockDc(hDC)))
- {
- SetLastWin32Error(ERROR_INVALID_HANDLE);
- return NULL;
- }
- pdcattr = dc->pdcattr;
-
- if (pdcattr->ulDirty_ & DC_BRUSH_DIRTY)
- IntGdiSelectBrush(dc,pdcattr->hbrush);
-
- if (pdcattr->ulDirty_ & DC_PEN_DIRTY)
- IntGdiSelectPen(dc,pdcattr->hpen);
-
- switch(ObjectType)
- {
- case GDI_OBJECT_TYPE_EXTPEN:
- case GDI_OBJECT_TYPE_PEN:
- SelObject = pdcattr->hpen;
- break;
- case GDI_OBJECT_TYPE_BRUSH:
- SelObject = pdcattr->hbrush;
- break;
- case GDI_OBJECT_TYPE_PALETTE:
- SelObject = dc->dclevel.hpal;
- break;
- case GDI_OBJECT_TYPE_FONT:
- SelObject = pdcattr->hlfntNew;
- break;
- case GDI_OBJECT_TYPE_BITMAP:
- SelObject = dc->rosdc.hBitmap;
- break;
- case GDI_OBJECT_TYPE_COLORSPACE:
- DPRINT1("FIXME: NtGdiGetCurrentObject() ObjectType OBJ_COLORSPACE not
supported yet!\n");
- // SelObject = dc->dclevel.pColorSpace.BaseObject.hHmgr; ?
- SelObject = NULL;
- break;
- default:
- SelObject = NULL;
- SetLastWin32Error(ERROR_INVALID_PARAMETER);
- break;
- }
-
- DC_UnlockDc(dc);
- return SelObject;
-}
-
-HPALETTE
-FASTCALL
-GdiSelectPalette(HDC hDC,
- HPALETTE hpal,
- BOOL ForceBackground)
-{
- PDC dc;
- HPALETTE oldPal = NULL;
- PPALGDI PalGDI;
-
- // FIXME: mark the palette as a [fore\back]ground pal
- dc = DC_LockDc(hDC);
- if (!dc)
- {
- return NULL;
- }
-
- /* Check if this is a valid palette handle */
- PalGDI = PALETTE_LockPalette(hpal);
- if (!PalGDI)
- {
- DC_UnlockDc(dc);
- return NULL;
- }
-
- /* Is this a valid palette for this depth? */
- if ((dc->rosdc.bitsPerPixel <= 8 && PalGDI->Mode == PAL_INDEXED) ||
- (dc->rosdc.bitsPerPixel > 8 && PalGDI->Mode != PAL_INDEXED))
- {
- oldPal = dc->dclevel.hpal;
- dc->dclevel.hpal = hpal;
- }
- else if (8 < dc->rosdc.bitsPerPixel && PAL_INDEXED == PalGDI->Mode)
- {
- oldPal = dc->dclevel.hpal;
- dc->dclevel.hpal = hpal;
- }
-
- PALETTE_UnlockPalette(PalGDI);
- DC_UnlockDc(dc);
-
- return oldPal;
-}
+ UNIMPLEMENTED;
+ return 0;
+}
+
Modified: trunk/reactos/subsystems/win32/win32k/objects/path.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/path.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/path.c [iso-8859-1] Thu Mar 26 01:14:20
2009
@@ -2635,51 +2635,4 @@
return Ret;
}
-BOOL
-APIENTRY
-NtGdiSelectClipPath(HDC hDC,
- int Mode)
-{
- HRGN hrgnPath;
- PPATH pPath;
- BOOL success = FALSE;
- PDC_ATTR pdcattr;
- PDC dc = DC_LockDc ( hDC );
-
- if ( !dc )
- {
- SetLastWin32Error(ERROR_INVALID_PARAMETER);
- return FALSE;
- }
-
- pdcattr = dc->pdcattr;
-
- pPath = PATH_LockPath( dc->dclevel.hPath );
- if (!pPath)
- {
- DC_UnlockDc ( dc );
- return FALSE;
- }
- /* Check that path is closed */
- if( pPath->state != PATH_Closed )
- {
- SetLastWin32Error(ERROR_CAN_NOT_COMPLETE);
- return FALSE;
- }
- /* Construct a region from the path */
- else if( PATH_PathToRegion( pPath, pdcattr->jFillMode, &hrgnPath ) )
- {
- success = GdiExtSelectClipRgn( dc, hrgnPath, Mode ) != ERROR;
- GreDeleteObject( hrgnPath );
-
- /* Empty the path */
- if( success )
- PATH_EmptyPath( pPath);
- /* FIXME: Should this function delete the path even if it failed? */
- }
- PATH_UnlockPath( pPath );
- DC_UnlockDc ( dc );
- return success;
-}
-
/* EOF */
Modified: trunk/reactos/subsystems/win32/win32k/objects/pen.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/pen.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/pen.c [iso-8859-1] Thu Mar 26 01:14:20
2009
@@ -276,50 +276,6 @@
}
-HPEN
-FASTCALL
-IntGdiSelectPen(
- PDC pDC,
- HPEN hPen)
-{
- PDC_ATTR pdcattr;
- HPEN hOrgPen = NULL;
- PBRUSH pbrushPen;
- XLATEOBJ *XlateObj;
- BOOLEAN bFailed;
-
- if (pDC == NULL || hPen == NULL) return NULL;
-
- pdcattr = pDC->pdcattr;
-
- pbrushPen = PEN_LockPen(hPen);
- if (pbrushPen == NULL)
- {
- return NULL;
- }
-
- XlateObj = IntGdiCreateBrushXlate(pDC, pbrushPen, &bFailed);
- PEN_UnlockPen(pbrushPen);
- if (bFailed)
- {
- SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES);
- return NULL;
- }
-
- hOrgPen = pdcattr->hpen;
- pdcattr->hpen = hPen;
-
- if (pDC->rosdc.XlatePen != NULL)
- {
- EngDeleteXlate(pDC->rosdc.XlatePen);
- }
- pdcattr->ulDirty_ &= ~DC_PEN_DIRTY;
-
- pDC->rosdc.XlatePen = XlateObj;
-
- return hOrgPen;
-}
-
/* PUBLIC FUNCTIONS ***********************************************************/
HPEN APIENTRY
@@ -439,31 +395,6 @@
return hPen;
}
- /*
- * @implemented
- */
-HPEN
-APIENTRY
-NtGdiSelectPen(
- IN HDC hDC,
- IN HPEN hPen)
-{
- PDC pDC;
- HPEN hOrgPen;
-
- if (hDC == NULL || hPen == NULL) return NULL;
-
- pDC = DC_LockDc(hDC);
- if (!pDC)
- {
- return NULL;
- }
-
- hOrgPen = IntGdiSelectPen(pDC,hPen);
-
- DC_UnlockDc(pDC);
-
- return hOrgPen;
-}
+
/* EOF */