]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - libs/gtkutil/image.cpp
Revert partially (auto) "reformat code! now the code is only ugly on the *inside*"
[xonotic/netradiant.git] / libs / gtkutil / image.cpp
index 16c03c54fc41f460e736bda8e971e00bb8fabcf5..210b055c076a74f45cabcda6e38f984ed497aecf 100644 (file)
 #include "stream/textstream.h"
 
 
-namespace {
-    CopiedString g_bitmapsPath;
+namespace
+{
+CopiedString g_bitmapsPath;
 }
 
-void BitmapsPath_set(const char *path)
-{
-    g_bitmapsPath = path;
+void BitmapsPath_set( const char* path ){
+       g_bitmapsPath = path;
 }
 
-GdkPixbuf *pixbuf_new_from_file_with_mask(const char *filename)
-{
-    GdkPixbuf *rgb = gdk_pixbuf_new_from_file(filename, 0);
-    if (rgb == 0) {
-        return 0;
-    } else {
-        GdkPixbuf *rgba = gdk_pixbuf_add_alpha(rgb, FALSE, 255, 0, 255);
-        g_object_unref(rgb);
-        return rgba;
-    }
+GdkPixbuf* pixbuf_new_from_file_with_mask( const char* filename ){
+       GdkPixbuf* rgb = gdk_pixbuf_new_from_file( filename, 0 );
+       if ( rgb == 0 ) {
+               return 0;
+       }
+       else
+       {
+               GdkPixbuf* rgba = gdk_pixbuf_add_alpha( rgb, FALSE, 255, 0, 255 );
+               g_object_unref( rgb );
+               return rgba;
+       }
 }
 
-ui::Image image_new_from_file_with_mask(const char *filename)
-{
-    GdkPixbuf *rgba = pixbuf_new_from_file_with_mask(filename);
-    if (rgba == 0) {
-        return ui::Image(ui::null);
-    } else {
-        auto image = ui::Image::from(gtk_image_new_from_pixbuf(rgba));
-        g_object_unref(rgba);
-        return image;
-    }
+ui::Image image_new_from_file_with_mask( const char* filename ){
+       GdkPixbuf* rgba = pixbuf_new_from_file_with_mask( filename );
+       if ( rgba == 0 ) {
+               return ui::Image(ui::null);
+       }
+       else
+       {
+               auto image = ui::Image::from( gtk_image_new_from_pixbuf( rgba ) );
+               g_object_unref( rgba );
+               return image;
+       }
 }
 
-ui::Image image_new_missing()
-{
-    return ui::Image::from(gtk_image_new_from_stock(GTK_STOCK_MISSING_IMAGE, GTK_ICON_SIZE_SMALL_TOOLBAR));
+ui::Image image_new_missing(){
+       return ui::Image::from( gtk_image_new_from_stock( GTK_STOCK_MISSING_IMAGE, GTK_ICON_SIZE_SMALL_TOOLBAR ) );
 }
 
-ui::Image new_image(const char *filename)
-{
-    if (auto image = image_new_from_file_with_mask(filename)) {
-        return image;
-    }
-    return image_new_missing();
+ui::Image new_image( const char* filename ){
+       if ( auto image = image_new_from_file_with_mask( filename ) ) {
+               return image;
+       }
+       return image_new_missing();
 }
 
-ui::Image new_local_image(const char *filename)
-{
-    StringOutputStream fullPath(256);
-    fullPath << g_bitmapsPath.c_str() << filename;
-    return new_image(fullPath.c_str());
+ui::Image new_local_image( const char* filename ){
+       StringOutputStream fullPath( 256 );
+       fullPath << g_bitmapsPath.c_str() << filename;
+       return new_image( fullPath.c_str() );
 }