memory refactor Texture and ImageData
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "../../typedefs.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
enum class ImageFormat {
|
||||
rgb888,
|
||||
rgba8888
|
||||
@@ -12,10 +14,11 @@ class ImageData {
|
||||
ImageFormat format;
|
||||
uint width;
|
||||
uint height;
|
||||
void* data;
|
||||
std::unique_ptr<ubyte[]> data;
|
||||
public:
|
||||
ImageData(ImageFormat format, uint width, uint height);
|
||||
ImageData(ImageFormat format, uint width, uint height, void* data);
|
||||
ImageData(ImageFormat format, uint width, uint height, std::unique_ptr<ubyte[]> data);
|
||||
ImageData(ImageFormat format, uint width, uint height, const ubyte* data);
|
||||
~ImageData();
|
||||
|
||||
void flipX();
|
||||
@@ -27,8 +30,8 @@ public:
|
||||
void extrude(int x, int y, int w, int h);
|
||||
void fixAlphaColor();
|
||||
|
||||
void* getData() const {
|
||||
return data;
|
||||
ubyte* getData() const {
|
||||
return data.get();
|
||||
}
|
||||
|
||||
ImageFormat getFormat() const {
|
||||
|
||||
Reference in New Issue
Block a user