56b6b250662f92f76ac7ec38adf03b79d4abf0fa
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_24BPP_PutPixel(SURFOBJ
*SurfObj
, LONG x
, LONG y
, ULONG c
)
25 PBYTE addr
= SurfObj
->pvScan0
+ (y
* SurfObj
->lDelta
) + (x
<< 1) + x
;
26 *(PUSHORT
)(addr
) = c
& 0xFFFF;
27 *(addr
+ 2) = (c
>> 16) & 0xFF;
31 DIB_24BPP_GetPixel(SURFOBJ
*SurfObj
, LONG x
, LONG y
)
33 PBYTE addr
= SurfObj
->pvScan0
+ y
* SurfObj
->lDelta
+ (x
<< 1) + x
;
34 return *(PUSHORT
)(addr
) + (*(addr
+ 2) << 16);
38 DIB_24BPP_HLine(SURFOBJ
*SurfObj
, LONG x1
, LONG x2
, LONG y
, ULONG c
)
40 PBYTE addr
= SurfObj
->pvScan0
+ y
* SurfObj
->lDelta
+ (x1
<< 1) + x1
;
45 *(PUSHORT
)(addr
) = c
& 0xFFFF;
54 DIB_24BPP_VLine(SURFOBJ
*SurfObj
, LONG x
, LONG y1
, LONG y2
, ULONG c
)
56 PBYTE addr
= SurfObj
->pvScan0
+ y1
* SurfObj
->lDelta
+ (x
<< 1) + x
;
57 LONG lDelta
= SurfObj
->lDelta
;
61 *(PUSHORT
)(addr
) = c
& 0xFFFF;
62 *(addr
+ 2) = c
>> 16;
69 DIB_24BPP_BitBltSrcCopy(PBLTINFO BltInfo
)
71 LONG i
, j
, sx
, sy
, xColor
, f1
;
72 PBYTE SourceBits
, DestBits
, SourceLine
, DestLine
;
73 PBYTE SourceBits_4BPP
, SourceLine_4BPP
;
74 PWORD SourceBits_16BPP
, SourceLine_16BPP
;
76 DestBits
= BltInfo
->DestSurface
->pvScan0
+ (BltInfo
->DestRect
.top
* BltInfo
->DestSurface
->lDelta
) + BltInfo
->DestRect
.left
* 3;
78 switch(BltInfo
->SourceSurface
->iBitmapFormat
)
81 sx
= BltInfo
->SourcePoint
.x
;
82 sy
= BltInfo
->SourcePoint
.y
;
84 for (j
=BltInfo
->DestRect
.top
; j
<BltInfo
->DestRect
.bottom
; j
++)
86 sx
= BltInfo
->SourcePoint
.x
;
87 for (i
=BltInfo
->DestRect
.left
; i
<BltInfo
->DestRect
.right
; i
++)
89 if(DIB_1BPP_GetPixel(BltInfo
->SourceSurface
, sx
, sy
) == 0)
91 DIB_24BPP_PutPixel(BltInfo
->DestSurface
, i
, j
, XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, 0));
93 DIB_24BPP_PutPixel(BltInfo
->DestSurface
, i
, j
, XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, 1));
102 SourceBits_4BPP
= BltInfo
->SourceSurface
->pvScan0
+ (BltInfo
->SourcePoint
.y
* BltInfo
->SourceSurface
->lDelta
) + (BltInfo
->SourcePoint
.x
>> 1);
104 for (j
=BltInfo
->DestRect
.top
; j
<BltInfo
->DestRect
.bottom
; j
++)
106 SourceLine_4BPP
= SourceBits_4BPP
;
108 sx
= BltInfo
->SourcePoint
.x
;
111 for (i
=BltInfo
->DestRect
.left
; i
<BltInfo
->DestRect
.right
; i
++)
113 xColor
= XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
,
114 (*SourceLine_4BPP
& altnotmask
[f1
]) >> (4 * (1 - f1
)));
115 *DestLine
++ = xColor
& 0xff;
116 *(PWORD
)DestLine
= xColor
>> 8;
118 if(f1
== 1) { SourceLine_4BPP
++; f1
= 0; } else { f1
= 1; }
122 SourceBits_4BPP
+= BltInfo
->SourceSurface
->lDelta
;
123 DestBits
+= BltInfo
->DestSurface
->lDelta
;
128 SourceLine
= BltInfo
->SourceSurface
->pvScan0
+ (BltInfo
->SourcePoint
.y
* BltInfo
->SourceSurface
->lDelta
) + BltInfo
->SourcePoint
.x
;
131 for (j
= BltInfo
->DestRect
.top
; j
< BltInfo
->DestRect
.bottom
; j
++)
133 SourceBits
= SourceLine
;
136 for (i
= BltInfo
->DestRect
.left
; i
< BltInfo
->DestRect
.right
; i
++)
138 xColor
= XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, *SourceBits
);
139 *DestBits
= xColor
& 0xff;
140 *(PWORD
)(DestBits
+ 1) = xColor
>> 8;
145 SourceLine
+= BltInfo
->SourceSurface
->lDelta
;
146 DestLine
+= BltInfo
->DestSurface
->lDelta
;
151 SourceBits_16BPP
= BltInfo
->SourceSurface
->pvScan0
+ (BltInfo
->SourcePoint
.y
* BltInfo
->SourceSurface
->lDelta
) + 2 * BltInfo
->SourcePoint
.x
;
153 for (j
=BltInfo
->DestRect
.top
; j
<BltInfo
->DestRect
.bottom
; j
++)
155 SourceLine_16BPP
= SourceBits_16BPP
;
158 for (i
=BltInfo
->DestRect
.left
; i
<BltInfo
->DestRect
.right
; i
++)
160 xColor
= XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, *SourceLine_16BPP
);
161 *DestLine
++ = xColor
& 0xff;
162 *(PWORD
)DestLine
= xColor
>> 8;
167 SourceBits_16BPP
= (PWORD
)((PBYTE
)SourceBits_16BPP
+ BltInfo
->SourceSurface
->lDelta
);
168 DestBits
+= BltInfo
->DestSurface
->lDelta
;
173 if (NULL
== BltInfo
->XlateSourceToDest
|| 0 != (BltInfo
->XlateSourceToDest
->flXlate
& XO_TRIVIAL
))
175 if (BltInfo
->DestRect
.top
< BltInfo
->SourcePoint
.y
)
177 SourceBits
= BltInfo
->SourceSurface
->pvScan0
+ (BltInfo
->SourcePoint
.y
* BltInfo
->SourceSurface
->lDelta
) + 3 * BltInfo
->SourcePoint
.x
;
178 for (j
= BltInfo
->DestRect
.top
; j
< BltInfo
->DestRect
.bottom
; j
++)
180 RtlMoveMemory(DestBits
, SourceBits
, 3 * (BltInfo
->DestRect
.right
- BltInfo
->DestRect
.left
));
181 SourceBits
+= BltInfo
->SourceSurface
->lDelta
;
182 DestBits
+= BltInfo
->DestSurface
->lDelta
;
187 SourceBits
= BltInfo
->SourceSurface
->pvScan0
+ ((BltInfo
->SourcePoint
.y
+ BltInfo
->DestRect
.bottom
- BltInfo
->DestRect
.top
- 1) * BltInfo
->SourceSurface
->lDelta
) + 3 * BltInfo
->SourcePoint
.x
;
188 DestBits
= BltInfo
->DestSurface
->pvScan0
+ ((BltInfo
->DestRect
.bottom
- 1) * BltInfo
->DestSurface
->lDelta
) + 3 * BltInfo
->DestRect
.left
;
189 for (j
= BltInfo
->DestRect
.bottom
- 1; BltInfo
->DestRect
.top
<= j
; j
--)
191 RtlMoveMemory(DestBits
, SourceBits
, 3 * (BltInfo
->DestRect
.right
- BltInfo
->DestRect
.left
));
192 SourceBits
-= BltInfo
->SourceSurface
->lDelta
;
193 DestBits
-= BltInfo
->DestSurface
->lDelta
;
200 DPRINT1("DIB_24BPP_Bitblt: Unhandled BltInfo->XlateSourceToDest for 16 -> 16 copy\n");
206 SourceLine
= BltInfo
->SourceSurface
->pvScan0
+ (BltInfo
->SourcePoint
.y
* BltInfo
->SourceSurface
->lDelta
) + 4 * BltInfo
->SourcePoint
.x
;
209 for (j
= BltInfo
->DestRect
.top
; j
< BltInfo
->DestRect
.bottom
; j
++)
211 SourceBits
= SourceLine
;
214 for (i
= BltInfo
->DestRect
.left
; i
< BltInfo
->DestRect
.right
; i
++)
216 xColor
= XLATEOBJ_iXlate(BltInfo
->XlateSourceToDest
, *((PDWORD
) SourceBits
));
217 *DestBits
= xColor
& 0xff;
218 *(PWORD
)(DestBits
+ 1) = xColor
>> 8;
223 SourceLine
+= BltInfo
->SourceSurface
->lDelta
;
224 DestLine
+= BltInfo
->DestSurface
->lDelta
;
229 DbgPrint("DIB_24BPP_Bitblt: Unhandled Source BPP: %u\n", BitsPerFormat(BltInfo
->SourceSurface
->iBitmapFormat
));
237 DIB_24BPP_BitBlt(PBLTINFO BltInfo
)
240 ULONG SourceX
, SourceY
;
242 ULONG Dest
, Source
= 0, Pattern
= 0;
247 UsesSource
= ROP4_USES_SOURCE(BltInfo
->Rop4
);
248 UsesPattern
= ROP4_USES_PATTERN(BltInfo
->Rop4
);
250 SourceY
= BltInfo
->SourcePoint
.y
;
252 BltInfo
->DestSurface
->pvScan0
+
253 (BltInfo
->DestRect
.left
<< 1) + BltInfo
->DestRect
.left
+
254 BltInfo
->DestRect
.top
* BltInfo
->DestSurface
->lDelta
);
258 if (BltInfo
->PatternSurface
)
260 PatternY
= (BltInfo
->DestRect
.top
+ BltInfo
->BrushOrigin
.y
) %
261 BltInfo
->PatternSurface
->sizlBitmap
.cy
;
265 Pattern
= BltInfo
->Brush
->iSolidColor
;
269 for (DestY
= BltInfo
->DestRect
.top
; DestY
< BltInfo
->DestRect
.bottom
; DestY
++)
271 SourceX
= BltInfo
->SourcePoint
.x
;
273 for (DestX
= BltInfo
->DestRect
.left
; DestX
< BltInfo
->DestRect
.right
; DestX
++, DestBits
+= 3, SourceX
++)
275 Dest
= *((PUSHORT
)DestBits
) + (*(DestBits
+ 2) << 16);
279 Source
= DIB_GetSource(BltInfo
->SourceSurface
, SourceX
, SourceY
, BltInfo
->XlateSourceToDest
);
282 if (BltInfo
->PatternSurface
)
284 Pattern
= DIB_GetSource(BltInfo
->PatternSurface
, (DestX
+ BltInfo
->BrushOrigin
.x
) % BltInfo
->PatternSurface
->sizlBitmap
.cx
, PatternY
, BltInfo
->XlatePatternToDest
);
287 Dest
= DIB_DoRop(BltInfo
->Rop4
, Dest
, Source
, Pattern
) & 0xFFFFFF;
288 *(PUSHORT
)(DestBits
) = Dest
& 0xFFFF;
289 *(DestBits
+ 2) = Dest
>> 16;
293 if (BltInfo
->PatternSurface
)
296 PatternY
%= BltInfo
->PatternSurface
->sizlBitmap
.cy
;
298 DestBits
-= (BltInfo
->DestRect
.right
- BltInfo
->DestRect
.left
) * 3;
299 DestBits
+= BltInfo
->DestSurface
->lDelta
;
305 //NOTE: If you change something here, please do the same in other dibXXbpp.c files!
306 BOOLEAN
DIB_24BPP_StretchBlt(SURFOBJ
*DestSurf
, SURFOBJ
*SourceSurf
,
307 RECTL
* DestRect
, RECTL
*SourceRect
,
308 POINTL
* MaskOrigin
, POINTL BrushOrigin
,
309 CLIPOBJ
*ClipRegion
, XLATEOBJ
*ColorTranslation
,
326 BOOLEAN DesIsBiggerY
=FALSE
;
328 SrcSizeY
= SourceRect
->bottom
;
329 SrcSizeX
= SourceRect
->right
;
331 DesSizeY
= DestRect
->bottom
;
332 DesSizeX
= DestRect
->right
;
334 zoomX
= DesSizeX
/ SrcSizeX
;
335 if (zoomX
==0) zoomX
=1;
337 zoomY
= DesSizeY
/ SrcSizeY
;
338 if (zoomY
==0) zoomY
=1;
340 if (DesSizeY
>SrcSizeY
)
343 switch(SourceSurf
->iBitmapFormat
)
346 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
347 /* This is a reference implementation, it hasn't been optimized for speed */
350 /* Draw one Hline on X - Led to the Des Zoom In*/
351 if (DesSizeX
>SrcSizeX
)
353 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
356 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
358 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
360 if (sy
> SourceRect
->bottom
) break;
364 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
366 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
368 if (sx
> SourceRect
->right
) break;
370 saveX
= DesX
+ zoomX
;
372 if (DIB_1BPP_GetPixel(SourceSurf
, sx
, sy
) == 0)
373 for (count
=DesY
;count
<saveY
;count
++)
374 DIB_24BPP_HLine(DestSurf
, DesX
, saveX
, count
, 0);
376 for (count
=DesY
;count
<saveY
;count
++)
377 DIB_24BPP_HLine(DestSurf
, DesX
, saveX
, count
, 1);
384 /* Draw one Hline on X - Led to the Des Zoom Out*/
386 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
389 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
391 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
393 if (sy
> SourceRect
->bottom
) break;
397 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
399 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
401 if (sx
> SourceRect
->right
) break;
403 saveX
= DesX
+ zoomX
;
405 if (DIB_1BPP_GetPixel(SourceSurf
, sx
, sy
) == 0)
406 for (count
=DesY
;count
<saveY
;count
++)
407 DIB_24BPP_HLine(DestSurf
, DesX
, saveX
, count
, 0);
409 for (count
=DesY
;count
<saveY
;count
++)
410 DIB_24BPP_HLine(DestSurf
, DesX
, saveX
, count
, 1);
419 if (DesSizeX
>SrcSizeX
)
421 /* Draw one pixel on X - Led to the Des Zoom In*/
422 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
425 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
427 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
429 if (sy
> SourceRect
->bottom
) break;
433 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
435 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
437 if (sx
> SourceRect
->right
) break;
439 if (DIB_1BPP_GetPixel(SourceSurf
, sx
, sy
) == 0)
440 for (count
=DesY
;count
<saveY
;count
++)
441 DIB_24BPP_PutPixel(DestSurf
, DesX
, count
, 0);
443 for (count
=DesY
;count
<saveY
;count
++)
444 DIB_24BPP_PutPixel(DestSurf
, DesX
, count
, 1);
452 /* Draw one pixel on X - Led to the Des Zoom Out*/
453 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
456 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
458 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
460 if (sy
> SourceRect
->bottom
) break;
464 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
466 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
468 if (sx
> SourceRect
->right
) break;
470 if (DIB_1BPP_GetPixel(SourceSurf
, sx
, sy
) == 0)
471 for (count
=DesY
;count
<saveY
;count
++)
472 DIB_24BPP_PutPixel(DestSurf
, DesX
, count
, 0);
474 for (count
=DesY
;count
<saveY
;count
++)
475 DIB_24BPP_PutPixel(DestSurf
, DesX
, count
, 1);
484 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
485 /* This is a reference implementation, it hasn't been optimized for speed */
488 /* Draw one Hline on X - Led to the Des Zoom In*/
489 if (DesSizeX
>SrcSizeX
)
491 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
494 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
496 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
498 if (sy
> SourceRect
->bottom
) break;
502 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
504 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
506 if (sx
> SourceRect
->right
) break;
508 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_4BPP_GetPixel(SourceSurf
, sx
, sy
));
510 saveX
= DesX
+ zoomX
;
511 for (count
=DesY
;count
<saveY
;count
++)
512 DIB_24BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
518 /* Draw one Hline on X - Led to the Des Zoom Out*/
520 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
523 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
525 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
527 if (sy
> SourceRect
->bottom
) break;
531 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
533 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
535 if (sx
> SourceRect
->right
) break;
537 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_4BPP_GetPixel(SourceSurf
, sx
, sy
));
539 saveX
= DesX
+ zoomX
;
540 for (count
=DesY
;count
<saveY
;count
++)
541 DIB_24BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
550 if (DesSizeX
>SrcSizeX
)
552 /* Draw one pixel on X - Led to the Des Zoom In*/
553 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
556 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
558 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
560 if (sy
> SourceRect
->bottom
) break;
564 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
566 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
568 if (sx
> SourceRect
->right
) break;
570 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_4BPP_GetPixel(SourceSurf
, sx
, sy
));
572 for (count
=DesY
;count
<saveY
;count
++)
573 DIB_24BPP_PutPixel(DestSurf
, DesX
, count
, color
);
579 /* Draw one pixel on X - Led to the Des Zoom Out*/
580 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
583 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
585 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
587 if (sy
> SourceRect
->bottom
) break;
591 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
593 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
595 if (sx
> SourceRect
->right
) break;
597 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_4BPP_GetPixel(SourceSurf
, sx
, sy
));
599 for (count
=DesY
;count
<saveY
;count
++)
600 DIB_24BPP_PutPixel(DestSurf
, DesX
, count
, color
);
608 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
609 /* This is a reference implementation, it hasn't been optimized for speed */
612 /* Draw one Hline on X - Led to the Des Zoom In*/
613 if (DesSizeX
>SrcSizeX
)
615 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
618 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
620 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
622 if (sy
> SourceRect
->bottom
) break;
626 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
628 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
630 if (sx
> SourceRect
->right
) break;
632 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_8BPP_GetPixel(SourceSurf
, sx
, sy
));
634 saveX
= DesX
+ zoomX
;
635 for (count
=DesY
;count
<saveY
;count
++)
636 DIB_24BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
642 /* Draw one Hline on X - Led to the Des Zoom Out*/
644 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
647 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
649 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
651 if (sy
> SourceRect
->bottom
) break;
655 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
657 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
659 if (sx
> SourceRect
->right
) break;
661 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_8BPP_GetPixel(SourceSurf
, sx
, sy
));
663 saveX
= DesX
+ zoomX
;
664 for (count
=DesY
;count
<saveY
;count
++)
665 DIB_24BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
674 if (DesSizeX
>SrcSizeX
)
676 /* Draw one pixel on X - Led to the Des Zoom In*/
677 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
680 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
682 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
684 if (sy
> SourceRect
->bottom
) break;
688 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
690 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
692 if (sx
> SourceRect
->right
) break;
694 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_8BPP_GetPixel(SourceSurf
, sx
, sy
));
696 for (count
=DesY
;count
<saveY
;count
++)
697 DIB_24BPP_PutPixel(DestSurf
, DesX
, count
, color
);
703 /* Draw one pixel on X - Led to the Des Zoom Out*/
704 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
707 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
709 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
711 if (sy
> SourceRect
->bottom
) break;
715 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
717 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
719 if (sx
> SourceRect
->right
) break;
721 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_8BPP_GetPixel(SourceSurf
, sx
, sy
));
723 for (count
=DesY
;count
<saveY
;count
++)
724 DIB_24BPP_PutPixel(DestSurf
, DesX
, count
, color
);
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_16BPP_GetPixel(SourceSurf
, sx
, sy
));
758 saveX
= DesX
+ zoomX
;
759 for (count
=DesY
;count
<saveY
;count
++)
760 DIB_24BPP_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_16BPP_GetPixel(SourceSurf
, sx
, sy
));
787 saveX
= DesX
+ zoomX
;
788 for (count
=DesY
;count
<saveY
;count
++)
789 DIB_24BPP_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_16BPP_GetPixel(SourceSurf
, sx
, sy
));
820 for (count
=DesY
;count
<saveY
;count
++)
821 DIB_24BPP_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_16BPP_GetPixel(SourceSurf
, sx
, sy
));
847 for (count
=DesY
;count
<saveY
;count
++)
848 DIB_24BPP_PutPixel(DestSurf
, DesX
, count
, color
);
856 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
857 /* This is a reference implementation, it hasn't been optimized for speed */
860 /* Draw one Hline on X - Led to the Des Zoom In*/
861 if (DesSizeX
>SrcSizeX
)
863 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
866 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
868 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
870 if (sy
> SourceRect
->bottom
) break;
874 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
876 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
878 if (sx
> SourceRect
->right
) break;
880 color
= DIB_24BPP_GetPixel(SourceSurf
, sx
, sy
);
882 saveX
= DesX
+ zoomX
;
883 for (count
=DesY
;count
<saveY
;count
++)
884 DIB_24BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
890 /* Draw one Hline on X - Led to the Des Zoom Out*/
892 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
895 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
897 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
899 if (sy
> SourceRect
->bottom
) break;
903 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
905 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
907 if (sx
> SourceRect
->right
) break;
909 color
= DIB_24BPP_GetPixel(SourceSurf
, sx
, sy
);
911 saveX
= DesX
+ zoomX
;
912 for (count
=DesY
;count
<saveY
;count
++)
913 DIB_24BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
922 if (DesSizeX
>SrcSizeX
)
924 /* Draw one pixel on X - Led to the Des Zoom In*/
925 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
928 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
930 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
932 if (sy
> SourceRect
->bottom
) break;
936 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
938 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
940 if (sx
> SourceRect
->right
) break;
942 color
= DIB_24BPP_GetPixel(SourceSurf
, sx
, sy
);
944 for (count
=DesY
;count
<saveY
;count
++)
945 DIB_24BPP_PutPixel(DestSurf
, DesX
, count
, color
);
951 /* Draw one pixel on X - Led to the Des Zoom Out*/
952 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
955 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
957 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
959 if (sy
> SourceRect
->bottom
) break;
963 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
965 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
967 if (sx
> SourceRect
->right
) break;
969 color
= DIB_24BPP_GetPixel(SourceSurf
, sx
, sy
);
971 for (count
=DesY
;count
<saveY
;count
++)
972 DIB_24BPP_PutPixel(DestSurf
, DesX
, count
, color
);
980 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
981 /* This is a reference implementation, it hasn't been optimized for speed */
984 /* Draw one Hline on X - Led to the Des Zoom In*/
985 if (DesSizeX
>SrcSizeX
)
987 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
990 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
992 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
994 if (sy
> SourceRect
->bottom
) break;
998 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1000 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
1002 if (sx
> SourceRect
->right
) break;
1004 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_32BPP_GetPixel(SourceSurf
, sx
, sy
));
1006 saveX
= DesX
+ zoomX
;
1007 for (count
=DesY
;count
<saveY
;count
++)
1008 DIB_24BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
1014 /* Draw one Hline on X - Led to the Des Zoom Out*/
1016 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1019 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1021 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1023 if (sy
> SourceRect
->bottom
) break;
1027 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1029 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
1031 if (sx
> SourceRect
->right
) break;
1033 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_32BPP_GetPixel(SourceSurf
, sx
, sy
));
1035 saveX
= DesX
+ zoomX
;
1036 for (count
=DesY
;count
<saveY
;count
++)
1037 DIB_24BPP_HLine(DestSurf
, DesX
, saveX
, count
, color
);
1046 if (DesSizeX
>SrcSizeX
)
1048 /* Draw one pixel on X - Led to the Des Zoom In*/
1049 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1052 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1054 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1056 if (sy
> SourceRect
->bottom
) break;
1060 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1062 sx
= (int) ((ULONG
) SrcSizeX
* (ULONG
) DesX
) / ((ULONG
) DesSizeX
);
1064 if (sx
> SourceRect
->right
) break;
1066 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_32BPP_GetPixel(SourceSurf
, sx
, sy
));
1068 for (count
=DesY
;count
<saveY
;count
++)
1069 DIB_24BPP_PutPixel(DestSurf
, DesX
, count
, color
);
1075 /* Draw one pixel on X - Led to the Des Zoom Out*/
1076 for (DesY
=DestRect
->bottom
-zoomY
; DesY
>=0; DesY
-=zoomY
)
1079 sy
= (int) ((ULONG
) SrcSizeY
* (ULONG
) DesY
) / ((ULONG
) DesSizeY
);
1081 sy
= (int) ((ULONG
) DesSizeY
* (ULONG
) DesY
) / ((ULONG
) SrcSizeY
);
1083 if (sy
> SourceRect
->bottom
) break;
1087 for (DesX
=DestRect
->right
-zoomX
; DesX
>=0; DesX
-=zoomX
)
1089 sx
= (int) ((ULONG
) DesSizeX
* (ULONG
) DesX
) / ((ULONG
) SrcSizeX
);
1091 if (sx
> SourceRect
->right
) break;
1093 color
= XLATEOBJ_iXlate(ColorTranslation
, DIB_32BPP_GetPixel(SourceSurf
, sx
, sy
));
1095 for (count
=DesY
;count
<saveY
;count
++)
1096 DIB_24BPP_PutPixel(DestSurf
, DesX
, count
, color
);
1104 //DPRINT1("DIB_24BPP_StretchBlt: Unhandled Source BPP: %u\n", BitsPerFormat(SourceSurf->iBitmapFormat));
1112 DIB_24BPP_TransparentBlt(SURFOBJ
*DestSurf
, SURFOBJ
*SourceSurf
,
1113 RECTL
* DestRect
, POINTL
*SourcePoint
,
1114 XLATEOBJ
*ColorTranslation
, ULONG iTransColor
)
1116 ULONG X
, Y
, SourceX
, SourceY
, Source
, wd
, Dest
;
1119 SourceY
= SourcePoint
->y
;
1120 DestBits
= (BYTE
*)(DestSurf
->pvScan0
+
1121 (DestRect
->left
<< 2) +
1122 DestRect
->top
* DestSurf
->lDelta
);
1123 wd
= DestSurf
->lDelta
- ((DestRect
->right
- DestRect
->left
) << 2);
1125 for(Y
= DestRect
->top
; Y
< DestRect
->bottom
; Y
++)
1127 SourceX
= SourcePoint
->x
;
1128 for(X
= DestRect
->left
; X
< DestRect
->right
; X
++, DestBits
+= 3, SourceX
++)
1130 Source
= DIB_GetSourceIndex(SourceSurf
, SourceX
, SourceY
);
1131 if(Source
!= iTransColor
)
1133 Dest
= XLATEOBJ_iXlate(ColorTranslation
, Source
) & 0xFFFFFF;
1134 *(PUSHORT
)(DestBits
) = Dest
& 0xFFFF;
1135 *(DestBits
+ 2) = Dest
>> 16;
1140 DestBits
= (BYTE
*)((ULONG_PTR
)DestBits
+ wd
);