summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/blurfx.c
diff options
context:
space:
mode:
authoronestone <onestone@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-13 00:43:33 +0000
committeronestone <onestone@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-13 00:43:33 +0000
commit0ab00e046951ad9b6263c8fb0ede3effa86d222d (patch)
treeaf3675da1e41d63d136e72824326d2a0c358bb7b /beryl-plugins/src/blurfx.c
parent104ed8ebe6ebeed3e48c8b1269a23e36928aacc8 (diff)
downloadmarex-dev-0ab00e046951ad9b6263c8fb0ede3effa86d222d.tar.gz
marex-dev-0ab00e046951ad9b6263c8fb0ede3effa86d222d.tar.bz2
beryl-(core|plugins): moved matrix transformations out of gl (David Reveman)
- group not ported yet - blurfx has bugs but this will be fixed in a rewrite all other plugins should work git-svn-id: file:///beryl/trunk@4005 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/blurfx.c')
-rw-r--r--beryl-plugins/src/blurfx.c459
1 files changed, 77 insertions, 382 deletions
diff --git a/beryl-plugins/src/blurfx.c b/beryl-plugins/src/blurfx.c
index 6ba3733..c2c296e 100644
--- a/beryl-plugins/src/blurfx.c
+++ b/beryl-plugins/src/blurfx.c
@@ -159,7 +159,6 @@ static Bool blurfxInitScreen(CompPlugin * p, CompScreen * s)
bs->vertArray.vertexSize = 0;
bs->screenDamage = XCreateRegion();
- bs->occlusion = XCreateRegion();
bs->blurredRegion = XCreateRegion();
bs->mb_activated = FALSE;
@@ -246,7 +245,6 @@ static void blurfxFiniScreen(CompPlugin * p, CompScreen * s)
freeWindowPrivateIndex(s, bs->windowPrivateIndex);
XDestroyRegion(bs->screenDamage);
- XDestroyRegion(bs->occlusion);
XDestroyRegion(bs->blurredRegion);
@@ -295,7 +293,6 @@ static Bool blurfxInitWindow(CompPlugin * p, CompWindow * w)
bw->damageRegion = XCreateRegion();
bw->texDamage = XCreateRegion();
bw->bTexRegion = XCreateRegion();
- bw->clip = XCreateRegion();
bw->hasTexture = FALSE;
bw->vertArray.vertices = 0;
bw->vertArray.vCount = 0;
@@ -342,7 +339,6 @@ static void blurfxFiniWindow(CompPlugin * p, CompWindow * w)
XDestroyRegion(bw->damageRegion);
XDestroyRegion(bw->texDamage);
XDestroyRegion(bw->bTexRegion);
- XDestroyRegion(bw->clip);
// delete blur cache texture
if (bw->hasTexture)
@@ -1126,6 +1122,7 @@ static void blurfxPreparePaintScreen(CompScreen * s, int ms)
static Bool
blurfxPaintScreen(CompScreen * s, const ScreenPaintAttrib * sa,
+ const CompTransform *transform,
Region region, int output, unsigned int mask)
{
@@ -1184,38 +1181,6 @@ blurfxPaintScreen(CompScreen * s, const ScreenPaintAttrib * sa,
value.list.value[i].s, 0);
}
- bs->od_active = FALSE;
-
- // calculate occluted regions
- if (bs->opt[BLURFX_SCREEN_OPTION_BLUR_DECORATION].value.b
- || bs->opt[BLURFX_SCREEN_OPTION_BLUR_WINDOWS].value.b
- || bs->opt[BLURFX_SCREEN_OPTION_REFLECTION_WINDOWS].value.b)
- {
- bs->mode = MODE_OCCLUSION;
- bs->od_active = TRUE;
- XUnionRegion(getEmptyRegion(), getEmptyRegion(), bs->occlusion);
- CompWindow *w;
-
- for (w = s->reverseWindows; w; w = w->prev)
- {
- BLURFX_WINDOW(w);
- if (w->destroyed)
- continue;
-
- if (w->state & CompWindowStateOffscreenMask)
- continue;
-
- if (!w->shaded)
- {
- if (w->attrib.map_state != IsViewable || !w->damaged)
- continue;
- }
- XUnionRegion(bs->occlusion, getEmptyRegion(), bw->clip);
- (*s->drawWindow) (w, &w->paint, &s->region,
- PAINT_WINDOW_SOLID_MASK);
- }
- }
-
bs->mode = MODE_NORMAL;
Bool splash = IPCS_GetBoolND(IPCS_OBJECT(s), "SPLASH_IS_ACTIVE", FALSE);
@@ -1230,28 +1195,20 @@ blurfxPaintScreen(CompScreen * s, const ScreenPaintAttrib * sa,
Bool enable_scissor = FALSE;
- // store the projection matrix
- glGetFloatv(GL_PROJECTION_MATRIX, bs->pm);
-
if ((blur_fbo || (bs->motion_blur_active && bs->mb_mode == 2)) && s->fbo)
{
- float ModelView[16];
-
- glGetFloatv(GL_MODELVIEW_MATRIX, ModelView);
-
-
// redirect all drawing operations into background texture
Bool fbo_ok = bindFbo(s, bs->backTex);
glMatrixMode(GL_PROJECTION);
- glLoadMatrixf(bs->pm);
+ glLoadMatrixf(s->projection);
glMatrixMode(GL_MODELVIEW);
- glLoadMatrixf(ModelView);
+ glLoadIdentity();
// paint the screen into fbo
UNWRAP(bs, s, paintScreen);
- status = (*s->paintScreen) (s, sa, bigregion, output, mask);
+ status = (*s->paintScreen) (s, sa, transform, bigregion, output, mask);
WRAP(bs, s, paintScreen, blurfxPaintScreen);
unbindFbo(s);
@@ -1415,7 +1372,7 @@ blurfxPaintScreen(CompScreen * s, const ScreenPaintAttrib * sa,
else
{
UNWRAP(bs, s, paintScreen);
- status = (*s->paintScreen) (s, sa, bigregion, output, mask);
+ status = (*s->paintScreen) (s, sa, transform, bigregion, output, mask);
WRAP(bs, s, paintScreen, blurfxPaintScreen);
}
@@ -1526,6 +1483,7 @@ blurfxPaintScreen(CompScreen * s, const ScreenPaintAttrib * sa,
static void
blurfxPaintTransformedScreen(CompScreen * s, const ScreenPaintAttrib * sa,
+ const CompTransform *transform,
Region region, int output, unsigned int mask)
{
@@ -1533,41 +1491,16 @@ blurfxPaintTransformedScreen(CompScreen * s, const ScreenPaintAttrib * sa,
bs->realPaintRegion = &s->region;
- // calculate occluted regions
- if (bs->opt[BLURFX_SCREEN_OPTION_BLUR_DECORATION].value.b
- || bs->opt[BLURFX_SCREEN_OPTION_BLUR_WINDOWS].value.b
- || bs->opt[BLURFX_SCREEN_OPTION_REFLECTION_WINDOWS].value.b)
- {
- bs->mode = MODE_OCCLUSION;
- bs->od_active = TRUE;
- XUnionRegion(getEmptyRegion(), getEmptyRegion(), bs->occlusion);
- CompWindow *w;
-
- for (w = s->reverseWindows; w; w = w->prev)
- {
- BLURFX_WINDOW(w);
- if (w->destroyed)
- continue;
-
- if (!w->shaded)
- {
- if (w->attrib.map_state != IsViewable || !w->damaged)
- continue;
- }
- XUnionRegion(bs->occlusion, getEmptyRegion(), bw->clip);
- (*s->drawWindow) (w, &w->paint, &s->region,
- PAINT_WINDOW_SOLID_MASK);
- }
- }
bs->mode = MODE_NORMAL;
UNWRAP(bs, s, paintTransformedScreen);
- (*s->paintTransformedScreen) (s, sa, region, output, mask);
+ (*s->paintTransformedScreen) (s, sa, transform, region, output, mask);
WRAP(bs, s, paintTransformedScreen, blurfxPaintTransformedScreen);
}
static Bool
-blurfxDrawWindow(CompWindow * w, const WindowPaintAttrib * attrib,
+blurfxDrawWindow(CompWindow * w, const CompTransform *transform,
+ const FragmentAttrib * attrib,
Region region, unsigned int mask)
{
Bool status;
@@ -1579,13 +1512,7 @@ blurfxDrawWindow(CompWindow * w, const WindowPaintAttrib * attrib,
CompScreen *s = w->screen;
Bool blur_enabled, reflection_enabled;
- if (bs->mode == MODE_OCCLUSION)
- {
- UNWRAP(bs, s, drawWindow);
- status = (*s->drawWindow) (w, attrib, region, mask);
- WRAP(bs, s, drawWindow, blurfxDrawWindow);
- return status;
- }
+ bw->mTransform = *transform;
// enable blur and/or reflection
blur_enabled = bs->blur_supported;
@@ -1678,8 +1605,6 @@ blurfxDrawWindow(CompWindow * w, const WindowPaintAttrib * attrib,
if (bs->opt[BLURFX_SCREEN_OPTION_BLUR_CACHE_TEXTURES].value.b)
XUnionRegion(bw->texDamage, bs->screenDamage, bw->texDamage);
- bw->mvm_updated = FALSE;
-
if (blur_enabled || reflection_enabled)
{
@@ -1701,10 +1626,15 @@ blurfxDrawWindow(CompWindow * w, const WindowPaintAttrib * attrib,
bs->paintingSwitcher = bw->isSwitcher;
+ glPushMatrix ();
+ glLoadMatrixf (transform->m);
+
UNWRAP(bs, s, drawWindow);
- status = (*s->drawWindow) (w, attrib, region, mask);
+ status = (*s->drawWindow) (w, &bw->mTransform, attrib, region, mask);
WRAP(bs, s, drawWindow, blurfxDrawWindow);
+ glPopMatrix ();
+
glColor4usv(defaultColor);
screenTexEnvMode(w->screen, GL_REPLACE);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
@@ -1714,10 +1644,13 @@ blurfxDrawWindow(CompWindow * w, const WindowPaintAttrib * attrib,
bs->mode = MODE_NORMAL;
bs->was_transformed = FALSE;
+ glPushMatrix ();
+ glLoadMatrixf (transform->m);
+
UNWRAP(bs, s, drawWindow);
- status = (*s->drawWindow) (w, attrib, region, mask);
+ status = (*s->drawWindow) (w, &bw->mTransform, attrib, region, mask);
WRAP(bs, s, drawWindow, blurfxDrawWindow);
-
+ glPopMatrix();
}
else
{
@@ -1726,7 +1659,7 @@ blurfxDrawWindow(CompWindow * w, const WindowPaintAttrib * attrib,
bs->was_transformed = FALSE;
UNWRAP(bs, s, drawWindow);
- status = (*s->drawWindow) (w, attrib, region, mask);
+ status = (*s->drawWindow) (w, transform, attrib, region, mask);
WRAP(bs, s, drawWindow, blurfxDrawWindow);
}
@@ -1735,69 +1668,12 @@ blurfxDrawWindow(CompWindow * w, const WindowPaintAttrib * attrib,
XUnionRegion(&s->outputDev[bs->output].region,
bs->screenDamage, bs->screenDamage);
- if (!(mask & PAINT_WINDOW_SOLID_MASK) && !WINDOW_INPUT_INVISIBLE(w))
- {
-
- // not all plugins send damage events on move or scale
- XRectangle rect;
-
- if (bw->lastX != w->attrib.x || bw->lastY != w->attrib.y
- || w->lastPaint.xScale != attrib->xScale
- || w->lastPaint.yScale != attrib->yScale)
- {
- 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 = 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->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 = 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);
- }
- }
- else
- {
- XUnionRegion(bw->damageRegion, bs->screenDamage,
- bs->screenDamage);
- }
- bw->lastPAttrib = *attrib;
- XUnionRegion(getEmptyRegion(), getEmptyRegion(), bw->damageRegion);
- }
-
return status;
}
static void
blurfxDrawWindowTexture(CompWindow * w, CompTexture * texture,
- const WindowPaintAttrib * attrib,
- const FragmentAttrib *fAttrib,
+ const FragmentAttrib *attrib,
unsigned int mask)
{
@@ -1891,28 +1767,12 @@ blurfxDrawWindowTexture(CompWindow * w, CompTexture * texture,
reflection_enabled &= !DISABLE_FEATURE(w, bw->ipcs_disable_reflection);
reflection_enabled &= !splash;
- // add window region to occlusion region
- if (bs->mode == MODE_OCCLUSION)
- {
- if (!(mask & PAINT_WINDOW_TRANSFORMED_MASK))
- return;
- if (mask & PAINT_WINDOW_TRANSFORMED_MASK)
- return;
- if (mask & PAINT_WINDOW_DECORATION_MASK)
- return;
- if (mask & PAINT_WINDOW_TRANSLUCENT_MASK)
- return;
- if (WINDOW_INPUT_INVISIBLE(w))
- return;
- XUnionRegion(w->region, bs->occlusion, bs->occlusion);
- return;
- }
// draw normal window
if (bs->mode == MODE_NORMAL)
{
GLERR;
UNWRAP(bs, w->screen, drawWindowTexture);
- (*w->screen->drawWindowTexture) (w, texture, attrib, fAttrib, mask);
+ (*w->screen->drawWindowTexture) (w, texture, attrib, mask);
WRAP(bs, w->screen, drawWindowTexture, blurfxDrawWindowTexture);
#ifdef GL_DEBUG
glGetError();
@@ -1979,22 +1839,22 @@ blurfxDrawWindowTexture(CompWindow * w, CompTexture * texture,
{
// update blur cache texture
bw->texUpdated = TRUE;
- updateBlurTextureSize(w, s, attrib, mask);
+ updateBlurTextureSize(w, s, mask);
GLERR;
if (useFbo)
{
- updateBlurTexture(w, s, attrib, mask, filter);
+ updateBlurTexture(w, s, mask, filter);
GLERR;
}
else
{
- updateBlurTextureNoFBO(w, s, attrib, mask);
+ updateBlurTextureNoFBO(w, s, mask);
GLERR;
}
}
if (useFbo)
{
- updateBlur(w, s, attrib, mask, filter);
+ updateBlur(w, s, mask, filter);
GLERR;
if (enable_clipPlanes)
@@ -2009,7 +1869,7 @@ blurfxDrawWindowTexture(CompWindow * w, CompTexture * texture,
}
else
{
- updateBlurNoFBO(w, s, attrib, mask);
+ updateBlurNoFBO(w, s, mask);
GLERR;
}
drawBlur(w, s, texture, attrib, mask, filter);
@@ -2029,10 +1889,6 @@ blurfxAddWindowGeometry(CompWindow * w, CompMatrix * m, int nM,
BLURFX_WINDOW(w);
REGION box;
- if (bs->mode == MODE_OCCLUSION)
- return;
-
-
// try to detect decorations
if (bs->mode == MODE_BLURREFLECTION && region->numRects == 1
&&
@@ -2116,8 +1972,7 @@ static Bool blurfxDamageWindowRect(CompWindow * w, Bool initial, BoxPtr box)
}
static void
-updateBlurTexture(CompWindow * w, CompScreen * s,
- const WindowPaintAttrib * attrib, unsigned int mask,
+updateBlurTexture(CompWindow * w, CompScreen * s, unsigned int mask,
CompTextureFilter filter)
{
@@ -2242,14 +2097,10 @@ updateBlurTexture(CompWindow * w, CompScreen * s,
if (bx2 - bx1 > 0 && by2 - by1 > 0
&& !(mask & PAINT_WINDOW_TRANSFORMED_MASK))
{
- 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;
+ rect.x = bx1 - 7;
+ rect.y = by1 - 1;
+ rect.width = bx2 - bx1 + 14;
+ rect.height = by2 - by1 + 2;
XUnionRectWithRegion(&rect, reblurRegion, reblurRegion);
}
@@ -2258,12 +2109,10 @@ updateBlurTexture(CompWindow * w, CompScreen * s,
if (bx2 - bx1 > 0 && by2 - by1 > 0
&& (mask & PAINT_WINDOW_TRANSFORMED_MASK))
{
- 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;
+ rect.x = bx1 - 7;
+ rect.y = by1 - 1;
+ rect.width = bx2 - bx1 + 14;
+ rect.height = by2 - by1 + 2;
XUnionRectWithRegion(&rect, reblurRegion, reblurRegion);
}
@@ -2278,11 +2127,6 @@ updateBlurTexture(CompWindow * w, CompScreen * s,
XIntersectRegion(reblurRegion, &s->outputDev[bs->output].region,
reblurRegion);
- // subtract occluded region
- if (bs->od_active)
- XSubtractRegion(reblurRegion, bw->clip, reblurRegion);
-
-
stride = 4 * sizeof(GLfloat);
if (screenGrabExist(s, "switcher", 0) || bw->isSwitcher)
@@ -2313,14 +2157,8 @@ updateBlurTexture(CompWindow * w, CompScreen * s,
float bpm[16];
float tm[16];
- if (!bw->mvm_updated)
- {
- bw->mvm_updated = TRUE;
- glGetFloatv(GL_MODELVIEW_MATRIX, bw->mvm);
- }
-
- MULTM(bm, bs->pm, bpm);
- MULTM(bpm, bw->mvm, tm);
+ MULTM(bm, s->projection, bpm);
+ MULTM(bpm, bw->mTransform.m, tm);
XRectangle rect, outputRect;
@@ -2557,8 +2395,7 @@ updateBlurTexture(CompWindow * w, CompScreen * s,
}
static void
-updateBlur(CompWindow * w, CompScreen * s,
- const WindowPaintAttrib * attrib, unsigned int mask,
+updateBlur(CompWindow * w, CompScreen * s, unsigned int mask,
CompTextureFilter filter)
{
@@ -2671,14 +2508,10 @@ updateBlur(CompWindow * w, CompScreen * s,
if (bx2 - bx1 > 0 && by2 - by1 > 0
&& !(mask & PAINT_WINDOW_TRANSFORMED_MASK))
{
- 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;
+ rect.x = bx1 - 7;
+ rect.y = by1 - 1;
+ rect.width = bx2 - bx1 + 14;
+ rect.height = by2 - by1 + 2;
XUnionRectWithRegion(&rect, reblurRegion, reblurRegion);
}
@@ -2687,12 +2520,10 @@ updateBlur(CompWindow * w, CompScreen * s,
if (bx2 - bx1 > 0 && by2 - by1 > 0
&& (mask & PAINT_WINDOW_TRANSFORMED_MASK))
{
- 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;
+ rect.x = bx1 - 7;
+ rect.y = by1 - 1;
+ rect.width = bx2 - bx1 + 14;
+ rect.height = by2 - by1 + 2;
XUnionRectWithRegion(&rect, reblurRegion, reblurRegion);
}
@@ -2703,10 +2534,6 @@ updateBlur(CompWindow * w, CompScreen * s,
XSubtractRegion(reblurRegion, bs->blurredRegion, reblurRegion);
- // subtract occluded region
- if (bs->od_active)
- XSubtractRegion(reblurRegion, bw->clip, reblurRegion);
-
// subtract blur cache texture region
if (bw->texUpdated)
XSubtractRegion(reblurRegion, bw->bTexRegion, reblurRegion);
@@ -2749,11 +2576,8 @@ updateBlur(CompWindow * w, CompScreen * s,
float bpm[16];
float tm[16];
- bw->mvm_updated = FALSE;
- glGetFloatv(GL_MODELVIEW_MATRIX, bw->mvm);
-
- MULTM(bm, bs->pm, bpm);
- MULTM(bpm, bw->mvm, tm);
+ MULTM(bm, s->projection, bpm);
+ MULTM(bpm, bw->mTransform.m, tm);
float s_gen[4] = { tm[0], tm[4], tm[8], tm[12] };
float t_gen[4] = { tm[1], tm[5], tm[9], tm[13] };
@@ -2832,8 +2656,7 @@ updateBlur(CompWindow * w, CompScreen * s,
}
static void
-updateBlurTextureSize(CompWindow * w, CompScreen * s,
- const WindowPaintAttrib * attrib, unsigned int mask)
+updateBlurTextureSize(CompWindow * w, CompScreen * s, unsigned int mask)
{
XRectangle box;
@@ -2944,8 +2767,7 @@ updateBlurTextureSize(CompWindow * w, CompScreen * s,
}
static void
-updateBlurTextureNoFBO(CompWindow * w, CompScreen * s,
- const WindowPaintAttrib * attrib, unsigned int mask)
+updateBlurTextureNoFBO(CompWindow * w, CompScreen * s, unsigned int mask)
{
Region reblurRegion;
@@ -3065,14 +2887,10 @@ updateBlurTextureNoFBO(CompWindow * w, CompScreen * s,
if (bx2 - bx1 > 0 && by2 - by1 > 0)
{
- 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;
+ rect.x = bx1 - 7;
+ rect.y = by1 - 1;
+ rect.width = bx2 - bx1 + 14;
+ rect.height = by2 - by1 + 2;
XUnionRectWithRegion(&rect, reblurRegion, reblurRegion);
}
@@ -3088,10 +2906,6 @@ updateBlurTextureNoFBO(CompWindow * w, CompScreen * s,
XIntersectRegion(reblurRegion, &s->outputDev[bs->output].region,
reblurRegion);
- // subtract occluded region
- if (bs->od_active)
- XSubtractRegion(reblurRegion, bw->clip, reblurRegion);
-
if (reblurRegion->numRects)
{
@@ -3108,14 +2922,8 @@ updateBlurTextureNoFBO(CompWindow * w, CompScreen * s,
float bpm[16];
float tm[16];
- if (!bw->mvm_updated)
- {
- bw->mvm_updated = TRUE;
- glGetFloatv(GL_MODELVIEW_MATRIX, bw->mvm);
- }
-
- MULTM(bm, bs->pm, bpm);
- MULTM(bpm, bw->mvm, tm);
+ MULTM(bm, s->projection, bpm);
+ MULTM(bpm, bw->mTransform.m, tm);
int i;
XRectangle sRect, bRect;
@@ -3266,8 +3074,7 @@ updateBlurTextureNoFBO(CompWindow * w, CompScreen * s,
}
static void
-updateBlurNoFBO(CompWindow * w, CompScreen * s,
- const WindowPaintAttrib * attrib, unsigned int mask)
+updateBlurNoFBO(CompWindow * w, CompScreen * s, unsigned int mask)
{
Region reblurRegion;
@@ -3377,14 +3184,10 @@ updateBlurNoFBO(CompWindow * w, CompScreen * s,
if (bx2 - bx1 > 0 && by2 - by1 > 0
&& !(mask & PAINT_WINDOW_TRANSFORMED_MASK))
{
- 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;
+ rect.x = bx1 - 7;
+ rect.y = by1 - 1;
+ rect.width = bx2 - bx1 + 14;
+ rect.height = by2 - by1 + 2;
XUnionRectWithRegion(&rect, reblurRegion, reblurRegion);
}
@@ -3393,12 +3196,10 @@ updateBlurNoFBO(CompWindow * w, CompScreen * s,
if (bx2 - bx1 > 0 && by2 - by1 > 0
&& (mask & PAINT_WINDOW_TRANSFORMED_MASK))
{
- 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;
+ rect.x = bx1 - 7;
+ rect.y = by1 - 1;
+ rect.width = bx2 - bx1 + 14;
+ rect.height = by2 - by1 + 2;
XUnionRectWithRegion(&rect, reblurRegion, reblurRegion);
}
@@ -3407,10 +3208,6 @@ updateBlurNoFBO(CompWindow * w, CompScreen * s,
XSubtractRegion(reblurRegion, bs->blurredRegion, reblurRegion);
- // subtract occluded region
- if (bs->od_active)
- XSubtractRegion(reblurRegion, bw->clip, reblurRegion);
-
// subtract blur cache texture region
if (bw->texUpdated)
XSubtractRegion(reblurRegion, bw->bTexRegion, reblurRegion);
@@ -3437,11 +3234,8 @@ updateBlurNoFBO(CompWindow * w, CompScreen * s,
float bpm[16];
float tm[16];
- bw->mvm_updated = FALSE;
- glGetFloatv(GL_MODELVIEW_MATRIX, bw->mvm);
-
- MULTM(bm, bs->pm, bpm);
- MULTM(bpm, bw->mvm, tm);
+ MULTM(bm, s->projection, bpm);
+ MULTM(bpm, bw->mTransform.m, tm);
Bool enable_light = FALSE;
@@ -3692,7 +3486,7 @@ updateBlurNoFBO(CompWindow * w, CompScreen * s,
static void
drawBlur(CompWindow * w, CompScreen * s, CompTexture * texture,
- const WindowPaintAttrib * attrib, int mask, CompTextureFilter filter)
+ const FragmentAttrib *attrib, int mask, CompTextureFilter filter)
{
int i, count, vCount, iCount, stride;
@@ -3707,14 +3501,6 @@ drawBlur(CompWindow * w, CompScreen * s, CompTexture * texture,
glPushMatrix();
- if (mask & PAINT_WINDOW_TRANSFORMED_MASK)
- {
- 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, 0.0f);
- }
// Do we have an decoration vertex array thet does not contain shadows?
if (mask & PAINT_WINDOW_DECORATION_MASK && bw->decoArray.vCount)
{
@@ -3738,39 +3524,9 @@ drawBlur(CompWindow * w, CompScreen * s, CompTexture * texture,
count = 0;
stride = (w->texUnits * w->texCoordSize + 2) * sizeof(GLfloat);
- // draw blur only for visible regions
- if (!(mask & PAINT_WINDOW_DECORATION_MASK) && !w->alpha
- && !(mask & PAINT_WINDOW_TRANSFORMED_MASK) && !w->shaded
- && bs->od_active)
- {
- Region drawBlurRegion = XCreateRegion();
-
- XIntersectRegion(w->region, bw->paintRegion, drawBlurRegion);
- if (bw->texUpdated)
- XIntersectRegion(drawBlurRegion, bw->bTexRegion, drawBlurRegion);
- XSubtractRegion(drawBlurRegion, bw->clip, drawBlurRegion);
-
- CompMatrix mat;
-
- mat.xx = 0.0;
- mat.yx = 0.0;
- mat.xy = 0.0;
- mat.yy = 0.0;
- mat.x0 = 0.0;
- mat.y0 = 0.0;
-
- genGeometry(&bs->vertArray, mat, 0, drawBlurRegion);
- stride = 4 * sizeof(GLfloat);
- vCount = bs->vertArray.vCount;
- iCount = 0;
- vertices = bs->vertArray.vertices + 2;
- XDestroyRegion(drawBlurRegion);
- }
-
glVertexPointer(2, GL_FLOAT, stride, vertices);
GLERR;
-
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -3800,14 +3556,9 @@ drawBlur(CompWindow * w, CompScreen * s, CompTexture * texture,
bm[5] *= -1;
float bpm[16];
- //if (!bw->mvm_updated)
- {
- bw->mvm_updated = TRUE;
- glGetFloatv(GL_MODELVIEW_MATRIX, bw->mvm);
- }
- MULTM(bm, bs->pm, bpm);
- MULTM(bpm, bw->mvm, tm);
+ MULTM(bm, s->projection, bpm);
+ MULTM(bpm, bw->mTransform.m, tm);
float s_gen[4] = { tm[0], tm[4], tm[8], tm[12] };
float t_gen[4] = { tm[1], tm[5], tm[9], tm[13] };
@@ -4086,8 +3837,8 @@ drawBlur(CompWindow * w, CompScreen * s, CompTexture * texture,
static void
drawReflection(CompWindow * w, CompScreen * s, CompTexture * texture,
- const WindowPaintAttrib * attrib, int mask,
- CompTextureFilter filter)
+ const FragmentAttrib *attrib,
+ int mask, CompTextureFilter filter)
{
int vCount, iCount;
@@ -4101,15 +3852,6 @@ drawReflection(CompWindow * w, CompScreen * s, CompTexture * texture,
glPushMatrix();
- if (mask & PAINT_WINDOW_TRANSFORMED_MASK)
- {
- 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, 0.0f);
-
- }
// setup reflection texture scaling
if (bs->opt[BLURFX_SCREEN_OPTION_REFLECTION_SCALE].value.b)
{
@@ -4163,32 +3905,6 @@ drawReflection(CompWindow * w, CompScreen * s, CompTexture * texture,
int stride = (w->texUnits * w->texCoordSize + 2) * sizeof(GLfloat);
- // draw reflection only for visible regions
- if (!(mask & PAINT_WINDOW_DECORATION_MASK) && !w->alpha
- && !(mask & PAINT_WINDOW_TRANSFORMED_MASK) && !w->shaded)
- {
- Region drawBlurRegion = XCreateRegion();
-
- XIntersectRegion(w->region, bw->paintRegion, drawBlurRegion);
- XSubtractRegion(drawBlurRegion, bw->clip, drawBlurRegion);
-
- CompMatrix mat;
-
- mat.xx = 0.0;
- mat.yx = 0.0;
- mat.xy = 0.0;
- mat.yy = 0.0;
- mat.x0 = 0.0;
- mat.y0 = 0.0;
-
- genGeometry(&bs->vertArray, mat, 0, drawBlurRegion);
- stride = 4 * sizeof(GLfloat);
- vCount = bs->vertArray.vCount;
- iCount = 0;
- vertices = bs->vertArray.vertices + 2;
- XDestroyRegion(drawBlurRegion);
- }
-
glVertexPointer(2, GL_FLOAT, stride, vertices);
@@ -4211,28 +3927,9 @@ drawReflection(CompWindow * w, CompScreen * s, CompTexture * texture,
};
float bpm[16];
float tm[16];
- float mvm[16];
-
- glPushMatrix();
- glLoadIdentity();
- glTranslatef(-0.5f, -0.5f, -DEFAULT_Z_CAMERA);
- glScalef(1.0f / s->width, -1.0f / s->height, 1.0f);
- glTranslatef(0.0f, -s->height, 0.0f);
- if (mask & PAINT_WINDOW_TRANSFORMED_MASK)
- {
- 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, 0.0f);
- }
- glGetFloatv(GL_MODELVIEW_MATRIX, mvm);
- glPopMatrix();
-
- MULTM(bm, bs->pm, bpm);
- MULTM(bpm, mvm, tm);
+ MULTM(bm, s->projection, bpm);
+ MULTM(bpm, bw->mTransform.m, tm);
float s_gen[4] = { tm[0], tm[4], tm[8], tm[12] };
float t_gen[4] = { tm[1], tm[5], tm[9], tm[13] };
@@ -4475,8 +4172,6 @@ static Bool bindFbo(CompScreen * s, BlurTexture tex)
s->outputDev[bs->output].width,
s->outputDev[bs->output].height);
- prepareXCoords(s, bs->output, -DEFAULT_Z_CAMERA);
-
bs->fboActive = TRUE;
GLERR;