little clean-up
[reactos.git] / reactos / subsys / win32k / dib / dib8bpp.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: dib8bpp.c,v 1.21 2004/04/07 15:37:50 weiden Exp $ */
20 #undef WIN32_LEAN_AND_MEAN
21 #include <windows.h>
22 #include <stdlib.h>
23 #include <win32k/bitmaps.h>
24 #include <win32k/brush.h>
25 #include <win32k/debug.h>
26 #include <debug.h>
27 #include <include/object.h>
28 #include <ddk/winddi.h>
29 #include "../eng/objects.h"
30 #include "dib.h"
31
32 VOID
33 DIB_8BPP_PutPixel(PSURFOBJ SurfObj, LONG x, LONG y, ULONG c)
34 {
35 PBYTE byteaddr = SurfObj->pvScan0 + y * SurfObj->lDelta + x;
36
37 *byteaddr = c;
38 }
39
40 ULONG
41 DIB_8BPP_GetPixel(PSURFOBJ SurfObj, LONG x, LONG y)
42 {
43 PBYTE byteaddr = SurfObj->pvScan0 + y * SurfObj->lDelta + x;
44
45 return (ULONG)(*byteaddr);
46 }
47
48 VOID
49 DIB_8BPP_HLine(PSURFOBJ SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
50 {
51 PBYTE byteaddr = SurfObj->pvScan0 + y * SurfObj->lDelta;
52 PBYTE addr = byteaddr + x1;
53 LONG cx = x1;
54
55 while(cx < x2) {
56 *addr = c;
57 ++addr;
58 ++cx;
59 }
60 }
61
62 VOID
63 DIB_8BPP_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
64 {
65 PBYTE byteaddr = SurfObj->pvScan0 + y1 * SurfObj->lDelta;
66 PBYTE addr = byteaddr + x;
67 LONG lDelta = SurfObj->lDelta;
68
69 byteaddr = addr;
70 while(y1++ < y2) {
71 *addr = c;
72
73 addr += lDelta;
74 }
75 }
76
77 BOOLEAN
78 DIB_8BPP_BitBltSrcCopy(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
79 SURFGDI *DestGDI, SURFGDI *SourceGDI,
80 PRECTL DestRect, POINTL *SourcePoint,
81 XLATEOBJ *ColorTranslation)
82 {
83 LONG i, j, sx, sy, xColor, f1;
84 PBYTE SourceBits, DestBits, SourceLine, DestLine;
85 PBYTE SourceBits_4BPP, SourceLine_4BPP;
86
87 DestBits = DestSurf->pvScan0 + (DestRect->top * DestSurf->lDelta) + DestRect->left;
88
89 switch(SourceGDI->BitsPerPixel)
90 {
91 case 1:
92 sx = SourcePoint->x;
93 sy = SourcePoint->y;
94
95 for (j=DestRect->top; j<DestRect->bottom; j++)
96 {
97 sx = SourcePoint->x;
98 for (i=DestRect->left; i<DestRect->right; i++)
99 {
100 if(DIB_1BPP_GetPixel(SourceSurf, sx, sy) == 0)
101 {
102 DIB_8BPP_PutPixel(DestSurf, i, j, XLATEOBJ_iXlate(ColorTranslation, 0));
103 } else {
104 DIB_8BPP_PutPixel(DestSurf, i, j, XLATEOBJ_iXlate(ColorTranslation, 1));
105 }
106 sx++;
107 }
108 sy++;
109 }
110 break;
111
112 case 4:
113 SourceBits_4BPP = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + (SourcePoint->x >> 1);
114
115 for (j=DestRect->top; j<DestRect->bottom; j++)
116 {
117 SourceLine_4BPP = SourceBits_4BPP;
118 sx = SourcePoint->x;
119 f1 = sx & 1;
120
121 for (i=DestRect->left; i<DestRect->right; i++)
122 {
123 xColor = XLATEOBJ_iXlate(ColorTranslation,
124 (*SourceLine_4BPP & altnotmask[f1]) >> (4 * (1 - f1)));
125 DIB_8BPP_PutPixel(DestSurf, i, j, xColor);
126 if(f1 == 1) { SourceLine_4BPP++; f1 = 0; } else { f1 = 1; }
127 sx++;
128 }
129
130 SourceBits_4BPP += SourceSurf->lDelta;
131 }
132 break;
133
134 case 8:
135 if (NULL == ColorTranslation || 0 != (ColorTranslation->flXlate & XO_TRIVIAL))
136 {
137 if (DestRect->top < SourcePoint->y)
138 {
139 SourceBits = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + SourcePoint->x;
140 for (j = DestRect->top; j < DestRect->bottom; j++)
141 {
142 RtlMoveMemory(DestBits, SourceBits, DestRect->right - DestRect->left);
143 SourceBits += SourceSurf->lDelta;
144 DestBits += DestSurf->lDelta;
145 }
146 }
147 else
148 {
149 SourceBits = SourceSurf->pvScan0 + ((SourcePoint->y + DestRect->bottom - DestRect->top - 1) * SourceSurf->lDelta) + SourcePoint->x;
150 DestBits = DestSurf->pvScan0 + ((DestRect->bottom - 1) * DestSurf->lDelta) + DestRect->left;
151 for (j = DestRect->bottom - 1; DestRect->top <= j; j--)
152 {
153 RtlMoveMemory(DestBits, SourceBits, DestRect->right - DestRect->left);
154 SourceBits -= SourceSurf->lDelta;
155 DestBits -= DestSurf->lDelta;
156 }
157 }
158 }
159 else
160 {
161 if (DestRect->top < SourcePoint->y)
162 {
163 SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + SourcePoint->x;
164 DestLine = DestBits;
165 for (j = DestRect->top; j < DestRect->bottom; j++)
166 {
167 SourceBits = SourceLine;
168 DestBits = DestLine;
169 for (i=DestRect->left; i<DestRect->right; i++)
170 {
171 *DestBits++ = XLATEOBJ_iXlate(ColorTranslation, *SourceBits++);
172 }
173 SourceLine += SourceSurf->lDelta;
174 DestLine += DestSurf->lDelta;
175 }
176 }
177 else
178 {
179 SourceLine = SourceSurf->pvScan0 + ((SourcePoint->y + DestRect->bottom - DestRect->top - 1) * SourceSurf->lDelta) + SourcePoint->x;
180 DestLine = DestSurf->pvScan0 + ((DestRect->bottom - 1) * DestSurf->lDelta) + DestRect->left;
181 for (j = DestRect->bottom - 1; DestRect->top <= j; j--)
182 {
183 SourceBits = SourceLine;
184 DestBits = DestLine;
185 for (i=DestRect->left; i<DestRect->right; i++)
186 {
187 *DestBits++ = XLATEOBJ_iXlate(ColorTranslation, *SourceBits++);
188 }
189 SourceLine -= SourceSurf->lDelta;
190 DestLine -= DestSurf->lDelta;
191 }
192 }
193 }
194 break;
195
196 case 16:
197 SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 2 * SourcePoint->x;
198 DestLine = DestBits;
199
200 for (j = DestRect->top; j < DestRect->bottom; j++)
201 {
202 SourceBits = SourceLine;
203 DestBits = DestLine;
204
205 for (i = DestRect->left; i < DestRect->right; i++)
206 {
207 xColor = *((PWORD) SourceBits);
208 *DestBits = XLATEOBJ_iXlate(ColorTranslation, xColor);
209 SourceBits += 2;
210 DestBits += 1;
211 }
212
213 SourceLine += SourceSurf->lDelta;
214 DestLine += DestSurf->lDelta;
215 }
216 break;
217
218 case 24:
219 SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 3 * SourcePoint->x;
220 DestLine = DestBits;
221
222 for (j = DestRect->top; j < DestRect->bottom; j++)
223 {
224 SourceBits = SourceLine;
225 DestBits = DestLine;
226
227 for (i = DestRect->left; i < DestRect->right; i++)
228 {
229 xColor = (*(SourceBits + 2) << 0x10) +
230 (*(SourceBits + 1) << 0x08) +
231 (*(SourceBits));
232 *DestBits = XLATEOBJ_iXlate(ColorTranslation, xColor);
233 SourceBits += 3;
234 DestBits += 1;
235 }
236
237 SourceLine += SourceSurf->lDelta;
238 DestLine += DestSurf->lDelta;
239 }
240 break;
241
242 case 32:
243 SourceLine = SourceSurf->pvScan0 + (SourcePoint->y * SourceSurf->lDelta) + 4 * SourcePoint->x;
244 DestLine = DestBits;
245
246 for (j = DestRect->top; j < DestRect->bottom; j++)
247 {
248 SourceBits = SourceLine;
249 DestBits = DestLine;
250
251 for (i = DestRect->left; i < DestRect->right; i++)
252 {
253 xColor = *((PDWORD) SourceBits);
254 *DestBits = XLATEOBJ_iXlate(ColorTranslation, xColor);
255 SourceBits += 4;
256 DestBits += 1;
257 }
258
259 SourceLine += SourceSurf->lDelta;
260 DestLine += DestSurf->lDelta;
261 }
262 break;
263
264 default:
265 DbgPrint("DIB_8BPP_Bitblt: Unhandled Source BPP: %u\n", SourceGDI->BitsPerPixel);
266 return FALSE;
267 }
268
269 return TRUE;
270 }
271
272 BOOLEAN
273 DIB_8BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
274 SURFGDI *DestGDI, SURFGDI *SourceGDI,
275 PRECTL DestRect, POINTL *SourcePoint,
276 PBRUSHOBJ Brush, PPOINTL BrushOrigin,
277 XLATEOBJ *ColorTranslation, ULONG Rop4)
278 {
279 LONG i, j, k, sx, sy;
280 ULONG Dest, Source, Pattern = 0, PatternY;
281 PULONG DestBits;
282 BOOL UsesSource;
283 BOOL UsesPattern;
284 LONG RoundedRight;
285 /* Pattern brushes */
286 PGDIBRUSHOBJ GdiBrush;
287 HBITMAP PatternSurface = NULL;
288 PSURFOBJ PatternObj;
289 ULONG PatternWidth, PatternHeight;
290
291 if (Rop4 == SRCCOPY)
292 {
293 return DIB_8BPP_BitBltSrcCopy(
294 DestSurf,
295 SourceSurf,
296 DestGDI,
297 SourceGDI,
298 DestRect,
299 SourcePoint,
300 ColorTranslation);
301 }
302
303 UsesSource = ((Rop4 & 0xCC0000) >> 2) != (Rop4 & 0x330000);
304 UsesPattern = (((Rop4 & 0xF00000) >> 4) != (Rop4 & 0x0F0000)) && Brush;
305
306 if (UsesPattern)
307 {
308 if (Brush->iSolidColor == 0xFFFFFFFF)
309 {
310 PBITMAPOBJ PatternBitmap;
311
312 GdiBrush = CONTAINING_RECORD(
313 Brush,
314 GDIBRUSHOBJ,
315 BrushObject);
316
317 PatternBitmap = BITMAPOBJ_LockBitmap(GdiBrush->hbmPattern);
318 PatternSurface = BitmapToSurf(PatternBitmap, NULL);
319 BITMAPOBJ_UnlockBitmap(GdiBrush->hbmPattern);
320
321 PatternObj = (PSURFOBJ)AccessUserObject((ULONG)PatternSurface);
322 PatternWidth = PatternObj->sizlBitmap.cx;
323 PatternHeight = PatternObj->sizlBitmap.cy;
324
325 UsesPattern = TRUE;
326 }
327 else
328 {
329 UsesPattern = FALSE;
330 Pattern = (Brush->iSolidColor & 0xFF) |
331 ((Brush->iSolidColor & 0xFF) << 8) |
332 ((Brush->iSolidColor & 0xFF) << 16) |
333 ((Brush->iSolidColor & 0xFF) << 24);
334 }
335 }
336
337 RoundedRight = DestRect->right - ((DestRect->right - DestRect->left) & 0x3);
338 sy = SourcePoint->y;
339
340 for (j = DestRect->top; j < DestRect->bottom; j++)
341 {
342 sx = SourcePoint->x;
343 DestBits = (PULONG)(DestSurf->pvScan0 + DestRect->left + j * DestSurf->lDelta);
344
345 if(UsesPattern)
346 PatternY = j % PatternHeight;
347
348 for (i = DestRect->left; i < RoundedRight; i += 4, DestBits++)
349 {
350 Dest = *DestBits;
351
352 if (UsesSource)
353 {
354 Source = 0;
355 for (k = 0; k < 4; k++)
356 Source |= (DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left) + k, sy, ColorTranslation) << (k * 8));
357 }
358
359 if (UsesPattern)
360 {
361 Pattern = DIB_1BPP_GetPixel(PatternObj, i % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
362 Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + 1) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 8;
363 Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + 2) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 16;
364 Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + 3) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 24;
365 }
366 *DestBits = DIB_DoRop(Rop4, Dest, Source, Pattern);
367 }
368
369 if (i < DestRect->right)
370 {
371 Dest = *DestBits;
372 for (; i < DestRect->right; i++)
373 {
374 if (UsesSource)
375 {
376 Source = DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left), sy, ColorTranslation);
377 }
378
379 if (UsesPattern)
380 {
381 Pattern = DIB_1BPP_GetPixel(PatternObj, i % PatternWidth,PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
382 }
383
384 DIB_8BPP_PutPixel(DestSurf, i, j, DIB_DoRop(Rop4, Dest, Source, Pattern) & 0xFFFF);
385 Dest >>= 8;
386 }
387 }
388
389 sy++;
390 }
391
392 if (PatternSurface != NULL)
393 EngDeleteSurface(PatternSurface);
394
395 return TRUE;
396 }
397
398 /*
399 =======================================
400 Stretching functions goes below
401 Some parts of code are based on an
402 article "Bresenhame image scaling"
403 Dr. Dobb Journal, May 2002
404 =======================================
405 */
406
407 typedef unsigned char PIXEL;
408
409 /* 16-bit HiColor (565 format) */
410 inline PIXEL average8(PIXEL a, PIXEL b)
411 {
412 return a; // FIXME: Depend on SetStretchMode
413 }
414
415 //NOTE: If you change something here, please do the same in other dibXXbpp.c files!
416 void ScaleLineAvg8(PIXEL *Target, PIXEL *Source, int SrcWidth, int TgtWidth)
417 {
418 int NumPixels = TgtWidth;
419 int IntPart = SrcWidth / TgtWidth;
420 int FractPart = SrcWidth % TgtWidth;
421 int Mid = TgtWidth >> 1;
422 int E = 0;
423 int skip;
424 PIXEL p;
425
426 skip = (TgtWidth < SrcWidth) ? 0 : (TgtWidth / (2*SrcWidth) + 1);
427 NumPixels -= skip;
428
429 while (NumPixels-- > 0) {
430 p = *Source;
431 if (E >= Mid)
432 p = average8(p, *(Source+1));
433 *Target++ = p;
434 Source += IntPart;
435 E += FractPart;
436 if (E >= TgtWidth) {
437 E -= TgtWidth;
438 Source++;
439 } /* if */
440 } /* while */
441 while (skip-- > 0)
442 *Target++ = *Source;
443 }
444
445 //NOTE: If you change something here, please do the same in other dibXXbpp.c files!
446 void ScaleRectAvg8(PIXEL *Target, PIXEL *Source, int SrcWidth, int SrcHeight,
447 int TgtWidth, int TgtHeight, int srcPitch, int dstPitch)
448 {
449 int NumPixels = TgtHeight;
450 int IntPart = ((SrcHeight / TgtHeight) * srcPitch); //(SrcHeight / TgtHeight) * SrcWidth;
451 int FractPart = SrcHeight % TgtHeight;
452 int Mid = TgtHeight >> 1;
453 int E = 0;
454 int skip;
455 PIXEL *ScanLine, *ScanLineAhead;
456 PIXEL *PrevSource = NULL;
457 PIXEL *PrevSourceAhead = NULL;
458
459 skip = (TgtHeight < SrcHeight) ? 0 : (TgtHeight / (2*SrcHeight) + 1);
460 NumPixels -= skip;
461
462 ScanLine = (PIXEL*)ExAllocatePool(NonPagedPool, TgtWidth*sizeof(PIXEL)); // FIXME: Should we use PagedPool here?
463 ScanLineAhead = (PIXEL *)ExAllocatePool(NonPagedPool, TgtWidth*sizeof(PIXEL));
464
465 while (NumPixels-- > 0) {
466 if (Source != PrevSource) {
467 if (Source == PrevSourceAhead) {
468 /* the next scan line has already been scaled and stored in
469 * ScanLineAhead; swap the buffers that ScanLine and ScanLineAhead
470 * point to
471 */
472 PIXEL *tmp = ScanLine;
473 ScanLine = ScanLineAhead;
474 ScanLineAhead = tmp;
475 } else {
476 ScaleLineAvg8(ScanLine, Source, SrcWidth, TgtWidth);
477 } /* if */
478 PrevSource = Source;
479 } /* if */
480
481 if (E >= Mid && PrevSourceAhead != (PIXEL *)((BYTE *)Source + srcPitch)) {
482 int x;
483 ScaleLineAvg8(ScanLineAhead, (PIXEL *)((BYTE *)Source + srcPitch), SrcWidth, TgtWidth);
484 for (x = 0; x < TgtWidth; x++)
485 ScanLine[x] = average8(ScanLine[x], ScanLineAhead[x]);
486 PrevSourceAhead = (PIXEL *)((BYTE *)Source + srcPitch);
487 } /* if */
488
489 memcpy(Target, ScanLine, TgtWidth*sizeof(PIXEL));
490 Target = (PIXEL *)((BYTE *)Target + dstPitch);
491 Source += IntPart;
492 E += FractPart;
493 if (E >= TgtHeight) {
494 E -= TgtHeight;
495 Source = (PIXEL *)((BYTE *)Source + srcPitch);
496 } /* if */
497 } /* while */
498
499 if (skip > 0 && Source != PrevSource)
500 ScaleLineAvg8(ScanLine, Source, SrcWidth, TgtWidth);
501 while (skip-- > 0) {
502 memcpy(Target, ScanLine, TgtWidth*sizeof(PIXEL));
503 Target = (PIXEL *)((BYTE *)Target + dstPitch);
504 } /* while */
505
506 ExFreePool(ScanLine);
507 ExFreePool(ScanLineAhead);
508 }
509
510 BOOLEAN DIB_8BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
511 SURFGDI *DestGDI, SURFGDI *SourceGDI,
512 RECTL* DestRect, RECTL *SourceRect,
513 POINTL* MaskOrigin, POINTL* BrushOrigin,
514 XLATEOBJ *ColorTranslation, ULONG Mode)
515 {
516 BYTE *SourceLine, *DestLine;
517
518 DbgPrint("DIB_8BPP_StretchBlt: Source BPP: %u, srcRect: (%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n",
519 SourceGDI->BitsPerPixel, SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom,
520 DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
521
522 switch(SourceGDI->BitsPerPixel)
523 {
524 case 1:
525 return FALSE;
526 break;
527
528 case 4:
529 return FALSE;
530 break;
531
532 case 8:
533 SourceLine = SourceSurf->pvScan0 + (SourceRect->top * SourceSurf->lDelta) + SourceRect->left;
534 DestLine = DestSurf->pvScan0 + (DestRect->top * DestSurf->lDelta) + DestRect->left;
535
536 ScaleRectAvg8((PIXEL *)DestLine, (PIXEL *)SourceLine,
537 SourceRect->right-SourceRect->left, SourceRect->bottom-SourceRect->top,
538 DestRect->right-DestRect->left, DestRect->bottom-DestRect->top, SourceSurf->lDelta, DestSurf->lDelta);
539 break;
540
541 case 16:
542 return FALSE;
543 break;
544
545 case 24:
546 return FALSE;
547 break;
548
549 case 32:
550 return FALSE;
551 break;
552
553 default:
554 DbgPrint("DIB_8BPP_StretchBlt: Unhandled Source BPP: %u\n", SourceGDI->BitsPerPixel);
555 return FALSE;
556 }
557
558 return TRUE;
559 }
560
561 BOOLEAN
562 DIB_8BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
563 PSURFGDI DestGDI, PSURFGDI SourceGDI,
564 RECTL* DestRect, POINTL *SourcePoint,
565 XLATEOBJ *ColorTranslation, ULONG iTransColor)
566 {
567 ULONG RoundedRight, X, Y, SourceX, SourceY, Source, wd, Dest;
568 ULONG *DestBits;
569
570 RoundedRight = DestRect->right - ((DestRect->right - DestRect->left) & 0x3);
571 SourceY = SourcePoint->y;
572 DestBits = (ULONG*)(DestSurf->pvScan0 + DestRect->left +
573 (DestRect->top * DestSurf->lDelta));
574 wd = DestSurf->lDelta - (DestRect->right - DestRect->left);
575
576 for(Y = DestRect->top; Y < DestRect->bottom; Y++)
577 {
578 DestBits = (ULONG*)(DestSurf->pvScan0 + DestRect->left +
579 (Y * DestSurf->lDelta));
580 SourceX = SourcePoint->x;
581 for (X = DestRect->left; X < RoundedRight; X += 4, DestBits++)
582 {
583 Dest = *DestBits;
584
585 Source = DIB_GetSourceIndex(SourceSurf, SourceGDI, SourceX++, SourceY);
586 if(Source != iTransColor)
587 {
588 Dest &= 0xFFFFFF00;
589 Dest |= (XLATEOBJ_iXlate(ColorTranslation, Source) & 0xFF);
590 }
591
592 Source = DIB_GetSourceIndex(SourceSurf, SourceGDI, SourceX++, SourceY);
593 if(Source != iTransColor)
594 {
595 Dest &= 0xFFFF00FF;
596 Dest |= ((XLATEOBJ_iXlate(ColorTranslation, Source) << 8) & 0xFF00);
597 }
598
599 Source = DIB_GetSourceIndex(SourceSurf, SourceGDI, SourceX++, SourceY);
600 if(Source != iTransColor)
601 {
602 Dest &= 0xFF00FFFF;
603 Dest |= ((XLATEOBJ_iXlate(ColorTranslation, Source) << 16) & 0xFF0000);
604 }
605
606 Source = DIB_GetSourceIndex(SourceSurf, SourceGDI, SourceX++, SourceY);
607 if(Source != iTransColor)
608 {
609 Dest &= 0x00FFFFFF;
610 Dest |= ((XLATEOBJ_iXlate(ColorTranslation, Source) << 24) & 0xFF000000);
611 }
612
613 *DestBits = Dest;
614 }
615
616 if(X < DestRect->right)
617 {
618 for (; X < DestRect->right; X++)
619 {
620 Source = DIB_GetSourceIndex(SourceSurf, SourceGDI, SourceX++, SourceY);
621 if(Source != iTransColor)
622 {
623 *((BYTE*)DestBits) = (BYTE)(XLATEOBJ_iXlate(ColorTranslation, Source) & 0xFF);
624 }
625 DestBits = (PULONG)((ULONG_PTR)DestBits + 1);
626 }
627 }
628 SourceY++;
629 }
630
631 return TRUE;
632 }
633
634 /* EOF */