diff Framework/Radiography/RadiographyAlphaLayer.cpp @ 1201:ab958fd99b07

RadiographyScene fixes
author Alain Mazy <alain@mazy.be>
date Fri, 29 Nov 2019 16:21:24 +0100
parents a5f2a6b04a31
children 355dba5352d7
line wrap: on
line diff
--- a/Framework/Radiography/RadiographyAlphaLayer.cpp	Thu Nov 28 18:28:15 2019 +0100
+++ b/Framework/Radiography/RadiographyAlphaLayer.cpp	Fri Nov 29 16:21:24 2019 +0100
@@ -79,15 +79,19 @@
 
     Orthanc::Image tmp(Orthanc::PixelFormat_Grayscale8, buffer.GetWidth(), buffer.GetHeight(), false);
 
-    t.Apply(tmp, cropped, interpolation, true /* clear */);
+    unsigned int x1, y1, x2, y2;
 
-    unsigned int x1, y1, x2, y2;
-    OrthancStone::GetProjectiveTransformExtent(x1, y1, x2, y2,
-                                               t.GetHomogeneousMatrix(),
-                                               cropped.GetWidth(),
-                                               cropped.GetHeight(),
-                                               buffer.GetWidth(),
-                                               buffer.GetHeight());
+    if (!OrthancStone::GetProjectiveTransformExtent(x1, y1, x2, y2,
+                                                    t.GetHomogeneousMatrix(),
+                                                    cropped.GetWidth(),
+                                                    cropped.GetHeight(),
+                                                    buffer.GetWidth(),
+                                                    buffer.GetHeight()))
+    {
+      return;  // layer is outside the buffer
+    }
+
+    t.Apply(tmp, cropped, interpolation, true /* clear */);
 
     float value = foreground_;