Changed logic of the DWM capture which tries to keep the window to capture on it's location, so less movement is visible. Also added a BoxBlur which might be a faster replacement of the CreateBlur (which is Gaussian), but the quality needs to be checked. For the BoxBlur the BitmapBuffer is extended with a few new tricks.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2245 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-11-06 15:59:19 +00:00
parent 15d5bb58e4
commit f63d4ca06e
5 changed files with 200 additions and 25 deletions

View file

@ -776,32 +776,25 @@ namespace GreenshotPlugin.Core {
Size borderSize = new Size();
if (!Maximised) {
Screen displayScreen = null;
// Find the screen where the window is and check if it fits
foreach(Screen screen in Screen.AllScreens) {
if (screen.WorkingArea.Contains(windowRectangle)) {
displayScreen = screen;
break;
// Assume using it's own location
formLocation = windowRectangle.Location;
using (Region workingArea = new Region(Screen.PrimaryScreen.WorkingArea)) {
// Find the screen where the window is and check if it fits
foreach (Screen screen in Screen.AllScreens) {
workingArea.Union(screen.WorkingArea);
}
}
if (displayScreen == null) {
// If none found we find the biggest screen
foreach(Screen screen in Screen.AllScreens) {
if (displayScreen == null || (screen.Bounds.Width >= displayScreen.Bounds.Width && screen.Bounds.Height >= displayScreen.Bounds.Height)) {
displayScreen = screen;
// If the formLocation is not inside the visible area
if (!workingArea.AreRectangleCornersVisisble(windowRectangle)) {
// If none found we find the biggest screen
foreach (Screen screen in Screen.AllScreens) {
Rectangle newWindowRectangle = new Rectangle(screen.WorkingArea.Location, windowRectangle.Size);
if (workingArea.AreRectangleCornersVisisble(newWindowRectangle)) {
formLocation = screen.WorkingArea.Location;
break;
}
}
}
// check if the window will fit
if (displayScreen != null && displayScreen.Bounds.Contains(new Rectangle(Point.Empty, windowRectangle.Size))) {
formLocation = new Point(displayScreen.Bounds.X, displayScreen.Bounds.Y);
} else {
// No, just use the primary screen
formLocation = new Point(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y);
}
} else {
// The window actually fits, so while capturing create the copy over the original
formLocation = new Point(windowRectangle.X, windowRectangle.Y);
}
} else {
//GetClientRect(out windowRectangle);