[beryl-commits] Animation plugin: Changes to 'master' (81aa45bafcc4122484de604e478f17142fb5e9b5)

cornelius at server.beryl-project.org cornelius at server.beryl-project.org
Fri Jun 1 03:45:41 CEST 2007


New commits:
commit 81aa45bafcc4122484de604e478f17142fb5e9b5
Merge: 200ef550c2fd318f13592547e201141dd27fbee6 badae017e48c691ae45cbc817cbe1e865fe1af53
Author: Erkin Bahceci <erkinbah at gmail.com>
Date:   Thu May 31 21:29:15 2007 -0400

    Merge branch 'master' of git+ssh://cornelius@git.opencompositing.org/git/compcomm/plugins/animation

commit 200ef550c2fd318f13592547e201141dd27fbee6
Author: Erkin Bahceci <erkinbah at gmail.com>
Date:   Tue May 29 23:22:35 2007 -0400

    Rename function and little clean-up.

commit 6b774bd7353eb5c11eed3bb4947d10679fa1b0e9
Author: Erkin Bahceci <erkinbah at gmail.com>
Date:   Tue May 29 23:16:23 2007 -0400

    Variable relocation.


 animation.c |   97 +++++++++++++++++++++++++---------------------------------
 1 files changed, 42 insertions(+), 55 deletions(-)


Modified: compcomm/plugins/animation/animation.c
===================================================================
--- compcomm/plugins/animation/animation.c
+++ compcomm/plugins/animation/animation.c
@@ -263,7 +263,6 @@ typedef struct _Model
 	int winWidth;				// keeps win. size when model was created
 	int winHeight;				//
 
-	float remainderSteps;
 	Vector scale;
 	Point scaleOrigin;
 	Point topLeft;
@@ -636,6 +635,7 @@ typedef struct _AnimWindow
 	Bool animInitialized;		// whether the animation effect (not the window) is initialized
 	float animTotalTime;
 	float animRemainingTime;
+	float remainderSteps;
 	int animOverrideProgressDir;	// 0: default dir, 1: forward, 2: backward
 
 	Bool nowShaded;
@@ -1311,9 +1311,9 @@ static void polygonsAnimStep(CompScreen * s, CompWindow * w, float time)
 
 	aw->timestep = timestep;
 
-	model->remainderSteps += time / timestep;
-	steps = floor(model->remainderSteps);
-	model->remainderSteps -= steps;
+	aw->remainderSteps += time / timestep;
+	steps = floor(aw->remainderSteps);
+	aw->remainderSteps -= steps;
 	if (!steps && aw->animRemainingTime < aw->animTotalTime)
 		return;
 	steps = MAX(1, steps);
