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_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect) { Drawable dst; int i; uint32 color; DELTA_RECT* rectangle; xfInfo* xfi = ((xfContext*) context)->xfi; color = freerdp_color_convert_var(multi_opaque_rect->color, xfi->srcBpp, 32, xfi->clrconv); XSetFunction(xfi->display, xfi->gc, GXcopy); XSetFillStyle(xfi->display, xfi->gc, FillSolid); XSetForeground(xfi->display, xfi->gc, color); GET_DST(xfi, dst); for (i = 1; i < multi_opaque_rect->numRectangles + 1; i++) { rectangle = &multi_opaque_rect->rectangles[i]; XFillRectangle(xfi->display, dst, xfi->gc, rectangle->left, rectangle->top, rectangle->width, rectangle->height); if (xfi->drawing == xfi->primary) { if (!xfi->remote_app && !xfi->skip_bs) { XFillRectangle(xfi->display, xfi->drawable, xfi->gc, rectangle->left, rectangle->top, rectangle->width, rectangle->height); } gdi_InvalidateRegion(xfi->hdc, rectangle->left, rectangle->top, rectangle->width, rectangle->height); } } }
void xf_gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect) { Drawable dst; uint32 color; xfInfo* xfi = ((xfContext*) context)->xfi; color = freerdp_color_convert_var(opaque_rect->color, xfi->srcBpp, 32, xfi->clrconv); XSetFunction(xfi->display, xfi->gc, GXcopy); XSetFillStyle(xfi->display, xfi->gc, FillSolid); XSetForeground(xfi->display, xfi->gc, color); GET_DST(xfi, dst); XFillRectangle(xfi->display, dst, xfi->gc, opaque_rect->nLeftRect, opaque_rect->nTopRect, opaque_rect->nWidth, opaque_rect->nHeight); if (xfi->drawing == xfi->primary) { if (!xfi->remote_app && !xfi->skip_bs) { XFillRectangle(xfi->display, xfi->drawable, xfi->gc, opaque_rect->nLeftRect, opaque_rect->nTopRect, opaque_rect->nWidth, opaque_rect->nHeight); } gdi_InvalidateRegion(xfi->hdc, opaque_rect->nLeftRect, opaque_rect->nTopRect, opaque_rect->nWidth, opaque_rect->nHeight); } }
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); }
/* Input: FPU opcode in 'code' Output: FPU disassembled in 'buf'. sizeof(buf) >= 6+1+7+1+11+1+11 = 38 */ int DasmFPU(uint16_t code, char *buf) { int operator = GET_OPERATOR(code); int size = GET_SIZE(code); int src = GET_SRC(code); int dst = GET_DST(code); int idx[4] = { 0 }; int i; int j = 0; for(i = 0; i < sizeof(operators) / sizeof(TUPLE); i++) { if(operators[i].code == operator) { idx[j++] = i; break; } } for(i = 0; i < sizeof(sizes) / sizeof(TUPLE); i++) { if(sizes[i].code == size) { idx[j++] = i; break; } } for(i = 0; i < sizeof(srcs) / sizeof(TUPLE); i++) { if(srcs[i].code == src) { idx[j++] = i; break; } } for(i = 0; i < sizeof(dsts) / sizeof(TUPLE); i++) { if(dsts[i].code == dst) { idx[j++] = i; break; } } sprintf(buf, "%s.%s %s,%s", operators[idx[0]].name, sizes[idx[1]].name, srcs[idx[2]].name, dsts[idx[3]].name); return 0; }
void xf_gdi_dstblt(rdpContext* context, DSTBLT_ORDER* dstblt) { Drawable dst; xfInfo* xfi = ((xfContext*) context)->xfi; xf_set_rop3(xfi, gdi_rop3_code(dstblt->bRop)); GET_DST(xfi, dst); XSetFillStyle(xfi->display, xfi->gc, FillSolid); XFillRectangle(xfi->display, dst, xfi->gc, dstblt->nLeftRect, dstblt->nTopRect, dstblt->nWidth, dstblt->nHeight); if (xfi->drawing == xfi->primary) { if (!xfi->remote_app && !xfi->skip_bs) { XFillRectangle(xfi->display, xfi->drawable, xfi->gc, dstblt->nLeftRect, dstblt->nTopRect, dstblt->nWidth, dstblt->nHeight); } gdi_InvalidateRegion(xfi->hdc, dstblt->nLeftRect, dstblt->nTopRect, dstblt->nWidth, dstblt->nHeight); } 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); }