diff --git a/reactos/win32ss/gdi/eng/engbrush.c b/reactos/win32ss/gdi/eng/engbrush.c index 7c752caa3b9..fcc03f1bce2 100644 --- a/reactos/win32ss/gdi/eng/engbrush.c +++ b/reactos/win32ss/gdi/eng/engbrush.c @@ -67,6 +67,9 @@ EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc) pebo->crCurrentText = pdc->pdcattr->crForegroundClr; pebo->psurfTrg = pdc->dclevel.pSurface; + /* We are initializing for a new memory DC */ + if(!pebo->psurfTrg) + pebo->psurfTrg = psurfDefaultBitmap; ASSERT(pebo->psurfTrg); ASSERT(pebo->psurfTrg->ppal); diff --git a/reactos/win32ss/gdi/ntgdi/bitblt.c b/reactos/win32ss/gdi/ntgdi/bitblt.c index e381d8dac6c..9845f02aa3e 100644 --- a/reactos/win32ss/gdi/ntgdi/bitblt.c +++ b/reactos/win32ss/gdi/ntgdi/bitblt.c @@ -807,9 +807,11 @@ IntPatBlt( SURFACE *psurf; POINTL BrushOrigin; BOOL ret; - PBRUSH pbrush = pebo->pbrush; + PBRUSH pbrush; ASSERT(pebo); + pbrush = pebo->pbrush; + ASSERT(pbrush); FIXUP_ROP(dwRop); diff --git a/reactos/win32ss/gdi/ntgdi/bitmaps.c b/reactos/win32ss/gdi/ntgdi/bitmaps.c index ddae4c5e683..5318e1d15e4 100644 --- a/reactos/win32ss/gdi/ntgdi/bitmaps.c +++ b/reactos/win32ss/gdi/ntgdi/bitmaps.c @@ -259,6 +259,7 @@ IntCreateCompatibleBitmap( DIBSECTION dibs; INT Count; PSURFACE psurf = Dc->dclevel.pSurface; + if(!psurf) psurf = psurfDefaultBitmap; Count = BITMAP_GetObject(psurf, sizeof(dibs), &dibs); if (Count == sizeof(BITMAP)) diff --git a/reactos/win32ss/gdi/ntgdi/dclife.c b/reactos/win32ss/gdi/ntgdi/dclife.c index 3d6c3e86109..fb102806ce3 100644 --- a/reactos/win32ss/gdi/ntgdi/dclife.c +++ b/reactos/win32ss/gdi/ntgdi/dclife.c @@ -180,7 +180,7 @@ DC_vInitDc( pdc->dclevel.pSurface = NULL; // FIXME: HACK, because our code expects a surface - pdc->dclevel.pSurface = SURFACE_ShareLockSurface(StockObjects[DEFAULT_BITMAP]); + // pdc->dclevel.pSurface = SURFACE_ShareLockSurface(StockObjects[DEFAULT_BITMAP]); pdc->erclBounds.left = 0; pdc->erclBounds.top = 0; @@ -271,12 +271,9 @@ DC_vInitDc( pdc->dclevel.ptlBrushOrigin.x = 0; pdc->dclevel.ptlBrushOrigin.y = 0; pdc->dcattr.ptlBrushOrigin = pdc->dclevel.ptlBrushOrigin; - - /* Initialize EBRUSHOBJs */ - EBRUSHOBJ_vInit(&pdc->eboFill, pdc->dclevel.pbrFill, pdc); - EBRUSHOBJ_vInit(&pdc->eboLine, pdc->dclevel.pbrLine, pdc); + + /* Init text brush */ EBRUSHOBJ_vInit(&pdc->eboText, pbrDefaultBrush, pdc); - EBRUSHOBJ_vInit(&pdc->eboBackground, pbrDefaultBrush, pdc); /* Setup fill data */ pdc->dcattr.jROP2 = R2_COPYPEN; @@ -424,9 +421,8 @@ DC_vSetOwner(PDC pdc, ULONG ulOwner) pdc->dclevel.pbrFill = BRUSH_ShareLockBrush(pdc->pdcattr->hbrush); pdc->dclevel.pbrLine = PEN_ShareLockPen(pdc->pdcattr->hpen); - /* Update the EBRUSHOBJs */ - EBRUSHOBJ_vUpdate(&pdc->eboFill, pdc->dclevel.pbrFill, pdc); - EBRUSHOBJ_vUpdate(&pdc->eboLine, pdc->dclevel.pbrLine, pdc); + /* Mark them as dirty */ + pdc->pdcattr->ulDirty_ |= DIRTY_FILL|DIRTY_LINE; /* Allocate or free DC attribute */ if (ulOwner == GDI_OBJ_HMGR_PUBLIC || ulOwner == GDI_OBJ_HMGR_NONE) @@ -796,7 +792,7 @@ NtGdiCreateCompatibleDC(HDC hdc) DC_bAllocDcAttr(pdcNew); // HACK! - DC_vSelectSurface(pdcNew, psurfDefaultBitmap); + //DC_vSelectSurface(pdcNew, psurfDefaultBitmap); DC_UnlockDc(pdcNew); diff --git a/reactos/win32ss/gdi/ntgdi/dcobjs.c b/reactos/win32ss/gdi/ntgdi/dcobjs.c index d7699eca8a7..a9b2b6cf696 100644 --- a/reactos/win32ss/gdi/ntgdi/dcobjs.c +++ b/reactos/win32ss/gdi/ntgdi/dcobjs.c @@ -230,9 +230,10 @@ GdiSelectPalette( } /* Is this a valid palette for this depth? */ - if ((BitsPerFormat(pdc->dclevel.pSurface->SurfObj.iBitmapFormat) <= 8 - && (ppal->flFlags & PAL_INDEXED)) || - (BitsPerFormat(pdc->dclevel.pSurface->SurfObj.iBitmapFormat) > 8)) + if ((!pdc->dclevel.pSurface) || + (BitsPerFormat(pdc->dclevel.pSurface->SurfObj.iBitmapFormat) <= 8 + && (ppal->flFlags & PAL_INDEXED)) || + (BitsPerFormat(pdc->dclevel.pSurface->SurfObj.iBitmapFormat) > 8)) { /* Get old palette, set new one */ oldPal = pdc->dclevel.hpal; @@ -383,7 +384,7 @@ NtGdiSelectBitmap( pdc->dclevel.sizl.cy = 1; // HACK - psurfNew = SURFACE_ShareLockSurface(hbmp); + //psurfNew = SURFACE_ShareLockSurface(hbmp); } else {