void xf_gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to) { Drawable dst; uint32 color; xfInfo* xfi = ((xfContext*) context)->xfi; xf_set_rop2(xfi, line_to->bRop2); color = freerdp_color_convert_rgb(line_to->penColor, xfi->srcBpp, 32, xfi->clrconv); XSetFillStyle(xfi->display, xfi->gc, FillSolid); XSetForeground(xfi->display, xfi->gc, color); GET_DST(xfi, dst); XDrawLine(xfi->display, dst, xfi->gc, line_to->nXStart, line_to->nYStart, line_to->nXEnd, line_to->nYEnd); if (xfi->drawing == xfi->primary) { int width, height; if (!xfi->remote_app && !xfi->skip_bs) { XDrawLine(xfi->display, xfi->drawable, xfi->gc, line_to->nXStart, line_to->nYStart, line_to->nXEnd, line_to->nYEnd); } width = line_to->nXStart - line_to->nXEnd; height = line_to->nYStart - line_to->nYEnd; if (width < 0) width *= (-1); if (height < 0) height *= (-1); gdi_InvalidateRegion(xfi->hdc, line_to->nXStart, line_to->nYStart, width, height); } XSetFunction(xfi->display, xfi->gc, GXcopy); }
void xf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline) { Drawable dst; int i; int x, y; int x1, y1; int x2, y2; int npoints; uint32 color; XPoint* points; int width, height; xfInfo* xfi = ((xfContext*) context)->xfi; xf_set_rop2(xfi, polyline->bRop2); color = freerdp_color_convert_rgb(polyline->penColor, xfi->srcBpp, 32, xfi->clrconv); XSetFillStyle(xfi->display, xfi->gc, FillSolid); XSetForeground(xfi->display, xfi->gc, color); npoints = polyline->numPoints + 1; points = xmalloc(sizeof(XPoint) * npoints); points[0].x = polyline->xStart; points[0].y = polyline->yStart; for (i = 0; i < polyline->numPoints; i++) { points[i + 1].x = polyline->points[i].x; points[i + 1].y = polyline->points[i].y; } GET_DST(xfi, dst); XDrawLines(xfi->display, dst, xfi->gc, points, npoints, CoordModePrevious); if (xfi->drawing == xfi->primary) { if (!xfi->remote_app && !xfi->skip_bs) { XDrawLines(xfi->display, xfi->drawable, xfi->gc, points, npoints, CoordModePrevious); } x1 = points[0].x; y1 = points[0].y; for (i = 1; i < npoints; i++) { x2 = points[i].x + x1; y2 = points[i].y + y1; x = (x2 < x1) ? x2 : x1; width = (x2 > x1) ? x2 - x1 : x1 - x2; y = (y2 < y1) ? y2 : y1; height = (y2 > y1) ? y2 - y1 : y1 - y2; x1 = x2; y1 = y2; gdi_InvalidateRegion(xfi->hdc, x, y, width, height); } } XSetFunction(xfi->display, xfi->gc, GXcopy); xfree(points); }
void xf_gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to) { UINT32 color; xfContext* context_ = (xfContext*) context; xfInfo* xfi = context_->xfi; xf_set_rop2(xfi, line_to->bRop2); color = freerdp_color_convert_rgb(line_to->penColor, context_->settings->ColorDepth, xfi->bpp, xfi->clrconv); XSetFillStyle(xfi->display, xfi->gc, FillSolid); XSetForeground(xfi->display, xfi->gc, color); XDrawLine(xfi->display, xfi->drawing, xfi->gc, line_to->nXStart, line_to->nYStart, line_to->nXEnd, line_to->nYEnd); if (xfi->drawing == xfi->primary) { int width, height; if (xfi->remote_app != TRUE) { XDrawLine(xfi->display, xfi->drawable, xfi->gc, line_to->nXStart, line_to->nYStart, line_to->nXEnd, line_to->nYEnd); } width = line_to->nXStart - line_to->nXEnd; height = line_to->nYStart - line_to->nYEnd; if (width < 0) width *= (-1); if (height < 0) height *= (-1); gdi_InvalidateRegion(xfi->hdc, line_to->nXStart, line_to->nYStart, width, height); } XSetFunction(xfi->display, xfi->gc, GXcopy); }
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); }
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); }
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); }