summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-14 08:36:35 +0000
committermaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-14 08:36:35 +0000
commit711a3adf9c7a016af43268e8da6c31a18a8b8b7a (patch)
tree0a0ca3d19dc769b626857fb2bb95cbe59c044220
parent74645bf176d214f411f1a4af01cb158117af7a10 (diff)
downloadmarex-dev-711a3adf9c7a016af43268e8da6c31a18a8b8b7a.tar.gz
marex-dev-711a3adf9c7a016af43268e8da6c31a18a8b8b7a.tar.bz2
tile plugin: fixes for new transform interface
git-svn-id: file:///beryl/trunk@4048 d7aaf104-2d23-0410-ae22-9d23157bf5a3
-rw-r--r--beryl-plugins-unsupported/src/tile.c176
1 files changed, 102 insertions, 74 deletions
diff --git a/beryl-plugins-unsupported/src/tile.c b/beryl-plugins-unsupported/src/tile.c
index fa2cd8c..610f465 100644
--- a/beryl-plugins-unsupported/src/tile.c
+++ b/beryl-plugins-unsupported/src/tile.c
@@ -214,6 +214,7 @@ static Bool tilePaintWindow(CompWindow * w, const WindowPaintAttrib * attrib,
{
CompScreen *s = w->screen;
Bool status;
+ Bool dontDraw = FALSE;
TILE_SCREEN(s);
TILE_WINDOW(w);
@@ -224,89 +225,116 @@ static Bool tilePaintWindow(CompWindow * w, const WindowPaintAttrib * attrib,
if(tw->isResizing && td->currentAnimationType != outline) // on window texture animation
{
- WindowPaintAttrib sAttrib = *attrib;
- FragmentAttrib fragment;
- initFragmentAttrib (&fragment, &sAttrib);
+ FragmentAttrib fragment;
+ WindowPaintAttrib wAttrib = *attrib;
+ CompTransform wTransform = *transform;
- glPushMatrix();
- glLoadIdentity();
- prepareXCoords(s, s->currentOutputDev, -DEFAULT_Z_CAMERA);
+ switch(td->currentAnimationType)
+ {
+ /*
+ Drop animation
+ */
+ case drop:
+ matrixRotate(&wTransform,
+ 100.0f / td->animationDuration * ts->msResizing - 100,
+ 0.0f, 0.0f, 1.0f);
+ mask |= PAINT_WINDOW_TRANSFORMED_MASK;
+ break;
- switch(td->currentAnimationType)
- {
- /*
- Drop animation
- */
- case drop:
- glRotatef(100.0f/td->animationDuration*ts->msResizing - 100, 0,0,1);
- (*s->drawWindow) (w, transform, &fragment, region, mask | PAINT_WINDOW_TRANSFORMED_MASK);
- break;
-
- /*
- Zoom animation
- */
- case zoom:
- glTranslatef(0,0, -1 + ts->msResizing/(float)td->animationDuration);
- (*s->drawWindow) (w, transform, &fragment, region, mask | PAINT_WINDOW_TRANSFORMED_MASK);
- break;
-
- /*
- Slide animation
- */
- case slide:
- if(ts->msResizing < 0.75*td->animationDuration)
- sAttrib.opacity = OPAQUE / 2;
- else
- sAttrib.opacity = OPAQUE/2 + OPAQUE/2*(ts->msResizing - 0.75*td->animationDuration)/(0.25*td->animationDuration);
-
- if(ts->msResizing > current*ts->oneDuration) // windows that have animation finished already
- {
- (*s->drawWindow) (w, transform, &fragment, region, mask | PAINT_WINDOW_TRANSFORMED_MASK);
- }
- else if(ts->msResizing > (current-1)*ts->oneDuration && ts->msResizing < current*ts->oneDuration) // animation in progress
- {
- int thisDur; // ms spent animating this window
- for(thisDur = ts->msResizing;thisDur > ts->oneDuration;thisDur -= ts->oneDuration)
- ;
+ /*
+ Zoom animation
+ */
+ case zoom:
+ matrixTranslate(&wTransform, 0, 0,
+ -1 + ts->msResizing / (float)td->animationDuration);
+ mask |= PAINT_WINDOW_TRANSFORMED_MASK;
+ break;
- if(current%2)
- glTranslatef(-s->width + s->width * (float)thisDur/ts->oneDuration, 0, 0);
+ /*
+ Slide animation
+ */
+ case slide:
+ if (ts->msResizing < 0.75 * td->animationDuration)
+ wAttrib.opacity = OPAQUE / 2;
else
- glTranslatef(s->width - s->width * (float)thisDur/ts->oneDuration, 0, 0);
+ wAttrib.opacity = OPAQUE / 2 + OPAQUE / 2 *
+ (ts->msResizing - 0.75 * td->animationDuration) /
+ (0.25 * td->animationDuration);
+
+ if(ts->msResizing > current * ts->oneDuration)
+ // windows that have animation finished already
+ {
+ mask |= PAINT_WINDOW_TRANSFORMED_MASK;
+ }
+ else if (ts->msResizing > (current-1)*ts->oneDuration && ts->msResizing < current*ts->oneDuration)
+ // animation in progress
+ {
+ int thisDur; // ms spent animating this window
+ for(thisDur = ts->msResizing;thisDur > ts->oneDuration;thisDur -= ts->oneDuration);
- (*s->drawWindow) (w, transform, &fragment, region, mask | PAINT_WINDOW_TRANSFORMED_MASK);
- }
- break;
+ if (current % 2)
+ matrixTranslate(&wTransform, -s->width +
+ s->width * (float)thisDur / ts->oneDuration,
+ 0, 0);
+ else
+ matrixTranslate(&wTransform, s->width -
+ s->width * (float)thisDur / ts->oneDuration,
+ 0, 0);
- /*
- Outline animation
- */
- case outline:
+ mask |= PAINT_WINDOW_TRANSFORMED_MASK;
+ }
+ else
+ dontDraw = TRUE;
+ break;
- break;
+ /*
+ Outline animation
+ */
+ case outline:
+ dontDraw = TRUE;
+ break;
- /*
- Fade animation
- */
- case fade:
- // first half of the animation, fade out
- if(ts->msResizing < 0.40f*td->animationDuration)
- {
- sAttrib.opacity = OPAQUE - OPAQUE*ts->msResizing/(0.40f*td->animationDuration);
- (*s->drawWindow) (w, transform, &fragment, region, mask | PAINT_WINDOW_TRANSFORMED_MASK);
+ /*
+ Fade animation
+ */
+ case fade:
+ // first half of the animation, fade out
+ if(ts->msResizing < 0.40f * td->animationDuration)
+ {
+ wAttrib.opacity = OPAQUE - OPAQUE *
+ ts->msResizing / (0.40f * td->animationDuration);
+ mask |= PAINT_WINDOW_TRANSFORMED_MASK;
+ }
+ else if (ts->msResizing > 0.40f * td->animationDuration && !tw->resizedAlready)
+ {
+ // resize window right after first half
+ setWindowFutureSize(w);
+ dontDraw = TRUE;
+ }
+ else if (ts->msResizing > 0.60f * td->animationDuration)
+ // second half of animation, fade in
+ {
+ wAttrib.opacity = OPAQUE *
+ (ts->msResizing - 0.60f*td->animationDuration) /
+ (0.40f*td->animationDuration);
+ mask |= PAINT_WINDOW_TRANSFORMED_MASK;
+ }
+ break;
}
- else if(ts->msResizing > 0.40f*td->animationDuration && !tw->resizedAlready) // resize window right after first half
- setWindowFutureSize(w);
- else if(ts->msResizing > 0.60f*td->animationDuration) // second half of animation, fade in
+
+ if (!dontDraw)
{
- sAttrib.opacity = OPAQUE*(ts->msResizing - 0.60f*td->animationDuration)/(0.40f*td->animationDuration);
- (*s->drawWindow) (w, transform, &fragment, region, mask | PAINT_WINDOW_TRANSFORMED_MASK);
+ glPushMatrix();
+ glLoadMatrixf(wTransform.m);
+ initFragmentAttrib(&fragment, &wAttrib);
+
+ status = (*s->drawWindow) (w, &wTransform, &fragment,
+ getInfiniteRegion(), mask);
+
+ glPopMatrix();
}
- break;
- }
- current -= 1;
- glPopMatrix();
+ current -= 1;
}
else // paint window as always
{
@@ -371,6 +399,7 @@ static Bool tilePaintScreen(CompScreen * s,
Region region, int output, unsigned int mask)
{
Bool status;
+ CompTransform sTransform = *transform;
TILE_SCREEN(s);
TILE_DISPLAY(s->display);
@@ -386,10 +415,9 @@ static Bool tilePaintScreen(CompScreen * s,
if(!td->opt[TILE_DISPLAY_OPTION_ANIMATE].value.b || !ts->isResizing || td->currentAnimationType != outline)
return status;
+ transformToScreenSpace(s, output, -DEFAULT_Z_CAMERA, &sTransform);
glPushMatrix();
- glLoadIdentity();
-
- prepareXCoords(s, output, -DEFAULT_Z_CAMERA);
+ glLoadMatrixf(sTransform.m);
glLineWidth(4.0f);