diff Core/Images/ImageAccessor.cpp @ 2861:9b4251721f22

ImageAccessor now non-copyable
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 05 Oct 2018 17:46:02 +0200
parents 89b789366596
children 0f07bdae0805
line wrap: on
line diff
--- a/Core/Images/ImageAccessor.cpp	Wed Oct 03 16:13:19 2018 +0200
+++ b/Core/Images/ImageAccessor.cpp	Fri Oct 05 17:46:02 2018 +0200
@@ -247,10 +247,11 @@
 
 
 
-  ImageAccessor ImageAccessor::GetRegion(unsigned int x,
-                                         unsigned int y,
-                                         unsigned int width,
-                                         unsigned int height) const
+  void ImageAccessor::GetRegion(ImageAccessor& accessor,
+                                unsigned int x,
+                                unsigned int y,
+                                unsigned int width,
+                                unsigned int height) const
   {
     if (x + width > width_ ||
         y + height > height_)
@@ -258,12 +259,10 @@
       throw OrthancException(ErrorCode_ParameterOutOfRange);
     }
     
-    ImageAccessor result;
-
     if (width == 0 ||
         height == 0)
     {
-      result.AssignWritable(format_, 0, 0, 0, NULL);
+      accessor.AssignWritable(format_, 0, 0, 0, NULL);
     }
     else
     {
@@ -273,15 +272,13 @@
 
       if (readOnly_)
       {
-        result.AssignReadOnly(format_, width, height, pitch_, p);
+        accessor.AssignReadOnly(format_, width, height, pitch_, p);
       }
       else
       {
-        result.AssignWritable(format_, width, height, pitch_, p);
+        accessor.AssignWritable(format_, width, height, pitch_, p);
       }
     }
-
-    return result;
   }