summaryrefslogtreecommitdiffstats
path: root/server/shadow/shadow_subsystem.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:25:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 01:25:11 +0000
commit941f9937e0744d18de4cc0afa71e0caa925d82ac (patch)
tree67872b86dbf72d73e91188bf8de12594668fe4aa /server/shadow/shadow_subsystem.c
parentAdding upstream version 3.3.0+dfsg1. (diff)
downloadfreerdp3-941f9937e0744d18de4cc0afa71e0caa925d82ac.tar.xz
freerdp3-941f9937e0744d18de4cc0afa71e0caa925d82ac.zip
Adding upstream version 3.5.0+dfsg1.upstream/3.5.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'server/shadow/shadow_subsystem.c')
-rw-r--r--server/shadow/shadow_subsystem.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/server/shadow/shadow_subsystem.c b/server/shadow/shadow_subsystem.c
index ca73c72..bbdb568 100644
--- a/server/shadow/shadow_subsystem.c
+++ b/server/shadow/shadow_subsystem.c
@@ -190,20 +190,23 @@ UINT32 shadow_enum_monitors(MONITOR_DEF* monitors, UINT32 maxMonitors)
* Caller should free the andMaskData and xorMaskData later.
*/
int shadow_subsystem_pointer_convert_alpha_pointer_data(
- BYTE* pixels, BOOL premultiplied, UINT32 width, UINT32 height,
+ const BYTE* WINPR_RESTRICT pixels, BOOL premultiplied, UINT32 width, UINT32 height,
+ SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE* WINPR_RESTRICT pointerColor)
+{
+ return shadow_subsystem_pointer_convert_alpha_pointer_data_to_format(
+ pixels, PIXEL_FORMAT_BGRX32, premultiplied, width, height, pointerColor);
+}
+
+int shadow_subsystem_pointer_convert_alpha_pointer_data_to_format(
+ const BYTE* pixels, UINT32 format, BOOL premultiplied, UINT32 width, UINT32 height,
SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE* pointerColor)
{
- BYTE* pSrc8 = NULL;
- BYTE* pDst8 = NULL;
UINT32 xorStep = 0;
UINT32 andStep = 0;
UINT32 andBit = 0;
BYTE* andBits = NULL;
UINT32 andPixel = 0;
- BYTE A = 0;
- BYTE R = 0;
- BYTE G = 0;
- BYTE B = 0;
+ const size_t bpp = FreeRDPGetBytesPerPixel(format);
xorStep = (width * 3);
xorStep += (xorStep % 2);
@@ -227,20 +230,23 @@ int shadow_subsystem_pointer_convert_alpha_pointer_data(
return -1;
}
- for (UINT32 y = 0; y < height; y++)
+ for (size_t y = 0; y < height; y++)
{
- pSrc8 = &pixels[(width * 4) * (height - 1 - y)];
- pDst8 = &(pointerColor->xorMaskData[y * xorStep]);
+ const BYTE* pSrc8 = &pixels[(width * bpp) * (height - 1 - y)];
+ BYTE* pDst8 = &(pointerColor->xorMaskData[y * xorStep]);
andBit = 0x80;
andBits = &(pointerColor->andMaskData[andStep * y]);
- for (UINT32 x = 0; x < width; x++)
+ for (size_t x = 0; x < width; x++)
{
- B = *pSrc8++;
- G = *pSrc8++;
- R = *pSrc8++;
- A = *pSrc8++;
+ BYTE B = 0;
+ BYTE G = 0;
+ BYTE R = 0;
+ BYTE A = 0;
+
+ const UINT32 color = FreeRDPReadColor(&pSrc8[x * bpp], format);
+ FreeRDPSplitColor(color, format, &R, &G, &B, &A, NULL);
andPixel = 0;