e8231bbb8498ac96ab9a5fb9bba5ca2f3484d07e
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_4BPP_PutPixel(PSURFOBJ SurfObj
, LONG x
, LONG y
, ULONG c
)
13 PBYTE addr
= SurfObj
->pvScan0
;
15 addr
+= (x
>>1) + y
* SurfObj
->lDelta
;
16 *addr
= (*addr
& notmask
[x
&1]) | (c
<< ((1-(x
&1))<<2));
19 ULONG
DIB_4BPP_GetPixel(PSURFOBJ SurfObj
, LONG x
, LONG y
)
21 PBYTE addr
= SurfObj
->pvScan0
;
23 return (addr
[(x
>>1) + y
* SurfObj
->lDelta
] >> ((1-(x
&1))<<2) ) & 0x0f;
26 VOID
DIB_4BPP_HLine(PSURFOBJ SurfObj
, LONG x1
, LONG x2
, LONG y
, ULONG c
)
28 PBYTE addr
= SurfObj
->pvScan0
+ (x1
>>1) + y
* SurfObj
->lDelta
;
32 *addr
= (*addr
& notmask
[x1
&1]) | (c
<< ((1-(x1
&1))<<2));
39 VOID
DIB_4BPP_VLine(PSURFOBJ SurfObj
, LONG x
, LONG y1
, LONG y2
, ULONG c
)
41 PBYTE addr
= SurfObj
->pvScan0
;
42 int lDelta
= SurfObj
->lDelta
;
44 addr
+= (x
>>1) + y1
* lDelta
;
46 *addr
= (*addr
& notmask
[x
&1]) | (c
<< ((1-(x
&1))<<2));
51 BOOLEAN
DIB_4BPP_BitBlt(SURFOBJ
*DestSurf
, SURFOBJ
*SourceSurf
,
52 SURFGDI
*DestGDI
, SURFGDI
*SourceGDI
,
53 PRECTL DestRect
, POINTL
*SourcePoint
,
54 XLATEOBJ
*ColorTranslation
)
56 LONG i
, j
, sx
, sy
, f1
, f2
, xColor
;
57 PBYTE SourceBits_24BPP
, SourceLine_24BPP
;
58 PBYTE DestBits
, DestLine
, SourceBits_8BPP
, SourceLine_8BPP
;
59 PBYTE SourceBits
, SourceLine
;
61 DestBits
= DestSurf
->pvScan0
+ (DestRect
->left
>>1) + DestRect
->top
* DestSurf
->lDelta
;
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_4BPP_PutPixel(DestSurf
, i
, j
, XLATEOBJ_iXlate(ColorTranslation
, 0));
78 DIB_4BPP_PutPixel(DestSurf
, i
, j
, XLATEOBJ_iXlate(ColorTranslation
, 1));
89 for (j
=DestRect
->top
; j
<DestRect
->bottom
; j
++)
93 for (i
=DestRect
->left
; i
<DestRect
->right
; i
++)
95 DIB_4BPP_PutPixel(DestSurf
, i
, j
, XLATEOBJ_iXlate(ColorTranslation
, DIB_4BPP_GetPixel(SourceSurf
, sx
, sy
)));
103 SourceBits_8BPP
= SourceSurf
->pvScan0
+ (SourcePoint
->y
* SourceSurf
->lDelta
) + SourcePoint
->x
;
105 for (j
=DestRect
->top
; j
<DestRect
->bottom
; j
++)
107 SourceLine_8BPP
= SourceBits_8BPP
;
109 f2
= DestRect
->left
& 1;
111 for (i
=DestRect
->left
; i
<DestRect
->right
; i
++)
113 *DestLine
= (*DestLine
& notmask
[i
&1]) |
114 ((XLATEOBJ_iXlate(ColorTranslation
, *SourceLine_8BPP
)) << ((4 * (1-(i
& 1)))));
115 if(f2
== 1) { DestLine
++; f2
= 0; } else { f2
= 1; }
119 SourceBits_8BPP
+= SourceSurf
->lDelta
;
120 DestBits
+= DestSurf
->lDelta
;
125 SourceLine
= SourceSurf
->pvScan0
+ (SourcePoint
->y
* SourceSurf
->lDelta
) + 2 * SourcePoint
->x
;
128 for (j
= DestRect
->top
; j
< DestRect
->bottom
; j
++)
130 SourceBits
= SourceLine
;
132 f2
= DestRect
->left
& 1;
134 for (i
= DestRect
->left
; i
< DestRect
->right
; i
++)
136 xColor
= *((PWORD
) SourceBits
);
137 *DestBits
= (*DestBits
& notmask
[i
&1]) |
138 ((XLATEOBJ_iXlate(ColorTranslation
, xColor
)) << ((4 * (1-(i
& 1)))));
139 if(f2
== 1) { DestBits
++; f2
= 0; } else { f2
= 1; }
143 SourceLine
+= SourceSurf
->lDelta
;
144 DestLine
+= DestSurf
->lDelta
;
149 SourceBits_24BPP
= SourceSurf
->pvScan0
+ (SourcePoint
->y
* SourceSurf
->lDelta
) + SourcePoint
->x
* 3;
151 for (j
=DestRect
->top
; j
<DestRect
->bottom
; j
++)
153 SourceLine_24BPP
= SourceBits_24BPP
;
155 f2
= DestRect
->left
& 1;
157 for (i
=DestRect
->left
; i
<DestRect
->right
; i
++)
159 xColor
= (*(SourceLine_24BPP
+ 2) << 0x10) +
160 (*(SourceLine_24BPP
+ 1) << 0x08) +
161 (*(SourceLine_24BPP
));
162 *DestLine
= (*DestLine
& notmask
[i
&1]) |
163 ((XLATEOBJ_iXlate(ColorTranslation
, xColor
)) << ((4 * (1-(i
& 1)))));
164 if(f2
== 1) { DestLine
++; f2
= 0; } else { f2
= 1; }
168 SourceBits_24BPP
+= SourceSurf
->lDelta
;
169 DestBits
+= 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
;
181 f2
= DestRect
->left
& 1;
183 for (i
= DestRect
->left
; i
< DestRect
->right
; i
++)
185 xColor
= *((PDWORD
) SourceBits
);
186 *DestBits
= (*DestBits
& notmask
[i
&1]) |
187 ((XLATEOBJ_iXlate(ColorTranslation
, xColor
)) << ((4 * (1-(i
& 1)))));
188 if(f2
== 1) { DestBits
++; f2
= 0; } else { f2
= 1; }
192 SourceLine
+= SourceSurf
->lDelta
;
193 DestLine
+= DestSurf
->lDelta
;
198 DbgPrint("DIB_4BPP_Bitblt: Unhandled Source BPP: %u\n", SourceGDI
->BitsPerPixel
);