comparison Plugins/Engine/OrthancPlugins.cpp @ 2107:88831c3edd8f

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 19 Oct 2016 17:22:09 +0200
parents 21a8ca9ad928
children a657f7772e69
comparison
equal deleted inserted replaced
2106:09cb73980740 2107:88831c3edd8f
1644 // Images returned to plugins are assumed to be writeable. If the 1644 // Images returned to plugins are assumed to be writeable. If the
1645 // input image is read-only, we return a copy so that it can be modified. 1645 // input image is read-only, we return a copy so that it can be modified.
1646 1646
1647 if (image->IsReadOnly()) 1647 if (image->IsReadOnly())
1648 { 1648 {
1649 std::auto_ptr<Image> copy(new Image(image->GetFormat(), image->GetWidth(), image->GetHeight())); 1649 std::auto_ptr<Image> copy(new Image(image->GetFormat(), image->GetWidth(), image->GetHeight(), false));
1650 ImageProcessing::Copy(*copy, *image); 1650 ImageProcessing::Copy(*copy, *image);
1651 image.reset(NULL); 1651 image.reset(NULL);
1652 return reinterpret_cast<OrthancPluginImage*>(copy.release()); 1652 return reinterpret_cast<OrthancPluginImage*>(copy.release());
1653 } 1653 }
1654 else 1654 else
1883 void OrthancPlugins::ConvertPixelFormat(const void* parameters) 1883 void OrthancPlugins::ConvertPixelFormat(const void* parameters)
1884 { 1884 {
1885 const _OrthancPluginConvertPixelFormat& p = *reinterpret_cast<const _OrthancPluginConvertPixelFormat*>(parameters); 1885 const _OrthancPluginConvertPixelFormat& p = *reinterpret_cast<const _OrthancPluginConvertPixelFormat*>(parameters);
1886 const ImageAccessor& source = *reinterpret_cast<const ImageAccessor*>(p.source); 1886 const ImageAccessor& source = *reinterpret_cast<const ImageAccessor*>(p.source);
1887 1887
1888 std::auto_ptr<ImageAccessor> target(new Image(Plugins::Convert(p.targetFormat), source.GetWidth(), source.GetHeight())); 1888 std::auto_ptr<ImageAccessor> target(new Image(Plugins::Convert(p.targetFormat), source.GetWidth(), source.GetHeight(), false));
1889 ImageProcessing::Convert(*target, source); 1889 ImageProcessing::Convert(*target, source);
1890 1890
1891 *(p.target) = ReturnImage(target); 1891 *(p.target) = ReturnImage(target);
1892 } 1892 }
1893 1893
2036 std::auto_ptr<ImageAccessor> result; 2036 std::auto_ptr<ImageAccessor> result;
2037 2037
2038 switch (service) 2038 switch (service)
2039 { 2039 {
2040 case _OrthancPluginService_CreateImage: 2040 case _OrthancPluginService_CreateImage:
2041 result.reset(new Image(Plugins::Convert(p.format), p.width, p.height)); 2041 result.reset(new Image(Plugins::Convert(p.format), p.width, p.height, false));
2042 break; 2042 break;
2043 2043
2044 case _OrthancPluginService_CreateImageAccessor: 2044 case _OrthancPluginService_CreateImageAccessor:
2045 result.reset(new ImageAccessor); 2045 result.reset(new ImageAccessor);
2046 result->AssignWritable(Plugins::Convert(p.format), p.width, p.height, p.pitch, p.buffer); 2046 result->AssignWritable(Plugins::Convert(p.format), p.width, p.height, p.pitch, p.buffer);