From e24313d28a40008d6fcc19bfd70f1e1ff1eb2f2c Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Sat, 4 Jun 2005 13:20:34 +0000 Subject: [PATCH] Optimized DstInvert32 svn path=/trunk/; revision=15769 --- reactos/subsys/win32k/dib/dib32bpp.c | 47 +++++++++++++++++----------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/reactos/subsys/win32k/dib/dib32bpp.c b/reactos/subsys/win32k/dib/dib32bpp.c index 54e7600dff6..f30d1d27dd9 100644 --- a/reactos/subsys/win32k/dib/dib32bpp.c +++ b/reactos/subsys/win32k/dib/dib32bpp.c @@ -398,32 +398,41 @@ DIB_32BPP_BitBlt(PBLTINFO BltInfo) } /* optimze functions for bitblt */ -BOOLEAN +VOID +FASTCALL DIB_32DstInvert(PBLTINFO BltInfo) { - // return(~Dest); - ULONG DestX, DestY; - ULONG Dest; PULONG DestBits; + ULONG top = BltInfo->DestRect.top; + ULONG bottom = BltInfo->DestRect.left; + ULONG DestX = BltInfo->DestRect.right - left; + ULONG DestY = BltInfo->DestRect.bottom - top; + ULONG delta = BltInfo->DestSurface->lDelta - (DestX << 2); - ULONG bottom = BltInfo->DestRect.bottom; - ULONG right = BltInfo->DestRect.right; - ULONG delta = BltInfo->DestSurface->lDelta - ((BltInfo->DestRect.right - BltInfo->DestRect.left) <<2) ; + /* Calculate the Initial Destination */ + DestBits = (PULONG)(BltInfo->DestSurface->pvScan0 + (left << 2) + + top * BltInfo->DestSurface->lDelta); - DestBits = (PULONG)(BltInfo->DestSurface->pvScan0 + (BltInfo->DestRect.left << 2) + - BltInfo->DestRect.top * BltInfo->DestSurface->lDelta); - - for (DestY = BltInfo->DestRect.top; DestY < bottom; DestY++) - { - for (DestX = BltInfo->DestRect.left; DestX < right; DestX++, DestBits++) - { - Dest = *DestBits; - *DestBits = ~Dest; - } + do while (DestY > 0) + { + do while (DestX > 0) + { + /* Invert bits */ + *DestBits =~ *DestBits; + + /* Update Position */ + DestBits++; + + /* Decrease distance to do */ + DestX--; + } - DestBits = (PULONG)((ULONG_PTR)DestBits + delta); + /* Update position */ + DestBits = (PULONG)((ULONG_PTR)DestBits + delta); + + /* Decrease distance to do */ + DestY--; } -return TRUE; } BOOLEAN