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_24BPP_PutPixel(PSURFOBJ SurfObj
, LONG x
, LONG y
, RGBTRIPLE c
)
13 PBYTE byteaddr
= SurfObj
->pvBits
+ y
* SurfObj
->lDelta
;
14 PRGBTRIPLE addr
= (PRGBTRIPLE
)byteaddr
+ x
;
19 RGBTRIPLE
DIB_24BPP_GetPixel(PSURFOBJ SurfObj
, LONG x
, LONG y
)
21 PBYTE byteaddr
= SurfObj
->pvBits
+ y
* SurfObj
->lDelta
;
22 PRGBTRIPLE addr
= (PRGBTRIPLE
)byteaddr
+ x
;
27 VOID
DIB_24BPP_HLine(PSURFOBJ SurfObj
, LONG x1
, LONG x2
, LONG y
, RGBTRIPLE c
)
29 PBYTE byteaddr
= SurfObj
->pvBits
+ y
* SurfObj
->lDelta
;
30 PRGBTRIPLE addr
= (PRGBTRIPLE
)byteaddr
+ x1
;
40 VOID
DIB_24BPP_VLine(PSURFOBJ SurfObj
, LONG x
, LONG y1
, LONG y2
, RGBTRIPLE c
)
42 PBYTE byteaddr
= SurfObj
->pvBits
+ y1
* SurfObj
->lDelta
;
43 PRGBTRIPLE addr
= (PRGBTRIPLE
)byteaddr
+ x
;
44 ULONG 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 ULONG Delta
, XLATEOBJ
*ColorTranslation
)
91 ULONG i
, j
, sx
, 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
)
103 SourceBits_4BPP
= SourceSurf
->pvBits
+ (SourcePoint
->y
* SourceSurf
->lDelta
) + SourcePoint
->x
;
105 for (j
=DestRect
->top
; j
<DestRect
->bottom
; j
++)
107 SourceLine_4BPP
= SourceBits_4BPP
;
112 for (i
=DestRect
->left
; i
<DestRect
->right
; i
++)
114 xColor
= XLATEOBJ_iXlate(ColorTranslation
,
115 (*SourceLine_4BPP
& altnotmask
[sx
&1]) >> (4 * (1-(sx
& 1))));
116 *DestLine
++ = xColor
& 0xff;
117 *(PWORD
)DestLine
= xColor
>> 8;
119 if(f1
== 1) { SourceLine_4BPP
++; f1
= 0; } else { f1
= 1; }
123 SourceBits_4BPP
+= SourceSurf
->lDelta
;
124 DestBits
+= DestSurf
->lDelta
;
129 DbgPrint("DIB_24BPP_Bitblt: Unhandled Source BPP: %u\n", SourceGDI
->BitsPerPixel
);