indent classes, align by spaces

This commit is contained in:
Garux
2021-03-24 00:25:15 +03:00
parent 5b1b9b5e6c
commit 2222100316
450 changed files with 42485 additions and 42239 deletions

View File

@@ -52,57 +52,57 @@ typedef struct
class ReadPixel8
{
PaletteEntry* m_palette;
PaletteEntry* m_palette;
public:
ReadPixel8( PaletteEntry* palette ) : m_palette( palette ){
}
void operator()( PointerInputStream& inputStream, byte*& pixbuf ) const {
byte palIndex;
inputStream.read( &palIndex, 1 );
*pixbuf++ = m_palette[palIndex][2];
*pixbuf++ = m_palette[palIndex][1];
*pixbuf++ = m_palette[palIndex][0];
*pixbuf++ = 0xff;
}
ReadPixel8( PaletteEntry* palette ) : m_palette( palette ){
}
void operator()( PointerInputStream& inputStream, byte*& pixbuf ) const {
byte palIndex;
inputStream.read( &palIndex, 1 );
*pixbuf++ = m_palette[palIndex][2];
*pixbuf++ = m_palette[palIndex][1];
*pixbuf++ = m_palette[palIndex][0];
*pixbuf++ = 0xff;
}
};
class ReadPixel16
{
public:
void operator()( PointerInputStream& inputStream, byte*& pixbuf ) const {
unsigned short shortPixel;
inputStream.read( reinterpret_cast<byte*>( &shortPixel ), sizeof( unsigned short ) ); //!\todo Is this endian safe?
*pixbuf++ = static_cast<byte>( shortPixel & ( 31 << 10 ) ) >> 7;
*pixbuf++ = static_cast<byte>( shortPixel & ( 31 << 5 ) ) >> 2;
*pixbuf++ = static_cast<byte>( shortPixel & ( 31 ) ) << 3;
*pixbuf++ = 0xff;
}
void operator()( PointerInputStream& inputStream, byte*& pixbuf ) const {
unsigned short shortPixel;
inputStream.read( reinterpret_cast<byte*>( &shortPixel ), sizeof( unsigned short ) ); //!\todo Is this endian safe?
*pixbuf++ = static_cast<byte>( shortPixel & ( 31 << 10 ) ) >> 7;
*pixbuf++ = static_cast<byte>( shortPixel & ( 31 << 5 ) ) >> 2;
*pixbuf++ = static_cast<byte>( shortPixel & ( 31 ) ) << 3;
*pixbuf++ = 0xff;
}
};
class ReadPixel24
{
public:
void operator()( PointerInputStream& inputStream, byte*& pixbuf ) const {
byte bgr[3];
inputStream.read( bgr, 3 );
*pixbuf++ = bgr[2];
*pixbuf++ = bgr[1];
*pixbuf++ = bgr[0];
*pixbuf++ = 255;
}
void operator()( PointerInputStream& inputStream, byte*& pixbuf ) const {
byte bgr[3];
inputStream.read( bgr, 3 );
*pixbuf++ = bgr[2];
*pixbuf++ = bgr[1];
*pixbuf++ = bgr[0];
*pixbuf++ = 255;
}
};
class ReadPixel32
{
public:
void operator()( PointerInputStream& inputStream, byte*& pixbuf ) const {
byte bgra[4];
inputStream.read( bgra, 4 );
*pixbuf++ = bgra[2];
*pixbuf++ = bgra[1];
*pixbuf++ = bgra[0];
*pixbuf++ = bgra[3];
}
void operator()( PointerInputStream& inputStream, byte*& pixbuf ) const {
byte bgra[4];
inputStream.read( bgra, 4 );
*pixbuf++ = bgra[2];
*pixbuf++ = bgra[1];
*pixbuf++ = bgra[0];
*pixbuf++ = bgra[3];
}
};
template<typename ReadPixel>

View File

