[beryl-commits] r1454 - trunk/beryl-plugins/src

onestone at server.beryl-project.org onestone at server.beryl-project.org
Sat Dec 2 00:22:00 CET 2006


Author: onestone
Date: 2006-12-02 00:21:59 +0100 (Sat, 02 Dec 2006)
New Revision: 1454

Modified:
   trunk/beryl-plugins/src/blurfx.c
   trunk/beryl-plugins/src/blurfx.h
Log:
beryl-plugins: blurfx: fixed scale problems

Modified: trunk/beryl-plugins/src/blurfx.c
===================================================================
--- trunk/beryl-plugins/src/blurfx.c	2006-11-29 16:54:20 UTC (rev 1453)
+++ trunk/beryl-plugins/src/blurfx.c	2006-12-01 23:21:59 UTC (rev 1454)
@@ -306,8 +306,7 @@
     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 @@
         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 @@
             || 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 @@
             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 @@
         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 @@
     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 @@
         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 @@
     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 @@
 
         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 @@
         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 @@
     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 @@
     {
         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 @@
         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 @@
     {
         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 @@
         {
             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);

Modified: trunk/beryl-plugins/src/blurfx.h
===================================================================
--- trunk/beryl-plugins/src/blurfx.h	2006-11-29 16:54:20 UTC (rev 1453)
+++ trunk/beryl-plugins/src/blurfx.h	2006-12-01 23:21:59 UTC (rev 1454)
@@ -289,8 +289,7 @@
     // last position and scale
     int                     lastX;
     int                     lastY;
-    float                   lastXScale;
-    float                   lastYScale;
+    WindowPaintAttrib       lastPAttrib;
 
     Region                  clip;              // occluted region
     Region                  paintRegion;       // actual paint region




More information about the commits mailing list