2 * ReactOS W32 Subsystem
3 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 DIB_32BPP_PutPixel(SURFOBJ
*SurfObj
, LONG x
, LONG y
, ULONG c
)
29 PBYTE byteaddr
= (PBYTE
)SurfObj
->pvScan0
+ y
* SurfObj
->lDelta
;
30 PDWORD addr
= (PDWORD
)byteaddr
+ x
;
36 DIB_32BPP_GetPixel(SURFOBJ
*SurfObj
, LONG x
, LONG y
)
38 PBYTE byteaddr
= (PBYTE
)SurfObj
->pvScan0
+ y
* SurfObj
->lDelta
;
39 PDWORD addr
= (PDWORD
)byteaddr
+ x
;
41 return (ULONG
)(*addr
);
47 DIB_32BPP_HLine(SURFOBJ
*SurfObj
, LONG x1
, LONG x2
, LONG y
, ULONG c
)
50 PBYTE byteaddr
= (PBYTE
)SurfObj
->pvScan0
+ y
* SurfObj
->lDelta
;
51 PDWORD addr
= (PDWORD
)byteaddr
+ x1
;
53 __asm__
__volatile__ (
57 " test $0x03, %%edi\n" /* Align to fullword boundary */
59 " mov %1,%%ecx\n" /* Setup count of fullwords to fill */
60 " rep stosl\n" /* The actual fill */
65 " mov %1,%%ecx\n" /* Setup count of fullwords to fill */
67 " rep stosl\n" /* The actual fill */
72 : "m"(c
), "r"(cx
), "m"(addr
)
73 : "%eax", "%ecx", "%edi");
79 DIB_32BPP_HLine(SURFOBJ
*SurfObj
, LONG x1
, LONG x2
, LONG y
, ULONG c
)
81 PBYTE byteaddr
= SurfObj
->pvScan0
+ y
* SurfObj
->lDelta
;
82 PDWORD addr
= (PDWORD
)byteaddr
+ x1
;
94 DIB_32BPP_VLine(SURFOBJ
*SurfObj
, LONG x
, LONG y1
, LONG y2
, ULONG c
)
98 PBYTE byteaddr
= (PBYTE
)SurfObj
->pvScan0
+ y1
* SurfObj
->lDelta
;
99 PDWORD addr
= (PDWORD
)byteaddr
+ x
;
100 LONG lDelta
= SurfObj
->lDelta
>> 2; // >> 2 == / sizeof(DWORD)
102 byteaddr
= (PBYTE
)addr
;
112 DIB_32BPP_BitBltSrcCopy(PBLTINFO BltInfo
)
114 LONG i
, j
, sx
, sy
, xColor
, f1
;
115 PBYTE SourceBits
, DestBits
, SourceLine
, DestLine
;
116 PBYTE SourceBits_4BPP
, SourceLine_4BPP
;
117 PDWORD Source32
, Dest32
;
119 DestBits
= (PBYTE
)BltInfo
->DestSurface
->pvScan0
+ (BltInfo
->DestRect
.top
* BltInfo
->DestSurface
->lDelta
) + 4 * BltInfo
->DestRect
.left
;
121 switch(BltInfo
->SourceSurface
->iBitmapFormat
)
125 sx
= BltInfo
->SourcePoint
.x
;
126 sy
= BltInfo
->SourcePoint
.y
;
128 for (j
=BltInfo
->DestRect
.top
; j
<BltInfo
->DestRect
.bottom
; j
++)
130 sx
= BltInfo
->SourcePoint
.x
;
131 for (i
=BltInfo
->DestRect
.left
; i
<BltInfo
->DestRect
.right
; i
++)
133 if(DIB_1BPP_GetPixel(BltInfo
->SourceSurface
, sx
, sy
) == 0)
135 DIB_32BPP_PutPixel(BltInfo
->DestSurface
, i
, j
, XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, 0));
137 DIB_32BPP_PutPixel(BltInfo
->DestSurface
, i
, j
, XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, 1));
146 SourceBits_4BPP
= (PBYTE
)BltInfo
->SourceSurface
->pvScan0
+ (BltInfo
->SourcePoint
.y
* BltInfo
->SourceSurface
->lDelta
) + (BltInfo
->SourcePoint
.x
>> 1);
148 for (j
=BltInfo
->DestRect
.top
; j
<BltInfo
->DestRect
.bottom
; j
++)
150 SourceLine_4BPP
= SourceBits_4BPP
;
151 sx
= BltInfo
->SourcePoint
.x
;
154 for (i
=BltInfo
->DestRect
.left
; i
<BltInfo
->DestRect
.right
; i
++)
156 xColor
= XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
,
157 (*SourceLine_4BPP
& altnotmask
[f1
]) >> (4 * (1 - f1
)));
158 DIB_32BPP_PutPixel(BltInfo
->DestSurface
, i
, j
, xColor
);
159 if(f1
== 1) { SourceLine_4BPP
++; f1
= 0; } else { f1
= 1; }
163 SourceBits_4BPP
+= BltInfo
->SourceSurface
->lDelta
;
168 SourceLine
= (PBYTE
)BltInfo
->SourceSurface
->pvScan0
+ (BltInfo
->SourcePoint
.y
* BltInfo
->SourceSurface
->lDelta
) + BltInfo
->SourcePoint
.x
;
171 for (j
= BltInfo
->DestRect
.top
; j
< BltInfo
->DestRect
.bottom
; j
++)
173 SourceBits
= SourceLine
;
176 for (i
= BltInfo
->DestRect
.left
; i
< BltInfo
->DestRect
.right
; i
++)
178 xColor
= *SourceBits
;
179 *((PDWORD
) DestBits
) = (DWORD
)XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, xColor
);
184 SourceLine
+= BltInfo
->SourceSurface
->lDelta
;
185 DestLine
+= BltInfo
->DestSurface
->lDelta
;
190 SourceLine
= (PBYTE
)BltInfo
->SourceSurface
->pvScan0
+ (BltInfo
->SourcePoint
.y
* BltInfo
->SourceSurface
->lDelta
) + 2 * BltInfo
->SourcePoint
.x
;
193 for (j
= BltInfo
->DestRect
.top
; j
< BltInfo
->DestRect
.bottom
; j
++)
195 SourceBits
= SourceLine
;
198 for (i
= BltInfo
->DestRect
.left
; i
< BltInfo
->DestRect
.right
; i
++)
200 xColor
= *((PWORD
) SourceBits
);
201 *((PDWORD
) DestBits
) = (DWORD
)XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, xColor
);
206 SourceLine
+= BltInfo
->SourceSurface
->lDelta
;
207 DestLine
+= BltInfo
->DestSurface
->lDelta
;
212 SourceLine
= (PBYTE
)BltInfo
->SourceSurface
->pvScan0
+ (BltInfo
->SourcePoint
.y
* BltInfo
->SourceSurface
->lDelta
) + 3 * BltInfo
->SourcePoint
.x
;
215 for (j
= BltInfo
->DestRect
.top
; j
< BltInfo
->DestRect
.bottom
; j
++)
217 SourceBits
= SourceLine
;
220 for (i
= BltInfo
->DestRect
.left
; i
< BltInfo
->DestRect
.right
; i
++)
222 xColor
= (*(SourceBits
+ 2) << 0x10) +
223 (*(SourceBits
+ 1) << 0x08) +
225 *((PDWORD
)DestBits
) = (DWORD
)XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, xColor
);
230 SourceLine
+= BltInfo
->SourceSurface
->lDelta
;
231 DestLine
+= BltInfo
->DestSurface
->lDelta
;
236 if (NULL
== BltInfo
->XlateSourceToDest
|| 0 != (BltInfo
->XlateSourceToDest
->flXlate
& XO_TRIVIAL
))
238 if (BltInfo
->DestRect
.top
< BltInfo
->SourcePoint
.y
)
240 SourceBits
= (PBYTE
)BltInfo
->SourceSurface
->pvScan0
+ (BltInfo
->SourcePoint
.y
* BltInfo
->SourceSurface
->lDelta
) + 4 * BltInfo
->SourcePoint
.x
;
241 for (j
= BltInfo
->DestRect
.top
; j
< BltInfo
->DestRect
.bottom
; j
++)
243 RtlMoveMemory(DestBits
, SourceBits
, 4 * (BltInfo
->DestRect
.right
- BltInfo
->DestRect
.left
));
244 SourceBits
+= BltInfo
->SourceSurface
->lDelta
;
245 DestBits
+= BltInfo
->DestSurface
->lDelta
;
250 SourceBits
= (PBYTE
)BltInfo
->SourceSurface
->pvScan0
+ ((BltInfo
->SourcePoint
.y
+ BltInfo
->DestRect
.bottom
- BltInfo
->DestRect
.top
- 1) * BltInfo
->SourceSurface
->lDelta
) + 4 * BltInfo
->SourcePoint
.x
;
251 DestBits
= (PBYTE
)BltInfo
->DestSurface
->pvScan0
+ ((BltInfo
->DestRect
.bottom
- 1) * BltInfo
->DestSurface
->lDelta
) + 4 * BltInfo
->DestRect
.left
;
252 for (j
= BltInfo
->DestRect
.bottom
- 1; BltInfo
->DestRect
.top
<= j
; j
--)
254 RtlMoveMemory(DestBits
, SourceBits
, 4 * (BltInfo
->DestRect
.right
- BltInfo
->DestRect
.left
));
255 SourceBits
-= BltInfo
->SourceSurface
->lDelta
;
256 DestBits
-= BltInfo
->DestSurface
->lDelta
;
262 if (BltInfo
->DestRect
.top
< BltInfo
->SourcePoint
.y
)
264 SourceBits
= ((PBYTE
)BltInfo
->SourceSurface
->pvScan0
+ (BltInfo
->SourcePoint
.y
* BltInfo
->SourceSurface
->lDelta
) + 4 * BltInfo
->SourcePoint
.x
);
265 for (j
= BltInfo
->DestRect
.top
; j
< BltInfo
->DestRect
.bottom
; j
++)
267 if (BltInfo
->DestRect
.left
< BltInfo
->SourcePoint
.x
)
269 Dest32
= (DWORD
*) DestBits
;
270 Source32
= (DWORD
*) SourceBits
;
271 for (i
= BltInfo
->DestRect
.left
; i
< BltInfo
->DestRect
.right
; i
++)
273 *Dest32
++ = XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, *Source32
++);
278 Dest32
= (DWORD
*) DestBits
+ (BltInfo
->DestRect
.right
- BltInfo
->DestRect
.left
- 1);
279 Source32
= (DWORD
*) SourceBits
+ (BltInfo
->DestRect
.right
- BltInfo
->DestRect
.left
- 1);
280 for (i
= BltInfo
->DestRect
.right
- 1; BltInfo
->DestRect
.left
<= i
; i
--)
282 *Dest32
-- = XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, *Source32
--);
285 SourceBits
+= BltInfo
->SourceSurface
->lDelta
;
286 DestBits
+= BltInfo
->DestSurface
->lDelta
;
291 SourceBits
= (PBYTE
)BltInfo
->SourceSurface
->pvScan0
+ ((BltInfo
->SourcePoint
.y
+ BltInfo
->DestRect
.bottom
- BltInfo
->DestRect
.top
- 1) * BltInfo
->SourceSurface
->lDelta
) + 4 * BltInfo
->SourcePoint
.x
;
292 DestBits
= (PBYTE
)BltInfo
->DestSurface
->pvScan0
+ ((BltInfo
->DestRect
.bottom
- 1) * BltInfo
->DestSurface
->lDelta
) + 4 * BltInfo
->DestRect
.left
;
293 for (j
= BltInfo
->DestRect
.bottom
- 1; BltInfo
->DestRect
.top
<= j
; j
--)
295 if (BltInfo
->DestRect
.left
< BltInfo
->SourcePoint
.x
)
297 Dest32
= (DWORD
*) DestBits
;
298 Source32
= (DWORD
*) SourceBits
;
299 for (i
= BltInfo
->DestRect
.left
; i
< BltInfo
->DestRect
.right
; i
++)
301 *Dest32
++ = XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, *Source32
++);
306 Dest32
= (DWORD
*) DestBits
+ (BltInfo
->DestRect
.right
- BltInfo
->DestRect
.left
- 1);
307 Source32
= (DWORD
*) SourceBits
+ (BltInfo
->DestRect
.right
- BltInfo
->DestRect
.left
- 1);
308 for (i
= BltInfo
->DestRect
.right
; BltInfo
->DestRect
.left
< i
; i
--)
310 *Dest32
-- = XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, *Source32
--);
313 SourceBits
-= BltInfo
->SourceSurface
->lDelta
;
314 DestBits
-= BltInfo
->DestSurface
->lDelta
;
321 DPRINT1("DIB_32BPP_Bitblt: Unhandled Source BPP: %u\n", BitsPerFormat(BltInfo
->SourceSurface
->iBitmapFormat
));
329 DIB_32BPP_ColorFill(SURFOBJ
* DestSurface
, RECTL
* DestRect
, ULONG color
)
333 for (DestY
= DestRect
->top
; DestY
< DestRect
->bottom
; DestY
++)
335 DIB_32BPP_HLine (DestSurface
, DestRect
->left
, DestRect
->right
, DestY
, color
);
342 =======================================
343 Stretching functions goes below
344 Some parts of code are based on an
345 article "Bresenhame image scaling"
346 Dr. Dobb Journal, May 2002
347 =======================================
350 typedef unsigned long PIXEL
;
352 //NOTE: If you change something here, please do the same in other dibXXbpp.c files!
354 /* 32-bit Color (___ format) */
355 inline PIXEL
average32(PIXEL a
, PIXEL b
)
357 return a
; // FIXME: Temp hack to remove "PCB-effect" from the image
360 void ScaleLineAvg32(PIXEL
*Target
, PIXEL
*Source
, int SrcWidth
, int TgtWidth
)
362 int NumPixels
= TgtWidth
;
363 int IntPart
= SrcWidth
/ TgtWidth
;
364 int FractPart
= SrcWidth
% TgtWidth
;
365 int Mid
= TgtWidth
>> 1;
370 skip
= (TgtWidth
< SrcWidth
) ? 0 : (TgtWidth
/ (2*SrcWidth
) + 1);
373 while (NumPixels
-- > 0) {
376 p
= average32(p
, *(Source
+1));
390 FinalCopy32(PIXEL
*Target
, PIXEL
*Source
, PSPAN ClipSpans
, UINT ClipSpansCount
, UINT
*SpanIndex
,
391 UINT DestY
, RECTL
*DestRect
)
395 while (ClipSpans
[*SpanIndex
].Y
< DestY
396 || (ClipSpans
[*SpanIndex
].Y
== DestY
397 && ClipSpans
[*SpanIndex
].X
+ ClipSpans
[*SpanIndex
].Width
< DestRect
->left
))
400 if (ClipSpansCount
<= *SpanIndex
)
402 /* No more spans, everything else is clipped away, we're done */
406 while (ClipSpans
[*SpanIndex
].Y
== DestY
)
408 if (ClipSpans
[*SpanIndex
].X
< DestRect
->right
)
410 Left
= max(ClipSpans
[*SpanIndex
].X
, DestRect
->left
);
411 Right
= min(ClipSpans
[*SpanIndex
].X
+ ClipSpans
[*SpanIndex
].Width
, DestRect
->right
);
412 memcpy(Target
+ Left
- DestRect
->left
, Source
+ Left
- DestRect
->left
,
413 (Right
- Left
) * sizeof(PIXEL
));
416 if (ClipSpansCount
<= *SpanIndex
)
418 /* No more spans, everything else is clipped away, we're done */
426 //NOTE: If you change something here, please do the same in other dibXXbpp.c files!
427 BOOLEAN
ScaleRectAvg32(SURFOBJ
*DestSurf
, SURFOBJ
*SourceSurf
,
428 RECTL
* DestRect
, RECTL
*SourceRect
,
429 POINTL
* MaskOrigin
, POINTL BrushOrigin
,
430 CLIPOBJ
*ClipRegion
, XLATEOBJ
*ColorTranslation
,
433 int NumPixels
= DestRect
->bottom
- DestRect
->top
;
434 int IntPart
= (((SourceRect
->bottom
- SourceRect
->top
) / (DestRect
->bottom
- DestRect
->top
)) * SourceSurf
->lDelta
) / 4;
435 int FractPart
= (SourceRect
->bottom
- SourceRect
->top
) % (DestRect
->bottom
- DestRect
->top
);
436 int Mid
= (DestRect
->bottom
- DestRect
->top
) >> 1;
439 PIXEL
*ScanLine
, *ScanLineAhead
;
440 PIXEL
*PrevSource
= NULL
;
441 PIXEL
*PrevSourceAhead
= NULL
;
442 PIXEL
*Target
= (PIXEL
*) ((PBYTE
)DestSurf
->pvScan0
+ (DestRect
->top
* DestSurf
->lDelta
) + 4 * DestRect
->left
);
443 PIXEL
*Source
= (PIXEL
*) ((PBYTE
)SourceSurf
->pvScan0
+ (SourceRect
->top
* SourceSurf
->lDelta
) + 4 * SourceRect
->left
);
449 if (! ClipobjToSpans(&ClipSpans
, &ClipSpansCount
, ClipRegion
, DestRect
))
453 if (0 == ClipSpansCount
)
455 /* No clip spans == empty clipping region, everything clipped away */
456 ASSERT(NULL
== ClipSpans
);
459 skip
= (DestRect
->bottom
- DestRect
->top
< SourceRect
->bottom
- SourceRect
->top
) ? 0 : ((DestRect
->bottom
- DestRect
->top
) / (2 * (SourceRect
->bottom
- SourceRect
->top
)) + 1);
462 ScanLine
= (PIXEL
*)ExAllocatePool(PagedPool
, (DestRect
->right
- DestRect
->left
) * sizeof(PIXEL
));
463 ScanLineAhead
= (PIXEL
*)ExAllocatePool(PagedPool
, (DestRect
->right
- DestRect
->left
) * sizeof(PIXEL
));
465 DestY
= DestRect
->top
;
467 while (NumPixels
-- > 0) {
468 if (Source
!= PrevSource
) {
469 if (Source
== PrevSourceAhead
) {
470 /* the next scan line has already been scaled and stored in
471 * ScanLineAhead; swap the buffers that ScanLine and ScanLineAhead
474 PIXEL
*tmp
= ScanLine
;
475 ScanLine
= ScanLineAhead
;
478 ScaleLineAvg32(ScanLine
, Source
, SourceRect
->right
- SourceRect
->left
, DestRect
->right
- DestRect
->left
);
483 if (E
>= Mid
&& PrevSourceAhead
!= (PIXEL
*)((BYTE
*)Source
+ SourceSurf
->lDelta
)) {
485 ScaleLineAvg32(ScanLineAhead
, (PIXEL
*)((BYTE
*)Source
+ SourceSurf
->lDelta
), SourceRect
->right
- SourceRect
->left
, DestRect
->right
- DestRect
->left
);
486 for (x
= 0; x
< DestRect
->right
- DestRect
->left
; x
++)
487 ScanLine
[x
] = average32(ScanLine
[x
], ScanLineAhead
[x
]);
488 PrevSourceAhead
= (PIXEL
*)((BYTE
*)Source
+ SourceSurf
->lDelta
);
491 if (! FinalCopy32(Target
, ScanLine
, ClipSpans
, ClipSpansCount
, &SpanIndex
, DestY
, DestRect
))
493 /* No more spans, everything else is clipped away, we're done */
494 ExFreePool(ClipSpans
);
495 ExFreePool(ScanLine
);
496 ExFreePool(ScanLineAhead
);
500 Target
= (PIXEL
*)((BYTE
*)Target
+ DestSurf
->lDelta
);
503 if (E
>= DestRect
->bottom
- DestRect
->top
) {
504 E
-= DestRect
->bottom
- DestRect
->top
;
505 Source
= (PIXEL
*)((BYTE
*)Source
+ SourceSurf
->lDelta
);
509 if (skip
> 0 && Source
!= PrevSource
)
510 ScaleLineAvg32(ScanLine
, Source
, SourceRect
->right
- SourceRect
->left
, DestRect
->right
- DestRect
->left
);
512 if (! FinalCopy32(Target
, ScanLine
, ClipSpans
, ClipSpansCount
, &SpanIndex
, DestY
, DestRect
))
514 /* No more spans, everything else is clipped away, we're done */
515 ExFreePool(ClipSpans
);
516 ExFreePool(ScanLine
);
517 ExFreePool(ScanLineAhead
);
521 Target
= (PIXEL
*)((BYTE
*)Target
+ DestSurf
->lDelta
);
524 ExFreePool(ClipSpans
);
525 ExFreePool(ScanLine
);
526 ExFreePool(ScanLineAhead
);
532 //NOTE: If you change something here, please do the same in other dibXXbpp.c files!
533 BOOLEAN
DIB_32BPP_StretchBlt(SURFOBJ
*DestSurf
, SURFOBJ
*SourceSurf
,
534 RECTL
* DestRect
, RECTL
*SourceRect
,
535 POINTL
* MaskOrigin
, POINTL BrushOrigin
,
536 CLIPOBJ
*ClipRegion
, XLATEOBJ
*ColorTranslation
,
554 BOOLEAN DesIsBiggerY
=FALSE
;
556 DPRINT("DIB_32BPP_StretchBlt: Source BPP: %u, srcRect: (%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n",
557 BitsPerFormat(SourceSurf
->iBitmapFormat
), SourceRect
->left
, SourceRect
->top
, SourceRect
->right
,
558 SourceRect
->bottom
, DestRect
->left
, DestRect
->top
, DestRect
->right
, DestRect
->bottom
);
560 SrcSizeY
= SourceRect
->bottom
;
561 SrcSizeX
= SourceRect
->right
;
563 DesSizeY
= DestRect
->bottom
;
564 DesSizeX
= DestRect
->right
;
566 zoomX
= DesSizeX
/ SrcSizeX
;
567 if (zoomX
==0) zoomX
=1;
569 zoomY
= DesSizeY
/ SrcSizeY
;
570 if (zoomY
==0) zoomY
=1;
572 if (DesSizeY
>SrcSizeY
)
575 switch(SourceSurf
->iBitmapFormat
)
578 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
579 /* This is a reference implementation, it hasn't been optimized for speed */
582 /* Draw one Hline on X - Led to the Des Zoom In*/
583 if (DesSizeX
>SrcSizeX
)
585 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
588 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
590 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
592 if (sy
> SourceRect
->bottom
) break;
596 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
598 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
600 if (sx
> SourceRect
->right
) break;
602 saveX
= DesX
+ zoomX
;
604 if (DIB_1BPP_GetPixel(SourceSurf
, sx
, sy
) == 0)
605 for (count
=DesY
;count
<saveY
;count
++)
606 DIB_32BPP_HLine(DestSurf
, DesX
, saveX
, count
, 0);
608 for (count
=DesY
;count
<saveY
;count
++)
609 DIB_32BPP_HLine(DestSurf
, DesX
, saveX
, count
, 1);
616 /* Draw one Hline on X - Led to the Des Zoom Out*/
618 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
621 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
623 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
625 if (sy
> SourceRect
->bottom
) break;
629 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
631 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
633 if (sx
> SourceRect
->right
) break;
635 saveX
= DesX
+ zoomX
;
637 if (DIB_1BPP_GetPixel(SourceSurf
, sx
, sy
) == 0)
638 for (count
=DesY
;count
<saveY
;count
++)
639 DIB_32BPP_HLine(DestSurf
, DesX
, saveX
, count
, 0);
641 for (count
=DesY
;count
<saveY
;count
++)
642 DIB_32BPP_HLine(DestSurf
, DesX
, saveX
, count
, 1);
651 if (DesSizeX
>SrcSizeX
)
653 /* Draw one pixel on X - Led to the Des Zoom In*/
654 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
657 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
659 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
661 if (sy
> SourceRect
->bottom
) break;
665 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
667 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
669 if (sx
> SourceRect
->right
) break;
671 if (DIB_1BPP_GetPixel(SourceSurf
, sx
, sy
) == 0)
672 for (count
=DesY
;count
<saveY
;count
++)
673 DIB_32BPP_PutPixel(DestSurf
, DesX
, count
, 0);
675 for (count
=DesY
;count
<saveY
;count
++)
676 DIB_32BPP_PutPixel(DestSurf
, DesX
, count
, 1);
684 /* Draw one pixel on X - Led to the Des Zoom Out*/
685 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
688 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
690 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
692 if (sy
> SourceRect
->bottom
) break;
696 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
698 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
700 if (sx
> SourceRect
->right
) break;
702 if (DIB_1BPP_GetPixel(SourceSurf
, sx
, sy
) == 0)
703 for (count
=DesY
;count
<saveY
;count
++)
704 DIB_32BPP_PutPixel(DestSurf
, DesX
, count
, 0);
706 for (count
=DesY
;count
<saveY
;count
++)
707 DIB_32BPP_PutPixel(DestSurf
, DesX
, count
, 1);
716 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
717 /* This is a reference implementation, it hasn't been optimized for speed */
720 /* Draw one Hline on X - Led to the Des Zoom In*/
721 if (DesSizeX
>SrcSizeX
)
723 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
726 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
728 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
730 if (sy
> SourceRect
->bottom
) break;
734 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
736 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
738 if (sx
> SourceRect
->right
) break;
740 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_4BPP_GetPixel(SourceSurf
, sx
, sy
));
742 saveX
= DesX
+ zoomX
;
743 for (count
=DesY
;count
<saveY
;count
++)
744 DIB_32BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
750 /* Draw one Hline on X - Led to the Des Zoom Out*/
752 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
755 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
757 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
759 if (sy
> SourceRect
->bottom
) break;
763 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
765 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
767 if (sx
> SourceRect
->right
) break;
769 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_4BPP_GetPixel(SourceSurf
, sx
, sy
));
771 saveX
= DesX
+ zoomX
;
772 for (count
=DesY
;count
<saveY
;count
++)
773 DIB_32BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
782 if (DesSizeX
>SrcSizeX
)
784 /* Draw one pixel on X - Led to the Des Zoom In*/
785 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
788 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
790 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
792 if (sy
> SourceRect
->bottom
) break;
796 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
798 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
800 if (sx
> SourceRect
->right
) break;
802 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_4BPP_GetPixel(SourceSurf
, sx
, sy
));
804 for (count
=DesY
;count
<saveY
;count
++)
805 DIB_32BPP_PutPixel(DestSurf
, DesX
, count
, color
);
811 /* Draw one pixel on X - Led to the Des Zoom Out*/
812 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
815 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
817 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
819 if (sy
> SourceRect
->bottom
) break;
823 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
825 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
827 if (sx
> SourceRect
->right
) break;
829 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_4BPP_GetPixel(SourceSurf
, sx
, sy
));
831 for (count
=DesY
;count
<saveY
;count
++)
832 DIB_32BPP_PutPixel(DestSurf
, DesX
, count
, color
);
840 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
841 /* This is a reference implementation, it hasn't been optimized for speed */
844 /* Draw one Hline on X - Led to the Des Zoom In*/
845 if (DesSizeX
>SrcSizeX
)
847 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
850 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
852 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
854 if (sy
> SourceRect
->bottom
) break;
858 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
860 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
862 if (sx
> SourceRect
->right
) break;
864 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_8BPP_GetPixel(SourceSurf
, sx
, sy
));
866 saveX
= DesX
+ zoomX
;
867 for (count
=DesY
;count
<saveY
;count
++)
868 DIB_32BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
874 /* Draw one Hline on X - Led to the Des Zoom Out*/
876 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
879 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
881 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
883 if (sy
> SourceRect
->bottom
) break;
887 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
889 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
891 if (sx
> SourceRect
->right
) break;
893 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_8BPP_GetPixel(SourceSurf
, sx
, sy
));
895 saveX
= DesX
+ zoomX
;
896 for (count
=DesY
;count
<saveY
;count
++)
897 DIB_32BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
906 if (DesSizeX
>SrcSizeX
)
908 /* Draw one pixel on X - Led to the Des Zoom In*/
909 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
912 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
914 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
916 if (sy
> SourceRect
->bottom
) break;
920 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
922 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
924 if (sx
> SourceRect
->right
) break;
926 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_8BPP_GetPixel(SourceSurf
, sx
, sy
));
928 for (count
=DesY
;count
<saveY
;count
++)
929 DIB_32BPP_PutPixel(DestSurf
, DesX
, count
, color
);
935 /* Draw one pixel on X - Led to the Des Zoom Out*/
936 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
939 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
941 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
943 if (sy
> SourceRect
->bottom
) break;
947 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
949 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
951 if (sx
> SourceRect
->right
) break;
953 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_8BPP_GetPixel(SourceSurf
, sx
, sy
));
955 for (count
=DesY
;count
<saveY
;count
++)
956 DIB_32BPP_PutPixel(DestSurf
, DesX
, count
, color
);
964 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
965 /* This is a reference implementation, it hasn't been optimized for speed */
968 /* Draw one Hline on X - Led to the Des Zoom In*/
969 if (DesSizeX
>SrcSizeX
)
971 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
974 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
976 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
978 if (sy
> SourceRect
->bottom
) break;
982 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
984 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
986 if (sx
> SourceRect
->right
) break;
988 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_16BPP_GetPixel(SourceSurf
, sx
, sy
));
990 saveX
= DesX
+ zoomX
;
991 for (count
=DesY
;count
<saveY
;count
++)
992 DIB_32BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
998 /* Draw one Hline on X - Led to the Des Zoom Out*/
1000 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1003 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1005 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1007 if (sy
> SourceRect
->bottom
) break;
1011 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1013 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
1015 if (sx
> SourceRect
->right
) break;
1017 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_16BPP_GetPixel(SourceSurf
, sx
, sy
));
1019 saveX
= DesX
+ zoomX
;
1020 for (count
=DesY
;count
<saveY
;count
++)
1021 DIB_32BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
1030 if (DesSizeX
>SrcSizeX
)
1032 /* Draw one pixel on X - Led to the Des Zoom In*/
1033 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1036 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1038 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1040 if (sy
> SourceRect
->bottom
) break;
1044 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1046 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
1048 if (sx
> SourceRect
->right
) break;
1050 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_16BPP_GetPixel(SourceSurf
, sx
, sy
));
1052 for (count
=DesY
;count
<saveY
;count
++)
1053 DIB_32BPP_PutPixel(DestSurf
, DesX
, count
, color
);
1059 /* Draw one pixel on X - Led to the Des Zoom Out*/
1060 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1063 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1065 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1067 if (sy
> SourceRect
->bottom
) break;
1071 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1073 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
1075 if (sx
> SourceRect
->right
) break;
1077 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_16BPP_GetPixel(SourceSurf
, sx
, sy
));
1079 for (count
=DesY
;count
<saveY
;count
++)
1080 DIB_32BPP_PutPixel(DestSurf
, DesX
, count
, color
);
1088 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
1089 /* This is a reference implementation, it hasn't been optimized for speed */
1092 /* Draw one Hline on X - Led to the Des Zoom In*/
1093 if (DesSizeX
>SrcSizeX
)
1095 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1098 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1100 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1102 if (sy
> SourceRect
->bottom
) break;
1106 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1108 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
1110 if (sx
> SourceRect
->right
) break;
1112 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_24BPP_GetPixel(SourceSurf
, sx
, sy
));
1114 saveX
= DesX
+ zoomX
;
1115 for (count
=DesY
;count
<saveY
;count
++)
1116 DIB_32BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
1122 /* Draw one Hline on X - Led to the Des Zoom Out*/
1124 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1127 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1129 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1131 if (sy
> SourceRect
->bottom
) break;
1135 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1137 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
1139 if (sx
> SourceRect
->right
) break;
1141 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_24BPP_GetPixel(SourceSurf
, sx
, sy
));
1143 saveX
= DesX
+ zoomX
;
1144 for (count
=DesY
;count
<saveY
;count
++)
1145 DIB_32BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
1154 if (DesSizeX
>SrcSizeX
)
1156 /* Draw one pixel on X - Led to the Des Zoom In*/
1157 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1160 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1162 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1164 if (sy
> SourceRect
->bottom
) break;
1168 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1170 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
1172 if (sx
> SourceRect
->right
) break;
1174 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_24BPP_GetPixel(SourceSurf
, sx
, sy
));
1176 for (count
=DesY
;count
<saveY
;count
++)
1177 DIB_32BPP_PutPixel(DestSurf
, DesX
, count
, color
);
1183 /* Draw one pixel on X - Led to the Des Zoom Out*/
1184 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1187 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1189 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1191 if (sy
> SourceRect
->bottom
) break;
1195 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1197 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
1199 if (sx
> SourceRect
->right
) break;
1201 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_24BPP_GetPixel(SourceSurf
, sx
, sy
));
1203 for (count
=DesY
;count
<saveY
;count
++)
1204 DIB_32BPP_PutPixel(DestSurf
, DesX
, count
, color
);
1212 return ScaleRectAvg32(DestSurf
, SourceSurf
, DestRect
, SourceRect
, MaskOrigin
, BrushOrigin
,
1213 ClipRegion
, ColorTranslation
, Mode
);
1217 //DPRINT1("DIB_32BPP_StretchBlt: Unhandled Source BPP: %u\n", BitsPerFormat(SourceSurf->iBitmapFormat));
1227 DIB_32BPP_TransparentBlt(SURFOBJ
*DestSurf
, SURFOBJ
*SourceSurf
,
1228 RECTL
* DestRect
, POINTL
*SourcePoint
,
1229 XLATEOBJ
*ColorTranslation
, ULONG iTransColor
)
1231 ULONG X
, Y
, SourceX
, SourceY
, Source
, wd
;
1234 SourceY
= SourcePoint
->y
;
1235 DestBits
= (ULONG
*)((PBYTE
)DestSurf
->pvScan0
+
1236 (DestRect
->left
<< 2) +
1237 DestRect
->top
* DestSurf
->lDelta
);
1238 wd
= DestSurf
->lDelta
- ((DestRect
->right
- DestRect
->left
) << 2);
1240 for(Y
= DestRect
->top
; Y
< DestRect
->bottom
; Y
++)
1242 SourceX
= SourcePoint
->x
;
1243 for(X
= DestRect
->left
; X
< DestRect
->right
; X
++, DestBits
++, SourceX
++)
1245 Source
= DIB_GetSourceIndex(SourceSurf
, SourceX
, SourceY
);
1246 if(Source
!= iTransColor
)
1248 *DestBits
= XLATEOBJ_iXlate(ColorTranslation
, Source
);
1253 DestBits
= (ULONG
*)((ULONG_PTR
)DestBits
+ wd
);