1 #undef WIN32_LEAN_AND_MEAN
4 #include <win32k/bitmaps.h>
5 #include <win32k/debug.h>
7 #include <ddk/winddi.h>
8 #include "../eng/objects.h"
11 VOID
DIB_8BPP_PutPixel(PSURFOBJ SurfObj
, LONG x
, LONG y
, ULONG c
)
13 PBYTE byteaddr
= SurfObj
->pvScan0
+ y
* SurfObj
->lDelta
+ x
;
18 ULONG
DIB_8BPP_GetPixel(PSURFOBJ SurfObj
, LONG x
, LONG y
)
20 PBYTE byteaddr
= SurfObj
->pvScan0
+ y
* SurfObj
->lDelta
+ x
;
22 return (ULONG
)(*byteaddr
);
25 VOID
DIB_8BPP_HLine(PSURFOBJ SurfObj
, LONG x1
, LONG x2
, LONG y
, ULONG c
)
27 PBYTE byteaddr
= SurfObj
->pvScan0
+ y
* SurfObj
->lDelta
;
28 PBYTE addr
= byteaddr
+ x1
;
38 VOID
DIB_8BPP_VLine(PSURFOBJ SurfObj
, LONG x
, LONG y1
, LONG y2
, ULONG c
)
40 PBYTE byteaddr
= SurfObj
->pvScan0
+ y1
* SurfObj
->lDelta
;
41 PBYTE addr
= byteaddr
+ x
;
42 LONG lDelta
= SurfObj
->lDelta
;
52 BOOLEAN
DIB_8BPP_BitBlt(SURFOBJ
*DestSurf
, SURFOBJ
*SourceSurf
,
53 SURFGDI
*DestGDI
, SURFGDI
*SourceGDI
,
54 PRECTL DestRect
, POINTL
*SourcePoint
,
55 XLATEOBJ
*ColorTranslation
)
57 ULONG i
, j
, sx
, sy
, xColor
, f1
;
58 PBYTE SourceBits
, DestBits
, SourceLine
, DestLine
;
59 PBYTE SourceBits_4BPP
, SourceLine_4BPP
;
61 DestBits
= DestSurf
->pvScan0
+ (DestRect
->top
* DestSurf
->lDelta
) + DestRect
->left
;
63 switch(SourceGDI
->BitsPerPixel
)
69 for (j
=DestRect
->top
; j
<DestRect
->bottom
; j
++)
72 for (i
=DestRect
->left
; i
<DestRect
->right
; i
++)
74 if(DIB_1BPP_GetPixel(SourceSurf
, sx
, sy
) == 0)
76 DIB_8BPP_PutPixel(DestSurf
, i
, j
, XLATEOBJ_iXlate(ColorTranslation
, 0));
78 DIB_8BPP_PutPixel(DestSurf
, i
, j
, XLATEOBJ_iXlate(ColorTranslation
, 1));
87 SourceBits_4BPP
= SourceSurf
->pvScan0
+ (SourcePoint
->y
* SourceSurf
->lDelta
) + (SourcePoint
->x
>> 1);
89 for (j
=DestRect
->top
; j
<DestRect
->bottom
; j
++)
91 SourceLine_4BPP
= SourceBits_4BPP
;
95 for (i
=DestRect
->left
; i
<DestRect
->right
; i
++)
97 xColor
= XLATEOBJ_iXlate(ColorTranslation
,
98 (*SourceLine_4BPP
& altnotmask
[sx
&1]) >> (4 * (1-(sx
& 1))));
99 DIB_8BPP_PutPixel(DestSurf
, i
, j
, xColor
);
100 if(f1
== 1) { SourceLine_4BPP
++; f1
= 0; } else { f1
= 1; }
104 SourceBits_4BPP
+= SourceSurf
->lDelta
;
109 if (NULL
== ColorTranslation
|| 0 != (ColorTranslation
->flXlate
& XO_TRIVIAL
))
111 SourceBits
= SourceSurf
->pvScan0
+ (SourcePoint
->y
* SourceSurf
->lDelta
) + SourcePoint
->x
;
112 for (j
= DestRect
->top
; j
< DestRect
->bottom
; j
++)
114 RtlCopyMemory(DestBits
, SourceBits
, DestRect
->right
- DestRect
->left
);
115 SourceBits
+= SourceSurf
->lDelta
;
116 DestBits
+= DestSurf
->lDelta
;
122 DPRINT1("DIB_8BPP_Bitblt: Unhandled ColorTranslation for 32 -> 32 copy");
128 SourceLine
= SourceSurf
->pvScan0
+ (SourcePoint
->y
* SourceSurf
->lDelta
) + 2 * SourcePoint
->x
;
131 for (j
= DestRect
->top
; j
< DestRect
->bottom
; j
++)
133 SourceBits
= SourceLine
;
136 for (i
= DestRect
->left
; i
< DestRect
->right
; i
++)
138 xColor
= *((PWORD
) SourceBits
);
139 *DestBits
= XLATEOBJ_iXlate(ColorTranslation
, xColor
);
144 SourceLine
+= SourceSurf
->lDelta
;
145 DestLine
+= DestSurf
->lDelta
;
150 SourceLine
= SourceSurf
->pvScan0
+ (SourcePoint
->y
* SourceSurf
->lDelta
) + 3 * SourcePoint
->x
;
153 for (j
= DestRect
->top
; j
< DestRect
->bottom
; j
++)
155 SourceBits
= SourceLine
;
158 for (i
= DestRect
->left
; i
< DestRect
->right
; i
++)
160 xColor
= (*(SourceBits
+ 2) << 0x10) +
161 (*(SourceBits
+ 1) << 0x08) +
163 *DestBits
= XLATEOBJ_iXlate(ColorTranslation
, xColor
);
168 SourceLine
+= SourceSurf
->lDelta
;
169 DestLine
+= DestSurf
->lDelta
;
174 SourceLine
= SourceSurf
->pvScan0
+ (SourcePoint
->y
* SourceSurf
->lDelta
) + 4 * SourcePoint
->x
;
177 for (j
= DestRect
->top
; j
< DestRect
->bottom
; j
++)
179 SourceBits
= SourceLine
;
182 for (i
= DestRect
->left
; i
< DestRect
->right
; i
++)
184 xColor
= *((PDWORD
) SourceBits
);
185 *DestBits
= XLATEOBJ_iXlate(ColorTranslation
, xColor
);
190 SourceLine
+= SourceSurf
->lDelta
;
191 DestLine
+= DestSurf
->lDelta
;
196 DbgPrint("DIB_8BPP_Bitblt: Unhandled Source BPP: %u\n", SourceGDI
->BitsPerPixel
);