From 6b0ac7a880238905e82e3ad061728e59d951bd41 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Sun, 20 Jun 2010 13:11:23 +0000 Subject: [PATCH] apply 46848 from yarotows [WIN32K] - get rid of ROS_DC::BitsPerPixel. 1 - It was a hack. 2 - Its use was inconsistent. svn path=/trunk/; revision=47809 --- reactos/subsystems/win32/win32k/include/dc.h | 2 -- .../subsystems/win32/win32k/objects/dclife.c | 6 ----- .../subsystems/win32/win32k/objects/dcobjs.c | 26 +++++++------------ .../subsystems/win32/win32k/objects/dcstate.c | 11 -------- 4 files changed, 10 insertions(+), 35 deletions(-) diff --git a/reactos/subsystems/win32/win32k/include/dc.h b/reactos/subsystems/win32/win32k/include/dc.h index 48b0e921400..8b988d5c14f 100644 --- a/reactos/subsystems/win32/win32k/include/dc.h +++ b/reactos/subsystems/win32/win32k/include/dc.h @@ -29,8 +29,6 @@ typedef struct _ROS_DC_INFO HRGN hVisRgn; /* Visible region (must never be 0) */ HRGN hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */ - BYTE bitsPerPixel; - CLIPOBJ *CombinedClip; /* Use XCLIPOBJ in DC. */ UNICODE_STRING DriverName; diff --git a/reactos/subsystems/win32/win32k/objects/dclife.c b/reactos/subsystems/win32/win32k/objects/dclife.c index 3791a6aaeb8..c4ba1ddcf19 100644 --- a/reactos/subsystems/win32/win32k/objects/dclife.c +++ b/reactos/subsystems/win32/win32k/objects/dclife.c @@ -310,10 +310,6 @@ IntGdiCreateDC( // ATM we only have one display. pdcattr->ulDirty_ |= DC_PRIMARY_DISPLAY; - pdc->rosdc.bitsPerPixel = pdc->ppdev->gdiinfo.cBitsPixel * - pdc->ppdev->gdiinfo.cPlanes; - DPRINT("Bits per pel: %u\n", pdc->rosdc.bitsPerPixel); - pdc->flGraphicsCaps = PrimarySurface.devinfo.flGraphicsCaps; pdc->flGraphicsCaps2 = PrimarySurface.devinfo.flGraphicsCaps2; @@ -714,8 +710,6 @@ NtGdiCreateCompatibleDC(HDC hDC) pdcNew->dhpdev = pdcOld->dhpdev; - pdcNew->rosdc.bitsPerPixel = pdcOld->rosdc.bitsPerPixel; - /* DriverName is copied in the AllocDC routine */ pdcattrNew->ptlWindowOrg = pdcattrOld->ptlWindowOrg; pdcattrNew->szlWindowExt = pdcattrOld->szlWindowExt; diff --git a/reactos/subsystems/win32/win32k/objects/dcobjs.c b/reactos/subsystems/win32/win32k/objects/dcobjs.c index 6e5e2c42fbb..3a093a01401 100644 --- a/reactos/subsystems/win32/win32k/objects/dcobjs.c +++ b/reactos/subsystems/win32/win32k/objects/dcobjs.c @@ -162,10 +162,10 @@ GdiSelectPalette( return NULL; } - // FIXME: This looks wrong /* Is this a valid palette for this depth? */ - if ((pdc->rosdc.bitsPerPixel <= 8 && ppal->Mode == PAL_INDEXED) || - (pdc->rosdc.bitsPerPixel > 8)) + if ((BitsPerFormat(pdc->dclevel.pSurface->SurfObj.iBitmapFormat) <= 8 + && ppal->Mode == PAL_INDEXED) || + (BitsPerFormat(pdc->dclevel.pSurface->SurfObj.iBitmapFormat) > 8)) { /* Get old palette, set new one */ oldPal = pdc->dclevel.hpal; @@ -291,28 +291,22 @@ NtGdiSelectBitmap( // If Info DC this is zero and pSurface is moved to DC->pSurfInfo. psurfBmp->hDC = hDC; - // if we're working with a DIB, get the palette - // [fixme: only create if the selected palette is null] - if (psurfBmp->hSecure) + /* FIXME; improve by using a region without a handle and selecting it */ + hVisRgn = IntSysCreateRectRgn( 0, + 0, + psurfBmp->SurfObj.sizlBitmap.cx, + psurfBmp->SurfObj.sizlBitmap.cy); + + if(psurfBmp->hSecure) { -// pDC->rosdc.bitsPerPixel = psurfBmp->dib->dsBmih.biBitCount; ??? - pDC->rosdc.bitsPerPixel = BitsPerFormat(psurfBmp->SurfObj.iBitmapFormat); /* Set DIBSECTION attribute */ pdcattr->ulDirty_ |= DC_DIBSECTION; } else { - pDC->rosdc.bitsPerPixel = BitsPerFormat(psurfBmp->SurfObj.iBitmapFormat); - /* Restore DIBSECTION attribute */ pdcattr->ulDirty_ &= ~DC_DIBSECTION; } - /* FIXME; improve by using a region without a handle and selecting it */ - hVisRgn = IntSysCreateRectRgn( 0, - 0, - psurfBmp->SurfObj.sizlBitmap.cx, - psurfBmp->SurfObj.sizlBitmap.cy); - /* Release the exclusive lock */ SURFACE_UnlockSurface(psurfBmp); diff --git a/reactos/subsystems/win32/win32k/objects/dcstate.c b/reactos/subsystems/win32/win32k/objects/dcstate.c index 1b97ae7aca9..f7942f33d02 100644 --- a/reactos/subsystems/win32/win32k/objects/dcstate.c +++ b/reactos/subsystems/win32/win32k/objects/dcstate.c @@ -44,12 +44,6 @@ DC_vCopyState(PDC pdcSrc, PDC pdcDst, BOOL To) // FIXME: handle refs pdcDst->dclevel.plfnt = pdcSrc->dclevel.plfnt; - /* ROS hacks */ - if (pdcDst->dctype != DC_TYPE_MEMORY) - { - pdcDst->rosdc.bitsPerPixel = pdcSrc->rosdc.bitsPerPixel; - } - /* Get/SetDCState() don't change hVisRgn field ("Undoc. Windows" p.559). */ if (To) // Copy "To" SaveDC state. { @@ -77,11 +71,6 @@ IntGdiCleanDC(HDC hDC) // Clean the DC if (defaultDCstate) DC_vCopyState(defaultDCstate, dc, FALSE); - if (dc->dctype != DC_TYPE_MEMORY) - { - dc->rosdc.bitsPerPixel = defaultDCstate->rosdc.bitsPerPixel; - } - DC_UnlockDc(dc); return TRUE; -- 2.17.1