Esempio n. 1
0
static void _render_copy(struct test_target *tt,
			 int x, int y, int w, int h,
			 uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha)
{
	XRenderColor color;
	Picture src;
	Pixmap tmp;

	tmp = XCreatePixmap(tt->dpy->dpy, DefaultRootWindow(tt->dpy->dpy),
			    10+w, 20+h, tt->format->depth);
	src = XRenderCreatePicture(tt->dpy->dpy, tmp, tt->format, 0, NULL);

	/* magenta border */
	color.red = 0xffff;
	color.green = 0;
	color.blue = 0xffff;
	color.alpha = 0xffff;
	XRenderFillRectangle(tt->dpy->dpy, PictOpSrc, src, &color, 0, 0, w+10, h+20);

	color.red = red * alpha;
	color.green = green * alpha;
	color.blue = blue * alpha;
	color.alpha = alpha << 8 | alpha;
	XRenderFillRectangle(tt->dpy->dpy, PictOpSrc, src, &color, 5, 10, w, h);

	XRenderComposite(tt->dpy->dpy, PictOpSrc,
			 src, 0, tt->picture,
			 5, 10,
			 0, 0,
			 x, y,
			 w, h);

	XRenderFreePicture(tt->dpy->dpy, src);
	XFreePixmap(tt->dpy->dpy, tmp);
}
Esempio n. 2
0
void
xfwmPixmapFree (xfwmPixmap * pm)
{

    TRACE ("entering xfwmPixmapFree");

    pm->width = 0;
    pm->height = 0;
    if (pm->pixmap != None)
    {
        XFreePixmap (myScreenGetXDisplay(pm->screen_info), pm->pixmap);
        pm->pixmap = None;
    }
    if (pm->mask != None)
    {
        XFreePixmap (myScreenGetXDisplay(pm->screen_info), pm->mask);
        pm->mask = None;
    }
#ifdef HAVE_RENDER
    if (pm->pict != None)
    {
        XRenderFreePicture (myScreenGetXDisplay(pm->screen_info), pm->pict);
        pm->pict = None;
    }
#endif
}
Esempio n. 3
0
void SetSurface(SystemDraw& w, int x, int y, int cx, int cy, const RGBA *pixels)
{
	GuiLock __;
	Pixmap pixmap = XCreatePixmap(Xdisplay, Xroot, cx, cy, 24);
	XPicture picture = XRenderCreatePicture(
		Xdisplay, pixmap,
	    XRenderFindStandardFormat(Xdisplay, PictStandardRGB24),
	    0, 0
	);
	XImage ximg;
	sInitXImage(ximg, Size(cx, cy));
	ximg.bitmap_pad = 32;
	ximg.bytes_per_line = 4 * cx;
	ximg.bits_per_pixel = 32;
	ximg.blue_mask = 0x00ff0000;
	ximg.green_mask = 0x0000ff00;
	ximg.red_mask = 0x000000ff;
	ximg.bitmap_unit = 32;
	ximg.depth = 24;
	ximg.data = (char *)pixels;
	XInitImage(&ximg);
	GC gc = XCreateGC(Xdisplay, pixmap, 0, 0);
	XPutImage(Xdisplay, pixmap, gc, &ximg, 0, 0, 0, 0, cx, cy);
	XFreeGC(Xdisplay, gc);
	XFreePixmap(Xdisplay, pixmap);
	XRenderComposite(Xdisplay, PictOpOver,
	                 picture, 0, XftDrawPicture(w.GetXftDraw()),
	                 0, 0, 0, 0, x, y, cx, cy);
	XRenderFreePicture(Xdisplay, picture);
}
Esempio n. 4
0
void clear_pixmap(Pixmap p, int x, int y, int w, int h)
{
	Picture pict = XRenderCreatePicture(server.dsp, p, XRenderFindVisualFormat(server.dsp, server.visual), 0, 0);
	XRenderColor col = { .red=0, .green=0, .blue=0, .alpha=0 };
	XRenderFillRectangle(server.dsp, PictOpSrc, pict, &col, x, y, w, h);
	XRenderFreePicture(server.dsp, pict);
}
Esempio n. 5
0
File: gui.c Progetto: mortehu/bra
static void
configure_window (struct gui_instance *gi)
{
  if (gi->back_buffer)
    XRenderFreePicture (GUI_display, gi->back_buffer);

  if (gi->fontdraw)
    XftDrawDestroy (gi->fontdraw);

  if (gi->pmap)
    XFreePixmap (GUI_display, gi->pmap);

  if (gi->gc)
    XFreeGC (GUI_display, gi->gc);

  gi->gc = XCreateGC (GUI_display, gi->window, 0, 0);

  gi->pmap = XCreatePixmap (GUI_display, gi->window, gi->width, gi->height, GUI_visual_info->depth);

  gi->fontdraw = XftDrawCreate (GUI_display, gi->pmap, GUI_visual, DefaultColormap (GUI_display, GUI_screenidx));

  gi->back_buffer
    = XRenderCreatePicture (GUI_display, gi->pmap, xrenderpictformat, 0, 0);

  if (!gi->back_buffer)
    errx (EXIT_FAILURE, "Failed to create back buffer for X window (XRenderCreatePicture)");
}
Esempio n. 6
0
void
xrender_surf_free(Display *disp, Xrender_Surf *rs)
{
   if (rs->allocated) XFreePixmap(disp, rs->draw);
   XRenderFreePicture(disp, rs->pic);
   free(rs);
}
Esempio n. 7
0
void window_set_mapped(Window id, bool mapped)
{
	window_t *window = window_get(id);
	
	if (window == NULL)
		return;
	
	window->mapped = mapped;
	
	if (mapped == TRUE) {
		XRenderPictFormat *format;
		XRenderPictureAttributes pa;
		
		format = XRenderFindVisualFormat(conn, visual);
		pa.subwindow_mode = IncludeInferiors;
		
		if (window->picture != None)
			XRenderFreePicture(conn, window->picture);
		
		if (window->pixmap != None)
			XFreePixmap(conn, window->pixmap);
		
		window->pixmap = XCompositeNameWindowPixmap(conn, id);
		window->picture = XRenderCreatePicture(conn, window->pixmap,
				format, CPSubwindowMode, &pa);
		XDamageCreate(conn, window->pixmap, XDamageReportNonEmpty);
		
		window_list_remove(id);
		window_list_append(id);
	}
}
Esempio n. 8
0
static void
_eiw_render_loop(EX_Window win, EImage * im, EiwData * d)
{
   int                 w, h;
   XRenderPictFormat  *pictfmt;
   EX_Pixmap           pmap;
   EX_Picture          pict;

   EImageGetSize(im, &w, &h);

   pictfmt = XRenderFindStandardFormat(disp, PictStandardARGB32);
   pmap = XCreatePixmap(disp, WinGetXwin(VROOT), w, h, 32);
   imlib_context_set_image(im);
   imlib_context_set_drawable(pmap);
   imlib_render_image_on_drawable(0, 0);
   pict = XRenderCreatePicture(disp, pmap, pictfmt, 0, 0);
   XFreePixmap(disp, pmap);

   if (d->curs != NoXID)
      XFreeCursor(disp, d->curs);
   d->curs = XRenderCreateCursor(disp, pict, w / 2, h / 2);
   XRenderFreePicture(disp, pict);

   XDefineCursor(disp, win, d->curs);
}
Esempio n. 9
0
void PreviewWidget::paintEvent(QPaintEvent *)
{
    QPixmap buffer(size());
    QPainter p(&buffer);
    p.fillRect(rect(), colorGroup().brush(QColorGroup::Background));
    Picture dest;

    if(!qt_has_xft || !qt_use_xrender)
    {
        XRenderPictFormat *fmt = XRenderFindVisualFormat(x11Display(), (Visual *)buffer.x11Visual());
        dest = XRenderCreatePicture(x11Display(), buffer.handle(), fmt, 0, NULL);
    }
    else
        dest = buffer.x11RenderHandle();

    int rwidth = width() / numCursors;

    for(int i = 0; i < numCursors; i++)
    {
        if(cursors[i]->picture())
        {
            XRenderComposite(x11Display(), PictOpOver, cursors[i]->picture(), 0, dest, 0, 0, 0, 0, rwidth * i + (rwidth - cursors[i]->width()) / 2,
                             (height() - cursors[i]->height()) / 2, cursors[i]->width(), cursors[i]->height());
        }
    }

    bitBlt(this, 0, 0, &buffer);

    if(!qt_has_xft || !qt_use_xrender)
        XRenderFreePicture(x11Display(), dest);
}
Esempio n. 10
0
PreviewCursor::~PreviewCursor()
{
    if(m_handle)
        XFreeCursor(QPaintDevice::x11AppDisplay(), m_handle);
    if(m_pict)
        XRenderFreePicture(QPaintDevice::x11AppDisplay(), m_pict);
}
static void fill_rect(struct test_display *dpy, Picture p, uint8_t op,
		      int x, int y, int w, int h,
		      int dx, int dy, enum mask mask,
		      uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha)
{
	XRenderColor render_color;
	XTrapezoid trap;
	Picture src;

	render_color.red   = red * alpha;
	render_color.green = green * alpha;
	render_color.blue  = blue * alpha;
	render_color.alpha = alpha << 8;

	trap.left.p1.x = trap.left.p2.x = (x << 16) + dx;
	trap.top = trap.left.p1.y = trap.right.p1.y = (y << 16) + dy;
	trap.right.p1.x = trap.right.p2.x = ((x + w) << 16) + dx;
	trap.bottom = trap.left.p2.y = trap.right.p2.y = ((y + h) << 16) + dy;

	src = XRenderCreateSolidFill(dpy->dpy, &render_color);
	XRenderCompositeTrapezoids(dpy->dpy,
				   op, src, p, mask_format(dpy->dpy, mask),
				   0, 0, &trap, 1);
	XRenderFreePicture(dpy->dpy, src);
}
Esempio n. 12
0
static double _bench_source(struct test_display *t, enum target target_type,
			    int op, int src, int loops)
{
	XRenderColor render_color = { 0x8000, 0x8000, 0x8000, 0x8000 };
	struct test_target target;
	Picture picture;
	struct timespec tv;
	double elapsed;

	test_target_create_render(t, target_type, &target);
	XRenderFillRectangle(t->dpy, PictOpClear, target.picture, &render_color,
			     0, 0, target.width, target.height);

	picture = source[src].create(t, &target);
	if (picture) {
		test_timer_start(t, &tv);
		while (loops--)
			XRenderComposite(t->dpy, op,
					 picture, 0, target.picture,
					 0, 0,
					 0, 0,
					 0, 0,
					 target.width, target.height);
		elapsed = test_timer_stop(t, &tv);
		XRenderFreePicture(t->dpy, picture);
	} else
		elapsed = -1;

	test_target_destroy_render(t, &target);

	return elapsed;
}
Esempio n. 13
0
static XPicture sGetSolidFill(Color c)
{
	int q = GetHashValue(c) % (int)XRSolidFillCount;
	XRSolidFill& f = sFill[q];
	if(f.color == c && f.picture)
		return f.picture;
	if(f.picture)
		XRenderFreePicture(Xdisplay, f.picture);
	if(f.pixmap)
		XFreePixmap(Xdisplay, f.pixmap);
	f.pixmap = XCreatePixmap(Xdisplay, Xroot, 1, 1, 32);
	XRenderPictureAttributes attr;
	attr.repeat = XTrue;
	f.picture = XRenderCreatePicture(Xdisplay, f.pixmap,
	                                 XRenderFindStandardFormat(Xdisplay, PictStandardARGB32),
	                                                           CPRepeat, &attr);
	f.color = c;
	XRenderColor xc;
	xc.red = s255d16(c.GetR());
	xc.green = s255d16(c.GetG());
	xc.blue = s255d16(c.GetB());
	xc.alpha = 65535;
	XRenderFillRectangle(Xdisplay, PictOpSrc, f.picture, &xc, 0, 0, 1, 1);
	return f.picture;
}
Esempio n. 14
0
static void DrawTrayExtend(winlist_t *win)
{
    Pixmap tray, dummy;
    XpmAttributes attr;
    attr.valuemask = 0;
    XpmCreatePixmapFromData(gui->display, win->window,
			oxim_tray, &tray, &dummy, &attr);

    int tray_w = attr.width;
    int tray_h = attr.height;
    int w = win->width;
    int h = win->height;
    int x=0, y=0;
    int offset_y = h/2 - tray_h/2;
    
    Picture trayw, mask, icon;
    
    XWindowAttributes attrs;

    XGetWindowAttributes( gui->display, win->window , &attrs );
    XRenderPictFormat*  format = XRenderFindVisualFormat( gui->display, attrs.visual );

    XRenderPictFormat *pformat = XRenderFindStandardFormat( gui->display, PictStandardA1 );
    XRenderPictFormat *pformat2 = XRenderFindStandardFormat( gui->display, PictStandardRGB24 );

    XRenderPictureAttributes pattrs;

    trayw = XRenderCreatePicture(gui->display, win->window,
	    format, 0, NULL);

    mask = XRenderCreatePicture(gui->display, icon_mask,
	    pformat, 0, NULL);

    pattrs.alpha_map = mask;
    icon = XRenderCreatePicture(gui->display, picon,
	    pformat2, CPAlphaMap, &pattrs);

    XRenderComposite(gui->display, PictOpOver, icon, None, trayw, 
	    x,y-offset_y , x,y,x,y,w,h);
    XRenderFreePicture(gui->display,trayw);
    XRenderFreePicture(gui->display,mask);
    XRenderFreePicture(gui->display,icon);
    XFreePixmap(gui->display,tray);
    if(dummy)
	XFreePixmap(gui->display,dummy);
}
Esempio n. 15
0
File: xftdraw.c Progetto: aosm/X11
void
XftDrawDestroy (XftDraw	*draw)
{
    int	n;
    
    if (draw->render_able)
    {
	XRenderFreePicture (draw->dpy, draw->render.pict);
	for (n = 0; n < XFT_DRAW_N_SRC; n++)
	    XRenderFreePicture (draw->dpy, draw->render.src[n].pict);
    }
    if (draw->core_set)
	XFreeGC (draw->dpy, draw->core.draw_gc);
    if (draw->clip)
	XDestroyRegion (draw->clip);
    free (draw);
}
Esempio n. 16
0
void xf_draw_screen_scaled(xfContext *xfc, int x, int y, int w, int h, BOOL scale)
{
#ifdef WITH_XRENDER
	XTransform transform;
	Picture windowPicture;
	Picture primaryPicture;
	XRenderPictureAttributes pa;
	XRenderPictFormat *picFormat;
	XRectangle xr;
	picFormat = XRenderFindStandardFormat(xfc->display, PictStandardRGB24);
	pa.subwindow_mode = IncludeInferiors;
	primaryPicture = XRenderCreatePicture(xfc->display, xfc->primary, picFormat, CPSubwindowMode, &pa);
	windowPicture = XRenderCreatePicture(xfc->display, xfc->window->handle, picFormat, CPSubwindowMode, &pa);
	transform.matrix[0][0] = XDoubleToFixed(1);
	transform.matrix[0][1] = XDoubleToFixed(0);
	transform.matrix[0][2] = XDoubleToFixed(0);
	transform.matrix[1][0] = XDoubleToFixed(0);
	transform.matrix[1][1] = XDoubleToFixed(1);
	transform.matrix[1][2] = XDoubleToFixed(0);
	transform.matrix[2][0] = XDoubleToFixed(0);
	transform.matrix[2][1] = XDoubleToFixed(0);
	transform.matrix[2][2] = XDoubleToFixed(xfc->settings->ScalingFactor);
	if((w != 0) && (h != 0))
	{
		if(scale == TRUE)
		{
			xr.x = x * xfc->settings->ScalingFactor;
			xr.y = y * xfc->settings->ScalingFactor;
			xr.width = (w+1) * xfc->settings->ScalingFactor;
			xr.height = (h+1) * xfc->settings->ScalingFactor;
		}
		else
		{
			xr.x = x;
			xr.y = y;
			xr.width = w;
			xr.height = h;
		}
		XRenderSetPictureClipRectangles(xfc->display, primaryPicture, 0, 0, &xr, 1);
	}
	XRenderSetPictureTransform(xfc->display, primaryPicture, &transform);
	XRenderComposite(xfc->display, PictOpSrc, primaryPicture, 0, windowPicture, 0, 0, 0, 0, xfc->offset_x, xfc->offset_y, xfc->currentWidth, xfc->currentHeight);
	XRenderFreePicture(xfc->display, primaryPicture);
	XRenderFreePicture(xfc->display, windowPicture);
#endif
}
Esempio n. 17
0
// Create the compositing buffer. The root window is not double-buffered,
// so it is done manually using this buffer,
void SceneXrender::createBuffer()
{
    if (buffer != None)
        XRenderFreePicture(display(), buffer);
    Pixmap pixmap = XCreatePixmap(display(), rootWindow(), displayWidth(), displayHeight(), DefaultDepth(display(), DefaultScreen(display())));
    buffer = XRenderCreatePicture(display(), pixmap, format, 0, 0);
    XFreePixmap(display(), pixmap);   // The picture owns the pixmap now
}
Esempio n. 18
0
void X11Grabber::freeResources()
{
	// Cleanup allocated resources of the X11 grab
	XDestroyImage(_xImage);
	if(_XShmAvailable && !_useXGetImage)
	{
		XShmDetach(_x11Display, &_shminfo);
		shmdt(_shminfo.shmaddr);
		shmctl(_shminfo.shmid, IPC_RMID, 0);
	}
	if (_XRenderAvailable && !_useXGetImage)
	{
		XRenderFreePicture(_x11Display, _srcPicture);
		XRenderFreePicture(_x11Display, _dstPicture);
		XFreePixmap(_x11Display, _pixmap);
	}
}
Esempio n. 19
0
File: gui.c Progetto: mortehu/bra
void
gui_destroy(struct gui_instance *gi)
{
  if(gi->gc)
    XFreeGC(GUI_display, gi->gc);

  if(gi->front_buffer)
    XRenderFreePicture(GUI_display, gi->front_buffer);

  if(gi->back_buffer)
    XRenderFreePicture(GUI_display, gi->back_buffer);

  if(gi->xic)
    XDestroyIC(gi->xic);

  if(gi->window)
    XDestroyWindow(GUI_display, gi->window);
}
Esempio n. 20
0
void
clientwin_destroy(ClientWin *cw, Bool parentDestroyed)
{
	if(! parentDestroyed)
	{
		if(cw->origin != None)
			XRenderFreePicture(cw->mainwin->dpy, cw->origin);
		if(cw->damage != None)
			XDamageDestroy(cw->mainwin->dpy, cw->damage);
	}
	if(cw->destination != None)
		XRenderFreePicture(cw->mainwin->dpy, cw->destination);
	if(cw->pixmap != None)
		XFreePixmap(cw->mainwin->dpy, cw->pixmap);
	
	XDestroyWindow(cw->mainwin->dpy, cw->mini.window);
	
	free(cw);
}
Esempio n. 21
0
void backing_deinit(backing_t *backing)
{
    backing->active = 0;
    XFreeGC(backing->dpy, backing->gc);
    if (backing->root_pixmap) {
	XFreePixmap(backing->dpy, backing->root_pixmap);
	backing->root_pixmap = 0;

	XRenderFreePicture(backing->dpy, backing->root_pict);
	backing->root_pict = 0;
    }
    if (backing->brush_pixmap) {
	XFreePixmap(backing->dpy, backing->brush_pixmap);
	backing->brush_pixmap = 0;

	XRenderFreePicture(backing->dpy, backing->brush_pict);
	backing->brush_pict = 0;
    }
}
Esempio n. 22
0
/* Apply the cursor to the Chromium OS X11 server.
 * Adapted from the XcursorImageLoadCursor implementation in libXcursor,
 * copyright 2002 Keith Packard.
 */
static void apply_cursor(Display* d, Window w, XFixesCursorImage *image) {
    static Cursor cur_cursor = 0;
    XImage ximage;
    Pixmap pixmap;
    Picture picture;
    GC gc;
    XRenderPictFormat *format;
    Cursor cursor;

    /* Unset the current cursor if no image is passed. */
    if (!image) {
        if (cur_cursor) {
            XUndefineCursor(d, w);
            XFreeCursor(d, cur_cursor);
            cur_cursor = 0;
        }
        return;
    }

    ximage.width = image->width;
    ximage.height = image->height;
    ximage.xoffset = 0;
    ximage.format = ZPixmap;
    ximage.data = (char *) image->pixels;
    ximage.byte_order = LSBFirst;
    ximage.bitmap_unit = 32;
    ximage.bitmap_bit_order = ximage.byte_order;
    ximage.bitmap_pad = 32;
    ximage.depth = 32;
    ximage.bits_per_pixel = 32;
    ximage.bytes_per_line = image->width * 4;
    ximage.red_mask = 0xff0000;
    ximage.green_mask = 0x00ff00;
    ximage.blue_mask = 0x0000ff;
    ximage.obdata = 0;
    if (!XInitImage(&ximage)) {
        puts("failed to init image");
        return;
    }
    pixmap = XCreatePixmap(d, w, image->width, image->height, 32);
    gc = XCreateGC(d, pixmap, 0, 0);
    XPutImage(d, pixmap, gc, &ximage, 0, 0, 0, 0, image->width, image->height);
    XFreeGC(d, gc);
    format = XRenderFindStandardFormat(d, PictStandardARGB32);
    picture = XRenderCreatePicture(d, pixmap, format, 0, 0);
    XFreePixmap(d, pixmap);
    cursor = XRenderCreateCursor(d, picture, image->xhot, image->yhot);
    XRenderFreePicture(d, picture);
    XDefineCursor(d, w, cursor);
    XFlush(d);
    if (cur_cursor)
        XFreeCursor(d, cur_cursor);
    cur_cursor = cursor;
}
Esempio n. 23
0
int backing_restore(backing_t *backing)
{
    XCopyArea(backing->dpy, backing->root_pixmap,
	      backing->root, backing->gc,
	      backing->x, backing->y,
	      backing->width, backing->height,
	      backing->x, backing->y);
    backing->active = 0;

    XFreePixmap(backing->dpy, backing->root_pixmap);
    backing->root_pixmap = 0;
    XRenderFreePicture(backing->dpy, backing->root_pict);
    backing->root_pict = 0;

    XFreePixmap(backing->dpy, backing->brush_pixmap);
    backing->brush_pixmap = 0;
    XRenderFreePicture(backing->dpy, backing->brush_pict);
    backing->brush_pict = 0;

    return 0;
}
Esempio n. 24
0
/** Destroy \a pPicture on the back-end server. */
Bool dmxBEFreePicture(PicturePtr pPicture)
{
    ScreenPtr      pScreen   = pPicture->pDrawable->pScreen;
    DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
    dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);

    if (pPictPriv->pict) {
	XRenderFreePicture(dmxScreen->beDisplay, pPictPriv->pict);
	pPictPriv->pict = (Picture)0;
	return TRUE;
    }

    return FALSE;
}
Esempio n. 25
0
static gboolean
xfwmWindowCopyComposite (xfwmWindow * win, xfwmPixmap * pix)
{
    if (myDisplayHaveRender (win->screen_info->display_info))
    {
        Picture pict;
        Pixmap temp;

        if (!pix->pict)
        {
            TRACE ("xfwmWindowCopyComposite: Pixmap picture does not exist");
            return FALSE;
        }

        if (!win->pict_format)
        {
            TRACE ("xfwmWindowCopyComposite: Window picture format is unknown");
            return FALSE;
        }

        temp = XCreatePixmap (myScreenGetXDisplay (win->screen_info),
                              win->window,
                              pix->width, pix->height, win->depth);

        if (!temp)
        {
            return FALSE;
        }

        pict = XRenderCreatePicture (myScreenGetXDisplay (win->screen_info),
                                     temp, win->pict_format, 0, NULL);

        if (!pict)
        {
            XFreePixmap (myScreenGetXDisplay (win->screen_info), temp);
            return FALSE;
        }

        XRenderComposite (myScreenGetXDisplay (win->screen_info), PictOpSrc, pix->pict, None, pict, 0, 0, 0, 0, 0, 0, pix->width, pix->height);

        XRenderFreePicture (myScreenGetXDisplay (win->screen_info), pict);

        XSetWindowBackgroundPixmap (myScreenGetXDisplay (win->screen_info), win->window, temp);

        XFreePixmap (myScreenGetXDisplay (win->screen_info), temp);
        return TRUE;
    }
    return FALSE;
}
Esempio n. 26
0
void shutdown_render()
{
	imlib_context_set_image(bb);
	imlib_free_image();
	imlib_context_set_image(bbcolor);
	imlib_free_image();

#ifdef WITH_COMPOSITE
	if (theme->use_composite) {
		imlib_context_set_image(bbalpha);
		imlib_free_image();

		XRenderFreePicture(bbdpy, rootpic);
		XRenderFreePicture(bbdpy, piccolor);
		XRenderFreePicture(bbdpy, picalpha);
		XFreePixmap(bbdpy, pixcolor);
		XFreePixmap(bbdpy, pixalpha);
	} else 
#endif
	if (bg) {
		imlib_context_set_image(bg);
		imlib_free_image();
	}
}
Esempio n. 27
0
File: xftdraw.c Progetto: aosm/X11
void
XftDrawChange (XftDraw	*draw,
	       Drawable	drawable)
{
    draw->drawable = drawable;
    if (draw->render_able)
    {
	XRenderPictFormat	    *format;
	
	XRenderFreePicture (draw->dpy, draw->render.pict);
	format = XRenderFindVisualFormat (draw->dpy, draw->visual);
	draw->render.pict = XRenderCreatePicture (draw->dpy, draw->drawable,
						  format, 0, 0);
    }
}
Esempio n. 28
0
void test_target_destroy_render(struct test_display *dpy,
                                struct test_target *tt)
{
    XRenderFreePicture(dpy->dpy, tt->picture);
    switch (tt->target) {
    case ROOT:
        break;
    case CHILD:
        XDestroyWindow(dpy->dpy, tt->draw);
        break;
    case PIXMAP:
        XFreePixmap(dpy->dpy, tt->draw);
        break;
    }
}
Esempio n. 29
0
int32_t
ppb_graphics3d_resize_buffers(PP_Resource context, int32_t width, int32_t height)
{
    if (width < 0 || height < 0) {
        trace_error("%s, width or height are negative\n", __func__);
        return PP_ERROR_BADARGUMENT;
    }

    struct pp_graphics3d_s *g3d = pp_resource_acquire(context, PP_RESOURCE_GRAPHICS3D);
    if (!g3d) {
        trace_error("%s, bad resource\n", __func__);
        return PP_ERROR_BADRESOURCE;
    }

    g3d->width = width;
    g3d->height = height;

    GLXPixmap old_glx_pixmap = g3d->glx_pixmap;
    Pixmap    old_pixmap = g3d->pixmap;
    Picture   old_pict = g3d->xr_pict;

    // release possibly bound to other thread g3d->glx_pixmap and bind it to the current one
    pthread_mutex_lock(&display.lock);
    glXMakeCurrent(display.x, g3d->glx_pixmap, g3d->glc);
    g3d->pixmap = XCreatePixmap(display.x, DefaultRootWindow(display.x), g3d->width, g3d->height,
                                g3d->depth);
    g3d->glx_pixmap = glXCreatePixmap(display.x, g3d->fb_config, g3d->pixmap, NULL);
    XFlush(display.x);
    g3d->xr_pict = XRenderCreatePicture(display.x, g3d->pixmap, g3d->xr_pictfmt, 0, 0);

    // make new g3d->glx_pixmap current to the current thread to allow releasing old_glx_pixmap
    glXMakeCurrent(display.x, g3d->glx_pixmap, g3d->glc);

    // clear surface
    glClearColor(0.0, 0.0, 0.0, 1.0);
    glClear(GL_COLOR_BUFFER_BIT);

    // destroy previous glx and x pixmaps
    glXDestroyPixmap(display.x, old_glx_pixmap);
    XRenderFreePicture(display.x, old_pict);
    XFreePixmap(display.x, old_pixmap);

    pthread_mutex_unlock(&display.lock);
    pp_resource_release(context);
    return PP_OK;
}
Esempio n. 30
0
/**
 * _gdk_x11_drawable_finish:
 * @drawable: a #GdkDrawableImplX11.
 * 
 * Performs necessary cleanup prior to freeing a pixmap or
 * destroying a window.
 **/
void
_gdk_x11_drawable_finish (GdkDrawable *drawable)
{
  GdkDrawableImplX11 *impl = GDK_DRAWABLE_IMPL_X11 (drawable);
  
  if (impl->picture)
    {
      XRenderFreePicture (GDK_SCREEN_XDISPLAY (impl->screen),
			  impl->picture);
      impl->picture = None;
    }
  
  if (impl->cairo_surface)
    {
      cairo_surface_finish (impl->cairo_surface);
      cairo_surface_set_user_data (impl->cairo_surface, &gdk_x11_cairo_key,
				   NULL, NULL);
    }
}