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_16BPP_PutPixel(PSURFOBJ SurfObj
, LONG x
, LONG y
, ULONG c
)
13 PBYTE byteaddr
= SurfObj
->pvBits
+ y
* SurfObj
->lDelta
;
14 PWORD addr
= (PWORD
)byteaddr
+ x
;
19 ULONG
DIB_16BPP_GetPixel(PSURFOBJ SurfObj
, LONG x
, LONG y
)
21 PBYTE byteaddr
= SurfObj
->pvBits
+ y
* SurfObj
->lDelta
;
22 PWORD addr
= (PWORD
)byteaddr
+ x
;
24 return (ULONG
)(*addr
);
27 VOID
DIB_16BPP_HLine(PSURFOBJ SurfObj
, LONG x1
, LONG x2
, LONG y
, ULONG c
)
29 PBYTE byteaddr
= SurfObj
->pvBits
+ y
* SurfObj
->lDelta
;
30 PWORD addr
= (PWORD
)byteaddr
+ x1
;
40 VOID
DIB_16BPP_VLine(PSURFOBJ SurfObj
, LONG x
, LONG y1
, LONG y2
, ULONG c
)
42 PBYTE byteaddr
= SurfObj
->pvBits
+ y1
* SurfObj
->lDelta
;
43 PWORD addr
= (PWORD
)byteaddr
+ x
;
44 LONG lDelta
= SurfObj
->lDelta
;
46 byteaddr
= (PBYTE
)addr
;
51 addr
= (PWORD
)byteaddr
;
55 BOOL
DIB_To_16BPP_Bitblt( SURFOBJ
*DestSurf
, SURFOBJ
*SourceSurf
,
56 SURFGDI
*DestGDI
, SURFGDI
*SourceGDI
,
57 PRECTL DestRect
, POINTL
*SourcePoint
,
58 LONG Delta
, XLATEOBJ
*ColorTranslation
)
60 LONG i
, j
, sx
, sy
, xColor
, f1
;
61 PBYTE SourceBits
, DestBits
, SourceLine
, DestLine
;
62 PBYTE SourceBits_4BPP
, SourceLine_4BPP
;
63 DestBits
= DestSurf
->pvBits
+ (DestRect
->top
* DestSurf
->lDelta
) + 2 * DestRect
->left
;
65 switch(SourceGDI
->BitsPerPixel
)
71 for (j
=DestRect
->top
; j
<DestRect
->bottom
; j
++)
74 for (i
=DestRect
->left
; i
<DestRect
->right
; i
++)
76 if(DIB_1BPP_GetPixel(SourceSurf
, sx
, sy
) == 0)
78 DIB_16BPP_PutPixel(DestSurf
, i
, j
, XLATEOBJ_iXlate(ColorTranslation
, 0));
80 DIB_16BPP_PutPixel(DestSurf
, i
, j
, XLATEOBJ_iXlate(ColorTranslation
, 1));
89 SourceBits_4BPP
= SourceSurf
->pvBits
+ (SourcePoint
->y
* SourceSurf
->lDelta
) + SourcePoint
->x
;
91 for (j
=DestRect
->top
; j
<DestRect
->bottom
; j
++)
93 SourceLine_4BPP
= SourceBits_4BPP
;
97 for (i
=DestRect
->left
; i
<DestRect
->right
; i
++)
99 xColor
= XLATEOBJ_iXlate(ColorTranslation
,
100 (*SourceLine_4BPP
& altnotmask
[sx
&1]) >> (4 * (1-(sx
& 1))));
101 DIB_16BPP_PutPixel(DestSurf
, i
, j
, xColor
);
102 if(f1
== 1) { SourceLine_4BPP
++; f1
= 0; } else { f1
= 1; }
106 SourceBits_4BPP
+= SourceSurf
->lDelta
;
111 if (NULL
== ColorTranslation
|| 0 != (ColorTranslation
->flXlate
& XO_TRIVIAL
))
113 SourceBits
= SourceSurf
->pvBits
+ (SourcePoint
->y
* SourceSurf
->lDelta
) + 2 * SourcePoint
->x
;
114 for (j
= DestRect
->top
; j
< DestRect
->bottom
; j
++)
116 RtlCopyMemory(DestBits
, SourceBits
, 2 * (DestRect
->right
- DestRect
->left
));
117 SourceBits
+= SourceSurf
->lDelta
;
118 DestBits
+= DestSurf
->lDelta
;
124 DPRINT1("DIB_16BPP_Bitblt: Unhandled ColorTranslation for 16 -> 16 copy");
130 SourceLine
= SourceSurf
->pvBits
+ (SourcePoint
->y
* SourceSurf
->lDelta
) + 3 * SourcePoint
->x
;
133 for (j
= DestRect
->top
; j
< DestRect
->bottom
; j
++)
135 SourceBits
= SourceLine
;
138 for (i
= DestRect
->left
; i
< DestRect
->right
; i
++)
140 xColor
= (*(SourceBits
+ 2) << 0x10) +
141 (*(SourceBits
+ 1) << 0x08) +
143 *((WORD
*)DestBits
) = (WORD
)XLATEOBJ_iXlate(ColorTranslation
, xColor
);
148 SourceLine
+= SourceSurf
->lDelta
;
149 DestLine
+= DestSurf
->lDelta
;
154 DbgPrint("DIB_16BPP_Bitblt: Unhandled Source BPP: %u\n", SourceGDI
->BitsPerPixel
);