aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-03-18 20:20:47 +1100
committerNeil <nyamatongwe@gmail.com>2021-03-18 20:20:47 +1100
commit088336e91cb2771acd435bcd4646373420f62484 (patch)
tree863d4eb386245ca5fe200fb5f2abb0140ca3ad15 /src
parent6af47b53d52c29474bfc551700f8394dbf1dbc04 (diff)
downloadscintilla-mirror-088336e91cb2771acd435bcd4646373420f62484.tar.gz
Use unique_ptr to add to RGBAImageSet.
Diffstat (limited to 'src')
-rw-r--r--src/XPM.cxx9
-rw-r--r--src/XPM.h2
2 files changed, 3 insertions, 8 deletions
diff --git a/src/XPM.cxx b/src/XPM.cxx
index cfe6d94af..c310911f6 100644
--- a/src/XPM.cxx
+++ b/src/XPM.cxx
@@ -297,13 +297,8 @@ void RGBAImageSet::Clear() noexcept {
}
/// Add an image.
-void RGBAImageSet::Add(int ident, RGBAImage *image) {
- ImageMap::iterator it=images.find(ident);
- if (it == images.end()) {
- images[ident] = std::unique_ptr<RGBAImage>(image);
- } else {
- it->second.reset(image);
- }
+void RGBAImageSet::AddImage(int ident, std::unique_ptr<RGBAImage> image) {
+ images[ident] = std::move(image);
height = -1;
width = -1;
}
diff --git a/src/XPM.h b/src/XPM.h
index 1f72ba738..cacae9b8a 100644
--- a/src/XPM.h
+++ b/src/XPM.h
@@ -88,7 +88,7 @@ public:
/// Remove all images.
void Clear() noexcept;
/// Add an image.
- void Add(int ident, RGBAImage *image);
+ void AddImage(int ident, std::unique_ptr<RGBAImage> image);
/// Get image by id.
RGBAImage *Get(int ident);
/// Give the largest height of the set.