|
|
@ -298,6 +298,7 @@ rdpCapture0(RegionPtr in_reg, BoxPtr *out_rects, int *num_out_rects,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
/* make out_rects always multiple of 16 width and height */
|
|
|
|
static Bool
|
|
|
|
static Bool
|
|
|
|
rdpCapture1(RegionPtr in_reg, BoxPtr *out_rects, int *num_out_rects,
|
|
|
|
rdpCapture1(RegionPtr in_reg, BoxPtr *out_rects, int *num_out_rects,
|
|
|
|
void *src, int src_width, int src_height,
|
|
|
|
void *src, int src_width, int src_height,
|
|
|
@ -305,6 +306,128 @@ rdpCapture1(RegionPtr in_reg, BoxPtr *out_rects, int *num_out_rects,
|
|
|
|
void *dst, int dst_width, int dst_height,
|
|
|
|
void *dst, int dst_width, int dst_height,
|
|
|
|
int dst_stride, int dst_format, int max_rects)
|
|
|
|
int dst_stride, int dst_format, int max_rects)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
BoxPtr psrc_rects;
|
|
|
|
|
|
|
|
BoxRec rect;
|
|
|
|
|
|
|
|
RegionRec reg;
|
|
|
|
|
|
|
|
char *src_rect;
|
|
|
|
|
|
|
|
char *dst_rect;
|
|
|
|
|
|
|
|
int num_regions;
|
|
|
|
|
|
|
|
int bytespp;
|
|
|
|
|
|
|
|
int src_bytespp;
|
|
|
|
|
|
|
|
int dst_bytespp;
|
|
|
|
|
|
|
|
int width;
|
|
|
|
|
|
|
|
int height;
|
|
|
|
|
|
|
|
int min_width;
|
|
|
|
|
|
|
|
int min_height;
|
|
|
|
|
|
|
|
int src_offset;
|
|
|
|
|
|
|
|
int dst_offset;
|
|
|
|
|
|
|
|
int bytes;
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
int j;
|
|
|
|
|
|
|
|
int k;
|
|
|
|
|
|
|
|
int red;
|
|
|
|
|
|
|
|
int green;
|
|
|
|
|
|
|
|
int blue;
|
|
|
|
|
|
|
|
Bool rv;
|
|
|
|
|
|
|
|
unsigned int *s32;
|
|
|
|
|
|
|
|
unsigned int *d32;
|
|
|
|
|
|
|
|
unsigned short *d16;
|
|
|
|
|
|
|
|
unsigned char *d8;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LLOGLN(10, ("rdpCapture0:"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rv = TRUE;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
min_width = min(dst_width, src_width);
|
|
|
|
|
|
|
|
min_height = min(dst_height, src_height);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rect.x1 = 0;
|
|
|
|
|
|
|
|
rect.y1 = 0;
|
|
|
|
|
|
|
|
rect.x2 = min_width;
|
|
|
|
|
|
|
|
rect.y2 = min_height;
|
|
|
|
|
|
|
|
rdpRegionInit(®, &rect, 0);
|
|
|
|
|
|
|
|
rdpRegionIntersect(®, in_reg, ®);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
num_regions = REGION_NUM_RECTS(®);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (num_regions > max_rects)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
num_regions = 1;
|
|
|
|
|
|
|
|
psrc_rects = rdpRegionExtents(®);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
psrc_rects = REGION_RECTS(®);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (num_regions < 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*num_out_rects = num_regions;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*out_rects = (BoxPtr) g_malloc(sizeof(BoxRec) * num_regions, 0);
|
|
|
|
|
|
|
|
for (i = 0; i < num_regions; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
rect = psrc_rects[i];
|
|
|
|
|
|
|
|
width = rect.x2 - rect.x1;
|
|
|
|
|
|
|
|
height = rect.y2 - rect.y1;
|
|
|
|
|
|
|
|
width = (width + 15) & ~15;
|
|
|
|
|
|
|
|
height = (height + 15) & ~15;
|
|
|
|
|
|
|
|
rect.x2 = rect.x1 + width;
|
|
|
|
|
|
|
|
rect.y2 = rect.y1 + height;
|
|
|
|
|
|
|
|
if (rect.x2 > min_width)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
rect.x2 = min_width;
|
|
|
|
|
|
|
|
rect.x1 = min_width - 16;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rect.y2 > min_height)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
rect.y2 = min_height;
|
|
|
|
|
|
|
|
rect.y1 = min_height - 16;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
(*out_rects)[i] = rect;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((src_format == XRDP_a8r8g8b8) && (dst_format == XRDP_a8b8g8r8))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
src_bytespp = 4;
|
|
|
|
|
|
|
|
dst_bytespp = 4;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < num_regions; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/* get rect to copy */
|
|
|
|
|
|
|
|
rect = (*out_rects)[i];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* get rect dimensions */
|
|
|
|
|
|
|
|
width = rect.x2 - rect.x1;
|
|
|
|
|
|
|
|
height = rect.y2 - rect.y1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* point to start of each rect in respective memory */
|
|
|
|
|
|
|
|
src_offset = rect.y1 * src_stride + rect.x1 * src_bytespp;
|
|
|
|
|
|
|
|
dst_offset = rect.y1 * dst_stride + rect.x1 * dst_bytespp;
|
|
|
|
|
|
|
|
src_rect = src + src_offset;
|
|
|
|
|
|
|
|
dst_rect = dst + dst_offset;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* copy one line at a time */
|
|
|
|
|
|
|
|
for (j = 0; j < height; j++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
s32 = (unsigned int *) src_rect;
|
|
|
|
|
|
|
|
d32 = (unsigned int *) dst_rect;
|
|
|
|
|
|
|
|
for (k = 0; k < width; k++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SPLITCOLOR32(red, green, blue, *s32);
|
|
|
|
|
|
|
|
*d32 = COLOR24(red, green, blue);
|
|
|
|
|
|
|
|
s32++;
|
|
|
|
|
|
|
|
d32++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
src_rect += src_stride;
|
|
|
|
|
|
|
|
dst_rect += dst_stride;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|