void xf_gdi_polyline(rdpUpdate* update, POLYLINE_ORDER* polyline) { int i; int x, y; int x1, y1; int x2, y2; int npoints; uint32 color; XPoint* points; int width, height; xfInfo* xfi = GET_XFI(update); xf_set_rop2(xfi, polyline->bRop2); color = freerdp_color_convert(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; } XDrawLines(xfi->display, xfi->drawing, xfi->gc, points, npoints, CoordModePrevious); if (xfi->drawing == xfi->primary) { if (xfi->remote_app != True) 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); } } xfree(points); }
void xf_gdi_multi_opaque_rect(rdpUpdate* update, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect) { int i; uint32 color; DELTA_RECT* rectangle; xfInfo* xfi = GET_XFI(update); color = freerdp_color_convert(multi_opaque_rect->color, xfi->srcBpp, xfi->bpp, xfi->clrconv); XSetFunction(xfi->display, xfi->gc, GXcopy); XSetFillStyle(xfi->display, xfi->gc, FillSolid); XSetForeground(xfi->display, xfi->gc, color); for (i = 1; i < multi_opaque_rect->numRectangles + 1; i++) { rectangle = &multi_opaque_rect->rectangles[i]; XFillRectangle(xfi->display, xfi->drawing, xfi->gc, rectangle->left, rectangle->top, rectangle->width, rectangle->height); if (xfi->drawing == xfi->primary) { if (xfi->remote_app != True) { 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(rdpUpdate* update, OPAQUE_RECT_ORDER* opaque_rect) { uint32 color; xfInfo* xfi = GET_XFI(update); color = freerdp_color_convert(opaque_rect->color, xfi->srcBpp, xfi->bpp, xfi->clrconv); XSetFunction(xfi->display, xfi->gc, GXcopy); XSetFillStyle(xfi->display, xfi->gc, FillSolid); XSetForeground(xfi->display, xfi->gc, color); XFillRectangle(xfi->display, xfi->drawing, xfi->gc, opaque_rect->nLeftRect, opaque_rect->nTopRect, opaque_rect->nWidth, opaque_rect->nHeight); if (xfi->drawing == xfi->primary) { if (xfi->remote_app != True) { 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(rdpUpdate* update, POLYLINE_ORDER* polyline) { int i; uint32 color; XPoint* points; xfInfo* xfi = GET_XFI(update); xf_set_rop2(xfi, polyline->bRop2); color = freerdp_color_convert(polyline->penColor, xfi->srcBpp, 32, xfi->clrconv); XSetFillStyle(xfi->display, xfi->gc, FillSolid); XSetForeground(xfi->display, xfi->gc, color); points = xmalloc(sizeof(XPoint) * polyline->numPoints); for (i = 0; i < polyline->numPoints; i++) { points[i].x = polyline->points[i].x; points[i].y = polyline->points[i].y; } XDrawLines(xfi->display, xfi->drawing, xfi->gc, points, polyline->numPoints, CoordModePrevious); if (xfi->drawing == xfi->primary) { if (xfi->remote_app != True) { XDrawLines(xfi->display, xfi->drawable, xfi->gc, points, polyline->numPoints, CoordModePrevious); } } xfree(points); }
void xf_gdi_line_to(rdpUpdate* update, LINE_TO_ORDER* line_to) { uint32 color; xfInfo* xfi = ((xfContext*) update->context)->xfi; xf_set_rop2(xfi, line_to->bRop2); color = freerdp_color_convert(line_to->penColor, xfi->srcBpp, 32, 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) { if (xfi->remote_app != True) { int width, height; 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_fast_index(rdpUpdate* update, FAST_INDEX_ORDER* fast_index) { int i, j; int x, y; int w, h; Pixmap bmp; Pixmap* bmps; uint32 fgcolor; uint32 bgcolor; GLYPH_DATA* glyph; GLYPH_DATA** glyphs; GLYPH_FRAGMENT* fragment; xfInfo* xfi = GET_XFI(update); fgcolor = freerdp_color_convert(fast_index->foreColor, xfi->srcBpp, 32, xfi->clrconv); bgcolor = freerdp_color_convert(fast_index->backColor, xfi->srcBpp, 32, xfi->clrconv); XSetFunction(xfi->display, xfi->gc, GXcopy); XSetForeground(xfi->display, xfi->gc, bgcolor); XSetBackground(xfi->display, xfi->gc, fgcolor); if (fast_index->opaqueRect) { XSetFillStyle(xfi->display, xfi->gc, FillSolid); x = fast_index->opLeft; y = fast_index->opTop; w = fast_index->opRight - fast_index->opLeft + 1; h = fast_index->opBottom - fast_index->opTop + 1; XFillRectangle(xfi->display, xfi->drawing, xfi->gc, x, y, w, h); if (xfi->drawing == xfi->primary) { if (xfi->remote_app != True) { XFillRectangle(xfi->display, xfi->drawable, xfi->gc, x, y, w, h); } gdi_InvalidateRegion(xfi->hdc, x, y, w, h); } } x = fast_index->bkLeft; y = fast_index->y; XSetFillStyle(xfi->display, xfi->gc, FillStippled); for (i = 0; i < fast_index->nfragments; i++) { fragment = &fast_index->fragments[i]; if (fragment->operation == GLYPH_FRAGMENT_USE) { fragment->indices = (GLYPH_FRAGMENT_INDEX*) glyph_fragment_get(xfi->cache->glyph, fragment->index, &fragment->nindices, (void**) &bmps); glyphs = (GLYPH_DATA**) xmalloc(sizeof(GLYPH_DATA*) * fragment->nindices); for (j = 0; j < fragment->nindices; j++) { glyphs[j] = glyph_get(xfi->cache->glyph, fast_index->cacheId, fragment->indices[j].index, (void**) &bmps[j]); } } else { bmps = (Pixmap*) xmalloc(sizeof(Pixmap*) * fragment->nindices); glyphs = (GLYPH_DATA**) xmalloc(sizeof(GLYPH_DATA*) * fragment->nindices); for (j = 0; j < fragment->nindices; j++) { glyphs[j] = glyph_get(xfi->cache->glyph, fast_index->cacheId, fragment->indices[j].index, (void**) &bmps[j]); } } for (j = 0; j < fragment->nindices; j++) { bmp = bmps[j]; glyph = glyphs[j]; XSetStipple(xfi->display, xfi->gc, bmp); XSetTSOrigin(xfi->display, xfi->gc, glyph->x + x, glyph->y + y); XFillRectangle(xfi->display, xfi->drawing, xfi->gc, glyph->x + x, glyph->y + y, glyph->cx, glyph->cy); XSetStipple(xfi->display, xfi->gc, xfi->bitmap_mono); if ((j + 1) < fragment->nindices) { if (!(fast_index->flAccel & SO_CHAR_INC_EQUAL_BM_BASE)) { if (fast_index->flAccel & SO_VERTICAL) { y += fragment->indices[j + 1].delta; } else { x += fragment->indices[j + 1].delta; } } else { x += glyph->cx; } } } if (fragment->operation == GLYPH_FRAGMENT_ADD) { glyph_fragment_put(xfi->cache->glyph, fragment->index, fragment->nindices, (void*) fragment->indices, (void*) bmps); } } if (xfi->drawing == xfi->primary) { if (xfi->remote_app != True) { XCopyArea(xfi->display, xfi->primary, xfi->drawable, xfi->gc, fast_index->bkLeft, fast_index->bkTop, fast_index->bkRight - fast_index->bkLeft + 1, fast_index->bkBottom - fast_index->bkTop + 1, fast_index->bkLeft, fast_index->bkTop); } gdi_InvalidateRegion(xfi->hdc, fast_index->bkLeft, fast_index->bkTop, fast_index->bkRight - fast_index->bkLeft + 1, fast_index->bkBottom - fast_index->bkTop + 1); } }
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); } }