comparison Core/Images/Font.cpp @ 3712:2a170a8f1faf

replacing std::auto_ptr by std::unique_ptr
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 02 Mar 2020 15:32:45 +0100
parents 94f4a18a79cc
children 058b5ade8acd
comparison
equal deleted inserted replaced
3709:1f4910999fe7 3712:2a170a8f1faf
101 info["Width"].type() != Json::intValue) 101 info["Width"].type() != Json::intValue)
102 { 102 {
103 throw OrthancException(ErrorCode_BadFont); 103 throw OrthancException(ErrorCode_BadFont);
104 } 104 }
105 105
106 std::auto_ptr<Character> c(new Character); 106 std::unique_ptr<Character> c(new Character);
107 107
108 c->advance_ = info["Advance"].asUInt(); 108 c->advance_ = info["Advance"].asUInt();
109 c->height_ = info["Height"].asUInt(); 109 c->height_ = info["Height"].asUInt();
110 c->top_ = info["Top"].asUInt(); 110 c->top_ = info["Top"].asUInt();
111 c->width_ = info["Width"].asUInt(); 111 c->width_ = info["Width"].asUInt();
405 uint8_t b) const 405 uint8_t b) const
406 { 406 {
407 unsigned int width, height; 407 unsigned int width, height;
408 ComputeTextExtent(width, height, utf8); 408 ComputeTextExtent(width, height, utf8);
409 409
410 std::auto_ptr<ImageAccessor> target(new Image(format, width, height, false)); 410 std::unique_ptr<ImageAccessor> target(new Image(format, width, height, false));
411 ImageProcessing::Set(*target, 0, 0, 0, 255); 411 ImageProcessing::Set(*target, 0, 0, 0, 255);
412 Draw(*target, utf8, 0, 0, r, g, b); 412 Draw(*target, utf8, 0, 0, r, g, b);
413 413
414 return target.release(); 414 return target.release();
415 } 415 }
418 ImageAccessor* Font::RenderAlpha(const std::string& utf8) const 418 ImageAccessor* Font::RenderAlpha(const std::string& utf8) const
419 { 419 {
420 unsigned int width, height; 420 unsigned int width, height;
421 ComputeTextExtent(width, height, utf8); 421 ComputeTextExtent(width, height, utf8);
422 422
423 std::auto_ptr<ImageAccessor> target(new Image(PixelFormat_Grayscale8, width, height, false)); 423 std::unique_ptr<ImageAccessor> target(new Image(PixelFormat_Grayscale8, width, height, false));
424 ImageProcessing::Set(*target, 0); 424 ImageProcessing::Set(*target, 0);
425 Draw(*target, utf8, 0, 0, 255); 425 Draw(*target, utf8, 0, 0, 255);
426 426
427 return target.release(); 427 return target.release();
428 } 428 }