mirror of
https://github.com/godotengine/godot.git
synced 2025-01-30 21:33:18 +08:00
d840165a32
- `etc` module was renamed to `etcpak` and modified to use the new library. - PKM importer is removed in the process, it's obsolete. - Old library `etc2comp` is removed. - S3TC compression no longer done via `squish` (but decompression still is). - Slight modifications to etcpak sources for MinGW compatibility, to fix LLVM `-Wc++11-narrowing` errors, and to allow using vendored or system libpng. Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
51 lines
1.0 KiB
C++
51 lines
1.0 KiB
C++
#ifndef __DARKRL__BITMAP_HPP__
|
|
#define __DARKRL__BITMAP_HPP__
|
|
|
|
#include <future>
|
|
#include <memory>
|
|
#include <mutex>
|
|
#include <stdint.h>
|
|
|
|
#include "Semaphore.hpp"
|
|
#include "Vector.hpp"
|
|
|
|
enum class Channels
|
|
{
|
|
RGB,
|
|
Alpha
|
|
};
|
|
|
|
class Bitmap
|
|
{
|
|
public:
|
|
Bitmap( const char* fn, unsigned int lines, bool bgr );
|
|
Bitmap( const v2i& size );
|
|
virtual ~Bitmap();
|
|
|
|
void Write( const char* fn );
|
|
|
|
uint32_t* Data() { if( m_load.valid() ) m_load.wait(); return m_data; }
|
|
const uint32_t* Data() const { if( m_load.valid() ) m_load.wait(); return m_data; }
|
|
const v2i& Size() const { return m_size; }
|
|
bool Alpha() const { return m_alpha; }
|
|
|
|
const uint32_t* NextBlock( unsigned int& lines, bool& done );
|
|
|
|
protected:
|
|
Bitmap( const Bitmap& src, unsigned int lines );
|
|
|
|
uint32_t* m_data;
|
|
uint32_t* m_block;
|
|
unsigned int m_lines;
|
|
unsigned int m_linesLeft;
|
|
v2i m_size;
|
|
bool m_alpha;
|
|
Semaphore m_sema;
|
|
std::mutex m_lock;
|
|
std::future<void> m_load;
|
|
};
|
|
|
|
typedef std::shared_ptr<Bitmap> BitmapPtr;
|
|
|
|
#endif
|