diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-05-17 07:36:47 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-05-17 07:37:45 -0300 |
commit | 98a329670227c726a5d7a196e5cba8dbdd54301b (patch) | |
tree | 7346f7a3e38eb35b784ac1a68a227d07cc8881b4 /platform/windows | |
parent | d801ff2b3db2de105c1b36a74ce116e360143d4e (diff) |
Removal of Image from Variant, converted to a Resource.
Diffstat (limited to 'platform/windows')
-rw-r--r-- | platform/windows/export/export.cpp | 2 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 15 | ||||
-rw-r--r-- | platform/windows/os_windows.h | 2 |
3 files changed, 10 insertions, 9 deletions
diff --git a/platform/windows/export/export.cpp b/platform/windows/export/export.cpp index 2d11bfe4d8..3802e7e784 100644 --- a/platform/windows/export/export.cpp +++ b/platform/windows/export/export.cpp @@ -35,7 +35,7 @@ void register_windows_exporter() { Ref<EditorExportPlatformPC> platform; platform.instance(); - Image img(_windows_logo); + Ref<Image> img = memnew(Image(_windows_logo)); Ref<ImageTexture> logo; logo.instance(); logo->create_from_image(img); diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 9dee2da21e..42597f79c8 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1996,13 +1996,14 @@ String OS_Windows::get_executable_path() const { return s; } -void OS_Windows::set_icon(const Image &p_icon) { +void OS_Windows::set_icon(const Ref<Image> &p_icon) { - Image icon = p_icon; - if (icon.get_format() != Image::FORMAT_RGBA8) - icon.convert(Image::FORMAT_RGBA8); - int w = icon.get_width(); - int h = icon.get_height(); + ERR_FAIL_COND(!p_icon.is_valid()); + Ref<Image> icon = p_icon->duplicate(); + if (icon->get_format() != Image::FORMAT_RGBA8) + icon->convert(Image::FORMAT_RGBA8); + int w = icon->get_width(); + int h = icon->get_height(); /* Create temporary bitmap buffer */ int icon_len = 40 + h * w * 4; @@ -2023,7 +2024,7 @@ void OS_Windows::set_icon(const Image &p_icon) { encode_uint32(0, &icon_bmp[36]); uint8_t *wr = &icon_bmp[40]; - PoolVector<uint8_t>::Read r = icon.get_data().read(); + PoolVector<uint8_t>::Read r = icon->get_data().read(); for (int i = 0; i < h; i++) { diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 87eceafa02..4dd05928df 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -254,7 +254,7 @@ public: virtual String get_clipboard() const; void set_cursor_shape(CursorShape p_shape); - void set_icon(const Image &p_icon); + void set_icon(const Ref<Image> &p_icon); virtual String get_executable_path() const; |