fixed working strechblt for all dibxx now. do not say it does not take offset of...
[reactos.git] / reactos / subsys / win32k / dib / dib1bpp.c
1 /*
2 * ReactOS W32 Subsystem
3 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
4 *
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.
9 *
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.
14 *
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.
18 */
19 /* $Id$ */
20 #include <w32k.h>
21
22 #define NDEBUG
23 #include <debug.h>
24
25 VOID
26 DIB_1BPP_PutPixel(SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
27 {
28 PBYTE addr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta + (x >> 3);
29
30 if (0 == (c & 0x01))
31 *addr &= ~MASK1BPP(x);
32 else
33 *addr |= MASK1BPP(x);
34 }
35
36 ULONG
37 DIB_1BPP_GetPixel(SURFOBJ *SurfObj, LONG x, LONG y)
38 {
39 PBYTE addr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta + (x >> 3);
40
41 return (*addr & MASK1BPP(x) ? 1 : 0);
42 }
43
44 VOID
45 DIB_1BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
46 {
47 while(x1 < x2) {
48 DIB_1BPP_PutPixel(SurfObj, x1, y, c);
49 x1++;
50 }
51 }
52
53 VOID
54 DIB_1BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
55 {
56 while(y1 < y2) {
57 DIB_1BPP_PutPixel(SurfObj, x, y1, c);
58 y1++;
59 }
60 }
61
62 static
63 void
64 DIB_1BPP_BitBltSrcCopy_From1BPP (
65 SURFOBJ* DestSurf, SURFOBJ* SourceSurf,
66 PRECTL DestRect, POINTL *SourcePoint )
67 {
68 // the 'window' in this sense is the x-position that corresponds
69 // to the left-edge of the 8-pixel byte we are currently working with.
70 // dwx is current x-window, dwx2 is the 'last' window we need to process
71 int dwx, dwx2; // destination window x-position
72 int swx; // source window y-position
73
74 // left and right edges of source and dest rectangles
75 int dl = DestRect->left; // dest left
76 int dr = DestRect->right-1; // dest right (inclusive)
77 int sl = SourcePoint->x; // source left
78 int sr = sl + dr - dl; // source right (inclusive)
79
80 // which direction are we going?
81 int xinc;
82 int yinc;
83 int ySrcDelta, yDstDelta;
84
85 // following 4 variables are used for the y-sweep
86 int dy; // dest y
87 int dy1; // dest y start
88 int dy2; // dest y end
89 int sy1; // src y start
90
91 int shift;
92 BYTE srcmask, dstmask;
93
94 // 'd' and 's' are the dest & src buffer pointers that I use on my x-sweep
95 // 'pd' and 'ps' are the dest & src buffer pointers used on the inner y-sweep
96 PBYTE d, pd; // dest ptrs
97 PBYTE s, ps; // src ptrs
98
99 shift = (dl-sl)&7;
100
101 if ( DestRect->top <= SourcePoint->y )
102 {
103 // moving up ( scan top -> bottom )
104 dy1 = DestRect->top;
105 dy2 = DestRect->bottom - 1;
106 sy1 = SourcePoint->y;
107 yinc = 1;
108 ySrcDelta = SourceSurf->lDelta;
109 yDstDelta = DestSurf->lDelta;
110 }
111 else
112 {
113 // moving down ( scan bottom -> top )
114 dy1 = DestRect->bottom - 1;
115 dy2 = DestRect->top;
116 sy1 = SourcePoint->y + dy1 - dy2;
117 yinc = -1;
118 ySrcDelta = -SourceSurf->lDelta;
119 yDstDelta = -DestSurf->lDelta;
120 }
121 if ( DestRect->left <= SourcePoint->x )
122 {
123 // moving left ( scan left->right )
124 dwx = dl&~7;
125 swx = (sl-(dl&7))&~7;
126 dwx2 = dr&~7;
127 xinc = 1;
128 }
129 else
130 {
131 // moving right ( scan right->left )
132 dwx = dr&~7;
133 swx = (sr-(dr&7))&~7; //(sr-7)&~7; // we need the left edge of this block... thus the -7
134 dwx2 = dl&~7;
135 xinc = -1;
136 }
137 d = &(((PBYTE)DestSurf->pvScan0)[dy1*DestSurf->lDelta + (dwx>>3)]);
138 s = &(((PBYTE)SourceSurf->pvScan0)[sy1*SourceSurf->lDelta + (swx>>3)]);
139 for ( ;; )
140 {
141 dy = dy1;
142 pd = d;
143 ps = s;
144 srcmask = 0xff;
145 int dx = dwx; /* dest x for this pass */
146 if ( dwx < dl )
147 {
148 int diff = dl-dwx;
149 srcmask &= (1<<(8-diff))-1;
150 dx = dl;
151 }
152 if ( dwx+7 > dr )
153 {
154 int diff = dr-dwx+1;
155 srcmask &= ~((1<<(8-diff))-1);
156 }
157 dstmask = ~srcmask;
158
159 // we unfortunately *must* have 5 different versions of the inner
160 // loop to be certain we don't try to read from memory that is not
161 // needed and may in fact be invalid
162 if ( !shift )
163 {
164 for ( ;; )
165 {
166 *pd = (BYTE)((*pd & dstmask) | (*ps & srcmask));
167
168 // this *must* be here, because we could be going up *or* down...
169 if ( dy == dy2 )
170 break;
171 dy += yinc;
172 pd += yDstDelta;
173 ps += ySrcDelta;
174 }
175 }
176 else if ( !(0xFF00 & (srcmask<<shift) ) ) // check if ps[0] not needed...
177 {
178 for ( ;; )
179 {
180 *pd = (BYTE)((*pd & dstmask)
181 | ( ( ps[1] >> shift ) & srcmask ));
182
183 // this *must* be here, because we could be going up *or* down...
184 if ( dy == dy2 )
185 break;
186 dy += yinc;
187 pd += yDstDelta;
188 ps += ySrcDelta;
189 }
190 }
191 else if ( !(0xFF & (srcmask<<shift) ) ) // check if ps[1] not needed...
192 {
193 for ( ;; )
194 {
195 *pd = (*pd & dstmask)
196 | ( ( ps[0] << ( 8 - shift ) ) & srcmask );
197
198 // this *must* be here, because we could be going up *or* down...
199 if ( dy == dy2 )
200 break;
201 dy += yinc;
202 pd += yDstDelta;
203 ps += ySrcDelta;
204 }
205 }
206 else // both ps[0] and ps[1] are needed
207 {
208 for ( ;; )
209 {
210 *pd = (*pd & dstmask)
211 | ( ( ( (ps[1])|(ps[0]<<8) ) >> shift ) & srcmask );
212
213 // this *must* be here, because we could be going up *or* down...
214 if ( dy == dy2 )
215 break;
216 dy += yinc;
217 pd += yDstDelta;
218 ps += ySrcDelta;
219 }
220 }
221
222 // this *must* be here, because we could be going right *or* left...
223 if ( dwx == dwx2 )
224 break;
225 d += xinc;
226 s += xinc;
227 dwx += xinc<<3;
228 swx += xinc<<3;
229 }
230 }
231
232 BOOLEAN
233 DIB_1BPP_BitBltSrcCopy(PBLTINFO BltInfo)
234 {
235 LONG i, j, sx, sy = BltInfo->SourcePoint.y;
236
237 switch ( BltInfo->SourceSurface->iBitmapFormat )
238 {
239 case BMF_1BPP:
240 DIB_1BPP_BitBltSrcCopy_From1BPP ( BltInfo->DestSurface, BltInfo->SourceSurface, &BltInfo->DestRect, &BltInfo->SourcePoint );
241 break;
242
243 case BMF_4BPP:
244 for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
245 {
246 sx = BltInfo->SourcePoint.x;
247 for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
248 {
249 if(XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_4BPP_GetPixel(BltInfo->SourceSurface, sx, sy)) == 0)
250 {
251 DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, 0);
252 } else {
253 DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, 1);
254 }
255 sx++;
256 }
257 sy++;
258 }
259 break;
260
261 case BMF_8BPP:
262 for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
263 {
264 sx = BltInfo->SourcePoint.x;
265 for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
266 {
267 if(XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_8BPP_GetPixel(BltInfo->SourceSurface, sx, sy)) == 0)
268 {
269 DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, 0);
270 } else {
271 DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, 1);
272 }
273 sx++;
274 }
275 sy++;
276 }
277 break;
278
279 case BMF_16BPP:
280 for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
281 {
282 sx = BltInfo->SourcePoint.x;
283 for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
284 {
285 if(XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_16BPP_GetPixel(BltInfo->SourceSurface, sx, sy)) == 0)
286 {
287 DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, 0);
288 } else {
289 DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, 1);
290 }
291 sx++;
292 }
293 sy++;
294 }
295 break;
296
297 case BMF_24BPP:
298 for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
299 {
300 sx = BltInfo->SourcePoint.x;
301 for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
302 {
303 if(XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_24BPP_GetPixel(BltInfo->SourceSurface, sx, sy)) == 0)
304 {
305 DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, 0);
306 } else {
307 DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, 1);
308 }
309 sx++;
310 }
311 sy++;
312 }
313 break;
314
315 case BMF_32BPP:
316 for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
317 {
318 sx = BltInfo->SourcePoint.x;
319 for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
320 {
321 if(XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, DIB_32BPP_GetPixel(BltInfo->SourceSurface, sx, sy)) == 0)
322 {
323 DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, 0);
324 } else {
325 DIB_1BPP_PutPixel(BltInfo->DestSurface, i, j, 1);
326 }
327 sx++;
328 }
329 sy++;
330 }
331 break;
332
333 default:
334 DbgPrint("DIB_1BPP_BitBlt: Unhandled Source BPP: %u\n", BitsPerFormat(BltInfo->SourceSurface->iBitmapFormat));
335 return FALSE;
336 }
337
338 return TRUE;
339 }
340
341 BOOLEAN
342 DIB_1BPP_BitBlt(PBLTINFO BltInfo)
343 {
344 ULONG DestX, DestY;
345 ULONG SourceX, SourceY;
346 ULONG PatternY = 0;
347 ULONG Dest, Source = 0, Pattern = 0;
348 ULONG Index;
349 BOOLEAN UsesSource;
350 BOOLEAN UsesPattern;
351 PULONG DestBits;
352 ULONG RoundedRight;
353 /* BYTE NoBits;*/
354
355 UsesSource = ROP4_USES_SOURCE(BltInfo->Rop4);
356 UsesPattern = ROP4_USES_PATTERN(BltInfo->Rop4);
357
358 RoundedRight = BltInfo->DestRect.right -
359 ((BltInfo->DestRect.right - BltInfo->DestRect.left) & 31);
360 SourceY = BltInfo->SourcePoint.y;
361
362 if (UsesPattern)
363 {
364 if (BltInfo->PatternSurface)
365 {
366 PatternY = (BltInfo->DestRect.top + BltInfo->BrushOrigin.y) %
367 BltInfo->PatternSurface->sizlBitmap.cy;
368 }
369 else
370 {
371 /* FIXME: Shouldn't it be expanded? */
372 Pattern = BltInfo->Brush->iSolidColor;
373 }
374 }
375
376 for (DestY = BltInfo->DestRect.top; DestY < BltInfo->DestRect.bottom; DestY++)
377 {
378 DestX = BltInfo->DestRect.left;
379 SourceX = BltInfo->SourcePoint.x;
380 DestBits = (PULONG)(
381 (PBYTE)BltInfo->DestSurface->pvScan0 +
382 (BltInfo->DestRect.left >> 3) +
383 DestY * BltInfo->DestSurface->lDelta);
384
385 if (DestX & 31)
386 {
387 #if 0
388 /* FIXME: This case is completely untested!!! */
389
390 Dest = *((PBYTE)DestBits);
391 NoBits = 31 - (DestX & 31);
392
393 if (UsesSource)
394 {
395 Source = 0;
396 /* FIXME: This is incorrect! */
397 for (Index = 31 - NoBits; Index >= 0; Index++)
398 Source |= (DIB_GetSource(SourceSurf, SourceX + Index, SourceY, ColorTranslation) << (31 - Index));
399 }
400
401 if (BltInfo->PatternSurface)
402 {
403 Pattern = 0;
404 for (k = 31 - NoBits; k >= 0; k++)
405 Pattern |= (DIB_GetSource(PatternObj, (X + BrushOrigin.x + k) % PatternWidth, PatternY, BltInfo->XlatePatternToDest) << (31 - k));
406 }
407
408 Dest = DIB_DoRop(Rop4, Dest, Source, Pattern);
409 Dest &= ~((1 << (31 - NoBits)) - 1);
410 Dest |= *((PBYTE)DestBits) & ((1 << (31 - NoBits)) - 1);
411
412 *DestBits = Dest;
413
414 DestX += NoBits;
415 SourceX += NoBits;
416 #endif
417 }
418
419 for (; DestX < RoundedRight; DestX += 32, DestBits++, SourceX++)
420 {
421 Dest = *DestBits;
422
423 if (UsesSource)
424 {
425 Source = 0;
426 for (Index = 0; Index < 8; Index++)
427 {
428 Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index, SourceY, BltInfo->XlateSourceToDest) << (7 - Index);
429 Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index + 8, SourceY, BltInfo->XlateSourceToDest) << (8 + (7 - Index));
430 Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index + 16, SourceY, BltInfo->XlateSourceToDest) << (16 + (7 - Index));
431 Source |= DIB_GetSource(BltInfo->SourceSurface, SourceX + Index + 24, SourceY, BltInfo->XlateSourceToDest) << (24 + (7 - Index));
432 }
433 }
434
435 if (BltInfo->PatternSurface)
436 {
437 Pattern = 0;
438 for (Index = 0; Index < 8; Index++)
439 {
440 Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << (7 - Index);
441 Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index + 8) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << (8 + (7 - Index));
442 Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index + 16) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << (16 + (7 - Index));
443 Pattern |= DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x + Index + 24) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest) << (24 + (7 - Index));
444 }
445 }
446
447 *DestBits = DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern);
448 }
449
450 if (DestX < BltInfo->DestRect.right)
451 {
452 // Dest = *DestBits;
453 for (; DestX < BltInfo->DestRect.right; DestX++, SourceX++)
454 {
455 // Dest = *DestBits;
456 Dest = DIB_1BPP_GetPixel(BltInfo->DestSurface, DestX, DestY);
457
458 if (UsesSource)
459 {
460 Source = DIB_GetSource(BltInfo->SourceSurface, SourceX, SourceY, BltInfo->XlateSourceToDest);
461 }
462
463 if (BltInfo->PatternSurface)
464 {
465 Pattern = DIB_GetSource(BltInfo->PatternSurface, (DestX + BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx, PatternY, BltInfo->XlatePatternToDest);
466 }
467
468 DIB_1BPP_PutPixel(BltInfo->DestSurface, DestX, DestY, DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern) & 0xF);
469 // Dest >>= 1;
470 }
471 }
472
473 SourceY++;
474 if (BltInfo->PatternSurface)
475 {
476 PatternY++;
477 PatternY %= BltInfo->PatternSurface->sizlBitmap.cy;
478 }
479 }
480
481 return TRUE;
482 }
483
484 /* BitBlt Optimize */
485 BOOLEAN
486 DIB_1BPP_ColorFill(SURFOBJ* DestSurface, RECTL* DestRect, ULONG color)
487 {
488 ULONG DestY;
489
490 for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
491 {
492 DIB_1BPP_HLine(DestSurface, DestRect->left, DestRect->right, DestY, color);
493 }
494
495 return TRUE;
496 }
497
498 //NOTE: If you change something here, please do the same in other dibXXbpp.c files!
499 BOOLEAN DIB_1BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
500 RECTL* DestRect, RECTL *SourceRect,
501 POINTL* MaskOrigin, POINTL BrushOrigin,
502 CLIPOBJ *ClipRegion, XLATEOBJ *ColorTranslation,
503 ULONG Mode)
504 {
505 LONG SrcSizeY;
506 LONG SrcSizeX;
507 LONG DesSizeY;
508 LONG DesSizeX;
509 LONG sx;
510 LONG sy;
511 LONG DesX;
512 LONG DesY;
513 LONG color;
514
515 SrcSizeY = SourceRect->bottom - SourceRect->top;
516 SrcSizeX = SourceRect->right - SourceRect->left;
517
518 DesSizeY = DestRect->bottom - DestRect->top;
519 DesSizeX = DestRect->right - DestRect->left;
520
521 switch(SourceSurf->iBitmapFormat)
522 {
523 case BMF_1BPP:
524 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
525 /* This is a reference implementation, it hasn't been optimized for speed */
526
527 for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
528 {
529 sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) + SourceRect->top;
530
531 for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
532 {
533 sx = (((DesX - DestRect->left) * SrcSizeX) / DesSizeX) + SourceRect->left;
534
535 color = DIB_1BPP_GetPixel(SourceSurf, sx, sy);
536 DIB_1BPP_PutPixel(DestSurf, DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, 0));
537 }
538 }
539
540 break;
541
542 case BMF_4BPP:
543 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
544 /* This is a reference implementation, it hasn't been optimized for speed */
545
546 for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
547 {
548 sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) + SourceRect->top;
549
550 for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
551 {
552 sx = (((DesX - DestRect->left) * SrcSizeX) / DesSizeX) + SourceRect->left;
553 color = DIB_4BPP_GetPixel(SourceSurf, sx, sy);
554 DIB_1BPP_PutPixel(DestSurf, DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
555 }
556 }
557 break;
558
559 case BMF_8BPP:
560 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
561 /* This is a reference implementation, it hasn't been optimized for speed */
562
563 for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
564 {
565 sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) + SourceRect->top;
566
567 for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
568 {
569 sx = (((DesX - DestRect->left) * SrcSizeX) / DesSizeX) + SourceRect->left;
570 color = DIB_8BPP_GetPixel(SourceSurf, sx, sy);
571 DIB_1BPP_PutPixel(DestSurf, DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
572 }
573 }
574 break;
575
576 case BMF_16BPP:
577 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
578 /* This is a reference implementation, it hasn't been optimized for speed */
579
580 for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
581 {
582 sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) + SourceRect->top;
583
584 for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
585 {
586 sx = (((DesX - DestRect->left) * SrcSizeX) / DesSizeX) + SourceRect->left;
587 color = DIB_16BPP_GetPixel(SourceSurf, sx, sy);
588 DIB_1BPP_PutPixel(DestSurf, DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
589 }
590 }
591 break;
592
593 case BMF_24BPP:
594 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
595 /* This is a reference implementation, it hasn't been optimized for speed */
596
597 for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
598 {
599 sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) + SourceRect->top;
600
601 for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
602 {
603 sx = (((DesX - DestRect->left) * SrcSizeX) / DesSizeX) + SourceRect->left;
604 color = DIB_24BPP_GetPixel(SourceSurf, sx, sy);
605 DIB_1BPP_PutPixel(DestSurf, DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
606 }
607 }
608 break;
609
610 case BMF_32BPP:
611 /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
612 /* This is a reference implementation, it hasn't been optimized for speed */
613
614 for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
615 {
616 sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) + SourceRect->top;
617
618 for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
619 {
620 sx = (((DesX - DestRect->left) * SrcSizeX) / DesSizeX) + SourceRect->left;
621 color = DIB_32BPP_GetPixel(SourceSurf, sx, sy);
622 DIB_1BPP_PutPixel(DestSurf, DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
623 }
624 }
625 break;
626
627 default:
628 //DPRINT1("DIB_1BPP_StretchBlt: Unhandled Source BPP: %u\n", BitsPerFormat(SourceSurf->iBitmapFormat));
629 return FALSE;
630 }
631
632 return TRUE;
633 }
634
635 BOOLEAN
636 DIB_1BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
637 RECTL* DestRect, POINTL *SourcePoint,
638 XLATEOBJ *ColorTranslation, ULONG iTransColor)
639 {
640 return FALSE;
641 }
642
643 BOOLEAN
644 DIB_1BPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect,
645 RECTL* SourceRect, CLIPOBJ* ClipRegion,
646 XLATEOBJ* ColorTranslation, BLENDOBJ* BlendObj)
647 {
648 UNIMPLEMENTED;
649 return FALSE;
650 }
651
652 /* EOF */