|
|
56112c |
From 5e1aa9e1a4ed8ca4119a6e5b4db554af5367784e Mon Sep 17 00:00:00 2001
|
|
|
56112c |
From: Ondrej Holy <oholy@redhat.com>
|
|
|
56112c |
Date: Tue, 3 Oct 2017 09:25:25 +0200
|
|
|
56112c |
Subject: [PATCH 2/2] Fix colors on big endian
|
|
|
56112c |
|
|
|
56112c |
Based on fixes from master:
|
|
|
56112c |
https://github.com/FreeRDP/FreeRDP/pull/4135
|
|
|
56112c |
---
|
|
|
56112c |
client/X11/xf_graphics.c | 31 +++++++++++++++++-
|
|
|
56112c |
client/X11/xfreerdp.c | 4 +++
|
|
|
56112c |
libfreerdp-codec/bitmap.c | 7 ++--
|
|
|
56112c |
libfreerdp-codec/color.c | 83 +++++++++++++++++++++++++++++++++++------------
|
|
|
56112c |
libfreerdp-gdi/16bpp.c | 17 +++++++---
|
|
|
56112c |
libfreerdp-gdi/32bpp.c | 21 +++++++++---
|
|
|
56112c |
6 files changed, 129 insertions(+), 34 deletions(-)
|
|
|
56112c |
|
|
|
56112c |
diff --git a/client/X11/xf_graphics.c b/client/X11/xf_graphics.c
|
|
|
56112c |
index ed5f9bc25..0bd4e9378 100644
|
|
|
56112c |
--- a/client/X11/xf_graphics.c
|
|
|
56112c |
+++ b/client/X11/xf_graphics.c
|
|
|
56112c |
@@ -49,6 +49,8 @@ void xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
|
|
|
56112c |
{
|
|
|
56112c |
image = XCreateImage(xfi->display, xfi->visual, xfi->depth,
|
|
|
56112c |
ZPixmap, 0, (char*) data, bitmap->width, bitmap->height, xfi->scanline_pad, 0);
|
|
|
56112c |
+ image->byte_order = LSBFirst;
|
|
|
56112c |
+ image->bitmap_bit_order = LSBFirst;
|
|
|
56112c |
|
|
|
56112c |
XPutImage(xfi->display, pixmap, xfi->gc, image, 0, 0, 0, 0, bitmap->width, bitmap->height);
|
|
|
56112c |
XFree(image);
|
|
|
56112c |
@@ -89,6 +91,8 @@ void xf_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap)
|
|
|
56112c |
|
|
|
56112c |
image = XCreateImage(xfi->display, xfi->visual, xfi->depth,
|
|
|
56112c |
ZPixmap, 0, (char*) bitmap->data, bitmap->width, bitmap->height, xfi->scanline_pad, 0);
|
|
|
56112c |
+ image->byte_order = LSBFirst;
|
|
|
56112c |
+ image->bitmap_bit_order = LSBFirst;
|
|
|
56112c |
|
|
|
56112c |
XPutImage(xfi->display, xfi->primary, xfi->gc,
|
|
|
56112c |
image, 0, 0, bitmap->left, bitmap->top, width, height);
|
|
|
56112c |
@@ -149,6 +153,13 @@ void xf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, boolean primar
|
|
|
56112c |
|
|
|
56112c |
/* Pointer Class */
|
|
|
56112c |
|
|
|
56112c |
+#define Data_Read_UINT32(_d, _v) do { _v = \
|
|
|
56112c |
+ (uint32)(*((uint8*) _d)) + \
|
|
|
56112c |
+ (((uint32)(*((uint8*) _d + 1))) << 8) + \
|
|
|
56112c |
+ (((uint32)(*((uint8*) _d + 2))) << 16) + \
|
|
|
56112c |
+ (((uint32)(*((uint8*) _d + 3))) << 24); \
|
|
|
56112c |
+} while (0)
|
|
|
56112c |
+
|
|
|
56112c |
void xf_Pointer_New(rdpContext* context, rdpPointer* pointer)
|
|
|
56112c |
{
|
|
|
56112c |
XcursorImage ci;
|
|
|
56112c |
@@ -170,6 +181,25 @@ void xf_Pointer_New(rdpContext* context, rdpPointer* pointer)
|
|
|
56112c |
pointer->width, pointer->height, pointer->xorBpp, xfi->clrconv);
|
|
|
56112c |
}
|
|
|
56112c |
|
|
|
56112c |
+ if (xfi->big_endian)
|
|
|
56112c |
+ {
|
|
|
56112c |
+ int x, y;
|
|
|
56112c |
+ uint32* pixel;
|
|
|
56112c |
+ uint32 value;
|
|
|
56112c |
+
|
|
|
56112c |
+ pixel = (uint32*) ci.pixels;
|
|
|
56112c |
+
|
|
|
56112c |
+ for (y = 0; y < ci.height; y++)
|
|
|
56112c |
+ {
|
|
|
56112c |
+ for (x = 0; x < ci.width; x++)
|
|
|
56112c |
+ {
|
|
|
56112c |
+ Data_Read_UINT32(pixel, value);
|
|
|
56112c |
+ *pixel = value;
|
|
|
56112c |
+ pixel++;
|
|
|
56112c |
+ }
|
|
|
56112c |
+ }
|
|
|
56112c |
+ }
|
|
|
56112c |
+
|
|
|
56112c |
((xfPointer*) pointer)->cursor = XcursorImageLoadCursor(xfi->display, &ci);
|
|
|
56112c |
xfree(ci.pixels);
|
|
|
56112c |
}
|
|
|
56112c |
@@ -209,7 +239,6 @@ void xf_Glyph_New(rdpContext* context, rdpGlyph* glyph)
|
|
|
56112c |
|
|
|
56112c |
image = XCreateImage(xfi->display, xfi->visual, 1,
|
|
|
56112c |
ZPixmap, 0, (char*) glyph->aj, glyph->cx, glyph->cy, 8, scanline);
|
|
|
56112c |
-
|
|
|
56112c |
image->byte_order = MSBFirst;
|
|
|
56112c |
image->bitmap_bit_order = MSBFirst;
|
|
|
56112c |
|
|
|
56112c |
diff --git a/client/X11/xfreerdp.c b/client/X11/xfreerdp.c
|
|
|
56112c |
index 2d0e6704d..786cc0bd8 100644
|
|
|
56112c |
--- a/client/X11/xfreerdp.c
|
|
|
56112c |
+++ b/client/X11/xfreerdp.c
|
|
|
56112c |
@@ -181,6 +181,8 @@ void xf_sw_desktop_resize(rdpContext* context)
|
|
|
56112c |
XDestroyImage(xfi->image);
|
|
|
56112c |
xfi->image = XCreateImage(xfi->display, xfi->visual, xfi->depth, ZPixmap, 0,
|
|
|
56112c |
(char*) gdi->primary_buffer, gdi->width, gdi->height, xfi->scanline_pad, 0);
|
|
|
56112c |
+ xfi->image->byte_order = LSBFirst;
|
|
|
56112c |
+ xfi->image->bitmap_bit_order = LSBFirst;
|
|
|
56112c |
}
|
|
|
56112c |
}
|
|
|
56112c |
}
|
|
|
56112c |
@@ -707,6 +709,8 @@ boolean xf_post_connect(freerdp* instance)
|
|
|
56112c |
|
|
|
56112c |
xfi->image = XCreateImage(xfi->display, xfi->visual, xfi->depth, ZPixmap, 0,
|
|
|
56112c |
(char*) xfi->primary_buffer, xfi->width, xfi->height, xfi->scanline_pad, 0);
|
|
|
56112c |
+ xfi->image->byte_order = LSBFirst;
|
|
|
56112c |
+ xfi->image->bitmap_bit_order = LSBFirst;
|
|
|
56112c |
|
|
|
56112c |
xfi->bmp_codec_none = (uint8*) xmalloc(64 * 64 * 4);
|
|
|
56112c |
|
|
|
56112c |
diff --git a/libfreerdp-codec/bitmap.c b/libfreerdp-codec/bitmap.c
|
|
|
56112c |
index 635a583aa..aafffc39b 100644
|
|
|
56112c |
--- a/libfreerdp-codec/bitmap.c
|
|
|
56112c |
+++ b/libfreerdp-codec/bitmap.c
|
|
|
56112c |
@@ -214,9 +214,10 @@ static uint32 ExtractRunLength(uint32 code, uint8* pbOrderHdr, uint32* advance)
|
|
|
56112c |
#undef WRITEFIRSTLINEFGBGIMAGE
|
|
|
56112c |
#undef RLEDECOMPRESS
|
|
|
56112c |
#undef RLEEXTRA
|
|
|
56112c |
-#define DESTWRITEPIXEL(_buf, _pix) ((uint16*)(_buf))[0] = (uint16)(_pix)
|
|
|
56112c |
-#define DESTREADPIXEL(_pix, _buf) _pix = ((uint16*)(_buf))[0]
|
|
|
56112c |
-#define SRCREADPIXEL(_pix, _buf) _pix = ((uint16*)(_buf))[0]
|
|
|
56112c |
+#define DESTWRITEPIXEL(_buf, _pix) do { (_buf)[0] = (uint8)(_pix); \
|
|
|
56112c |
+ (_buf)[1] = (uint8)((_pix) >> 8); } while (0)
|
|
|
56112c |
+#define DESTREADPIXEL(_pix, _buf) _pix = (_buf)[0] | ((_buf)[1] << 8)
|
|
|
56112c |
+#define SRCREADPIXEL(_pix, _buf) _pix = (_buf)[0] | ((_buf)[1] << 8)
|
|
|
56112c |
#define DESTNEXTPIXEL(_buf) _buf += 2
|
|
|
56112c |
#define SRCNEXTPIXEL(_buf) _buf += 2
|
|
|
56112c |
#define WRITEFGBGIMAGE WriteFgBgImage16to16
|
|
|
56112c |
diff --git a/libfreerdp-codec/color.c b/libfreerdp-codec/color.c
|
|
|
56112c |
index ff3bacb79..dbff7b159 100644
|
|
|
56112c |
--- a/libfreerdp-codec/color.c
|
|
|
56112c |
+++ b/libfreerdp-codec/color.c
|
|
|
56112c |
@@ -25,6 +25,30 @@
|
|
|
56112c |
#include <freerdp/codec/color.h>
|
|
|
56112c |
#include <freerdp/utils/memory.h>
|
|
|
56112c |
|
|
|
56112c |
+#define Data_Read_UINT32(_d, _v) do { _v = \
|
|
|
56112c |
+ (uint32)(*((uint8*) _d)) + \
|
|
|
56112c |
+ (((uint32)(*((uint8*) _d + 1))) << 8) + \
|
|
|
56112c |
+ (((uint32)(*((uint8*) _d + 2))) << 16) + \
|
|
|
56112c |
+ (((uint32)(*((uint8*) _d + 3))) << 24); \
|
|
|
56112c |
+} while (0)
|
|
|
56112c |
+
|
|
|
56112c |
+#define Data_Write_UINT32(_d, _v) do { \
|
|
|
56112c |
+ *((uint8*) _d) = (_v) & 0xFF; \
|
|
|
56112c |
+ *((uint8*) _d + 1) = ((_v) >> 8) & 0xFF; \
|
|
|
56112c |
+ *((uint8*) _d + 2) = ((_v) >> 16) & 0xFF; \
|
|
|
56112c |
+ *((uint8*) _d + 3) = ((_v) >> 24) & 0xFF; \
|
|
|
56112c |
+} while (0)
|
|
|
56112c |
+
|
|
|
56112c |
+#define Data_Read_UINT16(_d, _v) do { _v = \
|
|
|
56112c |
+ (uint16)(*((uint8*) _d)) + \
|
|
|
56112c |
+ (((uint16)(*((uint8*) _d + 1))) << 8); \
|
|
|
56112c |
+} while (0)
|
|
|
56112c |
+
|
|
|
56112c |
+#define Data_Write_UINT16(_d, _v) do { \
|
|
|
56112c |
+ *((uint8*) _d) = (_v) & 0xFF; \
|
|
|
56112c |
+ *((uint8*) _d + 1) = ((_v) >> 8) & 0xFF; \
|
|
|
56112c |
+} while (0)
|
|
|
56112c |
+
|
|
|
56112c |
int freerdp_get_pixel(uint8 * data, int x, int y, int width, int height, int bpp)
|
|
|
56112c |
{
|
|
|
56112c |
int start;
|
|
|
56112c |
@@ -32,6 +56,7 @@ int freerdp_get_pixel(uint8 * data, int x, int y, int width, int height, int bpp
|
|
|
56112c |
uint16 *src16;
|
|
|
56112c |
uint32 *src32;
|
|
|
56112c |
int red, green, blue;
|
|
|
56112c |
+ uint32 pixel;
|
|
|
56112c |
|
|
|
56112c |
switch (bpp)
|
|
|
56112c |
{
|
|
|
56112c |
@@ -45,7 +70,9 @@ int freerdp_get_pixel(uint8 * data, int x, int y, int width, int height, int bpp
|
|
|
56112c |
case 15:
|
|
|
56112c |
case 16:
|
|
|
56112c |
src16 = (uint16*) data;
|
|
|
56112c |
- return src16[y * width + x];
|
|
|
56112c |
+ src16 += y * width + x;
|
|
|
56112c |
+ Data_Read_UINT16 (src16, pixel);
|
|
|
56112c |
+ return pixel;
|
|
|
56112c |
case 24:
|
|
|
56112c |
data += y * width * 3;
|
|
|
56112c |
data += x * 3;
|
|
|
56112c |
@@ -55,7 +82,9 @@ int freerdp_get_pixel(uint8 * data, int x, int y, int width, int height, int bpp
|
|
|
56112c |
return RGB24(red, green, blue);
|
|
|
56112c |
case 32:
|
|
|
56112c |
src32 = (uint32*) data;
|
|
|
56112c |
- return src32[y * width + x];
|
|
|
56112c |
+ src32 += y * width + x;
|
|
|
56112c |
+ Data_Read_UINT32 (src32, pixel);
|
|
|
56112c |
+ return pixel;
|
|
|
56112c |
default:
|
|
|
56112c |
break;
|
|
|
56112c |
}
|
|
|
56112c |
@@ -82,7 +111,8 @@ void freerdp_set_pixel(uint8* data, int x, int y, int width, int height, int bpp
|
|
|
56112c |
else if (bpp == 32)
|
|
|
56112c |
{
|
|
|
56112c |
dst32 = (int*) data;
|
|
|
56112c |
- dst32[y * width + x] = pixel;
|
|
|
56112c |
+ dst32 += y * width + x;
|
|
|
56112c |
+ Data_Write_UINT32 (dst32, pixel);
|
|
|
56112c |
}
|
|
|
56112c |
}
|
|
|
56112c |
|
|
|
56112c |
@@ -383,7 +413,7 @@ uint8* freerdp_image_convert_8bpp(uint8* srcData, uint8* dstData, int width, int
|
|
|
56112c |
green = clrconv->palette->entries[pixel].green;
|
|
|
56112c |
blue = clrconv->palette->entries[pixel].blue;
|
|
|
56112c |
pixel = (clrconv->invert) ? BGR15(red, green, blue) : RGB15(red, green, blue);
|
|
|
56112c |
- *dst16 = pixel;
|
|
|
56112c |
+ Data_Write_UINT16 (dst16, pixel);
|
|
|
56112c |
dst16++;
|
|
|
56112c |
}
|
|
|
56112c |
return dstData;
|
|
|
56112c |
@@ -402,7 +432,7 @@ uint8* freerdp_image_convert_8bpp(uint8* srcData, uint8* dstData, int width, int
|
|
|
56112c |
green = clrconv->palette->entries[pixel].green;
|
|
|
56112c |
blue = clrconv->palette->entries[pixel].blue;
|
|
|
56112c |
pixel = (clrconv->invert) ? BGR16(red, green, blue) : RGB16(red, green, blue);
|
|
|
56112c |
- *dst16 = pixel;
|
|
|
56112c |
+ Data_Write_UINT16 (dst16, pixel);
|
|
|
56112c |
dst16++;
|
|
|
56112c |
}
|
|
|
56112c |
return dstData;
|
|
|
56112c |
@@ -422,7 +452,7 @@ uint8* freerdp_image_convert_8bpp(uint8* srcData, uint8* dstData, int width, int
|
|
|
56112c |
green = clrconv->palette->entries[pixel].green;
|
|
|
56112c |
blue = clrconv->palette->entries[pixel].blue;
|
|
|
56112c |
pixel = (clrconv->invert) ? RGB32(red, green, blue) : BGR32(red, green, blue);
|
|
|
56112c |
- *dst32 = pixel;
|
|
|
56112c |
+ Data_Write_UINT32 (dst32, pixel);
|
|
|
56112c |
dst32++;
|
|
|
56112c |
}
|
|
|
56112c |
return dstData;
|
|
|
56112c |
@@ -460,11 +490,11 @@ uint8* freerdp_image_convert_15bpp(uint8* srcData, uint8* dstData, int width, in
|
|
|
56112c |
dst32 = (uint32 *) dstData;
|
|
|
56112c |
for (i = width * height; i > 0; i--)
|
|
|
56112c |
{
|
|
|
56112c |
- pixel = *src16;
|
|
|
56112c |
+ Data_Read_UINT16 (src16, pixel);
|
|
|
56112c |
src16++;
|
|
|
56112c |
GetBGR15(red, green, blue, pixel);
|
|
|
56112c |
pixel = (clrconv->invert) ? RGB32(red, green, blue) : BGR32(red, green, blue);
|
|
|
56112c |
- *dst32 = pixel;
|
|
|
56112c |
+ Data_Write_UINT32 (dst32, pixel);
|
|
|
56112c |
dst32++;
|
|
|
56112c |
}
|
|
|
56112c |
return dstData;
|
|
|
56112c |
@@ -478,12 +508,12 @@ uint8* freerdp_image_convert_15bpp(uint8* srcData, uint8* dstData, int width, in
|
|
|
56112c |
dst16 = (uint16 *) dstData;
|
|
|
56112c |
for (i = width * height; i > 0; i--)
|
|
|
56112c |
{
|
|
|
56112c |
- pixel = *src16;
|
|
|
56112c |
+ Data_Read_UINT16 (src16, pixel);
|
|
|
56112c |
src16++;
|
|
|
56112c |
GetRGB_555(red, green, blue, pixel);
|
|
|
56112c |
RGB_555_565(red, green, blue);
|
|
|
56112c |
pixel = (clrconv->invert) ? BGR565(red, green, blue) : RGB565(red, green, blue);
|
|
|
56112c |
- *dst16 = pixel;
|
|
|
56112c |
+ Data_Write_UINT16 (dst16, pixel);
|
|
|
56112c |
dst16++;
|
|
|
56112c |
}
|
|
|
56112c |
return dstData;
|
|
|
56112c |
@@ -508,12 +538,15 @@ uint8* freerdp_image_convert_16bpp(uint8* srcData, uint8* dstData, int width, in
|
|
|
56112c |
uint8 red, green, blue;
|
|
|
56112c |
uint16* src16 = (uint16 *) srcData;
|
|
|
56112c |
uint16* dst16 = (uint16 *) dstData;
|
|
|
56112c |
+ uint32 pixel;
|
|
|
56112c |
|
|
|
56112c |
for (i = width * height; i > 0; i--)
|
|
|
56112c |
{
|
|
|
56112c |
- GetRGB_565(red, green, blue, (*src16));
|
|
|
56112c |
+ Data_Read_UINT16 (src16, pixel);
|
|
|
56112c |
+ GetRGB_565(red, green, blue, pixel);
|
|
|
56112c |
RGB_565_555(red, green, blue);
|
|
|
56112c |
- (*dst16) = (clrconv->invert) ? BGR555(red, green, blue) : RGB555(red, green, blue);
|
|
|
56112c |
+ pixel = (clrconv->invert) ? BGR555(red, green, blue) : RGB555(red, green, blue);
|
|
|
56112c |
+ Data_Write_UINT16 (dst16, pixel);
|
|
|
56112c |
src16++;
|
|
|
56112c |
dst16++;
|
|
|
56112c |
}
|
|
|
56112c |
@@ -531,6 +564,7 @@ uint8* freerdp_image_convert_16bpp(uint8* srcData, uint8* dstData, int width, in
|
|
|
56112c |
uint8 *dst8;
|
|
|
56112c |
uint16 *src16;
|
|
|
56112c |
uint8 red, green, blue;
|
|
|
56112c |
+ uint32 pixel;
|
|
|
56112c |
|
|
|
56112c |
if (dstData == NULL)
|
|
|
56112c |
dstData = (uint8*) malloc(width * height * 3);
|
|
|
56112c |
@@ -540,7 +574,8 @@ uint8* freerdp_image_convert_16bpp(uint8* srcData, uint8* dstData, int width, in
|
|
|
56112c |
|
|
|
56112c |
for (i = width * height; i > 0; i--)
|
|
|
56112c |
{
|
|
|
56112c |
- GetBGR16(red, green, blue, *src16);
|
|
|
56112c |
+ Data_Read_UINT16 (src16, pixel);
|
|
|
56112c |
+ GetBGR16(red, green, blue, pixel);
|
|
|
56112c |
src16++;
|
|
|
56112c |
|
|
|
56112c |
if (clrconv->invert)
|
|
|
56112c |
@@ -574,11 +609,11 @@ uint8* freerdp_image_convert_16bpp(uint8* srcData, uint8* dstData, int width, in
|
|
|
56112c |
|
|
|
56112c |
for (i = width * height; i > 0; i--)
|
|
|
56112c |
{
|
|
|
56112c |
- pixel = *src16;
|
|
|
56112c |
+ Data_Read_UINT16 (src16, pixel);
|
|
|
56112c |
src16++;
|
|
|
56112c |
GetBGR16(red, green, blue, pixel);
|
|
|
56112c |
pixel = (clrconv->invert) ? RGB32(red, green, blue) : BGR32(red, green, blue);
|
|
|
56112c |
- *dst32 = pixel;
|
|
|
56112c |
+ Data_Write_UINT32 (dst32, pixel);
|
|
|
56112c |
dst32++;
|
|
|
56112c |
}
|
|
|
56112c |
return dstData;
|
|
|
56112c |
@@ -619,6 +654,7 @@ uint8* freerdp_image_convert_32bpp(uint8* srcData, uint8* dstData, int width, in
|
|
|
56112c |
uint16 *dst16;
|
|
|
56112c |
uint32 *src32;
|
|
|
56112c |
uint8 red, green, blue;
|
|
|
56112c |
+ uint32 pixel;
|
|
|
56112c |
|
|
|
56112c |
if (dstData == NULL)
|
|
|
56112c |
dstData = (uint8*) malloc(width * height * 2);
|
|
|
56112c |
@@ -628,8 +664,10 @@ uint8* freerdp_image_convert_32bpp(uint8* srcData, uint8* dstData, int width, in
|
|
|
56112c |
|
|
|
56112c |
for (index = 0; index < width * height; index++)
|
|
|
56112c |
{
|
|
|
56112c |
- GetBGR32(blue, green, red, *src32);
|
|
|
56112c |
- *dst16 = (clrconv->invert) ? BGR16(red, green, blue) : RGB16(red, green, blue);
|
|
|
56112c |
+ Data_Read_UINT32 (src32, pixel);
|
|
|
56112c |
+ GetBGR32(blue, green, red, pixel);
|
|
|
56112c |
+ pixel = (clrconv->invert) ? BGR16(red, green, blue) : RGB16(red, green, blue);
|
|
|
56112c |
+ Data_Write_UINT16 (dst16, pixel);
|
|
|
56112c |
src32++;
|
|
|
56112c |
dst16++;
|
|
|
56112c |
}
|
|
|
56112c |
@@ -878,6 +916,7 @@ uint8* freerdp_mono_image_convert(uint8* srcData, int width, int height, int src
|
|
|
56112c |
int bitIndex;
|
|
|
56112c |
uint8 redBg, greenBg, blueBg;
|
|
|
56112c |
uint8 redFg, greenFg, blueFg;
|
|
|
56112c |
+ uint32 pixel;
|
|
|
56112c |
|
|
|
56112c |
switch (srcBpp)
|
|
|
56112c |
{
|
|
|
56112c |
@@ -941,12 +980,13 @@ uint8* freerdp_mono_image_convert(uint8* srcData, int width, int height, int src
|
|
|
56112c |
{
|
|
|
56112c |
if ((bitMask >> bitIndex) & 0x01)
|
|
|
56112c |
{
|
|
|
56112c |
- *dst16 = bgcolor;
|
|
|
56112c |
+ pixel = bgcolor;
|
|
|
56112c |
}
|
|
|
56112c |
else
|
|
|
56112c |
{
|
|
|
56112c |
- *dst16 = fgcolor;
|
|
|
56112c |
+ pixel = fgcolor;
|
|
|
56112c |
}
|
|
|
56112c |
+ Data_Write_UINT16 (dst16, pixel);
|
|
|
56112c |
dst16++;
|
|
|
56112c |
}
|
|
|
56112c |
srcData++;
|
|
|
56112c |
@@ -967,12 +1007,13 @@ uint8* freerdp_mono_image_convert(uint8* srcData, int width, int height, int src
|
|
|
56112c |
{
|
|
|
56112c |
if ((bitMask >> bitIndex) & 0x01)
|
|
|
56112c |
{
|
|
|
56112c |
- *dst32 = (clrconv->invert) ? BGR32(redBg, greenBg, blueBg) : RGB32(redBg, greenBg, blueBg);
|
|
|
56112c |
+ pixel = (clrconv->invert) ? BGR32(redBg, greenBg, blueBg) : RGB32(redBg, greenBg, blueBg);
|
|
|
56112c |
}
|
|
|
56112c |
else
|
|
|
56112c |
{
|
|
|
56112c |
- *dst32 = (clrconv->invert) ? BGR32(redFg, greenFg, blueFg) : RGB32(redFg, greenFg, blueFg);
|
|
|
56112c |
+ pixel = (clrconv->invert) ? BGR32(redFg, greenFg, blueFg) : RGB32(redFg, greenFg, blueFg);
|
|
|
56112c |
}
|
|
|
56112c |
+ Data_Write_UINT32 (dst32, pixel);
|
|
|
56112c |
dst32++;
|
|
|
56112c |
}
|
|
|
56112c |
srcData++;
|
|
|
56112c |
diff --git a/libfreerdp-gdi/16bpp.c b/libfreerdp-gdi/16bpp.c
|
|
|
56112c |
index 1b2a2e65d..dd52060ce 100644
|
|
|
56112c |
--- a/libfreerdp-gdi/16bpp.c
|
|
|
56112c |
+++ b/libfreerdp-gdi/16bpp.c
|
|
|
56112c |
@@ -66,6 +66,11 @@ uint16 gdi_get_color_16bpp(HGDI_DC hdc, GDI_COLOR color)
|
|
|
56112c |
return color16;
|
|
|
56112c |
}
|
|
|
56112c |
|
|
|
56112c |
+#define Data_Write_UINT16(_d, _v) do { \
|
|
|
56112c |
+ *((uint8*) _d) = (_v) & 0xFF; \
|
|
|
56112c |
+ *((uint8*) _d + 1) = ((_v) >> 8) & 0xFF; \
|
|
|
56112c |
+} while (0)
|
|
|
56112c |
+
|
|
|
56112c |
int FillRect_16bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr)
|
|
|
56112c |
{
|
|
|
56112c |
int x, y;
|
|
|
56112c |
@@ -90,7 +95,7 @@ int FillRect_16bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr)
|
|
|
56112c |
{
|
|
|
56112c |
for (x = 0; x < nWidth; x++)
|
|
|
56112c |
{
|
|
|
56112c |
- *dstp = color16;
|
|
|
56112c |
+ Data_Write_UINT16(dstp, color16);
|
|
|
56112c |
dstp++;
|
|
|
56112c |
}
|
|
|
56112c |
}
|
|
|
56112c |
@@ -373,11 +378,13 @@ static int BitBlt_DSPDxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
|
|
|
56112c |
uint16 src16;
|
|
|
56112c |
uint16 color16;
|
|
|
56112c |
HGDI_BITMAP hSrcBmp;
|
|
|
56112c |
+ uint16 pat;
|
|
|
56112c |
|
|
|
56112c |
/* D = (S & P) | (~S & D) */
|
|
|
56112c |
/* DSPDxax, used to draw glyphs */
|
|
|
56112c |
|
|
|
56112c |
color16 = gdi_get_color_16bpp(hdcDest, hdcDest->textColor);
|
|
|
56112c |
+ Data_Write_UINT16(&pat, color16);
|
|
|
56112c |
|
|
|
56112c |
hSrcBmp = (HGDI_BITMAP) hdcSrc->selectedObject;
|
|
|
56112c |
|
|
|
56112c |
@@ -397,7 +404,7 @@ static int BitBlt_DSPDxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
|
|
|
56112c |
for (x = 0; x < nWidth; x++)
|
|
|
56112c |
{
|
|
|
56112c |
src16 = (*srcp << 8) | *srcp;
|
|
|
56112c |
- *dstp = (src16 & color16) | (~src16 & *dstp);
|
|
|
56112c |
+ *dstp = (src16 & pat) | (~src16 & *dstp);
|
|
|
56112c |
srcp++;
|
|
|
56112c |
dstp++;
|
|
|
56112c |
}
|
|
|
56112c |
@@ -580,7 +587,7 @@ static int BitBlt_PATCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
|
|
|
56112c |
{
|
|
|
56112c |
for (x = 0; x < nWidth; x++)
|
|
|
56112c |
{
|
|
|
56112c |
- *dstp = color16;
|
|
|
56112c |
+ Data_Write_UINT16(dstp, color16);
|
|
|
56112c |
dstp++;
|
|
|
56112c |
}
|
|
|
56112c |
}
|
|
|
56112c |
@@ -613,10 +620,12 @@ static int BitBlt_PATINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
|
|
|
56112c |
uint16* dstp;
|
|
|
56112c |
uint16* patp;
|
|
|
56112c |
uint16 color16;
|
|
|
56112c |
+ uint16 pat;
|
|
|
56112c |
|
|
|
56112c |
if (hdcDest->brush->style == GDI_BS_SOLID)
|
|
|
56112c |
{
|
|
|
56112c |
color16 = gdi_get_color_16bpp(hdcDest, hdcDest->brush->color);
|
|
|
56112c |
+ Data_Write_UINT16(&pat, color16);
|
|
|
56112c |
|
|
|
56112c |
for (y = 0; y < nHeight; y++)
|
|
|
56112c |
{
|
|
|
56112c |
@@ -626,7 +635,7 @@ static int BitBlt_PATINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
|
|
|
56112c |
{
|
|
|
56112c |
for (x = 0; x < nWidth; x++)
|
|
|
56112c |
{
|
|
|
56112c |
- *dstp ^= color16;
|
|
|
56112c |
+ *dstp ^= pat;
|
|
|
56112c |
dstp++;
|
|
|
56112c |
}
|
|
|
56112c |
}
|
|
|
56112c |
diff --git a/libfreerdp-gdi/32bpp.c b/libfreerdp-gdi/32bpp.c
|
|
|
56112c |
index 5e946b0d5..536a7f57b 100644
|
|
|
56112c |
--- a/libfreerdp-gdi/32bpp.c
|
|
|
56112c |
+++ b/libfreerdp-gdi/32bpp.c
|
|
|
56112c |
@@ -53,6 +53,13 @@ uint32 gdi_get_color_32bpp(HGDI_DC hdc, GDI_COLOR color)
|
|
|
56112c |
return color32;
|
|
|
56112c |
}
|
|
|
56112c |
|
|
|
56112c |
+#define Data_Write_UINT32(_d, _v) do { \
|
|
|
56112c |
+ *((uint8*) _d) = (_v) & 0xFF; \
|
|
|
56112c |
+ *((uint8*) _d + 1) = ((_v) >> 8) & 0xFF; \
|
|
|
56112c |
+ *((uint8*) _d + 2) = ((_v) >> 16) & 0xFF; \
|
|
|
56112c |
+ *((uint8*) _d + 3) = ((_v) >> 24) & 0xFF; \
|
|
|
56112c |
+} while (0)
|
|
|
56112c |
+
|
|
|
56112c |
int FillRect_32bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr)
|
|
|
56112c |
{
|
|
|
56112c |
int x, y;
|
|
|
56112c |
@@ -76,7 +83,7 @@ int FillRect_32bpp(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr)
|
|
|
56112c |
{
|
|
|
56112c |
for (x = 0; x < nWidth; x++)
|
|
|
56112c |
{
|
|
|
56112c |
- *dstp = color32;
|
|
|
56112c |
+ Data_Write_UINT32(dstp, color32);
|
|
|
56112c |
dstp++;
|
|
|
56112c |
}
|
|
|
56112c |
}
|
|
|
56112c |
@@ -390,11 +397,13 @@ static int BitBlt_DSPDxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
|
|
|
56112c |
uint8* patp;
|
|
|
56112c |
uint32 color32;
|
|
|
56112c |
HGDI_BITMAP hSrcBmp;
|
|
|
56112c |
+ uint32 pat;
|
|
|
56112c |
|
|
|
56112c |
/* D = (S & P) | (~S & D) */
|
|
|
56112c |
/* DSPDxax, used to draw glyphs */
|
|
|
56112c |
|
|
|
56112c |
color32 = gdi_get_color_32bpp(hdcDest, hdcDest->textColor);
|
|
|
56112c |
+ Data_Write_UINT32(&pat, color32);
|
|
|
56112c |
|
|
|
56112c |
hSrcBmp = (HGDI_BITMAP) hdcSrc->selectedObject;
|
|
|
56112c |
srcp = hSrcBmp->data;
|
|
|
56112c |
@@ -414,7 +423,7 @@ static int BitBlt_DSPDxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
|
|
|
56112c |
{
|
|
|
56112c |
for (x = 0; x < nWidth; x++)
|
|
|
56112c |
{
|
|
|
56112c |
- patp = (uint8*) &color32;
|
|
|
56112c |
+ patp = (uint8*) &pat;
|
|
|
56112c |
|
|
|
56112c |
*dstp = (*srcp & *patp) | (~(*srcp) & *dstp);
|
|
|
56112c |
dstp++;
|
|
|
56112c |
@@ -609,7 +618,7 @@ static int BitBlt_PATCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
|
|
|
56112c |
{
|
|
|
56112c |
for (x = 0; x < nWidth; x++)
|
|
|
56112c |
{
|
|
|
56112c |
- *dstp = color32;
|
|
|
56112c |
+ Data_Write_UINT32(dstp, color32);
|
|
|
56112c |
dstp++;
|
|
|
56112c |
}
|
|
|
56112c |
}
|
|
|
56112c |
@@ -642,10 +651,12 @@ static int BitBlt_PATINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
|
|
|
56112c |
uint32* dstp;
|
|
|
56112c |
uint32* patp;
|
|
|
56112c |
uint32 color32;
|
|
|
56112c |
-
|
|
|
56112c |
+ uint32 pat;
|
|
|
56112c |
+
|
|
|
56112c |
if (hdcDest->brush->style == GDI_BS_SOLID)
|
|
|
56112c |
{
|
|
|
56112c |
color32 = gdi_get_color_32bpp(hdcDest, hdcDest->brush->color);
|
|
|
56112c |
+ Data_Write_UINT32(&pat, color32);
|
|
|
56112c |
|
|
|
56112c |
for (y = 0; y < nHeight; y++)
|
|
|
56112c |
{
|
|
|
56112c |
@@ -655,7 +666,7 @@ static int BitBlt_PATINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int n
|
|
|
56112c |
{
|
|
|
56112c |
for (x = 0; x < nWidth; x++)
|
|
|
56112c |
{
|
|
|
56112c |
- *dstp ^= color32;
|
|
|
56112c |
+ *dstp ^= pat;
|
|
|
56112c |
dstp++;
|
|
|
56112c |
}
|
|
|
56112c |
}
|
|
|
56112c |
--
|
|
|
56112c |
2.14.2
|
|
|
56112c |
|