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_16BPP_PutPixel(SURFOBJ
*SurfObj
, LONG x
, LONG y
, ULONG c
)
25 PBYTE byteaddr
= SurfObj
->pvScan0
+ y
* SurfObj
->lDelta
;
26 PWORD addr
= (PWORD
)byteaddr
+ x
;
32 DIB_16BPP_GetPixel(SURFOBJ
*SurfObj
, LONG x
, LONG y
)
34 PBYTE byteaddr
= SurfObj
->pvScan0
+ y
* SurfObj
->lDelta
;
35 PWORD addr
= (PWORD
)byteaddr
+ x
;
37 return (ULONG
)(*addr
);
41 DIB_16BPP_HLine(SURFOBJ
*SurfObj
, LONG x1
, LONG x2
, LONG y
, ULONG c
)
43 PDWORD addr
= (PDWORD
)((PWORD
)(SurfObj
->pvScan0
+ y
* SurfObj
->lDelta
) + x1
);
47 /* This is about 10% faster than the generic C code below */
54 " andl $0xffff, %0\n" /* If the pixel value is "abcd", put "abcdabcd" in %eax */
56 " test $0x03, %%edi\n" /* Align to fullword boundary */
62 " mov %1,%%ecx\n" /* Setup count of fullwords to fill */
64 " rep stosl\n" /* The actual fill */
65 " test $0x01, %1\n" /* One left to do at the right side? */
70 : "r"(c
), "r"(Count
), "D"(addr
)
76 if (0 != (cx
& 0x01)) {
79 addr
= (PDWORD
)((PWORD
)(addr
) + 1);
81 cc
= ((c
& 0xffff) << 16) | (c
& 0xffff);
94 DIB_16BPP_VLine(SURFOBJ
*SurfObj
, LONG x
, LONG y1
, LONG y2
, ULONG c
)
98 " testl %2, %2" "\n\t"
100 " movl %2, %%ecx" "\n\t"
101 " shrl $2, %2" "\n\t"
102 " andl $3, %%ecx" "\n\t"
105 " movw %%ax, (%0)" "\n\t"
106 " addl %1, %0" "\n\t"
109 " testl %2, %2" "\n\t"
112 " movw %%ax, (%0)" "\n\t"
113 " addl %1, %0" "\n\t"
114 " movw %%ax, (%0)" "\n\t"
115 " addl %1, %0" "\n\t"
116 " movw %%ax, (%0)" "\n\t"
117 " addl %1, %0" "\n\t"
118 " movw %%ax, (%0)" "\n\t"
119 " addl %1, %0" "\n\t"
124 : "r"(SurfObj
->pvScan0
+ (y1
* SurfObj
->lDelta
) + (x
* sizeof (WORD
))),
125 "r"(SurfObj
->lDelta
), "r"(y2
- y1
), "a"(c
)
126 : "cc", "memory", "%ecx");
128 PBYTE byteaddr
= SurfObj
->pvScan0
+ y1
* SurfObj
->lDelta
;
129 PWORD addr
= (PWORD
)byteaddr
+ x
;
130 LONG lDelta
= SurfObj
->lDelta
;
132 byteaddr
= (PBYTE
)addr
;
137 addr
= (PWORD
)byteaddr
;
143 DIB_16BPP_BitBltSrcCopy(PBLTINFO BltInfo
)
145 LONG i
, j
, sx
, sy
, xColor
, f1
;
146 PBYTE SourceBits
, DestBits
, SourceLine
, DestLine
;
147 PBYTE SourceBits_4BPP
, SourceLine_4BPP
;
148 DestBits
= BltInfo
->DestSurface
->pvScan0
+ (BltInfo
->DestRect
.top
* BltInfo
->DestSurface
->lDelta
) + 2 * BltInfo
->DestRect
.left
;
150 switch(BltInfo
->SourceSurface
->iBitmapFormat
)
153 sx
= BltInfo
->SourcePoint
.x
;
154 sy
= BltInfo
->SourcePoint
.y
;
156 for (j
=BltInfo
->DestRect
.top
; j
<BltInfo
->DestRect
.bottom
; j
++)
158 sx
= BltInfo
->SourcePoint
.x
;
159 for (i
=BltInfo
->DestRect
.left
; i
<BltInfo
->DestRect
.right
; i
++)
161 if(DIB_1BPP_GetPixel(BltInfo
->SourceSurface
, sx
, sy
) == 0)
163 DIB_16BPP_PutPixel(BltInfo
->DestSurface
, i
, j
, XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, 0));
165 DIB_16BPP_PutPixel(BltInfo
->DestSurface
, i
, j
, XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, 1));
174 SourceBits_4BPP
= BltInfo
->SourceSurface
->pvScan0
+ (BltInfo
->SourcePoint
.y
* BltInfo
->SourceSurface
->lDelta
) + (BltInfo
->SourcePoint
.x
>> 1);
176 for (j
=BltInfo
->DestRect
.top
; j
<BltInfo
->DestRect
.bottom
; j
++)
178 SourceLine_4BPP
= SourceBits_4BPP
;
179 sx
= BltInfo
->SourcePoint
.x
;
182 for (i
=BltInfo
->DestRect
.left
; i
<BltInfo
->DestRect
.right
; i
++)
184 xColor
= XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
,
185 (*SourceLine_4BPP
& altnotmask
[f1
]) >> (4 * (1 - f1
)));
186 DIB_16BPP_PutPixel(BltInfo
->DestSurface
, i
, j
, xColor
);
187 if(f1
== 1) { SourceLine_4BPP
++; f1
= 0; } else { f1
= 1; }
191 SourceBits_4BPP
+= BltInfo
->SourceSurface
->lDelta
;
196 SourceLine
= BltInfo
->SourceSurface
->pvScan0
+ (BltInfo
->SourcePoint
.y
* BltInfo
->SourceSurface
->lDelta
) + BltInfo
->SourcePoint
.x
;
199 for (j
= BltInfo
->DestRect
.top
; j
< BltInfo
->DestRect
.bottom
; j
++)
201 SourceBits
= SourceLine
;
204 for (i
= BltInfo
->DestRect
.left
; i
< BltInfo
->DestRect
.right
; i
++)
206 *((WORD
*)DestBits
) = (WORD
)XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, *SourceBits
);
211 SourceLine
+= BltInfo
->SourceSurface
->lDelta
;
212 DestLine
+= BltInfo
->DestSurface
->lDelta
;
217 if (NULL
== BltInfo
->XlateSourceToDest
|| 0 != (BltInfo
->XlateSourceToDest
->flXlate
& XO_TRIVIAL
))
219 if (BltInfo
->DestRect
.top
< BltInfo
->SourcePoint
.y
)
221 SourceBits
= BltInfo
->SourceSurface
->pvScan0
+ (BltInfo
->SourcePoint
.y
* BltInfo
->SourceSurface
->lDelta
) + 2 * BltInfo
->SourcePoint
.x
;
222 for (j
= BltInfo
->DestRect
.top
; j
< BltInfo
->DestRect
.bottom
; j
++)
224 RtlMoveMemory(DestBits
, SourceBits
, 2 * (BltInfo
->DestRect
.right
- BltInfo
->DestRect
.left
));
225 SourceBits
+= BltInfo
->SourceSurface
->lDelta
;
226 DestBits
+= BltInfo
->DestSurface
->lDelta
;
231 SourceBits
= BltInfo
->SourceSurface
->pvScan0
+ ((BltInfo
->SourcePoint
.y
+ BltInfo
->DestRect
.bottom
- BltInfo
->DestRect
.top
- 1) * BltInfo
->SourceSurface
->lDelta
) + 2 * BltInfo
->SourcePoint
.x
;
232 DestBits
= BltInfo
->DestSurface
->pvScan0
+ ((BltInfo
->DestRect
.bottom
- 1) * BltInfo
->DestSurface
->lDelta
) + 2 * BltInfo
->DestRect
.left
;
233 for (j
= BltInfo
->DestRect
.bottom
- 1; BltInfo
->DestRect
.top
<= j
; j
--)
235 RtlMoveMemory(DestBits
, SourceBits
, 2 * (BltInfo
->DestRect
.right
- BltInfo
->DestRect
.left
));
236 SourceBits
-= BltInfo
->SourceSurface
->lDelta
;
237 DestBits
-= BltInfo
->DestSurface
->lDelta
;
243 if (BltInfo
->DestRect
.top
< BltInfo
->SourcePoint
.y
)
245 SourceLine
= BltInfo
->SourceSurface
->pvScan0
+ (BltInfo
->SourcePoint
.y
* BltInfo
->SourceSurface
->lDelta
) + 2 * BltInfo
->SourcePoint
.x
;
247 for (j
= BltInfo
->DestRect
.top
; j
< BltInfo
->DestRect
.bottom
; j
++)
249 SourceBits
= SourceLine
;
251 for (i
= BltInfo
->DestRect
.left
; i
< BltInfo
->DestRect
.right
; i
++)
253 *((WORD
*)DestBits
) = (WORD
)XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, *((WORD
*)SourceBits
));
257 SourceLine
+= BltInfo
->SourceSurface
->lDelta
;
258 DestLine
+= BltInfo
->DestSurface
->lDelta
;
263 SourceLine
= BltInfo
->SourceSurface
->pvScan0
+ ((BltInfo
->SourcePoint
.y
+ BltInfo
->DestRect
.bottom
- BltInfo
->DestRect
.top
- 1) * BltInfo
->SourceSurface
->lDelta
) + 2 * BltInfo
->SourcePoint
.x
;
264 DestLine
= BltInfo
->DestSurface
->pvScan0
+ ((BltInfo
->DestRect
.bottom
- 1) * BltInfo
->DestSurface
->lDelta
) + 2 * BltInfo
->DestRect
.left
;
265 for (j
= BltInfo
->DestRect
.bottom
- 1; BltInfo
->DestRect
.top
<= j
; j
--)
267 SourceBits
= SourceLine
;
269 for (i
= BltInfo
->DestRect
.left
; i
< BltInfo
->DestRect
.right
; i
++)
271 *((WORD
*)DestBits
) = (WORD
)XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, *((WORD
*)SourceBits
));
275 SourceLine
-= BltInfo
->SourceSurface
->lDelta
;
276 DestLine
-= BltInfo
->DestSurface
->lDelta
;
283 SourceLine
= BltInfo
->SourceSurface
->pvScan0
+ (BltInfo
->SourcePoint
.y
* BltInfo
->SourceSurface
->lDelta
) + 3 * BltInfo
->SourcePoint
.x
;
286 for (j
= BltInfo
->DestRect
.top
; j
< BltInfo
->DestRect
.bottom
; j
++)
288 SourceBits
= SourceLine
;
291 for (i
= BltInfo
->DestRect
.left
; i
< BltInfo
->DestRect
.right
; i
++)
293 xColor
= (*(SourceBits
+ 2) << 0x10) +
294 (*(SourceBits
+ 1) << 0x08) +
296 *((WORD
*)DestBits
) = (WORD
)XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, xColor
);
301 SourceLine
+= BltInfo
->SourceSurface
->lDelta
;
302 DestLine
+= BltInfo
->DestSurface
->lDelta
;
307 SourceLine
= BltInfo
->SourceSurface
->pvScan0
+ (BltInfo
->SourcePoint
.y
* BltInfo
->SourceSurface
->lDelta
) + 4 * BltInfo
->SourcePoint
.x
;
310 for (j
= BltInfo
->DestRect
.top
; j
< BltInfo
->DestRect
.bottom
; j
++)
312 SourceBits
= SourceLine
;
315 for (i
= BltInfo
->DestRect
.left
; i
< BltInfo
->DestRect
.right
; i
++)
317 *((WORD
*)DestBits
) = (WORD
)XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, *((PDWORD
) SourceBits
));
322 SourceLine
+= BltInfo
->SourceSurface
->lDelta
;
323 DestLine
+= BltInfo
->DestSurface
->lDelta
;
328 DPRINT1("DIB_16BPP_Bitblt: Unhandled Source BPP: %u\n", BitsPerFormat(BltInfo
->SourceSurface
->iBitmapFormat
));
336 DIB_16BPP_BitBlt(PBLTINFO BltInfo
)
339 ULONG SourceX
, SourceY
;
341 ULONG Dest
, Source
= 0, Pattern
= 0;
347 UsesSource
= ROP4_USES_SOURCE(BltInfo
->Rop4
);
348 UsesPattern
= ROP4_USES_PATTERN(BltInfo
->Rop4
);
350 RoundedRight
= BltInfo
->DestRect
.right
-
351 ((BltInfo
->DestRect
.right
- BltInfo
->DestRect
.left
) & 0x1);
352 SourceY
= BltInfo
->SourcePoint
.y
;
354 BltInfo
->DestSurface
->pvScan0
+
355 (BltInfo
->DestRect
.left
<< 1) +
356 BltInfo
->DestRect
.top
* BltInfo
->DestSurface
->lDelta
);
360 if (BltInfo
->PatternSurface
)
362 PatternY
= (BltInfo
->DestRect
.top
+ BltInfo
->BrushOrigin
.y
) %
363 BltInfo
->PatternSurface
->sizlBitmap
.cy
;
367 Pattern
= BltInfo
->Brush
->iSolidColor
|
368 (BltInfo
->Brush
->iSolidColor
<< 16);
372 for (DestY
= BltInfo
->DestRect
.top
; DestY
< BltInfo
->DestRect
.bottom
; DestY
++)
374 SourceX
= BltInfo
->SourcePoint
.x
;
376 for (DestX
= BltInfo
->DestRect
.left
; DestX
< RoundedRight
; DestX
+= 2, DestBits
++, SourceX
+= 2)
382 Source
= DIB_GetSource(BltInfo
->SourceSurface
, SourceX
, SourceY
, BltInfo
->XlateSourceToDest
);
383 Source
|= DIB_GetSource(BltInfo
->SourceSurface
, SourceX
+ 1, SourceY
, BltInfo
->XlateSourceToDest
) << 16;
386 if (BltInfo
->PatternSurface
)
388 Pattern
= DIB_GetSource(BltInfo
->PatternSurface
, (DestX
+ BltInfo
->BrushOrigin
.x
) % BltInfo
->PatternSurface
->sizlBitmap
.cx
, PatternY
, BltInfo
->XlatePatternToDest
);
389 Pattern
|= DIB_GetSource(BltInfo
->PatternSurface
, (DestX
+ BltInfo
->BrushOrigin
.x
+ 1) % BltInfo
->PatternSurface
->sizlBitmap
.cx
, PatternY
, BltInfo
->XlatePatternToDest
) << 16;
392 *DestBits
= DIB_DoRop(BltInfo
->Rop4
, Dest
, Source
, Pattern
);
395 if (DestX
< BltInfo
->DestRect
.right
)
397 Dest
= *((PUSHORT
)DestBits
);
401 Source
= DIB_GetSource(BltInfo
->SourceSurface
, SourceX
, SourceY
, BltInfo
->XlateSourceToDest
);
404 if (BltInfo
->PatternSurface
)
406 Pattern
= DIB_GetSource(BltInfo
->PatternSurface
, (DestX
+ BltInfo
->BrushOrigin
.x
) % BltInfo
->PatternSurface
->sizlBitmap
.cx
, PatternY
, BltInfo
->XlatePatternToDest
);
409 DIB_16BPP_PutPixel(BltInfo
->DestSurface
, DestX
, DestY
, DIB_DoRop(BltInfo
->Rop4
, Dest
, Source
, Pattern
) & 0xFFFF);
410 DestBits
= (PULONG
)((ULONG_PTR
)DestBits
+ 2);
414 if (BltInfo
->PatternSurface
)
417 PatternY
%= BltInfo
->PatternSurface
->sizlBitmap
.cy
;
420 (ULONG_PTR
)DestBits
-
421 ((BltInfo
->DestRect
.right
- BltInfo
->DestRect
.left
) << 1) +
422 BltInfo
->DestSurface
->lDelta
);
428 /* Optimze for bitBlt */
430 DIB_16BPP_ColorFill(SURFOBJ
* DestSurface
, RECTL
* DestRect
, ULONG color
)
433 for (DestY
= DestRect
->top
; DestY
< DestRect
->bottom
; DestY
++)
435 DIB_16BPP_HLine (DestSurface
, DestRect
->left
, DestRect
->right
, DestY
, color
);
440 =======================================
441 Stretching functions goes below
442 Some parts of code are based on an
443 article "Bresenhame image scaling"
444 Dr. Dobb Journal, May 2002
445 =======================================
448 typedef unsigned short PIXEL
;
450 /* 16-bit HiColor (565 format) */
451 inline PIXEL
average16(PIXEL a
, PIXEL b
)
453 // This one doesn't work
458 unsigned short mask = ~ (((a | b) & 0x0410) << 1);
459 return ((a & mask) + (b & mask)) >> 1;
462 // This one should be correct, but it's too long
464 unsigned char r1, g1, b1, r2, g2, b2, rr, gr, br;
467 r1 = (a & 0xF800) >> 11;
468 g1 = (a & 0x7E0) >> 5;
471 r2 = (b & 0xF800) >> 11;
472 g2 = (b & 0x7E0) >> 5;
479 res = (rr << 11) + (gr << 5) + br;
483 return a
; // FIXME: Depend on SetStretchMode
486 //NOTE: If you change something here, please do the same in other dibXXbpp.c files!
487 void ScaleLineAvg16(PIXEL
*Target
, PIXEL
*Source
, int SrcWidth
, int TgtWidth
)
489 int NumPixels
= TgtWidth
;
490 int IntPart
= SrcWidth
/ TgtWidth
;
491 int FractPart
= SrcWidth
% TgtWidth
;
492 int Mid
= TgtWidth
>> 1;
497 skip
= (TgtWidth
< SrcWidth
) ? 0 : (TgtWidth
/ (2*SrcWidth
) + 1);
500 while (NumPixels
-- > 0) {
503 p
= average16(p
, *(Source
+1));
517 FinalCopy16(PIXEL
*Target
, PIXEL
*Source
, PSPAN ClipSpans
, UINT ClipSpansCount
, UINT
*SpanIndex
,
518 UINT DestY
, RECTL
*DestRect
)
522 while (ClipSpans
[*SpanIndex
].Y
< DestY
523 || (ClipSpans
[*SpanIndex
].Y
== DestY
524 && ClipSpans
[*SpanIndex
].X
+ ClipSpans
[*SpanIndex
].Width
< DestRect
->left
))
527 if (ClipSpansCount
<= *SpanIndex
)
529 /* No more spans, everything else is clipped away, we're done */
533 while (ClipSpans
[*SpanIndex
].Y
== DestY
)
535 if (ClipSpans
[*SpanIndex
].X
< DestRect
->right
)
537 Left
= max(ClipSpans
[*SpanIndex
].X
, DestRect
->left
);
538 Right
= min(ClipSpans
[*SpanIndex
].X
+ ClipSpans
[*SpanIndex
].Width
, DestRect
->right
);
539 memcpy(Target
+ Left
- DestRect
->left
, Source
+ Left
- DestRect
->left
,
540 (Right
- Left
) * sizeof(PIXEL
));
543 if (ClipSpansCount
<= *SpanIndex
)
545 /* No more spans, everything else is clipped away, we're done */
553 //NOTE: If you change something here, please do the same in other dibXXbpp.c files!
554 BOOLEAN
ScaleRectAvg16(SURFOBJ
*DestSurf
, SURFOBJ
*SourceSurf
,
555 RECTL
* DestRect
, RECTL
*SourceRect
,
556 POINTL
* MaskOrigin
, POINTL BrushOrigin
,
557 CLIPOBJ
*ClipRegion
, XLATEOBJ
*ColorTranslation
,
560 int NumPixels
= DestRect
->bottom
- DestRect
->top
;
561 int IntPart
= (((SourceRect
->bottom
- SourceRect
->top
) / (DestRect
->bottom
- DestRect
->top
)) * SourceSurf
->lDelta
) >> 1;
562 int FractPart
= (SourceRect
->bottom
- SourceRect
->top
) % (DestRect
->bottom
- DestRect
->top
);
563 int Mid
= (DestRect
->bottom
- DestRect
->top
) >> 1;
566 PIXEL
*ScanLine
, *ScanLineAhead
;
567 PIXEL
*PrevSource
= NULL
;
568 PIXEL
*PrevSourceAhead
= NULL
;
569 PIXEL
*Target
= (PIXEL
*) (DestSurf
->pvScan0
+ (DestRect
->top
* DestSurf
->lDelta
) + 2 * DestRect
->left
);
570 PIXEL
*Source
= (PIXEL
*) (SourceSurf
->pvScan0
+ (SourceRect
->top
* SourceSurf
->lDelta
) + 2 * SourceRect
->left
);
576 if (! ClipobjToSpans(&ClipSpans
, &ClipSpansCount
, ClipRegion
, DestRect
))
580 if (0 == ClipSpansCount
)
582 /* No clip spans == empty clipping region, everything clipped away */
583 ASSERT(NULL
== ClipSpans
);
586 skip
= (DestRect
->bottom
- DestRect
->top
< SourceRect
->bottom
- SourceRect
->top
) ? 0 : ((DestRect
->bottom
- DestRect
->top
) / (2 * (SourceRect
->bottom
- SourceRect
->top
)) + 1);
589 ScanLine
= (PIXEL
*)ExAllocatePool(PagedPool
, (DestRect
->right
- DestRect
->left
) * sizeof(PIXEL
));
590 ScanLineAhead
= (PIXEL
*)ExAllocatePool(PagedPool
, (DestRect
->right
- DestRect
->left
) * sizeof(PIXEL
));
592 DestY
= DestRect
->top
;
594 while (NumPixels
-- > 0) {
595 if (Source
!= PrevSource
) {
596 if (Source
== PrevSourceAhead
) {
597 /* the next scan line has already been scaled and stored in
598 * ScanLineAhead; swap the buffers that ScanLine and ScanLineAhead
601 PIXEL
*tmp
= ScanLine
;
602 ScanLine
= ScanLineAhead
;
605 ScaleLineAvg16(ScanLine
, Source
, SourceRect
->right
- SourceRect
->left
, DestRect
->right
- DestRect
->left
);
610 if (E
>= Mid
&& PrevSourceAhead
!= (PIXEL
*)((BYTE
*)Source
+ SourceSurf
->lDelta
)) {
612 ScaleLineAvg16(ScanLineAhead
, (PIXEL
*)((BYTE
*)Source
+ SourceSurf
->lDelta
), SourceRect
->right
- SourceRect
->left
, DestRect
->right
- DestRect
->left
);
613 for (x
= 0; x
< DestRect
->right
- DestRect
->left
; x
++)
614 ScanLine
[x
] = average16(ScanLine
[x
], ScanLineAhead
[x
]);
615 PrevSourceAhead
= (PIXEL
*)((BYTE
*)Source
+ SourceSurf
->lDelta
);
618 if (! FinalCopy16(Target
, ScanLine
, ClipSpans
, ClipSpansCount
, &SpanIndex
, DestY
, DestRect
))
620 /* No more spans, everything else is clipped away, we're done */
621 ExFreePool(ClipSpans
);
622 ExFreePool(ScanLine
);
623 ExFreePool(ScanLineAhead
);
627 Target
= (PIXEL
*)((BYTE
*)Target
+ DestSurf
->lDelta
);
630 if (E
>= DestRect
->bottom
- DestRect
->top
) {
631 E
-= DestRect
->bottom
- DestRect
->top
;
632 Source
= (PIXEL
*)((BYTE
*)Source
+ SourceSurf
->lDelta
);
636 if (skip
> 0 && Source
!= PrevSource
)
637 ScaleLineAvg16(ScanLine
, Source
, SourceRect
->right
- SourceRect
->left
, DestRect
->right
- DestRect
->left
);
639 if (! FinalCopy16(Target
, ScanLine
, ClipSpans
, ClipSpansCount
, &SpanIndex
, DestY
, DestRect
))
641 /* No more spans, everything else is clipped away, we're done */
642 ExFreePool(ClipSpans
);
643 ExFreePool(ScanLine
);
644 ExFreePool(ScanLineAhead
);
648 Target
= (PIXEL
*)((BYTE
*)Target
+ DestSurf
->lDelta
);
651 ExFreePool(ClipSpans
);
652 ExFreePool(ScanLine
);
653 ExFreePool(ScanLineAhead
);
658 //NOTE: If you change something here, please do the same in other dibXXbpp.c files!
659 BOOLEAN
DIB_16BPP_StretchBlt(SURFOBJ
*DestSurf
, SURFOBJ
*SourceSurf
,
660 RECTL
* DestRect
, RECTL
*SourceRect
,
661 POINTL
* MaskOrigin
, POINTL BrushOrigin
,
662 CLIPOBJ
*ClipRegion
, XLATEOBJ
*ColorTranslation
,
679 BOOLEAN DesIsBiggerY
=FALSE
;
681 DPRINT("DIB_16BPP_StretchBlt: Source BPP: %u, srcRect: (%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n",
682 BitsPerFormat(SourceSurf
->iBitmapFormat
), SourceRect
->left
, SourceRect
->top
, SourceRect
->right
, SourceRect
->bottom
,
683 DestRect
->left
, DestRect
->top
, DestRect
->right
, DestRect
->bottom
);
685 SrcSizeY
= SourceRect
->bottom
;
686 SrcSizeX
= SourceRect
->right
;
688 DesSizeY
= DestRect
->bottom
;
689 DesSizeX
= DestRect
->right
;
691 zoomX
= DesSizeX
/ SrcSizeX
;
692 if (zoomX
==0) zoomX
=1;
694 zoomY
= DesSizeY
/ SrcSizeY
;
695 if (zoomY
==0) zoomY
=1;
697 if (DesSizeY
>SrcSizeY
)
702 switch(SourceSurf
->iBitmapFormat
)
707 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
708 /* This is a reference implementation, it hasn't been optimized for speed */
711 /* Draw one Hline on X - Led to the Des Zoom In*/
712 if (DesSizeX
>SrcSizeX
)
714 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
717 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
719 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
721 if (sy
> SourceRect
->bottom
) break;
725 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
727 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
729 if (sx
> SourceRect
->right
) break;
731 saveX
= DesX
+ zoomX
;
733 if (DIB_1BPP_GetPixel(SourceSurf
, sx
, sy
) == 0)
734 for (count
=DesY
;count
<saveY
;count
++)
735 DIB_16BPP_HLine(DestSurf
, DesX
, saveX
, count
, 0);
737 for (count
=DesY
;count
<saveY
;count
++)
738 DIB_16BPP_HLine(DestSurf
, DesX
, saveX
, count
, 1);
745 /* Draw one Hline on X - Led to the Des Zoom Out*/
747 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
750 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
752 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
754 if (sy
> SourceRect
->bottom
) break;
758 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
760 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
762 if (sx
> SourceRect
->right
) break;
764 saveX
= DesX
+ zoomX
;
766 if (DIB_1BPP_GetPixel(SourceSurf
, sx
, sy
) == 0)
767 for (count
=DesY
;count
<saveY
;count
++)
768 DIB_16BPP_HLine(DestSurf
, DesX
, saveX
, count
, 0);
770 for (count
=DesY
;count
<saveY
;count
++)
771 DIB_16BPP_HLine(DestSurf
, DesX
, saveX
, count
, 1);
780 if (DesSizeX
>SrcSizeX
)
782 /* Draw one pixel on X - Led to the Des Zoom In*/
783 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
786 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
788 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
790 if (sy
> SourceRect
->bottom
) break;
794 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
796 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
798 if (sx
> SourceRect
->right
) break;
800 if (DIB_1BPP_GetPixel(SourceSurf
, sx
, sy
) == 0)
801 for (count
=DesY
;count
<saveY
;count
++)
802 DIB_16BPP_PutPixel(DestSurf
, DesX
, count
, 0);
804 for (count
=DesY
;count
<saveY
;count
++)
805 DIB_16BPP_PutPixel(DestSurf
, DesX
, count
, 1);
813 /* Draw one pixel on X - Led to the Des Zoom Out*/
814 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
817 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
819 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
821 if (sy
> SourceRect
->bottom
) break;
825 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
827 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
829 if (sx
> SourceRect
->right
) break;
831 if (DIB_1BPP_GetPixel(SourceSurf
, sx
, sy
) == 0)
832 for (count
=DesY
;count
<saveY
;count
++)
833 DIB_16BPP_PutPixel(DestSurf
, DesX
, count
, 0);
835 for (count
=DesY
;count
<saveY
;count
++)
836 DIB_16BPP_PutPixel(DestSurf
, DesX
, count
, 1);
845 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
846 /* This is a reference implementation, it hasn't been optimized for speed */
849 /* Draw one Hline on X - Led to the Des Zoom In*/
850 if (DesSizeX
>SrcSizeX
)
852 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
855 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
857 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
859 if (sy
> SourceRect
->bottom
) break;
863 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
865 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
867 if (sx
> SourceRect
->right
) break;
869 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_4BPP_GetPixel(SourceSurf
, sx
, sy
));
871 saveX
= DesX
+ zoomX
;
872 for (count
=DesY
;count
<saveY
;count
++)
873 DIB_16BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
879 /* Draw one Hline on X - Led to the Des Zoom Out*/
881 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
884 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
886 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
888 if (sy
> SourceRect
->bottom
) break;
892 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
894 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
896 if (sx
> SourceRect
->right
) break;
898 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_4BPP_GetPixel(SourceSurf
, sx
, sy
));
900 saveX
= DesX
+ zoomX
;
901 for (count
=DesY
;count
<saveY
;count
++)
902 DIB_16BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
911 if (DesSizeX
>SrcSizeX
)
913 /* Draw one pixel on X - Led to the Des Zoom In*/
914 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
917 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
919 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
921 if (sy
> SourceRect
->bottom
) break;
925 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
927 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
929 if (sx
> SourceRect
->right
) break;
931 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_4BPP_GetPixel(SourceSurf
, sx
, sy
));
933 for (count
=DesY
;count
<saveY
;count
++)
934 DIB_16BPP_PutPixel(DestSurf
, DesX
, count
, color
);
940 /* Draw one pixel on X - Led to the Des Zoom Out*/
941 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
944 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
946 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
948 if (sy
> SourceRect
->bottom
) break;
952 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
954 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
956 if (sx
> SourceRect
->right
) break;
958 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_4BPP_GetPixel(SourceSurf
, sx
, sy
));
960 for (count
=DesY
;count
<saveY
;count
++)
961 DIB_16BPP_PutPixel(DestSurf
, DesX
, count
, color
);
969 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
970 /* This is a reference implementation, it hasn't been optimized for speed */
973 /* Draw one Hline on X - Led to the Des Zoom In*/
974 if (DesSizeX
>SrcSizeX
)
976 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
979 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
981 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
983 if (sy
> SourceRect
->bottom
) break;
987 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
989 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
991 if (sx
> SourceRect
->right
) break;
993 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_8BPP_GetPixel(SourceSurf
, sx
, sy
));
995 saveX
= DesX
+ zoomX
;
996 for (count
=DesY
;count
<saveY
;count
++)
997 DIB_16BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
1003 /* Draw one Hline on X - Led to the Des Zoom Out*/
1005 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1008 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1010 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1012 if (sy
> SourceRect
->bottom
) break;
1016 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1018 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
1020 if (sx
> SourceRect
->right
) break;
1022 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_8BPP_GetPixel(SourceSurf
, sx
, sy
));
1024 saveX
= DesX
+ zoomX
;
1025 for (count
=DesY
;count
<saveY
;count
++)
1026 DIB_16BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
1035 if (DesSizeX
>SrcSizeX
)
1037 /* Draw one pixel on X - Led to the Des Zoom In*/
1038 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1041 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1043 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1045 if (sy
> SourceRect
->bottom
) break;
1049 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1051 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
1053 if (sx
> SourceRect
->right
) break;
1055 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_8BPP_GetPixel(SourceSurf
, sx
, sy
));
1057 for (count
=DesY
;count
<saveY
;count
++)
1058 DIB_16BPP_PutPixel(DestSurf
, DesX
, count
, color
);
1064 /* Draw one pixel on X - Led to the Des Zoom Out*/
1065 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1068 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1070 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1072 if (sy
> SourceRect
->bottom
) break;
1076 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1078 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
1080 if (sx
> SourceRect
->right
) break;
1082 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_8BPP_GetPixel(SourceSurf
, sx
, sy
));
1084 for (count
=DesY
;count
<saveY
;count
++)
1085 DIB_16BPP_PutPixel(DestSurf
, DesX
, count
, color
);
1093 return ScaleRectAvg16(DestSurf
, SourceSurf
, DestRect
, SourceRect
, MaskOrigin
, BrushOrigin
,
1094 ClipRegion
, ColorTranslation
, Mode
);
1098 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
1099 /* This is a reference implementation, it hasn't been optimized for speed */
1102 /* Draw one Hline on X - Led to the Des Zoom In*/
1103 if (DesSizeX
>SrcSizeX
)
1105 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1108 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1110 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1112 if (sy
> SourceRect
->bottom
) break;
1116 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1118 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
1120 if (sx
> SourceRect
->right
) break;
1122 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_24BPP_GetPixel(SourceSurf
, sx
, sy
));
1124 saveX
= DesX
+ zoomX
;
1125 for (count
=DesY
;count
<saveY
;count
++)
1126 DIB_16BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
1132 /* Draw one Hline on X - Led to the Des Zoom Out*/
1134 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1137 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1139 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1141 if (sy
> SourceRect
->bottom
) break;
1145 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1147 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
1149 if (sx
> SourceRect
->right
) break;
1151 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_24BPP_GetPixel(SourceSurf
, sx
, sy
));
1153 saveX
= DesX
+ zoomX
;
1154 for (count
=DesY
;count
<saveY
;count
++)
1155 DIB_16BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
1164 if (DesSizeX
>SrcSizeX
)
1166 /* Draw one pixel on X - Led to the Des Zoom In*/
1167 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1170 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1172 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1174 if (sy
> SourceRect
->bottom
) break;
1178 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1180 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
1182 if (sx
> SourceRect
->right
) break;
1184 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_24BPP_GetPixel(SourceSurf
, sx
, sy
));
1186 for (count
=DesY
;count
<saveY
;count
++)
1187 DIB_16BPP_PutPixel(DestSurf
, DesX
, count
, color
);
1193 /* Draw one pixel on X - Led to the Des Zoom Out*/
1194 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1197 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1199 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1201 if (sy
> SourceRect
->bottom
) break;
1205 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1207 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
1209 if (sx
> SourceRect
->right
) break;
1211 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_24BPP_GetPixel(SourceSurf
, sx
, sy
));
1213 for (count
=DesY
;count
<saveY
;count
++)
1214 DIB_16BPP_PutPixel(DestSurf
, DesX
, count
, color
);
1222 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
1223 /* This is a reference implementation, it hasn't been optimized for speed */
1226 /* Draw one Hline on X - Led to the Des Zoom In*/
1227 if (DesSizeX
>SrcSizeX
)
1229 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1232 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1234 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1236 if (sy
> SourceRect
->bottom
) break;
1240 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1242 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
1244 if (sx
> SourceRect
->right
) break;
1246 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_32BPP_GetPixel(SourceSurf
, sx
, sy
));
1248 saveX
= DesX
+ zoomX
;
1249 for (count
=DesY
;count
<saveY
;count
++)
1250 DIB_16BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
1256 /* Draw one Hline on X - Led to the Des Zoom Out*/
1258 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1261 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1263 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1265 if (sy
> SourceRect
->bottom
) break;
1269 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1271 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
1273 if (sx
> SourceRect
->right
) break;
1275 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_32BPP_GetPixel(SourceSurf
, sx
, sy
));
1277 saveX
= DesX
+ zoomX
;
1278 for (count
=DesY
;count
<saveY
;count
++)
1279 DIB_16BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
1288 if (DesSizeX
>SrcSizeX
)
1290 /* Draw one pixel on X - Led to the Des Zoom In*/
1291 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1294 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1296 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1298 if (sy
> SourceRect
->bottom
) break;
1302 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1304 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
1306 if (sx
> SourceRect
->right
) break;
1308 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_32BPP_GetPixel(SourceSurf
, sx
, sy
));
1310 for (count
=DesY
;count
<saveY
;count
++)
1311 DIB_16BPP_PutPixel(DestSurf
, DesX
, count
, color
);
1317 /* Draw one pixel on X - Led to the Des Zoom Out*/
1318 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1321 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1323 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1325 if (sy
> SourceRect
->bottom
) break;
1329 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1331 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
1333 if (sx
> SourceRect
->right
) break;
1335 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_32BPP_GetPixel(SourceSurf
, sx
, sy
));
1337 for (count
=DesY
;count
<saveY
;count
++)
1338 DIB_16BPP_PutPixel(DestSurf
, DesX
, count
, color
);
1348 DPRINT1("DIB_16BPP_StretchBlt: Unhandled Source BPP: %u\n", BitsPerFormat(SourceSurf
->iBitmapFormat
));
1358 DIB_16BPP_TransparentBlt(SURFOBJ
*DestSurf
, SURFOBJ
*SourceSurf
,
1359 RECTL
* DestRect
, POINTL
*SourcePoint
,
1360 XLATEOBJ
*ColorTranslation
, ULONG iTransColor
)
1362 ULONG RoundedRight
, X
, Y
, SourceX
, SourceY
, Source
, wd
, Dest
;
1365 RoundedRight
= DestRect
->right
- ((DestRect
->right
- DestRect
->left
) & 0x1);
1366 SourceY
= SourcePoint
->y
;
1367 DestBits
= (ULONG
*)(DestSurf
->pvScan0
+
1368 (DestRect
->left
<< 1) +
1369 DestRect
->top
* DestSurf
->lDelta
);
1370 wd
= DestSurf
->lDelta
- ((DestRect
->right
- DestRect
->left
) << 1);
1372 for(Y
= DestRect
->top
; Y
< DestRect
->bottom
; Y
++)
1374 SourceX
= SourcePoint
->x
;
1375 for(X
= DestRect
->left
; X
< RoundedRight
; X
+= 2, DestBits
++, SourceX
+= 2)
1379 Source
= DIB_GetSourceIndex(SourceSurf
, SourceX
, SourceY
);
1380 if(Source
!= iTransColor
)
1383 Dest
|= (XLATEOBJ_iXlate(ColorTranslation
, Source
) & 0xFFFF);
1386 Source
= DIB_GetSourceIndex(SourceSurf
, SourceX
+ 1, SourceY
);
1387 if(Source
!= iTransColor
)
1390 Dest
|= (XLATEOBJ_iXlate(ColorTranslation
, Source
) << 16);
1396 if(X
< DestRect
->right
)
1398 Source
= DIB_GetSourceIndex(SourceSurf
, SourceX
, SourceY
);
1399 if(Source
!= iTransColor
)
1401 *((USHORT
*)DestBits
) = (USHORT
)XLATEOBJ_iXlate(ColorTranslation
, Source
);
1404 DestBits
= (PULONG
)((ULONG_PTR
)DestBits
+ 2);
1407 DestBits
= (ULONG
*)((ULONG_PTR
)DestBits
+ wd
);