All pastes #673414 Raw Edit

Someone

public text v1 · immutable
#673414 ·published 2007-08-28 11:45 UTC
rendered paste body
diff --git a/3d.c b/3d.c
index 9c339b4..261c19c 100644
--- a/3d.c
+++ b/3d.c
@@ -81,6 +81,7 @@ typedef struct _tdScreen
 	PaintOutputProc				paintOutput;
 	DonePaintScreenProc			donePaintScreen;
 	InitWindowWalkerProc		initWindowWalker;
+	ApplyScreenTransformProc   applyScreenTransform;
 
 	CubePaintTopProc    paintTop;
 	CubePaintBottomProc paintBottom;
@@ -107,6 +108,8 @@ typedef struct _tdScreen
 
 	CompWindow *first;
 	CompWindow *last;
+
+	Bool test;
 } tdScreen;
 
 #define GET_TD_DISPLAY(d)       \
@@ -293,7 +296,7 @@ tdPaintWindow(CompWindow * w,
 
 	TD_SCREEN(w->screen);
 	TD_WINDOW(w);
-
+#if 0
 	if (tdw->currentZ != 0.0f)
 	{
 		Bool wasCulled;
@@ -556,6 +559,7 @@ tdPaintWindow(CompWindow * w,
 		WRAP(tds, w->screen, paintWindow, tdPaintWindow);
 	}
 	else
+#endif
 	{
 		UNWRAP(tds, w->screen, paintWindow);
 		status = (*w->screen->paintWindow) (w, attrib, transform, region, mask);
@@ -565,6 +569,26 @@ tdPaintWindow(CompWindow * w,
 	return status;
 }
 
+
+static void
+tdApplyScreenTransform (CompScreen		  *s,
+			  const ScreenPaintAttrib *sAttrib,
+			  CompOutput		  *output,
+			  CompTransform	          *transform)
+{
+    TD_SCREEN (s);
+
+    UNWRAP (tds, s, applyScreenTransform);
+    (*s->applyScreenTransform) (s, sAttrib, output, transform);
+    WRAP (tds, s, applyScreenTransform, tdApplyScreenTransform);
+
+    if (!tds->test)
+    {
+	matrixScale(transform, 0.5, 0.5, 0.5);
+    }
+    
+}
+
 static void tdAddWindow(CompScreen *s, CompWindow *w)
 {
 	TD_SCREEN(s);
@@ -590,7 +614,7 @@ tdPaintTransformedOutput(CompScreen * s,
 {
 	TD_SCREEN(s);
 	CUBE_SCREEN(s);
-
+#if 0
 	CompWindow* w;
 	CompWindow* firstFTB = NULL;
 
@@ -652,10 +676,63 @@ tdPaintTransformedOutput(CompScreen * s,
 			}
 		}
 	}
-
+#endif
+	
 	UNWRAP(tds, s, paintTransformedOutput);
 	(*s->paintTransformedOutput) (s, sAttrib, transform, region, output, mask);
 	WRAP(tds, s, paintTransformedOutput, tdPaintTransformedOutput);
+	tds->test = TRUE;
+
+	{
+		CompTransform sTransform = *transform;
+		    screenLighting (s, TRUE);
+
+	    	(*s->applyScreenTransform) (s, sAttrib, output, &sTransform);
+
+
+		s->enableOutputClipping (s, &sTransform, region, output);
+
+		transformToScreenSpace (s, output, -sAttrib->zTranslate,
+					&sTransform);
+
+		glPushMatrix ();
+		glLoadMatrixf (sTransform.m);
+
+    CompWindow    *w;
+    CompWalker    walk;
+
+
+
+
+    (*s->initWindowWalker) (s, &walk);
+
+
+    /* paint all windows from bottom to top */
+    for (w = (*walk.first) (s); w; w = (*walk.next) (w))
+    {
+	TD_WINDOW (w);
+	if (w->destroyed)
+	    continue;
+
+	if (!w->shaded)
+	{
+	    if (w->attrib.map_state != IsViewable || !w->damaged)
+		continue;
+	}
+	if (tdw->currentZ != 0.0f)
+		(*s->paintWindow) (w, &w->paint, &sTransform, w->clip, PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK);
+    }
+
+
+		glPopMatrix ();
+
+		s->disableOutputClipping (s);
+	}
+tds->test = FALSE;
+	/*
+	UNWRAP(tds, s, paintTransformedOutput);
+	(*s->paintTransformedOutput) (s, sAttrib, transform, region, output, mask);
+	WRAP(tds, s, paintTransformedOutput, tdPaintTransformedOutput);*/
 }
 
 static Bool
@@ -806,7 +883,7 @@ tdInitWindowWalker (CompScreen *s, CompWalker* walker)
 	UNWRAP (tds, s, initWindowWalker);
 	(*s->initWindowWalker) (s, walker);
 	WRAP (tds, s, initWindowWalker, tdInitWindowWalker);
-
+/*
 	if ((tds->active || tds->tdWindowExists) &&
 	     cs->paintOrder == BTF)
 	{
@@ -815,6 +892,7 @@ tdInitWindowWalker (CompScreen *s, CompWalker* walker)
 		walker->next =  tdWalkNext;
 		walker->prev =  tdWalkPrev;
 	}
+*/
 
 }
 
@@ -864,6 +942,8 @@ static Bool tdInitPluginForDisplay (CompPlugin *p, CompDisplay *d)
 				WRAP(tds, s, donePaintScreen, tdDonePaintScreen);
 				WRAP(tds, s, preparePaintScreen, tdPreparePaintScreen);
 				WRAP(tds, s, initWindowWalker, tdInitWindowWalker);
+				
+    WRAP (tds, s, applyScreenTransform, tdApplyScreenTransform);
 			}
 		}
 	}
@@ -895,6 +975,9 @@ static void tdFiniPluginForDisplay (CompPlugin *p, CompDisplay *d)
 			UNWRAP(tds, s, donePaintScreen);
 			UNWRAP(tds, s, preparePaintScreen);
 			UNWRAP(tds, s, initWindowWalker);
+			
+    UNWRAP (tds, s, applyScreenTransform);
+    
 		}
 
 		cubeDisplayPrivateIndex = -1;