Merge lp:~samuel-thibault/compiz/xysync2 into lp:compiz/0.9.13

Proposed by Samuel thibault
Status: Needs review
Proposed branch: lp:~samuel-thibault/compiz/xysync2
Merge into: lp:compiz/0.9.13
Diff against target: 35 lines (+8/-14)
1 file modified
plugins/ezoom/src/ezoom.cpp (+8/-14)
To merge this branch: bzr merge lp:~samuel-thibault/compiz/xysync2
Reviewer Review Type Date Requested Status
Compiz Maintainers Pending
Review via email: mp+349252@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alberts Muktupāvels (muktupavels) wrote :

Code/change looks good to me, but no idea about math part... Does that really produce expected result?

For example xdiff = 2.5 and ydiff = 3.5. With current code xamount = 2.5 and yamount = 3.5, but with your change amount is now 4.301162634. Is that expected?

lp:~samuel-thibault/compiz/xysync2 updated
4145. By Samuel thibault

Normalize combination of xdiff and ydiff

4146. By Samuel thibault

No need to use the double version of sqrt

Revision history for this message
Samuel thibault (samuel-thibault) wrote :

I, right, I missed normalizing by dividing by sqrt(2), I have now done so.

Revision history for this message
Samuel thibault (samuel-thibault) wrote :

Mmm, but then with e.g. xdiff == 0 the value is then not correct, I have to rethink that.

Unmerged revisions

4146. By Samuel thibault

No need to use the double version of sqrt

4145. By Samuel thibault

Normalize combination of xdiff and ydiff

4144. By Samuel thibault

Synchronize X and Y translation capping

Capping X and Y separately brings some discontinuity visual effect: instead of
terminating the translation at the same time, the axis getting capped (e.g. X)
will terminate the translation later, so that at the point when the other axis
(here, Y) is finished translating, there is a discontinuity in the movement: we
suddenly have only X translation, and no Y translation any more. This does not
look very smooth.

This changes it by simply capping both axis at the same time.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/ezoom/src/ezoom.cpp'
--- plugins/ezoom/src/ezoom.cpp 2017-12-05 14:45:06 +0000
+++ plugins/ezoom/src/ezoom.cpp 2018-07-14 08:18:26 +0000
@@ -308,23 +308,17 @@
308308
309 float xadjust = xdiff * 0.002f;309 float xadjust = xdiff * 0.002f;
310 float yadjust = ydiff * 0.002f;310 float yadjust = ydiff * 0.002f;
311 float xamount = fabs (xdiff);311 float amount = sqrtf (xdiff * xdiff + ydiff * ydiff) / sqrtf (2.);
312 float yamount = fabs (ydiff);312
313313 if (amount < 1.0f)
314 if (xamount < 1.0f)314 amount = 1.0f;
315 xamount = 1.0f;315 else if (amount > 5.0)
316 else if (xamount > 5.0)316 amount = 5.0f;
317 xamount = 5.0f;
318
319 if (yamount < 1.0f)
320 yamount = 1.0f;
321 else if (yamount > 5.0)
322 yamount = 5.0f;
323317
324 zooms.at (out).xVelocity =318 zooms.at (out).xVelocity =
325 (xamount * zooms.at (out).xVelocity + xadjust) / (xamount + 1.0f);319 (amount * zooms.at (out).xVelocity + xadjust) / (amount + 1.0f);
326 zooms.at (out).yVelocity =320 zooms.at (out).yVelocity =
327 (yamount * zooms.at (out).yVelocity + yadjust) / (yamount + 1.0f);321 (amount * zooms.at (out).yVelocity + yadjust) / (amount + 1.0f);
328322
329 if ((fabs(xdiff) < 0.1f && fabs (zooms.at (out).xVelocity) < 0.005f) &&323 if ((fabs(xdiff) < 0.1f && fabs (zooms.at (out).xVelocity) < 0.005f) &&
330 (fabs(ydiff) < 0.1f && fabs (zooms.at (out).yVelocity) < 0.005f))324 (fabs(ydiff) < 0.1f && fabs (zooms.at (out).yVelocity) < 0.005f))

Subscribers

People subscribed via source and target branches