comparison Framework/Viewport/CairoSurface.cpp @ 318:3a4ca166fafa am-2

ImageAccessor refactoring + implemented Image Cache in SmartLoader
author am@osimis.io
date Mon, 08 Oct 2018 17:10:08 +0200
parents 5412adf19980
children 557c8ff1db5c
comparison
equal deleted inserted replaced
317:b66d13708f40 318:3a4ca166fafa
103 } 103 }
104 104
105 105
106 void CairoSurface::Copy(const CairoSurface& other) 106 void CairoSurface::Copy(const CairoSurface& other)
107 { 107 {
108 Orthanc::ImageAccessor source = other.GetConstAccessor(); 108 Orthanc::ImageAccessor source, target;
109 Orthanc::ImageAccessor target = GetAccessor(); 109
110 other.GetConstAccessor(source);
111 GetAccessor(target);
112
110 Orthanc::ImageProcessing::Copy(target, source); 113 Orthanc::ImageProcessing::Copy(target, source);
111 } 114 }
112 115
113 116
114 Orthanc::ImageAccessor CairoSurface::GetConstAccessor() const 117 void CairoSurface::GetConstAccessor(Orthanc::ImageAccessor& target) const
115 { 118 {
116 Orthanc::ImageAccessor accessor; 119 target.AssignReadOnly(Orthanc::PixelFormat_BGRA32, width_, height_, pitch_, buffer_);
117 accessor.AssignReadOnly(Orthanc::PixelFormat_BGRA32, width_, height_, pitch_, buffer_);
118 return accessor;
119 } 120 }
120 121
121 122
122 Orthanc::ImageAccessor CairoSurface::GetAccessor() 123 void CairoSurface::GetAccessor(Orthanc::ImageAccessor& target)
123 { 124 {
124 Orthanc::ImageAccessor accessor; 125 target.AssignWritable(Orthanc::PixelFormat_BGRA32, width_, height_, pitch_, buffer_);
125 accessor.AssignWritable(Orthanc::PixelFormat_BGRA32, width_, height_, pitch_, buffer_);
126 return accessor;
127 } 126 }
128 } 127 }