ReactOS 0.4.16-dev-1636-g0502e33
dib16bpp.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for dib16bpp.c:

Go to the source code of this file.

Classes

union  NICEPIXEL32
 
union  NICEPIXEL16_565
 
union  NICEPIXEL16_555
 

Macros

#define NDEBUG
 
#define DEC_OR_INC(var, decTrue, amount)    ((var) = (decTrue) ? ((var) - (amount)) : ((var) + (amount)))
 

Functions

VOID DIB_16BPP_PutPixel (SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
 
ULONG DIB_16BPP_GetPixel (SURFOBJ *SurfObj, LONG x, LONG y)
 
VOID DIB_16BPP_HLine (SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
 
VOID DIB_16BPP_VLine (SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
 
BOOLEAN DIB_16BPP_BitBltSrcCopy (PBLTINFO BltInfo)
 
BOOLEAN DIB_16BPP_ColorFill (SURFOBJ *DestSurface, RECTL *DestRect, ULONG color)
 
BOOLEAN DIB_16BPP_TransparentBlt (SURFOBJ *DestSurf, SURFOBJ *SourceSurf, RECTL *DestRect, RECTL *SourceRect, XLATEOBJ *ColorTranslation, ULONG iTransColor)
 
static __inline UCHAR Clamp6 (ULONG val)
 
static __inline UCHAR Clamp5 (ULONG val)
 
BOOLEAN DIB_16BPP_AlphaBlend (SURFOBJ *Dest, SURFOBJ *Source, RECTL *DestRect, RECTL *SourceRect, CLIPOBJ *ClipRegion, XLATEOBJ *ColorTranslation, BLENDOBJ *BlendObj)
 

Macro Definition Documentation

◆ DEC_OR_INC

#define DEC_OR_INC (   var,
  decTrue,
  amount 
)     ((var) = (decTrue) ? ((var) - (amount)) : ((var) + (amount)))

Definition at line 17 of file dib16bpp.c.

◆ NDEBUG

#define NDEBUG

Definition at line 14 of file dib16bpp.c.

Function Documentation

◆ Clamp5()

static __inline UCHAR Clamp5 ( ULONG  val)
static

Definition at line 851 of file dib16bpp.c.

852{
853 return (val > 31) ? 31 : (UCHAR)val;
854}
GLuint GLfloat * val
Definition: glext.h:7180
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by DIB_16BPP_AlphaBlend().

◆ Clamp6()

static __inline UCHAR Clamp6 ( ULONG  val)
static

Definition at line 845 of file dib16bpp.c.

846{
847 return (val > 63) ? 63 : (UCHAR)val;
848}

Referenced by DIB_16BPP_AlphaBlend().

◆ DIB_16BPP_AlphaBlend()

BOOLEAN DIB_16BPP_AlphaBlend ( SURFOBJ Dest,
SURFOBJ Source,
RECTL DestRect,
RECTL SourceRect,
CLIPOBJ ClipRegion,
XLATEOBJ ColorTranslation,
BLENDOBJ BlendObj 
)

Definition at line 857 of file dib16bpp.c.

860{
861 INT DstX, DstY, SrcX, SrcY;
863 NICEPIXEL32 SrcPixel32;
864 UCHAR Alpha;
865 EXLATEOBJ* pexlo;
866 EXLATEOBJ exloSrcRGB;
867
868 DPRINT("DIB_16BPP_AlphaBlend: srcRect: (%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n",
869 SourceRect->left, SourceRect->top, SourceRect->right, SourceRect->bottom,
870 DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
871
872 BlendFunc = BlendObj->BlendFunction;
874 {
875 DPRINT1("BlendOp != AC_SRC_OVER\n");
876 return FALSE;
877 }
878 if (BlendFunc.BlendFlags != 0)
879 {
880 DPRINT1("BlendFlags != 0\n");
881 return FALSE;
882 }
883 if ((BlendFunc.AlphaFormat & ~AC_SRC_ALPHA) != 0)
884 {
885 DPRINT1("Unsupported AlphaFormat (0x%x)\n", BlendFunc.AlphaFormat);
886 return FALSE;
887 }
888 if ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0 &&
889 (BitsPerFormat(Source->iBitmapFormat) != 32))
890 {
891 DPRINT1("Source bitmap must be 32bpp when AC_SRC_ALPHA is set\n");
892 return FALSE;
893 }
894
895 if (!ColorTranslation)
896 {
897 DPRINT1("ColorTranslation must not be NULL!\n");
898 return FALSE;
899 }
900
901 pexlo = CONTAINING_RECORD(ColorTranslation, EXLATEOBJ, xlo);
902 EXLATEOBJ_vInitialize(&exloSrcRGB, pexlo->ppalSrc, &gpalRGB, 0, 0, 0);
903
904 if (pexlo->ppalDst->flFlags & PAL_RGB16_555)
905 {
906 NICEPIXEL16_555 DstPixel16;
907
908 SrcY = SourceRect->top;
909 DstY = DestRect->top;
910 while ( DstY < DestRect->bottom )
911 {
912 SrcX = SourceRect->left;
913 DstX = DestRect->left;
914 while(DstX < DestRect->right)
915 {
916 SrcPixel32.ul = DIB_GetSource(Source, SrcX, SrcY, &exloSrcRGB.xlo);
917 SrcPixel32.col.red = (SrcPixel32.col.red * BlendFunc.SourceConstantAlpha) / 255;
918 SrcPixel32.col.green = (SrcPixel32.col.green * BlendFunc.SourceConstantAlpha) / 255;
919 SrcPixel32.col.blue = (SrcPixel32.col.blue * BlendFunc.SourceConstantAlpha) / 255;
920
921 Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
922 (SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha) / 255 :
924
925 Alpha >>= 3;
926
927 DstPixel16.us = DIB_16BPP_GetPixel(Dest, DstX, DstY) & 0xFFFF;
928 /* Perform bit loss */
929 SrcPixel32.col.red >>= 3;
930 SrcPixel32.col.green >>= 3;
931 SrcPixel32.col.blue >>= 3;
932
933 /* Do the blend in the right bit depth */
934 DstPixel16.col.red = Clamp5((DstPixel16.col.red * (31 - Alpha)) / 31 + SrcPixel32.col.red);
935 DstPixel16.col.green = Clamp5((DstPixel16.col.green * (31 - Alpha)) / 31 + SrcPixel32.col.green);
936 DstPixel16.col.blue = Clamp5((DstPixel16.col.blue * (31 - Alpha)) / 31 + SrcPixel32.col.blue);
937
938 DIB_16BPP_PutPixel(Dest, DstX, DstY, DstPixel16.us);
939
940 DstX++;
941 SrcX = SourceRect->left + ((DstX-DestRect->left)*(SourceRect->right - SourceRect->left))
942 /(DestRect->right-DestRect->left);
943 }
944 DstY++;
945 SrcY = SourceRect->top + ((DstY-DestRect->top)*(SourceRect->bottom - SourceRect->top))
946 /(DestRect->bottom-DestRect->top);
947 }
948 }
949 else
950 {
951 NICEPIXEL16_565 DstPixel16;
952 UCHAR Alpha6, Alpha5;
953
954 SrcY = SourceRect->top;
955 DstY = DestRect->top;
956 while ( DstY < DestRect->bottom )
957 {
958 SrcX = SourceRect->left;
959 DstX = DestRect->left;
960 while(DstX < DestRect->right)
961 {
962 SrcPixel32.ul = DIB_GetSource(Source, SrcX, SrcY, &exloSrcRGB.xlo);
963 SrcPixel32.col.red = (SrcPixel32.col.red * BlendFunc.SourceConstantAlpha) / 255;
964 SrcPixel32.col.green = (SrcPixel32.col.green * BlendFunc.SourceConstantAlpha) / 255;
965 SrcPixel32.col.blue = (SrcPixel32.col.blue * BlendFunc.SourceConstantAlpha) / 255;
966
967 Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
968 (SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha) / 255 :
970
971 Alpha6 = Alpha >> 2;
972 Alpha5 = Alpha >> 3;
973
974 DstPixel16.us = DIB_16BPP_GetPixel(Dest, DstX, DstY) & 0xFFFF;
975 /* Perform bit loss */
976 SrcPixel32.col.red >>= 3;
977 SrcPixel32.col.green >>= 2;
978 SrcPixel32.col.blue >>= 3;
979
980 /* Do the blend in the right bit depth */
981 DstPixel16.col.red = Clamp5((DstPixel16.col.red * (31 - Alpha5)) / 31 + SrcPixel32.col.red);
982 DstPixel16.col.green = Clamp6((DstPixel16.col.green * (63 - Alpha6)) / 63 + SrcPixel32.col.green);
983 DstPixel16.col.blue = Clamp5((DstPixel16.col.blue * (31 - Alpha5)) / 31 + SrcPixel32.col.blue);
984
985 DIB_16BPP_PutPixel(Dest, DstX, DstY, DstPixel16.us);
986
987 DstX++;
988 SrcX = SourceRect->left + ((DstX-DestRect->left)*(SourceRect->right - SourceRect->left))
989 /(DestRect->right-DestRect->left);
990 }
991 DstY++;
992 SrcY = SourceRect->top + ((DstY-DestRect->top)*(SourceRect->bottom - SourceRect->top))
993 /(DestRect->bottom-DestRect->top);
994 }
995 }
996
997 EXLATEOBJ_vCleanup(&exloSrcRGB);
998
999 return TRUE;
1000}
#define DPRINT1
Definition: precomp.h:8
VOID DIB_16BPP_PutPixel(SURFOBJ *SurfObj, LONG x, LONG y, ULONG c)
Definition: dib16bpp.c:21
ULONG DIB_16BPP_GetPixel(SURFOBJ *SurfObj, LONG x, LONG y)
Definition: dib16bpp.c:30
static __inline UCHAR Clamp5(ULONG val)
Definition: dib16bpp.c:851
static __inline UCHAR Clamp6(ULONG val)
Definition: dib16bpp.c:845
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static const BLENDFUNCTION BlendFunc
Definition: general.c:34
GLdouble GLdouble right
Definition: glext.h:10859
GLint GLint bottom
Definition: glext.h:7726
#define AC_SRC_ALPHA
Definition: alphablend.c:9
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
#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
BYTE BlendOp
Definition: wingdi.h:3205
BYTE BlendFlags
Definition: wingdi.h:3206
BYTE AlphaFormat
Definition: wingdi.h:3208
BYTE SourceConstantAlpha
Definition: wingdi.h:3207
BLENDFUNCTION BlendFunction
Definition: winddi.h:224
XLATEOBJ xlo
Definition: xlateobj.h:21
PPALETTE ppalDst
Definition: xlateobj.h:26
PPALETTE ppalSrc
Definition: xlateobj.h:25
FLONG flFlags
Definition: palette.h:40
int32_t INT
Definition: typedefs.h:58
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
struct NICEPIXEL16_555::@5364 col
struct NICEPIXEL16_565::@5363 col
struct NICEPIXEL32::@5361 col
ULONG ul
Definition: alphablend.c:16
#define DIB_GetSource(SourceSurf, sx, sy, ColorTranslation)
Definition: dib.h:136
#define BitsPerFormat(Format)
Definition: surface.h:109
PALETTE gpalRGB
Definition: palette.c:20
@ PAL_RGB16_555
Definition: palette.h:27
#define AC_SRC_OVER
Definition: wingdi.h:1369
VOID NTAPI EXLATEOBJ_vInitialize(_Out_ PEXLATEOBJ pexlo, _In_opt_ PALETTE *ppalSrc, _In_opt_ PALETTE *ppalDst, _In_ COLORREF crSrcBackColor, _In_ COLORREF crDstBackColor, _In_ COLORREF crDstForeColor)
Definition: xlateobj.c:358
VOID NTAPI EXLATEOBJ_vCleanup(_Inout_ PEXLATEOBJ pexlo)
Definition: xlateobj.c:649

◆ DIB_16BPP_BitBltSrcCopy()

BOOLEAN DIB_16BPP_BitBltSrcCopy ( PBLTINFO  BltInfo)

Definition at line 150 of file dib16bpp.c.

151{
152 LONG i, j, sx, sy, xColor, f1;
153 PBYTE SourceBits, DestBits, SourceLine, DestLine;
154 PBYTE SourceBits_4BPP, SourceLine_4BPP;
155 PWORD Source32, Dest32;
156 DWORD Index, StartLeft, EndRight;
157 BOOLEAN bTopToBottom, bLeftToRight;
158
159 DPRINT("DIB_16BPP_BitBltSrcCopy: SrcSurf cx/cy (%d/%d), DestSuft cx/cy (%d/%d) dstRect: (%d,%d)-(%d,%d)\n",
161 BltInfo->DestSurface->sizlBitmap.cx, BltInfo->DestSurface->sizlBitmap.cy,
162 BltInfo->DestRect.left, BltInfo->DestRect.top, BltInfo->DestRect.right, BltInfo->DestRect.bottom);
163
164 /* Get back left to right flip here */
165 bLeftToRight = BltInfo->DestRect.left > BltInfo->DestRect.right;
166
167 /* Check for top to bottom flip needed. */
168 bTopToBottom = BltInfo->DestRect.top > BltInfo->DestRect.bottom;
169
170 DPRINT("BltInfo->SourcePoint.x is '%d' & BltInfo->SourcePoint.y is '%d'.\n",
171 BltInfo->SourcePoint.x, BltInfo->SourcePoint.y);
172
173 /* Make WellOrdered with top < bottom and left < right */
175
176 DPRINT("BPP is '%d/%d' & BltInfo->SourcePoint.x is '%d' & BltInfo->SourcePoint.y is '%d'.\n",
177 BltInfo->SourceSurface->iBitmapFormat, BltInfo->SourcePoint.x, BltInfo->SourcePoint.y);
178
179 DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 + (BltInfo->DestRect.top * BltInfo->DestSurface->lDelta) + 2 * BltInfo->DestRect.left;
180
181 switch(BltInfo->SourceSurface->iBitmapFormat)
182 {
183 case BMF_1BPP:
184 DPRINT("1BPP Case Selected with DestRect Width of '%d'.\n",
185 BltInfo->DestRect.right - BltInfo->DestRect.left);
186 sx = BltInfo->SourcePoint.x;
187
188 /* This sets sy to the top line */
189 sy = BltInfo->SourcePoint.y;
190
191 if (bTopToBottom)
192 {
193 /* This sets sy to the bottom line */
194 sy += BltInfo->SourceSurface->lDelta * (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1);
195 }
196
197 for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
198 {
199 sx = BltInfo->SourcePoint.x;
200
201 if (bLeftToRight)
202 {
203 /* This sets the sx to the rightmost pixel */
204 sx += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
205 StartLeft = BltInfo->DestRect.left + 1;
206 EndRight = BltInfo->DestRect.right + 1;
207 }
208 else
209 {
210 StartLeft = BltInfo->DestRect.left;
211 EndRight = BltInfo->DestRect.right;
212 }
213
214 for (i = StartLeft; i < EndRight; i++)
215 {
216 if(DIB_1BPP_GetPixel(BltInfo->SourceSurface, sx, sy) == 0)
217 {
220 }
221 else
222 {
225 }
226 DEC_OR_INC(sx, bLeftToRight, 1);
227 }
228 DEC_OR_INC(sy, bTopToBottom, 1);
229 }
230 break;
231
232 case BMF_4BPP:
233 DPRINT("4BPP Case Selected with DestRect Width of '%d'.\n",
234 BltInfo->DestRect.right - BltInfo->DestRect.left);
235
236 /* This sets SourceBits_4BPP to the top line */
237 SourceBits_4BPP = (PBYTE)BltInfo->SourceSurface->pvScan0 +
238 (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) +
239 (BltInfo->SourcePoint.x >> 1);
240
241 if (bTopToBottom)
242 {
243 /* This sets SourceBits_4BPP to the bottom line */
244 SourceBits_4BPP += (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->SourceSurface->lDelta;
245 }
246
247 for (j=BltInfo->DestRect.top; j<BltInfo->DestRect.bottom; j++)
248 {
249 SourceLine_4BPP = SourceBits_4BPP;
250 sx = BltInfo->SourcePoint.x;
251 if (bLeftToRight)
252 {
253 /* This sets sx to the rightmost pixel */
254 sx += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
255 }
256
257 f1 = sx & 1;
258
259 for (i=BltInfo->DestRect.left; i<BltInfo->DestRect.right; i++)
260 {
261 xColor = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest,
262 (*SourceLine_4BPP & altnotmask[f1]) >> (4 * (1 - f1)));
263 DIB_16BPP_PutPixel(BltInfo->DestSurface, i, j, xColor);
264 if(f1 == 1)
265 {
266 DEC_OR_INC(SourceLine_4BPP, bLeftToRight, 1);
267 f1 = 0;
268 }
269 else
270 {
271 f1 = 1;
272 }
273 DEC_OR_INC(sx, bLeftToRight, 1);
274 }
275 DEC_OR_INC(SourceBits_4BPP, bTopToBottom, BltInfo->SourceSurface->lDelta);
276 }
277 break;
278
279 case BMF_8BPP:
280 DPRINT("8BPP Case Selected with DestRect Width of '%d'.\n",
281 BltInfo->DestRect.right - BltInfo->DestRect.left);
282
283 /* This sets SourceLine to the top line */
284 SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 +
285 (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) +
286 BltInfo->SourcePoint.x;
287 DestLine = DestBits;
288
289 if (bTopToBottom)
290 {
291 /* This sets SourceLine to the bottom line */
292 SourceLine += BltInfo->SourceSurface->lDelta
293 * (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1);
294 }
295
296 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
297 {
298 SourceBits = SourceLine;
299 DestBits = DestLine;
300
301 if (bLeftToRight)
302 {
303 /* This sets SourceBits to the rightmost pixel */
304 SourceBits += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
305 }
306
307 for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
308 {
309 *((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(
310 BltInfo->XlateSourceToDest, *SourceBits);
311 DEC_OR_INC(SourceBits, bLeftToRight, 1);
312 DestBits += 2;
313 }
314 DEC_OR_INC(SourceLine, bTopToBottom, BltInfo->SourceSurface->lDelta);
315 DestLine += BltInfo->DestSurface->lDelta;
316 }
317 break;
318
319 case BMF_16BPP:
320 DPRINT("16BPP Case Selected with DestRect Width of '%d'.\n",
321 BltInfo->DestRect.right - BltInfo->DestRect.left);
322
323 DPRINT("BMF_16BPP-dstRect: (%d,%d)-(%d,%d) and Width of '%d'.\n",
324 BltInfo->DestRect.left, BltInfo->DestRect.top,
325 BltInfo->DestRect.right, BltInfo->DestRect.bottom,
326 BltInfo->DestRect.right - BltInfo->DestRect.left);
327
328 if ((BltInfo->XlateSourceToDest == NULL ||
329 (BltInfo->XlateSourceToDest->flXlate & XO_TRIVIAL) != 0) &&
330 (!bTopToBottom && !bLeftToRight))
331 {
332 DPRINT("XO_TRIVIAL is TRUE.\n");
333 if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
334 {
335 /* This sets SourceBits to the top line */
336 SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 +
337 (BltInfo->SourcePoint.y *
338 BltInfo->SourceSurface->lDelta) + 2 *
339 BltInfo->SourcePoint.x;
340
341 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
342 {
343 RtlMoveMemory(DestBits, SourceBits,
344 2 * (BltInfo->DestRect.right -
345 BltInfo->DestRect.left));
346
347 SourceBits += BltInfo->SourceSurface->lDelta;
348 DestBits += BltInfo->DestSurface->lDelta;
349 }
350 }
351 else
352 {
353 /* This sets SourceBits to the bottom line */
354 SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0 +
355 ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom -
356 BltInfo->DestRect.top - 1) *
357 BltInfo->SourceSurface->lDelta) + 2 *
358 BltInfo->SourcePoint.x;
359
360 DestBits = (PBYTE)BltInfo->DestSurface->pvScan0 +
361 ((BltInfo->DestRect.bottom - 1) *
362 BltInfo->DestSurface->lDelta) + 2 *
363 BltInfo->DestRect.left;
364
365 for (j = BltInfo->DestRect.bottom - 1;
366 BltInfo->DestRect.top <= j; j--)
367 {
368 RtlMoveMemory(DestBits, SourceBits, 2 *
369 (BltInfo->DestRect.right -
370 BltInfo->DestRect.left));
371
372 SourceBits -= BltInfo->SourceSurface->lDelta;
373 DestBits -= BltInfo->DestSurface->lDelta;
374 }
375 }
376 }
377 else
378 {
379 DPRINT("XO_TRIVIAL is NOT TRUE.\n");
380 if (!bTopToBottom && !bLeftToRight)
381 /* **Note: Indent is purposefully less than desired to keep reviewable differences to a minimum for PR** */
382 {
383 DPRINT("Flip is None.\n");
384 if (BltInfo->DestRect.top < BltInfo->SourcePoint.y)
385 {
386 SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 +
387 (BltInfo->SourcePoint.y *
388 BltInfo->SourceSurface->lDelta) + 2 *
389 BltInfo->SourcePoint.x;
390
391 DestLine = DestBits;
392 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
393 {
394 SourceBits = SourceLine;
395 DestBits = DestLine;
396 for (i = BltInfo->DestRect.left; i <
397 BltInfo->DestRect.right; i++)
398 {
399 *((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(
400 BltInfo->XlateSourceToDest,
401 *((WORD *)SourceBits));
402 SourceBits += 2;
403 DestBits += 2;
404 }
405 SourceLine += BltInfo->SourceSurface->lDelta;
406 DestLine += BltInfo->DestSurface->lDelta;
407 }
408 }
409 else
410 {
411 SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 +
412 ((BltInfo->SourcePoint.y +
413 BltInfo->DestRect.bottom -
414 BltInfo->DestRect.top - 1) *
415 BltInfo->SourceSurface->lDelta) + 2 *
416 BltInfo->SourcePoint.x;
417
418 DestLine = (PBYTE)BltInfo->DestSurface->pvScan0 +
419 ((BltInfo->DestRect.bottom - 1) *
420 BltInfo->DestSurface->lDelta) + 2 *
421 BltInfo->DestRect.left;
422
423 for (j = BltInfo->DestRect.bottom - 1;
424 BltInfo->DestRect.top <= j; j--)
425 {
426 SourceBits = SourceLine;
427 DestBits = DestLine;
428 for (i = BltInfo->DestRect.left; i <
429 BltInfo->DestRect.right; i++)
430 {
431 *((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(
432 BltInfo->XlateSourceToDest,
433 *((WORD *)SourceBits));
434 SourceBits += 2;
435 DestBits += 2;
436 }
437 SourceLine -= BltInfo->SourceSurface->lDelta;
438 DestLine -= BltInfo->DestSurface->lDelta;
439 }
440 }
441 }
442 else
443 {
444 /* Buffering for source and destination flip overlaps. Fixes KHMZ MirrorTest CORE-16642 */
445 BOOL TopToBottomDone = FALSE;
446
447 if (bLeftToRight)
448 {
449 DPRINT("Flip is bLeftToRight.\n");
450
451 /* Allocate enough pixels for a row in WORD's */
453 (BltInfo->DestRect.right - BltInfo->DestRect.left + 1) * 2, TAG_DIB);
454 if (store == NULL)
455 {
456 DPRINT1("Storage Allocation Failed.\n");
457 return FALSE;
458 }
459 WORD Index;
460
461 /* This sets SourceBits to the bottom line */
462 SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0
463 + ((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1)
464 * BltInfo->SourceSurface->lDelta) + 2 * BltInfo->SourcePoint.x;
465
466 /* Sets DestBits to the bottom line */
467 DestBits = (PBYTE)BltInfo->DestSurface->pvScan0
468 + (BltInfo->DestRect.bottom - 1) * BltInfo->DestSurface->lDelta
469 + 2 * BltInfo->DestRect.left + 2;
470
471 for (j = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= j; j--)
472 {
473 /* Set Dest32 to right pixel */
474 Dest32 = (WORD *) DestBits + (BltInfo->DestRect.right - BltInfo->DestRect.left - 1);
475 Source32 = (WORD *) SourceBits;
476
477 Index = 0;
478
479 /* Store pixels from left to right */
480 for (i = BltInfo->DestRect.right - 1; BltInfo->DestRect.left <= i; i--)
481 {
482 store[Index] = (WORD)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *(WORD *)Source32++);
483 Index++;
484 }
485
486 Index = 0;
487
488 /* Copy stored data to pixels from right to left */
489 for (i = BltInfo->DestRect.right - 1; BltInfo->DestRect.left <= i; i--)
490 {
491 *(WORD *)Dest32-- = store[Index];
492 Index++;
493 }
494
495 SourceBits -= BltInfo->SourceSurface->lDelta;
496 DestBits -= BltInfo->DestSurface->lDelta;
497 }
499 TopToBottomDone = TRUE;
500 }
501
502 if (bTopToBottom)
503 {
504 DPRINT("Flip is bTopToBottom.\n");
505
506 /* Allocate enough pixels for a column in WORD's */
508 (BltInfo->DestRect.bottom - BltInfo->DestRect.top + 1) * 2, TAG_DIB);
509 if (store == NULL)
510 {
511 DPRINT1("Storage Allocation Failed.\n");
512 return FALSE;
513 }
514
515 /* This set SourceBits to the top line */
516 SourceBits = (PBYTE)BltInfo->SourceSurface->pvScan0
517 + (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta)
518 + 2 * BltInfo->SourcePoint.x;
519
520 /* This sets DestBits to the top line */
521 DestBits = (PBYTE)BltInfo->DestSurface->pvScan0
522 + ((BltInfo->DestRect.top) * BltInfo->DestSurface->lDelta)
523 + 2 * BltInfo->DestRect.left;
524
525 if ((BltInfo->SourceSurface->fjBitmap & BMF_TOPDOWN) == 0)
526 {
527 DestBits += BltInfo->DestSurface->lDelta;
528 }
529
530 if (bLeftToRight)
531 {
532 DPRINT("Adjusting DestBits for bLeftToRight.\n");
533 DestBits += 2;
534 }
535
536 /* The TopToBottomDone flag indicates that we are flipping for bTopToBottom and bLeftToRight
537 * and have already completed the bLeftToRight. So we will lose our first flip output
538 * unless we work with its output which is at the destination site. So in this case
539 * our new Source becomes the previous outputs Destination. */
540
541 if (TopToBottomDone)
542 {
543 /* This sets SourceBits to the top line */
544 SourceBits = DestBits;
545 }
546
547 for (j = BltInfo->DestRect.right - 1; BltInfo->DestRect.left <= j ; j--)
548 {
549 /* Set Dest32 to bottom pixel */
550 Dest32 = (WORD *) DestBits + (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1)
551 * BltInfo->DestSurface->lDelta / 2;
552 Source32 = (WORD *) SourceBits;
553
554 Index = 0;
555
556 /* Store pixels from top to bottom */
557 for (i = BltInfo->DestRect.top; i <= BltInfo->DestRect.bottom - 1; i++)
558 {
559 store[Index] = XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *Source32);
560 Source32 += BltInfo->SourceSurface->lDelta / 2;
561 Index++;
562 }
563
564 Index = 0;
565
566 /* Copy stored data to pixels from bottom to top */
567 for (i = BltInfo->DestRect.bottom - 1; BltInfo->DestRect.top <= i; i--)
568 {
569 *Dest32 = store[Index];
570 Dest32 -= BltInfo->DestSurface->lDelta / 2;
571 Index++;
572 }
573 SourceBits += 2;
574 DestBits += 2;
575 }
577 }
578
579 }
580 }
581 break;
582
583 case BMF_24BPP:
584
585 DPRINT("BMF_24BPP-dstRect: (%d,%d)-(%d,%d) and Width of '%d'.\n",
586 BltInfo->DestRect.left, BltInfo->DestRect.top,
587 BltInfo->DestRect.right, BltInfo->DestRect.bottom,
588 BltInfo->DestRect.right - BltInfo->DestRect.left);
589
590 /* This sets SourceLine to the top line */
591 SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 +
592 (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) +
593 3 * BltInfo->SourcePoint.x;
594
595 if (bTopToBottom)
596 {
597 /* This sets SourceLine to the bottom line */
598 SourceLine += BltInfo->SourceSurface->lDelta * (BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1);
599 }
600 DestLine = DestBits;
601
602 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
603 {
604 SourceBits = SourceLine;
605 DestBits = DestLine;
606
607 if (bLeftToRight)
608 {
609 /* This sets the SourceBits to the rightmost pixel */
610 SourceBits += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1) * 3;
611 }
612 for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
613 {
614 xColor = (*(SourceBits + 2) << 0x10) +
615 (*(SourceBits + 1) << 0x08) + (*(SourceBits));
616
617 *((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(
618 BltInfo->XlateSourceToDest, xColor);
619
620 DEC_OR_INC(SourceBits, bLeftToRight, 3);
621 DestBits += 2;
622 }
623 DEC_OR_INC(SourceLine, bTopToBottom, BltInfo->SourceSurface->lDelta);
624 DestLine += BltInfo->DestSurface->lDelta;
625 }
626 break;
627
628 case BMF_32BPP:
629 DPRINT("32BPP Case Selected with DestRect Width of '%d'.\n",
630 BltInfo->DestRect.right - BltInfo->DestRect.left);
631
632 SourceLine = (PBYTE)BltInfo->SourceSurface->pvScan0 +
633 (BltInfo->SourcePoint.y * BltInfo->SourceSurface->lDelta) +
634 4 * BltInfo->SourcePoint.x;
635
636 if (bTopToBottom)
637 {
638 /* This sets SourceLine to the bottom line */
639 SourceLine += BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1;
640 }
641 DestLine = DestBits;
642
643 for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
644 {
645 SourceBits = SourceLine;
646 DestBits = DestLine;
647
648 if (bLeftToRight)
649 {
650 /* This sets SourceBits to the rightmost pixel */
651 SourceBits += (BltInfo->DestRect.right - BltInfo->DestRect.left - 1) * 4;
652 }
653
654 for (i = BltInfo->DestRect.left; i < BltInfo->DestRect.right; i++)
655 {
656 *((WORD *)DestBits) = (WORD)XLATEOBJ_iXlate(
657 BltInfo->XlateSourceToDest,
658 *((PDWORD) SourceBits));
659 DEC_OR_INC(SourceBits, bLeftToRight, 4);
660 DestBits += 2;
661 }
662
663 DEC_OR_INC(SourceLine, bTopToBottom, BltInfo->SourceSurface->lDelta);
664 DestLine += BltInfo->DestSurface->lDelta;
665 }
666 break;
667
668 default:
669 DPRINT1("DIB_16BPP_BitBltSrcCopy: Unhandled Source BPP: %u\n",
671 return FALSE;
672 }
673
674 return TRUE;
675}
unsigned char BOOLEAN
#define DEC_OR_INC(var, decTrue, amount)
Definition: dib16bpp.c:17
#define NULL
Definition: types.h:112
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define NonPagedPool
Definition: env_spec_w32.h:307
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
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
if(dx< 0)
Definition: linetemp.h:194
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define for
Definition: utility.h:88
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
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
USHORT fjBitmap
Definition: winddi.h:1217
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
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
_In_ WDFCOLLECTION _In_ ULONG Index
unsigned char altnotmask[2]
Definition: dib.c:18
ULONG DIB_1BPP_GetPixel(SURFOBJ *, LONG, LONG)
Definition: dib1bpp.c:30
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
#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
#define BMF_TOPDOWN
Definition: winddi.h:1180
#define BMF_32BPP
Definition: winddi.h:360
#define XO_TRIVIAL
Definition: winddi.h:1247
#define BMF_4BPP
Definition: winddi.h:356

◆ DIB_16BPP_ColorFill()

BOOLEAN DIB_16BPP_ColorFill ( SURFOBJ DestSurface,
RECTL DestRect,
ULONG  color 
)

Definition at line 679 of file dib16bpp.c.

680{
681 LONG DestY;
682
683 /* Make WellOrdered with top < bottom and left < right */
684 RECTL_vMakeWellOrdered(DestRect);
685
686#if defined(_M_IX86) && !defined(_MSC_VER)
687 /* This is about 10% faster than the generic C code below */
688 ULONG delta = DestSurface->lDelta;
689 ULONG width = (DestRect->right - DestRect->left) ;
690 PULONG pos = (PULONG) ((PBYTE)DestSurface->pvScan0 + DestRect->top * delta + (DestRect->left<<1));
691 color = (color&0xffff); /* If the color value is "abcd", put "abcdabcd" into color */
692 color += (color<<16);
693
694 for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
695 {
696 __asm__ __volatile__ (
697 "cld\n\t"
698 "mov %1,%%ebx\n\t"
699 "mov %2,%%edi\n\t"
700 "test $0x03, %%edi\n\t" /* Align to fullword boundary */
701 "jz 1f\n\t"
702 "stosw\n\t"
703 "dec %%ebx\n\t"
704 "jz 2f\n"
705 "1:\n\t"
706 "mov %%ebx,%%ecx\n\t" /* Setup count of fullwords to fill */
707 "shr $1,%%ecx\n\t"
708 "rep stosl\n\t" /* The actual fill */
709 "test $0x01, %%ebx\n\t" /* One left to do at the right side? */
710 "jz 2f\n\t"
711 "stosw\n"
712 "2:"
713 :
714 : "a" (color), "r" (width), "m" (pos)
715 : "%ecx", "%ebx", "%edi");
716 pos =(PULONG)((ULONG_PTR)pos + delta);
717 }
718#else /* _M_IX86 */
719
720 for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
721 {
722 DIB_16BPP_HLine (DestSurface, DestRect->left, DestRect->right, DestY, color);
723 }
724#endif
725 return TRUE;
726}
VOID DIB_16BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
Definition: dib16bpp.c:38
GLint GLint GLsizei width
Definition: gl.h:1546
GLuint color
Definition: glext.h:6243
__asm__(".p2align 4, 0x90\n" ".seh_proc __seh2_global_filter_func\n" "__seh2_global_filter_func:\n" "\tsub %rbp, %rax\n" "\tpush %rbp\n" "\t.seh_pushreg %rbp\n" "\tsub $32, %rsp\n" "\t.seh_stackalloc 32\n" "\t.seh_endprologue\n" "\tsub %rax, %rdx\n" "\tmov %rdx, %rbp\n" "\tjmp *%r8\n" "__seh2_global_filter_func_exit:\n" "\t.p2align 4\n" "\tadd $32, %rsp\n" "\tpop %rbp\n" "\tret\n" "\t.seh_endproc")
uint32_t * PULONG
Definition: typedefs.h:59
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59

◆ DIB_16BPP_GetPixel()

ULONG DIB_16BPP_GetPixel ( SURFOBJ SurfObj,
LONG  x,
LONG  y 
)

Definition at line 30 of file dib16bpp.c.

31{
32 PBYTE byteaddr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta;
33 PWORD addr = (PWORD)byteaddr + x;
34 return (ULONG)(*addr);
35}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLenum const GLvoid * addr
Definition: glext.h:9621

Referenced by DIB_16BPP_AlphaBlend(), and DIB_1BPP_BitBltSrcCopy().

◆ DIB_16BPP_HLine()

VOID DIB_16BPP_HLine ( SURFOBJ SurfObj,
LONG  x1,
LONG  x2,
LONG  y,
ULONG  c 
)

Definition at line 38 of file dib16bpp.c.

39{
40 PDWORD addr = (PDWORD)((PWORD)((PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta) + x1);
41
42#if defined(_M_IX86) && !defined(_MSC_VER)
43 /* This is about 10% faster than the generic C code below */
44 LONG Count = x2 - x1;
45
46 if (x1 >= x2)
47 return;
48
49 __asm__ __volatile__ (
50 " cld\n"
51 " mov %0, %%eax\n"
52 " shl $16, %%eax\n"
53 " andl $0xffff, %0\n" /* If the pixel value is "abcd", put "abcdabcd" in %eax */
54 " or %0, %%eax\n"
55 " mov %2, %%edi\n"
56 " test $0x03, %%edi\n" /* Align to fullword boundary */
57 " jz 0f\n"
58 " stosw\n"
59 " dec %1\n"
60 " jz 1f\n"
61 "0:\n"
62 " mov %1,%%ecx\n" /* Setup count of fullwords to fill */
63 " shr $1,%%ecx\n"
64 " rep stosl\n" /* The actual fill */
65 " test $0x01, %1\n" /* One left to do at the right side? */
66 " jz 1f\n"
67 " stosw\n"
68 "1:\n"
69 : /* no output */
70 : "r"(c), "r"(Count), "m"(addr)
71 : "%eax", "%ecx", "%edi");
72#else /* _M_IX86 */
73 LONG cx = x1;
74 DWORD cc;
75
76 if (x1 >= x2)
77 return;
78
79 if (0 != (cx & 0x01))
80 {
81 *((PWORD) addr) = (WORD)c;
82 cx++;
83 addr = (PDWORD)((PWORD)(addr) + 1);
84 }
85 cc = ((c & 0xffff) << 16) | (c & 0xffff);
86 while(cx + 1 < x2)
87 {
88 *addr++ = cc;
89 cx += 2;
90 }
91 if (cx < x2)
92 {
93 *((PWORD) addr) = (WORD)c;
94 }
95#endif /* _M_IX86 */
96}
const GLubyte * c
Definition: glext.h:8905
uint32_t cc
Definition: isohybrid.c:75
int Count
Definition: noreturn.cpp:7
_Out_opt_ int * cx
Definition: commctrl.h:585
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3710
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708

Referenced by DIB_16BPP_ColorFill().

◆ DIB_16BPP_PutPixel()

VOID DIB_16BPP_PutPixel ( SURFOBJ SurfObj,
LONG  x,
LONG  y,
ULONG  c 
)

Definition at line 21 of file dib16bpp.c.

22{
23 PBYTE byteaddr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta;
24 PWORD addr = (PWORD)byteaddr + x;
25
26 *addr = (WORD)c;
27}

Referenced by DIB_16BPP_AlphaBlend(), and DIB_16BPP_BitBltSrcCopy().

◆ DIB_16BPP_TransparentBlt()

BOOLEAN DIB_16BPP_TransparentBlt ( SURFOBJ DestSurf,
SURFOBJ SourceSurf,
RECTL DestRect,
RECTL SourceRect,
XLATEOBJ ColorTranslation,
ULONG  iTransColor 
)

Definition at line 729 of file dib16bpp.c.

732{
733 LONG RoundedRight, X, Y, SourceX = 0, SourceY = 0, wd;
734 ULONG *DestBits, Source, Dest;
735
736 LONG DstHeight;
737 LONG DstWidth;
738 LONG SrcHeight;
739 LONG SrcWidth;
740
741 DstHeight = DestRect->bottom - DestRect->top;
742 DstWidth = DestRect->right - DestRect->left;
743 SrcHeight = SourceRect->bottom - SourceRect->top;
744 SrcWidth = SourceRect->right - SourceRect->left;
745
746 RoundedRight = DestRect->right - ((DestRect->right - DestRect->left) & 0x1);
747 DestBits = (ULONG*)((PBYTE)DestSurf->pvScan0 +
748 (DestRect->left << 1) +
749 DestRect->top * DestSurf->lDelta);
750 wd = DestSurf->lDelta - ((DestRect->right - DestRect->left) << 1);
751
752 for(Y = DestRect->top; Y < DestRect->bottom; Y++)
753 {
754 SourceY = SourceRect->top+(Y - DestRect->top) * SrcHeight / DstHeight;
755 for(X = DestRect->left; X < RoundedRight; X += 2, DestBits++, SourceX += 2)
756 {
757 Dest = *DestBits;
758
759 SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
760 if (SourceX >= 0 && SourceY >= 0 &&
761 SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
762 {
763 Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
764 if(Source != iTransColor)
765 {
766 Dest &= 0xFFFF0000;
767 Dest |= (XLATEOBJ_iXlate(ColorTranslation, Source) & 0xFFFF);
768 }
769 }
770
771 SourceX = SourceRect->left+(X+1 - DestRect->left) * SrcWidth / DstWidth;
772 if (SourceX >= 0 && SourceY >= 0 &&
773 SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
774 {
775 Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
776 if(Source != iTransColor)
777 {
778 Dest &= 0xFFFF;
779 Dest |= (XLATEOBJ_iXlate(ColorTranslation, Source) << 16);
780 }
781 }
782
783 *DestBits = Dest;
784 }
785
786 if(X < DestRect->right)
787 {
788 SourceX = SourceRect->left+(X - DestRect->left) * SrcWidth / DstWidth;
789 if (SourceX >= 0 && SourceY >= 0 &&
790 SourceSurf->sizlBitmap.cx > SourceX && SourceSurf->sizlBitmap.cy > SourceY)
791 {
792 Source = DIB_GetSourceIndex(SourceSurf, SourceX, SourceY);
793 if(Source != iTransColor)
794 {
795 *((USHORT*)DestBits) = (USHORT)XLATEOBJ_iXlate(ColorTranslation,
796 Source);
797 }
798 }
799
800 DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
801 }
802
803 DestBits = (ULONG*)((ULONG_PTR)DestBits + wd);
804 }
805
806 return TRUE;
807}
#define Y(I)
#define X(b, s)
unsigned short USHORT
Definition: pedump.c:61
#define DIB_GetSourceIndex(SourceSurf, sx, sy)
Definition: dib.h:141
_In_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ RECTL _In_ RECTL _In_ ULONG iTransColor
Definition: winddi.h:4195

◆ DIB_16BPP_VLine()

VOID DIB_16BPP_VLine ( SURFOBJ SurfObj,
LONG  x,
LONG  y1,
LONG  y2,
ULONG  c 
)

Definition at line 100 of file dib16bpp.c.

101{
102#if defined(_M_IX86) && !defined(_MSC_VER)
103 asm volatile(
104 " testl %2, %2" "\n\t"
105 " jle 2f" "\n\t"
106 " movl %2, %%ecx" "\n\t"
107 " shrl $2, %2" "\n\t"
108 " andl $3, %%ecx" "\n\t"
109 " jz 1f" "\n\t"
110 "0:" "\n\t"
111 " movw %%ax, (%0)" "\n\t"
112 " addl %1, %0" "\n\t"
113 " decl %%ecx" "\n\t"
114 " jnz 0b" "\n\t"
115 " testl %2, %2" "\n\t"
116 " jz 2f" "\n\t"
117 "1:" "\n\t"
118 " movw %%ax, (%0)" "\n\t"
119 " addl %1, %0" "\n\t"
120 " movw %%ax, (%0)" "\n\t"
121 " addl %1, %0" "\n\t"
122 " movw %%ax, (%0)" "\n\t"
123 " addl %1, %0" "\n\t"
124 " movw %%ax, (%0)" "\n\t"
125 " addl %1, %0" "\n\t"
126 " decl %2" "\n\t"
127 " jnz 1b" "\n\t"
128 "2:" "\n\t"
129 : /* no output */
130 : "r"((PBYTE)SurfObj->pvScan0 + (y1 * SurfObj->lDelta) + (x * sizeof (WORD))),
131 "r"(SurfObj->lDelta), "r"(y2 - y1), "a"(c)
132 : "cc", "memory", "%ecx");
133#else
134 PBYTE byteaddr = (PBYTE)(ULONG_PTR)SurfObj->pvScan0 + y1 * SurfObj->lDelta;
135 PWORD addr = (PWORD)byteaddr + x;
136 LONG lDelta = SurfObj->lDelta;
137
138 byteaddr = (PBYTE)addr;
139 while(y1++ < y2)
140 {
141 *addr = (WORD)c;
142
143 byteaddr += lDelta;
144 addr = (PWORD)byteaddr;
145 }
146#endif
147}
_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