break;
default:
- WLog_ERR(TAG, "Format %s not supported!", GetColorFormatName(cmd->format));
+ WLog_ERR(TAG, "Format %s not supported!", FreeRDPGetColorFormatName(cmd->format));
return ERROR_INVALID_DATA;
}
return FALSE;
}
- *color = ConvertColor(srcColor, SrcFormat,
+ *color = FreeRDPConvertColor(srcColor, SrcFormat,
DstFormat, &gdi->palette);
return TRUE;
}
*
* @return A string representation of format
*/
-static const char* GetColorFormatName(UINT32 format)
+static const char* FreeRDPGetColorFormatName(UINT32 format)
{
switch (format)
{
if (_a)
*_a = 0x00;
- WLog_ERR(CTAG, "Unsupported format %s", GetColorFormatName(format));
+ WLog_ERR(CTAG, "Unsupported format %s", FreeRDPGetColorFormatName(format));
break;
}
}
* @return The pixel color in the desired format. Value is in internal
* representation.
*/
-static INLINE UINT32 GetColor(UINT32 format, BYTE r, BYTE g, BYTE b, BYTE a)
+static INLINE UINT32 FreeRDPGetColor(UINT32 format, BYTE r, BYTE g, BYTE b, BYTE a)
{
UINT32 _r = r;
UINT32 _g = g;
/* 1bpp formats */
case PIXEL_FORMAT_MONO:
default:
- WLog_ERR(CTAG, "Unsupported format %s", GetColorFormatName(format));
+ WLog_ERR(CTAG, "Unsupported format %s", FreeRDPGetColorFormatName(format));
return 0;
}
}
break;
default:
- WLog_ERR(CTAG, "Unsupported format %s", GetColorFormatName(format));
+ WLog_ERR(CTAG, "Unsupported format %s", FreeRDPGetColorFormatName(format));
color = 0;
break;
}
break;
default:
- WLog_ERR(CTAG, "Unsupported format %s", GetColorFormatName(format));
+ WLog_ERR(CTAG, "Unsupported format %s", FreeRDPGetColorFormatName(format));
return FALSE;
}
*
* @return The converted pixel color in dstFormat representation
*/
-static INLINE UINT32 ConvertColor(UINT32 color, UINT32 srcFormat,
+static INLINE UINT32 FreeRDPConvertColor(UINT32 color, UINT32 srcFormat,
UINT32 dstFormat, const gdiPalette* palette)
{
BYTE r = 0;
BYTE b = 0;
BYTE a = 0;
SplitColor(color, srcFormat, &r, &g, &b, &a, palette);
- return GetColor(dstFormat, r, g, b, a);
+ return FreeRDPGetColor(dstFormat, r, g, b, a);
}
/***
* @param nWidth width to copy in pixels
* @param nHeight height to copy in pixels
* @param color Pixel color in DstFormat (internal representation format,
- * use GetColor to create)
+ * use FreeRDPGetColor to create)
*
* @return TRUE if success, FALSE otherwise
*/
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight, UINT32 color);
+#if !defined(__APPLE__)
+#define GetColorFormatName FreeRDPGetColorFormatName
+#define GetColor FreeRDPGetColor
+#define ConvertColor FreeRDPFreeRDPConvertColor
+#endif
+
#ifdef __cplusplus
}
#endif
Stream_Read_UINT8(s, b);
Stream_Read_UINT8(s, g);
Stream_Read_UINT8(s, r);
- palette[i] = GetColor(DstFormat, r, g, b, 0xFF);
+ palette[i] = FreeRDPGetColor(DstFormat, r, g, b, 0xFF);
}
pixelIndex = 0;
Stream_Read_UINT8(s, r);
Stream_Read_UINT8(s, runLengthFactor);
suboffset += 4;
- color = GetColor(clear->format, r, g, b, 0xFF);
+ color = FreeRDPGetColor(clear->format, r, g, b, 0xFF);
if (runLengthFactor >= 0xFF)
{
Stream_Read_UINT8(s, g);
Stream_Read_UINT8(s, r);
suboffset += 11;
- colorBkg = GetColor(clear->format, r, g, b, 0xFF);
+ colorBkg = FreeRDPGetColor(clear->format, r, g, b, 0xFF);
if (xEnd < xStart)
{
Stream_Read_UINT8(s, b);
Stream_Read_UINT8(s, g);
Stream_Read_UINT8(s, r);
- color = GetColor(clear->format, r, g, b, 0xFF);
+ color = FreeRDPGetColor(clear->format, r, g, b, 0xFF);
if (!WriteColor(dstBuffer, clear->format, color))
return FALSE;
BYTE* pDstPixel8 = &pDstData[((nYDstRel + y) * nDstStep) +
((nXDstRel + i) * GetBytesPerPixel(DstFormat))];
UINT32 color = ReadColor(pSrcPixel, clear->format);
- color = ConvertColor(color, clear->format,
+ color = FreeRDPConvertColor(color, clear->format,
DstFormat, NULL);
if (!WriteColor(pDstPixel8, DstFormat, color))
#else
BYTE fill = 0x00;
#endif
- return GetColor(format, fill, fill, fill, 0xFF);
+ return FreeRDPGetColor(format, fill, fill, fill, 0xFF);
}
/**
}
if (!andPixel && !xorPixel)
- color = GetColor(DstFormat, 0, 0, 0, 0xFF); /* black */
+ color = FreeRDPGetColor(DstFormat, 0, 0, 0, 0xFF); /* black */
else if (!andPixel && xorPixel)
- color = GetColor(DstFormat, 0xFF, 0xFF, 0xFF, 0xFF); /* white */
+ color = FreeRDPGetColor(DstFormat, 0xFF, 0xFF, 0xFF, 0xFF); /* white */
else if (andPixel && !xorPixel)
- color = GetColor(DstFormat, 0, 0, 0, 0); /* transparent */
+ color = FreeRDPGetColor(DstFormat, 0, 0, 0, 0); /* transparent */
else if (andPixel && xorPixel)
color = freerdp_image_inverted_pointer_color(x, y, DstFormat); /* inverted */
xorPixel = ReadColor(xorBits, pixelFormat);
}
- xorPixel = ConvertColor(xorPixel,
+ xorPixel = FreeRDPConvertColor(xorPixel,
pixelFormat,
PIXEL_FORMAT_ARGB32,
palette);
xorPixel = freerdp_image_inverted_pointer_color(x, y, PIXEL_FORMAT_ARGB32);
}
- color = ConvertColor(xorPixel, PIXEL_FORMAT_ARGB32,
+ color = FreeRDPConvertColor(xorPixel, PIXEL_FORMAT_ARGB32,
DstFormat, palette);
WriteColor(pDstPixel, DstFormat, color);
pDstPixel += GetBytesPerPixel(DstFormat);
UINT32 dstColor;
UINT32 color = ReadColor(&srcLine[(x + nXSrc) * srcByte],
SrcFormat);
- dstColor = ConvertColor(color, SrcFormat, DstFormat, palette);
+ dstColor = FreeRDPConvertColor(color, SrcFormat, DstFormat, palette);
WriteColor(&dstLine[(x + nXDst) * dstByte], DstFormat, dstColor);
}
}
for (x = 0; x < width; x++)
{
BYTE alpha = *(*ppA)++;
- UINT32 color = GetColor(DstFormat, *(*ppR)++, *(*ppG)++, *(*ppB)++, alpha);
+ UINT32 color = FreeRDPGetColor(DstFormat, *(*ppR)++, *(*ppG)++, *(*ppB)++, alpha);
WriteColor(*ppRgba, DstFormat, color);
*ppRgba += GetBytesPerPixel(DstFormat);
}
for (x = 0; x < width; x++)
{
- UINT32 color = GetColor(DstFormat, *(*ppR)++, *(*ppG)++, *(*ppB)++, alpha);
+ UINT32 color = FreeRDPGetColor(DstFormat, *(*ppR)++, *(*ppG)++, *(*ppB)++, alpha);
WriteColor(*ppRgba, DstFormat, color);
*ppRgba += GetBytesPerPixel(DstFormat);
}
}
else /* NoAlpha */
{
- const UINT32 color = GetColor(TempFormat, 0, 0, 0, 0xFF);
+ const UINT32 color = FreeRDPGetColor(TempFormat, 0, 0, 0, 0xFF);
if (!freerdp_image_fill(pTempData, TempFormat, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight,
color))
srcBitmap, srcFormat, width, height, 0, NULL, &dstSize);
BYTE* decompressedBitmap = (BYTE*) calloc(height, width * GetBytesPerPixel(dstFormat));
printf("%s [%s] --> [%s]: ", __FUNCTION__,
- GetColorFormatName(srcFormat), GetColorFormatName(dstFormat));
+ FreeRDPGetColorFormatName(srcFormat), FreeRDPGetColorFormatName(dstFormat));
fflush(stdout);
printf("TODO: Skipping unfinished test!");
rc = TRUE;
{
UINT32 i, j, x, y;
BOOL rc = FALSE;
- printf("%s: [%s] --> [%s]: ", __FUNCTION__, GetColorFormatName(srcFormat),
- GetColorFormatName(dstFormat));
+ printf("%s: [%s] --> [%s]: ", __FUNCTION__, FreeRDPGetColorFormatName(srcFormat),
+ FreeRDPGetColorFormatName(dstFormat));
fflush(stdout);
for (j = 0; j < 100; j += 8)
{
UINT32 compressedSize;
const UINT32 fill = j;
- const UINT32 color = GetColor(srcFormat, (fill >> 8) & 0xF, (fill >> 4) & 0xF,
+ const UINT32 color = FreeRDPGetColor(srcFormat, (fill >> 8) & 0xF, (fill >> 4) & 0xF,
(fill) & 0xF, 0xFF);
const UINT32 width = i;
const UINT32 height = i;
switch (op)
{
case '0':
- stack[stackp++] = GetColor(format, 0, 0, 0, 0xFF);
+ stack[stackp++] = FreeRDPGetColor(format, 0, 0, 0, 0xFF);
break;
case '1':
- stack[stackp++] = GetColor(format, 0xFF, 0xFF, 0xFF, 0xFF);
+ stack[stackp++] = FreeRDPGetColor(format, 0xFF, 0xFF, 0xFF, 0xFF);
break;
case 'D':
}
colorC = ReadColor(srcp, hdcSrc->format);
- colorC = ConvertColor(colorC, hdcSrc->format, hdcDest->format, palette);
+ colorC = FreeRDPConvertColor(colorC, hdcSrc->format, hdcDest->format, palette);
}
if (usePat)
if (format)
*format = gdi->dstFormat;
- *color = ConvertColor(srcColor, SrcFormat, gdi->dstFormat, &gdi->palette);
+ *color = FreeRDPConvertColor(srcColor, SrcFormat, gdi->dstFormat, &gdi->palette);
return TRUE;
}
{
const PALETTE_ENTRY* pe = &(palette->entries[index]);
gdi->palette.palette[index] =
- GetColor(gdi->dstFormat, pe->red, pe->green, pe->blue, 0xFF);
+ FreeRDPGetColor(gdi->dstFormat, pe->red, pe->green, pe->blue, 0xFF);
}
return TRUE;
gdi->dstFormat = format;
/* default internal buffer format */
WLog_Print(gdi->log, WLOG_INFO, "Local framebuffer format %s",
- GetColorFormatName(gdi->dstFormat));
+ FreeRDPGetColorFormatName(gdi->dstFormat));
WLog_Print(gdi->log, WLOG_INFO, "Remote framebuffer format %s",
- GetColorFormatName(SrcFormat));
+ FreeRDPGetColorFormatName(SrcFormat));
if (!(gdi->hdc = gdi_GetDC()))
goto fail;
WLog_WARN(TAG, "TODO gdi_SurfaceCommand_Alpha: status: %"PRIu32"", status);
/* fill with green for now to distinguish from the rest */
- color = GetColor(surface->format, 0x00, 0xFF, 0x00, 0xFF);
+ color = FreeRDPGetColor(surface->format, 0x00, 0xFF, 0x00, 0xFF);
if (!freerdp_image_fill(surface->data, surface->format, surface->scanline,
cmd->left, cmd->top, cmd->width, cmd->height, color))
"left=%"PRIu32", top=%"PRIu32", right=%"PRIu32", bottom=%"PRIu32", width=%"PRIu32", height=%"PRIu32" "
"length=%"PRIu32", data=%p, extra=%p",
cmd->surfaceId, cmd->codecId, cmd->contextId,
- GetColorFormatName(cmd->format), cmd->left, cmd->top, cmd->right,
+ FreeRDPGetColorFormatName(cmd->format), cmd->left, cmd->top, cmd->right,
cmd->bottom, cmd->width, cmd->height, cmd->length, (void*) cmd->data, (void*) cmd->extra);
switch (cmd->codecId)
/* a = solidFill->fillPixel.XA;
* Ignore alpha channel, this is a solid fill. */
a = 0xFF;
- color = GetColor(surface->format, r, g, b, a);
+ color = FreeRDPGetColor(surface->format, r, g, b, a);
for (index = 0; index < solidFill->fillRectCount; index++)
{
switch (rop)
{
case GDI_R2_BLACK: /* LineTo_BLACK */
- dstPixel = GetColor(format, 0, 0, 0, 0xFF);
+ dstPixel = FreeRDPGetColor(format, 0, 0, 0, 0xFF);
break;
case GDI_R2_NOTMERGEPEN: /* LineTo_NOTMERGEPEN */
break;
case GDI_R2_WHITE: /* LineTo_WHITE */
- dstPixel = GetColor(format, 0xFF, 0xFF, 0xFF, 0xFF);
+ dstPixel = FreeRDPGetColor(format, 0xFF, 0xFF, 0xFF, 0xFF);
break;
default:
INLINE UINT32 gdi_GetPenColor(HGDI_PEN pen, UINT32 format)
{
- return ConvertColor(pen->color, pen->format, format, pen->palette);
+ return FreeRDPConvertColor(pen->color, pen->format, format, pen->palette);
}
else
{
dstColor = ReadColor(patp, hbr->pattern->format);
- dstColor = ConvertColor(dstColor, hbr->pattern->format, hdc->format, NULL);
+ dstColor = FreeRDPConvertColor(dstColor, hbr->pattern->format, hdc->format, NULL);
}
if (dstp)
g.format = DstFormat;
for (x = 0; x < 256; x++)
- g.palette[x] = GetColor(DstFormat, x, x, x, 0xFF);
+ g.palette[x] = FreeRDPGetColor(DstFormat, x, x, x, 0xFF);
if (!(hdcSrc = gdi_GetDC()))
{
if (!test_gdi_BitBlt(formatList[x], formatList[y]))
{
fprintf(stderr, "test_gdi_BitBlt(SrcFormat=%s, DstFormat=%s) failed!\n",
- GetColorFormatName(formatList[x]),
- GetColorFormatName(formatList[y]));
+ FreeRDPGetColorFormatName(formatList[x]),
+ FreeRDPGetColorFormatName(formatList[y]));
rc = -y;
}
}
for (j = 0; j < width; j++)
{
UINT32 pixel;
- const UINT32 color = GetColor(hBitmap->format, rand(), rand(), rand(), rand());
+ const UINT32 color = FreeRDPGetColor(hBitmap->format, rand(), rand(), rand(), rand());
WriteColor(&hBitmap->data[i * hBitmap->scanline + j * bpp], hBitmap->format,
color);
pixel = gdi_GetPixel(hdc, j, i);
for (j = 0; j < width; j++)
{
UINT32 pixel;
- const UINT32 color = GetColor(hBitmap->format, rand(), rand(), rand(), rand());
+ const UINT32 color = FreeRDPGetColor(hBitmap->format, rand(), rand(), rand(), rand());
gdi_SetPixel(hdc, j, i, color);
pixel = ReadColor(&hBitmap->data[i * hBitmap->scanline + j * bpp],
hBitmap->format);
g.format = format;
for (j = 0; j < 256; j++)
- g.palette[i] = GetColor(format, j, j, j, 0xFF);
+ g.palette[i] = FreeRDPGetColor(format, j, j, j, 0xFF);
rc = -1;
g.format = format;
for (i = 0; i < 256; i++)
- g.palette[i] = GetColor(format, i, i, i, 0xFF);
+ g.palette[i] = FreeRDPGetColor(format, i, i, i, 0xFF);
rc = -1;
hdc->format = format;
gdi_SetNullClipRgn(hdc);
- penColor = GetColor(format, 0xFF, 0xFF, 0xFF, 0xFF);
+ penColor = FreeRDPGetColor(format, 0xFF, 0xFF, 0xFF, 0xFF);
if (!(pen = gdi_CreatePen(1, 1, penColor, format, hPalette)))
{
{
char name[1024];
_snprintf(name, sizeof(name), "%s [%s]", gdi_rop_to_string(rop_map[x].rop),
- GetColorFormatName(hdc->format));
+ FreeRDPGetColorFormatName(hdc->format));
/* Test Case 13: (0,0) -> (16,16), R2_NOTMERGEPEN */
if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS, hPalette))
hBitmap = gdi_CreateCompatibleBitmap(hdc, width, height);
ZeroMemory(hBitmap->data, width * height * GetBytesPerPixel(hdc->format));
gdi_SelectObject(hdc, (HGDIOBJECT) hBitmap);
- color = GetColor(PIXEL_FORMAT_ARGB32, 0xAA, 0xBB, 0xCC, 0xFF);
+ color = FreeRDPGetColor(PIXEL_FORMAT_ARGB32, 0xAA, 0xBB, 0xCC, 0xFF);
hBrush = gdi_CreateSolidBrush(color);
gdi_FillRect(hdc, hRect, hBrush);
badPixels = 0;
for (y = 0; y < height; y++)
{
rawPixel = gdi_GetPixel(hdc, x, y);
- pixel = ConvertColor(rawPixel, hdc->format, PIXEL_FORMAT_ARGB32, NULL);
+ pixel = FreeRDPConvertColor(rawPixel, hdc->format, PIXEL_FORMAT_ARGB32, NULL);
if (gdi_PtInRect(hRect, x, y))
{
p2 += GetBytesPerPixel(hBmp2->format);
if (hBmp1->format != hBmp2->format)
- colorB = ConvertColor(colorB, hBmp2->format, hBmp1->format, palette);
+ colorB = FreeRDPConvertColor(colorB, hBmp2->format, hBmp1->format, palette);
if (colorA != colorB)
return FALSE;
static INLINE BYTE* writePixelGeneric(BYTE* dst, DWORD formatSize, UINT32 format,
BYTE R, BYTE G, BYTE B, BYTE A)
{
- UINT32 color = GetColor(format, R, G, B, A);
+ UINT32 color = FreeRDPGetColor(format, R, G, B, A);
WriteColor(dst, format, color);
return dst + formatSize;
}
}
}
- printf("Results for %"PRIu32"x%"PRIu32" [%s]", roi.width, roi.height, GetColorFormatName(DstFormat));
+ printf("Results for %"PRIu32"x%"PRIu32" [%s]", roi.width, roi.height, FreeRDPGetColorFormatName(DstFormat));
PROFILER_PRINT_HEADER;
PROFILER_PRINT(genericProf);
PROFILER_PRINT(optProf);
prim_size_t roi = { 64, 64 };
int rc;
printf("----------------------- GENERIC %s [%"PRIu32"x%"PRIu32"] COMPARE CONTENT ----\n",
- GetColorFormatName(formats[x]), roi.width, roi.height);
+ FreeRDPGetColorFormatName(formats[x]), roi.width, roi.height);
rc = test_PrimitivesYCbCr(generics, formats[x], roi, TRUE);
if (rc != PRIMITIVES_SUCCESS)
return rc;
printf("------------------------- END %s ----------------------\n",
- GetColorFormatName(formats[x]));
+ FreeRDPGetColorFormatName(formats[x]));
printf("---------------------- OPTIMIZED %s [%"PRIu32"x%"PRIu32"] COMPARE CONTENT ----\n",
- GetColorFormatName(formats[x]), roi.width, roi.height);
+ FreeRDPGetColorFormatName(formats[x]), roi.width, roi.height);
rc = test_PrimitivesYCbCr(prims, formats[x], roi, TRUE);
if (rc != PRIMITIVES_SUCCESS)
return rc;
printf("------------------------- END %s ----------------------\n",
- GetColorFormatName(formats[x]));
+ FreeRDPGetColorFormatName(formats[x]));
}
}
/* Do random data conversion with random sizes */
{
int rc;
printf("----------------------- GENERIC %s [%"PRIu32"x%"PRIu32"] COMPARE CONTENT ----\n",
- GetColorFormatName(formats[x]), roi.width, roi.height);
+ FreeRDPGetColorFormatName(formats[x]), roi.width, roi.height);
rc = test_PrimitivesYCbCr(generics, formats[x], roi, FALSE);
if (rc != PRIMITIVES_SUCCESS)
return rc;
printf("------------------------- END %s ----------------------\n",
- GetColorFormatName(formats[x]));
+ FreeRDPGetColorFormatName(formats[x]));
printf("---------------------- OPTIMIZED %s [%"PRIu32"x%"PRIu32"] COMPARE CONTENT ----\n",
- GetColorFormatName(formats[x]), roi.width, roi.height);
+ FreeRDPGetColorFormatName(formats[x]), roi.width, roi.height);
rc = test_PrimitivesYCbCr(prims, formats[x], roi, FALSE);
if (rc != PRIMITIVES_SUCCESS)
return rc;
printf("------------------------- END %s ----------------------\n",
- GetColorFormatName(formats[x]));
+ FreeRDPGetColorFormatName(formats[x]));
}
}
}
{
int rc;
printf("----------------------- GENERIC %s [%"PRIu32"x%"PRIu32"] COMPARE CONTENT ----\n",
- GetColorFormatName(formats[x]), roi.width, roi.height);
+ FreeRDPGetColorFormatName(formats[x]), roi.width, roi.height);
rc = test_PrimitivesYCbCr(generics, formats[x], roi, FALSE);
if (rc != PRIMITIVES_SUCCESS)
return rc;
printf("------------------------- END %s ----------------------\n",
- GetColorFormatName(formats[x]));
+ FreeRDPGetColorFormatName(formats[x]));
printf("---------------------- OPTIMIZED %s [%"PRIu32"x%"PRIu32"] COMPARE CONTENT ----\n",
- GetColorFormatName(formats[x]), roi.width, roi.height);
+ FreeRDPGetColorFormatName(formats[x]), roi.width, roi.height);
rc = test_PrimitivesYCbCr(prims, formats[x], roi, FALSE);
if (rc != PRIMITIVES_SUCCESS)
return rc;
printf("------------------------- END %s ----------------------\n",
- GetColorFormatName(formats[x]));
+ FreeRDPGetColorFormatName(formats[x]));
}
}
{
const UINT32 format = formats[x];
const UINT32 dstStride = width * GetBytesPerPixel(format);
- const char* formatName = GetColorFormatName(format);
+ const char* formatName = FreeRDPGetColorFormatName(format);
PROFILER_CREATE(genericProf, "YCoCgRToRGB_8u_AC4R-GENERIC");
PROFILER_CREATE(optProf, "YCoCgRToRGB_8u_AC4R-OPT");
PROFILER_ENTER(genericProf);
{
pstatus_t rc;
const UINT32 DstFormat = formats[x];
- printf("Testing destination color format %s\n", GetColorFormatName(DstFormat));
+ printf("Testing destination color format %s\n", FreeRDPGetColorFormatName(DstFormat));
PROFILER_CREATE(rgbToYUV420, "RGBToYUV420");
PROFILER_CREATE(rgbToYUV444, "RGBToYUV444");
PROFILER_CREATE(yuv420ToRGB, "YUV420ToRGB");
R = pSrcPixel[2] + pSrcPixel[6] + pSrcPixel[nSrcStep + 2] + pSrcPixel[nSrcStep +
6];
pSrcPixel += 8;
- color = GetColor(DstFormat, R >> 2, G >> 2, B >> 2, 0xFF);
+ color = FreeRDPGetColor(DstFormat, R >> 2, G >> 2, B >> 2, 0xFF);
WriteColor(pDstPixel, DstFormat, color);
pDstPixel += dstBytesPerPixel;
}
CFDictionaryRef opts;
CGDirectDisplayID displayId;
displayId = CGMainDisplayID();
-
subsystem->captureQueue = dispatch_queue_create("mac.shadow.capture", NULL);
keys[0] = (void*) kCGDisplayStreamShowCursor;
values[0] = (void*) kCFBooleanFalse;