mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-16 19:54:10 +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:
@@ -1,11 +1,11 @@
|
||||
namespace hiro {
|
||||
|
||||
static const unsigned Windows2000 = 0x0500;
|
||||
static const unsigned WindowsXP = 0x0501;
|
||||
static const unsigned WindowsVista = 0x0600;
|
||||
static const unsigned Windows7 = 0x0601;
|
||||
static const uint Windows2000 = 0x0500;
|
||||
static const uint WindowsXP = 0x0501;
|
||||
static const uint WindowsVista = 0x0600;
|
||||
static const uint Windows7 = 0x0601;
|
||||
|
||||
static auto Button_CustomDraw(HWND, PAINTSTRUCT&, bool, bool, bool, unsigned, const Font&, const Image&, Orientation, const string&) -> void;
|
||||
static auto Button_CustomDraw(HWND, PAINTSTRUCT&, bool, bool, bool, unsigned, const Font&, const image&, Orientation, const string&) -> void;
|
||||
|
||||
static auto OsVersion() -> unsigned {
|
||||
OSVERSIONINFO versionInfo{0};
|
||||
@@ -34,33 +34,6 @@ static auto CreateBitmap(image icon) -> HBITMAP {
|
||||
return hbitmap;
|
||||
}
|
||||
|
||||
static auto CreateBitmap(const Image& image) -> HBITMAP {
|
||||
HDC hdc = GetDC(0);
|
||||
BITMAPINFO bitmapInfo{0};
|
||||
bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bitmapInfo.bmiHeader.biWidth = image.width();
|
||||
bitmapInfo.bmiHeader.biHeight = -image.height(); //bitmaps are stored upside down unless we negate height
|
||||
bitmapInfo.bmiHeader.biPlanes = 1;
|
||||
bitmapInfo.bmiHeader.biBitCount = 32;
|
||||
bitmapInfo.bmiHeader.biCompression = BI_RGB;
|
||||
bitmapInfo.bmiHeader.biSizeImage = image.width() * image.height() * sizeof(uint32_t);
|
||||
void* bits = nullptr;
|
||||
HBITMAP hbitmap = CreateDIBSection(hdc, &bitmapInfo, DIB_RGB_COLORS, &bits, nullptr, 0);
|
||||
if(bits) {
|
||||
auto source = (const uint8_t*)image.data();
|
||||
auto target = (uint8_t*)bits;
|
||||
for(auto n : range(image.width() * image.height())) {
|
||||
target[0] = (source[0] * source[3]) / 255;
|
||||
target[1] = (source[1] * source[3]) / 255;
|
||||
target[2] = (source[2] * source[3]) / 255;
|
||||
target[3] = (source[3]);
|
||||
source += 4, target += 4;
|
||||
}
|
||||
}
|
||||
ReleaseDC(0, hdc);
|
||||
return hbitmap;
|
||||
}
|
||||
|
||||
static auto CreateRGB(const Color& color) -> COLORREF {
|
||||
return RGB(color.red(), color.green(), color.blue());
|
||||
}
|
||||
@@ -93,11 +66,8 @@ static auto GetWindowZOrder(HWND hwnd) -> unsigned {
|
||||
return z;
|
||||
}
|
||||
|
||||
static auto ImageList_Append(HIMAGELIST imageList, const Image& image, unsigned scale) -> void {
|
||||
nall::image icon;
|
||||
if(image) {
|
||||
icon.allocate(image.width(), image.height());
|
||||
memory::copy(icon.data(), image.data(), icon.size());
|
||||
static auto ImageList_Append(HIMAGELIST imageList, image icon, unsigned scale) -> void {
|
||||
if(icon) {
|
||||
icon.scale(scale, scale);
|
||||
} else {
|
||||
icon.allocate(scale, scale);
|
||||
|
Reference in New Issue
Block a user