Finishing performance improvement changes.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2105 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-09-28 11:21:05 +00:00
commit 336518f5f9

View file

@ -223,12 +223,14 @@ namespace Greenshot.Helpers {
break; break;
case CaptureMode.ActiveWindow: case CaptureMode.ActiveWindow:
if (CaptureActiveWindow()) { if (CaptureActiveWindow()) {
if (windowDetailsThread != null) { // TODO: Reactive / check if the elements code is activated
windowDetailsThread.Join(); //if (windowDetailsThread != null) {
} // windowDetailsThread.Join();
//}
//capture.MoveElements(capture.ScreenBounds.Location.X-capture.Location.X, capture.ScreenBounds.Location.Y-capture.Location.Y);
// Capture worked, offset mouse according to screen bounds and capture location // Capture worked, offset mouse according to screen bounds and capture location
capture.MoveMouseLocation(capture.ScreenBounds.Location.X-capture.Location.X, capture.ScreenBounds.Location.Y-capture.Location.Y); capture.MoveMouseLocation(capture.ScreenBounds.Location.X-capture.Location.X, capture.ScreenBounds.Location.Y-capture.Location.Y);
capture.MoveElements(capture.ScreenBounds.Location.X-capture.Location.X, capture.ScreenBounds.Location.Y-capture.Location.Y);
capture.CaptureDetails.AddMetaData("source", "Window"); capture.CaptureDetails.AddMetaData("source", "Window");
} else { } else {
captureMode = CaptureMode.FullScreen; captureMode = CaptureMode.FullScreen;
@ -354,9 +356,11 @@ namespace Greenshot.Helpers {
case CaptureMode.LastRegion: case CaptureMode.LastRegion:
if (!RuntimeConfig.LastCapturedRegion.IsEmpty) { if (!RuntimeConfig.LastCapturedRegion.IsEmpty) {
capture = WindowCapture.CaptureRectangle(capture, RuntimeConfig.LastCapturedRegion); capture = WindowCapture.CaptureRectangle(capture, RuntimeConfig.LastCapturedRegion);
if (windowDetailsThread != null) { // TODO: Reactive / check if the elements code is activated
windowDetailsThread.Join(); //if (windowDetailsThread != null) {
} // windowDetailsThread.Join();
//}
// Set capture title, fixing bug #3569703 // Set capture title, fixing bug #3569703
foreach (WindowDetails window in WindowDetails.GetVisibleWindows()) { foreach (WindowDetails window in WindowDetails.GetVisibleWindows()) {
Point estimatedLocation = new Point(RuntimeConfig.LastCapturedRegion.X + (RuntimeConfig.LastCapturedRegion.Width / 2), RuntimeConfig.LastCapturedRegion.Y + (RuntimeConfig.LastCapturedRegion.Height / 2)); Point estimatedLocation = new Point(RuntimeConfig.LastCapturedRegion.X + (RuntimeConfig.LastCapturedRegion.Width / 2), RuntimeConfig.LastCapturedRegion.Y + (RuntimeConfig.LastCapturedRegion.Height / 2));
@ -390,9 +394,10 @@ namespace Greenshot.Helpers {
LOG.Warn("Unknown capture mode: " + captureMode); LOG.Warn("Unknown capture mode: " + captureMode);
break; break;
} }
if (windowDetailsThread != null) { // TODO: Reactive / check if the elements code is activated
windowDetailsThread.Join(); //if (windowDetailsThread != null) {
} // windowDetailsThread.Join();
//}
if (capture != null) { if (capture != null) {
LOG.Debug("Disposing capture"); LOG.Debug("Disposing capture");
capture.Dispose(); capture.Dispose();
@ -822,9 +827,11 @@ namespace Greenshot.Helpers {
} }
if (captureRect.Height > 0 && captureRect.Width > 0) { if (captureRect.Height > 0 && captureRect.Width > 0) {
if (windowDetailsThread != null) { // TODO: Reactive / check if the elements code is activated
windowDetailsThread.Join(); //if (windowDetailsThread != null) {
} // windowDetailsThread.Join();
//}
// Take the captureRect, this already is specified as bitmap coordinates // Take the captureRect, this already is specified as bitmap coordinates
capture.Crop(captureRect); capture.Crop(captureRect);