UINT32 nbUpdateRects;
REGION16 clippingRects;
const RECTANGLE_16* updateRects;
+ const DWORD formatSize = GetBytesPerPixel(format);
region16_init(&clippingRects);
for (i = 0; i < message->numRects; i++)
for (j = 0; j < nbUpdateRects; j++)
{
- UINT32 stride = 64 * GetBytesPerPixel(format);
+ UINT32 stride = 64 * formatSize;
UINT32 nXDst = updateRects[j].left;
UINT32 nYDst = updateRects[j].top;
UINT32 nXSrc = nXDst - updateRect.left;
UINT32 nXDest, nYDest;
UINT32 nWidth, nHeight;
const BYTE* srcp;
+ DWORD formatSize;
gdi_RectToCRgn(rect, &nXDest, &nYDest, &nWidth, &nHeight);
if (!hdc || !hbr)
}
srcp = gdi_get_bitmap_pointer(hdc, nXDest, nYDest);
+ formatSize = GetBytesPerPixel(hdc->format);
for (y = 1; y < nHeight; y++)
{
BYTE* dstp = gdi_get_bitmap_pointer(hdc, nXDest, nYDest + y);
- memcpy(dstp, srcp, nWidth * GetBytesPerPixel(hdc->format));
+ memcpy(dstp, srcp, nWidth * formatSize);
}
break;
case GDI_BS_HATCHED:
case GDI_BS_PATTERN:
monochrome = (hbr->pattern->format == PIXEL_FORMAT_MONO);
+ formatSize = GetBytesPerPixel(hbr->pattern->format);
for (y = 0; y < nHeight; y++)
{
for (x = 0; x < nWidth; x++)
{
const UINT32 yOffset = ((nYDest + y) * hbr->pattern->width %
- hbr->pattern->height) * GetBytesPerPixel(hbr->pattern->format);
- const UINT32 xOffset = ((nXDest + x) % hbr->pattern->width) * GetBytesPerPixel(
- hbr->pattern->format);
+ hbr->pattern->height) * formatSize;
+ const UINT32 xOffset = ((nXDest + x) % hbr->pattern->width) * formatSize;
const BYTE* patp = &hbr->pattern->data[yOffset + xOffset];
BYTE* dstp = gdi_get_bitmap_pointer(hdc, nXDest + x,
nYDest + y);
/* ------------------------------------------------------------------------- */
static pstatus_t general_YCoCgToRGB_8u_AC4R(
- const BYTE* pSrc, INT32 srcStep,
- BYTE* pDst, UINT32 DstFormat, INT32 dstStep,
- UINT32 width, UINT32 height,
- UINT8 shift,
- BOOL withAlpha)
+ const BYTE* pSrc, INT32 srcStep,
+ BYTE* pDst, UINT32 DstFormat, INT32 dstStep,
+ UINT32 width, UINT32 height,
+ UINT8 shift,
+ BOOL withAlpha)
{
BYTE A;
UINT32 x, y;
BYTE* dptr = pDst;
const BYTE* sptr = pSrc;
INT16 Cg, Co, Y, T, R, G, B;
+ const DWORD formatSize = GetBytesPerPixel(DstFormat);
int cll = shift - 1; /* -1 builds in the /2's */
UINT32 srcPad = srcStep - (width * 4);
- UINT32 dstPad = dstStep - (width * GetBytesPerPixel(DstFormat));
+ UINT32 dstPad = dstStep - (width * formatSize);
for (y = 0; y < height; y++)
{
R = T + Co;
G = Y + Cg;
B = T - Co;
-
color = GetColor(DstFormat,
- MINMAX(R, 0, 255), MINMAX(G, 0, 255),
- MINMAX(B, 0, 255), A);
+ MINMAX(R, 0, 255), MINMAX(G, 0, 255),
+ MINMAX(B, 0, 255), A);
WriteColor(dptr, DstFormat, color);
- dptr += GetBytesPerPixel(DstFormat);
+ dptr += formatSize;
}
sptr += srcPad;
{
/* Filter */
const INT32 u = pSrcU[2 * x] + pSrcU[2 * x + 1] + pSrcU1[2 * x]
- + pSrcU1[2 * x + 1];
+ + pSrcU1[2 * x + 1];
const INT32 v = pSrcV[2 * x] + pSrcV[2 * x + 1] + pSrcV1[2 * x]
- + pSrcV1[2 * x + 1];
+ + pSrcV1[2 * x + 1];
pU[x] = CLIP(u / 4L);
pV[x] = CLIP(v / 4L);
}
return CLIP(b8);
}
-static INLINE BYTE* writePixel(BYTE* dst, UINT32 format, BYTE Y, BYTE U, BYTE V)
+static INLINE BYTE* writeYUVPixel(BYTE* dst, DWORD formatSize, UINT32 format, BYTE Y, BYTE U,
+ BYTE V)
{
const BYTE r = YUV2R(Y, U, V);
const BYTE g = YUV2G(Y, U, V);
const BYTE b = YUV2B(Y, U, V);
UINT32 color = GetColor(format, r, g, b, 0xFF);
WriteColor(dst, format, color);
- return dst + GetBytesPerPixel(format);
+ return dst + formatSize;
}
static pstatus_t general_YUV444ToRGB_8u_P3AC4R(
{
UINT32 x, y;
UINT32 nWidth, nHeight;
+ const DWORD formatSize = GetBytesPerPixel(DstFormat);
nWidth = roi->width;
nHeight = roi->height;
const BYTE Y = pY[x];
const INT32 U = pU[x];
const INT32 V = pV[x];
- pRGB = writePixel(pRGB, DstFormat, Y, U, V);
+ pRGB = writeYUVPixel(pRGB, formatSize, DstFormat, Y, U, V);
}
}
BYTE* pRGB = pDst;
UINT32 nWidth, nHeight;
UINT32 lastRow, lastCol;
+ const DWORD formatSize = GetBytesPerPixel(DstFormat);
pY = pSrc[0];
pU = pSrc[1];
pV = pSrc[2];
V = *pV++;
/* 1st pixel */
Y = *pY++;
- pRGB = writePixel(pRGB, DstFormat, Y, U, V);
+ pRGB = writeYUVPixel(pRGB, formatSize, DstFormat, Y, U, V);
/* 2nd pixel */
if (!(lastCol & 0x02))
{
Y = *pY++;
- pRGB = writePixel(pRGB, DstFormat, Y, U, V);
+ pRGB = writeYUVPixel(pRGB, formatSize, DstFormat, Y, U, V);
}
else
{
pY++;
- pRGB += GetBytesPerPixel(DstFormat);
+ pRGB += formatSize;
lastCol >>= 1;
}
}
V = *pV++;
/* 3rd pixel */
Y = *pY++;
- pRGB = writePixel(pRGB, DstFormat, Y, U, V);
+ pRGB = writeYUVPixel(pRGB, formatSize, DstFormat, Y, U, V);
/* 4th pixel */
if (!(lastCol & 0x02))
{
Y = *pY++;
- pRGB = writePixel(pRGB, DstFormat, Y, U, V);
+ pRGB = writeYUVPixel(pRGB, formatSize, DstFormat, Y, U, V);
}
else
{
pY++;
- pRGB += GetBytesPerPixel(DstFormat);
+ pRGB += formatSize;
lastCol >>= 1;
}
}
BYTE B, G, R;
const UINT32 color = ReadColor(&pRGB[x * bpp], SrcFormat);
SplitColor(color, SrcFormat, &R, &G, &B, NULL, NULL);
-
pY[x] = RGB2Y(R, G, B);
pU[x] = RGB2U(R, G, B);
pV[x] = RGB2V(R, G, B);
const UINT32 val2x = (x * 2);
const UINT32 val2x1 = val2x + 1;
BYTE B, G, R;
-
/* 1st pixel */
color = ReadColor(&pRGB[val2x * bpp], SrcFormat);
SplitColor(color, SrcFormat, &R, &G, &B, NULL, NULL);
-
Ba = B;
Ga = G;
Ra = R;