Author: tkreuzer Date: Wed May 19 18:23:33 2010 New Revision: 47278
URL: http://svn.reactos.org/svn/reactos?rev=47278&view=rev Log: [WIN32K] Simplify EXLATEOBJ_vInitXlateFromDCs and remove EXLATEOBJ_vInitBrushXlate. Less code, more fun.
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/engbrush.c branches/reactos-yarotows/subsystems/win32/win32k/eng/xlate.c branches/reactos-yarotows/subsystems/win32/win32k/include/xlateobj.h
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/engbrush.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/eng/engbrush.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/eng/engbrush.c [iso-8859-1] Wed May 19 18:23:33 2010 @@ -217,16 +217,18 @@
psurfPattern = SURFACE_ShareLockSurface(pebo->pbrush->hbmPattern); ASSERT(psurfPattern); + ASSERT(psurfPattern->ppal);
/* FIXME: implement mask */ psurfMask = NULL;
/* Initialize XLATEOBJ for the brush */ - EXLATEOBJ_vInitBrushXlate(&exlo, - pebo->pbrush, - pebo->psurfTrg, - pebo->crCurrentText, - pebo->crCurrentBack); + EXLATEOBJ_vInitialize(&exlo, + psurfPattern->ppal, + pebo->psurfTrg->ppal, + 0, + pebo->crCurrentBack, + pebo->crCurrentText);
/* Create the realization */ bResult = pfnRealzizeBrush(&pebo->BrushObject,
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/xlate.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/eng/xlate.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/eng/xlate.c [iso-8859-1] Wed May 19 18:23:33 2010 @@ -603,88 +603,24 @@ PDC pdcDst) { PSURFACE psurfDst, psurfSrc; - PPALETTE ppalSrc, ppalDst, ppalDstDc; - - DPRINT("Enter EXLATEOBJ_vInitXlateFromDCs\n"); - - /* Do basic init */ - EXLATEOBJ_vInitTrivial(pexlo);
psurfDst = pdcDst->dclevel.pSurface; psurfSrc = pdcSrc->dclevel.pSurface;
+ /* Check for trivial color translation */ if (psurfDst == psurfSrc) { + EXLATEOBJ_vInitTrivial(pexlo); return; }
- ppalSrc = psurfSrc->ppal; - - if(!ppalSrc) - { - DPRINT1("No palette for src surface %p.\n", psurfSrc); - return; - } - - ppalDst = psurfDst->ppal; - - if (!ppalDst) - { - DPRINT1("No palette for dst surface %p.\n", psurfDst); - return; - } - - ppalDstDc = pdcDst->dclevel.ppal; - ASSERT(ppalDstDc); - + /* Normal initialisation. No surface means DEFAULT_BITMAP */ EXLATEOBJ_vInitialize(pexlo, - ppalSrc, - ppalDst, + psurfSrc ? psurfSrc->ppal : &gpalMono, + psurfDst ? psurfDst->ppal : &gpalMono, pdcSrc->pdcattr->crBackgroundClr, pdcDst->pdcattr->crBackgroundClr, pdcDst->pdcattr->crForegroundClr); -} - - -VOID -NTAPI -EXLATEOBJ_vInitBrushXlate( - PEXLATEOBJ pexlo, - BRUSH *pbrush, - SURFACE *psurfDst, - COLORREF crForegroundClr, - COLORREF crBackgroundClr) -{ - PPALETTE ppalDst; - SURFACE *psurfPattern; - - ASSERT(pexlo); - ASSERT(pbrush); - ASSERT(psurfDst); - ASSERT(!(pbrush->flAttrs & (GDIBRUSH_IS_SOLID | GDIBRUSH_IS_NULL))); - - EXLATEOBJ_vInitTrivial(pexlo); - - ppalDst = psurfDst->ppal; - - if (!ppalDst) - { - DPRINT1("No palette for dst surface %p.\n", psurfDst); - return; - } - - psurfPattern = SURFACE_ShareLockSurface(pbrush->hbmPattern); - if (!psurfPattern) - { - return; - } - - if (psurfPattern->ppal) - { - EXLATEOBJ_vInitialize(pexlo, psurfPattern->ppal, ppalDst, 0, crBackgroundClr, crForegroundClr); - } - - SURFACE_ShareUnlockSurface(psurfPattern); }
VOID
Modified: branches/reactos-yarotows/subsystems/win32/win32k/include/xlateobj.h URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/include/xlateobj.h [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/include/xlateobj.h [iso-8859-1] Wed May 19 18:23:33 2010 @@ -45,7 +45,6 @@
VOID NTAPI EXLATEOBJ_vInitialize(PEXLATEOBJ pexlo, PALETTE *ppalSrc, PALETTE *ppalDst, ULONG, ULONG, ULONG); VOID NTAPI EXLATEOBJ_vInitXlateFromDCs(PEXLATEOBJ pexlo, PDC pdcSrc, PDC pdcDst); -VOID NTAPI EXLATEOBJ_vInitBrushXlate(PEXLATEOBJ pexlo, BRUSH *pbrush, SURFACE *psurf, COLORREF crForegroundClr, COLORREF crBackgroundClr); VOID NTAPI EXLATEOBJ_vInitSrcMonoXlate(PEXLATEOBJ pexlo, PPALETTE ppalDst, ULONG Color0, ULONG Color1); VOID NTAPI EXLATEOBJ_vCleanup(PEXLATEOBJ pexlo);