2 * PROJECT: Win32 subsystem
3 * LICENSE: See COPYING in the top level directory
4 * FILE: subsystems/win32/win32k/dib/dib24bppc.c
5 * PURPOSE: C language equivalents of asm optimised 24bpp functions
6 * PROGRAMMERS: Jason Filby
16 DIB_24BPP_HLine(SURFOBJ
*SurfObj
, LONG x1
, LONG x2
, LONG y
, ULONG c
)
18 PBYTE addr
= (PBYTE
)SurfObj
->pvScan0
+ y
* SurfObj
->lDelta
+ (x1
<< 1) + x1
;
19 ULONG Count
= x2
- x1
;
23 /* For small fills, don't bother doing anything fancy */
37 /* Align to 4-byte address */
38 while (0 != ((ULONG_PTR
) addr
& 0x3))
46 /* If the color we need to fill with is 0ABC, then the final mem pattern
47 * (note little-endianness) would be:
49 * |C.B.A|C.B.A|C.B.A|C.B.A| <- pixel borders
50 * |C.B.A.C|B.A.C.B|A.C.B.A| <- ULONG borders
52 * So, taking endianness into account again, we need to fill with these
53 * ULONGs: CABC BCAB ABCA */
55 c
= c
& 0xffffff; /* 0ABC */
56 Fill
[0] = c
| (c
<< 24); /* CABC */
57 Fill
[1] = (c
>> 8) | (c
<< 16); /* BCAB */
58 Fill
[2] = (c
<< 8) | (c
>> 16); /* ABCA */
59 MultiCount
= Count
/ 4;
62 *(PULONG
)addr
= Fill
[0];
64 *(PULONG
)addr
= Fill
[1];
66 *(PULONG
)addr
= Fill
[2];
69 while (0 != --MultiCount
);