[core] mbgl::Image is now movable, noncopyable

This commit is contained in:
Bruno de Oliveira Abinader
2016-06-07 16:04:03 +03:00
parent 680fcd09b1
commit 4294b0f83a

View File

@@ -1,5 +1,7 @@
#pragma once
#include <mbgl/util/noncopyable.hpp>
#include <string>
#include <memory>
#include <algorithm>
@@ -12,7 +14,7 @@ enum ImageAlphaMode {
};
template <ImageAlphaMode Mode>
class Image {
class Image : private util::noncopyable {
public:
Image() = default;
@@ -26,6 +28,18 @@ public:
height(h),
data(std::move(data_)) {}
Image(Image&& o)
: width(o.width),
height(o.height),
data(std::move(o.data)) {}
Image& operator=(Image&& o) {
width = o.width;
height = o.height;
data = std::move(o.data);
return *this;
}
bool operator==(const Image& rhs) const {
return width == rhs.width && height == rhs.height &&
std::equal(data.get(), data.get() + size(), rhs.data.get(),