comparison Framework/Deprecated/Toolbox/MessagingToolbox.cpp @ 1298:8a0a62189f46

replacing std::auto_ptr by std::unique_ptr
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 02 Mar 2020 16:31:30 +0100
parents 2d8ab34c8c91
children 3d26447ddd28
comparison
equal deleted inserted replaced
1296:86400fa16091 1298:8a0a62189f46
249 249
250 default: 250 default:
251 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); 251 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
252 } 252 }
253 253
254 std::auto_ptr<Orthanc::PngReader> result(new Orthanc::PngReader); 254 std::unique_ptr<Orthanc::PngReader> result(new Orthanc::PngReader);
255 result->ReadFromMemory(compressed); 255 result->ReadFromMemory(compressed);
256 256
257 if (targetFormat == Orthanc::PixelFormat_SignedGrayscale16) 257 if (targetFormat == Orthanc::PixelFormat_SignedGrayscale16)
258 { 258 {
259 if (result->GetFormat() == Orthanc::PixelFormat_Grayscale16) 259 if (result->GetFormat() == Orthanc::PixelFormat_Grayscale16)
326 } 326 }
327 327
328 std::string jpeg; 328 std::string jpeg;
329 Orthanc::Toolbox::DecodeBase64(jpeg, info["PixelData"].asString()); 329 Orthanc::Toolbox::DecodeBase64(jpeg, info["PixelData"].asString());
330 330
331 std::auto_ptr<Orthanc::JpegReader> reader(new Orthanc::JpegReader); 331 std::unique_ptr<Orthanc::JpegReader> reader(new Orthanc::JpegReader);
332 reader->ReadFromMemory(jpeg); 332 reader->ReadFromMemory(jpeg);
333 333
334 if (reader->GetFormat() == Orthanc::PixelFormat_RGB24) // This is a color image 334 if (reader->GetFormat() == Orthanc::PixelFormat_RGB24) // This is a color image
335 { 335 {
336 if (targetFormat != Orthanc::PixelFormat_RGB24) 336 if (targetFormat != Orthanc::PixelFormat_RGB24)
384 // This range cannot be represented with a uint16_t or an int16_t 384 // This range cannot be represented with a uint16_t or an int16_t
385 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented); 385 throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
386 } 386 }
387 387
388 // Decode a grayscale JPEG 8bpp image coming from the Web viewer 388 // Decode a grayscale JPEG 8bpp image coming from the Web viewer
389 std::auto_ptr<Orthanc::ImageAccessor> image 389 std::unique_ptr<Orthanc::ImageAccessor> image
390 (new Orthanc::Image(targetFormat, reader->GetWidth(), reader->GetHeight(), false)); 390 (new Orthanc::Image(targetFormat, reader->GetWidth(), reader->GetHeight(), false));
391 391
392 float scaling = static_cast<float>(stretchHigh - stretchLow) / 255.0f; 392 float scaling = static_cast<float>(stretchHigh - stretchLow) / 255.0f;
393 float offset = static_cast<float>(stretchLow) / scaling; 393 float offset = static_cast<float>(stretchLow) / scaling;
394 394