my own uncrustify run
This commit is contained in:
192
libs/imagelib.h
192
libs/imagelib.h
@@ -1,25 +1,25 @@
|
||||
/*
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
Copyright (C) 2001-2006, William Joseph.
|
||||
All Rights Reserved.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
GtkRadiant is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
GtkRadiant is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GtkRadiant is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
GtkRadiant is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#if !defined(INCLUDED_IMAGELIB_H)
|
||||
#if !defined( INCLUDED_IMAGELIB_H )
|
||||
#define INCLUDED_IMAGELIB_H
|
||||
|
||||
#include "iimage.h"
|
||||
@@ -29,124 +29,106 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
struct RGBAPixel
|
||||
{
|
||||
unsigned char red, green, blue, alpha;
|
||||
unsigned char red, green, blue, alpha;
|
||||
};
|
||||
|
||||
class RGBAImage : public Image
|
||||
{
|
||||
RGBAImage(const RGBAImage& other);
|
||||
RGBAImage& operator=(const RGBAImage& other);
|
||||
RGBAImage( const RGBAImage& other );
|
||||
RGBAImage& operator=( const RGBAImage& other );
|
||||
public:
|
||||
RGBAPixel* pixels;
|
||||
unsigned int width, height;
|
||||
RGBAPixel* pixels;
|
||||
unsigned int width, height;
|
||||
|
||||
RGBAImage(unsigned int _width, unsigned int _height)
|
||||
: pixels(new RGBAPixel[_width * _height]), width(_width), height(_height)
|
||||
{
|
||||
}
|
||||
~RGBAImage()
|
||||
{
|
||||
delete[] pixels;
|
||||
}
|
||||
RGBAImage( unsigned int _width, unsigned int _height )
|
||||
: pixels( new RGBAPixel[_width * _height] ), width( _width ), height( _height ){
|
||||
}
|
||||
~RGBAImage(){
|
||||
delete[] pixels;
|
||||
}
|
||||
|
||||
void release()
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
byte* getRGBAPixels() const
|
||||
{
|
||||
return reinterpret_cast<byte*>(pixels);
|
||||
}
|
||||
unsigned int getWidth() const
|
||||
{
|
||||
return width;
|
||||
}
|
||||
unsigned int getHeight() const
|
||||
{
|
||||
return height;
|
||||
}
|
||||
void release(){
|
||||
delete this;
|
||||
}
|
||||
byte* getRGBAPixels() const {
|
||||
return reinterpret_cast<byte*>( pixels );
|
||||
}
|
||||
unsigned int getWidth() const {
|
||||
return width;
|
||||
}
|
||||
unsigned int getHeight() const {
|
||||
return height;
|
||||
}
|
||||
};
|
||||
|
||||
class RGBAImageFlags : public RGBAImage
|
||||
{
|
||||
public:
|
||||
int m_surfaceFlags;
|
||||
int m_contentFlags;
|
||||
int m_value;
|
||||
RGBAImageFlags(unsigned short _width, unsigned short _height, int surfaceFlags, int contentFlags, int value) :
|
||||
RGBAImage(_width, _height), m_surfaceFlags(surfaceFlags), m_contentFlags(contentFlags), m_value(value)
|
||||
{
|
||||
}
|
||||
int m_surfaceFlags;
|
||||
int m_contentFlags;
|
||||
int m_value;
|
||||
RGBAImageFlags( unsigned short _width, unsigned short _height, int surfaceFlags, int contentFlags, int value ) :
|
||||
RGBAImage( _width, _height ), m_surfaceFlags( surfaceFlags ), m_contentFlags( contentFlags ), m_value( value ){
|
||||
}
|
||||
|
||||
int getSurfaceFlags() const
|
||||
{
|
||||
return m_surfaceFlags;
|
||||
}
|
||||
int getContentFlags() const
|
||||
{
|
||||
return m_contentFlags;
|
||||
}
|
||||
int getValue() const
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
int getSurfaceFlags() const {
|
||||
return m_surfaceFlags;
|
||||
}
|
||||
int getContentFlags() const {
|
||||
return m_contentFlags;
|
||||
}
|
||||
int getValue() const {
|
||||
return m_value;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
inline InputStream::byte_type* ArchiveFile_loadBuffer(ArchiveFile& file, std::size_t& length)
|
||||
{
|
||||
InputStream::byte_type* buffer = (InputStream::byte_type*)malloc(file.size() + 1);
|
||||
length = file.getInputStream().read(buffer, file.size());
|
||||
buffer[file.size()] = 0;
|
||||
return buffer;
|
||||
inline InputStream::byte_type* ArchiveFile_loadBuffer( ArchiveFile& file, std::size_t& length ){
|
||||
InputStream::byte_type* buffer = (InputStream::byte_type*)malloc( file.size() + 1 );
|
||||
length = file.getInputStream().read( buffer, file.size() );
|
||||
buffer[file.size()] = 0;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
inline void ArchiveFile_freeBuffer(InputStream::byte_type* buffer)
|
||||
{
|
||||
free(buffer);
|
||||
inline void ArchiveFile_freeBuffer( InputStream::byte_type* buffer ){
|
||||
free( buffer );
|
||||
}
|
||||
|
||||
class ScopedArchiveBuffer
|
||||
{
|
||||
public:
|
||||
std::size_t length;
|
||||
InputStream::byte_type* buffer;
|
||||
std::size_t length;
|
||||
InputStream::byte_type* buffer;
|
||||
|
||||
ScopedArchiveBuffer(ArchiveFile& file)
|
||||
{
|
||||
buffer = ArchiveFile_loadBuffer(file, length);
|
||||
}
|
||||
~ScopedArchiveBuffer()
|
||||
{
|
||||
ArchiveFile_freeBuffer(buffer);
|
||||
}
|
||||
ScopedArchiveBuffer( ArchiveFile& file ){
|
||||
buffer = ArchiveFile_loadBuffer( file, length );
|
||||
}
|
||||
~ScopedArchiveBuffer(){
|
||||
ArchiveFile_freeBuffer( buffer );
|
||||
}
|
||||
};
|
||||
|
||||
class PointerInputStream : public InputStream
|
||||
{
|
||||
const byte* m_read;
|
||||
const byte* m_read;
|
||||
public:
|
||||
PointerInputStream(const byte* pointer)
|
||||
: m_read(pointer)
|
||||
{
|
||||
}
|
||||
std::size_t read(byte* buffer, std::size_t length)
|
||||
{
|
||||
const byte* end = m_read + length;
|
||||
while(m_read != end)
|
||||
{
|
||||
*buffer++ = *m_read++;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
void seek(std::size_t offset)
|
||||
{
|
||||
m_read += offset;
|
||||
}
|
||||
const byte* get()
|
||||
{
|
||||
return m_read;
|
||||
}
|
||||
PointerInputStream( const byte* pointer )
|
||||
: m_read( pointer ){
|
||||
}
|
||||
std::size_t read( byte* buffer, std::size_t length ){
|
||||
const byte* end = m_read + length;
|
||||
while ( m_read != end )
|
||||
{
|
||||
*buffer++ = *m_read++;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
void seek( std::size_t offset ){
|
||||
m_read += offset;
|
||||
}
|
||||
const byte* get(){
|
||||
return m_read;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user