|
@@ -1,13 +1,15 @@
|
|
#pragma once
|
|
#pragma once
|
|
|
|
|
|
-#include "Assertions.h"
|
|
|
|
-#include "StdLibExtras.h"
|
|
|
|
-#include "Types.h"
|
|
|
|
-#include "kmalloc.h"
|
|
|
|
|
|
+#include <AK/Assertions.h>
|
|
|
|
+#include <AK/Noncopyable.h>
|
|
|
|
+#include <AK/StdLibExtras.h>
|
|
|
|
+#include <AK/Types.h>
|
|
|
|
+#include <AK/kmalloc.h>
|
|
|
|
|
|
namespace AK {
|
|
namespace AK {
|
|
|
|
|
|
class Bitmap {
|
|
class Bitmap {
|
|
|
|
+ AK_MAKE_NONCOPYABLE(Bitmap)
|
|
public:
|
|
public:
|
|
// NOTE: A wrapping Bitmap won't try to free the wrapped data.
|
|
// NOTE: A wrapping Bitmap won't try to free the wrapped data.
|
|
static Bitmap wrap(u8* data, int size)
|
|
static Bitmap wrap(u8* data, int size)
|
|
@@ -25,6 +27,25 @@ public:
|
|
return Bitmap();
|
|
return Bitmap();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ Bitmap(Bitmap&& other)
|
|
|
|
+ {
|
|
|
|
+ m_owned = exchange(other.m_owned, false);
|
|
|
|
+ m_data = exchange(other.m_data, nullptr);
|
|
|
|
+ m_size = exchange(other.m_size, 0);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Bitmap& operator=(Bitmap&& other)
|
|
|
|
+ {
|
|
|
|
+ if (this != &other) {
|
|
|
|
+ if (m_owned)
|
|
|
|
+ kfree(m_data);
|
|
|
|
+ m_owned = exchange(other.m_owned, false);
|
|
|
|
+ m_data = exchange(other.m_data, nullptr);
|
|
|
|
+ m_size = exchange(other.m_size, 0);
|
|
|
|
+ }
|
|
|
|
+ return *this;
|
|
|
|
+ }
|
|
|
|
+
|
|
~Bitmap()
|
|
~Bitmap()
|
|
{
|
|
{
|
|
if (m_owned)
|
|
if (m_owned)
|