aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.RemoteDesktop/Comparers/RasterBitmapComparer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/Tango.RemoteDesktop/Comparers/RasterBitmapComparer.cs')
-rw-r--r--Software/Visual_Studio/Tango.RemoteDesktop/Comparers/RasterBitmapComparer.cs15
1 files changed, 15 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.RemoteDesktop/Comparers/RasterBitmapComparer.cs b/Software/Visual_Studio/Tango.RemoteDesktop/Comparers/RasterBitmapComparer.cs
index b1b186065..7aa6a07a0 100644
--- a/Software/Visual_Studio/Tango.RemoteDesktop/Comparers/RasterBitmapComparer.cs
+++ b/Software/Visual_Studio/Tango.RemoteDesktop/Comparers/RasterBitmapComparer.cs
@@ -16,6 +16,12 @@ namespace Tango.RemoteDesktop.Comparers
public class RasterBitmapComparer : IBitmapComparer<RasterFrame>
{
/// <summary>
+ /// When max number of differences reached, the comparer will immediately return the current difference frame.
+ /// This should enforce the screen capture engine to report 'No Difference Available'.
+ /// </summary>
+ public long? MaxDifferencesThrow { get; set; }
+
+ /// <summary>
/// Creates the difference as <see cref="RasterFrame"/>.
/// </summary>
/// <param name="previousBitmap">The previous bitmap.</param>
@@ -94,6 +100,15 @@ namespace Tango.RemoteDesktop.Comparers
if (same != 4)
{
count++;
+
+ if (MaxDifferencesThrow != null && count > MaxDifferencesThrow.Value)
+ {
+ previousBitmap.UnlockBits(data1);
+ currentBitmap.UnlockBits(data2);
+ diffImage.UnlockBits(diffData);
+ diffImage.Dispose();
+ throw new MaxDifferencesReachedException();
+ }
}
}