No ScaleTransform is needed at 100% zoom

This commit is contained in:
Killy 2020-05-01 18:53:08 +03:00
commit b2a6fc8774

View file

@ -1489,12 +1489,14 @@ namespace Greenshot.Drawing
graphics.SetClip(ZoomClipRectangle(Rectangle.Round(targetGraphics.ClipBounds), _zoomFactor.Inverse(), 2)); graphics.SetClip(ZoomClipRectangle(Rectangle.Round(targetGraphics.ClipBounds), _zoomFactor.Inverse(), 2));
_elements.Draw(graphics, _buffer, RenderMode.EDIT, imageClipRectangle); _elements.Draw(graphics, _buffer, RenderMode.EDIT, imageClipRectangle);
} }
targetGraphics.ScaleTransform(_zoomFactor, _zoomFactor);
if (_zoomFactor == Fraction.Identity) if (_zoomFactor == Fraction.Identity)
{ {
targetGraphics.DrawImage(_buffer, imageClipRectangle, imageClipRectangle, GraphicsUnit.Pixel); targetGraphics.DrawImage(_buffer, imageClipRectangle, imageClipRectangle, GraphicsUnit.Pixel);
} }
else if(_zoomFactor > Fraction.Identity) else
{
targetGraphics.ScaleTransform(_zoomFactor, _zoomFactor);
if (_zoomFactor > Fraction.Identity)
{ {
DrawSharpImage(targetGraphics, _buffer, imageClipRectangle); DrawSharpImage(targetGraphics, _buffer, imageClipRectangle);
} }
@ -1504,22 +1506,23 @@ namespace Greenshot.Drawing
} }
targetGraphics.ResetTransform(); targetGraphics.ResetTransform();
} }
}
else else
{ {
DrawBackground(targetGraphics, targetClipRectangle); DrawBackground(targetGraphics, targetClipRectangle);
targetGraphics.ScaleTransform(_zoomFactor, _zoomFactor);
if (_zoomFactor == Fraction.Identity) if (_zoomFactor == Fraction.Identity)
{ {
targetGraphics.DrawImage(Image, imageClipRectangle, imageClipRectangle, GraphicsUnit.Pixel); targetGraphics.DrawImage(Image, imageClipRectangle, imageClipRectangle, GraphicsUnit.Pixel);
_elements.Draw(targetGraphics, null, RenderMode.EDIT, imageClipRectangle);
} }
else else
{ {
targetGraphics.ScaleTransform(_zoomFactor, _zoomFactor);
DrawSmoothImage(targetGraphics, Image, imageClipRectangle); DrawSmoothImage(targetGraphics, Image, imageClipRectangle);
}
_elements.Draw(targetGraphics, null, RenderMode.EDIT, imageClipRectangle); _elements.Draw(targetGraphics, null, RenderMode.EDIT, imageClipRectangle);
targetGraphics.ResetTransform(); targetGraphics.ResetTransform();
} }
}
// No clipping for the adorners // No clipping for the adorners
targetGraphics.ResetClip(); targetGraphics.ResetClip();