@@ -39,17 +39,17 @@ class ImageDependencies : public GlobalFileSystemModuleRef
class ImageTGAAPI
{
_QERPlugImageTable m_imagetga;
_QERPlugImageTable m_imagetga;
public:
typedef _QERPlugImageTable Type;
STRING_CONSTANT( Name, "tga" );
typedef _QERPlugImageTable Type;
STRING_CONSTANT( Name, "tga" );
ImageTGAAPI(){
m_imagetga.loadImage = LoadTGA;
}
_QERPlugImageTable* getTable(){
return &m_imagetga;
}
ImageTGAAPI(){
m_imagetga.loadImage = LoadTGA;
}
_QERPlugImageTable* getTable(){
return &m_imagetga;
}
};
typedef SingletonModule<ImageTGAAPI> ImageTGAModule;
@@ -59,17 +59,17 @@ ImageTGAModule g_ImageTGAModule;
class ImageJPGAPI
{
_QERPlugImageTable m_imagejpg;
_QERPlugImageTable m_imagejpg;
public:
typedef _QERPlugImageTable Type;
STRING_CONSTANT( Name, "jpg" );
typedef _QERPlugImageTable Type;
STRING_CONSTANT( Name, "jpg" );
ImageJPGAPI(){
m_imagejpg.loadImage = LoadJPG;
}
_QERPlugImageTable* getTable(){
return &m_imagejpg;
}
ImageJPGAPI(){
m_imagejpg.loadImage = LoadJPG;
}
_QERPlugImageTable* getTable(){
return &m_imagejpg;
}
};
typedef SingletonModule<ImageJPGAPI, ImageDependencies> ImageJPGModule;
@@ -79,17 +79,17 @@ ImageJPGModule g_ImageJPGModule;
class ImageBMPAPI
{
_QERPlugImageTable m_imagebmp;
_QERPlugImageTable m_imagebmp;
public:
typedef _QERPlugImageTable Type;
STRING_CONSTANT( Name, "bmp" );
typedef _QERPlugImageTable Type;
STRING_CONSTANT( Name, "bmp" );
ImageBMPAPI(){
m_imagebmp.loadImage = LoadBMP;
}
_QERPlugImageTable* getTable(){
return &m_imagebmp;
}
ImageBMPAPI(){
m_imagebmp.loadImage = LoadBMP;
}
_QERPlugImageTable* getTable(){
return &m_imagebmp;
}
};
typedef SingletonModule<ImageBMPAPI, ImageDependencies> ImageBMPModule;
@@ -99,17 +99,17 @@ ImageBMPModule g_ImageBMPModule;
class ImagePCXAPI
{
_QERPlugImageTable m_imagepcx;
_QERPlugImageTable m_imagepcx;
public:
typedef _QERPlugImageTable Type;
STRING_CONSTANT( Name, "pcx" );
typedef _QERPlugImageTable Type;
STRING_CONSTANT( Name, "pcx" );
ImagePCXAPI(){
m_imagepcx.loadImage = LoadPCX32;
}
_QERPlugImageTable* getTable(){
return &m_imagepcx;
}
ImagePCXAPI(){
m_imagepcx.loadImage = LoadPCX32;
}
_QERPlugImageTable* getTable(){
return &m_imagepcx;
}
};
typedef SingletonModule<ImagePCXAPI, ImageDependencies> ImagePCXModule;
@@ -119,17 +119,17 @@ ImagePCXModule g_ImagePCXModule;
class ImageDDSAPI
{
_QERPlugImageTable m_imagedds;
_QERPlugImageTable m_imagedds;
public:
typedef _QERPlugImageTable Type;
STRING_CONSTANT( Name, "dds" );
typedef _QERPlugImageTable Type;
STRING_CONSTANT( Name, "dds" );
ImageDDSAPI(){
m_imagedds.loadImage = LoadDDS;
}
_QERPlugImageTable* getTable(){
return &m_imagedds;
}
ImageDDSAPI(){
m_imagedds.loadImage = LoadDDS;
}
_QERPlugImageTable* getTable(){
return &m_imagedds;
}
};
typedef SingletonModule<ImageDDSAPI, ImageDependencies> ImageDDSModule;

View File

@@ -226,12 +226,12 @@ static void jpeg_buffer_src( j_decompress_ptr cinfo, void* buffer, int bufsize )
*/
if ( cinfo->src == NULL ) { /* first time for this JPEG object? */
cinfo->src = (struct jpeg_source_mgr *)
( *cinfo->mem->alloc_small )( (j_common_ptr) cinfo, JPOOL_PERMANENT,
sizeof( my_source_mgr ) );
( *cinfo->mem->alloc_small )( (j_common_ptr) cinfo, JPOOL_PERMANENT,
sizeof( my_source_mgr ) );
src = (my_src_ptr) cinfo->src;
src->buffer = (JOCTET *)
( *cinfo->mem->alloc_small )( (j_common_ptr) cinfo, JPOOL_PERMANENT,
INPUT_BUF_SIZE * sizeof( JOCTET ) );
( *cinfo->mem->alloc_small )( (j_common_ptr) cinfo, JPOOL_PERMANENT,
INPUT_BUF_SIZE * sizeof( JOCTET ) );
}
src = (my_src_ptr) cinfo->src;

View File

