X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=libs%2Fgtkutil%2Fimage.cpp;h=210b055c076a74f45cabcda6e38f984ed497aecf;hb=6790eb7048a160e04b84ee6305a9e830e23415d8;hp=961d2e73651db9808e2f9d0cc480b1e2bb6e9150;hpb=c52a4bd4da209e657018e8d799dcb488cd848e4c;p=xonotic%2Fnetradiant.git diff --git a/libs/gtkutil/image.cpp b/libs/gtkutil/image.cpp index 961d2e73..210b055c 100644 --- a/libs/gtkutil/image.cpp +++ b/libs/gtkutil/image.cpp @@ -50,35 +50,31 @@ GdkPixbuf* pixbuf_new_from_file_with_mask( const char* filename ){ } } -GtkImage* image_new_from_file_with_mask( const char* filename ){ +ui::Image image_new_from_file_with_mask( const char* filename ){ GdkPixbuf* rgba = pixbuf_new_from_file_with_mask( filename ); if ( rgba == 0 ) { - return 0; + return ui::Image(ui::null); } else { - GtkImage* image = GTK_IMAGE( gtk_image_new_from_pixbuf( rgba ) ); + auto image = ui::Image::from( gtk_image_new_from_pixbuf( rgba ) ); g_object_unref( rgba ); return image; } } -GtkImage* image_new_missing(){ - return GTK_IMAGE( 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 ) ); } -GtkImage* new_image( const char* filename ){ - { - GtkImage* image = image_new_from_file_with_mask( filename ); - if ( image != 0 ) { - return image; - } +ui::Image new_image( const char* filename ){ + if ( auto image = image_new_from_file_with_mask( filename ) ) { + return image; } - return image_new_missing(); } -GtkImage* new_local_image( const char* filename ){ +ui::Image new_local_image( const char* filename ){ StringOutputStream fullPath( 256 ); fullPath << g_bitmapsPath.c_str() << filename; return new_image( fullPath.c_str() );