mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-16 07:54:00 +02:00
Update to 20160106 OS X Preview for Developers release.
byuu says: New update. Most of the work today went into eliminating hiro::Image from all objects in all ports, replacing with nall::image. That took an eternity. Changelog: - fixed crashing bug when loading games [thanks endrift!!] - toggling "show status bar" option adjusts window geometry (not supposed to recenter the window, though) - button sizes improved; icon-only button icons no longer being cut off
This commit is contained in:
@@ -29,40 +29,11 @@ static auto CreatePixbuf(image icon, bool scale = false) -> GdkPixbuf* {
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
static auto CreatePixbuf(const Image& image, bool scale = false) -> GdkPixbuf* {
|
||||
if(!image.state.data) return nullptr;
|
||||
|
||||
auto pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, image.width(), image.height());
|
||||
|
||||
//ARGB -> ABGR conversion
|
||||
const uint32_t* source = image.data();
|
||||
uint32_t* target = (uint32_t*)gdk_pixbuf_get_pixels(pixbuf);
|
||||
for(auto n : range(image.width() * image.height())) {
|
||||
uint32_t pixel = *source++;
|
||||
*target++ = (pixel & 0x00ff0000) >> 16 | (pixel & 0xff00ff00) | (pixel & 0x000000ff) << 16;
|
||||
}
|
||||
|
||||
if(scale) {
|
||||
auto scaled = gdk_pixbuf_scale_simple(pixbuf, 15, 15, GDK_INTERP_BILINEAR);
|
||||
g_object_unref(pixbuf);
|
||||
pixbuf = scaled;
|
||||
}
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
static auto CreateImage(const nall::image& image, bool scale = false) -> GtkImage* {
|
||||
auto pixbuf = CreatePixbuf(image, scale);
|
||||
auto gtkImage = (GtkImage*)gtk_image_new_from_pixbuf(pixbuf);
|
||||
static auto CreateImage(const image& icon, bool scale = false) -> GtkImage* {
|
||||
auto pixbuf = CreatePixbuf(icon, scale);
|
||||
auto gtkIcon = (GtkImage*)gtk_image_new_from_pixbuf(pixbuf);
|
||||
g_object_unref(pixbuf);
|
||||
return gtkImage;
|
||||
}
|
||||
|
||||
static auto CreateImage(const Image& image, bool scale = false) -> GtkImage* {
|
||||
auto pixbuf = CreatePixbuf(image, scale);
|
||||
auto gtkImage = (GtkImage*)gtk_image_new_from_pixbuf(pixbuf);
|
||||
g_object_unref(pixbuf);
|
||||
return gtkImage;
|
||||
return gtkIcon;
|
||||
}
|
||||
|
||||
static auto DropPaths(GtkSelectionData* data) -> lstring {
|
||||
|
Reference in New Issue
Block a user