38a479a52d04168577ff5c3374d7a8ddab89cd04
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_32BPP_PutPixel(PSURFOBJ SurfObj
, LONG x
, LONG y
, ULONG c
)
13 PBYTE byteaddr
= SurfObj
->pvScan0
+ y
* SurfObj
->lDelta
;
14 PDWORD addr
= (PDWORD
)byteaddr
+ x
;
19 ULONG
DIB_32BPP_GetPixel(PSURFOBJ SurfObj
, LONG x
, LONG y
)
21 PBYTE byteaddr
= SurfObj
->pvScan0
+ y
* SurfObj
->lDelta
;
22 PDWORD addr
= (PDWORD
)byteaddr
+ x
;
24 return (ULONG
)(*addr
);
27 VOID
DIB_32BPP_HLine(PSURFOBJ SurfObj
, LONG x1
, LONG x2
, LONG y
, ULONG c
)
29 PBYTE byteaddr
= SurfObj
->pvScan0
+ y
* SurfObj
->lDelta
;
30 PDWORD addr
= (PDWORD
)byteaddr
+ x1
;
40 VOID
DIB_32BPP_VLine(PSURFOBJ SurfObj
, LONG x
, LONG y1
, LONG y2
, ULONG c
)
42 PBYTE byteaddr
= SurfObj
->pvScan0
+ y1
* SurfObj
->lDelta
;
43 PDWORD addr
= (PDWORD
)byteaddr
+ x
;
44 LONG lDelta
= SurfObj
->lDelta
/ sizeof(DWORD
);
46 byteaddr
= (PBYTE
)addr
;
54 BOOLEAN
DIB_32BPP_BitBlt(SURFOBJ
*DestSurf
, SURFOBJ
*SourceSurf
,
55 SURFGDI
*DestGDI
, SURFGDI
*SourceGDI
,
56 PRECTL DestRect
, POINTL
*SourcePoint
,
57 XLATEOBJ
*ColorTranslation
)
59 ULONG i
, j
, sx
, sy
, xColor
, f1
;
60 PBYTE SourceBits
, DestBits
, SourceLine
, DestLine
;
61 PBYTE SourceBits_4BPP
, SourceLine_4BPP
;
63 DestBits
= DestSurf
->pvScan0
+ (DestRect
->top
* DestSurf
->lDelta
) + 4 * 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_32BPP_PutPixel(DestSurf
, i
, j
, XLATEOBJ_iXlate(ColorTranslation
, 0));
80 DIB_32BPP_PutPixel(DestSurf
, i
, j
, XLATEOBJ_iXlate(ColorTranslation
, 1));
89 SourceBits_4BPP
= SourceSurf
->pvScan0
+ (SourcePoint
->y
* SourceSurf
->lDelta
) + (SourcePoint
->x
>> 1);
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_32BPP_PutPixel(DestSurf
, i
, j
, xColor
);
102 if(f1
== 1) { SourceLine_4BPP
++; f1
= 0; } else { f1
= 1; }
106 SourceBits_4BPP
+= SourceSurf
->lDelta
;
111 SourceLine
= SourceSurf
->pvScan0
+ (SourcePoint
->y
* SourceSurf
->lDelta
) + SourcePoint
->x
;
114 for (j
= DestRect
->top
; j
< DestRect
->bottom
; j
++)
116 SourceBits
= SourceLine
;
119 for (i
= DestRect
->left
; i
< DestRect
->right
; i
++)
121 xColor
= *SourceBits
;
122 *((PDWORD
) DestBits
) = (DWORD
)XLATEOBJ_iXlate(ColorTranslation
, xColor
);
127 SourceLine
+= SourceSurf
->lDelta
;
128 DestLine
+= DestSurf
->lDelta
;
133 SourceLine
= SourceSurf
->pvScan0
+ (SourcePoint
->y
* SourceSurf
->lDelta
) + 2 * SourcePoint
->x
;
136 for (j
= DestRect
->top
; j
< DestRect
->bottom
; j
++)
138 SourceBits
= SourceLine
;
141 for (i
= DestRect
->left
; i
< DestRect
->right
; i
++)
143 xColor
= *((PWORD
) SourceBits
);
144 *((PDWORD
) DestBits
) = (DWORD
)XLATEOBJ_iXlate(ColorTranslation
, xColor
);
149 SourceLine
+= SourceSurf
->lDelta
;
150 DestLine
+= DestSurf
->lDelta
;
155 SourceLine
= SourceSurf
->pvScan0
+ (SourcePoint
->y
* SourceSurf
->lDelta
) + 3 * SourcePoint
->x
;
158 for (j
= DestRect
->top
; j
< DestRect
->bottom
; j
++)
160 SourceBits
= SourceLine
;
163 for (i
= DestRect
->left
; i
< DestRect
->right
; i
++)
165 xColor
= (*(SourceBits
+ 2) << 0x10) +
166 (*(SourceBits
+ 1) << 0x08) +
168 *((PDWORD
)DestBits
) = (DWORD
)XLATEOBJ_iXlate(ColorTranslation
, xColor
);
173 SourceLine
+= SourceSurf
->lDelta
;
174 DestLine
+= DestSurf
->lDelta
;
179 if (NULL
== ColorTranslation
|| 0 != (ColorTranslation
->flXlate
& XO_TRIVIAL
))
181 SourceBits
= SourceSurf
->pvScan0
+ (SourcePoint
->y
* SourceSurf
->lDelta
) + 4 * SourcePoint
->x
;
182 for (j
= DestRect
->top
; j
< DestRect
->bottom
; j
++)
184 RtlCopyMemory(DestBits
, SourceBits
, 4 * (DestRect
->right
- DestRect
->left
));
185 SourceBits
+= SourceSurf
->lDelta
;
186 DestBits
+= DestSurf
->lDelta
;
192 DPRINT1("DIB_32BPP_Bitblt: Unhandled ColorTranslation for 32 -> 32 copy");
198 DbgPrint("DIB_32BPP_Bitblt: Unhandled Source BPP: %u\n", SourceGDI
->BitsPerPixel
);