mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
Disposing matrix in the new code, otherwise it would cause memory leaks
This commit is contained in:
parent
4d6bf9f1ad
commit
4b8ec88aaf
3 changed files with 10 additions and 4 deletions
|
@ -148,9 +148,10 @@ namespace Greenshot.Drawing {
|
||||||
state = graphics.Save();
|
state = graphics.Save();
|
||||||
// Draw bubble where the Tail is not visible.
|
// Draw bubble where the Tail is not visible.
|
||||||
using (Region clipRegion = new Region(tail)) {
|
using (Region clipRegion = new Region(tail)) {
|
||||||
Matrix transformMatrix = new Matrix();
|
using (Matrix transformMatrix = new Matrix()) {
|
||||||
transformMatrix.Rotate(tailAngle);
|
transformMatrix.Rotate(tailAngle);
|
||||||
clipRegion.Transform(transformMatrix);
|
clipRegion.Transform(transformMatrix);
|
||||||
|
}
|
||||||
clipRegion.Translate(rect.Left + (rect.Width / 2), rect.Top + (rect.Height / 2));
|
clipRegion.Translate(rect.Left + (rect.Width / 2), rect.Top + (rect.Height / 2));
|
||||||
graphics.SetClip(clipRegion, CombineMode.Exclude);
|
graphics.SetClip(clipRegion, CombineMode.Exclude);
|
||||||
graphics.TranslateTransform(rect.Left, rect.Top);
|
graphics.TranslateTransform(rect.Left, rect.Top);
|
||||||
|
|
|
@ -879,6 +879,9 @@ namespace Greenshot.Drawing {
|
||||||
if (_surfaceSizeChanged != null && !imageRectangle.Equals(new Rectangle(Point.Empty, newImage.Size))) {
|
if (_surfaceSizeChanged != null && !imageRectangle.Equals(new Rectangle(Point.Empty, newImage.Size))) {
|
||||||
_surfaceSizeChanged(this, null);
|
_surfaceSizeChanged(this, null);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// clean up matrix, as it hasn't been used in the undo stack.
|
||||||
|
matrix.Dispose();
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
// Always close the background form
|
// Always close the background form
|
||||||
|
|
|
@ -303,7 +303,9 @@ namespace GreenshotPlugin.Core {
|
||||||
Image tmpImage;
|
Image tmpImage;
|
||||||
if (outputSettings.Effects != null && outputSettings.Effects.Count > 0) {
|
if (outputSettings.Effects != null && outputSettings.Effects.Count > 0) {
|
||||||
// apply effects, if there are any
|
// apply effects, if there are any
|
||||||
tmpImage = ImageHelper.ApplyEffects(imageToSave, outputSettings.Effects, new Matrix());
|
using (Matrix matrix = new Matrix()) {
|
||||||
|
tmpImage = ImageHelper.ApplyEffects(imageToSave, outputSettings.Effects, matrix);
|
||||||
|
}
|
||||||
if (tmpImage != null) {
|
if (tmpImage != null) {
|
||||||
if (disposeImage) {
|
if (disposeImage) {
|
||||||
imageToSave.Dispose();
|
imageToSave.Dispose();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue