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.
23 DIB_8BPP_PutPixel(SURFOBJ
*SurfObj
, LONG x
, LONG y
, ULONG c
)
25 PBYTE byteaddr
= SurfObj
->pvScan0
+ y
* SurfObj
->lDelta
+ x
;
31 DIB_8BPP_GetPixel(SURFOBJ
*SurfObj
, LONG x
, LONG y
)
33 PBYTE byteaddr
= SurfObj
->pvScan0
+ y
* SurfObj
->lDelta
+ x
;
35 return (ULONG
)(*byteaddr
);
39 DIB_8BPP_HLine(SURFOBJ
*SurfObj
, LONG x1
, LONG x2
, LONG y
, ULONG c
)
41 memset(SurfObj
->pvScan0
+ y
* SurfObj
->lDelta
+ x1
, (BYTE
) c
, x2
- x1
);
45 DIB_8BPP_VLine(SURFOBJ
*SurfObj
, LONG x
, LONG y1
, LONG y2
, ULONG c
)
47 PBYTE byteaddr
= SurfObj
->pvScan0
+ y1
* SurfObj
->lDelta
;
48 PBYTE addr
= byteaddr
+ x
;
49 LONG lDelta
= SurfObj
->lDelta
;
60 DIB_8BPP_BitBltSrcCopy(PBLTINFO BltInfo
)
62 LONG i
, j
, sx
, sy
, xColor
, f1
;
63 PBYTE SourceBits
, DestBits
, SourceLine
, DestLine
;
64 PBYTE SourceBits_4BPP
, SourceLine_4BPP
;
66 DestBits
= BltInfo
->DestSurface
->pvScan0
+ (BltInfo
->DestRect
.top
* BltInfo
->DestSurface
->lDelta
) + BltInfo
->DestRect
.left
;
68 switch(BltInfo
->SourceSurface
->iBitmapFormat
)
71 sx
= BltInfo
->SourcePoint
.x
;
72 sy
= BltInfo
->SourcePoint
.y
;
74 for (j
=BltInfo
->DestRect
.top
; j
<BltInfo
->DestRect
.bottom
; j
++)
76 sx
= BltInfo
->SourcePoint
.x
;
77 for (i
=BltInfo
->DestRect
.left
; i
<BltInfo
->DestRect
.right
; i
++)
79 if(DIB_1BPP_GetPixel(BltInfo
->SourceSurface
, sx
, sy
) == 0)
81 DIB_8BPP_PutPixel(BltInfo
->DestSurface
, i
, j
, XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, 0));
83 DIB_8BPP_PutPixel(BltInfo
->DestSurface
, i
, j
, XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, 1));
92 SourceBits_4BPP
= BltInfo
->SourceSurface
->pvScan0
+ (BltInfo
->SourcePoint
.y
* BltInfo
->SourceSurface
->lDelta
) + (BltInfo
->SourcePoint
.x
>> 1);
94 for (j
=BltInfo
->DestRect
.top
; j
<BltInfo
->DestRect
.bottom
; j
++)
96 SourceLine_4BPP
= SourceBits_4BPP
;
97 sx
= BltInfo
->SourcePoint
.x
;
100 for (i
=BltInfo
->DestRect
.left
; i
<BltInfo
->DestRect
.right
; i
++)
102 xColor
= XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
,
103 (*SourceLine_4BPP
& altnotmask
[f1
]) >> (4 * (1 - f1
)));
104 DIB_8BPP_PutPixel(BltInfo
->DestSurface
, i
, j
, xColor
);
105 if(f1
== 1) { SourceLine_4BPP
++; f1
= 0; } else { f1
= 1; }
109 SourceBits_4BPP
+= BltInfo
->SourceSurface
->lDelta
;
114 if (NULL
== BltInfo
->XlateSourceToDest
|| 0 != (BltInfo
->XlateSourceToDest
->flXlate
& XO_TRIVIAL
))
116 if (BltInfo
->DestRect
.top
< BltInfo
->SourcePoint
.y
)
118 SourceBits
= BltInfo
->SourceSurface
->pvScan0
+ (BltInfo
->SourcePoint
.y
* BltInfo
->SourceSurface
->lDelta
) + BltInfo
->SourcePoint
.x
;
119 for (j
= BltInfo
->DestRect
.top
; j
< BltInfo
->DestRect
.bottom
; j
++)
121 RtlMoveMemory(DestBits
, SourceBits
, BltInfo
->DestRect
.right
- BltInfo
->DestRect
.left
);
122 SourceBits
+= BltInfo
->SourceSurface
->lDelta
;
123 DestBits
+= BltInfo
->DestSurface
->lDelta
;
128 SourceBits
= BltInfo
->SourceSurface
->pvScan0
+ ((BltInfo
->SourcePoint
.y
+ BltInfo
->DestRect
.bottom
- BltInfo
->DestRect
.top
- 1) * BltInfo
->SourceSurface
->lDelta
) + BltInfo
->SourcePoint
.x
;
129 DestBits
= BltInfo
->DestSurface
->pvScan0
+ ((BltInfo
->DestRect
.bottom
- 1) * BltInfo
->DestSurface
->lDelta
) + BltInfo
->DestRect
.left
;
130 for (j
= BltInfo
->DestRect
.bottom
- 1; BltInfo
->DestRect
.top
<= j
; j
--)
132 RtlMoveMemory(DestBits
, SourceBits
, BltInfo
->DestRect
.right
- BltInfo
->DestRect
.left
);
133 SourceBits
-= BltInfo
->SourceSurface
->lDelta
;
134 DestBits
-= BltInfo
->DestSurface
->lDelta
;
140 if (BltInfo
->DestRect
.top
< BltInfo
->SourcePoint
.y
)
142 SourceLine
= BltInfo
->SourceSurface
->pvScan0
+ (BltInfo
->SourcePoint
.y
* BltInfo
->SourceSurface
->lDelta
) + BltInfo
->SourcePoint
.x
;
144 for (j
= BltInfo
->DestRect
.top
; j
< BltInfo
->DestRect
.bottom
; j
++)
146 SourceBits
= SourceLine
;
148 for (i
=BltInfo
->DestRect
.left
; i
<BltInfo
->DestRect
.right
; i
++)
150 *DestBits
++ = XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, *SourceBits
++);
152 SourceLine
+= BltInfo
->SourceSurface
->lDelta
;
153 DestLine
+= BltInfo
->DestSurface
->lDelta
;
158 SourceLine
= BltInfo
->SourceSurface
->pvScan0
+ ((BltInfo
->SourcePoint
.y
+ BltInfo
->DestRect
.bottom
- BltInfo
->DestRect
.top
- 1) * BltInfo
->SourceSurface
->lDelta
) + BltInfo
->SourcePoint
.x
;
159 DestLine
= BltInfo
->DestSurface
->pvScan0
+ ((BltInfo
->DestRect
.bottom
- 1) * BltInfo
->DestSurface
->lDelta
) + BltInfo
->DestRect
.left
;
160 for (j
= BltInfo
->DestRect
.bottom
- 1; BltInfo
->DestRect
.top
<= j
; j
--)
162 SourceBits
= SourceLine
;
164 for (i
=BltInfo
->DestRect
.left
; i
<BltInfo
->DestRect
.right
; i
++)
166 *DestBits
++ = XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, *SourceBits
++);
168 SourceLine
-= BltInfo
->SourceSurface
->lDelta
;
169 DestLine
-= BltInfo
->DestSurface
->lDelta
;
176 SourceLine
= BltInfo
->SourceSurface
->pvScan0
+ (BltInfo
->SourcePoint
.y
* BltInfo
->SourceSurface
->lDelta
) + 2 * BltInfo
->SourcePoint
.x
;
179 for (j
= BltInfo
->DestRect
.top
; j
< BltInfo
->DestRect
.bottom
; j
++)
181 SourceBits
= SourceLine
;
184 for (i
= BltInfo
->DestRect
.left
; i
< BltInfo
->DestRect
.right
; i
++)
186 xColor
= *((PWORD
) SourceBits
);
187 *DestBits
= XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, xColor
);
192 SourceLine
+= BltInfo
->SourceSurface
->lDelta
;
193 DestLine
+= BltInfo
->DestSurface
->lDelta
;
198 SourceLine
= BltInfo
->SourceSurface
->pvScan0
+ (BltInfo
->SourcePoint
.y
* BltInfo
->SourceSurface
->lDelta
) + 3 * BltInfo
->SourcePoint
.x
;
201 for (j
= BltInfo
->DestRect
.top
; j
< BltInfo
->DestRect
.bottom
; j
++)
203 SourceBits
= SourceLine
;
206 for (i
= BltInfo
->DestRect
.left
; i
< BltInfo
->DestRect
.right
; i
++)
208 xColor
= (*(SourceBits
+ 2) << 0x10) +
209 (*(SourceBits
+ 1) << 0x08) +
211 *DestBits
= XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, xColor
);
216 SourceLine
+= BltInfo
->SourceSurface
->lDelta
;
217 DestLine
+= BltInfo
->DestSurface
->lDelta
;
222 SourceLine
= BltInfo
->SourceSurface
->pvScan0
+ (BltInfo
->SourcePoint
.y
* BltInfo
->SourceSurface
->lDelta
) + 4 * BltInfo
->SourcePoint
.x
;
225 for (j
= BltInfo
->DestRect
.top
; j
< BltInfo
->DestRect
.bottom
; j
++)
227 SourceBits
= SourceLine
;
230 for (i
= BltInfo
->DestRect
.left
; i
< BltInfo
->DestRect
.right
; i
++)
232 xColor
= *((PDWORD
) SourceBits
);
233 *DestBits
= XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, xColor
);
238 SourceLine
+= BltInfo
->SourceSurface
->lDelta
;
239 DestLine
+= BltInfo
->DestSurface
->lDelta
;
244 DPRINT1("DIB_8BPP_Bitblt: Unhandled Source BPP: %u\n", BitsPerFormat(BltInfo
->SourceSurface
->iBitmapFormat
));
252 DIB_8BPP_BitBlt(PBLTINFO BltInfo
)
255 ULONG SourceX
, SourceY
;
257 ULONG Dest
, Source
= 0, Pattern
= 0;
263 UsesSource
= ROP4_USES_SOURCE(BltInfo
->Rop4
);
264 UsesPattern
= ROP4_USES_PATTERN(BltInfo
->Rop4
);
266 SourceY
= BltInfo
->SourcePoint
.y
;
267 RoundedRight
= BltInfo
->DestRect
.right
-
268 ((BltInfo
->DestRect
.right
- BltInfo
->DestRect
.left
) & 0x7);
272 if (BltInfo
->PatternSurface
)
274 PatternY
= (BltInfo
->DestRect
.top
+ BltInfo
->BrushOrigin
.y
) %
275 BltInfo
->PatternSurface
->sizlBitmap
.cy
;
279 Pattern
= BltInfo
->Brush
->iSolidColor
|
280 (BltInfo
->Brush
->iSolidColor
<< 8) |
281 (BltInfo
->Brush
->iSolidColor
<< 16) |
282 (BltInfo
->Brush
->iSolidColor
<< 24);
286 for (DestY
= BltInfo
->DestRect
.top
; DestY
< BltInfo
->DestRect
.bottom
; DestY
++)
288 SourceX
= BltInfo
->SourcePoint
.x
;
290 BltInfo
->DestSurface
->pvScan0
+
291 BltInfo
->DestRect
.left
+
292 DestY
* BltInfo
->DestSurface
->lDelta
);
294 for (DestX
= BltInfo
->DestRect
.left
; DestX
< RoundedRight
; DestX
+= 4, DestBits
++)
300 Source
= DIB_GetSource(BltInfo
->SourceSurface
, SourceX
+ (DestX
- BltInfo
->DestRect
.left
), SourceY
, BltInfo
->XlateSourceToDest
);
301 Source
|= DIB_GetSource(BltInfo
->SourceSurface
, SourceX
+ (DestX
- BltInfo
->DestRect
.left
) + 1, SourceY
, BltInfo
->XlateSourceToDest
) << 8;
302 Source
|= DIB_GetSource(BltInfo
->SourceSurface
, SourceX
+ (DestX
- BltInfo
->DestRect
.left
) + 2, SourceY
, BltInfo
->XlateSourceToDest
) << 16;
303 Source
|= DIB_GetSource(BltInfo
->SourceSurface
, SourceX
+ (DestX
- BltInfo
->DestRect
.left
) + 3, SourceY
, BltInfo
->XlateSourceToDest
) << 24;
306 if (BltInfo
->PatternSurface
)
308 Pattern
= DIB_GetSource(BltInfo
->PatternSurface
, (DestX
+ BltInfo
->BrushOrigin
.x
) % BltInfo
->PatternSurface
->sizlBitmap
.cx
, PatternY
, BltInfo
->XlatePatternToDest
);
309 Pattern
|= DIB_GetSource(BltInfo
->PatternSurface
, (DestX
+ BltInfo
->BrushOrigin
.x
+ 1) % BltInfo
->PatternSurface
->sizlBitmap
.cx
, PatternY
, BltInfo
->XlatePatternToDest
) << 8;
310 Pattern
|= DIB_GetSource(BltInfo
->PatternSurface
, (DestX
+ BltInfo
->BrushOrigin
.x
+ 2) % BltInfo
->PatternSurface
->sizlBitmap
.cx
, PatternY
, BltInfo
->XlatePatternToDest
) << 16;
311 Pattern
|= DIB_GetSource(BltInfo
->PatternSurface
, (DestX
+ BltInfo
->BrushOrigin
.x
+ 3) % BltInfo
->PatternSurface
->sizlBitmap
.cx
, PatternY
, BltInfo
->XlatePatternToDest
) << 24;
314 *DestBits
= DIB_DoRop(BltInfo
->Rop4
, Dest
, Source
, Pattern
);
317 if (DestX
< BltInfo
->DestRect
.right
)
319 for (; DestX
< BltInfo
->DestRect
.right
; DestX
++)
321 Dest
= DIB_8BPP_GetPixel(BltInfo
->DestSurface
, DestX
, DestY
);
325 Source
= DIB_GetSource(BltInfo
->SourceSurface
, SourceX
+ (DestX
- BltInfo
->DestRect
.left
), SourceY
, BltInfo
->XlateSourceToDest
);
328 if (BltInfo
->PatternSurface
)
330 Pattern
= DIB_GetSource(BltInfo
->PatternSurface
, (DestX
+ BltInfo
->BrushOrigin
.x
) % BltInfo
->PatternSurface
->sizlBitmap
.cx
, PatternY
, BltInfo
->XlatePatternToDest
);
333 DIB_8BPP_PutPixel(BltInfo
->DestSurface
, DestX
, DestY
, DIB_DoRop(BltInfo
->Rop4
, Dest
, Source
, Pattern
) & 0xFFFF);
338 if (BltInfo
->PatternSurface
)
341 PatternY
%= BltInfo
->PatternSurface
->sizlBitmap
.cy
;
350 DIB_8BPP_ColorFill(SURFOBJ
* DestSurface
, RECTL
* DestRect
, ULONG color
)
353 for (DestY
= DestRect
->top
; DestY
< DestRect
->bottom
; DestY
++)
355 DIB_32BPP_HLine (DestSurface
, DestRect
->left
, DestRect
->right
, DestY
, color
);
361 =======================================
362 Stretching functions goes below
363 Some parts of code are based on an
364 article "Bresenhame image scaling"
365 Dr. Dobb Journal, May 2002
366 =======================================
369 typedef unsigned char PIXEL
;
371 /* 16-bit HiColor (565 format) */
372 inline PIXEL
average8(PIXEL a
, PIXEL b
)
374 return a
; // FIXME: Depend on SetStretchMode
377 //NOTE: If you change something here, please do the same in other dibXXbpp.c files!
378 void ScaleLineAvg8(PIXEL
*Target
, PIXEL
*Source
, int SrcWidth
, int TgtWidth
)
380 int NumPixels
= TgtWidth
;
381 int IntPart
= SrcWidth
/ TgtWidth
;
382 int FractPart
= SrcWidth
% TgtWidth
;
383 int Mid
= TgtWidth
>> 1;
388 skip
= (TgtWidth
< SrcWidth
) ? 0 : (TgtWidth
/ (2*SrcWidth
) + 1);
391 while (NumPixels
-- > 0) {
394 p
= average8(p
, *(Source
+1));
408 FinalCopy8(PIXEL
*Target
, PIXEL
*Source
, PSPAN ClipSpans
, UINT ClipSpansCount
, UINT
*SpanIndex
,
409 UINT DestY
, RECTL
*DestRect
)
413 while (ClipSpans
[*SpanIndex
].Y
< DestY
414 || (ClipSpans
[*SpanIndex
].Y
== DestY
415 && ClipSpans
[*SpanIndex
].X
+ ClipSpans
[*SpanIndex
].Width
< DestRect
->left
))
418 if (ClipSpansCount
<= *SpanIndex
)
420 /* No more spans, everything else is clipped away, we're done */
424 while (ClipSpans
[*SpanIndex
].Y
== DestY
)
426 if (ClipSpans
[*SpanIndex
].X
< DestRect
->right
)
428 Left
= max(ClipSpans
[*SpanIndex
].X
, DestRect
->left
);
429 Right
= min(ClipSpans
[*SpanIndex
].X
+ ClipSpans
[*SpanIndex
].Width
, DestRect
->right
);
430 memcpy(Target
+ Left
- DestRect
->left
, Source
+ Left
- DestRect
->left
,
431 (Right
- Left
) * sizeof(PIXEL
));
434 if (ClipSpansCount
<= *SpanIndex
)
436 /* No more spans, everything else is clipped away, we're done */
444 //NOTE: If you change something here, please do the same in other dibXXbpp.c files!
445 BOOLEAN
ScaleRectAvg8(SURFOBJ
*DestSurf
, SURFOBJ
*SourceSurf
,
446 RECTL
* DestRect
, RECTL
*SourceRect
,
447 POINTL
* MaskOrigin
, POINTL BrushOrigin
,
448 CLIPOBJ
*ClipRegion
, XLATEOBJ
*ColorTranslation
,
451 int NumPixels
= DestRect
->bottom
- DestRect
->top
;
452 int IntPart
= (((SourceRect
->bottom
- SourceRect
->top
) / (DestRect
->bottom
- DestRect
->top
)) * SourceSurf
->lDelta
); //((SourceRect->bottom - SourceRect->top) / (DestRect->bottom - DestRect->top)) * (SourceRect->right - SourceRect->left);
453 int FractPart
= (SourceRect
->bottom
- SourceRect
->top
) % (DestRect
->bottom
- DestRect
->top
);
454 int Mid
= (DestRect
->bottom
- DestRect
->top
) >> 1;
457 PIXEL
*ScanLine
, *ScanLineAhead
;
458 PIXEL
*PrevSource
= NULL
;
459 PIXEL
*PrevSourceAhead
= NULL
;
460 PIXEL
*Target
= (PIXEL
*) (DestSurf
->pvScan0
+ (DestRect
->top
* DestSurf
->lDelta
) + DestRect
->left
);
461 PIXEL
*Source
= (PIXEL
*) (SourceSurf
->pvScan0
+ (SourceRect
->top
* SourceSurf
->lDelta
) + SourceRect
->left
);
467 if (! ClipobjToSpans(&ClipSpans
, &ClipSpansCount
, ClipRegion
, DestRect
))
471 if (0 == ClipSpansCount
)
473 /* No clip spans == empty clipping region, everything clipped away */
474 ASSERT(NULL
== ClipSpans
);
477 skip
= (DestRect
->bottom
- DestRect
->top
< SourceRect
->bottom
- SourceRect
->top
) ? 0 : ((DestRect
->bottom
- DestRect
->top
) / (2 * (SourceRect
->bottom
- SourceRect
->top
)) + 1);
480 ScanLine
= (PIXEL
*)ExAllocatePool(PagedPool
, (DestRect
->right
- DestRect
->left
) * sizeof(PIXEL
));
481 ScanLineAhead
= (PIXEL
*)ExAllocatePool(PagedPool
, (DestRect
->right
- DestRect
->left
) * sizeof(PIXEL
));
483 DestY
= DestRect
->top
;
485 while (NumPixels
-- > 0) {
486 if (Source
!= PrevSource
) {
487 if (Source
== PrevSourceAhead
) {
488 /* the next scan line has already been scaled and stored in
489 * ScanLineAhead; swap the buffers that ScanLine and ScanLineAhead
492 PIXEL
*tmp
= ScanLine
;
493 ScanLine
= ScanLineAhead
;
496 ScaleLineAvg8(ScanLine
, Source
, SourceRect
->right
- SourceRect
->left
, DestRect
->right
- DestRect
->left
);
501 if (E
>= Mid
&& PrevSourceAhead
!= (PIXEL
*)((BYTE
*)Source
+ SourceSurf
->lDelta
)) {
503 ScaleLineAvg8(ScanLineAhead
, (PIXEL
*)((BYTE
*)Source
+ SourceSurf
->lDelta
), SourceRect
->right
- SourceRect
->left
, DestRect
->right
- DestRect
->left
);
504 for (x
= 0; x
< DestRect
->right
- DestRect
->left
; x
++)
505 ScanLine
[x
] = average8(ScanLine
[x
], ScanLineAhead
[x
]);
506 PrevSourceAhead
= (PIXEL
*)((BYTE
*)Source
+ SourceSurf
->lDelta
);
509 if (! FinalCopy8(Target
, ScanLine
, ClipSpans
, ClipSpansCount
, &SpanIndex
, DestY
, DestRect
))
511 /* No more spans, everything else is clipped away, we're done */
512 ExFreePool(ClipSpans
);
513 ExFreePool(ScanLine
);
514 ExFreePool(ScanLineAhead
);
518 Target
= (PIXEL
*)((BYTE
*)Target
+ DestSurf
->lDelta
);
521 if (E
>= DestRect
->bottom
- DestRect
->top
) {
522 E
-= DestRect
->bottom
- DestRect
->top
;
523 Source
= (PIXEL
*)((BYTE
*)Source
+ SourceSurf
->lDelta
);
527 if (skip
> 0 && Source
!= PrevSource
)
528 ScaleLineAvg8(ScanLine
, Source
, SourceRect
->right
- SourceRect
->left
, DestRect
->right
- DestRect
->left
);
530 if (! FinalCopy8(Target
, ScanLine
, ClipSpans
, ClipSpansCount
, &SpanIndex
, DestY
, DestRect
))
532 /* No more spans, everything else is clipped away, we're done */
533 ExFreePool(ClipSpans
);
534 ExFreePool(ScanLine
);
535 ExFreePool(ScanLineAhead
);
539 Target
= (PIXEL
*)((BYTE
*)Target
+ DestSurf
->lDelta
);
542 ExFreePool(ClipSpans
);
543 ExFreePool(ScanLine
);
544 ExFreePool(ScanLineAhead
);
549 //NOTE: If you change something here, please do the same in other dibXXbpp.c files!
550 BOOLEAN
DIB_8BPP_StretchBlt(SURFOBJ
*DestSurf
, SURFOBJ
*SourceSurf
,
551 RECTL
* DestRect
, RECTL
*SourceRect
,
552 POINTL
* MaskOrigin
, POINTL BrushOrigin
,
553 CLIPOBJ
*ClipRegion
, XLATEOBJ
*ColorTranslation
,
570 BOOLEAN DesIsBiggerY
=FALSE
;
572 DPRINT("DIB_8BPP_StretchBlt: Source BPP: %u, srcRect: (%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n",
573 BitsPerFormat(SourceSurf
->iBitmapFormat
), SourceRect
->left
, SourceRect
->top
, SourceRect
->right
, SourceRect
->bottom
,
574 DestRect
->left
, DestRect
->top
, DestRect
->right
, DestRect
->bottom
);
576 SrcSizeY
= SourceRect
->bottom
;
577 SrcSizeX
= SourceRect
->right
;
579 DesSizeY
= DestRect
->bottom
;
580 DesSizeX
= DestRect
->right
;
582 zoomX
= DesSizeX
/ SrcSizeX
;
583 if (zoomX
==0) zoomX
=1;
585 zoomY
= DesSizeY
/ SrcSizeY
;
586 if (zoomY
==0) zoomY
=1;
588 if (DesSizeY
>SrcSizeY
)
591 switch(SourceSurf
->iBitmapFormat
)
594 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
595 /* This is a reference implementation, it hasn't been optimized for speed */
598 /* Draw one Hline on X - Led to the Des Zoom In*/
599 if (DesSizeX
>SrcSizeX
)
601 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
604 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
606 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
608 if (sy
> SourceRect
->bottom
) break;
612 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
614 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
616 if (sx
> SourceRect
->right
) break;
618 saveX
= DesX
+ zoomX
;
620 if (DIB_1BPP_GetPixel(SourceSurf
, sx
, sy
) == 0)
621 for (count
=DesY
;count
<saveY
;count
++)
622 DIB_8BPP_HLine(DestSurf
, DesX
, saveX
, count
, 0);
624 for (count
=DesY
;count
<saveY
;count
++)
625 DIB_8BPP_HLine(DestSurf
, DesX
, saveX
, count
, 1);
632 /* Draw one Hline on X - Led to the Des Zoom Out*/
634 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
637 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
639 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
641 if (sy
> SourceRect
->bottom
) break;
645 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
647 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
649 if (sx
> SourceRect
->right
) break;
651 saveX
= DesX
+ zoomX
;
653 if (DIB_1BPP_GetPixel(SourceSurf
, sx
, sy
) == 0)
654 for (count
=DesY
;count
<saveY
;count
++)
655 DIB_8BPP_HLine(DestSurf
, DesX
, saveX
, count
, 0);
657 for (count
=DesY
;count
<saveY
;count
++)
658 DIB_8BPP_HLine(DestSurf
, DesX
, saveX
, count
, 1);
667 if (DesSizeX
>SrcSizeX
)
669 /* Draw one pixel on X - Led to the Des Zoom In*/
670 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
673 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
675 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
677 if (sy
> SourceRect
->bottom
) break;
681 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
683 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
685 if (sx
> SourceRect
->right
) break;
687 if (DIB_1BPP_GetPixel(SourceSurf
, sx
, sy
) == 0)
688 for (count
=DesY
;count
<saveY
;count
++)
689 DIB_8BPP_PutPixel(DestSurf
, DesX
, count
, 0);
691 for (count
=DesY
;count
<saveY
;count
++)
692 DIB_8BPP_PutPixel(DestSurf
, DesX
, count
, 1);
700 /* Draw one pixel on X - Led to the Des Zoom Out*/
701 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
704 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
706 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
708 if (sy
> SourceRect
->bottom
) break;
712 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
714 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
716 if (sx
> SourceRect
->right
) break;
718 if (DIB_1BPP_GetPixel(SourceSurf
, sx
, sy
) == 0)
719 for (count
=DesY
;count
<saveY
;count
++)
720 DIB_8BPP_PutPixel(DestSurf
, DesX
, count
, 0);
722 for (count
=DesY
;count
<saveY
;count
++)
723 DIB_8BPP_PutPixel(DestSurf
, DesX
, count
, 1);
732 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
733 /* This is a reference implementation, it hasn't been optimized for speed */
736 /* Draw one Hline on X - Led to the Des Zoom In*/
737 if (DesSizeX
>SrcSizeX
)
739 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
742 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
744 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
746 if (sy
> SourceRect
->bottom
) break;
750 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
752 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
754 if (sx
> SourceRect
->right
) break;
756 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_4BPP_GetPixel(SourceSurf
, sx
, sy
));
758 saveX
= DesX
+ zoomX
;
759 for (count
=DesY
;count
<saveY
;count
++)
760 DIB_8BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
766 /* Draw one Hline on X - Led to the Des Zoom Out*/
768 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
771 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
773 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
775 if (sy
> SourceRect
->bottom
) break;
779 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
781 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
783 if (sx
> SourceRect
->right
) break;
785 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_4BPP_GetPixel(SourceSurf
, sx
, sy
));
787 saveX
= DesX
+ zoomX
;
788 for (count
=DesY
;count
<saveY
;count
++)
789 DIB_8BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
798 if (DesSizeX
>SrcSizeX
)
800 /* Draw one pixel on X - Led to the Des Zoom In*/
801 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
804 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
806 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
808 if (sy
> SourceRect
->bottom
) break;
812 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
814 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
816 if (sx
> SourceRect
->right
) break;
818 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_4BPP_GetPixel(SourceSurf
, sx
, sy
));
820 for (count
=DesY
;count
<saveY
;count
++)
821 DIB_8BPP_PutPixel(DestSurf
, DesX
, count
, color
);
827 /* Draw one pixel on X - Led to the Des Zoom Out*/
828 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
831 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
833 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
835 if (sy
> SourceRect
->bottom
) break;
839 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
841 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
843 if (sx
> SourceRect
->right
) break;
845 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_4BPP_GetPixel(SourceSurf
, sx
, sy
));
847 for (count
=DesY
;count
<saveY
;count
++)
848 DIB_8BPP_PutPixel(DestSurf
, DesX
, count
, color
);
856 return ScaleRectAvg8(DestSurf
, SourceSurf
, DestRect
, SourceRect
, MaskOrigin
, BrushOrigin
,
857 ClipRegion
, ColorTranslation
, Mode
);
861 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
862 /* This is a reference implementation, it hasn't been optimized for speed */
865 /* Draw one Hline on X - Led to the Des Zoom In*/
866 if (DesSizeX
>SrcSizeX
)
868 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
871 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
873 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
875 if (sy
> SourceRect
->bottom
) break;
879 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
881 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
883 if (sx
> SourceRect
->right
) break;
885 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_16BPP_GetPixel(SourceSurf
, sx
, sy
));
887 saveX
= DesX
+ zoomX
;
888 for (count
=DesY
;count
<saveY
;count
++)
889 DIB_8BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
895 /* Draw one Hline on X - Led to the Des Zoom Out*/
897 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
900 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
902 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
904 if (sy
> SourceRect
->bottom
) break;
908 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
910 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
912 if (sx
> SourceRect
->right
) break;
914 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_16BPP_GetPixel(SourceSurf
, sx
, sy
));
916 saveX
= DesX
+ zoomX
;
917 for (count
=DesY
;count
<saveY
;count
++)
918 DIB_8BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
927 if (DesSizeX
>SrcSizeX
)
929 /* Draw one pixel on X - Led to the Des Zoom In*/
930 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
933 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
935 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
937 if (sy
> SourceRect
->bottom
) break;
941 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
943 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
945 if (sx
> SourceRect
->right
) break;
947 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_16BPP_GetPixel(SourceSurf
, sx
, sy
));
949 for (count
=DesY
;count
<saveY
;count
++)
950 DIB_8BPP_PutPixel(DestSurf
, DesX
, count
, color
);
956 /* Draw one pixel on X - Led to the Des Zoom Out*/
957 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
960 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
962 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
964 if (sy
> SourceRect
->bottom
) break;
968 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
970 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
972 if (sx
> SourceRect
->right
) break;
974 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_16BPP_GetPixel(SourceSurf
, sx
, sy
));
976 for (count
=DesY
;count
<saveY
;count
++)
977 DIB_8BPP_PutPixel(DestSurf
, DesX
, count
, color
);
985 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
986 /* This is a reference implementation, it hasn't been optimized for speed */
989 /* Draw one Hline on X - Led to the Des Zoom In*/
990 if (DesSizeX
>SrcSizeX
)
992 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
995 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
997 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
999 if (sy
> SourceRect
->bottom
) break;
1003 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1005 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
1007 if (sx
> SourceRect
->right
) break;
1009 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_24BPP_GetPixel(SourceSurf
, sx
, sy
));
1011 saveX
= DesX
+ zoomX
;
1012 for (count
=DesY
;count
<saveY
;count
++)
1013 DIB_8BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
1019 /* Draw one Hline on X - Led to the Des Zoom Out*/
1021 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1024 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1026 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1028 if (sy
> SourceRect
->bottom
) break;
1032 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1034 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
1036 if (sx
> SourceRect
->right
) break;
1038 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_24BPP_GetPixel(SourceSurf
, sx
, sy
));
1040 saveX
= DesX
+ zoomX
;
1041 for (count
=DesY
;count
<saveY
;count
++)
1042 DIB_8BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
1051 if (DesSizeX
>SrcSizeX
)
1053 /* Draw one pixel on X - Led to the Des Zoom In*/
1054 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1057 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1059 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1061 if (sy
> SourceRect
->bottom
) break;
1065 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1067 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
1069 if (sx
> SourceRect
->right
) break;
1071 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_24BPP_GetPixel(SourceSurf
, sx
, sy
));
1073 for (count
=DesY
;count
<saveY
;count
++)
1074 DIB_8BPP_PutPixel(DestSurf
, DesX
, count
, color
);
1080 /* Draw one pixel on X - Led to the Des Zoom Out*/
1081 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1084 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1086 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1088 if (sy
> SourceRect
->bottom
) break;
1092 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1094 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
1096 if (sx
> SourceRect
->right
) break;
1098 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_24BPP_GetPixel(SourceSurf
, sx
, sy
));
1100 for (count
=DesY
;count
<saveY
;count
++)
1101 DIB_8BPP_PutPixel(DestSurf
, DesX
, count
, color
);
1109 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
1110 /* This is a reference implementation, it hasn't been optimized for speed */
1113 /* Draw one Hline on X - Led to the Des Zoom In*/
1114 if (DesSizeX
>SrcSizeX
)
1116 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1119 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1121 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1123 if (sy
> SourceRect
->bottom
) break;
1127 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1129 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
1131 if (sx
> SourceRect
->right
) break;
1133 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_32BPP_GetPixel(SourceSurf
, sx
, sy
));
1135 saveX
= DesX
+ zoomX
;
1136 for (count
=DesY
;count
<saveY
;count
++)
1137 DIB_8BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
1143 /* Draw one Hline on X - Led to the Des Zoom Out*/
1145 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1148 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1150 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1152 if (sy
> SourceRect
->bottom
) break;
1156 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1158 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
1160 if (sx
> SourceRect
->right
) break;
1162 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_32BPP_GetPixel(SourceSurf
, sx
, sy
));
1164 saveX
= DesX
+ zoomX
;
1165 for (count
=DesY
;count
<saveY
;count
++)
1166 DIB_8BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
1175 if (DesSizeX
>SrcSizeX
)
1177 /* Draw one pixel on X - Led to the Des Zoom In*/
1178 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1181 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1183 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1185 if (sy
> SourceRect
->bottom
) break;
1189 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1191 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
1193 if (sx
> SourceRect
->right
) break;
1195 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_32BPP_GetPixel(SourceSurf
, sx
, sy
));
1197 for (count
=DesY
;count
<saveY
;count
++)
1198 DIB_8BPP_PutPixel(DestSurf
, DesX
, count
, color
);
1204 /* Draw one pixel on X - Led to the Des Zoom Out*/
1205 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1208 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1210 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1212 if (sy
> SourceRect
->bottom
) break;
1216 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1218 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
1220 if (sx
> SourceRect
->right
) break;
1222 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_32BPP_GetPixel(SourceSurf
, sx
, sy
));
1224 for (count
=DesY
;count
<saveY
;count
++)
1225 DIB_8BPP_PutPixel(DestSurf
, DesX
, count
, color
);
1234 DPRINT1("DIB_8BPP_StretchBlt: Unhandled Source BPP: %u\n", BitsPerFormat(SourceSurf
->iBitmapFormat
));
1242 DIB_8BPP_TransparentBlt(SURFOBJ
*DestSurf
, SURFOBJ
*SourceSurf
,
1243 RECTL
* DestRect
, POINTL
*SourcePoint
,
1244 XLATEOBJ
*ColorTranslation
, ULONG iTransColor
)
1246 ULONG RoundedRight
, X
, Y
, SourceX
, SourceY
, Source
, wd
, Dest
;
1249 RoundedRight
= DestRect
->right
- ((DestRect
->right
- DestRect
->left
) & 0x3);
1250 SourceY
= SourcePoint
->y
;
1251 DestBits
= (ULONG
*)(DestSurf
->pvScan0
+ DestRect
->left
+
1252 (DestRect
->top
* DestSurf
->lDelta
));
1253 wd
= DestSurf
->lDelta
- (DestRect
->right
- DestRect
->left
);
1255 for(Y
= DestRect
->top
; Y
< DestRect
->bottom
; Y
++)
1257 DestBits
= (ULONG
*)(DestSurf
->pvScan0
+ DestRect
->left
+
1258 (Y
* DestSurf
->lDelta
));
1259 SourceX
= SourcePoint
->x
;
1260 for (X
= DestRect
->left
; X
< RoundedRight
; X
+= 4, DestBits
++)
1264 Source
= DIB_GetSourceIndex(SourceSurf
, SourceX
++, SourceY
);
1265 if(Source
!= iTransColor
)
1268 Dest
|= (XLATEOBJ_iXlate(ColorTranslation
, Source
) & 0xFF);
1271 Source
= DIB_GetSourceIndex(SourceSurf
, SourceX
++, SourceY
);
1272 if(Source
!= iTransColor
)
1275 Dest
|= ((XLATEOBJ_iXlate(ColorTranslation
, Source
) << 8) & 0xFF00);
1278 Source
= DIB_GetSourceIndex(SourceSurf
, SourceX
++, SourceY
);
1279 if(Source
!= iTransColor
)
1282 Dest
|= ((XLATEOBJ_iXlate(ColorTranslation
, Source
) << 16) & 0xFF0000);
1285 Source
= DIB_GetSourceIndex(SourceSurf
, SourceX
++, SourceY
);
1286 if(Source
!= iTransColor
)
1289 Dest
|= ((XLATEOBJ_iXlate(ColorTranslation
, Source
) << 24) & 0xFF000000);
1295 if(X
< DestRect
->right
)
1297 for (; X
< DestRect
->right
; X
++)
1299 Source
= DIB_GetSourceIndex(SourceSurf
, SourceX
++, SourceY
);
1300 if(Source
!= iTransColor
)
1302 *((BYTE
*)DestBits
) = (BYTE
)(XLATEOBJ_iXlate(ColorTranslation
, Source
) & 0xFF);
1304 DestBits
= (PULONG
)((ULONG_PTR
)DestBits
+ 1);