summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/resize.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/resize.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/resize.c')
-rw-r--r--beryl-plugins/src/resize.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/beryl-plugins/src/resize.c b/beryl-plugins/src/resize.c
index b4918dd..57824bf 100644
--- a/beryl-plugins/src/resize.c
+++ b/beryl-plugins/src/resize.c
@@ -976,9 +976,11 @@ static void resizePreparePaintScreen(CompScreen * s, int msSinceLastPaint)
static Bool
resizePaintWindow(CompWindow * w,
const WindowPaintAttrib * attrib,
+ const CompTransform *transform,
Region region, unsigned int mask)
{
- WindowPaintAttrib sAttrib;
+ WindowPaintAttrib sAttrib = *attrib;
+ CompTransform sTransform = *transform;
CompScreen *s = w->screen;
Bool status;
@@ -994,12 +996,15 @@ resizePaintWindow(CompWindow * w,
if (rd->resizeMode == ResizeModeStretch)
{
- sAttrib.xScale =
+ float xScale =
(float)(rd->currentWidth) /
(float)(rd->w->attrib.width);
- sAttrib.yScale =
+ float yScale =
(float)(rd->currentHeight) /
(float)(rd->w->attrib.height);
+ matrixTranslate (&sTransform, w->attrib.x, w->attrib.y, 0.0f);
+ matrixScale (&sTransform, xScale, yScale, 0.0f);
+ matrixTranslate (&sTransform, -w->attrib.x, -w->attrib.y, 0.0f);
}
if (rd->resizeOpacity != OPAQUE
@@ -1007,18 +1012,18 @@ resizePaintWindow(CompWindow * w,
{
sAttrib.opacity = (sAttrib.opacity * rd->resizeOpacity) >> 16;
}
- attrib = &sAttrib;
}
UNWRAP(rs, s, paintWindow);
- status = (*s->paintWindow) (w, attrib, region, mask);
+ status = (*s->paintWindow) (w, &sAttrib, &sTransform, region, mask);
WRAP(rs, s, paintWindow, resizePaintWindow);
return status;
}
static void
-resizePaintOutline(CompScreen * s, const ScreenPaintAttrib * sa, int output,
+resizePaintOutline(CompScreen * s, const ScreenPaintAttrib * sa,
+ const CompTransform *transform, int output,
Bool transformed)
{
int x1 = 0, x2 = 0, y1 = 0, y2 = 0;
@@ -1036,16 +1041,21 @@ resizePaintOutline(CompScreen * s, const ScreenPaintAttrib * sa, int output,
(rd->w->shaded ? rd->w->height : rd->currentHeight) +
rd->w->input.bottom;
- glPushMatrix();
+ CompTransform sTransform = *transform;
if (transformed)
{
- glLoadIdentity();
- (s->applyScreenTransform) (s, sa, output);
+ (s->applyScreenTransform) (s, sa, output, &sTransform);
+ transformToScreenSpace (s, output, -sa->zTranslate, &sTransform);
}
+ else
+ transformToScreenSpace (s, output, -DEFAULT_Z_CAMERA, &sTransform);
+
+
+
+ glPushMatrix ();
+ glLoadMatrixf (sTransform.m);
- prepareXCoords(s, output,
- transformed ? -sa->zTranslate : -DEFAULT_Z_CAMERA);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glEnable(GL_BLEND);
@@ -1076,6 +1086,7 @@ resizePaintOutline(CompScreen * s, const ScreenPaintAttrib * sa, int output,
static Bool
resizePaintScreen(CompScreen * s,
const ScreenPaintAttrib * sAttrib,
+ const CompTransform *transform,
Region region, int output, unsigned int mask)
{
Bool status = FALSE;
@@ -1091,28 +1102,29 @@ resizePaintScreen(CompScreen * s,
mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
UNWRAP(rs, s, paintScreen);
- status = (*s->paintScreen) (s, sAttrib, region, output, mask);
+ status = (*s->paintScreen) (s, sAttrib, transform, region, output, mask);
WRAP(rs, s, paintScreen, resizePaintScreen);
if (status && !rs->painted)
- resizePaintOutline(s, sAttrib, output, FALSE);
+ resizePaintOutline(s, sAttrib, transform, output, FALSE);
return status;
}
static void
resizePaintTransformedScreen(CompScreen * s, const ScreenPaintAttrib * sa,
+ const CompTransform *transform,
Region region, int output, unsigned int mask)
{
RESIZE_SCREEN(s);
UNWRAP(rs, s, paintTransformedScreen);
- (*s->paintTransformedScreen) (s, sa, region, output, mask);
+ (*s->paintTransformedScreen) (s, sa, transform, region, output, mask);
WRAP(rs, s, paintTransformedScreen, resizePaintTransformedScreen);
if ((rs->x == s->x) && (rs->y == s->y)) {
rs->painted = TRUE;
- resizePaintOutline(s, sa, output, TRUE);
+ resizePaintOutline(s, sa, transform, output, TRUE);
}
}