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 PFN_DIB_PutPixel
DIB_4BPP_PutPixel(PSURFOBJ SurfObj
, LONG x
, LONG y
, ULONG c
)
15 PBYTE addr
= SurfObj
->pvBits
;
17 addr
+= (x
>>1) + y
* SurfObj
->lDelta
;
18 *addr
= (*addr
& notmask
[x
&1]) | (c
<< ((1-(x
&1))<<2));
21 PFN_DIB_GetPixel
DIB_4BPP_GetPixel(PSURFOBJ SurfObj
, LONG x
, LONG y
)
23 PBYTE addr
= SurfObj
->pvBits
;
25 return (PFN_DIB_GetPixel
)((addr
[(x
>>1) + y
* SurfObj
->lDelta
] >> ((1-(x
&1))<<2) ) & 0x0f);
28 PFN_DIB_HLine
DIB_4BPP_HLine(PSURFOBJ SurfObj
, LONG x1
, LONG x2
, LONG y
, ULONG c
)
30 PBYTE addr
= SurfObj
->pvBits
+ (x1
>>1) + y
* SurfObj
->lDelta
;
34 *addr
= (*addr
& notmask
[x1
&1]) | (c
<< ((1-(x1
&1))<<2));
41 PFN_DIB_VLine
DIB_4BPP_VLine(PSURFOBJ SurfObj
, LONG x
, LONG y1
, LONG y2
, ULONG c
)
43 PBYTE addr
= SurfObj
->pvBits
;
44 int lDelta
= SurfObj
->lDelta
;
46 addr
+= (x
>>1) + y1
* lDelta
;
48 *addr
= (*addr
& notmask
[x
&1]) | (c
<< ((1-(x
&1))<<2));
53 BOOLEAN
DIB_To_4BPP_Bitblt( SURFOBJ
*DestSurf
, SURFOBJ
*SourceSurf
,
54 SURFGDI
*DestGDI
, SURFGDI
*SourceGDI
,
55 PRECTL DestRect
, POINTL
*SourcePoint
,
56 LONG Delta
, XLATEOBJ
*ColorTranslation
)
58 LONG i
, j
, sx
, sy
, f1
, f2
, xColor
;
59 PBYTE SourceBits_24BPP
, SourceLine_24BPP
;
60 PBYTE DestBits
, DestLine
, SourceBits_4BPP
, SourceBits_8BPP
, SourceLine_4BPP
, SourceLine_8BPP
;
61 PWORD SourceBits_16BPP
, SourceLine_16BPP
;
62 PDWORD SourceBits_32BPP
, SourceLine_32BPP
;
64 DestBits
= DestSurf
->pvBits
+ (DestRect
->left
>>1) + DestRect
->top
* DestSurf
->lDelta
;
66 switch(SourceGDI
->BitsPerPixel
)
72 for (j
=DestRect
->top
; j
<DestRect
->bottom
; j
++)
75 for (i
=DestRect
->left
; i
<DestRect
->right
; i
++)
77 if(DIB_1BPP_GetPixel(SourceSurf
, sx
, sy
) == 0)
79 DIB_4BPP_PutPixel(DestSurf
, i
, j
, XLATEOBJ_iXlate(ColorTranslation
, 0));
81 DIB_4BPP_PutPixel(DestSurf
, i
, j
, XLATEOBJ_iXlate(ColorTranslation
, 1));
92 for (j
=DestRect
->top
; j
<DestRect
->bottom
; j
++)
96 for (i
=DestRect
->left
; i
<DestRect
->right
; i
++)
98 DIB_4BPP_PutPixel(DestSurf
, i
, j
, XLATEOBJ_iXlate(ColorTranslation
, DIB_4BPP_GetPixel(SourceSurf
, sx
, sy
)));
106 SourceBits_8BPP
= SourceSurf
->pvBits
+ (SourcePoint
->y
* SourceSurf
->lDelta
) + SourcePoint
->x
;
108 for (j
=DestRect
->top
; j
<DestRect
->bottom
; j
++)
110 SourceLine_8BPP
= SourceBits_8BPP
;
114 f2
= DestRect
->left
& 1;
116 for (i
=DestRect
->left
; i
<DestRect
->right
; i
++)
118 *DestLine
= (*DestLine
& notmask
[i
&1]) |
119 ((XLATEOBJ_iXlate(ColorTranslation
, *SourceLine_8BPP
)) << ((4 * (1-(sx
& 1)))));
120 if(f2
== 1) { DestLine
++; f2
= 0; } else { f2
= 1; }
125 SourceBits_8BPP
+= SourceSurf
->lDelta
;
126 DestBits
+= DestSurf
->lDelta
;
131 SourceBits_24BPP
= SourceSurf
->pvBits
+ (SourcePoint
->y
* SourceSurf
->lDelta
) + SourcePoint
->x
* 3;
133 for (j
=DestRect
->top
; j
<DestRect
->bottom
; j
++)
135 SourceLine_24BPP
= SourceBits_24BPP
;
139 f2
= DestRect
->left
& 1;
141 for (i
=DestRect
->left
; i
<DestRect
->right
; i
++)
143 xColor
= (*(SourceLine_24BPP
+ 2) << 0x10) +
144 (*(SourceLine_24BPP
+ 1) << 0x08) +
145 (*(SourceLine_24BPP
));
146 *DestLine
= (*DestLine
& notmask
[i
&1]) |
147 ((XLATEOBJ_iXlate(ColorTranslation
, xColor
)) << ((4 * (1-(sx
& 1)))));
148 if(f2
== 1) { DestLine
++; f2
= 0; } else { f2
= 1; }
153 SourceBits_24BPP
+= SourceSurf
->lDelta
;
154 DestBits
+= DestSurf
->lDelta
;
159 DbgPrint("DIB_4BPP_Bitblt: Unhandled Source BPP: %u\n", SourceGDI
->BitsPerPixel
);