GUACAMOLE-249: Use ReadColor() / WriteColor() around FreeRDPConvertColor().
The latter expects color input to be in an intermediate representation resulting from using ReadColor(), and produces color output which cannot be used until converted back with WriteColor().
This commit is contained in:
parent
e325dbc672
commit
a54a12362c
@ -45,11 +45,23 @@ UINT32 guac_rdp_get_native_pixel_format(BOOL alpha) {
|
|||||||
UINT32 guac_rdp_convert_color(rdpContext* context, UINT32 color) {
|
UINT32 guac_rdp_convert_color(rdpContext* context, UINT32 color) {
|
||||||
|
|
||||||
int depth = guac_rdp_get_depth(context->instance);
|
int depth = guac_rdp_get_depth(context->instance);
|
||||||
|
int src_format = gdi_get_pixel_format(depth);
|
||||||
|
int dst_format = guac_rdp_get_native_pixel_format(TRUE);
|
||||||
rdpGdi* gdi = context->gdi;
|
rdpGdi* gdi = context->gdi;
|
||||||
|
|
||||||
/* Convert given color to ARGB32 */
|
/* Convert provided color into the intermediate representation expected by
|
||||||
return FreeRDPConvertColor(color, gdi_get_pixel_format(depth),
|
* FreeRDPConvertColor() */
|
||||||
guac_rdp_get_native_pixel_format(TRUE), &gdi->palette);
|
UINT32 intermed = ReadColor((BYTE*) &color, src_format);
|
||||||
|
|
||||||
|
/* Convert color from RDP source format to the native format used by Cairo,
|
||||||
|
* still maintaining intermediate representation */
|
||||||
|
intermed = FreeRDPConvertColor(intermed, src_format, dst_format,
|
||||||
|
&gdi->palette);
|
||||||
|
|
||||||
|
/* Convert color from intermediate representation to the actual desired
|
||||||
|
* format */
|
||||||
|
WriteColor((BYTE*) &color, dst_format, intermed);
|
||||||
|
return color;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user