static void paint_fly(ModeInfo * mi, Fly * f) { EyeScrInfo *ep = &eye_info[MI_SCREEN(mi)]; Display *display = MI_DISPLAY(mi); Window window = MI_WINDOW(mi); int x = f->x, y = f->y; if (MI_IS_ICONIC(mi)) { /* don't need to unpaint when iconic * ep->flyGC has stipple set, don't use when iconic */ XSetForeground(display, MI_GC(mi), f->pixel); XFillArc(display, window, MI_GC(mi), x, y, f->width, f->height, 90 * 64, 360 * 64); } else { unpaint_fly(mi, f); XSetForeground(display, ep->flyGC, f->pixel); #ifdef XBM_GRELB if (ep->fly2pix != None) { XSetStipple(display, ep->flyGC, (f->vy <= 0) ? ep->flypix : ep->fly2pix); } else #endif XSetStipple(display, ep->flyGC, ep->flypix); XSetTSOrigin(display, ep->flyGC, x, y); #ifdef FLASH XSetFillStyle(display, ep->flyGC, FillStippled); #else XSetFillStyle(display, ep->flyGC, FillOpaqueStippled); #endif XFillRectangle(display, window, ep->flyGC, x, y, f->width, f->height); XFlush(display); } }
static BOOL xf_Glyph_Draw(rdpContext* context, const rdpGlyph* glyph, UINT32 x, UINT32 y, UINT32 w, UINT32 h, UINT32 sx, UINT32 sy, BOOL fOpRedundant) { xfGlyph* xf_glyph; xfContext* xfc = (xfContext*) context; xf_glyph = (xfGlyph*) glyph; xf_lock_x11(xfc, FALSE); if (!fOpRedundant) { XSetFillStyle(xfc->display, xfc->gc, FillOpaqueStippled); XFillRectangle(xfc->display, xfc->drawable, xfc->gc, x, y, w, h); } XSetFillStyle(xfc->display, xfc->gc, FillStippled); XSetStipple(xfc->display, xfc->gc, xf_glyph->pixmap); if (sx || sy) WLog_ERR(TAG, ""); //XSetClipOrigin(xfc->display, xfc->gc, sx, sy); XSetTSOrigin(xfc->display, xfc->gc, x, y); XFillRectangle(xfc->display, xfc->drawing, xfc->gc, x, y, w, h); xf_unlock_x11(xfc, FALSE); return TRUE; }
GdkPixmap * fb_bg_get_xroot_pix_for_win(FbBg *bg, GtkWidget *widget) { Window win; Window dummy; Pixmap bgpix; GdkPixmap *gbgpix; int width, height ; int border, depth, x, y ; ENTER; win = GDK_WINDOW_XWINDOW(widget->window); if (!XGetGeometry(bg->dpy, win, &dummy, &x, &y, &width, &height, &border, &depth)) { DBG2("XGetGeometry failed\n"); RET(NULL); } XTranslateCoordinates(bg->dpy, win, bg->xroot, 0, 0, &x, &y, &dummy); DBG("win=%x %dx%d%+d%+d\n", win, width, height, x, y); gbgpix = gdk_pixmap_new(NULL, width, height, depth); if (!gbgpix) { ERR("gdk_pixmap_new failed\n"); RET(NULL); } bgpix = gdk_x11_drawable_get_xid(gbgpix); XSetTSOrigin(bg->dpy, bg->gc, -x, -y) ; XFillRectangle(bg->dpy, bgpix, bg->gc, 0, 0, width, height); RET(gbgpix); }
void panel_clear_background(void *obj) { Panel *p = obj; clear_pixmap(p->area.pix, 0, 0, p->area.width, p->area.height); if (!server.real_transparency) { get_root_pixmap(); // copy background (server.root_pmap) in panel.area.pix Window dummy; int x, y; XTranslateCoordinates(server.display, p->main_win, server.root_win, 0, 0, &x, &y, &dummy); if (panel_autohide && p->is_hidden) { int xoff = 0, yoff = 0; if (panel_horizontal && panel_position & BOTTOM) yoff = p->area.height - p->hidden_height; else if (!panel_horizontal && panel_position & RIGHT) xoff = p->area.width - p->hidden_width; x -= xoff; y -= yoff; } XSetTSOrigin(server.display, server.gc, -x, -y); XFillRectangle(server.display, p->area.pix, server.gc, 0, 0, p->area.width, p->area.height); } }
void set_panel_background(Panel *p) { if (p->area.pix) XFreePixmap (server.dsp, p->area.pix); p->area.pix = XCreatePixmap (server.dsp, server.root_win, p->area.width, p->area.height, server.depth); int xoff=0, yoff=0; if (panel_horizontal && panel_position & BOTTOM) yoff = p->area.height-p->hidden_height; else if (!panel_horizontal && panel_position & RIGHT) xoff = p->area.width-p->hidden_width; if (server.real_transparency) { clear_pixmap(p->area.pix, 0, 0, p->area.width, p->area.height); } else { get_root_pixmap(); // copy background (server.root_pmap) in panel.area.pix Window dummy; int x, y; XTranslateCoordinates(server.dsp, p->main_win, server.root_win, 0, 0, &x, &y, &dummy); if (panel_autohide && p->is_hidden) { x -= xoff; y -= yoff; } XSetTSOrigin(server.dsp, server.gc, -x, -y); XFillRectangle(server.dsp, p->area.pix, server.gc, 0, 0, p->area.width, p->area.height); } // draw background panel cairo_surface_t *cs; cairo_t *c; cs = cairo_xlib_surface_create (server.dsp, p->area.pix, server.visual, p->area.width, p->area.height); c = cairo_create (cs); draw_background(&p->area, c); cairo_destroy (c); cairo_surface_destroy (cs); if (panel_autohide) { if (p->hidden_pixmap) XFreePixmap(server.dsp, p->hidden_pixmap); p->hidden_pixmap = XCreatePixmap(server.dsp, server.root_win, p->hidden_width, p->hidden_height, server.depth); XCopyArea(server.dsp, p->area.pix, p->hidden_pixmap, server.gc, xoff, yoff, p->hidden_width, p->hidden_height, 0, 0); } // redraw panel's object GSList *l0; Area *a; for (l0 = p->area.list; l0 ; l0 = l0->next) { a = l0->data; set_redraw(a); } // reset task 'state_pix' int i; Taskbar *tskbar; for (i=0 ; i < p->nb_desktop ; i++) { tskbar = &p->taskbar[i]; for (l0 = tskbar->area.list; l0 ; l0 = l0->next) { set_task_redraw((Task *)l0->data); } } }
cairo_status_t _cairo_xcb_surface_core_fill_boxes (cairo_xcb_surface_t *dst, const cairo_color_t *color, cairo_boxes_t *boxes) { struct _cairo_boxes_chunk *chunk; xcb_gcontext_t gc; cairo_status_t status; status = _cairo_xcb_connection_acquire (dst->connection); if (unlikely (status)) return status; status = _cairo_xcb_connection_take_socket (dst->connection); if (unlikely (status)) { _cairo_xcb_connection_release (dst->connection); return status; } gc = _cairo_xcb_screen_get_gc (dst->screen, dst->drawable, dst->depth); #if 0 xcb_pixmap_t source; source = _dither_source (dst, color); XSetTSOrigin (surface->dpy, gc, 0, 0); XSetTile (surface->dpy, gc, source); #endif for (chunk = &boxes->chunks; chunk != NULL; chunk = chunk->next) { xcb_rectangle_t *xcb_rects; int i; xcb_rects = (xcb_rectangle_t *) chunk->base; for (i = 0; i < chunk->count; i++) { int x1 = _cairo_fixed_integer_round (chunk->base[i].p1.x); int x2 = _cairo_fixed_integer_round (chunk->base[i].p2.x); int y1 = _cairo_fixed_integer_round (chunk->base[i].p1.y); int y2 = _cairo_fixed_integer_round (chunk->base[i].p2.y); xcb_rects[i].x = x1; xcb_rects[i].y = y1; xcb_rects[i].width = x2 - x1; xcb_rects[i].height = y2 - y1; } _cairo_xcb_connection_poly_fill_rectangle (dst->connection, dst->drawable, gc, chunk->count, xcb_rects); } _cairo_xcb_screen_put_gc (dst->screen, dst->depth, gc); _cairo_xcb_connection_release (dst->connection); return CAIRO_STATUS_SUCCESS; }
void xf_Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y) { xfGlyph* xf_glyph; xfInfo* xfi = ((xfContext*) context)->xfi; xf_glyph = (xfGlyph*) glyph; XSetStipple(xfi->display, xfi->gc, xf_glyph->pixmap); XSetTSOrigin(xfi->display, xfi->gc, x, y); XFillRectangle(xfi->display, xfi->drawing, xfi->gc, x, y, glyph->cx, glyph->cy); XSetStipple(xfi->display, xfi->gc, xfi->bitmap_mono); }
/*ARGSUSED*/ void Tk_SetTSOrigin( Tk_Window tkwin, GC gc, int x, int y) { while (!Tk_TopWinHierarchy(tkwin)) { x -= Tk_X(tkwin) + Tk_Changes(tkwin)->border_width; y -= Tk_Y(tkwin) + Tk_Changes(tkwin)->border_width; tkwin = Tk_Parent(tkwin); } XSetTSOrigin(Tk_Display(tkwin), gc, x, y); }
void rf_Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y) { #ifdef RF_GLYPH rfGlyph* rf_glyph; rfContext* rfi = (rfContext*) context; rf_glyph = (rfGlyph*) glyph; XSetStipple(rfi->display, rfi->gc, rf_glyph->pixmap); XSetTSOrigin(rfi->display, rfi->gc, x, y); XFillRectangle(rfi->display, rfi->drawing, rfi->gc, x, y, glyph->cx, glyph->cy); XSetStipple(rfi->display, rfi->gc, rfi->bitmap_mono); #endif }
void xf_Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y) { xfGlyph* xf_glyph; xfContext* xfc = (xfContext*) context; xf_glyph = (xfGlyph*) glyph; xf_lock_x11(xfc, FALSE); XSetStipple(xfc->display, xfc->gc, xf_glyph->pixmap); XSetTSOrigin(xfc->display, xfc->gc, x, y); XFillRectangle(xfc->display, xfc->drawing, xfc->gc, x, y, glyph->cx, glyph->cy); XSetStipple(xfc->display, xfc->gc, xfc->bitmap_mono); xf_unlock_x11(xfc, FALSE); }
static PyObject * PaxGC_SetTSOrigin(PaxGCObject *self, PyObject*args) { int arg1; int arg2; if (self->shared) { PyErr_SetString(PyExc_TypeError, "can't modify shared GC"); return NULL; } if (!PyArg_ParseTuple(args, "ii", &arg1, &arg2)) return NULL; XSetTSOrigin(self->display, self->gc, arg1, arg2); Py_INCREF(Py_None); return Py_None; }
/**************************************************************************** Fill the area covered by the sprite with the given color. ****************************************************************************/ void canvas_fog_sprite_area(struct canvas *pcanvas, struct sprite *psprite, int canvas_x, int canvas_y) { if (psprite->has_mask) { XSetClipOrigin(display, fill_tile_gc, canvas_x, canvas_y); XSetClipMask(display, fill_tile_gc, psprite->mask); } XSetStipple(display, fill_tile_gc, gray50); XSetTSOrigin(display, fill_tile_gc, canvas_x, canvas_y); XSetForeground(display, fill_tile_gc, get_color(tileset, COLOR_MAPVIEW_UNKNOWN)->color.pixel); XFillRectangle(display, pcanvas->pixmap, fill_tile_gc, canvas_x, canvas_y, psprite->width, psprite->height); if (psprite->has_mask) { XSetClipMask(display, fill_tile_gc, None); } }
GdkPixmap * bg_new_for_win(Window win) { Window dummy; Pixmap bgpix; GdkPixmap *gbgpix; int width, height ; int border, depth, x, y ; ENTER; XGetGeometry(dpy, win, &dummy, &x, &y, &width, &height, &border, &depth); XTranslateCoordinates(dpy, win, xroot, 0, 0, &x, &y, &dummy); gbgpix = gdk_pixmap_new(NULL, width, height, depth); if (!gbgpix) RET(NULL); bgpix = gdk_x11_drawable_get_xid(gbgpix); XSetTSOrigin(dpy, gc, -x, -y) ; XFillRectangle(dpy, bgpix, gc, 0, 0, width, height); RET(gbgpix); }
void LFSTK_imageClass::LFSTK_clearWindow(void) { if(this->wc->useTile==true) { XSetTSOrigin(this->display,this->gc,0-this->gadgetGeom.x,0-this->gadgetGeom.y); XSetFillStyle(this->display,this->gc,FillTiled); XSetTile(this->display,this->gc,this->wc->tile[0]); XFillRectangle(this->display,this->window,this->gc,0,0,this->gadgetGeom.w,this->gadgetGeom.h); XSetFillStyle(this->display,this->gc,FillSolid); } else { XSetFillStyle(this->display,this->gc,FillSolid); XSetForeground(this->display,this->gc,this->wc->windowColourNames[NORMALCOLOUR].pixel); XFillRectangle(this->display,this->window,this->gc,0,0,this->gadgetGeom.w,this->gadgetGeom.h); } if(this->gotIcon==true) { XSetClipMask(this->display,this->gc,this->icon[1]); XSetClipOrigin(this->display,this->gc,0,0); XCopyArea(this->display,this->icon[0],this->window,this->gc,0,0,this->iconSize,this->iconSize,0,0); XSetClipMask(this->display,this->gc,None); } else if(this->useImage==true) { imlib_context_set_display(this->display); imlib_context_set_visual(this->visual); imlib_context_set_colormap(this->cm); imlib_context_set_drawable(this->window); imlib_context_set_image(this->image); imlib_context_set_blend(1); imlib_render_image_on_drawable_at_size(4,(this->gadgetGeom.h/2)-(this->imageHeight/2),this->imageWidth,this->imageHeight); } }
void XmLStringDrawDirection(Display *dpy, Window win, XmFontList fontlist, XmString string, GC gc, int x, int y, Dimension width, unsigned char alignment, unsigned char layout_direction, unsigned char drawing_direction) { Screen *screen; XFontStruct *fontStruct; XImage *sourceImage, *destImage; Pixmap pixmap; GC pixmapGC; /* int sourceWidth, sourceHeight;*/ int destWidth, destHeight; int stringWidth, stringHeight; int i, j, bytesPerLine; Dimension dW, dH; char *data; screen = DefaultScreenOfDisplay(dpy); XmStringExtent(fontlist, string, &dW, &dH); stringWidth = (int)dW; stringHeight = (int)dH; if (!stringWidth || !stringHeight) return; /* draw string into 1 bit deep pixmap */ pixmap = XCreatePixmap(dpy, win, stringWidth, stringHeight, 1); pixmapGC = XCreateGC(dpy, pixmap, 0, NULL); fontStruct = XLoadQueryFont(dpy, "fixed"); if (!fontStruct) { fprintf(stderr, "XmLStringDrawDirection: error - "); fprintf(stderr, "can't load fixed font\n"); return; } XSetFont(dpy, pixmapGC, fontStruct->fid); XSetBackground(dpy, pixmapGC, 0L); XSetForeground(dpy, pixmapGC, 0L); XFillRectangle(dpy, pixmap, pixmapGC, 0, 0, stringWidth, stringHeight); XSetForeground(dpy, pixmapGC, 1L); XmStringDraw(dpy, pixmap, fontlist, string, pixmapGC, 0, 0, stringWidth, XmALIGNMENT_BEGINNING, layout_direction, 0); XFreeFont(dpy, fontStruct); /* copy 1 bit deep pixmap into source image */ sourceImage = XGetImage(dpy, pixmap, 0, 0, stringWidth, stringHeight, 1, XYPixmap); XFreePixmap(dpy, pixmap); /* draw rotated text into destination image */ if (drawing_direction == XmSTRING_UP || drawing_direction == XmSTRING_DOWN) { destWidth = stringHeight; destHeight = stringWidth; } else { destWidth = stringWidth; destHeight = stringHeight; } bytesPerLine = (destWidth - 1) / 8 + 1; data = (char *)malloc(bytesPerLine * destHeight); destImage = XCreateImage(dpy, DefaultVisualOfScreen(screen), 1, XYBitmap, 0, data, destWidth, destHeight, 8, 0); for (i = 0; i < stringWidth; i++) for (j = 0; j < stringHeight; j++) { if (drawing_direction == XmSTRING_UP) XPutPixel(destImage, j, i, XGetPixel(sourceImage, stringWidth - i - 1, j)); else if (drawing_direction == XmSTRING_DOWN) XPutPixel(destImage, stringHeight - j - 1, stringWidth - i - 1, XGetPixel(sourceImage, stringWidth - i - 1, j)); else if (drawing_direction == XmSTRING_LEFT) XPutPixel(destImage, i, stringHeight - j - 1, XGetPixel(sourceImage, stringWidth - i - 1, j)); else XPutPixel(destImage, i, j, XGetPixel(sourceImage, i, j)); } XDestroyImage(sourceImage); /* copy rotated image into 1 bit deep pixmap */ pixmap = XCreatePixmap(dpy, win, destWidth, destHeight, 1); XPutImage(dpy, pixmap, pixmapGC, destImage, 0, 0, 0, 0, destWidth, destHeight); XDestroyImage(destImage); XFreeGC(dpy, pixmapGC); /* adjust position for alignment */ if (drawing_direction == XmSTRING_UP || drawing_direction == XmSTRING_DOWN) { if (alignment == XmALIGNMENT_BEGINNING) ; else if (alignment == XmALIGNMENT_CENTER) y += width / 2 - stringWidth / 2; else if (alignment == XmALIGNMENT_END) y += (int)width - stringWidth; } else { if (alignment == XmALIGNMENT_BEGINNING) ; else if (alignment == XmALIGNMENT_CENTER) x += width / 2 - stringWidth / 2; else if (alignment == XmALIGNMENT_END) x += (int)width - stringWidth; } /* draw the pixmap as a stipple in the window */ XSetStipple(dpy, gc, pixmap); XSetFillStyle(dpy, gc, FillStippled); XSetTSOrigin(dpy, gc, x % destWidth, y % destHeight); XFillRectangle(dpy, win, gc, x, y, destWidth, destHeight); XFreePixmap(dpy, pixmap); XSetFillStyle(dpy, gc, FillSolid); }
static int xdraw(Memdrawparam *par) { int dy, dx; unsigned m; Memimage *src, *dst, *mask; Xmem *dxm, *sxm, *mxm; GC gc; Rectangle r, sr, mr; ulong sdval; dx = Dx(par->r); dy = Dy(par->r); src = par->src; dst = par->dst; mask = par->mask; r = par->r; sr = par->sr; mr = par->mr; sdval = par->sdval; return 0; if((dxm = dst->X) == nil) return 0; /* * If we have an opaque mask and source is one opaque pixel we can convert to the * destination format and just XFillRectangle. */ m = Simplesrc|Simplemask|Fullmask; if((par->state&m)==m){ xfillcolor(dst, r, sdval); dirtyXdata(dst, par->r); return 1; } /* * If no source alpha, an opaque mask, we can just copy the * source onto the destination. If the channels are the same and * the source is not replicated, XCopyArea suffices. */ m = Simplemask|Fullmask; if((par->state&(m|Replsrc))==m && src->chan == dst->chan && src->X){ sxm = src->X; r = rectsubpt(r, dst->r.min); sr = rectsubpt(sr, src->r.min); if(dst->chan == GREY1) gc = xgccopy0; else gc = xgccopy; XCopyArea(xdisplay, sxm->pmid, dxm->pmid, gc, sr.min.x, sr.min.y, dx, dy, r.min.x, r.min.y); dirtyXdata(dst, par->r); return 1; } /* * If no source alpha, a 1-bit mask, and a simple source * we can just copy through the mask onto the destination. */ if(dst->X && mask->X && !(mask->flags&Frepl) && mask->chan == GREY1 && (par->state&Simplesrc)){ Point p; mxm = mask->X; r = rectsubpt(r, dst->r.min); mr = rectsubpt(mr, mask->r.min); p = subpt(r.min, mr.min); if(dst->chan == GREY1){ gc = xgcsimplesrc0; if(xgcsimplecolor0 != sdval){ XSetForeground(xdisplay, gc, sdval); xgcsimplecolor0 = sdval; } if(xgcsimplepm0 != mxm->pmid){ XSetStipple(xdisplay, gc, mxm->pmid); xgcsimplepm0 = mxm->pmid; } }else{ /* somehow this doesn't work on rob's mac gc = xgcsimplesrc; if(dst->chan == CMAP8 && xtblbit) sdval = plan9tox11[sdval]; if(xgcsimplecolor != sdval){ XSetForeground(xdisplay, gc, sdval); xgcsimplecolor = sdval; } if(xgcsimplepm != mxm->pmid){ XSetStipple(xdisplay, gc, mxm->pmid); xgcsimplepm = mxm->pmid; } */ return 0; } XSetTSOrigin(xdisplay, gc, p.x, p.y); XFillRectangle(xdisplay, dxm->pmid, gc, r.min.x, r.min.y, dx, dy); dirtyXdata(dst, par->r); return 1; } return 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; }
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); }
static int XRotPaintAlignedString(Display* dpy, XFontStruct* font, float angle, Drawable drawable, GC gc, int x, int y, char* text, int align, int bg) { int i; GC my_gc; int xp, yp; float hot_x, hot_y; float hot_xp, hot_yp; float sin_angle, cos_angle; RotatedTextItem *item; Pixmap bitmap_to_paint; /* return early for NULL/empty strings */ if(text==NULL) return 0; if(strlen(text)==0) return 0; /* manipulate angle to 0<=angle<360 degrees */ while(angle<0) angle+=360; while(angle>=360) angle-=360; angle*=M_PI/180; /* horizontal text made easy */ if(angle==0. && style.magnify==1.) return(XRotDrawHorizontalString(dpy, font, drawable, gc, x, y, text, align, bg)); /* get a rotated bitmap */ item=XRotRetrieveFromCache(dpy, font, angle, text, align); if(item==NULL) return 0; /* this gc has similar properties to the user's gc */ my_gc=XCreateGC(dpy, drawable, 0, 0); XCopyGC(dpy, gc, GCForeground|GCBackground|GCFunction|GCPlaneMask, my_gc); /* alignment : which point (hot_x, hot_y) relative to bitmap centre coincides with user's specified point? */ /* y position */ if(align==TLEFT || align==TCENTRE || align==TRIGHT) hot_y=(float)item->rows_in/2*style.magnify; else if(align==MLEFT || align==MCENTRE || align==MRIGHT) hot_y=0; else if(align==BLEFT || align==BCENTRE || align==BRIGHT) hot_y=-(float)item->rows_in/2*style.magnify; else hot_y=-((float)item->rows_in/2-(float)font->descent)*style.magnify; /* x position */ if(align==TLEFT || align==MLEFT || align==BLEFT || align==NONE) hot_x=-(float)item->max_width/2*style.magnify; else if(align==TCENTRE || align==MCENTRE || align==BCENTRE) hot_x=0; else hot_x=(float)item->max_width/2*style.magnify; /* pre-calculate sin and cos */ sin_angle=sin(angle); cos_angle=cos(angle); /* rotate hot_x and hot_y around bitmap centre */ hot_xp= hot_x*cos_angle - hot_y*sin_angle; hot_yp= hot_x*sin_angle + hot_y*cos_angle; /* text background will be drawn using XFillPolygon */ if(bg) { GC depth_one_gc; XPoint *xpoints; Pixmap empty_stipple; /* reserve space for XPoints */ xpoints=(XPoint *)malloc((unsigned)(4*item->nl*sizeof(XPoint))); if(!xpoints) return 1; /* rotate corner positions */ for(i=0; i<4*item->nl; i++) { xpoints[i].x=(float)x + ( (item->corners_x[i]-hot_x)*cos_angle + (item->corners_y[i]+hot_y)*sin_angle); xpoints[i].y=(float)y + (-(item->corners_x[i]-hot_x)*sin_angle + (item->corners_y[i]+hot_y)*cos_angle); } /* we want to swap foreground and background colors here; XGetGCValues() is only available in R4+ */ empty_stipple=XCreatePixmap(dpy, drawable, 1, 1, 1); depth_one_gc=XCreateGC(dpy, empty_stipple, 0, 0); XSetForeground(dpy, depth_one_gc, 0); XFillRectangle(dpy, empty_stipple, depth_one_gc, 0, 0, 2, 2); XSetStipple(dpy, my_gc, empty_stipple); XSetFillStyle(dpy, my_gc, FillOpaqueStippled); XFillPolygon(dpy, drawable, my_gc, xpoints, 4*item->nl, Nonconvex, CoordModeOrigin); /* free our resources */ free((char *)xpoints); XFreeGC(dpy, depth_one_gc); XFreePixmap(dpy, empty_stipple); } /* where should top left corner of bitmap go ? */ xp=(float)x-((float)item->cols_out/2 +hot_xp); yp=(float)y-((float)item->rows_out/2 -hot_yp); /* by default we draw the rotated bitmap, solid */ bitmap_to_paint=item->bitmap; /* handle user stippling */ #ifndef X11R3 { GC depth_one_gc; XGCValues values; Pixmap new_bitmap, inverse; /* try and get some GC properties */ if(XGetGCValues(dpy, gc, GCStipple|GCFillStyle|GCForeground|GCBackground| GCTileStipXOrigin|GCTileStipYOrigin, &values)) { /* only do this if stippling requested */ if((values.fill_style==FillStippled || values.fill_style==FillOpaqueStippled) && !bg) { /* opaque stipple: draw rotated text in background colour */ if(values.fill_style==FillOpaqueStippled) { XSetForeground(dpy, my_gc, values.background); XSetFillStyle(dpy, my_gc, FillStippled); XSetStipple(dpy, my_gc, item->bitmap); XSetTSOrigin(dpy, my_gc, xp, yp); XFillRectangle(dpy, drawable, my_gc, xp, yp, item->cols_out, item->rows_out); XSetForeground(dpy, my_gc, values.foreground); } /* this will merge the rotated text and the user's stipple */ new_bitmap=XCreatePixmap(dpy, drawable, item->cols_out, item->rows_out, 1); /* create a GC */ depth_one_gc=XCreateGC(dpy, new_bitmap, 0, 0); XSetForeground(dpy, depth_one_gc, 1); XSetBackground(dpy, depth_one_gc, 0); /* set the relative stipple origin */ XSetTSOrigin(dpy, depth_one_gc, values.ts_x_origin-xp, values.ts_y_origin-yp); /* fill the whole bitmap with the user's stipple */ XSetStipple(dpy, depth_one_gc, values.stipple); XSetFillStyle(dpy, depth_one_gc, FillOpaqueStippled); XFillRectangle(dpy, new_bitmap, depth_one_gc, 0, 0, item->cols_out, item->rows_out); /* set stipple origin back to normal */ XSetTSOrigin(dpy, depth_one_gc, 0, 0); /* this will contain an inverse copy of the rotated text */ inverse=XCreatePixmap(dpy, drawable, item->cols_out, item->rows_out, 1); /* invert text */ XSetFillStyle(dpy, depth_one_gc, FillSolid); XSetFunction(dpy, depth_one_gc, GXcopyInverted); XCopyArea(dpy, item->bitmap, inverse, depth_one_gc, 0, 0, item->cols_out, item->rows_out, 0, 0); /* now delete user's stipple everywhere EXCEPT on text */ XSetForeground(dpy, depth_one_gc, 0); XSetBackground(dpy, depth_one_gc, 1); XSetStipple(dpy, depth_one_gc, inverse); XSetFillStyle(dpy, depth_one_gc, FillStippled); XSetFunction(dpy, depth_one_gc, GXcopy); XFillRectangle(dpy, new_bitmap, depth_one_gc, 0, 0, item->cols_out, item->rows_out); /* free resources */ XFreePixmap(dpy, inverse); XFreeGC(dpy, depth_one_gc); /* this is the new bitmap */ bitmap_to_paint=new_bitmap; } } } #endif /*X11R3*/ /* paint text using stipple technique */ XSetFillStyle(dpy, my_gc, FillStippled); XSetStipple(dpy, my_gc, bitmap_to_paint); XSetTSOrigin(dpy, my_gc, xp, yp); XFillRectangle(dpy, drawable, my_gc, xp, yp, item->cols_out, item->rows_out); /* free our resources */ XFreeGC(dpy, my_gc); /* stippled bitmap no longer needed */ if(bitmap_to_paint!=item->bitmap) XFreePixmap(dpy, bitmap_to_paint); #ifdef CACHE_XIMAGES XFreePixmap(dpy, item->bitmap); #endif /*CACHE_XIMAGES*/ /* if item isn't cached, destroy it completely */ if(!item->cached) XRotFreeTextItem(dpy,item); /* we got to the end OK! */ return 0; }
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); } }
static void DisplayCanvText( Tk_Canvas canvas, /* Canvas that contains item. */ Tk_Item *itemPtr, /* Item to be displayed. */ Display *display, /* Display on which to draw item. */ Drawable drawable, /* Pixmap or window in which to draw item. */ int x, int y, int width, int height) /* Describes region of canvas that must be * redisplayed (not used). */ { TextItem *textPtr; Tk_CanvasTextInfo *textInfoPtr; int selFirstChar, selLastChar; short drawableX, drawableY; Pixmap stipple; Tk_State state = itemPtr->state; textPtr = (TextItem *) itemPtr; textInfoPtr = textPtr->textInfoPtr; if (state == TK_STATE_NULL) { state = Canvas(canvas)->canvas_state; } stipple = textPtr->stipple; if (Canvas(canvas)->currentItemPtr == itemPtr) { if (textPtr->activeStipple != None) { stipple = textPtr->activeStipple; } } else if (state == TK_STATE_DISABLED) { if (textPtr->disabledStipple != None) { stipple = textPtr->disabledStipple; } } if (textPtr->gc == NULL) { return; } /* * If we're stippling, then modify the stipple offset in the GC. Be sure * to reset the offset when done, since the GC is supposed to be * read-only. */ if (stipple != None) { Tk_CanvasSetOffset(canvas, textPtr->gc, &textPtr->tsoffset); } selFirstChar = -1; selLastChar = 0; /* lint. */ Tk_CanvasDrawableCoords(canvas, textPtr->drawOrigin[0], textPtr->drawOrigin[1], &drawableX, &drawableY); if (textInfoPtr->selItemPtr == itemPtr) { selFirstChar = textInfoPtr->selectFirst; selLastChar = textInfoPtr->selectLast; if (selLastChar > textPtr->numChars) { selLastChar = textPtr->numChars - 1; } if ((selFirstChar >= 0) && (selFirstChar <= selLastChar)) { int xFirst, yFirst, hFirst; int xLast, yLast, wLast; /* * Draw a special background under the selection. */ Tk_CharBbox(textPtr->textLayout, selFirstChar, &xFirst, &yFirst, NULL, &hFirst); Tk_CharBbox(textPtr->textLayout, selLastChar, &xLast, &yLast, &wLast, NULL); /* * If the selection spans the end of this line, then display * selection background all the way to the end of the line. * However, for the last line we only want to display up to the * last character, not the end of the line. */ x = xFirst; height = hFirst; for (y = yFirst ; y <= yLast; y += height) { int dx1, dy1, dx2, dy2; double s = textPtr->sine, c = textPtr->cosine; XPoint points[4]; if (y == yLast) { width = xLast + wLast - x; } else { width = textPtr->actualWidth - x; } dx1 = x - textInfoPtr->selBorderWidth; dy1 = y; dx2 = width + 2 * textInfoPtr->selBorderWidth; dy2 = height; points[0].x = (short)(drawableX + dx1*c + dy1*s); points[0].y = (short)(drawableY + dy1*c - dx1*s); points[1].x = (short)(drawableX + (dx1+dx2)*c + dy1*s); points[1].y = (short)(drawableY + dy1*c - (dx1+dx2)*s); points[2].x = (short)(drawableX + (dx1+dx2)*c + (dy1+dy2)*s); points[2].y = (short)(drawableY + (dy1+dy2)*c - (dx1+dx2)*s); points[3].x = (short)(drawableX + dx1*c + (dy1+dy2)*s); points[3].y = (short)(drawableY + (dy1+dy2)*c - dx1*s); Tk_Fill3DPolygon(Tk_CanvasTkwin(canvas), drawable, textInfoPtr->selBorder, points, 4, textInfoPtr->selBorderWidth, TK_RELIEF_RAISED); x = 0; } } } /* * If the insertion point should be displayed, then draw a special * background for the cursor before drawing the text. Note: if we're the * cursor item but the cursor is turned off, then redraw background over * the area of the cursor. This guarantees that the selection won't make * the cursor invisible on mono displays, where both are drawn in the same * color. */ if ((textInfoPtr->focusItemPtr == itemPtr) && (textInfoPtr->gotFocus)) { if (Tk_CharBbox(textPtr->textLayout, textPtr->insertPos, &x, &y, NULL, &height)) { int dx1, dy1, dx2, dy2; double s = textPtr->sine, c = textPtr->cosine; XPoint points[4]; dx1 = x - (textInfoPtr->insertWidth / 2); dy1 = y; dx2 = textInfoPtr->insertWidth; dy2 = height; points[0].x = (short)(drawableX + dx1*c + dy1*s); points[0].y = (short)(drawableY + dy1*c - dx1*s); points[1].x = (short)(drawableX + (dx1+dx2)*c + dy1*s); points[1].y = (short)(drawableY + dy1*c - (dx1+dx2)*s); points[2].x = (short)(drawableX + (dx1+dx2)*c + (dy1+dy2)*s); points[2].y = (short)(drawableY + (dy1+dy2)*c - (dx1+dx2)*s); points[3].x = (short)(drawableX + dx1*c + (dy1+dy2)*s); points[3].y = (short)(drawableY + (dy1+dy2)*c - dx1*s); Tk_SetCaretPos(Tk_CanvasTkwin(canvas), points[0].x, points[0].y, height); if (textInfoPtr->cursorOn) { Tk_Fill3DPolygon(Tk_CanvasTkwin(canvas), drawable, textInfoPtr->insertBorder, points, 4, textInfoPtr->insertBorderWidth, TK_RELIEF_RAISED); } else if (textPtr->cursorOffGC != NULL) { /* * Redraw the background over the area of the cursor, even * though the cursor is turned off. This guarantees that the * selection won't make the cursor invisible on mono displays, * where both may be drawn in the same color. */ XFillPolygon(display, drawable, textPtr->cursorOffGC, points, 4, Convex, CoordModeOrigin); } } } /* * If there is no selected text or the selected text foreground is the * same as the regular text foreground, then draw one text string. If * there is selected text and the foregrounds differ, draw the regular * text up to the selection, draw the selection, then draw the rest of the * regular text. Drawing the regular text and then the selected text over * it would causes problems with anti-aliased text because the two * anti-aliasing colors would blend together. */ if ((selFirstChar >= 0) && (textPtr->selTextGC != textPtr->gc)) { TkDrawAngledTextLayout(display, drawable, textPtr->gc, textPtr->textLayout, drawableX, drawableY, textPtr->angle, 0, selFirstChar); TkDrawAngledTextLayout(display, drawable, textPtr->selTextGC, textPtr->textLayout, drawableX, drawableY, textPtr->angle, selFirstChar, selLastChar + 1); TkDrawAngledTextLayout(display, drawable, textPtr->gc, textPtr->textLayout, drawableX, drawableY, textPtr->angle, selLastChar + 1, -1); } else { TkDrawAngledTextLayout(display, drawable, textPtr->gc, textPtr->textLayout, drawableX, drawableY, textPtr->angle, 0, -1); } TkUnderlineAngledTextLayout(display, drawable, textPtr->gc, textPtr->textLayout, drawableX, drawableY, textPtr->angle, textPtr->underline); if (stipple != None) { XSetTSOrigin(display, textPtr->gc, 0, 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); }
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); }
static void setupGC(Display * dpy, GC gc, unsigned long valuemask, XGCValues * values) { if (valuemask & GCFunction) XSetFunction(dpy, gc, values->function); if (valuemask & GCForeground) XSetForeground(dpy, gc, values->foreground); if (valuemask & GCBackground) XSetBackground(dpy, gc, values->background); //FIXME add save gc->ext_data values for each of these... if (valuemask & GCFont) XSetFont(dpy, gc, values->font); if (valuemask & GCGraphicsExposures) XSetGraphicsExposures(dpy, gc, values->graphics_exposures); if ((valuemask & GCClipXOrigin) && (valuemask & GCClipYOrigin)) XSetClipOrigin(dpy, gc, values->clip_x_origin, values->clip_y_origin); if (valuemask & GCClipMask) XSetClipMask(dpy, gc, values->clip_mask); if (valuemask & GCFillStyle) XSetFillStyle(dpy, gc, values->fill_style); if ((valuemask & GCTileStipXOrigin) && (valuemask & GCTileStipYOrigin)) XSetTSOrigin(dpy, gc, values->ts_x_origin, values->ts_y_origin); // FIXME if (valuemask & (GCLineWidth | GCLineStyle | GCCapStyle | GCJoinStyle)) XSetLineAttributes(dpy, gc, values->line_width, values->line_style, values->cap_style, values->join_style); if (valuemask & GCFillRule) XSetFillStyle(dpy, gc, values->fill_rule); if (valuemask & GCTile) XSetTile(dpy, gc, values->tile); if (valuemask & GCStipple) XSetStipple(dpy, gc, values->stipple); if (valuemask & (GCDashOffset | GCDashList)) { // FIXME is this correct for values->dashes? if (values->dashes) { char d[2]; d[0] = d[1] = values->dashes; XSetDashes(dpy, gc, values->dash_offset, d, 2); } } if (valuemask & GCSubwindowMode) XSetSubwindowMode(dpy, gc, values->subwindow_mode); if (valuemask & GCPlaneMask) DPRINTF("XCreateGC: GCPlaneMask not implemented\n"); if (valuemask & GCArcMode) DPRINTF("XCreateGC: GCArcMode not implemented\n"); }
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); } }
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); }
static void DisplayRectOval( Tk_Canvas canvas, /* Canvas that contains item. */ Tk_Item *itemPtr, /* Item to be displayed. */ Display *display, /* Display on which to draw item. */ Drawable drawable, /* Pixmap or window in which to draw item. */ int x, int y, int width, int height) /* Describes region of canvas that must be * redisplayed (not used). */ { RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr; short x1, y1, x2, y2; Pixmap fillStipple; Tk_State state = itemPtr->state; /* * Compute the screen coordinates of the bounding box for the item. Make * sure that the bbox is at least one pixel large, since some X servers * will die if it isn't. */ Tk_CanvasDrawableCoords(canvas, rectOvalPtr->bbox[0],rectOvalPtr->bbox[1], &x1, &y1); Tk_CanvasDrawableCoords(canvas, rectOvalPtr->bbox[2],rectOvalPtr->bbox[3], &x2, &y2); if (x2 <= x1) { x2 = x1+1; } if (y2 <= y1) { y2 = y1+1; } /* * Display filled part first (if wanted), then outline. If we're * stippling, then modify the stipple offset in the GC. Be sure to reset * the offset when done, since the GC is supposed to be read-only. */ if (state == TK_STATE_NULL) { state = Canvas(canvas)->canvas_state; } fillStipple = rectOvalPtr->fillStipple; if (Canvas(canvas)->currentItemPtr == (Tk_Item *) rectOvalPtr) { if (rectOvalPtr->activeFillStipple != None) { fillStipple = rectOvalPtr->activeFillStipple; } } else if (state == TK_STATE_DISABLED) { if (rectOvalPtr->disabledFillStipple != None) { fillStipple = rectOvalPtr->disabledFillStipple; } } if (rectOvalPtr->fillGC != None) { if (fillStipple != None) { Tk_TSOffset *tsoffset; int w = 0, h = 0; tsoffset = &rectOvalPtr->tsoffset; if (tsoffset) { int flags = tsoffset->flags; if (flags & (TK_OFFSET_CENTER|TK_OFFSET_MIDDLE)) { Tk_SizeOfBitmap(display, fillStipple, &w, &h); if (flags & TK_OFFSET_CENTER) { w /= 2; } else { w = 0; } if (flags & TK_OFFSET_MIDDLE) { h /= 2; } else { h = 0; } } tsoffset->xoffset -= w; tsoffset->yoffset -= h; } Tk_CanvasSetOffset(canvas, rectOvalPtr->fillGC, tsoffset); if (tsoffset) { tsoffset->xoffset += w; tsoffset->yoffset += h; } } if (rectOvalPtr->header.typePtr == &tkRectangleType) { XFillRectangle(display, drawable, rectOvalPtr->fillGC, x1, y1, (unsigned int) (x2-x1), (unsigned int) (y2-y1)); } else { XFillArc(display, drawable, rectOvalPtr->fillGC, x1, y1, (unsigned) (x2-x1), (unsigned) (y2-y1), 0, 360*64); } if (fillStipple != None) { XSetTSOrigin(display, rectOvalPtr->fillGC, 0, 0); } } if (rectOvalPtr->outline.gc != None) { Tk_ChangeOutlineGC(canvas, itemPtr, &(rectOvalPtr->outline)); if (rectOvalPtr->header.typePtr == &tkRectangleType) { XDrawRectangle(display, drawable, rectOvalPtr->outline.gc, x1, y1, (unsigned) (x2-x1), (unsigned) (y2-y1)); } else { XDrawArc(display, drawable, rectOvalPtr->outline.gc, x1, y1, (unsigned) (x2-x1), (unsigned) (y2-y1), 0, 360*64); } Tk_ResetOutlineGC(canvas, itemPtr, &(rectOvalPtr->outline)); } }
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; }
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; }
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); }