Author: jimtabor
Date: Wed Apr 7 02:46:16 2010
New Revision: 46758
URL:
http://svn.reactos.org/svn/reactos?rev=46758&view=rev
Log:
[Win32k|Gdi32]
- Enable font batch and fixed setting brush origion. Use the new delete object functions
in win32k.
Modified:
trunk/reactos/dll/win32/gdi32/objects/dc.c
trunk/reactos/subsystems/win32/win32k/include/coord.h
trunk/reactos/subsystems/win32/win32k/include/gdiobj.h
trunk/reactos/subsystems/win32/win32k/objects/brush.c
trunk/reactos/subsystems/win32/win32k/objects/coord.c
trunk/reactos/subsystems/win32/win32k/objects/dclife.c
trunk/reactos/subsystems/win32/win32k/objects/font.c
trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c
Modified: trunk/reactos/dll/win32/gdi32/objects/dc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/dc…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/dc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdi32/objects/dc.c [iso-8859-1] Wed Apr 7 02:46:16 2010
@@ -1540,7 +1540,7 @@
PDC_ATTR pDc_Attr;
HGDIOBJ hOldObj = NULL;
UINT uType;
-// PTEB pTeb;
+ PTEB pTeb;
if(!GdiGetHandleUserData(hDC, GDI_OBJECT_TYPE_DC, (PVOID)&pDc_Attr))
{
@@ -1582,7 +1582,6 @@
case GDI_OBJECT_TYPE_FONT:
hOldObj = pDc_Attr->hlfntNew;
if (hOldObj == hGdiObj) return hOldObj;
-#if 0
pDc_Attr->ulDirty_ &= ~SLOW_WIDTHS;
pDc_Attr->ulDirty_ |= DIRTY_CHARSET;
pDc_Attr->hlfntNew = hGdiObj;
@@ -1604,7 +1603,6 @@
if (pTeb->GdiBatchCount >= GDI_BatchLimit) NtGdiFlush();
return hOldObj;
}
-#endif
// default for select object font
return NtGdiSelectFont(hDC, hGdiObj);
Modified: trunk/reactos/subsystems/win32/win32k/include/coord.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/coord.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/coord.h [iso-8859-1] Wed Apr 7 02:46:16
2010
@@ -18,4 +18,6 @@
DWORD Mode);
VOID FASTCALL IntMirrorWindowOrg(PDC);
-void FASTCALL IntFixIsotropicMapping(PDC dc);
+void FASTCALL IntFixIsotropicMapping(PDC);
+LONG FASTCALL IntCalcFillOrigin(PDC);
+PPOINTL FASTCALL IntptlBrushOrigin(PDC pdc,LONG,LONG);
Modified: trunk/reactos/subsystems/win32/win32k/include/gdiobj.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/gdiobj.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/gdiobj.h [iso-8859-1] Wed Apr 7
02:46:16 2010
@@ -131,3 +131,6 @@
#endif
INT FASTCALL GreGetObjectOwner(HGDIOBJ, GDIOBJTYPE);
+
+#define GDIOBJ_GetKernelObj(Handle) \
+
((PGDI_TABLE_ENTRY)&GdiHandleTable->Entries[GDI_HANDLE_GET_INDEX(Handle)])->KernelData
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] Wed Apr 7 02:46:16
2010
@@ -709,6 +709,7 @@
pdcattr->ptlBrushOrigin.x = XOrg;
pdcattr->ptlBrushOrigin.y = YOrg;
+ IntptlBrushOrigin(dc, XOrg, YOrg );
DC_UnlockDc(dc);
return TRUE;
Modified: trunk/reactos/subsystems/win32/win32k/objects/coord.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/coord.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/coord.c [iso-8859-1] Wed Apr 7 02:46:16
2010
@@ -1133,6 +1133,16 @@
return pdc->ptlFillOrigin.y;
}
+PPOINTL
+FASTCALL
+IntptlBrushOrigin(PDC pdc, LONG x, LONG y )
+{
+ pdc->dclevel.ptlBrushOrigin.x = x;
+ pdc->dclevel.ptlBrushOrigin.y = y;
+ IntCalcFillOrigin(pdc);
+ return &pdc->dclevel.ptlBrushOrigin;
+}
+
VOID
APIENTRY
GdiSetDCOrg(HDC hDC, LONG Left, LONG Top, PRECTL prc)
Modified: trunk/reactos/subsystems/win32/win32k/objects/dclife.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] Wed Apr 7
02:46:16 2010
@@ -119,6 +119,8 @@
pdcattr->hlfntNew = NtGdiGetStockObject(SYSTEM_FONT);
TextIntRealizeFont(pdcattr->hlfntNew,NULL);
+ NewDC->hlfntCur = pdcattr->hlfntNew;
+ NewDC->dclevel.plfnt = GDIOBJ_GetKernelObj(pdcattr->hlfntNew);
NewDC->dclevel.hpal = NtGdiGetStockObject(DEFAULT_PALETTE);
NewDC->dclevel.ppal = PALETTE_ShareLockPalette(NewDC->dclevel.hpal);
@@ -763,32 +765,14 @@
APIENTRY
NtGdiDeleteObjectApp(HANDLE DCHandle)
{
- /* Complete all pending operations */
- NtGdiFlushUserBatch();
-
- if (GDI_HANDLE_IS_STOCKOBJ(DCHandle)) return TRUE;
-
- if (GDI_HANDLE_GET_TYPE(DCHandle) != GDI_OBJECT_TYPE_DC)
- return GreDeleteObject((HGDIOBJ) DCHandle);
-
- if (IsObjectDead((HGDIOBJ)DCHandle)) return TRUE;
-
- if (!GDIOBJ_OwnedByCurrentProcess(DCHandle))
- {
- SetLastWin32Error(ERROR_INVALID_HANDLE);
- return FALSE;
- }
-
- return IntGdiDeleteDC(DCHandle, FALSE);
-}
-
-BOOL
-APIENTRY
-NewNtGdiDeleteObjectApp(HANDLE DCHandle)
-{
GDIOBJTYPE ObjType;
+ /* Complete all pending operations */
+ NtGdiFlushUserBatch();
+
if (GDI_HANDLE_IS_STOCKOBJ(DCHandle)) return TRUE;
+
+ if (IsObjectDead((HGDIOBJ)DCHandle)) return TRUE;
ObjType = GDI_HANDLE_GET_TYPE(DCHandle) >> GDI_ENTRY_UPPER_SHIFT;
Modified: trunk/reactos/subsystems/win32/win32k/objects/font.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/font.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/font.c [iso-8859-1] Wed Apr 7 02:46:16
2010
@@ -249,6 +249,49 @@
}
}
return pTextObj;
+}
+
+HFONT
+FASTCALL
+GreSelectFont( HDC hDC, HFONT hFont)
+{
+ PDC pdc;
+ PDC_ATTR pdcattr;
+ PTEXTOBJ pOrgFnt, pNewFnt = NULL;
+ HFONT hOrgFont = NULL;
+
+ if (!hDC || !hFont) return NULL;
+
+ pdc = DC_LockDc(hDC);
+ if (!pdc)
+ {
+ return NULL;
+ }
+
+ if (NT_SUCCESS(TextIntRealizeFont((HFONT)hFont,NULL)))
+ {
+ /* LFONTOBJ use share and locking. */
+ pNewFnt = TEXTOBJ_LockText(hFont);
+ pdcattr = pdc->pdcattr;
+ pOrgFnt = pdc->dclevel.plfnt;
+ if (pOrgFnt)
+ {
+ hOrgFont = pOrgFnt->BaseObject.hHmgr;
+ }
+ else
+ {
+ hOrgFont = pdcattr->hlfntNew;
+ }
+ pdc->dclevel.plfnt = pNewFnt;
+ pdc->hlfntCur = hFont;
+ pdcattr->hlfntNew = hFont;
+ pdcattr->ulDirty_ |= DIRTY_CHARSET;
+ pdcattr->ulDirty_ &= ~SLOW_WIDTHS;
+ }
+
+ if (pNewFnt) TEXTOBJ_UnlockText(pNewFnt);
+ DC_UnlockDc(pdc);
+ return hOrgFont;
}
/** Functions ******************************************************************/
@@ -933,30 +976,7 @@
IN HDC hDC,
IN HFONT hFont)
{
- PDC pDC;
- PDC_ATTR pdcattr;
- HFONT hOrgFont = NULL;
-
- if (hDC == NULL || hFont == NULL) return NULL;
-
- pDC = DC_LockDc(hDC);
- if (!pDC)
- {
- return NULL;
- }
-
- pdcattr = pDC->pdcattr;
-
- /* FIXME: what if not successful? */
- if(NT_SUCCESS(TextIntRealizeFont((HFONT)hFont,NULL)))
- {
- hOrgFont = pdcattr->hlfntNew;
- pdcattr->hlfntNew = hFont;
- }
-
- DC_UnlockDc(pDC);
-
- return hOrgFont;
+ return GreSelectFont(hDC, hFont);
}
Modified: trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c [iso-8859-1] Wed Apr 7
02:46:16 2010
@@ -106,9 +106,10 @@
case GdiBCSetBrushOrg:
{
PGDIBSSETBRHORG pgSBO;
- if(!dc) break;
+ if (!dc) break;
pgSBO = (PGDIBSSETBRHORG) pHdr;
pdcattr->ptlBrushOrigin = pgSBO->ptlBrushOrigin;
+ IntptlBrushOrigin(dc, pgSBO->ptlBrushOrigin.x, pgSBO->ptlBrushOrigin.y);
break;
}
case GdiBCExtSelClipRgn:
@@ -116,10 +117,34 @@
case GdiBCSelObj:
{
PGDIBSOBJECT pgO;
- if(!dc) break;
+ PTEXTOBJ pOrgFnt, pNewFnt = NULL;
+ HFONT hOrgFont = NULL;
+
+ if (!dc) break;
pgO = (PGDIBSOBJECT) pHdr;
- TextIntRealizeFont((HFONT) pgO->hgdiobj, NULL);
- pdcattr->ulDirty_ &= ~(DIRTY_CHARSET);
+
+ if (NT_SUCCESS(TextIntRealizeFont((HFONT)pgO->hgdiobj,NULL)))
+ {
+ /* LFONTOBJ use share and locking. */
+ pNewFnt = TEXTOBJ_LockText(pgO->hgdiobj);
+
+ pOrgFnt = dc->dclevel.plfnt;
+ if (pOrgFnt)
+ {
+ hOrgFont = pOrgFnt->BaseObject.hHmgr;
+ }
+ else
+ {
+ hOrgFont = pdcattr->hlfntNew;
+ }
+ dc->dclevel.plfnt = pNewFnt;
+ dc->hlfntCur = pgO->hgdiobj;
+ pdcattr->hlfntNew = pgO->hgdiobj;
+ pdcattr->ulDirty_ |= DIRTY_CHARSET;
+ pdcattr->ulDirty_ &= ~SLOW_WIDTHS;
+ }
+ if (pNewFnt) TEXTOBJ_UnlockText(pNewFnt);
+ break;
}
case GdiBCDelRgn:
DPRINT("Delete Region Object!\n");