Author: jgardou
Date: Sun May 9 00:10:41 2010
New Revision: 47137
URL:
http://svn.reactos.org/svn/reactos?rev=47137&view=rev
Log:
[WIN32K]
- attach devinfo->hpalDefault to the pdevobj after enabling it
- attach this palette to surfaces attached to this pdevobj through EngModifySurface
- use this palette in several place
Partially fixes icon drawing after mode switch
Modified:
branches/reactos-yarotows/subsystems/win32/win32k/eng/engbrush.c
branches/reactos-yarotows/subsystems/win32/win32k/eng/pdevobj.c
branches/reactos-yarotows/subsystems/win32/win32k/eng/surface.c
branches/reactos-yarotows/subsystems/win32/win32k/eng/xlate.c
branches/reactos-yarotows/subsystems/win32/win32k/include/pdevobj.h
branches/reactos-yarotows/subsystems/win32/win32k/objects/bitblt.c
branches/reactos-yarotows/subsystems/win32/win32k/objects/bitmaps.c
branches/reactos-yarotows/subsystems/win32/win32k/objects/dibobj.c
branches/reactos-yarotows/subsystems/win32/win32k/objects/fillshap.c
branches/reactos-yarotows/subsystems/win32/win32k/objects/freetype.c
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/engbrush.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- 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] Sun May
9 00:10:41 2010
@@ -18,8 +18,6 @@
NTAPI
EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc)
{
- HPALETTE hpal = NULL;
-
ASSERT(pebo);
ASSERT(pbrush);
ASSERT(pdc);
@@ -35,12 +33,20 @@
pebo->crCurrentText = pdc->pdcattr->crForegroundClr;
pebo->psurfTrg = pdc->dclevel.pSurface;
-// ASSERT(pebo->psurfTrg); // FIXME: some dcs don't have a surface
-
- if (pebo->psurfTrg)
- hpal = pebo->psurfTrg->hDIBPalette;
- if (!hpal) hpal = pPrimarySurface->devinfo.hpalDefault;
- pebo->ppalSurf = PALETTE_ShareLockPalette(hpal);
+ ASSERT(pebo->psurfTrg);
+
+ if (pebo->psurfTrg->hDIBPalette)
+ {
+ pebo->ppalSurf = PALETTE_ShareLockPalette(pebo->psurfTrg->hDIBPalette);
+ }
+ else if (pebo->psurfTrg->ppal)
+ {
+ pebo->ppalSurf = pebo->psurfTrg->ppal;
+ GDIOBJ_IncrementShareCount(&pebo->ppalSurf->BaseObject);
+ }
+ else
+ pebo->ppalSurf =
PALETTE_ShareLockPalette(pdc->ppdev->devinfo.hpalDefault);
+
if (!pebo->ppalSurf)
pebo->ppalSurf = &gpalRGB;
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/pdevobj.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/eng/pdevobj.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/eng/pdevobj.c [iso-8859-1] Sun May
9 00:10:41 2010
@@ -63,6 +63,12 @@
/* Release the surface and let the driver free it */
SURFACE_ShareUnlockSurface(ppdev->pSurface);
ppdev->pfn.DisableSurface(ppdev->dhpdev);
+ }
+
+ /* Do we have a palette? */
+ if(ppdev->ppalSurf)
+ {
+ PALETTE_ShareUnlockPalette(ppdev->ppalSurf);
}
/* Disable PDEV */
@@ -132,6 +138,10 @@
if (ppdev->gdiinfo.ulLogPixelsY == 0)
ppdev->gdiinfo.ulLogPixelsY = 96;
+
+ /* Setup Palette */
+ GDIOBJ_SetOwnership(ppdev->devinfo.hpalDefault, NULL);
+ ppdev->ppalSurf = PALETTE_ShareLockPalette(ppdev->devinfo.hpalDefault);
DPRINT1("PDEVOBJ_bEnablePDEV - dhpdev = %p\n", ppdev->dhpdev);
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/surface.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/eng/surface.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/eng/surface.c [iso-8859-1] Sun May
9 00:10:41 2010
@@ -134,6 +134,12 @@
{
GreDeleteObject(psurf->hDIBPalette);
}
+ }
+
+ /* Free palette */
+ if(psurf->ppal)
+ {
+ PALETTE_ShareUnlockPalette(psurf->ppal);
}
return TRUE;
@@ -731,6 +737,9 @@
/* Hook up specified functions */
psurf->flHooks = flHooks;
+ /* Get palette */
+ psurf->ppal = PALETTE_ShareLockPalette(ppdev->devinfo.hpalDefault);
+
SURFACE_UnlockSurface(psurf);
return TRUE;
@@ -773,6 +782,9 @@
/* Hook up specified functions */
psurf->flHooks = flHooks;
+ /* Get palette */
+ psurf->ppal = PALETTE_ShareLockPalette(ppdev->devinfo.hpalDefault);
+
SURFACE_UnlockSurface(psurf);
return TRUE;
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/xlate.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- 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] Sun May 9
00:10:41 2010
@@ -603,7 +603,6 @@
PDC pdcDst)
{
PSURFACE psurfDst, psurfSrc;
- HPALETTE hpalSrc, hpalDst;
PPALETTE ppalSrc, ppalDst, ppalDstDc;
DPRINT("Enter EXLATEOBJ_vInitXlateFromDCs\n");
@@ -619,18 +618,33 @@
return;
}
- hpalSrc = psurfSrc->hDIBPalette;
- if (!hpalSrc)
- hpalSrc = pPrimarySurface->devinfo.hpalDefault;
-
- ppalSrc = PALETTE_ShareLockPalette(hpalSrc);
- if (!ppalSrc)
+ if (psurfSrc->hDIBPalette)
+ {
+ ppalSrc = PALETTE_ShareLockPalette(psurfSrc->hDIBPalette);
+ }
+ else if (psurfSrc->ppal)
+ {
+ ppalSrc = psurfSrc->ppal;
+ GDIOBJ_IncrementShareCount(&ppalSrc->BaseObject);
+ }
+ else
+ ppalSrc = PALETTE_ShareLockPalette(pdcSrc->ppdev->devinfo.hpalDefault);
+
+ if(!ppalSrc)
return;
- hpalDst = psurfDst->hDIBPalette;
- if (!hpalDst) hpalDst = pPrimarySurface->devinfo.hpalDefault;
-
- ppalDst = PALETTE_ShareLockPalette(hpalDst);
+ if (psurfDst->hDIBPalette)
+ {
+ ppalDst = PALETTE_ShareLockPalette(psurfDst->hDIBPalette);
+ }
+ else if (psurfDst->ppal)
+ {
+ ppalDst = psurfDst->ppal;
+ GDIOBJ_IncrementShareCount(&ppalDst->BaseObject);
+ }
+ else
+ ppalDst = PALETTE_ShareLockPalette(pdcDst->ppdev->devinfo.hpalDefault);
+
if (!ppalDst)
{
PALETTE_ShareUnlockPalette(ppalSrc);
@@ -683,7 +697,6 @@
COLORREF crForegroundClr,
COLORREF crBackgroundClr)
{
- HPALETTE hpalDst = NULL;
PPALETTE ppalDst, ppalPattern;
SURFACE *psurfPattern;
@@ -694,9 +707,18 @@
EXLATEOBJ_vInitTrivial(pexlo);
- hpalDst = psurfDst->hDIBPalette;
- if (!hpalDst) hpalDst = pPrimarySurface->devinfo.hpalDefault;
- ppalDst = PALETTE_ShareLockPalette(hpalDst);
+ if (psurfDst->hDIBPalette)
+ {
+ ppalDst = PALETTE_ShareLockPalette(psurfDst->hDIBPalette);
+ }
+ else if (psurfDst->ppal)
+ {
+ ppalDst = psurfDst->ppal;
+ GDIOBJ_IncrementShareCount(&ppalDst->BaseObject);
+ }
+ else
+ ppalDst = PALETTE_ShareLockPalette(pPrimarySurface->devinfo.hpalDefault);
+
if (!ppalDst)
{
DPRINT1("No ppalDst!\n");
Modified: branches/reactos-yarotows/subsystems/win32/win32k/include/pdevobj.h
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/include/pdevobj.h [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/include/pdevobj.h [iso-8859-1] Sun
May 9 00:10:41 2010
@@ -116,7 +116,7 @@
// ULONG TagSig;
struct _LDEVOBJ * pldev;
DHPDEV dhpdev; /* DHPDEV for device. */
- PVOID ppalSurf; /* PEPALOBJ/PPALETTE for this device. */
+ struct _PALETTE* ppalSurf; /* PEPALOBJ/PPALETTE for this device. */
DEVINFO devinfo;
GDIINFO gdiinfo;
PSURFACE pSurface; /* SURFACE for this device. */
Modified: branches/reactos-yarotows/subsystems/win32/win32k/objects/bitblt.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/objects/bitblt.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/objects/bitblt.c [iso-8859-1] Sun
May 9 00:10:41 2010
@@ -328,9 +328,7 @@
PGDIOBJ apObj[2];
RECTL rcDest, rcSrc;
SURFACE *BitmapDest, *BitmapSrc = NULL;
- HPALETTE SourcePalette = 0, DestPalette = 0;
- PPALETTE PalDestGDI, PalSourceGDI;
- USHORT PalDestMode, PalSrcMode;
+ PPALETTE PalSourceGDI;
ULONG TransparentColor = 0;
BOOL Ret = FALSE;
EXLATEOBJ exlo;
@@ -396,42 +394,29 @@
goto done;
}
- DestPalette = BitmapDest->hDIBPalette;
- if (!DestPalette) DestPalette = pPrimarySurface->devinfo.hpalDefault;
-
- SourcePalette = BitmapSrc->hDIBPalette;
- if (!SourcePalette) SourcePalette = pPrimarySurface->devinfo.hpalDefault;
-
- if(!(PalSourceGDI = PALETTE_LockPalette(SourcePalette)))
+ if (BitmapSrc->hDIBPalette)
+ PalSourceGDI = PALETTE_ShareLockPalette(BitmapSrc->hDIBPalette);
+ else if (BitmapSrc->ppal)
+ {
+ GDIOBJ_IncrementShareCount(&BitmapSrc->ppal->BaseObject);
+ PalSourceGDI = BitmapSrc->ppal ;
+ }
+ else
+ PalSourceGDI = PALETTE_ShareLockPalette(pPrimarySurface->devinfo.hpalDefault)
;
+
+ if(!PalSourceGDI)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
goto done;
- }
- PalSrcMode = PalSourceGDI->Mode;
- PALETTE_UnlockPalette(PalSourceGDI);
-
- if(DestPalette != SourcePalette)
- {
- if (!(PalDestGDI = PALETTE_LockPalette(DestPalette)))
- {
- SetLastWin32Error(ERROR_INVALID_HANDLE);
- goto done;
- }
- PalDestMode = PalDestGDI->Mode;
- PALETTE_UnlockPalette(PalDestGDI);
- }
- else
- {
- PalDestMode = PalSrcMode;
- PalDestGDI = PalSourceGDI;
}
/* Translate Transparent (RGB) Color to the source palette */
EXLATEOBJ_vInitialize(&exlo, &gpalRGB, PalSourceGDI, 0, 0, 0);
TransparentColor = XLATEOBJ_iXlate(&exlo.xlo, (ULONG)TransColor);
EXLATEOBJ_vCleanup(&exlo);
-
- EXLATEOBJ_vInitialize(&exlo, PalSourceGDI, PalDestGDI, 0, 0, 0);
+ PALETTE_ShareUnlockPalette(PalSourceGDI);
+
+ EXLATEOBJ_vInitXlateFromDCs(&exlo, DCSrc, DCDest);
Ret = IntEngTransparentBlt(&BitmapDest->SurfObj, &BitmapSrc->SurfObj,
DCDest->rosdc.CombinedClip, &exlo.xlo, &rcDest, &rcSrc,
Modified: branches/reactos-yarotows/subsystems/win32/win32k/objects/bitmaps.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/objects/bitmaps.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/objects/bitmaps.c [iso-8859-1] Sun
May 9 00:10:41 2010
@@ -143,11 +143,23 @@
{
if (Dc->dctype != DC_TYPE_MEMORY)
{
+ PSURFACE psurf;
Bmp = IntGdiCreateBitmap(abs(Width),
abs(Height),
Dc->ppdev->gdiinfo.cPlanes,
Dc->ppdev->gdiinfo.cBitsPixel,
NULL);
+ /* Set palette */
+ psurf = SURFACE_LockSurface(Bmp);
+ if(!psurf)
+ {
+ DPRINT1("Could not lock surface?\n");
+ }
+ else
+ {
+ psurf->ppal =
PALETTE_ShareLockPalette(Dc->ppdev->devinfo.hpalDefault);
+ SURFACE_UnlockSurface(psurf);
+ }
}
else
{
@@ -334,7 +346,6 @@
BOOL bInRect = FALSE;
SURFACE *psurf;
SURFOBJ *pso;
- HPALETTE hpal = 0;
PPALETTE ppal;
EXLATEOBJ exlo;
HBITMAP hBmpTmp;
@@ -362,9 +373,15 @@
if (psurf)
{
pso = &psurf->SurfObj;
- hpal = psurf->hDIBPalette;
- if (!hpal) hpal = pPrimarySurface->devinfo.hpalDefault;
- ppal = PALETTE_ShareLockPalette(hpal);
+ if(psurf->hDIBPalette)
+ ppal = PALETTE_ShareLockPalette(psurf->hDIBPalette);
+ else if (psurf->ppal)
+ {
+ ppal = psurf->ppal;
+ GDIOBJ_IncrementShareCount(&ppal->BaseObject);
+ }
+ else
+ ppal = PALETTE_ShareLockPalette(dc->ppdev->devinfo.hpalDefault);
if (psurf->SurfObj.iBitmapFormat == BMF_1BPP &&
!psurf->hSecure)
{
Modified: branches/reactos-yarotows/subsystems/win32/win32k/objects/dibobj.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] Sun
May 9 00:10:41 2010
@@ -230,7 +230,7 @@
EXLATEOBJ exlo;
PPALETTE ppalDDB, ppalDIB;
//RGBQUAD *lpRGB;
- HPALETTE DDB_Palette, DIB_Palette;
+ HPALETTE DIB_Palette;
ULONG DIB_Palette_Type;
INT DIBWidth;
@@ -279,15 +279,17 @@
// Use hDIBPalette if it exists
if (bitmap->hDIBPalette)
{
- DDB_Palette = bitmap->hDIBPalette;
+ ppalDDB = PALETTE_ShareLockPalette(bitmap->hDIBPalette);
+ }
+ else if (bitmap->ppal)
+ {
+ ppalDDB = bitmap->ppal;
+ GDIOBJ_IncrementShareCount(&ppalDDB->BaseObject);
}
else
- {
// Destination palette obtained from the hDC
- DDB_Palette = DC->ppdev->devinfo.hpalDefault;
- }
-
- ppalDDB = PALETTE_LockPalette(DDB_Palette);
+ ppalDDB = PALETTE_ShareLockPalette(DC->ppdev->devinfo.hpalDefault);
+
if (NULL == ppalDDB)
{
EngUnlockSurface(SourceSurf);
@@ -304,6 +306,7 @@
EngUnlockSurface(SourceSurf);
EngDeleteSurface((HSURF)SourceBitmap);
SURFACE_UnlockSurface(bitmap);
+ PALETTE_ShareUnlockPalette(ppalDDB);
SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES);
return 0;
}
@@ -336,7 +339,7 @@
// Clean up
EXLATEOBJ_vCleanup(&exlo);
PALETTE_UnlockPalette(ppalDIB);
- PALETTE_UnlockPalette(ppalDDB);
+ PALETTE_ShareUnlockPalette(ppalDDB);
PALETTE_FreePaletteByHandle(DIB_Palette);
EngUnlockSurface(SourceSurf);
EngDeleteSurface((HSURF)SourceBitmap);
@@ -441,7 +444,7 @@
SIZEL SourceSize;
EXLATEOBJ exlo;
PPALETTE ppalDDB = NULL, ppalDIB = NULL;
- HPALETTE hpalDDB, hpalDIB = NULL;
+ HPALETTE hpalDIB = NULL;
ULONG DIBPaletteType;
if (!Bits) return 0;
@@ -474,15 +477,7 @@
return 0;
}
- /* Use destination palette obtained from the DC by default */
- hpalDDB = pDC->ppdev->devinfo.hpalDefault;
-
- /* Try to use hDIBPalette if it exists */
pSurf = pDC->dclevel.pSurface;
- if (pSurf && pSurf->hDIBPalette)
- {
- hpalDDB = pSurf->hDIBPalette;
- }
pDestSurf = pSurf ? &pSurf->SurfObj : NULL;
@@ -528,7 +523,18 @@
}
/* Obtain destination palette */
- ppalDDB = PALETTE_LockPalette(hpalDDB);
+ if (pSurf && pSurf->hDIBPalette)
+ {
+ ppalDDB = PALETTE_ShareLockPalette(pSurf->hDIBPalette);
+ }
+ else if (pSurf && pSurf->ppal)
+ {
+ ppalDDB = pSurf->ppal;
+ GDIOBJ_IncrementShareCount(&ppalDDB->BaseObject);
+ }
+ else
+ ppalDDB = PALETTE_ShareLockPalette(pDC->ppdev->devinfo.hpalDefault);
+
if (!ppalDDB)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
@@ -547,7 +553,7 @@
/* Lock the DIB palette */
ppalDIB = PALETTE_LockPalette(hpalDIB);
- if (!ppalDDB)
+ if (!ppalDIB)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
Status = STATUS_UNSUCCESSFUL;
@@ -558,7 +564,7 @@
EXLATEOBJ_vInitialize(&exlo, ppalDIB, ppalDDB, 0, 0, 0);
/* Copy the bits */
- DPRINT("BitsToDev with dstsurf=(%d|%d) (%d|%d), src=(%d|%d) w=%d h=%d\n",
+ DPRINT("BitsToDev with dstsurf=(%d|%d) (%d|%d), src=(%d|%d) w=%d h=%d\n",
rcDest.left, rcDest.top, rcDest.right, rcDest.bottom,
ptSource.x, ptSource.y, SourceSize.cx, SourceSize.cy);
Status = IntEngBitBlt(pDestSurf,
@@ -583,7 +589,7 @@
}
if (ppalDIB) PALETTE_UnlockPalette(ppalDIB);
- if (ppalDDB) PALETTE_UnlockPalette(ppalDDB);
+ if (ppalDDB) PALETTE_ShareUnlockPalette(ppalDDB);
if (pSourceSurf) EngUnlockSurface(pSourceSurf);
if (hSourceBitmap) EngDeleteSurface((HSURF)hSourceBitmap);
@@ -611,7 +617,6 @@
PDC Dc;
SURFACE *psurf = NULL;
HBITMAP hDestBitmap = NULL;
- HPALETTE hSourcePalette = NULL;
HPALETTE hDestPalette = NULL;
PPALETTE ppalSrc = NULL;
PPALETTE ppalDst = NULL;
@@ -636,7 +641,7 @@
_SEH2_TRY
{
ProbeForRead(&Info->bmiHeader.biSize, sizeof(DWORD), 1);
-
+
ProbeForWrite(Info, Info->bmiHeader.biSize, 1); // Comp for Core.
if (ChkBits) ProbeForWrite(ChkBits, MaxBits, 1);
}
@@ -658,18 +663,30 @@
DC_UnlockDc(Dc);
return 0;
}
- DC_UnlockDc(Dc);
/* Get a pointer to the source bitmap object */
psurf = SURFACE_LockSurface(hBitmap);
if (psurf == NULL)
- return 0;
-
- hSourcePalette = psurf->hDIBPalette;
- if (!hSourcePalette)
- {
- hSourcePalette = pPrimarySurface->devinfo.hpalDefault;
- }
+ {
+ DC_UnlockDc(Dc);
+ return 0;
+ }
+
+ if (psurf->hDIBPalette)
+ {
+ ppalSrc = PALETTE_ShareLockPalette(psurf->hDIBPalette);
+ }
+ else if (psurf->ppal)
+ {
+ ppalSrc = psurf->ppal;
+ GDIOBJ_IncrementShareCount(&ppalSrc->BaseObject);
+ }
+ else
+ ppalSrc = PALETTE_ShareLockPalette(Dc->ppdev->devinfo.hpalDefault);
+
+ DC_UnlockDc(Dc);
+
+ ASSERT(ppalSrc != NULL);
ColorPtr = ((PBYTE)Info + Info->bmiHeader.biSize);
rgbQuads = (RGBQUAD *)ColorPtr;
@@ -680,15 +697,11 @@
Info->bmiHeader.biBitCount != 15 && Info->bmiHeader.biBitCount !=
16) ||
!ChkBits)
{
- hDestPalette = hSourcePalette;
+ ppalDst = ppalSrc;
bPaletteMatch = TRUE;
}
else
hDestPalette = BuildDIBPalette(Info, (PINT)&DestPaletteType); //hDestPalette
= Dc->DevInfo->hpalDefault;
-
- ppalSrc = PALETTE_LockPalette(hSourcePalette);
- /* FIXME - ppalSrc can be NULL!!! Don't assert here! */
- ASSERT(ppalSrc);
if (!bPaletteMatch)
{
@@ -696,10 +709,6 @@
/* FIXME - ppalDst can be NULL!!!! Don't assert here!!! */
DPRINT("ppalDst : %p\n", ppalDst);
ASSERT(ppalDst);
- }
- else
- {
- ppalDst = ppalSrc;
}
/* Copy palette. */
@@ -970,7 +979,7 @@
}
}
cleanup:
- PALETTE_UnlockPalette(ppalSrc);
+ PALETTE_ShareUnlockPalette(ppalSrc);
if (hDestBitmap != NULL)
EngDeleteSurface((HSURF)hDestBitmap);
Modified: branches/reactos-yarotows/subsystems/win32/win32k/objects/fillshap.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/objects/fillshap.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/objects/fillshap.c [iso-8859-1] Sun
May 9 00:10:41 2010
@@ -872,7 +872,6 @@
POINTL DitherOrg;
ULONG i;
BOOL Ret;
- HPALETTE hDestPalette;
ASSERT(dc);
ASSERT(pVertex);
@@ -936,10 +935,19 @@
/* FIXME - psurf can be NULL!!! Don't assert but handle this case gracefully! */
ASSERT(psurf);
- hDestPalette = psurf->hDIBPalette;
- if (!hDestPalette) hDestPalette = pPrimarySurface->devinfo.hpalDefault;
-
- PalDestGDI = PALETTE_LockPalette(hDestPalette);
+ if (psurf->hDIBPalette)
+ {
+ PalDestGDI = PALETTE_ShareLockPalette(psurf->hDIBPalette);
+ }
+ else if (psurf->ppal)
+ {
+ PalDestGDI = psurf->ppal;
+ GDIOBJ_IncrementShareCount(&PalDestGDI->BaseObject);
+ }
+ else
+ // Destination palette obtained from the hDC
+ PalDestGDI = PALETTE_ShareLockPalette(dc->ppdev->devinfo.hpalDefault);
+
EXLATEOBJ_vInitialize(&exlo, &gpalRGB, PalDestGDI, 0, 0, 0);
Ret = IntEngGradientFill(&psurf->SurfObj,
@@ -956,7 +964,7 @@
EXLATEOBJ_vCleanup(&exlo);
if (PalDestGDI)
- PALETTE_UnlockPalette(PalDestGDI);
+ PALETTE_ShareUnlockPalette(PalDestGDI);
return Ret;
}
@@ -1089,7 +1097,6 @@
PDC dc;
PDC_ATTR pdcattr;
SURFACE *psurf = NULL;
- HPALETTE hpal;
PPALETTE ppal;
EXLATEOBJ exlo;
BOOL Ret = FALSE;
@@ -1135,9 +1142,18 @@
goto cleanup;
}
- hpal = dc->dclevel.pSurface->hDIBPalette;
- if (!hpal) hpal = pPrimarySurface->devinfo.hpalDefault;
- ppal = PALETTE_ShareLockPalette(hpal);
+ if (psurf->hDIBPalette)
+ {
+ ppal = PALETTE_ShareLockPalette(psurf->hDIBPalette);
+ }
+ else if (psurf->ppal)
+ {
+ ppal = psurf->ppal;
+ GDIOBJ_IncrementShareCount(&ppal->BaseObject);
+ }
+ else
+ // Destination palette obtained from the hDC
+ ppal = PALETTE_ShareLockPalette(dc->ppdev->devinfo.hpalDefault);
EXLATEOBJ_vInitialize(&exlo, &gpalRGB, ppal, 0, 0xffffff, 0);
Modified: branches/reactos-yarotows/subsystems/win32/win32k/objects/freetype.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win…
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/objects/freetype.c [iso-8859-1]
(original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/objects/freetype.c [iso-8859-1] Sun
May 9 00:10:41 2010
@@ -3168,7 +3168,6 @@
BOOLEAN Render;
POINT Start;
BOOL DoBreak = FALSE;
- HPALETTE hDestPalette;
PPALETTE ppalDst;
USHORT DxShift;
@@ -3440,14 +3439,22 @@
SurfObj = &psurf->SurfObj ;
/* Create the xlateobj */
- hDestPalette = psurf->hDIBPalette;
- if (!hDestPalette) hDestPalette = pPrimarySurface->devinfo.hpalDefault;
- //if (!hDestPalette) hDestPalette =
StockObjects[DEFAULT_PALETTE];//pPrimarySurface->devinfo.hpalDefault;
- ppalDst = PALETTE_LockPalette(hDestPalette);
+ if (psurf->hDIBPalette)
+ {
+ ppalDst = PALETTE_ShareLockPalette(psurf->hDIBPalette);
+ }
+ else if (psurf->ppal)
+ {
+ ppalDst = psurf->ppal;
+ GDIOBJ_IncrementShareCount(&ppalDst->BaseObject);
+ }
+ else
+ // Destination palette obtained from the hDC
+ ppalDst = PALETTE_ShareLockPalette(dc->ppdev->devinfo.hpalDefault);
ASSERT(ppalDst);
EXLATEOBJ_vInitialize(&exloRGB2Dst, &gpalRGB, ppalDst, 0, 0, 0);
EXLATEOBJ_vInitialize(&exloDst2RGB, ppalDst, &gpalRGB, 0, 0, 0);
- PALETTE_UnlockPalette(ppalDst);
+ PALETTE_ShareUnlockPalette(ppalDst);
if ((fuOptions & ETO_OPAQUE) && (dc->pdcattr->ulDirty_ &
DIRTY_BACKGROUND))
DC_vUpdateBackgroundBrush(dc) ;