All pastes #715700 Raw Edit

Meins

public text v1 · immutable
#715700 ·published 2007-09-26 12:34 UTC
rendered paste body
diff --git a/3d.c b/3d.c
index 8ed754b..8a61246 100644
--- a/3d.c
+++ b/3d.c
@@ -71,10 +71,6 @@ typedef struct _tdScreen
 {
     int windowPrivateIndex;
 
-    Bool tdWindowExists;
-    Bool active;
-    Bool wasActive;
-
     PreparePaintScreenProc    preparePaintScreen;
     PaintOutputProc	      paintOutput;
     CubePostPaintViewportProc postPaintViewport;
@@ -86,6 +82,7 @@ typedef struct _tdScreen
     CompWindow *first;
     CompWindow *last;
 
+    Bool  active;
     Bool  painting3D;
     float currentScale;
 
@@ -140,16 +137,16 @@ tdPreparePaintScreen (CompScreen *s,
 {
     CompWindow *w;
     float      amount;
+    Bool       active;
 
     TD_SCREEN (s);
     CUBE_SCREEN (s);
 
-    tds->active = (cs->rotationState != RotationNone) &&
-	          !(tdGetManualOnly(s) &&
-		    (cs->rotationState != RotationManual));
+    active = (cs->rotationState != RotationNone) &&
+	     !(tdGetManualOnly(s) && (cs->rotationState != RotationManual));
 
     amount = ((float)msSinceLastPaint * tdGetSpeed (s) / 1000.0);
-    if (tds->active)
+    if (active)
     {
 	float maxDiv = (float) tdGetMaxWindowSpace (s) / 100;
 	float minScale = (float) tdGetMinCubeSize (s) / 100;
@@ -167,14 +164,13 @@ tdPreparePaintScreen (CompScreen *s,
 	    tdw->is3D = TRUE;
 	    tds->maxDepth++;
 	    tdw->depth = tds->maxDepth;
-	    tds->tdWindowExists = TRUE;
 	}
 
 	minScale =  MAX (minScale, 1.0 - (tds->maxDepth * maxDiv));
 	if (cs->invert == 1)
 	    tds->basicScale = MAX (minScale, tds->basicScale - amount);
 	else
- 	    tds->basicScale = MIN (2 - minScale, tds->basicScale + amount);
+	    tds->basicScale = MIN (2 - minScale, tds->basicScale + amount);
     }
     else
     {
@@ -184,11 +180,13 @@ tdPreparePaintScreen (CompScreen *s,
 	    tds->basicScale = MAX (1.0, tds->basicScale - amount);
     }
 
+    tds->active = (fabs (tds->basicScale - 1.0f) > 1e-4);
+
     UNWRAP (tds, s, preparePaintScreen);
     (*s->preparePaintScreen) (s, msSinceLastPaint);
     WRAP (tds, s, preparePaintScreen, tdPreparePaintScreen);
 
-    cs->paintAllViewports |= tds->active | tds->tdWindowExists;
+    cs->paintAllViewports |= tds->active;
 }
 
 /* forward declaration */
@@ -427,7 +425,7 @@ tdPaintWindow (CompWindow              *w,
     TD_SCREEN (s);
     TD_WINDOW (w);
 
-    if (tdw->depth != 0.0f && !tds->painting3D && tds->basicScale != 1.0)
+    if (tdw->depth != 0.0f && !tds->painting3D && tds->active)
 	mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK;
 
     if (tds->painting3D)
@@ -509,7 +507,7 @@ tdPostPaintViewport (CompScreen              *s,
     (*cs->postPaintViewport) (s, sAttrib, transform, output, region);
     WRAP (tds, cs, postPaintViewport, tdPostPaintViewport);
 
-    if (tds->active || tds->tdWindowExists)
+    if (tds->active)
     {
 	CompTransform sTransform = *transform;
 	CompWindow    *firstFTB = NULL;
@@ -653,7 +651,7 @@ tdPaintOutput (CompScreen              *s,
 
     TD_SCREEN (s);
 
-    if (tds->basicScale != 1.0)
+    if (tds->active)
     {
 	mask |= PAINT_SCREEN_TRANSFORMED_MASK |
 	        PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
@@ -671,7 +669,7 @@ tdDonePaintScreen (CompScreen *s)
 {
     TD_SCREEN (s);
 
-    if (tds->basicScale != 1.0f)
+    if (tds->active)
 	damageScreen (s);
 
     UNWRAP (tds, s, donePaintScreen);
@@ -718,8 +716,7 @@ tdInitWindowWalker (CompScreen *s,
     (*s->initWindowWalker) (s, walker);
     WRAP (tds, s, initWindowWalker, tdInitWindowWalker);
 
-    if ((tds->active || tds->tdWindowExists) &&
-	cs->paintOrder == BTF && tds->painting3D)
+    if (tds->active && cs->paintOrder == BTF && tds->painting3D)
     {
 	walker->first = tdWalkFirst;
 	walker->last =  tdWalkLast;
@@ -790,12 +787,11 @@ tdInitScreen (CompPlugin *p,
 	return FALSE;
     }
 
-    tds->active = tds->wasActive = FALSE;
+    tds->basicScale     = 1.0f;
+    tds->currentScale   = 1.0f;
 
-    tds->basicScale     = 1.0;
-    tds->currentScale   = 1.0;
-    tds->tdWindowExists = FALSE;
-    tds->painting3D     = FALSE;
+    tds->active     = FALSE;
+    tds->painting3D = FALSE;
 
     tds->first = NULL;
     tds->last  = NULL;