[fusion-commits] Cube reflection and cylinder effect plugin: Changes to 'master' (d89fad3a22f58ec81793120f2929a57cdf4c7bb7)
onestone at server.opencompositing.org
onestone at server.opencompositing.org
Mon May 5 19:40:29 CEST 2008
New commits:
commit d89fad3a22f58ec81793120f2929a57cdf4c7bb7
Author: Dennis Kasprzyk <onestone at opencompositing.org>
Date: Mon May 5 19:40:19 2008 +0200
Reduced number of addWindowGeometry calls.
cubeaddon.c | 47 +++++++++++++++++++++++++++++++++++------------
1 files changed, 35 insertions(+), 12 deletions(-)
Modified: fusion/plugins/cubeaddon/cubeaddon.c
===================================================================
--- fusion/plugins/cubeaddon/cubeaddon.c
+++ fusion/plugins/cubeaddon/cubeaddon.c
@@ -73,6 +73,8 @@ typedef struct _CubeaddonScreen
Bool wasDeformed;
Region tmpRegion;
+ BoxPtr tmpBox;
+ int nTmpBox;
GLfloat *winNormals;
unsigned int winNormSize;
@@ -418,7 +420,7 @@ cubeaddonPaintBottom (CompScreen *s,
glColor4usv (defaultColor);
}
-
+
static void
cubeaddonAddWindowGeometry (CompWindow *w,
CompMatrix *matrix,
@@ -437,7 +439,7 @@ cubeaddonAddWindowGeometry (CompWindow *w,
REGION reg;
GLfloat *v;
int offX = 0, offY = 0;
- int sx1, sx2, sw, sy1, sy2, sh;
+ int sx1, sx2, sw, sy1, sy2, sh, nBox, currBox;
float lastX, lastZ = 0.0, radSquare;
float a1, a2, ang;
@@ -453,11 +455,15 @@ cubeaddonAddWindowGeometry (CompWindow *w,
radSquare = (cs->distance * cs->distance) + 0.5;
}
+ nBox = (((region->extents.y2 - region->extents.y1) / yi) + 1) *
+ (((region->extents.x2 - region->extents.x1) /
+ CUBEADDON_GRID_SIZE) + 1);
+
reg.numRects = 1;
reg.rects = ®.extents;
y1 = region->extents.y1;
- y2 = MIN (y1 + y1, region->extents.y2);
+ y2 = MIN (y1 + yi, region->extents.y2);
UNWRAP (cas, s, addWindowGeometry);
@@ -493,26 +499,40 @@ cubeaddonAddWindowGeometry (CompWindow *w,
}
else
{
- while (y1 < region->extents.y2)
+ if (cas->nTmpBox < nBox)
{
- reg.extents.y1 = y1;
- reg.extents.y2 = y2;
+ cas->tmpBox = realloc (cas->tmpBox, nBox * sizeof (BOX));
+ if (!cas->tmpBox)
+ return;
+ cas->nTmpBox = nBox;
+ }
+ reg.extents = region->extents;
+ reg.rects = cas->tmpBox;
+
+ currBox = 0;
+ while (y1 < region->extents.y2)
+ {
x1 = region->extents.x1;
- x2 = MIN (x1 + CUBEADDON_GRID_SIZE, region->extents.x2);
+ x2 = MIN (x1 + yi, region->extents.x2);
while (x1 < region->extents.x2)
{
- reg.extents.x1 = x1;
- reg.extents.x2 = x2;
- (*w->screen->addWindowGeometry) (w, matrix, nMatrix,
- ®, clip);
+ reg.rects[currBox].y1 = y1;
+ reg.rects[currBox].y2 = y2;
+ reg.rects[currBox].x1 = x1;
+ reg.rects[currBox].x2 = x2;
+
+ currBox++;
+
x1 = x2;
x2 = MIN (x2 + CUBEADDON_GRID_SIZE, region->extents.x2);
}
y1 = y2;
- y2 = MIN (y2 + CUBEADDON_GRID_SIZE, region->extents.y2);
+ y2 = MIN (y2 + yi, region->extents.y2);
}
+ reg.numRects = currBox;
+ (*w->screen->addWindowGeometry) (w, matrix, nMatrix, ®, clip);
}
WRAP (cas, s, addWindowGeometry, cubeaddonAddWindowGeometry);
@@ -1193,6 +1213,9 @@ cubeaddonInitScreen (CompPlugin *p,
cas->winNormals = NULL;
cas->winNormSize = 0;
+ cas->tmpBox = NULL;
+ cas->nTmpBox = 0;
+
WRAP (cas, s, paintTransformedOutput, cubeaddonPaintTransformedOutput);
WRAP (cas, s, paintOutput, cubeaddonPaintOutput);
WRAP (cas, s, donePaintScreen, cubeaddonDonePaintScreen);
More information about the commits
mailing list