Code review nitpicks

This commit is contained in:
Killy 2020-04-27 01:14:52 +03:00
commit 79742d1b4d
6 changed files with 10 additions and 10 deletions

View file

@ -1,4 +1,4 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
@ -119,7 +119,7 @@ namespace Greenshot.Drawing.Adorners
/// <summary> /// <summary>
/// Return the bounds of the Adorner as displayed on the parent Surface /// Return the bounds of the Adorner as displayed on the parent Surface
/// </summary> /// </summary>
protected virtual Rectangle SurfaceBounds protected virtual Rectangle BoundsOnSurface
{ {
get get
{ {

View file

@ -142,7 +142,7 @@ namespace Greenshot.Drawing.Adorners
{ {
Graphics targetGraphics = paintEventArgs.Graphics; Graphics targetGraphics = paintEventArgs.Graphics;
var bounds = SurfaceBounds; var bounds = BoundsOnSurface;
GraphicsState state = targetGraphics.Save(); GraphicsState state = targetGraphics.Save();
targetGraphics.SmoothingMode = SmoothingMode.None; targetGraphics.SmoothingMode = SmoothingMode.None;

View file

@ -169,7 +169,7 @@ namespace Greenshot.Drawing.Adorners
{ {
Graphics targetGraphics = paintEventArgs.Graphics; Graphics targetGraphics = paintEventArgs.Graphics;
var bounds = SurfaceBounds; var bounds = BoundsOnSurface;
GraphicsState state = targetGraphics.Save(); GraphicsState state = targetGraphics.Save();
targetGraphics.SmoothingMode = SmoothingMode.None; targetGraphics.SmoothingMode = SmoothingMode.None;

View file

@ -1,4 +1,4 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
@ -96,7 +96,7 @@ namespace Greenshot.Drawing.Adorners
{ {
Graphics targetGraphics = paintEventArgs.Graphics; Graphics targetGraphics = paintEventArgs.Graphics;
var bounds = SurfaceBounds; var bounds = BoundsOnSurface;
targetGraphics.FillRectangle(Brushes.Green, bounds.X, bounds.Y, bounds.Width, bounds.Height); targetGraphics.FillRectangle(Brushes.Green, bounds.X, bounds.Y, bounds.Width, bounds.Height);
} }

View file

@ -61,7 +61,7 @@ namespace Greenshot.Drawing {
if (_parent?.Image is Image image) { if (_parent?.Image is Image image) {
return new Rectangle(0, 0, image.Width, image.Height); return new Rectangle(0, 0, image.Width, image.Height);
} else { } else {
return new Rectangle(); return Rectangle.Empty;
} }
} }
} }

View file

@ -1,4 +1,4 @@
/* /*
* Greenshot - a free and open source screenshot tool * Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom * Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
* *
@ -1405,7 +1405,7 @@ namespace Greenshot.Drawing
return GetImage(RenderMode.EXPORT); return GetImage(RenderMode.EXPORT);
} }
private Rectangle ZoomClipRectangle(Rectangle rc, double scale) private static Rectangle ZoomClipRectangle(Rectangle rc, double scale)
=> new Rectangle( => new Rectangle(
(int)(rc.X * scale), (int)(rc.X * scale),
(int)(rc.Y * scale), (int)(rc.Y * scale),
@ -1413,7 +1413,7 @@ namespace Greenshot.Drawing
(int)((rc.Height + 1) * scale) + 1 (int)((rc.Height + 1) * scale) + 1
); );
private RectangleF ZoomClipRectangle(RectangleF rc, double scale) private static RectangleF ZoomClipRectangle(RectangleF rc, double scale)
=> new RectangleF( => new RectangleF(
(float)Math.Floor(rc.X * scale), (float)Math.Floor(rc.X * scale),
(float)Math.Floor(rc.Y * scale), (float)Math.Floor(rc.Y * scale),