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_24BPP_PutPixel(PSURFOBJ SurfObj
, LONG x
, LONG y
, ULONG c
)
13 PBYTE byteaddr
= SurfObj
->pvBits
+ y
* SurfObj
->lDelta
;
14 PRGBTRIPLE addr
= (PRGBTRIPLE
)byteaddr
+ x
;
19 PFN_DIB_GetPixel
DIB_24BPP_GetPixel(PSURFOBJ SurfObj
, LONG x
, LONG y
)
21 PBYTE byteaddr
= SurfObj
->pvBits
+ y
* SurfObj
->lDelta
;
22 PRGBTRIPLE addr
= (PRGBTRIPLE
)byteaddr
+ x
;
24 return (PFN_DIB_GetPixel
)(*(PULONG
)(addr
));
27 PFN_DIB_HLine
DIB_24BPP_HLine(PSURFOBJ SurfObj
, LONG x1
, LONG x2
, LONG y
, ULONG c
)
29 PBYTE byteaddr
= SurfObj
->pvBits
+ y
* SurfObj
->lDelta
;
30 PRGBTRIPLE addr
= (PRGBTRIPLE
)byteaddr
+ x1
;
40 PFN_DIB_VLine
DIB_24BPP_VLine(PSURFOBJ SurfObj
, LONG x
, LONG y1
, LONG y2
, ULONG c
)
42 PBYTE byteaddr
= SurfObj
->pvBits
+ y1
* SurfObj
->lDelta
;
43 PRGBTRIPLE addr
= (PRGBTRIPLE
)byteaddr
+ x
;
44 LONG lDelta
= SurfObj
->lDelta
;
46 byteaddr
= (PBYTE
)addr
;
51 addr
= (PRGBTRIPLE
)byteaddr
;
55 VOID
DIB_24BPP_BltTo_24BPP(PSURFOBJ dstpsd
, LONG dstx
, LONG dsty
, LONG w
, LONG h
,
56 PSURFOBJ srcpsd
, LONG srcx
, LONG srcy
)
63 int dlDelta
= dstpsd
->lDelta
;
64 int slDelta
= srcpsd
->lDelta
;
66 bytedst
= (char *)dstpsd
->pvBits
+ dsty
* dlDelta
;
67 bytesrc
= (char *)srcpsd
->pvBits
+ srcy
* slDelta
;
68 dst
= (PRGBTRIPLE
)bytedst
+ dstx
;
69 src
= (PRGBTRIPLE
)bytesrc
+ srcx
;
86 BOOLEAN
DIB_To_24BPP_Bitblt( SURFOBJ
*DestSurf
, SURFOBJ
*SourceSurf
,
87 SURFGDI
*DestGDI
, SURFGDI
*SourceGDI
,
88 PRECTL DestRect
, POINTL
*SourcePoint
,
89 LONG Delta
, XLATEOBJ
*ColorTranslation
)
91 LONG i
, j
, sx
, sy
, xColor
, f1
;
92 PBYTE DestBits
, SourceBits_24BPP
, DestLine
, SourceLine_24BPP
;
93 PRGBTRIPLE SPDestBits
, SPSourceBits_24BPP
, SPDestLine
, SPSourceLine_24BPP
; // specially for 24-to-24 blit
94 PBYTE SourceBits_4BPP
, SourceBits_8BPP
, SourceLine_4BPP
, SourceLine_8BPP
;
95 PWORD SourceBits_16BPP
, SourceLine_16BPP
;
96 PDWORD SourceBits_32BPP
, SourceLine_32BPP
;
98 DestBits
= DestSurf
->pvBits
+ (DestRect
->top
* DestSurf
->lDelta
) + DestRect
->left
* 3;
100 switch(SourceGDI
->BitsPerPixel
)
106 for (j
=DestRect
->top
; j
<DestRect
->bottom
; j
++)
109 for (i
=DestRect
->left
; i
<DestRect
->right
; i
++)
111 if(DIB_1BPP_GetPixel(SourceSurf
, sx
, sy
) == 0)
113 DIB_24BPP_PutPixel(DestSurf
, i
, j
, XLATEOBJ_iXlate(ColorTranslation
, 0));
115 DIB_24BPP_PutPixel(DestSurf
, i
, j
, XLATEOBJ_iXlate(ColorTranslation
, 1));
124 SourceBits_4BPP
= SourceSurf
->pvBits
+ (SourcePoint
->y
* SourceSurf
->lDelta
) + SourcePoint
->x
;
126 for (j
=DestRect
->top
; j
<DestRect
->bottom
; j
++)
128 SourceLine_4BPP
= SourceBits_4BPP
;
133 for (i
=DestRect
->left
; i
<DestRect
->right
; i
++)
135 xColor
= XLATEOBJ_iXlate(ColorTranslation
,
136 (*SourceLine_4BPP
& altnotmask
[sx
&1]) >> (4 * (1-(sx
& 1))));
137 *DestLine
++ = xColor
& 0xff;
138 *(PWORD
)DestLine
= xColor
>> 8;
140 if(f1
== 1) { SourceLine_4BPP
++; f1
= 0; } else { f1
= 1; }
144 SourceBits_4BPP
+= SourceSurf
->lDelta
;
145 DestBits
+= DestSurf
->lDelta
;
150 SourceBits_16BPP
= SourceSurf
->pvBits
+ (SourcePoint
->y
* SourceSurf
->lDelta
) + 2 * SourcePoint
->x
;
152 for (j
=DestRect
->top
; j
<DestRect
->bottom
; j
++)
154 SourceLine_16BPP
= SourceBits_16BPP
;
157 for (i
=DestRect
->left
; i
<DestRect
->right
; i
++)
159 xColor
= XLATEOBJ_iXlate(ColorTranslation
, *SourceLine_16BPP
);
160 *DestLine
++ = xColor
& 0xff;
161 *(PWORD
)DestLine
= xColor
>> 8;
166 SourceBits_16BPP
= (PWORD
)((PBYTE
)SourceBits_16BPP
+ SourceSurf
->lDelta
);
167 DestBits
+= DestSurf
->lDelta
;
172 DbgPrint("DIB_24BPP_Bitblt: Unhandled Source BPP: %u\n", SourceGDI
->BitsPerPixel
);