mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Stay zoomed when image doesn't fit in client area
This commit is contained in:
parent
992e462383
commit
778eec1188
1 changed files with 8 additions and 8 deletions
|
@ -791,14 +791,14 @@ protected override void OnPaint(PaintEventArgs e)
|
||||||
|
|
||||||
Graphics g = e.Graphics;
|
Graphics g = e.Graphics;
|
||||||
|
|
||||||
g.PixelOffsetMode = PixelOffsetMode.HighSpeed;
|
if (IsEditorMode)
|
||||||
g.InterpolationMode = InterpolationMode.NearestNeighbor;
|
|
||||||
|
|
||||||
if (IsEditorMode && !CanvasRectangle.Contains(ClientArea))
|
|
||||||
{
|
{
|
||||||
g.ScaleTransform(ZoomFactor, ZoomFactor);
|
g.ScaleTransform(ZoomFactor, ZoomFactor);
|
||||||
g.Clear(canvasBackgroundColor);
|
if (!CanvasRectangle.Contains(ClientArea))
|
||||||
g.DrawRectangleProper(canvasBorderPen, CanvasRectangle.Offset(1));
|
{
|
||||||
|
g.Clear(canvasBackgroundColor);
|
||||||
|
g.DrawRectangleProper(canvasBorderPen, CanvasRectangle.Offset(1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawBackground(g);
|
DrawBackground(g);
|
||||||
|
@ -820,8 +820,8 @@ protected override void OnPaint(PaintEventArgs e)
|
||||||
|
|
||||||
private void DrawBackground(Graphics g)
|
private void DrawBackground(Graphics g)
|
||||||
{
|
{
|
||||||
// TODO: dynamically adjust scaling quality when zoom != 1 based on FPS
|
// TODO: dynamically improved scaling quality when zoom != 1 if FPS is high
|
||||||
// Quality is more important when scaling down than up.
|
// especially when scaling down
|
||||||
g.PixelOffsetMode = PixelOffsetMode.HighSpeed;
|
g.PixelOffsetMode = PixelOffsetMode.HighSpeed;
|
||||||
g.InterpolationMode = InterpolationMode.NearestNeighbor;
|
g.InterpolationMode = InterpolationMode.NearestNeighbor;
|
||||||
g.SmoothingMode = SmoothingMode.HighSpeed;
|
g.SmoothingMode = SmoothingMode.HighSpeed;
|
||||||
|
|
Loading…
Reference in a new issue