mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 20:11:50 +00:00
memory refactor Texture and ImageData
This commit is contained in:
parent
ce9c5b97c7
commit
c0dca31e98
14 changed files with 191 additions and 160 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue