Hi,
> 
> So what I think you want to achieve is:
> 
>   dst = a * srcA + (1-a) * srcB

yes, that's my intension

> 
> which can be acheived (and hitting the accelerated paths) with:
> 
>   Picture a = XRenderCreateSolidFill(dpy, &(XRenderColor){.alpha = 0xffff * 
> Fade});
>   Picture ia = XRenderCreateSolidFill(dpy, &(XRenderColor){.alpha = 0xffff * 
> (1-Fade)});
>   XRenderComposite(dpy, PictOpSrc, srcA, a, dst, 0, 0, 0, 0, 0, 0, width, 
> height);
>   XRenderComposite(dpy, PictOpAdd, srcB, ia, dst, 0, 0, 0, 0, 0, 0, width, 
> height);
>   XRenderFreePicture(dpy, ia);
>   XRenderFreePicture(dpy, a);
> -Chris
> 
That work's much better (and avoids the crash). I thought the third parameter
of XRenderComposite() is something like a clipmask (after reading
http://www.x.org/releases/current/doc/renderproto/renderproto.txt), but it is
the missing multiplier.

I will use your approach.
Thank you very much.

Peter

Anyway, I wrote a little programm to reproduce the bug.
/******************************************************************************/
/******************************************************************************/
#include <stdint.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/extensions/Xrender.h>

/******************************************************************************/
/******************************************************************************/
int main(int argc, char *argv[])
{
	const char *Host = (argc == 2) ? argv[1] : getenv("DISPLAY") ;
	
	if(Host != NULL) {
		Display *Dpy = XOpenDisplay(Host) ;
		
		if(Dpy != NULL) {
			Window Root = RootWindowOfScreen(DefaultScreenOfDisplay(Dpy)) ;
			Pixmap s = XCreatePixmap(Dpy, Root, 100, 100, 32) ;
			Pixmap d = XCreatePixmap(Dpy, Root, 100, 100, 32) ;
			Pixmap Map = XCreatePixmap(Dpy, Root, 1, 1, 8) ;
			XRenderPictFormat *Format32 = XRenderFindStandardFormat(Dpy,
																			PictStandardARGB32) ;
			XRenderPictFormat	*Format8 = XRenderFindStandardFormat(Dpy,
																					PictStandardA8) ;
			uint16_t v = 0x8000 ;
			XRenderColor c = {.red = v, .green = v, .blue = v, .alpha = v} ;
			XRenderPictureAttributes Rep = {.repeat = RepeatNormal} ;
			Picture Alpha = XRenderCreatePicture(Dpy, Map, Format8,
															 CPRepeat, &Rep) ;
			Picture Src = XRenderCreatePicture(Dpy, s, Format32, 0, NULL) ;
			Picture Dest = XRenderCreatePicture(Dpy, d, Format32, 0, NULL) ;
			XRenderPictureAttributes Att = {.alpha_map = Alpha} ;
			
			XRenderFillRectangle(Dpy, PictOpSrc, Alpha, &c, 0, 0, 1, 1) ;
			XRenderChangePicture(Dpy, Src, CPAlphaMap, &Att) ;
			XRenderChangePicture(Dpy, Dest, CPAlphaMap, &Att) ;

			XRenderComposite(Dpy, PictOpClear, Src, None, Dest,
								  0, 0, 0, 0, 0, 0, 100, 100) ;
			XSync(Dpy, False) ;
			XRenderFreePicture(Dpy, Dest) ;
			XRenderFreePicture(Dpy, Src) ;
			XRenderFreePicture(Dpy, Alpha) ;
			XFreePixmap(Dpy, s) ;
			XFreePixmap(Dpy, d) ;
			XCloseDisplay(Dpy) ;
		}
	}
	return(0) ;
}
_______________________________________________
xorg@lists.freedesktop.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.freedesktop.org/mailman/listinfo/xorg
Your subscription address: arch...@mail-archive.com

Reply via email to