diff --git a/Greenshot/Drawing/CursorContainer.cs b/Greenshot/Drawing/CursorContainer.cs
index 3d5c0fdb6..1c6338e9e 100644
--- a/Greenshot/Drawing/CursorContainer.cs
+++ b/Greenshot/Drawing/CursorContainer.cs
@@ -56,12 +56,11 @@ namespace Greenshot.Drawing {
get { return cursor; }
}
- // The bulk of the clean-up code is implemented in Dispose(bool)
-
- /**
- * This Dispose is called from the Dispose and the Destructor.
- * When disposing==true all non-managed resources should be freed too!
- */
+ ///
+ /// This Dispose is called from the Dispose and the Destructor.
+ /// When disposing==true all non-managed resources should be freed too!
+ ///
+ ///
protected override void Dispose(bool disposing) {
if (disposing) {
if (cursor != null) {
diff --git a/GreenshotPlugin/Core/FastBitmap.cs b/GreenshotPlugin/Core/FastBitmap.cs
index ec80b1906..7257d2172 100644
--- a/GreenshotPlugin/Core/FastBitmap.cs
+++ b/GreenshotPlugin/Core/FastBitmap.cs
@@ -128,6 +128,14 @@ namespace GreenshotPlugin.Core {
/// Graphics
/// Rectangle with destination
void DrawTo(Graphics graphics, Rectangle destinationRect);
+
+ ///
+ /// Return true if the coordinates are inside the FastBitmap
+ ///
+ ///
+ ///
+ ///
+ bool Contains(int x, int y);
}
///
@@ -416,6 +424,16 @@ namespace GreenshotPlugin.Core {
}
}
+ ///
+ /// returns true if x & y are inside the FastBitmap
+ ///
+ ///
+ ///
+ /// true if x & y are inside the FastBitmap
+ public bool Contains(int x, int y) {
+ return x >= 0 && x < Width && y >= 0 && y < Height;
+ }
+
public abstract Color GetColorAt(int x, int y);
public abstract void SetColorAt(int x, int y, Color color);
public abstract void GetColorAt(int x, int y, byte[] color);
diff --git a/GreenshotPlugin/Core/ImageHelper.cs b/GreenshotPlugin/Core/ImageHelper.cs
index a7cde338c..d0bd35ed3 100644
--- a/GreenshotPlugin/Core/ImageHelper.cs
+++ b/GreenshotPlugin/Core/ImageHelper.cs
@@ -1197,6 +1197,8 @@ namespace GreenshotPlugin.Core {
// Make sure the source is not Rectangle.Empty
if (Rectangle.Empty.Equals(sourceRect)) {
sourceRect = new Rectangle(0, 0, sourceImage.Width, sourceImage.Height);
+ } else {
+ sourceRect.Intersect(bitmapRect);
}
// If no pixelformat is supplied
diff --git a/GreenshotPlugin/UnmanagedHelpers/GDIplus.cs b/GreenshotPlugin/UnmanagedHelpers/GDIplus.cs
index 8aa8b8270..0586992b9 100644
--- a/GreenshotPlugin/UnmanagedHelpers/GDIplus.cs
+++ b/GreenshotPlugin/UnmanagedHelpers/GDIplus.cs
@@ -165,7 +165,7 @@ namespace GreenshotPlugin.UnmanagedHelpers {
return (IntPtr)FIELD_INFO_NATIVE_IMAGEATTRIBUTES.GetValue(imageAttributes);
}
- private static bool canApply(int radius) {
+ private static bool isBlurPossible(int radius) {
if (Environment.OSVersion.Version.Major < 6) {
return false;
} else if ((Environment.OSVersion.Version.Major >= 6 && Environment.OSVersion.Version.Minor >= 2) && radius < 20) {
@@ -183,8 +183,7 @@ namespace GreenshotPlugin.UnmanagedHelpers {
/// bool true if the edges are expanded with the radius
/// false if there is no GDI+ available or an exception occured
public static bool ApplyBlur(Bitmap destinationBitmap, Rectangle area, int radius, bool expandEdges) {
- if (!canApply(radius))
- {
+ if (!isBlurPossible(radius)) {
return false;
}
IntPtr hBlurParams = IntPtr.Zero;
@@ -238,8 +237,7 @@ namespace GreenshotPlugin.UnmanagedHelpers {
///
/// false if there is no GDI+ available or an exception occured
public static bool DrawWithBlur(Graphics graphics, Bitmap image, Rectangle source, Matrix transform, ImageAttributes imageAttributes, int radius, bool expandEdges) {
- if (!canApply(radius))
- {
+ if (!isBlurPossible(radius)) {
return false;
}
@@ -279,7 +277,7 @@ namespace GreenshotPlugin.UnmanagedHelpers {
// Everything worked, return true
return true;
} catch (Exception ex) {
- LOG.Error("Problem using GdipBitmapApplyEffect: ", ex);
+ LOG.Error("Problem using GdipDrawImageFX: ", ex);
return false;
} finally {
if (hEffect != null) {