]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - plugins/image/dds.cpp
Revert partially (auto) "reformat code! now the code is only ugly on the *inside*"
[xonotic/netradiant.git] / plugins / image / dds.cpp
index 79941e87e98ce4869f7d5331d85c0a9b2991a6f7..0da0d3a223c1f728acafc71e954cac55bde29aab 100644 (file)
 #include "ddslib.h"
 #include "imagelib.h"
 
-Image *LoadDDSBuff(const byte *buffer)
-{
-    int width, height;
-    ddsPF_t pixelFormat;
-    if (DDSGetInfo(reinterpret_cast<ddsBuffer_t *>( const_cast<byte *>( buffer )), &width, &height, &pixelFormat) ==
-        -1) {
-        return 0;
-    }
-
-    RGBAImage *image = new RGBAImage(width, height);
-
-    if (DDSDecompress(reinterpret_cast<ddsBuffer_t *>( const_cast<byte *>( buffer )), image->getRGBAPixels()) == -1) {
-        image->release();
-        return 0;
-    }
-    return image;
+Image* LoadDDSBuff( const byte* buffer ){
+       int width, height;
+       ddsPF_t pixelFormat;
+       if ( DDSGetInfo( reinterpret_cast<ddsBuffer_t*>( const_cast<byte*>( buffer ) ), &width, &height, &pixelFormat ) == -1 ) {
+               return 0;
+       }
+
+       RGBAImage* image = new RGBAImage( width, height );
+
+       if ( DDSDecompress( reinterpret_cast<ddsBuffer_t*>( const_cast<byte*>( buffer ) ), image->getRGBAPixels() ) == -1 ) {
+               image->release();
+               return 0;
+       }
+       return image;
 }
 
-Image *LoadDDS(ArchiveFile &file)
-{
-    ScopedArchiveBuffer buffer(file);
-    return LoadDDSBuff(buffer.buffer);
+Image* LoadDDS( ArchiveFile& file ){
+       ScopedArchiveBuffer buffer( file );
+       return LoadDDSBuff( buffer.buffer );
 }