reactos/win32ss/gdi/dib/i386/dib32bpp_colorfill.s

69 lines
2.2 KiB
ArmAsm
Raw Permalink Normal View History

/*
* PROJECT: Win32 subsystem
* LICENSE: See COPYING in the top level directory
* FILE: win32ss/gdi/dib/i386/dib32bpp_colorfill.s
* PURPOSE: ASM optimised 32bpp ColorFill
* PROGRAMMERS: Magnus Olsen
XLATEOBJ rewrite. The new XLATEOBJ is not allocated from paged pool anymore, but instead allocated on the stack and Initialized. Only when we habe more than a color table with more than 6 entries, we need to allocate an additional buffer. The new interface: EXLATEOBJ_vInitialize is the main init function. It takes a source and destination palette and back and fore colors for monochome surfaces. EXLATEOBJ_vInitXlateFromDCs takes the source and dest DC and is for color translation between 2 surfaces represented by 2 DCs. EXLATEOBJ_vInitBrushXlate initializes an XLATEOBJ for a pattern brush. Finally EXLATEOBJ_vCleanup needs to be called when the XLATEOBJ is not needed anymore. Implement individual iXlate functions for certain cases and store a function pointer in the EXLATEOBJ structure for quick access. Change the usage of the PALETTE.Mode member to be a flag instead of an enum, add usage of PAL_MONOCHOME, PAL_RGB16_555 and PAL_RGB16_565. Add gpalMono, which *should* be used as palette for 1bpp DDBs. Currently there's a hack in the XLATEOBJ init code, to hack around the fact that this is missing. Fix the Hatch brush patterns, as they were inverted. Implement PALETTE_ulGetNearestBitFieldsIndex and PALETTE_ulGetNearestIndex. Get rid of the XLATEOBJ for the mouse pointer instead realize the pointer before usage. Get rid of logicalToSystem PALETTE member. NtGdiGetDIBitsInternal: Don't create a DIBBrush from the BITMAPINFO, when pvBits is NULL, as the function might be uninitualized. This fixes a crash of gdi_regtest. The whole function is quite ugly and needs to be rewritten (like probably the rest of the DIB code). This fixes the problem of artifacts in the selected desktop icons and some color problems. svn path=/trunk/; revision=42391
2009-08-04 20:37:10 +00:00
* Timo Kreuzer (timo.kreuzer@reactos.org)
*/
#include <asm.inc>
.code
/*
* BOOLEAN
* _cdecl
* DIB_32BPP_ColorFill(SURFOBJ* pso, RECTL* prcl, ULONG iColor);
*/
PUBLIC _DIB_32BPP_ColorFill
_DIB_32BPP_ColorFill:
push ebp
mov ebp, esp
push ebx
push esi
push edi
sub esp, 4 /* Space for lDelta */
mov edx, [ebp+12] /* edx = prcl */
mov ecx, [ebp+8] /* ecx = pso */
mov ebx, [ecx+36] /* ebx = pso->lDelta; */
mov [esp], ebx /* lDelta = pso->lDelta; */
mov edi, [edx+4] /* edi = prcl->top; */
mov eax, edi /* eax = prcl->top; */
imul eax, ebx /* eax = prcl->top * pso->lDelta; */
add eax, [ecx+32] /* eax += pso->pvScan0; */
mov ebx, [edx] /* ebx = prcl->left; */
lea esi, [eax+ebx*4] /* esi = pvLine0 = eax + 4 * prcl->left; */
mov ebx, [edx+8] /* ebx = prcl->right; */
sub ebx, [edx] /* ebx = prcl->right - prcl->left; */
jle .end /* if (ebx <= 0) goto end; */
mov edx, [edx+12] /* edx = prcl->bottom; */
sub edx, edi /* edx -= prcl->top; */
jle .end /* if (eax <= 0) goto end; */
mov eax, [ebp+16] /* eax = iColor; */
cld
for_loop: /* do { */
mov edi, esi /* edi = pvLine0; */
mov ecx, ebx /* ecx = cx; */
rep stosd /* memset(pvLine0, iColor, cx); */
add esi, [esp] /* pvLine0 += lDelta; */
dec edx /* cy--; */
jnz for_loop /* } while (cy > 0); */
.end:
mov eax, 1
add esp, 4
pop edi
pop esi
pop ebx
pop ebp
ret
END