@@ -111,9 +111,9 @@ void LoadPCXBuff( byte* buffer, std::size_t len, byte **pic, byte **palette, int
if ( pcx.manufacturer != 0x0a
|| pcx.version != 5
|| pcx.encoding != 1
|| pcx.bits_per_pixel != 8 ) {
|| pcx.version != 5
|| pcx.encoding != 1
|| pcx.bits_per_pixel != 8 ) {
return;
}

View File

@@ -162,9 +162,9 @@ template<std::size_t BYTES>
class TargaDecodePixel
{
public:
void operator()( PointerInputStream& istream, RGBAPixel& pixel ) const {
istream_read_pixel<BYTES>( istream, pixel );
}
void operator()( PointerInputStream& istream, RGBAPixel& pixel ) const {
istream_read_pixel<BYTES>( istream, pixel );
}
};
template<typename Flip, std::size_t BYTES>
@@ -193,33 +193,33 @@ inline TargaPacketSize targa_packet_size( const TargaPacket& packet ){
template<typename PixelReadFunctor>
class TargaDecodePixelRLE
{
TargaPacketSize m_packetSize;
RGBAPixel m_pixel;
TargaPacket m_packet;
const PixelReadFunctor& m_pixelRead;
TargaPacketSize m_packetSize;
RGBAPixel m_pixel;
TargaPacket m_packet;
const PixelReadFunctor& m_pixelRead;
public:
TargaDecodePixelRLE( const PixelReadFunctor& pixelRead ) : m_packetSize( 0 ), m_pixelRead( pixelRead ){
}
void operator()( PointerInputStream& istream, RGBAPixel& pixel ){
if ( m_packetSize == 0 ) {
targa_packet_read_istream( m_packet, istream );
m_packetSize = targa_packet_size( m_packet );
TargaDecodePixelRLE( const PixelReadFunctor& pixelRead ) : m_packetSize( 0 ), m_pixelRead( pixelRead ){
}
void operator()( PointerInputStream& istream, RGBAPixel& pixel ){
if ( m_packetSize == 0 ) {
targa_packet_read_istream( m_packet, istream );
m_packetSize = targa_packet_size( m_packet );
if ( targa_packet_is_rle( m_packet ) ) {
m_pixelRead( istream, m_pixel );
}
}
if ( targa_packet_is_rle( m_packet ) ) {
m_pixelRead( istream, m_pixel );
pixel = m_pixel;
}
else
{
m_pixelRead( istream, pixel );
}
}
if ( targa_packet_is_rle( m_packet ) ) {
pixel = m_pixel;
--m_packetSize;
}
else
{
m_pixelRead( istream, pixel );
}
--m_packetSize;
}
};
template<typename Flip, std::size_t BYTES>
@@ -368,11 +368,11 @@ Image* LoadTGABuff( const byte* buffer ){
targa_header_read_istream( targa_header, istream );
if ( targa_header.image_type != 1 &&
targa_header.image_type != 2 &&
targa_header.image_type != 3 &&
targa_header.image_type != 9 &&
targa_header.image_type != 10 &&
targa_header.image_type != 11 ) {
targa_header.image_type != 2 &&
targa_header.image_type != 3 &&
targa_header.image_type != 9 &&
targa_header.image_type != 10 &&
targa_header.image_type != 11 ) {
globalErrorStream() << "LoadTGA: TGA type " << targa_header.image_type << " not supported\n";
globalErrorStream() << "LoadTGA: Only uncompressed types: 1 (paletted), 2 (RGB), 3 (gray) and compressed: 9 (paletted), 10 (RGB), 11 (gray) of TGA images supported\n";
return 0;
@@ -390,26 +390,26 @@ Image* LoadTGABuff( const byte* buffer ){
}
if ( ( ( targa_header.image_type == 2 || targa_header.image_type == 10 ) && targa_header.pixel_size != 32 && targa_header.pixel_size != 24 ) ||
( ( targa_header.image_type == 3 || targa_header.image_type == 11 ) && targa_header.pixel_size != 8 ) ||
( ( targa_header.image_type == 1 || targa_header.image_type == 9 ) && targa_header.pixel_size != 8 ) ) {
( ( targa_header.image_type == 3 || targa_header.image_type == 11 ) && targa_header.pixel_size != 8 ) ||
( ( targa_header.image_type == 1 || targa_header.image_type == 9 ) && targa_header.pixel_size != 8 ) ) {
globalErrorStream() << "LoadTGA: Only 32, 24 or 8 bit images supported\n";
return 0;
}
if ( !bitfield_enabled( targa_header.attributes, TGA_FLIP_HORIZONTAL )
&& !bitfield_enabled( targa_header.attributes, TGA_FLIP_VERTICAL ) ) {
&& !bitfield_enabled( targa_header.attributes, TGA_FLIP_VERTICAL ) ) {
return Targa_decodeImageData( targa_header, istream, Flip00() );
}
if ( !bitfield_enabled( targa_header.attributes, TGA_FLIP_HORIZONTAL )
&& bitfield_enabled( targa_header.attributes, TGA_FLIP_VERTICAL ) ) {
&& bitfield_enabled( targa_header.attributes, TGA_FLIP_VERTICAL ) ) {
return Targa_decodeImageData( targa_header, istream, Flip01() );
}
if ( bitfield_enabled( targa_header.attributes, TGA_FLIP_HORIZONTAL )
&& !bitfield_enabled( targa_header.attributes, TGA_FLIP_VERTICAL ) ) {
&& !bitfield_enabled( targa_header.attributes, TGA_FLIP_VERTICAL ) ) {
return Targa_decodeImageData( targa_header, istream, Flip10() );
}
if ( bitfield_enabled( targa_header.attributes, TGA_FLIP_HORIZONTAL )
&& bitfield_enabled( targa_header.attributes, TGA_FLIP_VERTICAL ) ) {
&& bitfield_enabled( targa_header.attributes, TGA_FLIP_VERTICAL ) ) {
return Targa_decodeImageData( targa_header, istream, Flip11() );
}