All pastes #277538 Raw Edit

Mine

public text v1 · immutable
·published 2006-12-13 09:39 UTC
rendered paste body
Index: beryl-core/include/beryl.h
===================================================================
--- beryl-core/include/beryl.h	(Revision 1715)
+++ beryl-core/include/beryl.h	(Arbeitskopie)
@@ -1305,6 +1305,10 @@
         CompIcon   *icon);
 
 Bool
+imageToTexture (CompScreen *screen, CompTexture *texture, 
+	char *image, unsigned int width, unsigned int height);
+
+Bool
 bindPixmapToTexture (CompScreen  *screen,
         CompTexture *texture,
         Pixmap   pixmap,
Index: beryl-core/src/texture.c
===================================================================
--- beryl-core/src/texture.c	(Revision 1715)
+++ beryl-core/src/texture.c	(Arbeitskopie)
@@ -103,7 +103,7 @@
 	free(texture);
 }
 
-static Bool
+Bool
 imageToTexture(CompScreen * screen,
 	       CompTexture * texture,
 	       char *image, unsigned int width, unsigned int height)


Index: beryl-group-tab/group.c
===================================================================
--- beryl-group-tab/group.c	(Revision 1715)
+++ beryl-group-tab/group.c	(Arbeitskopie)
@@ -330,7 +330,7 @@
 	int x2;
 	int y2;
 
-	GLuint glowTexture;
+	CompTexture glowTexture;
 } GroupScreen;
 
 /*
@@ -2497,7 +2497,49 @@
 	Bool status;
 	GROUP_WINDOW(w);
 	GROUP_SCREEN(w->screen);
+#if 0
+	if (gw->inGroup && gs->opt[GROUP_SCREEN_OPTION_GLOW].value.b) {
+	    if (mask & PAINT_WINDOW_TRANSFORMED_MASK)
+		region = getInfiniteRegion();
 
+	    if (region->numRects) {
+		REGION box;
+		CompMatrix matrix;
+
+		box.rects = &box.extents;
+		box.numRects = 1;
+
+		w->vCount = 0;
+
+		int glowBorderX = 12;
+		int glowBorderY = 12;
+		int glowWidth	= 128;
+		int glowHeight	= 128;
+
+		int overlapX, overlapY;
+		overlapX = (WIN_WIDTH(w)  * glowBorderX) / (glowWidth  - glowBorderX * 2);
+		overlapY = (WIN_HEIGHT(w) * glowBorderY) / (glowHeight - glowBorderY * 2);
+
+		box.extents.x1 = WIN_X(w) - w->input.left - overlapX;
+		box.extents.y1 = WIN_Y(w) - w->input.top - overlapY;
+		box.extents.x2 = WIN_X(w) + w->input.right + WIN_WIDTH(w) + overlapX;
+		box.extents.y2 = WIN_Y(w) + w->input.right + WIN_HEIGHT(w) + overlapY;
+
+		matrix = gs->glowTexture.matrix;
+		matrix.x0 -= (w->attrib.x * gs->glowTexture.matrix.xx);
+		matrix.y0 -= (w->attrib.y * gs->glowTexture.matrix.yy);
+		
+		if (box.extents.x1 < box.extents.x2 &&
+		    box.extents.y1 < box.extents.y2) {
+		    (*w->screen->addWindowGeometry) (w, &matrix, 1, &box, region);
+		}
+	    }
+
+	    if (w->vCount)
+		(*w->screen->drawWindowTexture) (w, &gs->glowTexture, attrib,
+		    mask | PAINT_WINDOW_TRANSLUCENT_MASK);
+	}
+#endif
 	UNWRAP(gs, w->screen, drawWindow);
 
 	status = (*w->screen->drawWindow) (w, attrib, region, mask);
@@ -2543,13 +2585,14 @@
 	}
 
 	// paint glow
+#if 1
 	if (gw->inGroup && gs->opt[GROUP_SCREEN_OPTION_GLOW].value.b) {
 		glPushMatrix();
 		glDisableClientState(GL_TEXTURE_COORD_ARRAY);
 
 		glEnable(GL_BLEND);
-		if (gs->glowTexture) {
-			glBindTexture(GL_TEXTURE_2D, gs->glowTexture);
+		if (gs->glowTexture.name) {
+			glBindTexture(GL_TEXTURE_2D, gs->glowTexture.name);
 			glEnable(GL_TEXTURE_2D);
 		}
 		glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
@@ -2602,6 +2645,7 @@
 
 		damageScreenRegion(w->screen, reg);
 	}
+#endif
 
 	if (gw->inGroup &&
 		gw->group->tabbed && gw->group->topTab != -1 &&
@@ -3058,13 +3102,8 @@
 	gs->grabIndex = 0;
 
 	// bind texture for glow
-	glGenTextures(1, &gs->glowTexture);
-	glBindTexture(GL_TEXTURE_2D, gs->glowTexture);
-	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 128, 128, 0,
-		     GL_RGBA, GL_UNSIGNED_BYTE, glowTex);
-	glBindTexture(GL_TEXTURE_2D, 0);
+	initTexture (s, &gs->glowTexture);
+	imageToTexture (s, &gs->glowTexture, (char*) glowTex, 128, 128);
 
 	return TRUE;
 }