18EXLATEOBJ_iXlateTrivial(
29{ 0, 8, 16, 25, 33, 41, 49, 58, 66, 74, 82, 90, 99,107,115,123,
30 132,140,148,156,165,173,181,189,197,206,214,222,231,239,247,255};
33{ 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 45, 49, 52, 57, 61,
34 65, 69, 73, 77, 81, 85, 89, 93, 97,101,105,109,113,117,121,125,
35130,134,138,142,146,150,154,158,162,166,170,174,178,182,186,190,
36194,198,202,207,210,215,219,223,227,231,235,239,243,247,251,255};
45EXLATEOBJ_iXlateTrivial(
57 return (
iColor == pexlo->xlo.pulXlate[0]);
77 iNewColor =
iColor & 0xff00ff00;
98 iNewColor =
iColor & 0x7C00;
102 iNewColor |=
iColor & 0x3E0;
106 iNewColor |=
iColor & 0x1F;
120 iNewColor =
iColor & 0x1f;
124 iNewColor |= (
iColor & 0x3E0);
128 iNewColor |= (
iColor & 0x7C00);
142 iNewColor =
iColor & 0xF800;
146 iNewColor |=
iColor & 0x7E0;
150 iNewColor |=
iColor & 0x1F;
164 iNewColor =
iColor & 0x1f;
168 iNewColor |= (
iColor & 0x7E0);
172 iNewColor |= (
iColor & 0xF800);
235 iNewColor =
iColor & 0x1f;
239 iNewColor |=
iColor & 0xFFC0;
243 iNewColor |= (
iColor & 0x20);
266 iNewColor =
iColor & 0x1f;
270 iNewColor |=
iColor & 0x7FE0;
369 if (!ppalSrc) ppalSrc = &
gpalRGB;
370 if (!ppalDst) ppalDst = &
gpalRGB;
373 pexlo->xlo.cEntries = 0;
374 pexlo->xlo.flXlate = 0;
375 pexlo->xlo.pulXlate = pexlo->aulXlate;
376 pexlo->pfnXlate = EXLATEOBJ_iXlateTrivial;
377 pexlo->hColorTransform =
NULL;
378 pexlo->ppalSrc = ppalSrc;
379 pexlo->ppalDst = ppalDst;
380 pexlo->xlo.iSrcType = (
USHORT)ppalSrc->flFlags;
381 pexlo->xlo.iDstType = (
USHORT)ppalDst->flFlags;
384 if (ppalDst == ppalSrc)
394 ULONG aulMasksSrc[3], aulMasksDst[3];
399 pexlo->ulRedMask = aulMasksDst[0];
400 pexlo->ulGreenMask = aulMasksDst[1];
401 pexlo->ulBlueMask = aulMasksDst[2];
403 pexlo->ulRedShift =
CalculateShift(aulMasksSrc[0], aulMasksDst[0]);
404 pexlo->ulGreenShift =
CalculateShift(aulMasksSrc[1], aulMasksDst[1]);
405 pexlo->ulBlueShift =
CalculateShift(aulMasksSrc[2], aulMasksDst[2]);
414 pexlo->pfnXlate = EXLATEOBJ_iXlateTable;
416 pexlo->xlo.cEntries = 2;
417 pexlo->xlo.pulXlate[0] =
419 pexlo->xlo.pulXlate[1] =
425 pexlo->pfnXlate = EXLATEOBJ_iXlateToMono;
427 pexlo->xlo.cEntries = 1;
434 else if (ppalSrc->flFlags &
PAL_RGB)
436 pexlo->aulXlate[0] = crSrcBackColor;
438 else if (ppalSrc->flFlags &
PAL_BGR)
451 pexlo->aulXlate[0] = EXLATEOBJ_iXlateShiftAndMask(pexlo, crSrcBackColor);
464 if (!pexlo->xlo.pulXlate)
466 DPRINT1(
"Could not allocate pulXlate buffer.\n");
467 pexlo->pfnXlate = EXLATEOBJ_iXlateTrivial;
473 pexlo->pfnXlate = EXLATEOBJ_iXlateTable;
483 ulColor =
RGB(ppalSrc->IndexedColors[
i].peRed,
484 ppalSrc->IndexedColors[
i].peGreen,
485 ppalSrc->IndexedColors[
i].peBlue);
487 pexlo->xlo.pulXlate[
i] =
490 if (pexlo->xlo.pulXlate[
i] !=
i) cDiff++;
496 if (pexlo->xlo.pulXlate != pexlo->aulXlate)
499 pexlo->xlo.pulXlate = pexlo->aulXlate;
501 pexlo->pfnXlate = EXLATEOBJ_iXlateTrivial;
503 pexlo->xlo.cEntries = 0;
509 for (
i = 0;
i < pexlo->xlo.cEntries;
i++)
511 ulColor =
RGB(ppalSrc->IndexedColors[
i].peRed,
512 ppalSrc->IndexedColors[
i].peGreen,
513 ppalSrc->IndexedColors[
i].peBlue);
518 else if (ppalSrc->flFlags &
PAL_RGB)
521 pexlo->pfnXlate = EXLATEOBJ_iXlateRGBtoPal;
523 else if (ppalDst->flFlags &
PAL_BGR)
524 pexlo->pfnXlate = EXLATEOBJ_iXlateRGBtoBGR;
527 pexlo->pfnXlate = EXLATEOBJ_iXlateRGBto555;
530 pexlo->pfnXlate = EXLATEOBJ_iXlateRGBto565;
533 pexlo->pfnXlate = EXLATEOBJ_iXlateShiftAndMask;
535 else if (ppalSrc->flFlags &
PAL_BGR)
538 pexlo->pfnXlate = EXLATEOBJ_iXlateBitfieldsToPal;
540 else if (ppalDst->flFlags &
PAL_RGB)
542 pexlo->pfnXlate = EXLATEOBJ_iXlateRGBtoBGR;
545 pexlo->pfnXlate = EXLATEOBJ_iXlateBGRto555;
548 pexlo->pfnXlate = EXLATEOBJ_iXlateBGRto565;
551 pexlo->pfnXlate = EXLATEOBJ_iXlateShiftAndMask;
556 pexlo->pfnXlate = EXLATEOBJ_iXlate555toPal;
558 else if (ppalDst->flFlags &
PAL_RGB)
559 pexlo->pfnXlate = EXLATEOBJ_iXlate555toRGB;
561 else if (ppalDst->flFlags &
PAL_BGR)
562 pexlo->pfnXlate = EXLATEOBJ_iXlate555toBGR;
565 pexlo->pfnXlate = EXLATEOBJ_iXlate555to565;
568 pexlo->pfnXlate = EXLATEOBJ_iXlateShiftAndMask;
573 pexlo->pfnXlate = EXLATEOBJ_iXlate565toPal;
575 else if (ppalDst->flFlags &
PAL_RGB)
576 pexlo->pfnXlate = EXLATEOBJ_iXlate565toRGB;
578 else if (ppalDst->flFlags &
PAL_BGR)
579 pexlo->pfnXlate = EXLATEOBJ_iXlate565toBGR;
582 pexlo->pfnXlate = EXLATEOBJ_iXlate565to555;
585 pexlo->pfnXlate = EXLATEOBJ_iXlateShiftAndMask;
590 pexlo->pfnXlate = EXLATEOBJ_iXlateBitfieldsToPal;
592 pexlo->pfnXlate = EXLATEOBJ_iXlateShiftAndMask;
596 if (pexlo->pfnXlate == EXLATEOBJ_iXlateShiftAndMask &&
597 !pexlo->ulRedShift && !pexlo->ulGreenShift && !pexlo->ulBlueShift)
599 pexlo->pfnXlate = EXLATEOBJ_iXlateTrivial;
603 if (pexlo->pfnXlate == EXLATEOBJ_iXlateTrivial)
606 pexlo->xlo.flXlate &= ~XO_TRIVIAL;
618 psurfDst = pdcDst->dclevel.pSurface;
619 psurfSrc = pdcSrc->dclevel.pSurface;
625 pdcSrc->pdcattr->crBackgroundClr,
626 pdcDst->pdcattr->crBackgroundClr,
627 pdcDst->pdcattr->crForegroundClr);
629 pexlo->ppalDstDc = pdcDst->dclevel.ppal;
652 if (pexlo->xlo.pulXlate != pexlo->aulXlate)
656 pexlo->xlo.pulXlate = pexlo->aulXlate;
661#undef XLATEOBJ_iXlate
696 DPRINT1(
"XLATEOBJ_cGetPalette called with wrong iPal: %lu\n", iPal);
733 for (
i = 0;
i < cPal;
i++)
767 return pxlo->pulXlate;
#define InterlockedIncrement
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
_Check_return_ unsigned int __cdecl _rotl(_In_ unsigned int _Value, _In_ int _Shift)
#define _Function_class_(x)
#define _Post_satisfies_(cond)
void * EngAllocMem(int zero, unsigned long size, int tag=0)
PALETTEENTRY * IndexedColors
struct _PALETTE *const ppal
ULONG NTAPI PALETTE_ulGetNearestBitFieldsIndex(PALETTE *ppal, ULONG ulColor)
ULONG NTAPI PALETTE_ulGetNearestIndex(PALETTE *ppal, ULONG ulColor)
VOID NTAPI PALETTE_vGetBitMasks(PPALETTE ppal, PULONG pulColors)
ULONG NTAPI PALETTE_ulGetNearestPaletteIndex(PALETTE *ppal, ULONG iColor)
FORCEINLINE ULONG CalculateShift(ULONG ulMask1, ULONG ulMask2)
_In_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ * pxlo
_In_ UINT _In_ UINT cEntries
VOID NTAPI EXLATEOBJ_vInitialize(_Out_ PEXLATEOBJ pexlo, _In_opt_ PALETTE *ppalSrc, _In_opt_ PALETTE *ppalDst, _In_ COLORREF crSrcBackColor, _In_ COLORREF crDstBackColor, _In_ COLORREF crDstForeColor)
static const BYTE gajXlate5to8[32]
VOID NTAPI EXLATEOBJ_vCleanup(_Inout_ PEXLATEOBJ pexlo)
static const BYTE gajXlate6to8[64]
ULONG NTAPI XLATEOBJ_cGetPalette(_In_ XLATEOBJ *pxlo, _In_ ULONG iPal, _In_ ULONG cPal, _Out_cap_(cPal) ULONG *pPalOut)
VOID NTAPI EXLATEOBJ_vInitXlateFromDCs(_Out_ EXLATEOBJ *pexlo, _In_ PDC pdcSrc, _In_ PDC pdcDst)
ULONG NTAPI XLATEOBJ_iXlate(_In_ XLATEOBJ *pxlo, _In_ ULONG iColor)
PULONG NTAPI XLATEOBJ_piVector(_In_ XLATEOBJ *pxlo)
HANDLE NTAPI XLATEOBJ_hGetColorTransform(_In_ XLATEOBJ *pxlo)
VOID NTAPI EXLATEOBJ_vInitSrcMonoXlate(PEXLATEOBJ pexlo, PPALETTE ppalDst, COLORREF crBackgroundClr, COLORREF crForegroundClr)
static ULONG giUniqueXlate
struct _EXLATEOBJ * PEXLATEOBJ