Skip to content

Commit 03f0c7f

Browse files
committed
Replace use of new with make_unique
1 parent 6c886cf commit 03f0c7f

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/dio/aseprite_decoder.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ bool AsepriteDecoder::decode()
5959

6060
// Create the new sprite
6161
std::unique_ptr<doc::Sprite> sprite(
62-
new doc::Sprite(doc::ImageSpec(header.depth == 32 ? doc::ColorMode::RGB:
63-
header.depth == 16 ? doc::ColorMode::GRAYSCALE:
64-
doc::ColorMode::INDEXED,
65-
header.width,
66-
header.height),
67-
header.ncolors));
62+
std::make_unique<doc::Sprite>(doc::ImageSpec(header.depth == 32 ? doc::ColorMode::RGB:
63+
header.depth == 16 ? doc::ColorMode::GRAYSCALE:
64+
doc::ColorMode::INDEXED,
65+
header.width,
66+
header.height),
67+
header.ncolors));
6868

6969
// Set frames and speed
7070
sprite->setTotalFrames(doc::frame_t(header.frames));
@@ -784,7 +784,7 @@ doc::Cel* AsepriteDecoder::readCelChunk(doc::Sprite* sprite,
784784
break;
785785
}
786786

787-
cel.reset(new doc::Cel(frame, image));
787+
cel = std::make_unique<doc::Cel>(frame, image);
788788
cel->setPosition(x, y);
789789
cel->setOpacity(opacity);
790790
}
@@ -825,7 +825,7 @@ doc::Cel* AsepriteDecoder::readCelChunk(doc::Sprite* sprite,
825825
doc::ImageRef image(doc::Image::create(pixelFormat, w, h));
826826
read_compressed_image(f(), delegate(), image.get(), header, chunk_end);
827827

828-
cel.reset(new doc::Cel(frame, image));
828+
cel = std::make_unique<doc::Cel>(frame, image);
829829
cel->setPosition(x, y);
830830
cel->setOpacity(opacity);
831831
}
@@ -870,7 +870,7 @@ doc::Cel* AsepriteDecoder::readCelChunk(doc::Sprite* sprite,
870870
return doc::tile_geti(tile) >= tilesetSize ? doc::notile : tile;
871871
});
872872

873-
cel.reset(new doc::Cel(frame, image));
873+
cel = std::make_unique<doc::Cel>(frame, image);
874874
cel->setPosition(x, y);
875875
cel->setOpacity(opacity);
876876
}
@@ -1075,7 +1075,7 @@ doc::Slice* AsepriteDecoder::readSliceChunk(doc::Slices& slices)
10751075
read32(); // 4 bytes reserved
10761076
std::string name = readString(); // Name
10771077

1078-
std::unique_ptr<doc::Slice> slice(new doc::Slice);
1078+
std::unique_ptr<doc::Slice> slice(std::make_unique<doc::Slice>());
10791079
slice->setName(name);
10801080

10811081
// For each key

0 commit comments

Comments
 (0)