diff OrthancStone/Sources/Toolbox/AffineTransform2D.cpp @ 1882:4e80b8afd0da

numpy in rendering plugin
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 Jan 2022 18:02:24 +0100
parents 7053b8a0aaec
children e8b9a2ba1df1
line wrap: on
line diff
--- a/OrthancStone/Sources/Toolbox/AffineTransform2D.cpp	Wed Jan 12 10:01:25 2022 +0100
+++ b/OrthancStone/Sources/Toolbox/AffineTransform2D.cpp	Wed Jan 12 18:02:24 2022 +0100
@@ -277,12 +277,20 @@
                                                   unsigned int width,
                                                   unsigned int height)
   {
-    AffineTransform2D t;
-    t.matrix_(0, 0) = (flipX ? -1 : 1);
-    t.matrix_(0, 2) = (flipX ? width : 0);
-    t.matrix_(1, 1) = (flipY ? -1 : 1);
-    t.matrix_(1, 2) = (flipY ? height : 0);
+    if (width == 0 ||
+        height == 0)
+    {
+      return AffineTransform2D();  // Identity
+    }
+    else
+    {
+      AffineTransform2D t;
+      t.matrix_(0, 0) = (flipX ? -1 : 1);
+      t.matrix_(0, 2) = (flipX ? width : 0);
+      t.matrix_(1, 1) = (flipY ? -1 : 1);
+      t.matrix_(1, 2) = (flipY ? height : 0);
 
-    return t;
+      return t;
+    }
   }
 }