@@ -190,20 +190,23 @@ UINT32 shadow_enum_monitors(MONITOR_DEF* monitors, UINT32 maxMonitors)
190
190
* Caller should free the andMaskData and xorMaskData later.
191
191
*/
192
192
int shadow_subsystem_pointer_convert_alpha_pointer_data (
193
- BYTE * pixels , BOOL premultiplied , UINT32 width , UINT32 height ,
193
+ const BYTE * WINPR_RESTRICT pixels , BOOL premultiplied , UINT32 width , UINT32 height ,
194
+ SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE * WINPR_RESTRICT pointerColor )
195
+ {
196
+ return shadow_subsystem_pointer_convert_alpha_pointer_data_to_format (
197
+ pixels , PIXEL_FORMAT_BGRX32 , premultiplied , width , height , pointerColor );
198
+ }
199
+
200
+ int shadow_subsystem_pointer_convert_alpha_pointer_data_to_format (
201
+ const BYTE * pixels , UINT32 format , BOOL premultiplied , UINT32 width , UINT32 height ,
194
202
SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE * pointerColor )
195
203
{
196
- BYTE * pSrc8 = NULL ;
197
- BYTE * pDst8 = NULL ;
198
204
UINT32 xorStep = 0 ;
199
205
UINT32 andStep = 0 ;
200
206
UINT32 andBit = 0 ;
201
207
BYTE * andBits = NULL ;
202
208
UINT32 andPixel = 0 ;
203
- BYTE A = 0 ;
204
- BYTE R = 0 ;
205
- BYTE G = 0 ;
206
- BYTE B = 0 ;
209
+ const size_t bpp = FreeRDPGetBytesPerPixel (format );
207
210
208
211
xorStep = (width * 3 );
209
212
xorStep += (xorStep % 2 );
@@ -227,20 +230,23 @@ int shadow_subsystem_pointer_convert_alpha_pointer_data(
227
230
return -1 ;
228
231
}
229
232
230
- for (UINT32 y = 0 ; y < height ; y ++ )
233
+ for (size_t y = 0 ; y < height ; y ++ )
231
234
{
232
- pSrc8 = & pixels [(width * 4 ) * (height - 1 - y )];
233
- pDst8 = & (pointerColor -> xorMaskData [y * xorStep ]);
235
+ const BYTE * pSrc8 = & pixels [(width * bpp ) * (height - 1 - y )];
236
+ BYTE * pDst8 = & (pointerColor -> xorMaskData [y * xorStep ]);
234
237
235
238
andBit = 0x80 ;
236
239
andBits = & (pointerColor -> andMaskData [andStep * y ]);
237
240
238
- for (UINT32 x = 0 ; x < width ; x ++ )
241
+ for (size_t x = 0 ; x < width ; x ++ )
239
242
{
240
- B = * pSrc8 ++ ;
241
- G = * pSrc8 ++ ;
242
- R = * pSrc8 ++ ;
243
- A = * pSrc8 ++ ;
243
+ BYTE B = 0 ;
244
+ BYTE G = 0 ;
245
+ BYTE R = 0 ;
246
+ BYTE A = 0 ;
247
+
248
+ const UINT32 color = FreeRDPReadColor (& pSrc8 [x * bpp ], format );
249
+ FreeRDPSplitColor (color , format , & R , & G , & B , & A , NULL );
244
250
245
251
andPixel = 0 ;
246
252
0 commit comments