ReactOS 0.4.16-dev-1946-g52006dd
dib8bpp.c
Go to the documentation of this file.
1/*
2 * PROJECT: Win32 subsystem
3 * LICENSE: See COPYING in the top level directory
4 * FILE: win32ss/gdi/dib/dib8bpp.c
5 * PURPOSE: Device Independant Bitmap functions, 8bpp
6 * PROGRAMMERS: Jason Filby
7 * Thomas Bluemel
8 * Gregor Anich
9 * Doug Lyons
10 */
11
12#include <win32k.h>
13
14#define NDEBUG
15#include <debug.h>
16
17#define DEC_OR_INC(var, decTrue, amount) \
18 ((var) = (decTrue) ? ((var) - (amount)) : ((var) + (amount)))
19
20VOID
22{
23 PBYTE byteaddr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta + x;
24
25 *byteaddr = (BYTE)c;
26}
27
30{
31 PBYTE byteaddr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta + x;
32
33 return (ULONG)(*byteaddr);
34}
35
36VOID
38{
39 if (x1 >= x2)
40 return;
41
42 memset((PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta + x1, (BYTE) c, x2 - x1);
43}
44
45VOID
47{
48 PBYTE byteaddr = (PBYTE)SurfObj->pvScan0 + y1 * SurfObj->lDelta;
49 PBYTE addr = byteaddr + x;
50 LONG lDelta = SurfObj->lDelta;
51
52 byteaddr = addr;
53 while(y1++ < y2)
54 {
55 *addr = (BYTE)c;
56
57 addr += lDelta;
58 }
59}
60
63{
64 LONG i, j, sx, sy, xColor, f1;
65 PBYTE SourceBits, DestBits, SourceLine, DestLine;
66 PBYTE SourceBits_4BPP, SourceLine_4BPP;
67 BOOLEAN bTopToBottom, bLeftToRight;
68
69 DPRINT("DIB_8BPP_BitBltSrcCopy: SrcSurf cx/cy (%d/%d), DestSuft cx/cy (%d/%d) dstRect: (%d,%d)-(%d,%d)\n",
71 BltInfo->DestSurface->sizlBitmap.cx, BltInfo->DestSurface->sizlBitmap.cy,
72 BltInfo->DestRect.left, BltInfo->DestRect.top, BltInfo->DestRect.right, BltInfo->DestRect.bottom);
73
74 /* Get back left to right flip here */
75 bLeftToRight = (BltInfo->DestRect.left > BltInfo->DestRect.right);
76
77 /* Check for top to bottom flip needed. */
78 bTopToBottom = BltInfo->DestRect.top > BltInfo->DestRect.bottom;
79
80 DPRINT("bTopToBottom is '%d' and bLeftToRight is '%d'.\n", bTopToBottom, bLeftToRight);
81
82 /* Make WellOrdered by making top < bottom and left < right */
84
85 DPRINT("BPP is '%d' & BltInfo->SourcePoint.x is '%d' & BltInfo->SourcePoint.y is '%d'.\n",
86 BltInfo->SourceSurface->iBitmapFormat, BltInfo->SourcePoint.x, BltInfo->SourcePoint.y);
87
88 DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 + (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta) + BltInfo->DestRect.left;
89
90 switch(BltInfo->SourceSurface->iBitmapFormat)
91 {
92 case BMF_1BPP:
93 DPRINT("1BPP Case Selected with DestRect Width of '%d'.\n",
94 BltInfo->DestRect.right - BltInfo->DestRect.left);
95
96 sx = BltInfo->SourcePoint.x;
97
98 /* This sets sy to the top line */
99 sy = BltInfo->SourcePoint.y;
100
101 if (bTopToBottom)
102 {
103 /* This sets sy to the bottom line */
104 sy += BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1;
105 }
106
107 for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
108 {
109 sx = BltInfo->SourcePoint.x;
110
111 if (bLeftToRight)
112 {
113 /* This sets the sx to the rightmost pixel */
114 sx += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
115 }
116
117 for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
118 {
119 if(DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
120 {
122 }
123 else
124 {
126 }
127 DEC_OR_INC(sx, bLeftToRight, 1);
128 }
129 DEC_OR_INC(sy, bTopToBottom, 1);
130 }
131 break;
132
133 case BMF_4BPP:
134 DPRINT("4BPP Case Selected with DestRect Width of '%d'.\n",
135 BltInfo->DestRect.right - BltInfo->DestRect.left);
136
137 /* This sets SourceBits_4BPP to the top line */
138 SourceBits_4BPP = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + (BltInfo->SourcePoint.x >> 1);
139
140 if (bTopToBottom)
141 {
142 /* This sets SourceBits_4BPP to the bottom line */
143 SourceBits_4BPP += (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta;
144 }
145
146 for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
147 {
148 SourceLine_4BPP = SourceBits_4BPP;
149 sx = BltInfo->SourcePoint.x;
150
151 if (bLeftToRight)
152 {
153 /* This sets sx to the rightmost pixel */
154 sx += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
155 }
156
157 f1 = sx & 1;
158
159 for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
160 {
161 xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest,
162 (*SourceLine_4BPP & altnotmask[f1]) >> (4 * (1 - f1)));
163 DIB_8BPP_PutPixel(BltInfo->DestSurface, i, j, xColor);
164 if(f1 == 1)
165 {
166 DEC_OR_INC(SourceLine_4BPP, bLeftToRight, 1);
167 f1 = 0;
168 }
169 else
170 {
171 f1 = 1;
172 }
173
174 DEC_OR_INC(sx, bLeftToRight, 1);
175 }
176 DEC_OR_INC(SourceBits_4BPP, bTopToBottom, BltInfo->SourceSurface->lDelta);
177 }
178 break;
179
180 case BMF_8BPP:
181 DPRINT("8BPP-dstRect: (%d,%d)-(%d,%d) and Width of '%d'.\n",
182 BltInfo->DestRect.left, BltInfo->DestRect.top,
183 BltInfo->DestRect.right, BltInfo->DestRect.bottom,
184 BltInfo->DestRect.right - BltInfo->DestRect.left);
185
186 if ((BltInfo->XlateSourceToDest == NULL ||
187 (BltInfo->XlateSourceToDest->flXlate & XO_TRIVIAL) != 0) &&
188 (!bTopToBottom && !bLeftToRight))
189 {
190 if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
191 {
192 DPRINT("BltInfo->DestRect.top < BltInfo->SourcePoint.y.\n");
193 SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
194 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
195 {
196 RtlMoveMemory(DestBits, SourceBits, BltInfo->DestRect.right - BltInfo->DestRect.left);
197 SourceBits += BltInfo->SourceSurface->lDelta;
198 DestBits += BltInfo->DestSurface->lDelta;
199 }
200 }
201 else
202 {
203 DPRINT("BltInfo->DestRect.top >= BltInfo->SourcePoint.y.\n");
204 SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 + ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
205 DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + BltInfo->DestRect.left;
206 for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
207 {
208 RtlMoveMemory(DestBits, SourceBits, BltInfo->DestRect.right - BltInfo->DestRect.left);
209 SourceBits -= BltInfo->SourceSurface->lDelta;
210 DestBits -= BltInfo->DestSurface->lDelta;
211 }
212 }
213 }
214 else
215 {
216 DPRINT("XO_TRIVIAL is NOT TRUE or we have flips.\n");
217
218 if (!bTopToBottom && !bLeftToRight)
219 /* **Note: Indent is purposefully less than desired to keep reviewable differences to a minimum for PR** */
220 {
221 if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
222 {
223 DPRINT("Dest.top < SourcePoint.y.\n");
224 SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
225 DestLine = DestBits;
226 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
227 {
228 SourceBits = SourceLine;
229 DestBits = DestLine;
230 for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
231 {
232 *DestBits++ = (BYTE)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *SourceBits++);
233 }
234 SourceLine += BltInfo->SourceSurface->lDelta;
235 DestLine += BltInfo->DestSurface->lDelta;
236 }
237 }
238 else
239 {
240 DPRINT("Dest.top >= SourcePoint.y.\n");
241 SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 + ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta) + BltInfo->SourcePoint.x;
242 DestLine = (PBYTE)BltInfo->DestSurface->pvScan0 + ((BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta) + BltInfo->DestRect.left;
243 for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
244 {
245 SourceBits = SourceLine;
246 DestBits = DestLine;
247 for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
248 {
249 *DestBits++ = (BYTE)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *SourceBits++);
250 }
251 SourceLine -= BltInfo->SourceSurface->lDelta;
252 DestLine -= BltInfo->DestSurface->lDelta;
253 }
254 }
255 }
256 else
257 {
258 /* Buffering for source and destination flip overlaps. Fixes KHMZ MirrorTest CORE-16642 */
259 BOOL OneDone = FALSE;
260
261 if (bLeftToRight)
262 {
263 DPRINT("Flip is bLeftToRight.\n");
264
265 /* Allocate enough pixels for a row in BYTE's */
267 BltInfo->DestRect.right - BltInfo->DestRect.left + 1, TAG_DIB);
268 if (store == NULL)
269 {
270 DPRINT1("Storage Allocation Failed.\n");
271 return FALSE;
272 }
273 WORD Index;
274
275 /* This sets SourceLine to the top line */
276 SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 +
277 (BltInfo->SourcePoint.y *
278 BltInfo->SourceSurface->lDelta) +
279 BltInfo->SourcePoint.x;
280
281 /* This set the DestLine to the top line */
282 DestLine = (PBYTE)BltInfo->DestSurface->pvScan0 +
283 (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta) +
284 BltInfo->DestRect.left;
285
286 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
287 {
288 SourceBits = SourceLine;
289 DestBits = DestLine;
290
291 /* This sets SourceBits to the rightmost pixel */
292 SourceBits += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
293
294 Index = 0;
295
296 for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
297 {
298 store[Index] = (BYTE)XLATEOBJ_iXlate(
299 BltInfo->XlateSourceToDest,
300 *SourceBits);
301 SourceBits--;
302 Index++;
303 }
304
305 Index = 0;
306
307 for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
308 {
309 *DestBits = store[Index];
310 DestBits++;
311 Index++;
312 }
313
314 SourceLine += BltInfo->SourceSurface->lDelta;
315 DestLine += BltInfo->DestSurface->lDelta;
316 }
318 OneDone = TRUE;
319 }
320
321 if (bTopToBottom)
322 {
323 DPRINT("Flip is bTopToBottom.\n");
324
325 DWORD Index;
326
327 /* Allocate enough pixels for a column in BYTE's */
329 BltInfo->DestRect.bottom - BltInfo->DestRect.top + 1, TAG_DIB);
330 if (store == NULL)
331 {
332 DPRINT1("Storage Allocation Failed.\n");
333 return FALSE;
334 }
335
336 /* The OneDone flag indicates that we are flipping for bTopToBottom and bLeftToRight
337 * and have already completed the bLeftToRight. So we will lose our first flip output
338 * unless we work with its output which is at the destination site. So in this case
339 * our new Source becomes the previous outputs Destination. */
340
341 if (OneDone)
342 {
343 /* This sets SourceLine to the bottom line of our previous destination */
344 SourceLine = (PBYTE)BltInfo->DestSurface->pvScan0 +
345 (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta) + BltInfo->DestRect.left +
346 (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->DestSurface->lDelta;
347 }
348 else
349 {
350 /* This sets SourceLine to the bottom line */
351 SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 +
352 ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1)
353 * BltInfo->SourceSurface->lDelta) +
354 BltInfo->SourcePoint.x;
355 }
356
357 /* This set the DestLine to the top line */
358 DestLine = (PBYTE)BltInfo->DestSurface->pvScan0 +
359 (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta) +
360 BltInfo->DestRect.left;
361
362 /* Read columns */
363 for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
364 {
365
366 DestBits = DestLine;
367 SourceBits = SourceLine;
368
369 Index = 0;
370
371 /* Read up the column and store the pixels */
372 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
373 {
374 store[Index] = (BYTE)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *SourceBits);
375 /* Go up a line */
376 SourceBits -= BltInfo->SourceSurface->lDelta;
377 Index++;
378 }
379
380 Index = 0;
381
382 /* Get the stored pixel and copy then down the column */
383 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
384 {
385 *DestBits = store[Index];
386 /* Go down a line */
387 DestBits += BltInfo->SourceSurface->lDelta;
388 Index++;
389 }
390 /* Index to next column */
391 SourceLine += 1;
392 DestLine += 1;
393 }
395 }
396
397 }
398 }
399 break;
400
401 case BMF_16BPP:
402 DPRINT("16BPP Case Selected with DestRect Width of '%d'.\n",
403 BltInfo->DestRect.right - BltInfo->DestRect.left);
404
405 DPRINT("BMF_16BPP-dstRect: (%d,%d)-(%d,%d) and Width of '%d'.\n",
406 BltInfo->DestRect.left, BltInfo->DestRect.top,
407 BltInfo->DestRect.right, BltInfo->DestRect.bottom,
408 BltInfo->DestRect.right - BltInfo->DestRect.left);
409
410 SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 2 * BltInfo->SourcePoint.x;
411
412 if (bTopToBottom)
413 {
414 /* This sets SourceLine to the bottom line */
415 SourceLine += (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta;;
416 }
417 DestLine = DestBits;
418
419 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
420 {
421 SourceBits = SourceLine;
422
423 if (bLeftToRight)
424 {
425 /* This sets SourceBits to the rightmost pixel */
426 SourceBits += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1) * 2;
427 }
428 DestBits = DestLine;
429
430 for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
431 {
432 xColor = *((PWORD) SourceBits);
433 *DestBits = (BYTE)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
434
435 DEC_OR_INC(SourceBits, bLeftToRight, 2);
436 DestBits += 1;
437 }
438 DEC_OR_INC(SourceLine, bTopToBottom, BltInfo->SourceSurface->lDelta);
439 DestLine += BltInfo->DestSurface->lDelta;
440 }
441 break;
442
443 case BMF_24BPP:
444 DPRINT("24BPP-dstRect: (%d,%d)-(%d,%d) and Width of '%d'.\n",
445 BltInfo->DestRect.left, BltInfo->DestRect.top,
446 BltInfo->DestRect.right, BltInfo->DestRect.bottom,
447 BltInfo->DestRect.right - BltInfo->DestRect.left);
448
449 SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 3 * BltInfo->SourcePoint.x;
450 DestLine = DestBits;
451
452 if (bTopToBottom)
453 {
454 /* This sets SourceLine to the bottom line */
455 SourceLine += BltInfo->SourceSurface->lDelta * (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1);
456 }
457
458 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
459 {
460 SourceBits = SourceLine;
461 DestBits = DestLine;
462
463 if (bLeftToRight)
464 {
465 /* This sets the SourceBits to the rightmost pixel */
466 SourceBits += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1) * 3;
467 }
468
469 for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
470 {
471 xColor = (*(SourceBits + 2) << 0x10) +
472 (*(SourceBits + 1) << 0x08) +
473 (*(SourceBits));
474 *DestBits = (BYTE)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
475 DEC_OR_INC(SourceBits, bLeftToRight, 3);
476 DestBits += 1;
477 }
478 DEC_OR_INC(SourceLine, bTopToBottom, BltInfo->SourceSurface->lDelta);
479 DestLine += BltInfo->DestSurface->lDelta;
480 }
481 break;
482
483 case BMF_32BPP:
484 DPRINT("32BPP Case Selected with DestRect Width of '%d'.\n",
485 BltInfo->DestRect.right - BltInfo->DestRect.left);
486
487 SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) + 4 * BltInfo->SourcePoint.x;
488
489 if (bTopToBottom)
490 {
491 /* This sets SourceLine to the bottom line */
492 SourceLine += BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1;
493 }
494 DestLine = DestBits;
495
496 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
497 {
498 SourceBits = SourceLine;
499 DestBits = DestLine;
500
501 if (bLeftToRight)
502 {
503 /* This sets SourceBits to the rightmost pixel */
504 SourceBits += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1) * 4;
505 }
506
507 for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
508 {
509 xColor = *((PDWORD) SourceBits);
510 *DestBits = (BYTE)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, xColor);
511
512 DEC_OR_INC(SourceBits, bLeftToRight, 4);
513 DestBits += 1;
514 }
515 DEC_OR_INC(SourceLine, bTopToBottom, BltInfo->SourceSurface->lDelta);
516 DestLine += BltInfo->DestSurface->lDelta;
517 }
518 break;
519
520 default:
521 DPRINT1("DIB_8BPP_Bitblt: Unhandled Source BPP: %u\n", BitsPerFormat(BltInfo->SourceSurface->iBitmapFormat));
522 return FALSE;
523 }
524
525 return TRUE;
526}
527
528/* BitBlt Optimize */
530DIB_8BPP_ColorFill(SURFOBJ* DestSurface, RECTL* DestRect, ULONG color)
531{
532 LONG DestY;
533
534 /* Make WellOrdered by making top < bottom and left < right */
535 RECTL_vMakeWellOrdered(DestRect);
536
537 for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
538 {
539 DIB_8BPP_HLine(DestSurface, DestRect->left, DestRect->right, DestY, color);
540 }
541 return TRUE;
542}
543
544
547 RECTL* DestRect, RECTL *SourceRect,
548 XLATEOBJ *ColorTranslation, ULONG iTransColor)
549{
550 LONG RoundedRight, X, Y, SourceX = 0, SourceY = 0;
551 ULONG *DestBits, Source, Dest;
552
553 LONG DstHeight;
554 LONG DstWidth;
555 LONG SrcHeight;
556 LONG SrcWidth;
557
558 DstHeight = DestRect->bottom - DestRect->top;
559 DstWidth = DestRect->right - DestRect->left;
560 SrcHeight = SourceRect->bottom - SourceRect->top;
561 SrcWidth = SourceRect->right - SourceRect->left;
562
563 RoundedRight = DestRect->right - ((DestRect->right - DestRect->left) & 0x3);
564 DestBits = (ULONG*)((PBYTE)DestSurf->pvScan0 + DestRect->left +
565 (DestRect->top * DestSurf->lDelta));
566
567 for(Y = DestRect->top; Y < DestRect->bottom; Y++)
568 {
569 DestBits = (ULONG*)((PBYTE)DestSurf->pvScan0 + DestRect->left +
570 (Y * DestSurf->lDelta));
571 SourceY = SourceRect->top+(Y - DestRect->top) * SrcHeight / DstHeight;
572 for (X = DestRect->left; X < RoundedRight; X += 4, DestBits++)
573 {
574 Dest = *DestBits;
575
576 SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
577 if (SourceX >= 0 && SourceY >= 0 &&
578 SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
579 {
580 Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
581 if(Source != iTransColor)
582 {
583 Dest &= 0xFFFFFF00;
584 Dest |= (XLATEOBJ_iXlate(ColorTranslation, Source) & 0xFF);
585 }
586 }
587
588 SourceX = SourceRect->left+(X+1 - DestRect->left) * SrcWidth / DstWidth;
589 if (SourceX >= 0 && SourceY >= 0 &&
590 SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
591 {
592 Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
593 if(Source != iTransColor)
594 {
595 Dest &= 0xFFFF00FF;
596 Dest |= ((XLATEOBJ_iXlate(ColorTranslation, Source) << 8) & 0xFF00);
597 }
598 }
599
600 SourceX = SourceRect->left+(X+2 - DestRect->left) * SrcWidth / DstWidth;
601 if (SourceX >= 0 && SourceY >= 0 &&
602 SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
603 {
604 Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
605 if(Source != iTransColor)
606 {
607 Dest &= 0xFF00FFFF;
608 Dest |= ((XLATEOBJ_iXlate(ColorTranslation, Source) << 16) & 0xFF0000);
609 }
610 }
611
612 SourceX = SourceRect->left+(X+3 - DestRect->left) * SrcWidth / DstWidth;
613 if (SourceX >= 0 && SourceY >= 0 &&
614 SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
615 {
616 Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
617 if(Source != iTransColor)
618 {
619 Dest &= 0x00FFFFFF;
620 Dest |= ((XLATEOBJ_iXlate(ColorTranslation, Source) << 24) & 0xFF000000);
621 }
622 }
623
624 *DestBits = Dest;
625 }
626
627 if(X < DestRect->right)
628 {
629 for (; X < DestRect->right; X++)
630 {
631 SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
632 if (SourceX >= 0 && SourceY >= 0 &&
633 SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
634 {
635 Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
636 if(Source != iTransColor)
637 {
638 *((BYTE*)DestBits) = (BYTE)(XLATEOBJ_iXlate(ColorTranslation, Source) & 0xFF);
639 }
640 }
641 DestBits = (PULONG)((ULONG_PTR)DestBits + 1);
642 }
643 }
644 }
645
646 return TRUE;
647}
648
649/* EOF */
unsigned char BOOLEAN
#define DPRINT1
Definition: precomp.h:8
return
Definition: dirsup.c:529
ULONG DIB_8BPP_GetPixel(SURFOBJ *SurfObj, LONG x, LONG y)
Definition: dib8bpp.c:29
BOOLEAN DIB_8BPP_BitBltSrcCopy(PBLTINFO BltInfo)
Definition: dib8bpp.c:62
#define DEC_OR_INC(var, decTrue, amount)
Definition: dib8bpp.c:17
BOOLEAN DIB_8BPP_ColorFill(SURFOBJ *DestSurface, RECTL *DestRect, ULONG color)
Definition: dib8bpp.c:530
BOOLEAN DIB_8BPP_TransparentBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf, RECTL *DestRect, RECTL *SourceRect, XLATEOBJ *ColorTranslation, ULONG iTransColor)
Definition: dib8bpp.c:546
VOID DIB_8BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
Definition: dib8bpp.c:37
VOID DIB_8BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
Definition: dib8bpp.c:46
VOID DIB_8BPP_PutPixel(SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
Definition: dib8bpp.c:21
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define Y(I)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define NonPagedPool
Definition: env_spec_w32.h:307
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint color
Definition: glext.h:6243
const GLubyte * c
Definition: glext.h:8905
GLdouble GLdouble right
Definition: glext.h:10859
GLint GLint bottom
Definition: glext.h:7726
GLenum const GLvoid * addr
Definition: glext.h:9621
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define X(b, s)
#define c
Definition: ke_i.h:80
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
WORD * PWORD
Definition: pedump.c:67
BYTE * PBYTE
Definition: pedump.c:66
DWORD * PDWORD
Definition: pedump.c:68
long LONG
Definition: pedump.c:60
#define f1(x, y, z)
Definition: sha1.c:30
#define memset(x, y, z)
Definition: compat.h:39
#define DPRINT
Definition: sndvol32.h:73
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
Definition: dib.h:21
RECTL DestRect
Definition: dib.h:26
SURFOBJ * SourceSurface
Definition: dib.h:23
SURFOBJ * DestSurface
Definition: dib.h:22
POINTL SourcePoint
Definition: dib.h:27
XLATEOBJ * XlateSourceToDest
Definition: dib.h:25
LONG y
Definition: windef.h:124
LONG x
Definition: windef.h:123
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
SIZEL sizlBitmap
Definition: winddi.h:1209
ULONG iBitmapFormat
Definition: winddi.h:1215
PVOID pvScan0
Definition: winddi.h:1212
LONG lDelta
Definition: winddi.h:1213
FLONG flXlate
Definition: winddi.h:1256
uint32_t * PULONG
Definition: typedefs.h:59
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFCOLLECTION _In_ ULONG Index
unsigned char altnotmask[2]
Definition: dib.c:18
ULONG DIB_1BPP_GetPixel(SURFOBJ *, LONG, LONG)
Definition: dib1bpp.c:30
#define DIB_GetSourceIndex(SourceSurf, sx, sy)
Definition: dib.h:141
#define BitsPerFormat(Format)
Definition: surface.h:109
VOID FASTCALL RECTL_vMakeWellOrdered(_Inout_ RECTL *prcl)
Definition: rect.c:81
#define TAG_DIB
Definition: tags.h:17
#define BMF_16BPP
Definition: winddi.h:358
_In_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ RECTL _In_ RECTL _In_ ULONG iTransColor
Definition: winddi.h:4195
#define BMF_8BPP
Definition: winddi.h:357
#define BMF_1BPP
Definition: winddi.h:355
ENGAPI ULONG APIENTRY XLATEOBJ_iXlate(_In_ XLATEOBJ *pxlo, _In_ ULONG iColor)
Definition: xlateobj.c:664
#define BMF_24BPP
Definition: winddi.h:359
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708
#define BMF_32BPP
Definition: winddi.h:360
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3711
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3710
#define XO_TRIVIAL
Definition: winddi.h:1247
#define BMF_4BPP
Definition: winddi.h:356
unsigned char BYTE
Definition: xxhash.c:193