[longomatch] Add support for empty roi's in canvases



commit 579a03b84a107338a107318b553baba71b8df43d
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Thu Apr 23 13:39:12 2015 +0200

    Add support for empty roi's in canvases

 LongoMatch.Core/Common/Area.cs |    7 +++++++
 LongoMatch.Drawing/Canvas.cs   |    2 +-
 2 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/LongoMatch.Core/Common/Area.cs b/LongoMatch.Core/Common/Area.cs
index 4799aad..07023d4 100644
--- a/LongoMatch.Core/Common/Area.cs
+++ b/LongoMatch.Core/Common/Area.cs
@@ -45,6 +45,13 @@ namespace LongoMatch.Core.Common
                        Height = height;
                }
 
+               public bool Empty {
+                       get {
+                               return Start.X == 0 && Start.Y == 0 &&
+                               Width == 0 && Height == 0;
+                       }
+               }
+
                [JsonProperty]
                public Point Start {
                        get;
diff --git a/LongoMatch.Drawing/Canvas.cs b/LongoMatch.Drawing/Canvas.cs
index c629587..189dda3 100644
--- a/LongoMatch.Drawing/Canvas.cs
+++ b/LongoMatch.Drawing/Canvas.cs
@@ -685,7 +685,7 @@ namespace LongoMatch.Drawing
                                Translation = translation;
 
                                /* If there is a region of interest set, combine the transformation */
-                               if (RegionOfInterest != null) {
+                               if (RegionOfInterest != null && !RegionOfInterest.Empty) {
                                        ScaleX *= background.Width / RegionOfInterest.Width;
                                        ScaleY *= background.Height / RegionOfInterest.Height;
                                        Translation -= new Point (RegionOfInterest.Start.X * ScaleX,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]