From c74dd37de0c6859eba93dd4713a117718720462d Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 23 Aug 2007 16:38:23 +0000 Subject: [PATCH] - rename painting.c to bitblt.c - move NtGdi/Int(Poly)PatBlt to bitblt.c svn path=/trunk/; revision=28478 --- .../win32k/objects/{painting.c => bitblt.c} | 223 ++++++++++++++++++ .../subsystems/win32/win32k/objects/brush.c | 223 ------------------ reactos/subsystems/win32/win32k/win32k.rbuild | 2 +- 3 files changed, 224 insertions(+), 224 deletions(-) rename reactos/subsystems/win32/win32k/objects/{painting.c => bitblt.c} (82%) diff --git a/reactos/subsystems/win32/win32k/objects/painting.c b/reactos/subsystems/win32/win32k/objects/bitblt.c similarity index 82% rename from reactos/subsystems/win32/win32k/objects/painting.c rename to reactos/subsystems/win32/win32k/objects/bitblt.c index 7887c01d536..06e42eb87e9 100644 --- a/reactos/subsystems/win32/win32k/objects/painting.c +++ b/reactos/subsystems/win32/win32k/objects/bitblt.c @@ -1012,3 +1012,226 @@ failed: return Status; } +BOOL FASTCALL +IntPatBlt( + PDC dc, + INT XLeft, + INT YLeft, + INT Width, + INT Height, + DWORD ROP, + PGDIBRUSHOBJ BrushObj) +{ + RECTL DestRect; + BITMAPOBJ *BitmapObj; + GDIBRUSHINST BrushInst; + POINTL BrushOrigin; + BOOL ret = TRUE; + + ASSERT(BrushObj); + + BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap); + if (BitmapObj == NULL) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return FALSE; + } + + if (!(BrushObj->flAttrs & GDIBRUSH_IS_NULL)) + { + if (Width > 0) + { + DestRect.left = XLeft + dc->w.DCOrgX; + DestRect.right = XLeft + Width + dc->w.DCOrgX; + } + else + { + DestRect.left = XLeft + Width + 1 + dc->w.DCOrgX; + DestRect.right = XLeft + dc->w.DCOrgX + 1; + } + + if (Height > 0) + { + DestRect.top = YLeft + dc->w.DCOrgY; + DestRect.bottom = YLeft + Height + dc->w.DCOrgY; + } + else + { + DestRect.top = YLeft + Height + dc->w.DCOrgY + 1; + DestRect.bottom = YLeft + dc->w.DCOrgY + 1; + } + + IntLPtoDP(dc, (LPPOINT)&DestRect, 2); + + BrushOrigin.x = BrushObj->ptOrigin.x + dc->w.DCOrgX; + BrushOrigin.y = BrushObj->ptOrigin.y + dc->w.DCOrgY; + + IntGdiInitBrushInstance(&BrushInst, BrushObj, dc->XlateBrush); + + ret = IntEngBitBlt( + &BitmapObj->SurfObj, + NULL, + NULL, + dc->CombinedClip, + NULL, + &DestRect, + NULL, + NULL, + &BrushInst.BrushObject, + &BrushOrigin, + ROP3_TO_ROP4(ROP)); + } + + BITMAPOBJ_UnlockBitmap(BitmapObj); + + return ret; +} + +BOOL FASTCALL +IntGdiPolyPatBlt( + HDC hDC, + DWORD dwRop, + PPATRECT pRects, + int cRects, + ULONG Reserved) +{ + int i; + PPATRECT r; + PGDIBRUSHOBJ BrushObj; + DC *dc; + + dc = DC_LockDc(hDC); + if (dc == NULL) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return FALSE; + } + if (dc->IsIC) + { + DC_UnlockDc(dc); + /* Yes, Windows really returns TRUE in this case */ + return TRUE; + } + + for (r = pRects, i = 0; i < cRects; i++) + { + BrushObj = BRUSHOBJ_LockBrush(r->hBrush); + if(BrushObj != NULL) + { + IntPatBlt( + dc, + r->r.left, + r->r.top, + r->r.right, + r->r.bottom, + dwRop, + BrushObj); + BRUSHOBJ_UnlockBrush(BrushObj); + } + r++; + } + + DC_UnlockDc(dc); + + return TRUE; +} + + +BOOL STDCALL +NtGdiPatBlt( + HDC hDC, + INT XLeft, + INT YLeft, + INT Width, + INT Height, + DWORD ROP) +{ + PGDIBRUSHOBJ BrushObj; + DC *dc = DC_LockDc(hDC); + BOOL ret; + + if (dc == NULL) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return FALSE; + } + if (dc->IsIC) + { + DC_UnlockDc(dc); + /* Yes, Windows really returns TRUE in this case */ + return TRUE; + } + + BrushObj = BRUSHOBJ_LockBrush(dc->Dc_Attr.hbrush); + if (BrushObj == NULL) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + DC_UnlockDc(dc); + return FALSE; + } + + ret = IntPatBlt( + dc, + XLeft, + YLeft, + Width, + Height, + ROP, + BrushObj); + + BRUSHOBJ_UnlockBrush(BrushObj); + DC_UnlockDc(dc); + + return ret; +} + +BOOL STDCALL +NtGdiPolyPatBlt( + HDC hDC, + DWORD dwRop, + IN PPOLYPATBLT pRects, + IN DWORD cRects, + IN DWORD Mode) +{ + PPATRECT rb = NULL; + NTSTATUS Status = STATUS_SUCCESS; + BOOL Ret; + + if (cRects > 0) + { + rb = ExAllocatePoolWithTag(PagedPool, sizeof(PATRECT) * cRects, TAG_PATBLT); + if (!rb) + { + SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + _SEH_TRY + { + ProbeForRead(pRects, + cRects * sizeof(PATRECT), + 1); + RtlCopyMemory(rb, + pRects, + cRects * sizeof(PATRECT)); + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + + if (!NT_SUCCESS(Status)) + { + ExFreePool(rb); + SetLastNtError(Status); + return FALSE; + } + } + + Ret = IntGdiPolyPatBlt(hDC, dwRop, (PPATRECT)pRects, cRects, Mode); + + if (cRects > 0) + ExFreePool(rb); + + return Ret; +} diff --git a/reactos/subsystems/win32/win32k/objects/brush.c b/reactos/subsystems/win32/win32k/objects/brush.c index 698b6f8e9c8..1fc144a4121 100644 --- a/reactos/subsystems/win32/win32k/objects/brush.c +++ b/reactos/subsystems/win32/win32k/objects/brush.c @@ -492,130 +492,6 @@ IntGdiCreateNullBrush(VOID) return hBrush; } -BOOL FASTCALL -IntPatBlt( - PDC dc, - INT XLeft, - INT YLeft, - INT Width, - INT Height, - DWORD ROP, - PGDIBRUSHOBJ BrushObj) -{ - RECTL DestRect; - BITMAPOBJ *BitmapObj; - GDIBRUSHINST BrushInst; - POINTL BrushOrigin; - BOOL ret = TRUE; - - ASSERT(BrushObj); - - BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap); - if (BitmapObj == NULL) - { - SetLastWin32Error(ERROR_INVALID_HANDLE); - return FALSE; - } - - if (!(BrushObj->flAttrs & GDIBRUSH_IS_NULL)) - { - if (Width > 0) - { - DestRect.left = XLeft + dc->w.DCOrgX; - DestRect.right = XLeft + Width + dc->w.DCOrgX; - } - else - { - DestRect.left = XLeft + Width + 1 + dc->w.DCOrgX; - DestRect.right = XLeft + dc->w.DCOrgX + 1; - } - - if (Height > 0) - { - DestRect.top = YLeft + dc->w.DCOrgY; - DestRect.bottom = YLeft + Height + dc->w.DCOrgY; - } - else - { - DestRect.top = YLeft + Height + dc->w.DCOrgY + 1; - DestRect.bottom = YLeft + dc->w.DCOrgY + 1; - } - - IntLPtoDP(dc, (LPPOINT)&DestRect, 2); - - BrushOrigin.x = BrushObj->ptOrigin.x + dc->w.DCOrgX; - BrushOrigin.y = BrushObj->ptOrigin.y + dc->w.DCOrgY; - - IntGdiInitBrushInstance(&BrushInst, BrushObj, dc->XlateBrush); - - ret = IntEngBitBlt( - &BitmapObj->SurfObj, - NULL, - NULL, - dc->CombinedClip, - NULL, - &DestRect, - NULL, - NULL, - &BrushInst.BrushObject, - &BrushOrigin, - ROP3_TO_ROP4(ROP)); - } - - BITMAPOBJ_UnlockBitmap(BitmapObj); - - return ret; -} - -BOOL FASTCALL -IntGdiPolyPatBlt( - HDC hDC, - DWORD dwRop, - PPATRECT pRects, - int cRects, - ULONG Reserved) -{ - int i; - PPATRECT r; - PGDIBRUSHOBJ BrushObj; - DC *dc; - - dc = DC_LockDc(hDC); - if (dc == NULL) - { - SetLastWin32Error(ERROR_INVALID_HANDLE); - return FALSE; - } - if (dc->IsIC) - { - DC_UnlockDc(dc); - /* Yes, Windows really returns TRUE in this case */ - return TRUE; - } - - for (r = pRects, i = 0; i < cRects; i++) - { - BrushObj = BRUSHOBJ_LockBrush(r->hBrush); - if(BrushObj != NULL) - { - IntPatBlt( - dc, - r->r.left, - r->r.top, - r->r.right, - r->r.bottom, - dwRop, - BrushObj); - BRUSHOBJ_UnlockBrush(BrushObj); - } - r++; - } - - DC_UnlockDc(dc); - - return TRUE; -} - /* PUBLIC FUNCTIONS ***********************************************************/ HBRUSH STDCALL @@ -747,105 +623,6 @@ NtGdiSetBrushOrg(HDC hDC, INT XOrg, INT YOrg, LPPOINT Point) return TRUE; } -BOOL STDCALL -NtGdiPolyPatBlt( - HDC hDC, - DWORD dwRop, - IN PPOLYPATBLT pRects, - IN DWORD cRects, - IN DWORD Mode) -{ - PPATRECT rb = NULL; - NTSTATUS Status = STATUS_SUCCESS; - BOOL Ret; - - if (cRects > 0) - { - rb = ExAllocatePoolWithTag(PagedPool, sizeof(PATRECT) * cRects, TAG_PATBLT); - if (!rb) - { - SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - _SEH_TRY - { - ProbeForRead(pRects, - cRects * sizeof(PATRECT), - 1); - RtlCopyMemory(rb, - pRects, - cRects * sizeof(PATRECT)); - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - - if (!NT_SUCCESS(Status)) - { - ExFreePool(rb); - SetLastNtError(Status); - return FALSE; - } - } - - Ret = IntGdiPolyPatBlt(hDC, dwRop, (PPATRECT)pRects, cRects, Mode); - - if (cRects > 0) - ExFreePool(rb); - - return Ret; -} - -BOOL STDCALL -NtGdiPatBlt( - HDC hDC, - INT XLeft, - INT YLeft, - INT Width, - INT Height, - DWORD ROP) -{ - PGDIBRUSHOBJ BrushObj; - DC *dc = DC_LockDc(hDC); - BOOL ret; - - if (dc == NULL) - { - SetLastWin32Error(ERROR_INVALID_HANDLE); - return FALSE; - } - if (dc->IsIC) - { - DC_UnlockDc(dc); - /* Yes, Windows really returns TRUE in this case */ - return TRUE; - } - - BrushObj = BRUSHOBJ_LockBrush(dc->Dc_Attr.hbrush); - if (BrushObj == NULL) - { - SetLastWin32Error(ERROR_INVALID_HANDLE); - DC_UnlockDc(dc); - return FALSE; - } - - ret = IntPatBlt( - dc, - XLeft, - YLeft, - Width, - Height, - ROP, - BrushObj); - - BRUSHOBJ_UnlockBrush(BrushObj); - DC_UnlockDc(dc); - - return ret; -} - VOID FASTCALL IntGdiSetSolidBrushColor(HBRUSH hBrush, COLORREF Color) { diff --git a/reactos/subsystems/win32/win32k/win32k.rbuild b/reactos/subsystems/win32/win32k/win32k.rbuild index 0e259e0e321..d427312ab67 100644 --- a/reactos/subsystems/win32/win32k/win32k.rbuild +++ b/reactos/subsystems/win32/win32k/win32k.rbuild @@ -134,6 +134,7 @@ arc.c bezier.c + bitblt.c bitmaps.c brush.c cliprgn.c @@ -147,7 +148,6 @@ icm.c line.c metafile.c - painting.c paintobj.c palobj.c path.c