@@ -1613,9 +1613,9 @@ static void fxMagicLampModelStep(CompScreen * s, CompWindow * w, float time)
 	float timestep = (s->slowAnimations ? 2 :	// For smooth slow-mo (refer to display.c)
 					  as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
 
-	model->remainderSteps += time / timestep;
-	steps = floor(model->remainderSteps);
-	model->remainderSteps -= steps;
+	aw->remainderSteps += time / timestep;
+	steps = floor(aw->remainderSteps);
+	aw->remainderSteps -= steps;
 
 	if (!steps && aw->animRemainingTime < aw->animTotalTime)
 		return;
@@ -1700,9 +1700,9 @@ static void fxDreamModelStep(CompScreen * s, CompWindow * w, float time)
 
 	aw->timestep = timestep;
 
-	model->remainderSteps += time / timestep;
-	steps = floor(model->remainderSteps);
-	model->remainderSteps -= steps;
+	aw->remainderSteps += time / timestep;
+	steps = floor(aw->remainderSteps);
+	aw->remainderSteps -= steps;
 
 	if (!steps && aw->animRemainingTime < aw->animTotalTime)
 		return;
@@ -1789,9 +1789,9 @@ static void fxWaveModelStep(CompScreen * s, CompWindow * w, float time)
 	float timestep = (s->slowAnimations ? 2 :	// For smooth slow-mo (refer to display.c)
 					  as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
 
-	model->remainderSteps += time / timestep;
-	steps = floor(model->remainderSteps);
-	model->remainderSteps -= steps;
+	aw->remainderSteps += time / timestep;
+	steps = floor(aw->remainderSteps);
+	aw->remainderSteps -= steps;
 
 	if (!steps && aw->animRemainingTime < aw->animTotalTime)
 		return;
@@ -1980,9 +1980,9 @@ static void fxZoomModelStep(CompScreen * s, CompWindow * w, float time)
 
 	aw->timestep = timestep;
 
-	model->remainderSteps += time / timestep;
-	steps = floor(model->remainderSteps);
-	model->remainderSteps -= steps;
+	aw->remainderSteps += time / timestep;
+	steps = floor(aw->remainderSteps);
+	aw->remainderSteps -= steps;
 
 	if (!steps && aw->animRemainingTime < aw->animTotalTime)
 		return;
@@ -2154,9 +2154,9 @@ static void fxGlideAnimStep(CompScreen * s, CompWindow * w, float time)
 
 	aw->timestep = timestep;
 
-	model->remainderSteps += time / timestep;
-	steps = floor(model->remainderSteps);
-	model->remainderSteps -= steps;
+	aw->remainderSteps += time / timestep;
+	steps = floor(aw->remainderSteps);
+	aw->remainderSteps -= steps;
 
 	if (!steps && aw->animRemainingTime < aw->animTotalTime)
 		return;
@@ -2306,9 +2306,9 @@ static void fxCurvedFoldModelStep(CompScreen * s, CompWindow * w, float time)
 	float timestep = (s->slowAnimations ? 2 :	// For smooth slow-mo (refer to display.c)
 					  as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
 
-	model->remainderSteps += time / timestep;
-	steps = floor(model->remainderSteps);
-	model->remainderSteps -= steps;
+	aw->remainderSteps += time / timestep;
+	steps = floor(aw->remainderSteps);
+	aw->remainderSteps -= steps;
 
 	if (!steps && aw->animRemainingTime < aw->animTotalTime)
 		return;
@@ -2438,9 +2438,9 @@ fxHorizontalFoldsModelStep(CompScreen * s, CompWindow * w, float time)
 	float timestep = (s->slowAnimations ? 2 :	// For smooth slow-mo (refer to display.c)
 					  as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
 
-	model->remainderSteps += time / timestep;
-	steps = floor(model->remainderSteps);
-	model->remainderSteps -= steps;
+	aw->remainderSteps += time / timestep;
+	steps = floor(aw->remainderSteps);
+	aw->remainderSteps -= steps;
 	if (!steps && aw->animRemainingTime < aw->animTotalTime)
 		return;
 	steps = MAX(1, steps);
@@ -2566,9 +2566,9 @@ static void fxRollUpModelStep(CompScreen * s, CompWindow * w, float time)
 	float timestep = (s->slowAnimations ? 2 :	// For smooth slow-mo (refer to display.c)
 					  as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
 
-	model->remainderSteps += time / timestep;
-	steps = floor(model->remainderSteps);
-	model->remainderSteps -= steps;
+	aw->remainderSteps += time / timestep;
+	steps = floor(aw->remainderSteps);
+	aw->remainderSteps -= steps;
 	if (!steps && aw->animRemainingTime < aw->animTotalTime)
 		return;
 	steps = MAX(1, steps);
@@ -2620,23 +2620,21 @@ static void fxFadeInit(CompScreen * s, CompWindow * w)
 					as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
 }
 
-static void fxFadeModelStep(CompScreen * s, CompWindow * w, float time)
+static void defaultAnimStep(CompScreen * s, CompWindow * w, float time)
 {
 	int j, steps;
 
 	ANIM_WINDOW(w);
 	ANIM_SCREEN(s);
 
-	Model *model = aw->model;
-
 	float timestep = (s->slowAnimations ? 2 :	// For smooth slow-mo (refer to display.c)
 					  as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
 
 	aw->timestep = timestep;
 
-	model->remainderSteps += time / timestep;
-	steps = floor(model->remainderSteps);
-	model->remainderSteps -= steps;
+	aw->remainderSteps += time / timestep;
+	steps = floor(aw->remainderSteps);
+	aw->remainderSteps -= steps;
 
 	if (!steps && aw->animRemainingTime < aw->animTotalTime)
 		return;
@@ -2666,11 +2664,6 @@ fxFadeUpdateWindowAttrib(AnimScreen * as,
 // =====================  Effect: Focus Fade  =========================
 
 
-static void fxFocusFadeModelStep(CompScreen * s, CompWindow * w, float time)
-{
-	fxFadeModelStep(s, w, time);
-}
-
 static void
 fxFocusFadeUpdateWindowAttrib(AnimScreen * as,
 							  AnimWindow * aw,
@@ -2953,9 +2946,9 @@ static void fxBurnModelStep(CompScreen * s, CompWindow * w, float time)
 	float old = 1 - (aw->animRemainingTime) / (aw->animTotalTime);
 	float stepSize;
 
-	model->remainderSteps += time / timestep;
-	steps = floor(model->remainderSteps);
-	model->remainderSteps -= steps;
+	aw->remainderSteps += time / timestep;
+	steps = floor(aw->remainderSteps);
+	aw->remainderSteps -= steps;
 	if (!steps && aw->animRemainingTime < aw->animTotalTime)
 		return;
 	steps = MAX(1, steps);
@@ -3263,7 +3256,7 @@ static void fxBeamUpModelStep(CompScreen * s, CompWindow * w, float time)
 	int steps;
 	int creating = 0;
 
-	fxFadeModelStep(s, w, time);
+	defaultAnimStep(s, w, time);
 
 	ANIM_SCREEN(s);
 	ANIM_WINDOW(w);
@@ -3275,9 +3268,9 @@ static void fxBeamUpModelStep(CompScreen * s, CompWindow * w, float time)
 	float old = 1 - (aw->animRemainingTime) / (aw->animTotalTime);
 	float stepSize;
 
-	model->remainderSteps += time / timestep;
-	steps = floor(model->remainderSteps);
-	model->remainderSteps -= steps;
+	aw->remainderSteps += time / timestep;
+	steps = floor(aw->remainderSteps);
+	aw->remainderSteps -= steps;
 	if (!steps && aw->animRemainingTime < aw->animTotalTime)
 		return;
 	steps = MAX(1, steps);
@@ -5417,10 +5410,10 @@ AnimEffectProperties animEffectProperties[AnimEffectNum] = {
 	 fxExplode3DInit, 0, polygonsStoreClips, polygonsDrawCustomGeometry, 0,
 	 polygonsLinearAnimStepPolygon, 0, 0},
 	// AnimEffectFade
-	{fxFadeUpdateWindowAttrib, 0, 0, fxFadeModelStep, fxFadeInit, 0, 0, 0, 0,
+	{fxFadeUpdateWindowAttrib, 0, 0, defaultAnimStep, fxFadeInit, 0, 0, 0, 0,
 	 0, 0, TRUE},
 	// AnimEffectFocusFade
-	{fxFocusFadeUpdateWindowAttrib, 0, 0, fxFocusFadeModelStep, fxFadeInit, 0, 0, 0, 0,
+	{fxFocusFadeUpdateWindowAttrib, 0, 0, defaultAnimStep, fxFadeInit, 0, 0, 0, 0,
 	 0, 0, TRUE},
 	// AnimEffectGlide3D1
 	{fxGlideUpdateWindowAttrib, polygonsPrePaintWindow,
@@ -5895,8 +5888,6 @@ static Model *createModel(CompWindow * w,
 	model->topHeight = w->output.top;
 	model->bottomHeight = w->output.bottom;
 
-	model->remainderSteps = 0;
-
 	model->scale.x = 1.0f;
 	model->scale.y = 1.0f;
 
@@ -6030,6 +6021,7 @@ static void postAnimationCleanup(CompWindow * w, Bool resetAnimation)
 		//aw->polygonSet->nClips = 0;
 	}
 	aw->animInitialized = FALSE;
+	aw->remainderSteps = 0;
 
 	//if (aw->unmapCnt || aw->destroyCnt)
 	//    releaseWindow (w);
@@ -6304,16 +6296,11 @@ static void animPreparePaintScreen(CompScreen * s, int msSinceLastPaint)
 						aw->model->winHeight != WIN_H(w))
 					{
 						// model needs update
-
-						// keep this value
-						float remainderSteps = aw->model->remainderSteps;
-
 						// re-create model
 						animEnsureModel
 								(w, aw->curWindowEvent, aw->curAnimEffect);
 						if (aw->model == 0)
 							continue;	// skip this window
-						aw->model->remainderSteps = remainderSteps;
 					}
 					// Call fx step func.
 					if (animEffectProperties[aw->curAnimEffect].animStepFunc)



More information about the commits mailing list