All pastes #917770 Raw Edit

Zeug

public c v1 · immutable
#917770 ·published 2008-02-25 17:41 UTC
rendered paste body
From f773efdb67fb00133ea4cf33333115c6675ef2d3 Mon Sep 17 00:00:00 2001From: Patrick Niklaus <marex@opencompositing.org>Date: Mon, 25 Feb 2008 18:40:33 +0100Subject: [PATCH] Use visual and depth of the window to support RGBA--- plugins/svg.c |   24 ++++++++++++++---------- 1 files changed, 14 insertions(+), 10 deletions(-)diff --git a/plugins/svg.c b/plugins/svg.cindex 69714de..371622c 100644--- a/plugins/svg.c+++ b/plugins/svg.c@@ -133,7 +133,7 @@ renderSvg (CompScreen *s,     cairo_save (texture->cr);      cairo_set_operator (texture->cr, CAIRO_OPERATOR_SOURCE);-    cairo_set_source_rgb (texture->cr, 1.0, 1.0, 1.0);+    cairo_set_source_rgba (texture->cr, 1.0, 1.0, 1.0, 0.0);     cairo_paint (texture->cr);     cairo_set_operator (texture->cr, CAIRO_OPERATOR_OVER); @@ -153,7 +153,7 @@ renderSvg (CompScreen *s, }  static Bool-initSvgTexture (CompScreen *s,+initSvgTexture (CompWindow *w, 		SvgSource  *source, 		SvgTexture *texture, 		int	   width,@@ -163,6 +163,8 @@ initSvgTexture (CompScreen *s,     Visual	    *visual;     int		    depth; +    CompScreen *s = w->screen;+     initTexture (s, &texture->texture);      texture->width  = width;@@ -173,7 +175,10 @@ initSvgTexture (CompScreen *s,      if (width && height)     {-	depth = DefaultDepth (s->display->display, s->screenNum);+	XWindowAttributes attr;+	XGetWindowAttributes(s->display->display, w->id, &attr);++	depth = attr.depth; 	texture->pixmap = XCreatePixmap (s->display->display, s->root, 					 width, height, depth); @@ -190,8 +195,7 @@ initSvgTexture (CompScreen *s, 	    return FALSE; 	} -	visual = DefaultVisual (s->display->display, s->screenNum);-+	visual = attr.visual; 	surface = cairo_xlib_surface_create (s->display->display, 					     texture->pixmap, visual, 					     width, height);@@ -351,7 +355,7 @@ svgDrawWindow (CompWindow	      *w,  		    finiSvgTexture (w->screen, &sw->context->texture[1]); -		    if (initSvgTexture (w->screen, sw->context->source,+		    if (initSvgTexture (w, sw->context->source, 					&sw->context->texture[1], 					width, height)) 		    {@@ -381,7 +385,7 @@ svgDrawWindow (CompWindow	      *w, 	    else if (sw->context->texture[1].width) 	    { 		finiSvgTexture (w->screen, &sw->context->texture[1]);-		initSvgTexture (w->screen, sw->source,+		initSvgTexture (w, sw->source, 				&sw->context->texture[1], 				0, 0); @@ -421,7 +425,7 @@ updateWindowSvgContext (CompWindow *w,     sw->context->width  = 0;     sw->context->height = 0; -    initSvgTexture (w->screen, source,+    initSvgTexture (w, source, 		    &sw->context->texture[1], 		    0, 0); @@ -445,7 +449,7 @@ updateWindowSvgContext (CompWindow *w,     x2 = MIN (x2, w->width);     y2 = MIN (y2, w->height); -    if (!initSvgTexture (w->screen, source,+    if (!initSvgTexture (w, source, 			 &sw->context->texture[0], 			 w->width, w->height))     {@@ -457,7 +461,7 @@ updateWindowSvgContext (CompWindow *w, 	renderSvg (w->screen, source, &sw->context->texture[0], 		   0.0f, 0.0f, 1.0f, 1.0f, w->width, w->height); -	initSvgTexture (w->screen, source, &sw->context->texture[1], 0, 0);+	initSvgTexture (w, source, &sw->context->texture[1], 0, 0);  	sw->context->box.extents.x1 = x1; 	sw->context->box.extents.y1 = y1;-- 1.5.2.5