ReactOS 0.4.16-dev-1946-g52006dd
dib24bppc.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for dib24bppc.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

VOID DIB_24BPP_HLine (SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file dib24bppc.c.

Function Documentation

◆ DIB_24BPP_HLine()

VOID DIB_24BPP_HLine ( SURFOBJ SurfObj,
LONG  x1,
LONG  x2,
LONG  y,
ULONG  c 
)

Definition at line 16 of file dib24bppc.c.

17{
18 PBYTE addr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta + (x1 << 1) + x1;
19 ULONG Count = x2 - x1;
20
21 if (x1 >= x2)
22 return;
23
24 if (Count < 8)
25 {
26 /* For small fills, don't bother doing anything fancy */
27 while (Count--)
28 {
29 *(PUSHORT)(addr) = c;
30 addr += 2;
31 *(addr) = c >> 16;
32 addr += 1;
33 }
34 }
35 else
36 {
37 ULONG Fill[3];
38 ULONG MultiCount;
39
40 /* Align to 4-byte address */
41 while (0 != ((ULONG_PTR) addr & 0x3))
42 {
43 *(PUSHORT)(addr) = c;
44 addr += 2;
45 *(addr) = c >> 16;
46 addr += 1;
47 Count--;
48 }
49 /* If the color we need to fill with is 0ABC, then the final mem pattern
50 * (note little-endianness) would be:
51 *
52 * |C.B.A|C.B.A|C.B.A|C.B.A| <- pixel borders
53 * |C.B.A.C|B.A.C.B|A.C.B.A| <- ULONG borders
54 *
55 * So, taking endianness into account again, we need to fill with these
56 * ULONGs: CABC BCAB ABCA */
57
58 c = c & 0xffffff; /* 0ABC */
59 Fill[0] = c | (c << 24); /* CABC */
60 Fill[1] = (c >> 8) | (c << 16); /* BCAB */
61 Fill[2] = (c << 8) | (c >> 16); /* ABCA */
62 MultiCount = Count / 4;
63 do
64 {
65 *(PULONG)addr = Fill[0];
66 addr += 4;
67 *(PULONG)addr = Fill[1];
68 addr += 4;
69 *(PULONG)addr = Fill[2];
70 addr += 4;
71 }
72 while (0 != --MultiCount);
73
74 Count = Count & 0x03;
75 while (0 != Count--)
76 {
77 *(PUSHORT)(addr) = c;
78 addr += 2;
79 *(addr) = c >> 16;
80 addr += 1;
81 }
82 }
83}
void Fill(HDC hdc, LONG x, LONG y, COLORREF color)
Definition: drawing.cpp:107
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
const GLubyte * c
Definition: glext.h:8905
GLenum const GLvoid * addr
Definition: glext.h:9621
#define c
Definition: ke_i.h:80
int Count
Definition: noreturn.cpp:7
BYTE * PBYTE
Definition: pedump.c:66
PVOID pvScan0
Definition: winddi.h:1212
LONG lDelta
Definition: winddi.h:1213
uint32_t * PULONG
Definition: typedefs.h:59
uint16_t * PUSHORT
Definition: typedefs.h:56
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3710

Referenced by DIB_24BPP_ColorFill().