summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/blurfx.c
diff options
context:
space:
mode:
authoronestone <onestone@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-11-29 19:55:18 +0000
committeronestone <onestone@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-11-29 19:55:18 +0000
commit1ea675193e2cb7b79e1873b51c4016a968bed854 (patch)
tree311076d383d35a37d2cfb3573f7e5a952909461e /beryl-plugins/src/blurfx.c
parent702ccd1d1192f774ac1f1cf193fa9c8a4875c625 (diff)
downloadmarex-dev-1ea675193e2cb7b79e1873b51c4016a968bed854.tar.gz
marex-dev-1ea675193e2cb7b79e1873b51c4016a968bed854.tar.bz2
beryl-plugins: blurfx: fixed scale problems
git-svn-id: file:///beryl/trunk@1455 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/blurfx.c')
-rw-r--r--beryl-plugins/src/blurfx.c85
1 files changed, 48 insertions, 37 deletions
diff --git a/beryl-plugins/src/blurfx.c b/beryl-plugins/src/blurfx.c
index 025d251..5567d63 100644
--- a/beryl-plugins/src/blurfx.c
+++ b/beryl-plugins/src/blurfx.c
@@ -306,8 +306,7 @@ blurfxInitWindow (CompPlugin * p, CompWindow * w)
bw->my_next = w->next;
bw->lastX = w->attrib.x;
bw->lastY = w->attrib.y;
- bw->lastXScale = 1.0;
- bw->lastYScale = 1.0;
+ bw->lastPAttrib = w->lastPaint;
bw->decoArray.vertices = NULL;
bw->decoArray.indices = NULL;
bw->decoArray.vCount = 0;
@@ -1578,7 +1577,7 @@ blurfxDrawWindow (CompWindow * w, const WindowPaintAttrib * attrib,
bs->was_transformed = FALSE;
UNWRAP (bs, s, drawWindow);
- status = (*s->drawWindow) (w, &w->lastPaint, region, mask);
+ status = (*s->drawWindow) (w, attrib, region, mask);
WRAP (bs, s, drawWindow, blurfxDrawWindow);
}
@@ -1608,28 +1607,35 @@ blurfxDrawWindow (CompWindow * w, const WindowPaintAttrib * attrib,
|| w->lastPaint.xScale != attrib->xScale
|| w->lastPaint.yScale != attrib->yScale)
{
- rect.x = (-w->output.left * bw->lastXScale) + bw->lastX;
- rect.y = (-w->output.top * bw->lastYScale) + bw->lastY;
- rect.width = WIN_W (w) * bw->lastXScale;
- rect.height = WIN_H (w) * bw->lastYScale;
+ rect.x = bw->lastPAttrib.xTranslate +
+ (-w->output.left * bw->lastPAttrib.xScale) + bw->lastX;
+ rect.y = bw->lastPAttrib.yTranslate +
+ (-w->output.top * bw->lastPAttrib.yScale) + bw->lastY;
+ rect.width = WIN_W (w) * bw->lastPAttrib.xScale;
+ rect.height = WIN_H (w) * bw->lastPAttrib.yScale;
XUnionRectWithRegion (&rect, bs->screenDamage, bs->screenDamage);
- rect.x = (-w->output.left * attrib->xScale) + w->attrib.x;
- rect.y = (-w->output.top * attrib->yScale) + w->attrib.x;
+ rect.x = attrib->xTranslate +
+ (-w->output.left * attrib->xScale) + w->attrib.x;
+ rect.y = attrib->yTranslate +
+ (-w->output.top * attrib->yScale) + w->attrib.x;
rect.width = WIN_W (w) * attrib->xScale;
rect.height = WIN_H (w) * attrib->yScale;
XUnionRectWithRegion (&rect, bs->screenDamage, bs->screenDamage);
}
bw->lastX = w->attrib.x;
bw->lastY = w->attrib.y;
- if (bw->lastXScale != 1.0 || bw->lastYScale != 1.0)
+
+ if (bw->lastPAttrib.xScale != 1.0 || bw->lastPAttrib.yScale != 1.0)
{
for (i = 0; i < bw->damageRegion->numRects; i++)
{
BOX box = bw->damageRegion->rects[i];
- rect.x = (box.x1 - w->attrib.x) * bw->lastXScale != 1.0;
- rect.y = (box.y1 - w->attrib.y) * bw->lastYScale != 1.0;
- rect.width = (box.x2 - box.x1) * bw->lastXScale != 1.0;
- rect.height = (box.y2 - box.y1) * bw->lastYScale != 1.0;
+ rect.x = bw->lastPAttrib.xTranslate +
+ (box.x1 - w->attrib.x) * bw->lastPAttrib.xScale;
+ rect.y = bw->lastPAttrib.yTranslate +
+ (box.y1 - w->attrib.y) * bw->lastPAttrib.yScale;
+ rect.width = (box.x2 - box.x1) * bw->lastPAttrib.xScale;
+ rect.height = (box.y2 - box.y1) * bw->lastPAttrib.yScale;
XUnionRectWithRegion (&rect, bs->screenDamage,
bs->screenDamage);
}
@@ -1639,8 +1645,7 @@ blurfxDrawWindow (CompWindow * w, const WindowPaintAttrib * attrib,
XUnionRegion (bw->damageRegion, bs->screenDamage,
bs->screenDamage);
}
- bw->lastXScale = attrib->xScale;
- bw->lastYScale = attrib->yScale;
+ bw->lastPAttrib = *attrib;
XUnionRegion (getEmptyRegion(), getEmptyRegion(), bw->damageRegion);
}
@@ -2099,9 +2104,9 @@ updateBlurTexture (CompWindow * w, CompScreen * s,
if (bx2 - bx1 > 0 && by2 - by1 > 0
&& !(mask & PAINT_WINDOW_TRANSFORMED_MASK))
{
- rect.x =
+ rect.x = attrib->xTranslate +
(((bx1 - 7) - w->attrib.x) * attrib->xScale) + w->attrib.x;
- rect.y =
+ rect.y = attrib->yTranslate +
(((by1 - 1) - w->attrib.y) * attrib->yScale) + w->attrib.y;
rect.width = (bx2 - bx1 + 14) * attrib->xScale;
rect.height = (by2 - by1 + 2) * attrib->yScale;
@@ -2113,8 +2118,10 @@ updateBlurTexture (CompWindow * w, CompScreen * s,
if (bx2 - bx1 > 0 && by2 - by1 > 0
&& (mask & PAINT_WINDOW_TRANSFORMED_MASK))
{
- rect.x = (((bx1 - 7) - w->attrib.x) * attrib->xScale) + w->attrib.x;
- rect.y = (((by1 - 1) - w->attrib.y) * attrib->yScale) + w->attrib.y;
+ rect.x = attrib->xTranslate +
+ (((bx1 - 7) - w->attrib.x) * attrib->xScale) + w->attrib.x;
+ rect.y = attrib->yTranslate +
+ (((by1 - 1) - w->attrib.y) * attrib->yScale) + w->attrib.y;
rect.width = (bx2 - bx1 + 14) * attrib->xScale;
rect.height = (by2 - by1 + 2) * attrib->yScale;
@@ -2513,9 +2520,9 @@ updateBlur (CompWindow * w, CompScreen * s, const WindowPaintAttrib * attrib,
if (bx2 - bx1 > 0 && by2 - by1 > 0
&& !(mask & PAINT_WINDOW_TRANSFORMED_MASK))
{
- rect.x =
+ rect.x = -attrib->xTranslate +
(((bx1 - 7) - w->attrib.x) * attrib->xScale) + w->attrib.x;
- rect.y =
+ rect.y = -attrib->yTranslate +
(((by1 - 1) - w->attrib.y) * attrib->yScale) + w->attrib.y;
rect.width = (bx2 - bx1 + 14) * attrib->xScale;
rect.height = (by2 - by1 + 2) * attrib->yScale;
@@ -2527,8 +2534,10 @@ updateBlur (CompWindow * w, CompScreen * s, const WindowPaintAttrib * attrib,
if (bx2 - bx1 > 0 && by2 - by1 > 0
&& (mask & PAINT_WINDOW_TRANSFORMED_MASK))
{
- rect.x = (((bx1 - 7) - w->attrib.x) * attrib->xScale) + w->attrib.x;
- rect.y = (((by1 - 1) - w->attrib.y) * attrib->yScale) + w->attrib.y;
+ rect.x = attrib->xTranslate +
+ (((bx1 - 7) - w->attrib.x) * attrib->xScale) + w->attrib.x;
+ rect.y = attrib->yTranslate +
+ (((by1 - 1) - w->attrib.y) * attrib->yScale) + w->attrib.y;
rect.width = (bx2 - bx1 + 14) * attrib->xScale;
rect.height = (by2 - by1 + 2) * attrib->yScale;
@@ -2901,9 +2910,9 @@ updateBlurTextureNoFBO (CompWindow * w, CompScreen * s,
if (bx2 - bx1 > 0 && by2 - by1 > 0)
{
- rect.x =
+ rect.x = attrib->xTranslate +
(((bx1 - 7) - w->attrib.x) * attrib->xScale) + w->attrib.x;
- rect.y =
+ rect.y = attrib->yTranslate +
(((by1 - 1) - w->attrib.y) * attrib->yScale) + w->attrib.y;
rect.width = (bx2 - bx1 + 14) * attrib->xScale;
rect.height = (by2 - by1 + 2) * attrib->yScale;
@@ -3203,9 +3212,9 @@ updateBlurNoFBO (CompWindow * w, CompScreen * s,
if (bx2 - bx1 > 0 && by2 - by1 > 0
&& !(mask & PAINT_WINDOW_TRANSFORMED_MASK))
{
- rect.x =
+ rect.x = attrib->xTranslate +
(((bx1 - 7) - w->attrib.x) * attrib->xScale) + w->attrib.x;
- rect.y =
+ rect.y = attrib->yTranslate +
(((by1 - 1) - w->attrib.y) * attrib->yScale) + w->attrib.y;
rect.width = (bx2 - bx1 + 14) * attrib->xScale;
rect.height = (by2 - by1 + 2) * attrib->yScale;
@@ -3217,8 +3226,10 @@ updateBlurNoFBO (CompWindow * w, CompScreen * s,
if (bx2 - bx1 > 0 && by2 - by1 > 0
&& (mask & PAINT_WINDOW_TRANSFORMED_MASK))
{
- rect.x = (((bx1 - 7) - w->attrib.x) * attrib->xScale) + w->attrib.x;
- rect.y = (((by1 - 1) - w->attrib.y) * attrib->yScale) + w->attrib.y;
+ rect.x = attrib->xTranslate +
+ (((bx1 - 7) - w->attrib.x) * attrib->xScale) + w->attrib.x;
+ rect.y = attrib->yTranslate +
+ (((by1 - 1) - w->attrib.y) * attrib->yScale) + w->attrib.y;
rect.width = (bx2 - bx1 + 14) * attrib->xScale;
rect.height = (by2 - by1 + 2) * attrib->yScale;
@@ -3492,8 +3503,8 @@ drawBlur (CompWindow * w, CompScreen * s, CompTexture * texture,
{
glTranslatef (w->attrib.x, w->attrib.y, 0.0f);
glScalef (attrib->xScale, attrib->yScale, 0.0f);
- glTranslatef (attrib->xTranslate / attrib->xScale - w->attrib.x,
- attrib->yTranslate / attrib->yScale - w->attrib.y,
+ glTranslatef (attrib->xTranslate / attrib->xScale - w->attrib.x,
+ attrib->yTranslate / attrib->yScale - w->attrib.y,
0.0f);
}
@@ -3571,7 +3582,7 @@ drawBlur (CompWindow * w, CompScreen * s, CompTexture * texture,
if (bs->downSample != 1.0)
bm[5] *= -1;
float bpm[16];
- if (!bw->mvm_updated)
+ //if (!bw->mvm_updated)
{
bw->mvm_updated = TRUE;
glGetFloatv (GL_MODELVIEW_MATRIX, bw->mvm);
@@ -3875,8 +3886,8 @@ drawReflection (CompWindow * w, CompScreen * s, CompTexture * texture,
{
glTranslatef (w->attrib.x, w->attrib.y, 0.0f);
glScalef (attrib->xScale, attrib->yScale, 0.0f);
- glTranslatef (attrib->xTranslate / attrib->xScale - w->attrib.x,
- attrib->yTranslate / attrib->yScale - w->attrib.y,
+ glTranslatef (attrib->xTranslate / attrib->xScale - w->attrib.x,
+ attrib->yTranslate / attrib->yScale - w->attrib.y,
0.0f);
}
@@ -3987,8 +3998,8 @@ drawReflection (CompWindow * w, CompScreen * s, CompTexture * texture,
{
glTranslatef (w->attrib.x, w->attrib.y, 0.0f);
glScalef (attrib->xScale, attrib->yScale, 0.0f);
- glTranslatef (attrib->xTranslate / attrib->xScale - w->attrib.x,
- attrib->yTranslate / attrib->yScale - w->attrib.y,
+ glTranslatef (attrib->xTranslate / attrib->xScale - w->attrib.x,
+ attrib->yTranslate / attrib->yScale - w->attrib.y,
0.0f);
}
glGetFloatv (GL_MODELVIEW_MATRIX, mvm);