Ejemplo n.º 1
0
static BOOL xf_gdi_polygon_cb(rdpContext* context,
                              POLYGON_CB_ORDER* polygon_cb)
{
	int i, npoints;
	XPoint* points;
	Pixmap pattern;
	const rdpBrush* brush;
	XColor foreColor;
	XColor backColor;
	xfContext* xfc = (xfContext*) context;
	BOOL ret = TRUE;

	if (!xf_decode_color(xfc, polygon_cb->foreColor, &foreColor))
		return FALSE;

	if (!xf_decode_color(xfc, polygon_cb->backColor, &backColor))
		return FALSE;

	xf_lock_x11(xfc, FALSE);
	brush = &(polygon_cb->brush);
	xf_set_rop2(xfc, polygon_cb->bRop2);
	npoints = polygon_cb->numPoints + 1;
	points = malloc(sizeof(XPoint) * npoints);

	if (!points)
	{
		xf_unlock_x11(xfc, FALSE);
		return FALSE;
	}

	points[0].x = polygon_cb->xStart;
	points[0].y = polygon_cb->yStart;

	for (i = 0; i < polygon_cb->numPoints; i++)
	{
		points[i + 1].x = polygon_cb->points[i].x;
		points[i + 1].y = polygon_cb->points[i].y;
	}

	switch (polygon_cb->fillMode)
	{
		case GDI_FILL_ALTERNATE: /* alternate */
			XSetFillRule(xfc->display, xfc->gc, EvenOddRule);
			break;

		case GDI_FILL_WINDING: /* winding */
			XSetFillRule(xfc->display, xfc->gc, WindingRule);
			break;

		default:
			WLog_ERR(TAG, "PolygonCB unknown fillMode: %"PRIu32"", polygon_cb->fillMode);
			break;
	}

	if (brush->style == GDI_BS_PATTERN)
	{
		if (brush->bpp > 1)
		{
			pattern = xf_brush_new(xfc, 8, 8, brush->bpp, brush->data);
			XSetFillStyle(xfc->display, xfc->gc, FillTiled);
			XSetTile(xfc->display, xfc->gc, pattern);
		}
		else
		{
			pattern = xf_mono_bitmap_new(xfc, 8, 8, brush->data);
			XSetForeground(xfc->display, xfc->gc, backColor.pixel);
			XSetBackground(xfc->display, xfc->gc, foreColor.pixel);

			if (polygon_cb->backMode == BACKMODE_TRANSPARENT)
				XSetFillStyle(xfc->display, xfc->gc, FillStippled);
			else if (polygon_cb->backMode == BACKMODE_OPAQUE)
				XSetFillStyle(xfc->display, xfc->gc, FillOpaqueStippled);

			XSetStipple(xfc->display, xfc->gc, pattern);
		}

		XSetTSOrigin(xfc->display, xfc->gc, brush->x, brush->y);
		XFillPolygon(xfc->display, xfc->drawing, xfc->gc,
		             points, npoints, Complex, CoordModePrevious);
		XSetFillStyle(xfc->display, xfc->gc, FillSolid);
		XSetTSOrigin(xfc->display, xfc->gc, 0, 0);
		XFreePixmap(xfc->display, pattern);

		if (xfc->drawing == xfc->primary)
		{
			if (!xf_gdi_invalidate_poly_region(xfc, points, npoints))
				ret = FALSE;
		}
	}
	else
	{
		WLog_ERR(TAG,  "PolygonCB unimplemented brush style:%"PRIu32"", brush->style);
	}

	XSetFunction(xfc->display, xfc->gc, GXcopy);
	free(points);
	xf_unlock_x11(xfc, FALSE);
	return ret;
}
Ejemplo n.º 2
0
void xf_gdi_patblt(rdpUpdate* update, PATBLT_ORDER* patblt)
{
	BRUSH* brush;
	Pixmap pattern;
	uint32 foreColor;
	uint32 backColor;
	xfInfo* xfi = GET_XFI(update);

	brush = &patblt->brush;
	xf_set_rop3(xfi, gdi_rop3_code(patblt->bRop));

	foreColor = freerdp_color_convert(patblt->foreColor, xfi->srcBpp, 32, xfi->clrconv);
	backColor = freerdp_color_convert(patblt->backColor, xfi->srcBpp, 32, xfi->clrconv);

	if (brush->style & CACHED_BRUSH)
	{
		brush->data = brush_get(xfi->cache->brush, brush->index, &brush->bpp);
		brush->style = GDI_BS_PATTERN;
	}

	if (brush->style == GDI_BS_SOLID)
	{
		XSetFillStyle(xfi->display, xfi->gc, FillSolid);
		XSetForeground(xfi->display, xfi->gc, patblt->foreColor);

		XFillRectangle(xfi->display, xfi->drawing, xfi->gc,
				patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);
	}
	else if (brush->style == GDI_BS_PATTERN)
	{
		if (brush->bpp > 1)
		{
			pattern = xf_brush_new(xfi, 8, 8, brush->bpp, brush->data);

			XSetFillStyle(xfi->display, xfi->gc, FillTiled);
			XSetTile(xfi->display, xfi->gc, pattern);
			XSetTSOrigin(xfi->display, xfi->gc, brush->x, brush->y);

			XFillRectangle(xfi->display, xfi->drawing, xfi->gc,
					patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);

			XSetTile(xfi->display, xfi->gc, xfi->primary);
		}
		else
		{
			pattern = xf_mono_bitmap_new(xfi, 8, 8, brush->data);

			XSetForeground(xfi->display, xfi->gc, backColor);
			XSetBackground(xfi->display, xfi->gc, foreColor);
			XSetFillStyle(xfi->display, xfi->gc, FillOpaqueStippled);
			XSetTSOrigin(xfi->display, xfi->gc, brush->x, brush->y);

			XFillRectangle(xfi->display, xfi->drawing, xfi->gc,
					patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);

			XSetStipple(xfi->display, xfi->gc_mono, pattern);
		}
	}
	else
	{
		printf("unimplemented brush style:%d\n", brush->style);
	}

	if (xfi->drawing == xfi->primary)
	{
		XSetFunction(xfi->display, xfi->gc, GXcopy);

		if (xfi->remote_app != True)
		{
			XCopyArea(xfi->display, xfi->primary, xfi->drawable, xfi->gc, patblt->nLeftRect, patblt->nTopRect,
				patblt->nWidth, patblt->nHeight, patblt->nLeftRect, patblt->nTopRect);
		}

		gdi_InvalidateRegion(xfi->hdc, patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);
	}
}
Ejemplo n.º 3
0
static BOOL xf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
{
	const rdpBrush* brush;
	xfContext* xfc = (xfContext*) context;
	BOOL ret = FALSE;
	XColor xfg, xbg;

	if (!xf_decode_color(xfc, patblt->foreColor, &xfg))
		return FALSE;

	if (!xf_decode_color(xfc, patblt->backColor, &xbg))
		return FALSE;

	xf_lock_x11(xfc, FALSE);
	brush = &patblt->brush;

	if (!xf_set_rop3(xfc, gdi_rop3_code(patblt->bRop)))
		goto fail;

	switch (brush->style)
	{
		case GDI_BS_SOLID:
			XSetFillStyle(xfc->display, xfc->gc, FillSolid);
			XSetBackground(xfc->display, xfc->gc, xbg.pixel);
			XSetForeground(xfc->display, xfc->gc, xfg.pixel);
			XFillRectangle(xfc->display, xfc->drawing, xfc->gc,
			               patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);
			break;

		case GDI_BS_HATCHED:
			{
				Pixmap pattern = xf_mono_bitmap_new(xfc, 8, 8,
				                                    &GDI_BS_HATCHED_PATTERNS[8 * brush->hatch]);
				XSetBackground(xfc->display, xfc->gc, xbg.pixel);
				XSetForeground(xfc->display, xfc->gc, xfg.pixel);
				XSetFillStyle(xfc->display, xfc->gc, FillOpaqueStippled);
				XSetStipple(xfc->display, xfc->gc, pattern);
				XSetTSOrigin(xfc->display, xfc->gc, brush->x, brush->y);
				XFillRectangle(xfc->display, xfc->drawing, xfc->gc,
				               patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);
				XFreePixmap(xfc->display, pattern);
			}
			break;

		case GDI_BS_PATTERN:
			if (brush->bpp > 1)
			{
				Pixmap pattern = xf_brush_new(xfc, 8, 8, brush->bpp, brush->data);
				XSetFillStyle(xfc->display, xfc->gc, FillTiled);
				XSetTile(xfc->display, xfc->gc, pattern);
				XSetTSOrigin(xfc->display, xfc->gc, brush->x, brush->y);
				XFillRectangle(xfc->display, xfc->drawing, xfc->gc,
				               patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);
				XSetTile(xfc->display, xfc->gc, xfc->primary);
				XFreePixmap(xfc->display, pattern);
			}
			else
			{
				Pixmap pattern = xf_mono_bitmap_new(xfc, 8, 8, brush->data);
				XSetBackground(xfc->display, xfc->gc, xfg.pixel);
				XSetForeground(xfc->display, xfc->gc, xbg.pixel);
				XSetFillStyle(xfc->display, xfc->gc, FillOpaqueStippled);
				XSetStipple(xfc->display, xfc->gc, pattern);
				XSetTSOrigin(xfc->display, xfc->gc, brush->x, brush->y);
				XFillRectangle(xfc->display, xfc->drawing, xfc->gc,
				               patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);
				XFreePixmap(xfc->display, pattern);
			}

			break;

		default:
			WLog_ERR(TAG,  "unimplemented brush style:%"PRIu32"", brush->style);
			goto fail;
	}

	ret = TRUE;

	if (xfc->drawing == xfc->primary)
		ret = gdi_InvalidateRegion(xfc->hdc, patblt->nLeftRect, patblt->nTopRect,
		                           patblt->nWidth, patblt->nHeight);

fail:
	XSetFunction(xfc->display, xfc->gc, GXcopy);
	xf_unlock_x11(xfc, FALSE);
	return ret;
}
Ejemplo n.º 4
0
static BOOL xf_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
{
	const rdpBrush* brush;
	xfBitmap* bitmap;
	XColor foreColor;
	XColor backColor;
	Pixmap pattern = 0;
	xfContext* xfc = (xfContext*) context;
	BOOL ret = FALSE;

	if (!xfc->display || !xfc->drawing)
		return FALSE;

	if (!xf_decode_color(xfc, mem3blt->foreColor, &foreColor))
		return FALSE;

	if (!xf_decode_color(xfc, mem3blt->backColor, &backColor))
		return FALSE;

	xf_lock_x11(xfc, FALSE);
	brush = &mem3blt->brush;
	bitmap = (xfBitmap*) mem3blt->bitmap;

	if (!xf_set_rop3(xfc, gdi_rop3_code(mem3blt->bRop)))
		goto fail;

	switch (brush->style)
	{
		case GDI_BS_PATTERN:
			if (brush->bpp > 1)
			{
				pattern = xf_brush_new(xfc, 8, 8, brush->bpp, brush->data);
				XSetFillStyle(xfc->display, xfc->gc, FillTiled);
				XSetTile(xfc->display, xfc->gc, pattern);
				XSetTSOrigin(xfc->display, xfc->gc, brush->x, brush->y);
			}
			else
			{
				pattern = xf_mono_bitmap_new(xfc, 8, 8, brush->data);
				XSetBackground(xfc->display, xfc->gc, backColor.pixel);
				XSetForeground(xfc->display, xfc->gc, foreColor.pixel);
				XSetFillStyle(xfc->display, xfc->gc, FillOpaqueStippled);
				XSetStipple(xfc->display, xfc->gc, pattern);
				XSetTSOrigin(xfc->display, xfc->gc, brush->x, brush->y);
			}

			break;

		case GDI_BS_SOLID:
			XSetFillStyle(xfc->display, xfc->gc, FillSolid);
			XSetBackground(xfc->display, xfc->gc, backColor.pixel);
			XSetForeground(xfc->display, xfc->gc, foreColor.pixel);
			XSetTSOrigin(xfc->display, xfc->gc, brush->x, brush->y);
			break;

		default:
			WLog_ERR(TAG,  "Mem3Blt unimplemented brush style:%"PRIu32"", brush->style);
			goto fail;
	}

	XCopyArea(xfc->display, bitmap->pixmap, xfc->drawing, xfc->gc,
	          mem3blt->nXSrc, mem3blt->nYSrc, mem3blt->nWidth, mem3blt->nHeight,
	          mem3blt->nLeftRect, mem3blt->nTopRect);
	ret = TRUE;

	if (xfc->drawing == xfc->primary)
		ret = gdi_InvalidateRegion(xfc->hdc, mem3blt->nLeftRect, mem3blt->nTopRect,
		                           mem3blt->nWidth, mem3blt->nHeight);

	XSetFillStyle(xfc->display, xfc->gc, FillSolid);
	XSetTSOrigin(xfc->display, xfc->gc, 0, 0);

	if (pattern != 0)
		XFreePixmap(xfc->display, pattern);

fail:
	XSetFunction(xfc->display, xfc->gc, GXcopy);
	xf_unlock_x11(xfc, FALSE);
	return ret;
}
Ejemplo n.º 5
0
void xf_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb)
{
	int i, npoints;
	XPoint* points;
	Pixmap pattern;
	rdpBrush* brush;
	UINT32 foreColor;
	UINT32 backColor;
	xfInfo* xfi = ((xfContext*) context)->xfi;

	brush = &(polygon_cb->brush);
	xf_set_rop2(xfi, polygon_cb->bRop2);
	foreColor = freerdp_color_convert_rgb(polygon_cb->foreColor, ((xfContext*) context)->settings->ColorDepth, xfi->bpp, xfi->clrconv);
	backColor = freerdp_color_convert_rgb(polygon_cb->backColor, ((xfContext*) context)->settings->ColorDepth, xfi->bpp, xfi->clrconv);

	npoints = polygon_cb->numPoints + 1;
	points = malloc(sizeof(XPoint) * npoints);

	points[0].x = polygon_cb->xStart;
	points[0].y = polygon_cb->yStart;

	for (i = 0; i < polygon_cb->numPoints; i++)
	{
		points[i + 1].x = polygon_cb->points[i].x;
		points[i + 1].y = polygon_cb->points[i].y;
	}

	switch (polygon_cb->fillMode)
	{
		case 1: /* alternate */
			XSetFillRule(xfi->display, xfi->gc, EvenOddRule);
			break;

		case 2: /* winding */
			XSetFillRule(xfi->display, xfi->gc, WindingRule);
			break;

		default:
			printf("PolygonCB unknown fillMode: %d\n", polygon_cb->fillMode);
			break;
	}

	if (brush->style == GDI_BS_PATTERN)
	{
		if (brush->bpp > 1)
		{
			pattern = xf_brush_new(xfi, 8, 8, brush->bpp, brush->data);

			XSetFillStyle(xfi->display, xfi->gc, FillTiled);
			XSetTile(xfi->display, xfi->gc, pattern);
			XSetTSOrigin(xfi->display, xfi->gc, brush->x, brush->y);

			XFillPolygon(xfi->display, xfi->drawing, xfi->gc,
					points, npoints, Complex, CoordModePrevious);

			if (xfi->drawing == xfi->primary)
			{
				XFillPolygon(xfi->display, xfi->drawable, xfi->gc,
						points, npoints, Complex, CoordModePrevious);
			}

			XSetFillStyle(xfi->display, xfi->gc, FillSolid);
			XSetTSOrigin(xfi->display, xfi->gc, 0, 0);
			XFreePixmap(xfi->display, pattern);
		}
		else
		{
			pattern = xf_mono_bitmap_new(xfi, 8, 8, brush->data);

			XSetForeground(xfi->display, xfi->gc, backColor);
			XSetBackground(xfi->display, xfi->gc, foreColor);

			if (polygon_cb->backMode == BACKMODE_TRANSPARENT)
				XSetFillStyle(xfi->display, xfi->gc, FillStippled);
			else if (polygon_cb->backMode == BACKMODE_OPAQUE)
				XSetFillStyle(xfi->display, xfi->gc, FillOpaqueStippled);

			XSetStipple(xfi->display, xfi->gc, pattern);
			XSetTSOrigin(xfi->display, xfi->gc, brush->x, brush->y);

			XFillPolygon(xfi->display, xfi->drawing, xfi->gc,
					points, npoints, Complex, CoordModePrevious);

			if (xfi->drawing == xfi->primary)
			{
				XFillPolygon(xfi->display, xfi->drawable, xfi->gc,
						points, npoints, Complex, CoordModePrevious);
			}

			XSetFillStyle(xfi->display, xfi->gc, FillSolid);
			XSetTSOrigin(xfi->display, xfi->gc, 0, 0);
			XFreePixmap(xfi->display, pattern);
		}
	}
	else
	{
		printf("PolygonCB unimplemented brush style:%d\n", brush->style);
	}

	XSetFunction(xfi->display, xfi->gc, GXcopy);
	free(points);
}
Ejemplo n.º 6
0
void xf_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
{
	rdpBrush* brush;
	xfBitmap* bitmap;
	UINT32 foreColor;
	UINT32 backColor;
	Pixmap pattern = 0;
	xfContext* context_ = (xfContext*) context;
	xfInfo* xfi = context_->xfi;

	brush = &mem3blt->brush;
	bitmap = (xfBitmap*) mem3blt->bitmap;
	xf_set_rop3(xfi, gdi_rop3_code(mem3blt->bRop));
	foreColor = freerdp_color_convert_rgb(mem3blt->foreColor, context_->settings->ColorDepth, xfi->bpp, xfi->clrconv);
	backColor = freerdp_color_convert_rgb(mem3blt->backColor, context_->settings->ColorDepth, xfi->bpp, xfi->clrconv);

	if (brush->style == GDI_BS_PATTERN)
	{
		if (brush->bpp > 1)
		{
			pattern = xf_brush_new(xfi, 8, 8, brush->bpp, brush->data);

			XSetFillStyle(xfi->display, xfi->gc, FillTiled);
			XSetTile(xfi->display, xfi->gc, pattern);
			XSetTSOrigin(xfi->display, xfi->gc, brush->x, brush->y);
		}
		else
		{
			pattern = xf_mono_bitmap_new(xfi, 8, 8, brush->data);

			XSetForeground(xfi->display, xfi->gc, backColor);
			XSetBackground(xfi->display, xfi->gc, foreColor);
			XSetFillStyle(xfi->display, xfi->gc, FillOpaqueStippled);
			XSetStipple(xfi->display, xfi->gc, pattern);
			XSetTSOrigin(xfi->display, xfi->gc, brush->x, brush->y);
		}
	}
	else if (brush->style == GDI_BS_SOLID)
	{
		XSetFillStyle(xfi->display, xfi->gc, FillSolid);
		XSetForeground(xfi->display, xfi->gc, backColor);
		XSetBackground(xfi->display, xfi->gc, foreColor);

		XSetTSOrigin(xfi->display, xfi->gc, brush->x, brush->y);
	}
	else
	{
		printf("Mem3Blt unimplemented brush style:%d\n", brush->style);
	}

	XCopyArea(xfi->display, bitmap->pixmap, xfi->drawing, xfi->gc,
			mem3blt->nXSrc, mem3blt->nYSrc, mem3blt->nWidth, mem3blt->nHeight,
			mem3blt->nLeftRect, mem3blt->nTopRect);

	if (xfi->drawing == xfi->primary)
	{
		if (xfi->remote_app != TRUE)
		{
			XCopyArea(xfi->display, bitmap->pixmap, xfi->drawable, xfi->gc,
				mem3blt->nXSrc, mem3blt->nYSrc, mem3blt->nWidth, mem3blt->nHeight,
				mem3blt->nLeftRect, mem3blt->nTopRect);
		}

		gdi_InvalidateRegion(xfi->hdc, mem3blt->nLeftRect, mem3blt->nTopRect, mem3blt->nWidth, mem3blt->nHeight);
	}

	XSetFillStyle(xfi->display, xfi->gc, FillSolid);
	XSetTSOrigin(xfi->display, xfi->gc, 0, 0);

	if (pattern != 0)
		XFreePixmap(xfi->display, pattern);

	XSetFunction(xfi->display, xfi->gc, GXcopy);
}
Ejemplo n.º 7
0
void xf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
{
	Pixmap pattern;
	rdpBrush* brush;
	UINT32 foreColor;
	UINT32 backColor;
	xfContext* xfc = (xfContext*) context;

	xf_lock_x11(xfc, FALSE);

	brush = &patblt->brush;
	xf_set_rop3(xfc, gdi_rop3_code(patblt->bRop));

	foreColor = freerdp_convert_gdi_order_color(patblt->foreColor, context->settings->ColorDepth, xfc->format, xfc->palette);
	foreColor = xf_gdi_get_color(xfc, foreColor);
	backColor = freerdp_convert_gdi_order_color(patblt->backColor, context->settings->ColorDepth, xfc->format, xfc->palette);
	backColor = xf_gdi_get_color(xfc, backColor);

	if (brush->style == GDI_BS_SOLID)
	{
		XSetFillStyle(xfc->display, xfc->gc, FillSolid);
		XSetForeground(xfc->display, xfc->gc, foreColor);

		XFillRectangle(xfc->display, xfc->drawing, xfc->gc,
				patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);
	}
	else if (brush->style == GDI_BS_HATCHED)
	{
		pattern = xf_mono_bitmap_new(xfc, 8, 8, GDI_BS_HATCHED_PATTERNS + 8 * brush->hatch);

		XSetForeground(xfc->display, xfc->gc, backColor);
		XSetBackground(xfc->display, xfc->gc, foreColor);
		XSetFillStyle(xfc->display, xfc->gc, FillOpaqueStippled);
		XSetStipple(xfc->display, xfc->gc, pattern);
		XSetTSOrigin(xfc->display, xfc->gc, brush->x, brush->y);

		XFillRectangle(xfc->display, xfc->drawing, xfc->gc,
		patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);

		XFreePixmap(xfc->display, pattern);
	}
	else if (brush->style == GDI_BS_PATTERN)
	{
		if (brush->bpp > 1)
		{
			pattern = xf_brush_new(xfc, 8, 8, brush->bpp, brush->data);

			XSetFillStyle(xfc->display, xfc->gc, FillTiled);
			XSetTile(xfc->display, xfc->gc, pattern);
			XSetTSOrigin(xfc->display, xfc->gc, brush->x, brush->y);

			XFillRectangle(xfc->display, xfc->drawing, xfc->gc,
					patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);

			XSetTile(xfc->display, xfc->gc, xfc->primary);

			XFreePixmap(xfc->display, pattern);
		}
		else
		{
			pattern = xf_mono_bitmap_new(xfc, 8, 8, brush->data);

			XSetForeground(xfc->display, xfc->gc, backColor);
			XSetBackground(xfc->display, xfc->gc, foreColor);
			XSetFillStyle(xfc->display, xfc->gc, FillOpaqueStippled);
			XSetStipple(xfc->display, xfc->gc, pattern);
			XSetTSOrigin(xfc->display, xfc->gc, brush->x, brush->y);

			XFillRectangle(xfc->display, xfc->drawing, xfc->gc,
					patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);

			XFreePixmap(xfc->display, pattern);
		}
	}
	else
	{
		WLog_ERR(TAG,  "unimplemented brush style:%d", brush->style);
	}

	if (xfc->drawing == xfc->primary)
	{
		XSetFunction(xfc->display, xfc->gc, GXcopy);
		if (!xfc->remote_app)
		{
			XCopyArea(xfc->display, xfc->primary, xfc->drawable, xfc->gc, patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight, patblt->nLeftRect, patblt->nTopRect);
		}
		gdi_InvalidateRegion(xfc->hdc, patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);
	}

	XSetFunction(xfc->display, xfc->gc, GXcopy);

	xf_unlock_x11(xfc, FALSE);
}
Ejemplo n.º 8
0
void xf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
{
	Drawable dst;
	Pixmap pattern;
	rdpBrush* brush;
	uint32 foreColor;
	uint32 backColor;
	xfInfo* xfi = ((xfContext*) context)->xfi;

	GET_DST(xfi, dst);
	brush = &patblt->brush;
	xf_set_rop3(xfi, gdi_rop3_code(patblt->bRop));
	foreColor = freerdp_color_convert_rgb(patblt->foreColor, xfi->srcBpp, 32, xfi->clrconv);
	backColor = freerdp_color_convert_rgb(patblt->backColor, xfi->srcBpp, 32, xfi->clrconv);
	if (brush->style == GDI_BS_SOLID)
	{
		XSetFillStyle(xfi->display, xfi->gc, FillSolid);
		XSetForeground(xfi->display, xfi->gc, foreColor);
		XFillRectangle(xfi->display, dst, xfi->gc,
				patblt->nLeftRect, patblt->nTopRect,
				patblt->nWidth, patblt->nHeight);
	}
	else if (brush->style == GDI_BS_PATTERN)
	{
		if (brush->bpp > 1)
		{
			pattern = xf_brush_new(xfi, 8, 8, brush->bpp, brush->data);
			XSetFillStyle(xfi->display, xfi->gc, FillTiled);
			XSetTile(xfi->display, xfi->gc, pattern);
			XSetTSOrigin(xfi->display, xfi->gc, brush->x, brush->y);
			XFillRectangle(xfi->display, dst, xfi->gc,
					patblt->nLeftRect, patblt->nTopRect,
					patblt->nWidth, patblt->nHeight);
			XSetTile(xfi->display, xfi->gc, xfi->primary);
			XFreePixmap(xfi->display, pattern);
		}
		else
		{
			pattern = xf_mono_bitmap_new(xfi, 8, 8, brush->data);
			XSetForeground(xfi->display, xfi->gc, foreColor);
			XSetBackground(xfi->display, xfi->gc, backColor);
			XSetFillStyle(xfi->display, xfi->gc, FillOpaqueStippled);
			XSetStipple(xfi->display, xfi->gc, pattern);
			XSetTSOrigin(xfi->display, xfi->gc, brush->x, brush->y);
			XFillRectangle(xfi->display, dst, xfi->gc,
					patblt->nLeftRect, patblt->nTopRect,
					patblt->nWidth, patblt->nHeight);
			XFreePixmap(xfi->display, pattern);
		}
	}
	else
	{
		printf("unimplemented brush style:%d\n", brush->style);
	}
	if (xfi->drawing == xfi->primary)
	{
		XSetFunction(xfi->display, xfi->gc, GXcopy);
		if (!xfi->remote_app && !xfi->skip_bs)
		{
			XCopyArea(xfi->display, xfi->primary, xfi->drawable, xfi->gc,
				patblt->nLeftRect, patblt->nTopRect,
				patblt->nWidth, patblt->nHeight,
				patblt->nLeftRect, patblt->nTopRect);
		}
		gdi_InvalidateRegion(xfi->hdc, patblt->nLeftRect, patblt->nTopRect,
				patblt->nWidth, patblt->nHeight);
	}
	XSetFunction(xfi->display, xfi->gc, GXcopy);
}
Ejemplo n.º 9
0
void xf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
{
    Pixmap pattern;
    rdpBrush* brush;
    UINT32 foreColor;
    UINT32 backColor;
    xfContext* context_ = (xfContext*) context;
    xfInfo* xfi = context_->xfi;

    xf_lock_x11(xfi, FALSE);

    brush = &patblt->brush;
    xf_set_rop3(xfi, gdi_rop3_code(patblt->bRop));

    foreColor = freerdp_color_convert_var(patblt->foreColor, context_->settings->ColorDepth, xfi->bpp, xfi->clrconv);
    backColor = freerdp_color_convert_var(patblt->backColor, context_->settings->ColorDepth, xfi->bpp, xfi->clrconv);

    if (brush->style == GDI_BS_SOLID)
    {
        XSetFillStyle(xfi->display, xfi->gc, FillSolid);
        XSetForeground(xfi->display, xfi->gc, foreColor);

        XFillRectangle(xfi->display, xfi->drawing, xfi->gc,
                       patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);
    }
    else if (brush->style == GDI_BS_HATCHED)
    {
        pattern = xf_mono_bitmap_new(xfi, 8, 8, GDI_BS_HATCHED_PATTERNS + 8 * brush->hatch);

        XSetForeground(xfi->display, xfi->gc, backColor);
        XSetBackground(xfi->display, xfi->gc, foreColor);
        XSetFillStyle(xfi->display, xfi->gc, FillOpaqueStippled);
        XSetStipple(xfi->display, xfi->gc, pattern);
        XSetTSOrigin(xfi->display, xfi->gc, brush->x, brush->y);

        XFillRectangle(xfi->display, xfi->drawing, xfi->gc,
                       patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);

        XFreePixmap(xfi->display, pattern);
    }
    else if (brush->style == GDI_BS_PATTERN)
    {
        if (brush->bpp > 1)
        {
            pattern = xf_brush_new(xfi, 8, 8, brush->bpp, brush->data);

            XSetFillStyle(xfi->display, xfi->gc, FillTiled);
            XSetTile(xfi->display, xfi->gc, pattern);
            XSetTSOrigin(xfi->display, xfi->gc, brush->x, brush->y);

            XFillRectangle(xfi->display, xfi->drawing, xfi->gc,
                           patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);

            XSetTile(xfi->display, xfi->gc, xfi->primary);

            XFreePixmap(xfi->display, pattern);
        }
        else
        {
            pattern = xf_mono_bitmap_new(xfi, 8, 8, brush->data);

            XSetForeground(xfi->display, xfi->gc, backColor);
            XSetBackground(xfi->display, xfi->gc, foreColor);
            XSetFillStyle(xfi->display, xfi->gc, FillOpaqueStippled);
            XSetStipple(xfi->display, xfi->gc, pattern);
            XSetTSOrigin(xfi->display, xfi->gc, brush->x, brush->y);

            XFillRectangle(xfi->display, xfi->drawing, xfi->gc,
                           patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);

            XFreePixmap(xfi->display, pattern);
        }
    }
    else
    {
        fprintf(stderr, "unimplemented brush style:%d\n", brush->style);
    }

    if (xfi->drawing == xfi->primary)
    {
        gdi_InvalidateRegion(xfi->hdc, patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);
    }

    XSetFunction(xfi->display, xfi->gc, GXcopy);

    xf_unlock_x11(xfi, FALSE);
}