diff Framework/Viewport/CairoSurface.cpp @ 316:ce48c3b3b0e9

fix for new ImageAccessor API
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 08 Oct 2018 12:45:27 +0200
parents 5412adf19980
children 557c8ff1db5c
line wrap: on
line diff
--- a/Framework/Viewport/CairoSurface.cpp	Mon Oct 01 10:46:26 2018 +0200
+++ b/Framework/Viewport/CairoSurface.cpp	Mon Oct 08 12:45:27 2018 +0200
@@ -105,24 +105,22 @@
 
   void CairoSurface::Copy(const CairoSurface& other)
   {
-    Orthanc::ImageAccessor source = other.GetConstAccessor();
-    Orthanc::ImageAccessor target = GetAccessor();
+    Orthanc::ImageAccessor source, target;
+    other.GetReadOnlyAccessor(source);
+    GetWriteableAccessor(target);
+
     Orthanc::ImageProcessing::Copy(target, source);
   }
 
 
-  Orthanc::ImageAccessor CairoSurface::GetConstAccessor() const
+  void CairoSurface::GetReadOnlyAccessor(Orthanc::ImageAccessor& target) const
   {
-    Orthanc::ImageAccessor accessor;
-    accessor.AssignReadOnly(Orthanc::PixelFormat_BGRA32, width_, height_, pitch_, buffer_);
-    return accessor;
+    target.AssignReadOnly(Orthanc::PixelFormat_BGRA32, width_, height_, pitch_, buffer_);
   }
+  
 
-
-  Orthanc::ImageAccessor CairoSurface::GetAccessor()
+  void CairoSurface::GetWriteableAccessor(Orthanc::ImageAccessor& target)
   {
-    Orthanc::ImageAccessor accessor;
-    accessor.AssignWritable(Orthanc::PixelFormat_BGRA32, width_, height_, pitch_, buffer_);
-    return accessor;
+    target.AssignWritable(Orthanc::PixelFormat_BGRA32, width_, height_, pitch_, buffer_);
   }
 }