mirror of
https://github.com/greenshot/greenshot
synced 2025-08-20 13:33:27 -07:00
Fix for pixel jerk
This commit is contained in:
parent
dcf75fd081
commit
bac1ff4ba0
1 changed files with 19 additions and 0 deletions
|
@ -1440,6 +1440,25 @@ namespace Greenshot.Drawing
|
||||||
LOG.Debug("Empty cliprectangle??");
|
LOG.Debug("Empty cliprectangle??");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Correction to prevent rounding errors at certain zoom levels.
|
||||||
|
// When zooming to N/M, clip rectangle top and left coordinates should be multiples of N.
|
||||||
|
if (_zoomFactor.Numerator > 1 && _zoomFactor.Denominator > 1)
|
||||||
|
{
|
||||||
|
int horizontalCorrection = targetClipRectangle.Left % (int)_zoomFactor.Numerator;
|
||||||
|
int verticalCorrection = targetClipRectangle.Top % (int)_zoomFactor.Numerator;
|
||||||
|
if (horizontalCorrection != 0)
|
||||||
|
{
|
||||||
|
targetClipRectangle.X -= horizontalCorrection;
|
||||||
|
targetClipRectangle.Width += horizontalCorrection;
|
||||||
|
}
|
||||||
|
if (verticalCorrection != 0)
|
||||||
|
{
|
||||||
|
targetClipRectangle.Y -= verticalCorrection;
|
||||||
|
targetClipRectangle.Height += verticalCorrection;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle imageClipRectangle = ZoomClipRectangle(targetClipRectangle, _zoomFactor.Inverse(), 2);
|
Rectangle imageClipRectangle = ZoomClipRectangle(targetClipRectangle, _zoomFactor.Inverse(), 2);
|
||||||
|
|
||||||
bool isZoomedIn = _zoomFactor > Fraction.Identity;
|
bool isZoomedIn = _zoomFactor > Fraction.Identity;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue