diff options
61 files changed, 201 insertions, 2824 deletions
diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt index 443e6fee97..7741573039 100644 --- a/COPYRIGHT.txt +++ b/COPYRIGHT.txt @@ -257,12 +257,6 @@ Comment: FastLZ Copyright: 2005-2020, Ariya Hidayat License: Expat -Files: ./thirdparty/misc/hq2x.cpp - ./thirdparty/misc/hq2x.h -Comment: hq2x implementation -Copyright: 2016, Bruno Ribeiro -License: Apache-2.0 - Files: ./thirdparty/misc/ifaddrs-android.cc ./thirdparty/misc/ifaddrs-android.h Comment: libjingle @@ -334,7 +328,7 @@ License: Zlib Files: ./thirdparty/rvo2/ Comment: RVO2 -Copyright: 2016, University of North Carolina at Chapel Hill +Copyright: 2016, University of North Carolina at Chapel Hill License: Apache 2.0 Files: ./thirdparty/squish/ diff --git a/core/SCsub b/core/SCsub index d53988fae7..80a5f6b623 100644 --- a/core/SCsub +++ b/core/SCsub @@ -52,7 +52,6 @@ thirdparty_misc_sources = [ "r128.c", "smaz.c", # C++ sources - "hq2x.cpp", "pcg.cpp", "triangulator.cpp", "clipper.cpp", diff --git a/core/error_macros.h b/core/error_macros.h index a592f752d5..46a1623115 100644 --- a/core/error_macros.h +++ b/core/error_macros.h @@ -103,6 +103,11 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li * running application to fail or crash. * Always try to return processable data, so the engine can keep running well. * Use the _MSG versions to print a meaningful message to help with debugging. + * + * The `((void)0)` no-op statement is used as a trick to force us to put a semicolon after + * those macros, making them look like proper statements. + * The if wrappers are used to ensure that the macro replacement does not trigger unexpected + * issues when expanded e.g. after an `if (cond) ERR_FAIL();` without braces. */ // Index out of bounds error macros. @@ -361,11 +366,11 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li * Ensures `m_cond` is false. * If `m_cond` is true, the current function returns `m_retval`. */ -#define ERR_FAIL_COND_V(m_cond, m_retval) \ - if (unlikely(m_cond)) { \ - _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. returned: " _STR(m_retval)); \ - return m_retval; \ - } else \ +#define ERR_FAIL_COND_V(m_cond, m_retval) \ + if (unlikely(m_cond)) { \ + _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Returning: " _STR(m_retval)); \ + return m_retval; \ + } else \ ((void)0) /** @@ -375,11 +380,11 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li * If checking for null use ERR_FAIL_NULL_V_MSG instead. * If checking index bounds use ERR_FAIL_INDEX_V_MSG instead. */ -#define ERR_FAIL_COND_V_MSG(m_cond, m_retval, m_msg) \ - if (unlikely(m_cond)) { \ - _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. returned: " _STR(m_retval), DEBUG_STR(m_msg)); \ - return m_retval; \ - } else \ +#define ERR_FAIL_COND_V_MSG(m_cond, m_retval, m_msg) \ + if (unlikely(m_cond)) { \ + _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Condition \"" _STR(m_cond) "\" is true. Returning: " _STR(m_retval), DEBUG_STR(m_msg)); \ + return m_retval; \ + } else \ ((void)0) /** @@ -472,7 +477,7 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li */ #define ERR_FAIL() \ if (1) { \ - _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method/Function Failed."); \ + _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method/function failed."); \ return; \ } else \ ((void)0) @@ -485,7 +490,7 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li */ #define ERR_FAIL_MSG(m_msg) \ if (1) { \ - _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method/Function Failed.", DEBUG_STR(m_msg)); \ + _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method/function failed.", DEBUG_STR(m_msg)); \ return; \ } else \ ((void)0) @@ -499,7 +504,7 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li */ #define ERR_FAIL_V(m_retval) \ if (1) { \ - _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method/Function Failed, returning: " _STR(m_retval)); \ + _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method/function failed. Returning: " _STR(m_retval)); \ return m_retval; \ } else \ ((void)0) @@ -512,7 +517,7 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li */ #define ERR_FAIL_V_MSG(m_retval, m_msg) \ if (1) { \ - _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method/Function Failed, returning: " _STR(m_retval), DEBUG_STR(m_msg)); \ + _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "Method/function failed. Returning: " _STR(m_retval), DEBUG_STR(m_msg)); \ return m_retval; \ } else \ ((void)0) @@ -601,7 +606,7 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li */ #define CRASH_NOW() \ if (1) { \ - _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Method/Function Failed."); \ + _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Method/function failed."); \ GENERATE_TRAP(); \ } else \ ((void)0) @@ -613,7 +618,7 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li */ #define CRASH_NOW_MSG(m_msg) \ if (1) { \ - _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Method/Function Failed.", DEBUG_STR(m_msg)); \ + _err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: Method/function failed.", DEBUG_STR(m_msg)); \ GENERATE_TRAP(); \ } else \ ((void)0) diff --git a/core/image.cpp b/core/image.cpp index f99e8a636f..51216c8c31 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -37,8 +37,6 @@ #include "core/os/copymem.h" #include "core/print_string.h" -#include "thirdparty/misc/hq2x.h" - #include <stdio.h> const char *Image::format_names[Image::FORMAT_MAX] = { @@ -1445,47 +1443,6 @@ static void _generate_po2_mipmap(const Component *p_src, Component *p_dst, uint3 } } -void Image::expand_x2_hq2x() { - ERR_FAIL_COND(!_can_modify(format)); - - bool used_mipmaps = has_mipmaps(); - if (used_mipmaps) { - clear_mipmaps(); - } - - Format current = format; - - if (current != FORMAT_RGBA8) { - convert(FORMAT_RGBA8); - } - - Vector<uint8_t> dest; - dest.resize(width * 2 * height * 2 * 4); - - { - const uint8_t *r = data.ptr(); - uint8_t *w = dest.ptrw(); - - ERR_FAIL_COND(!r); - - hq2x_resize((const uint32_t *)r, width, height, (uint32_t *)w); - } - - width *= 2; - height *= 2; - data = dest; - - if (current != FORMAT_RGBA8) { - convert(current); - } - - // FIXME: This is likely meant to use "used_mipmaps" as defined above, but if we do, - // we end up with a regression: GH-22747 - if (mipmaps) { - generate_mipmaps(); - } -} - void Image::shrink_x2() { ERR_FAIL_COND(data.size() == 0); @@ -3047,7 +3004,6 @@ void Image::_bind_methods() { ClassDB::bind_method(D_METHOD("resize_to_po2", "square"), &Image::resize_to_po2, DEFVAL(false)); ClassDB::bind_method(D_METHOD("resize", "width", "height", "interpolation"), &Image::resize, DEFVAL(INTERPOLATE_BILINEAR)); ClassDB::bind_method(D_METHOD("shrink_x2"), &Image::shrink_x2); - ClassDB::bind_method(D_METHOD("expand_x2_hq2x"), &Image::expand_x2_hq2x); ClassDB::bind_method(D_METHOD("crop", "width", "height"), &Image::crop); ClassDB::bind_method(D_METHOD("flip_x"), &Image::flip_x); diff --git a/core/image.h b/core/image.h index dbdfaa917b..53c203998e 100644 --- a/core/image.h +++ b/core/image.h @@ -235,7 +235,6 @@ public: void resize_to_po2(bool p_square = false); void resize(int p_width, int p_height, Interpolation p_interpolation = INTERPOLATE_BILINEAR); void shrink_x2(); - void expand_x2_hq2x(); bool is_size_po2() const; /** * Crop the image to a specific size, if larger, then the image is filled by black diff --git a/doc/classes/Image.xml b/doc/classes/Image.xml index 99253e8840..55d2275194 100644 --- a/doc/classes/Image.xml +++ b/doc/classes/Image.xml @@ -190,13 +190,6 @@ <description> </description> </method> - <method name="expand_x2_hq2x"> - <return type="void"> - </return> - <description> - Stretches the image and enlarges it by a factor of 2. No interpolation is done. - </description> - </method> <method name="fill"> <return type="void"> </return> diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index ca0e486259..8b7014fabe 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -6014,8 +6014,11 @@ EditorNode::EditorNode() { left_menu_hb->add_child(settings_menu); p = settings_menu->get_popup(); - +#ifdef OSX_ENABLED + p->add_shortcut(ED_SHORTCUT("editor/editor_settings", TTR("Editor Settings..."), KEY_MASK_CMD + KEY_COMMA), SETTINGS_PREFERENCES); +#else p->add_shortcut(ED_SHORTCUT("editor/editor_settings", TTR("Editor Settings...")), SETTINGS_PREFERENCES); +#endif p->add_separator(); editor_layouts = memnew(PopupMenu); diff --git a/editor/icons/CameraEffects.svg b/editor/icons/CameraEffects.svg new file mode 100644 index 0000000000..2f6dad5fd8 --- /dev/null +++ b/editor/icons/CameraEffects.svg @@ -0,0 +1 @@ +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m5.9492188 2a3 3 0 0 0 -2.9492188 3 3 3 0 0 0 1 2.2304688v1.7695312l-3-2v6l3-2v1c0 .554.44599 1 1 1h3c.0076117-.045309.0115938-.096059.0214844-.134766.0773621-.302758.1860981-.478282.2832031-.625.1397097-.211089.2814954-.338835.4257813-.480468-.1445165-.141692-.2879205-.269839-.4277344-.480469-.0971224-.146315-.2052562-.321748-.2832032-.623047-.0777157-.300405-.1044198-.8152648.1640626-1.2910156.2700589-.4775976.7340166-.7239536 1.0371093-.8105469.3037241-.0867737.5108695-.0808838.6875-.0703125.2608449.0156115.4500479.0763383.6503909.1328125.049596-.1859081.086921-.3641449.195312-.5800781.078477-.1563394.174637-.3364783.396485-.5527344.221847-.2162561.652628-.4930277 1.195312-.4980469a1.6124973 1.6124973 0 0 1 .033203 0c.542861.0056205.97185.2837448 1.19336.5.146452.1429781.230167.265896.298828.3808594a3 3 0 0 0 .128906-.8671875 3 3 0 0 0 -3-3 3 3 0 0 0 -2.0117188.7773438 3 3 0 0 0 -2.9882812-2.7773438 3 3 0 0 0 -.0507812 0z" fill="#e0e0e0"/><path d="m12.36062 8.59795a.53334 3.2001 0 0 0 -.50976 2.2754 3.2001.53334 30 0 0 -2.2656-.71484 3.2001.53334 30 0 0 1.75 1.6016.53334 3.2001 60 0 0 -1.7461 1.5996.53334 3.2001 60 0 0 2.2578-.71094.53334 3.2001 0 0 0 .51367 2.3496.53334 3.2001 0 0 0 .51367-2.3516 3.2001.53334 30 0 0 2.2539.71094 3.2001.53334 30 0 0 -1.7441-1.5977.53334 3.2001 60 0 0 1.748-1.5996.53334 3.2001 60 0 0 -2.2617.71484.53334 3.2001 0 0 0 -.50977-2.2773z" fill="#cea4f1" stroke-width="1.0667"/></svg>
\ No newline at end of file diff --git a/editor/icons/CubeMap.svg b/editor/icons/Cubemap.svg index c9e6f1fa7d..c9e6f1fa7d 100644 --- a/editor/icons/CubeMap.svg +++ b/editor/icons/Cubemap.svg diff --git a/editor/icons/CubemapArray.svg b/editor/icons/CubemapArray.svg new file mode 100644 index 0000000000..350a64f9c2 --- /dev/null +++ b/editor/icons/CubemapArray.svg @@ -0,0 +1 @@ +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m2 6v4h2v-4zm6 0v4h4v-4z" fill="#84ffb1"/><path d="m4 6v4h4v-4zm8 0v4h2v-4z" fill="#ff8484"/><path d="m4 2v4h4v-4zm0 8v4h4v-4z" fill="#84c2ff"/><path d="m-.00000002 2v12h4.00000002v-2h-2v-8h2v-2h-2zm12.00000002 0v2h2.000001v8h-2.000001v2h4.000001v-12h-2z" fill="#e0e0e0"/></svg>
\ No newline at end of file diff --git a/editor/icons/LightmapProbe.svg b/editor/icons/LightmapProbe.svg new file mode 100644 index 0000000000..0972220fda --- /dev/null +++ b/editor/icons/LightmapProbe.svg @@ -0,0 +1 @@ +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1 9h3v-2h-3zm2.050781 2.535156 1.414063 1.414063 1.414062-1.414063-1.414062-1.414062zm0-7.070312 1.414063 1.414062 1.414062-1.414062-1.414062-1.414063zm1.949219 3.535156c0 1.6569 1.3432 3 3 3s3-1.3431 3-3-1.3432-3-3-3-3 1.3431-3 3zm3 7c3.865993 0 7-3.134007 7-7s-3.134007-7-7-7v2.333984c2.577329 0 4.666016 2.088687 4.666016 4.666016s-2.088687 4.666016-4.666016 4.666016z" fill="#fc9c9c" fill-opacity=".996078" stroke-width="1.16667"/></svg>
\ No newline at end of file diff --git a/editor/icons/PanoramaSky.svg b/editor/icons/PanoramaSky.svg deleted file mode 100644 index bfff6840bd..0000000000 --- a/editor/icons/PanoramaSky.svg +++ /dev/null @@ -1 +0,0 @@ -<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="a" gradientTransform="matrix(1.0096 0 0 1.0227 -.009615 -22.593)" gradientUnits="userSpaceOnUse" x1="8" x2="8" y1="1038.4" y2="1050.4"><stop offset="0" stop-color="#1ec3ff"/><stop offset="1" stop-color="#b2e1ff"/></linearGradient><g transform="translate(0 -1037.4)"><path d="m1 1039.4c4.2749 2.6091 10.765 2.7449 14 0v12c-3.5849-2.6849-9.7929-2.6544-14 0z" fill="url(#a)" stroke-width="15.242"/><path d="m11 6c-.554 0-1 .446-1 1h-1c-.554 0-1 .446-1 1s.446 1 1 1h2c.554 0 1-.446 1-1h1c.554 0 1-.446 1-1s-.446-1-1-1zm-8 3c-.554 0-1 .446-1 1s.446 1 1 1h1c.554 0 1-.446 1-1s-.446-1-1-1z" fill="#fff" transform="translate(0 1037.4)"/></g></svg>
\ No newline at end of file diff --git a/editor/icons/PanoramaSkyMaterial.svg b/editor/icons/PanoramaSkyMaterial.svg new file mode 100644 index 0000000000..9f40ffb63c --- /dev/null +++ b/editor/icons/PanoramaSkyMaterial.svg @@ -0,0 +1 @@ +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1 5v2h8 1c0-.554.446-1 1-1h2c.554 0 1 .446 1 1h1v-2z" fill="#9dff70"/><path d="m1 3v2h14v-2h-1.589844c-2.86436 1.357608-6.9481434 1.30996-10.347656 0z" fill="#ffeb70"/><path d="m1 2v1h2.0625c-.7241713-.2790504-1.419865-.6077805-2.0625-1zm14 0c-.465784.3952185-1.005424.7230054-1.589844 1h1.589844z" fill="#ff7070"/><path d="m1 7v2h2 1 5c-.554 0-1-.446-1-1s.446-1 1-1zm13 0c0 .554-.446 1-1 1h-1c0 .554-.446 1-1 1h4v-2z" fill="#70ffb9"/><path d="m1 9v2h2c-.554 0-1-.446-1-1s.446-1 1-1zm3 0c.554 0 1 .446 1 1s-.446 1-1 1h11v-2h-4-2z" fill="#70deff"/><path d="m1 13v-2h14v2h-1.589844c-2.86436-1.357608-6.9481434-1.30996-10.347656 0z" fill="#9f70ff"/><path d="m1 14v-1h2.0625c-.7241713.27905-1.419865.60778-2.0625 1zm14 0c-.465784-.395219-1.005424-.723005-1.589844-1h1.589844z" fill="#ff70ac"/></svg>
\ No newline at end of file diff --git a/editor/icons/PhysicalSkyMaterial.svg b/editor/icons/PhysicalSkyMaterial.svg new file mode 100644 index 0000000000..5831cb2c63 --- /dev/null +++ b/editor/icons/PhysicalSkyMaterial.svg @@ -0,0 +1 @@ +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1 5v2h8 1c0-.554.446-1 1-1h2c.554 0 1 .446 1 1h1v-2z" fill="#9dff70"/><path d="m1 7v2h2 1 5c-.554 0-1-.446-1-1s.446-1 1-1zm13 0c0 .554-.446 1-1 1h-1c0 .554-.446 1-1 1h4v-2z" fill="#70ffb9"/><path d="m1 9v2h2c-.554 0-1-.446-1-1s.446-1 1-1zm3 0c.554 0 1 .446 1 1s-.446 1-1 1h11v-2h-4-2z" fill="#70deff"/><path d="m1 3v2h14v-2z" fill="#ffeb70"/><path d="m1 11v2h14v-2z" fill="#9f70ff"/></svg>
\ No newline at end of file diff --git a/editor/icons/ProceduralSky.svg b/editor/icons/ProceduralSky.svg deleted file mode 100644 index 356a966fe9..0000000000 --- a/editor/icons/ProceduralSky.svg +++ /dev/null @@ -1 +0,0 @@ -<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="a" gradientUnits="userSpaceOnUse" x1="8" x2="8" y1="1040.4" y2="1050.4"><stop offset="0" stop-color="#1ec3ff"/><stop offset="1" stop-color="#b2e1ff"/></linearGradient><g transform="translate(0 -1037.4)"><path d="m8 1040.4a7 7 0 0 0 -7 7 7 7 0 0 0 .68555 3h12.631a7 7 0 0 0 .68359-3 7 7 0 0 0 -7-7z" fill="url(#a)"/><path d="m10 7c-.554 0-1 .446-1 1h-1c-.554 0-1 .446-1 1s.446 1 1 1h2c.554 0 1-.446 1-1h1c.554 0 1-.446 1-1s-.446-1-1-1zm-7 3c-.554 0-1 .446-1 1s.446 1 1 1h1c.554 0 1-.446 1-1s-.446-1-1-1z" fill="#fff" transform="translate(0 1037.4)"/></g></svg>
\ No newline at end of file diff --git a/editor/icons/ProceduralSkyMaterial.svg b/editor/icons/ProceduralSkyMaterial.svg new file mode 100644 index 0000000000..f7a3944671 --- /dev/null +++ b/editor/icons/ProceduralSkyMaterial.svg @@ -0,0 +1 @@ +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1.0761719 11a7 7 0 0 0 .609375 2h12.6308591a7 7 0 0 0 .609375-2h-9.925781c0 .554-.446 1-1 1h-1c-.554 0-1-.446-1-1z" fill="#9f70ff"/><path d="m1.0722656 9a7 7 0 0 0 -.0722656 1 7 7 0 0 0 .0761719 1h.9238281c0-.554.446-1 1-1h1c.554 0 1 .446 1 1h9.925781a7 7 0 0 0 .074219-1 7 7 0 0 0 -.072266-1h-2.927734-1c0 .554-.446 1-1 1h-2c-.554 0-1-.446-1-1z" fill="#70deff"/><path d="m1.6757812 7a7 7 0 0 0 -.6035156 2h5.9277344c0-.554.446-1 1-1h1c0-.554.446-1 1-1zm10.3242188 0c.554 0 1 .446 1 1s-.446 1-1 1h2.927734a7 7 0 0 0 -.603515-2z" fill="#70ffb9"/><path d="m3.1035156 5a7 7 0 0 0 -1.4277344 2h12.6484378a7 7 0 0 0 -1.425781-2z" fill="#9dff70"/><path d="m8 3a7 7 0 0 0 -4.8964844 2h9.7949224a7 7 0 0 0 -4.898438-2z" fill="#ffeb70"/></svg>
\ No newline at end of file diff --git a/modules/gdnative/gdnative/aabb.cpp b/modules/gdnative/gdnative/aabb.cpp index 246e5d4e8d..7f22c7dfe3 100644 --- a/modules/gdnative/gdnative/aabb.cpp +++ b/modules/gdnative/gdnative/aabb.cpp @@ -37,6 +37,8 @@ extern "C" { #endif +static_assert(sizeof(godot_aabb) == sizeof(AABB), "AABB size mismatch"); + void GDAPI godot_aabb_new(godot_aabb *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size) { const Vector3 *pos = (const Vector3 *)p_pos; const Vector3 *size = (const Vector3 *)p_size; diff --git a/modules/gdnative/gdnative/array.cpp b/modules/gdnative/gdnative/array.cpp index 0c764ab8fd..fb23863dc9 100644 --- a/modules/gdnative/gdnative/array.cpp +++ b/modules/gdnative/gdnative/array.cpp @@ -41,6 +41,8 @@ extern "C" { #endif +static_assert(sizeof(godot_array) == sizeof(Array), "Array size mismatch"); + void GDAPI godot_array_new(godot_array *r_dest) { Array *dest = (Array *)r_dest; memnew_placement(dest, Array); diff --git a/modules/gdnative/gdnative/basis.cpp b/modules/gdnative/gdnative/basis.cpp index 4f489287b9..990fd3795d 100644 --- a/modules/gdnative/gdnative/basis.cpp +++ b/modules/gdnative/gdnative/basis.cpp @@ -37,6 +37,8 @@ extern "C" { #endif +static_assert(sizeof(godot_basis) == sizeof(Basis), "Basis size mismatch"); + void GDAPI godot_basis_new_with_rows(godot_basis *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis) { const Vector3 *x_axis = (const Vector3 *)p_x_axis; const Vector3 *y_axis = (const Vector3 *)p_y_axis; diff --git a/modules/gdnative/gdnative/color.cpp b/modules/gdnative/gdnative/color.cpp index d79170771a..c75e74daba 100644 --- a/modules/gdnative/gdnative/color.cpp +++ b/modules/gdnative/gdnative/color.cpp @@ -37,6 +37,8 @@ extern "C" { #endif +static_assert(sizeof(godot_color) == sizeof(Color), "Color size mismatch"); + void GDAPI godot_color_new_rgba(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b, const godot_real p_a) { Color *dest = (Color *)r_dest; *dest = Color(p_r, p_g, p_b, p_a); diff --git a/modules/gdnative/gdnative/dictionary.cpp b/modules/gdnative/gdnative/dictionary.cpp index b145b88934..a126974815 100644 --- a/modules/gdnative/gdnative/dictionary.cpp +++ b/modules/gdnative/gdnative/dictionary.cpp @@ -39,6 +39,8 @@ extern "C" { #endif +static_assert(sizeof(godot_dictionary) == sizeof(Dictionary), "Dictionary size mismatch"); + void GDAPI godot_dictionary_new(godot_dictionary *r_dest) { Dictionary *dest = (Dictionary *)r_dest; memnew_placement(dest, Dictionary); diff --git a/modules/gdnative/gdnative/node_path.cpp b/modules/gdnative/gdnative/node_path.cpp index 93f43835c8..88ed650ebe 100644 --- a/modules/gdnative/gdnative/node_path.cpp +++ b/modules/gdnative/gdnative/node_path.cpp @@ -37,6 +37,8 @@ extern "C" { #endif +static_assert(sizeof(godot_node_path) == sizeof(NodePath), "NodePath size mismatch"); + void GDAPI godot_node_path_new(godot_node_path *r_dest, const godot_string *p_from) { NodePath *dest = (NodePath *)r_dest; const String *from = (const String *)p_from; diff --git a/modules/gdnative/gdnative/plane.cpp b/modules/gdnative/gdnative/plane.cpp index 923308dc34..663937f906 100644 --- a/modules/gdnative/gdnative/plane.cpp +++ b/modules/gdnative/gdnative/plane.cpp @@ -37,6 +37,8 @@ extern "C" { #endif +static_assert(sizeof(godot_plane) == sizeof(Plane), "Plane size mismatch"); + void GDAPI godot_plane_new_with_reals(godot_plane *r_dest, const godot_real p_a, const godot_real p_b, const godot_real p_c, const godot_real p_d) { Plane *dest = (Plane *)r_dest; *dest = Plane(p_a, p_b, p_c, p_d); diff --git a/modules/gdnative/gdnative/pool_arrays.cpp b/modules/gdnative/gdnative/pool_arrays.cpp index 589b4d4dfe..652f59cd07 100644 --- a/modules/gdnative/gdnative/pool_arrays.cpp +++ b/modules/gdnative/gdnative/pool_arrays.cpp @@ -42,6 +42,14 @@ extern "C" { #endif +static_assert(sizeof(godot_packed_byte_array) == sizeof(Vector<uint8_t>), "Vector<uint8_t> size mismatch"); +static_assert(sizeof(godot_packed_int_array) == sizeof(Vector<godot_int>), "Vector<godot_int> size mismatch"); +static_assert(sizeof(godot_packed_real_array) == sizeof(Vector<godot_real>), "Vector<godot_real> size mismatch"); +static_assert(sizeof(godot_packed_string_array) == sizeof(Vector<String>), "Vector<String> size mismatch"); +static_assert(sizeof(godot_packed_vector2_array) == sizeof(Vector<Vector2>), "Vector<Vector2> size mismatch"); +static_assert(sizeof(godot_packed_vector3_array) == sizeof(Vector<Vector3>), "Vector<Vector3> size mismatch"); +static_assert(sizeof(godot_packed_color_array) == sizeof(Vector<Color>), "Vector<Color> size mismatch"); + #define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr) // byte diff --git a/modules/gdnative/gdnative/quat.cpp b/modules/gdnative/gdnative/quat.cpp index 15c04f7191..de6308ad2a 100644 --- a/modules/gdnative/gdnative/quat.cpp +++ b/modules/gdnative/gdnative/quat.cpp @@ -37,6 +37,8 @@ extern "C" { #endif +static_assert(sizeof(godot_quat) == sizeof(Quat), "Quat size mismatch"); + void GDAPI godot_quat_new(godot_quat *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z, const godot_real p_w) { Quat *dest = (Quat *)r_dest; *dest = Quat(p_x, p_y, p_z, p_w); diff --git a/modules/gdnative/gdnative/rect2.cpp b/modules/gdnative/gdnative/rect2.cpp index a2f735172f..63cbbaa3cf 100644 --- a/modules/gdnative/gdnative/rect2.cpp +++ b/modules/gdnative/gdnative/rect2.cpp @@ -37,6 +37,8 @@ extern "C" { #endif +static_assert(sizeof(godot_rect2) == sizeof(Rect2), "Rect2 size mismatch"); + void GDAPI godot_rect2_new_with_position_and_size(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size) { const Vector2 *position = (const Vector2 *)p_pos; const Vector2 *size = (const Vector2 *)p_size; diff --git a/modules/gdnative/gdnative/rid.cpp b/modules/gdnative/gdnative/rid.cpp index 7ea80123a3..d7a63f33a7 100644 --- a/modules/gdnative/gdnative/rid.cpp +++ b/modules/gdnative/gdnative/rid.cpp @@ -38,6 +38,8 @@ extern "C" { #endif +static_assert(sizeof(godot_rid) == sizeof(RID), "RID size mismatch"); + void GDAPI godot_rid_new(godot_rid *r_dest) { RID *dest = (RID *)r_dest; memnew_placement(dest, RID); diff --git a/modules/gdnative/gdnative/string.cpp b/modules/gdnative/gdnative/string.cpp index a22af89edc..724a4b56cb 100644 --- a/modules/gdnative/gdnative/string.cpp +++ b/modules/gdnative/gdnative/string.cpp @@ -40,6 +40,10 @@ extern "C" { #endif +static_assert(sizeof(godot_char_string) == sizeof(CharString), "CharString size mismatch"); +static_assert(sizeof(godot_string) == sizeof(String), "String size mismatch"); +static_assert(sizeof(godot_char_type) == sizeof(CharType), "CharType size mismatch"); + godot_int GDAPI godot_char_string_length(const godot_char_string *p_cs) { const CharString *cs = (const CharString *)p_cs; diff --git a/modules/gdnative/gdnative/string_name.cpp b/modules/gdnative/gdnative/string_name.cpp index 1abb4486b1..7bbaaeeaa0 100644 --- a/modules/gdnative/gdnative/string_name.cpp +++ b/modules/gdnative/gdnative/string_name.cpp @@ -39,6 +39,8 @@ extern "C" { #endif +static_assert(sizeof(godot_string_name) == sizeof(StringName), "StringName size mismatch"); + void GDAPI godot_string_name_new(godot_string_name *r_dest, const godot_string *p_name) { StringName *dest = (StringName *)r_dest; const String *name = (const String *)p_name; diff --git a/modules/gdnative/gdnative/transform.cpp b/modules/gdnative/gdnative/transform.cpp index c9b3e37fb2..d19de93e9b 100644 --- a/modules/gdnative/gdnative/transform.cpp +++ b/modules/gdnative/gdnative/transform.cpp @@ -37,6 +37,8 @@ extern "C" { #endif +static_assert(sizeof(godot_transform) == sizeof(Transform), "Transform size mismatch"); + void GDAPI godot_transform_new_with_axis_origin(godot_transform *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis, const godot_vector3 *p_origin) { const Vector3 *x_axis = (const Vector3 *)p_x_axis; const Vector3 *y_axis = (const Vector3 *)p_y_axis; diff --git a/modules/gdnative/gdnative/transform2d.cpp b/modules/gdnative/gdnative/transform2d.cpp index 26a71333b1..c0f7878eb0 100644 --- a/modules/gdnative/gdnative/transform2d.cpp +++ b/modules/gdnative/gdnative/transform2d.cpp @@ -37,6 +37,8 @@ extern "C" { #endif +static_assert(sizeof(godot_transform2d) == sizeof(Transform2D), "Transform2D size mismatch"); + void GDAPI godot_transform2d_new(godot_transform2d *r_dest, const godot_real p_rot, const godot_vector2 *p_pos) { const Vector2 *pos = (const Vector2 *)p_pos; Transform2D *dest = (Transform2D *)r_dest; diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp index f0fc44ae8a..29d0f96b97 100644 --- a/modules/gdnative/gdnative/variant.cpp +++ b/modules/gdnative/gdnative/variant.cpp @@ -37,6 +37,8 @@ extern "C" { #endif +static_assert(sizeof(godot_variant) == sizeof(Variant), "Variant size mismatch"); + // Workaround GCC ICE on armv7hl which was affected GCC 6.0 up to 8.0 (GH-16100). // It was fixed upstream in 8.1, and a fix was backported to 7.4. // This can be removed once no supported distro ships with versions older than 7.4. diff --git a/modules/gdnative/gdnative/vector2.cpp b/modules/gdnative/gdnative/vector2.cpp index b6c3569f42..72c3c0ec35 100644 --- a/modules/gdnative/gdnative/vector2.cpp +++ b/modules/gdnative/gdnative/vector2.cpp @@ -37,6 +37,8 @@ extern "C" { #endif +static_assert(sizeof(godot_vector2) == sizeof(Vector2), "Vector2 size mismatch"); + void GDAPI godot_vector2_new(godot_vector2 *r_dest, const godot_real p_x, const godot_real p_y) { Vector2 *dest = (Vector2 *)r_dest; *dest = Vector2(p_x, p_y); diff --git a/modules/gdnative/gdnative/vector3.cpp b/modules/gdnative/gdnative/vector3.cpp index 3e272ae9df..16fbdf353a 100644 --- a/modules/gdnative/gdnative/vector3.cpp +++ b/modules/gdnative/gdnative/vector3.cpp @@ -37,6 +37,8 @@ extern "C" { #endif +static_assert(sizeof(godot_vector3) == sizeof(Vector3), "Vector3 size mismatch"); + void GDAPI godot_vector3_new(godot_vector3 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z) { Vector3 *dest = (Vector3 *)r_dest; *dest = Vector3(p_x, p_y, p_z); diff --git a/modules/gdnative/include/gdnative/pool_arrays.h b/modules/gdnative/include/gdnative/pool_arrays.h index c610377f54..652bd6ae1c 100644 --- a/modules/gdnative/include/gdnative/pool_arrays.h +++ b/modules/gdnative/include/gdnative/pool_arrays.h @@ -39,7 +39,7 @@ extern "C" { /////// PackedByteArray -#define GODOT_PACKED_BYTE_ARRAY_SIZE sizeof(void *) +#define GODOT_PACKED_BYTE_ARRAY_SIZE (2 * sizeof(void *)) #ifndef GODOT_CORE_API_GODOT_PACKED_BYTE_ARRAY_TYPE_DEFINED #define GODOT_CORE_API_GODOT_PACKED_BYTE_ARRAY_TYPE_DEFINED @@ -50,7 +50,7 @@ typedef struct { /////// PackedInt32Array -#define GODOT_PACKED_INT_ARRAY_SIZE sizeof(void *) +#define GODOT_PACKED_INT_ARRAY_SIZE (2 * sizeof(void *)) #ifndef GODOT_CORE_API_GODOT_PACKED_INT_ARRAY_TYPE_DEFINED #define GODOT_CORE_API_GODOT_PACKED_INT_ARRAY_TYPE_DEFINED @@ -61,7 +61,7 @@ typedef struct { /////// PackedFloat32Array -#define GODOT_PACKED_REAL_ARRAY_SIZE sizeof(void *) +#define GODOT_PACKED_REAL_ARRAY_SIZE (2 * sizeof(void *)) #ifndef GODOT_CORE_API_GODOT_PACKED_REAL_ARRAY_TYPE_DEFINED #define GODOT_CORE_API_GODOT_PACKED_REAL_ARRAY_TYPE_DEFINED @@ -72,7 +72,7 @@ typedef struct { /////// PackedStringArray -#define GODOT_PACKED_STRING_ARRAY_SIZE sizeof(void *) +#define GODOT_PACKED_STRING_ARRAY_SIZE (2 * sizeof(void *)) #ifndef GODOT_CORE_API_GODOT_PACKED_STRING_ARRAY_TYPE_DEFINED #define GODOT_CORE_API_GODOT_PACKED_STRING_ARRAY_TYPE_DEFINED @@ -83,7 +83,7 @@ typedef struct { /////// PackedVector2Array -#define GODOT_PACKED_VECTOR2_ARRAY_SIZE sizeof(void *) +#define GODOT_PACKED_VECTOR2_ARRAY_SIZE (2 * sizeof(void *)) #ifndef GODOT_CORE_API_GODOT_PACKED_VECTOR2_ARRAY_TYPE_DEFINED #define GODOT_CORE_API_GODOT_PACKED_VECTOR2_ARRAY_TYPE_DEFINED @@ -94,7 +94,7 @@ typedef struct { /////// PackedVector3Array -#define GODOT_PACKED_VECTOR3_ARRAY_SIZE sizeof(void *) +#define GODOT_PACKED_VECTOR3_ARRAY_SIZE (2 * sizeof(void *)) #ifndef GODOT_CORE_API_GODOT_PACKED_VECTOR3_ARRAY_TYPE_DEFINED #define GODOT_CORE_API_GODOT_PACKED_VECTOR3_ARRAY_TYPE_DEFINED @@ -105,7 +105,7 @@ typedef struct { /////// PackedColorArray -#define GODOT_PACKED_COLOR_ARRAY_SIZE sizeof(void *) +#define GODOT_PACKED_COLOR_ARRAY_SIZE (2 * sizeof(void *)) #ifndef GODOT_CORE_API_GODOT_PACKED_COLOR_ARRAY_TYPE_DEFINED #define GODOT_CORE_API_GODOT_PACKED_COLOR_ARRAY_TYPE_DEFINED diff --git a/modules/gdnative/include/gdnative/rid.h b/modules/gdnative/include/gdnative/rid.h index 04661cedc8..73b601dc04 100644 --- a/modules/gdnative/include/gdnative/rid.h +++ b/modules/gdnative/include/gdnative/rid.h @@ -37,7 +37,7 @@ extern "C" { #include <stdint.h> -#define GODOT_RID_SIZE sizeof(void *) +#define GODOT_RID_SIZE sizeof(uint64_t) #ifndef GODOT_CORE_API_GODOT_RID_TYPE_DEFINED #define GODOT_CORE_API_GODOT_RID_TYPE_DEFINED diff --git a/modules/gdnative/include/gdnative/variant.h b/modules/gdnative/include/gdnative/variant.h index 934e856fbf..682c3e3ba8 100644 --- a/modules/gdnative/include/gdnative/variant.h +++ b/modules/gdnative/include/gdnative/variant.h @@ -37,7 +37,7 @@ extern "C" { #include <stdint.h> -#define GODOT_VARIANT_SIZE (16 + sizeof(void *)) +#define GODOT_VARIANT_SIZE (16 + sizeof(int64_t)) #ifndef GODOT_CORE_API_GODOT_VARIANT_TYPE_DEFINED #define GODOT_CORE_API_GODOT_VARIANT_TYPE_DEFINED diff --git a/modules/gdscript/language_server/lsp.hpp b/modules/gdscript/language_server/lsp.hpp index 44a0076107..cf27a1578c 100644 --- a/modules/gdscript/language_server/lsp.hpp +++ b/modules/gdscript/language_server/lsp.hpp @@ -486,7 +486,7 @@ struct TextDocumentSyncOptions { * If present save notifications are sent to the server. If omitted the notification should not be * sent. */ - SaveOptions save; + bool save = false; Dictionary to_json() { Dictionary dict; @@ -494,7 +494,7 @@ struct TextDocumentSyncOptions { dict["willSave"] = willSave; dict["openClose"] = openClose; dict["change"] = change; - dict["save"] = save.to_json(); + dict["save"] = save; return dict; } }; @@ -1656,7 +1656,7 @@ struct ServerCapabilities { _FORCE_INLINE_ Dictionary to_json() { Dictionary dict; - dict["textDocumentSync"] = (int)textDocumentSync.change; + dict["textDocumentSync"] = textDocumentSync.to_json(); dict["completionProvider"] = completionProvider.to_json(); signatureHelpProvider.triggerCharacters.push_back(","); signatureHelpProvider.triggerCharacters.push_back("("); diff --git a/modules/jsonrpc/jsonrpc.cpp b/modules/jsonrpc/jsonrpc.cpp index 6ab5f2d9b3..7bb70b098f 100644 --- a/modules/jsonrpc/jsonrpc.cpp +++ b/modules/jsonrpc/jsonrpc.cpp @@ -120,7 +120,7 @@ Variant JSONRPC::process_action(const Variant &p_action, bool p_process_arr_elem } if (object == nullptr || !object->has_method(method)) { - ret = make_response_error(JSONRPC::METHOD_NOT_FOUND, "Method not found", id); + ret = make_response_error(JSONRPC::METHOD_NOT_FOUND, "Method not found: " + method, id); } else { Variant call_ret = object->callv(method, args); if (id.get_type() != Variant::NIL) { diff --git a/modules/websocket/register_types.cpp b/modules/websocket/register_types.cpp index 1ad249e1eb..bc50de414e 100644 --- a/modules/websocket/register_types.cpp +++ b/modules/websocket/register_types.cpp @@ -42,9 +42,16 @@ #endif #ifdef TOOLS_ENABLED #include "editor/debugger/editor_debugger_server.h" +#include "editor/editor_node.h" #include "editor_debugger_server_websocket.h" #endif +#ifdef TOOLS_ENABLED +static void _editor_init_callback() { + EditorDebuggerServer::register_protocol_handler("ws://", EditorDebuggerServerWebSocket::create); +} +#endif + void register_websocket_types() { #ifdef JAVASCRIPT_ENABLED EMWSPeer::make_default(); @@ -62,7 +69,7 @@ void register_websocket_types() { ClassDB::register_custom_instance_class<WebSocketPeer>(); #ifdef TOOLS_ENABLED - EditorDebuggerServer::register_protocol_handler("ws://", EditorDebuggerServerWebSocket::create); + EditorNode::add_init_callback(&_editor_init_callback); #endif } diff --git a/platform/android/java/app/config.gradle b/platform/android/java/app/config.gradle index aa98194a10..68ec93ed47 100644 --- a/platform/android/java/app/config.gradle +++ b/platform/android/java/app/config.gradle @@ -4,18 +4,18 @@ ext.versions = [ minSdk : 18, targetSdk : 29, buildTools : '29.0.3', - supportCoreUtils : '28.0.0', + supportCoreUtils : '1.0.0', kotlinVersion : '1.3.61', - v4Support : '28.0.0' + v4Support : '1.0.0' ] ext.libraries = [ androidGradlePlugin: "com.android.tools.build:gradle:$versions.androidGradlePlugin", - supportCoreUtils : "com.android.support:support-core-utils:$versions.supportCoreUtils", + supportCoreUtils : "androidx.legacy:legacy-support-core-utils:$versions.supportCoreUtils", kotlinGradlePlugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlinVersion", kotlinStdLib : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$versions.kotlinVersion", - v4Support : "com.android.support:support-v4:$versions.v4Support" + v4Support : "androidx.legacy:legacy-support-v4:$versions.v4Support" ] ext.getExportPackageName = { -> diff --git a/platform/android/java/gradle.properties b/platform/android/java/gradle.properties index aac7c9b461..e14cd5ba5c 100644 --- a/platform/android/java/gradle.properties +++ b/platform/android/java/gradle.properties @@ -7,6 +7,9 @@ # For more details on how to configure your build environment visit # http://www.gradle.org/docs/current/userguide/build_environment.html +android.enableJetifier=true +android.useAndroidX=true + # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. org.gradle.jvmargs=-Xmx1536m diff --git a/platform/android/java/lib/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java b/platform/android/java/lib/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java index 0abaf2e052..d481c22204 100644 --- a/platform/android/java/lib/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java +++ b/platform/android/java/lib/src/com/google/android/vending/expansion/downloader/impl/DownloadNotification.java @@ -29,9 +29,9 @@ import com.google.android.vending.expansion.downloader.IDownloaderClient; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; -import android.os.Build; import android.os.Messenger; -import android.support.v4.app.NotificationCompat; + +import androidx.core.app.NotificationCompat; /** * This class handles displaying the notification associated with the download diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.java b/platform/android/java/lib/src/org/godotengine/godot/Godot.java index cc9c7a9652..f27d8620ec 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.java @@ -66,10 +66,6 @@ import android.os.Messenger; import android.os.VibrationEffect; import android.os.Vibrator; import android.provider.Settings.Secure; -import android.support.annotation.CallSuper; -import android.support.annotation.Keep; -import android.support.annotation.NonNull; -import android.support.v4.app.FragmentActivity; import android.view.Display; import android.view.KeyEvent; import android.view.MotionEvent; @@ -85,6 +81,11 @@ import android.widget.FrameLayout; import android.widget.ProgressBar; import android.widget.TextView; +import androidx.annotation.CallSuper; +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import androidx.fragment.app.FragmentActivity; + import com.google.android.vending.expansion.downloader.DownloadProgressInfo; import com.google.android.vending.expansion.downloader.DownloaderClientMarshaller; import com.google.android.vending.expansion.downloader.DownloaderServiceMarshaller; diff --git a/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java b/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java index a8146a1332..431bd4f5f9 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java +++ b/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java @@ -35,13 +35,13 @@ import org.godotengine.godot.Godot; import android.app.Activity; import android.content.Intent; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.text.TextUtils; import android.util.Log; import android.view.Surface; import android.view.View; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collections; diff --git a/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPluginRegistry.java b/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPluginRegistry.java index bb11300861..17f5a7469e 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPluginRegistry.java +++ b/platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPluginRegistry.java @@ -35,13 +35,13 @@ import org.godotengine.godot.Godot; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.os.Bundle; -import android.support.annotation.Nullable; import android.text.TextUtils; import android.util.Log; +import androidx.annotation.Nullable; + import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; -import java.util.Arrays; import java.util.Collection; import java.util.HashSet; import java.util.Set; diff --git a/platform/android/java/lib/src/org/godotengine/godot/plugin/SignalInfo.java b/platform/android/java/lib/src/org/godotengine/godot/plugin/SignalInfo.java index 71523d8c27..f82c4d3fa0 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/plugin/SignalInfo.java +++ b/platform/android/java/lib/src/org/godotengine/godot/plugin/SignalInfo.java @@ -30,9 +30,10 @@ package org.godotengine.godot.plugin; -import android.support.annotation.NonNull; import android.text.TextUtils; +import androidx.annotation.NonNull; + import java.util.Arrays; /** diff --git a/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java b/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java index c34e4c18db..6837e4f147 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java +++ b/platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java @@ -37,9 +37,10 @@ import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PermissionInfo; import android.os.Build; -import android.support.v4.content.ContextCompat; import android.util.Log; +import androidx.core.content.ContextCompat; + import java.util.ArrayList; import java.util.List; diff --git a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/GodotPayment.java b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/GodotPayment.java index 6f76007e1e..ded7f0a9aa 100644 --- a/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/GodotPayment.java +++ b/platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/GodotPayment.java @@ -36,9 +36,10 @@ import org.godotengine.godot.GodotLib; import org.godotengine.godot.plugin.GodotPlugin; import android.content.Intent; -import android.support.annotation.NonNull; import android.util.Log; +import androidx.annotation.NonNull; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm index 1cdcdbcaf5..9a1191490c 100644 --- a/platform/osx/display_server_osx.mm +++ b/platform/osx/display_server_osx.mm @@ -278,13 +278,17 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) { } - (BOOL)windowShouldClose:(id)sender { - ERR_FAIL_COND_V(!DS_OSX->windows.has(window_id), YES); + if (!DS_OSX || !DS_OSX->windows.has(window_id)) { + return YES; + } DS_OSX->_send_window_event(DS_OSX->windows[window_id], DisplayServerOSX::WINDOW_EVENT_CLOSE_REQUEST); return NO; } - (void)windowWillClose:(NSNotification *)notification { - ERR_FAIL_COND(!DS_OSX->windows.has(window_id)); + if (!DS_OSX || !DS_OSX->windows.has(window_id)) { + return; + } DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id]; while (wd.transient_children.size()) { @@ -310,7 +314,9 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) { } - (void)windowDidEnterFullScreen:(NSNotification *)notification { - ERR_FAIL_COND(!DS_OSX->windows.has(window_id)); + if (!DS_OSX || !DS_OSX->windows.has(window_id)) { + return; + } DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id]; wd.fullscreen = true; @@ -320,8 +326,9 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) { } - (void)windowDidExitFullScreen:(NSNotification *)notification { - if (!DS_OSX || !DS_OSX->windows.has(window_id)) + if (!DS_OSX || !DS_OSX->windows.has(window_id)) { return; + } DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id]; wd.fullscreen = false; @@ -383,8 +390,9 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) { } - (void)windowDidResize:(NSNotification *)notification { - if (!DS_OSX || !DS_OSX->windows.has(window_id)) + if (!DS_OSX || !DS_OSX->windows.has(window_id)) { return; + } DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id]; #if defined(OPENGL_ENABLED) @@ -425,11 +433,26 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) { } - (void)windowDidMove:(NSNotification *)notification { + if (!DS_OSX || !DS_OSX->windows.has(window_id)) { + return; + } + DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id]; + DS_OSX->_release_pressed_events(); + + if (!wd.rect_changed_callback.is_null()) { + Variant size = Rect2i(DS_OSX->window_get_position(window_id), DS_OSX->window_get_size(window_id)); + Variant *sizep = &size; + Variant ret; + Callable::CallError ce; + wd.rect_changed_callback.call((const Variant **)&sizep, 1, ret, ce); + } } - (void)windowDidBecomeKey:(NSNotification *)notification { - ERR_FAIL_COND(!DS_OSX->windows.has(window_id)); + if (!DS_OSX || !DS_OSX->windows.has(window_id)) { + return; + } DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id]; const CGFloat backingScaleFactor = (OS::get_singleton()->is_hidpi_allowed()) ? [wd.window_view backingScaleFactor] : 1.0; @@ -441,7 +464,9 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) { } - (void)windowDidResignKey:(NSNotification *)notification { - ERR_FAIL_COND(!DS_OSX->windows.has(window_id)); + if (!DS_OSX || !DS_OSX->windows.has(window_id)) { + return; + } DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id]; DS_OSX->window_focused = false; @@ -451,7 +476,9 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) { } - (void)windowDidMiniaturize:(NSNotification *)notification { - ERR_FAIL_COND(!DS_OSX->windows.has(window_id)); + if (!DS_OSX || !DS_OSX->windows.has(window_id)) { + return; + } DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id]; DS_OSX->window_focused = false; @@ -461,7 +488,9 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) { } - (void)windowDidDeminiaturize:(NSNotification *)notification { - ERR_FAIL_COND(!DS_OSX->windows.has(window_id)); + if (!DS_OSX || !DS_OSX->windows.has(window_id)) { + return; + } DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id]; DS_OSX->window_focused = true; @@ -2148,7 +2177,7 @@ Rect2i DisplayServerOSX::screen_get_usable_rect(int p_screen) const { Point2i position = Point2i(nsrect.origin.x, nsrect.origin.y + nsrect.size.height) * displayScale - _get_screens_origin(); position.y *= -1; - Size2i size = Size2i(nsrect.size.width, nsrect.size.height) / displayScale; + Size2i size = Size2i(nsrect.size.width, nsrect.size.height) * displayScale; return Rect2i(position, size); } diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 114b64855e..14116d6f23 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -1695,6 +1695,12 @@ void DisplayServerWindows::_dispatch_input_events(const Ref<InputEvent> &p_event } void DisplayServerWindows::_dispatch_input_event(const Ref<InputEvent> &p_event) { + _THREAD_SAFE_METHOD_ + if (in_dispatch_input_event) { + return; + } + + in_dispatch_input_event = true; Variant ev = p_event; Variant *evp = &ev; Variant ret; @@ -1706,6 +1712,7 @@ void DisplayServerWindows::_dispatch_input_event(const Ref<InputEvent> &p_event) ERR_FAIL_COND(!windows.has(event_from_window->get_window_id())); Callable callable = windows[event_from_window->get_window_id()].input_event_callback; if (callable.is_null()) { + in_dispatch_input_event = false; return; } callable.call((const Variant **)&evp, 1, ret, ce); @@ -1719,6 +1726,8 @@ void DisplayServerWindows::_dispatch_input_event(const Ref<InputEvent> &p_event) callable.call((const Variant **)&evp, 1, ret, ce); } } + + in_dispatch_input_event = false; } LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h index ea08b1899f..f8606bb492 100644 --- a/platform/windows/display_server_windows.h +++ b/platform/windows/display_server_windows.h @@ -388,6 +388,7 @@ class DisplayServerWindows : public DisplayServer { uint32_t last_button_state = 0; bool use_raw_input = false; bool drop_events = false; + bool in_dispatch_input_event = false; bool console_visible = false; WNDCLASSEXW wc; diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 5489638125..5080ba74e2 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -768,9 +768,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { if (mm.is_valid() && dragging) { just_selected = true; - // TODO: Remove local mouse pos hack if/when InputEventMouseMotion is fixed to support floats - //drag_accum+=Vector2(mm->get_relative().x,mm->get_relative().y); - drag_accum = get_local_mouse_position() - drag_origin; + drag_accum += mm->get_relative(); for (int i = get_child_count() - 1; i >= 0; i--) { GraphNode *gn = Object::cast_to<GraphNode>(get_child(i)); if (gn && gn->is_selected()) { @@ -789,7 +787,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { } if (mm.is_valid() && box_selecting) { - box_selecting_to = get_local_mouse_position(); + box_selecting_to = mm->get_position(); box_selecting_rect = Rect2(MIN(box_selecting_from.x, box_selecting_to.x), MIN(box_selecting_from.y, box_selecting_to.y), @@ -849,7 +847,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { if (gn) { Rect2 r = gn->get_rect(); r.size *= zoom; - if (r.has_point(get_local_mouse_position())) { + if (r.has_point(b->get_position())) { gn->set_selected(false); } } @@ -887,7 +885,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { continue; } - if (gn_selected->has_point(gn_selected->get_local_mouse_position())) { + if (gn_selected->has_point(b->get_position() - gn_selected->get_position())) { gn = gn_selected; break; } @@ -901,7 +899,6 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { dragging = true; drag_accum = Vector2(); - drag_origin = get_local_mouse_position(); just_selected = !gn->is_selected(); if (!gn->is_selected() && !Input::get_singleton()->is_key_pressed(KEY_CONTROL)) { for (int i = 0; i < get_child_count(); i++) { @@ -939,7 +936,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { } box_selecting = true; - box_selecting_from = get_local_mouse_position(); + box_selecting_from = b->get_position(); if (b->get_control()) { box_selection_mode_additive = true; previus_selected.clear(); diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h index 8cfc5d32b9..c632490855 100644 --- a/scene/gui/graph_edit.h +++ b/scene/gui/graph_edit.h @@ -97,7 +97,6 @@ private: bool dragging; bool just_selected; Vector2 drag_accum; - Point2 drag_origin; // Workaround for GH-5907 float zoom; diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 52aee8f089..932dda2f9d 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1121,9 +1121,7 @@ void TextEdit::_notification(int p_what) { int ofs_y = (i * get_row_height() + cache.line_spacing / 2) + ofs_readonly; ofs_y -= cursor.wrap_ofs * get_row_height(); - if (smooth_scroll_enabled) { - ofs_y += (-get_v_scroll_offset()) * get_row_height(); - } + ofs_y -= get_v_scroll_offset() * get_row_height(); // Check if line contains highlighted word. int highlighted_text_col = -1; diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 6565f02503..a9be8a1eff 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -992,7 +992,7 @@ void Window::popup_centered_ratio(float p_ratio) { ERR_FAIL_COND(!is_inside_tree()); ERR_FAIL_COND_MSG(window_id == DisplayServer::MAIN_WINDOW_ID, "Can't popup the main window."); - Rect2i parent_rect; + Rect2 parent_rect; if (is_embedded()) { parent_rect = get_parent_viewport()->get_visible_rect(); @@ -1024,6 +1024,15 @@ void Window::popup(const Rect2i &p_screen_rect) { set_size(adjust.size); } + int scr = DisplayServer::get_singleton()->get_screen_count(); + for (int i = 0; i < scr; i++) { + Rect2i r = DisplayServer::get_singleton()->screen_get_usable_rect(i); + if (r.has_point(position)) { + current_screen = i; + break; + } + } + set_transient(true); set_visible(true); _post_popup(); diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 67617a946f..f5b987e8df 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -52,20 +52,9 @@ static Ref<StyleBoxTexture> make_stylebox(T p_src, float p_left, float p_top, fl } else { texture = Ref<ImageTexture>(memnew(ImageTexture)); Ref<Image> img = memnew(Image(p_src)); - - if (scale > 1) { - Size2 orig_size = Size2(img->get_width(), img->get_height()); - - img->convert(Image::FORMAT_RGBA8); - img->expand_x2_hq2x(); - if (scale != 2.0) { - img->resize(orig_size.x * scale, orig_size.y * scale); - } - } else if (scale < 1) { - Size2 orig_size = Size2(img->get_width(), img->get_height()); - img->convert(Image::FORMAT_RGBA8); - img->resize(orig_size.x * scale, orig_size.y * scale); - } + const Size2 orig_size = Size2(img->get_width(), img->get_height()); + img->convert(Image::FORMAT_RGBA8); + img->resize(orig_size.x * scale, orig_size.y * scale); texture->create_from_image(img); (*tex_cache)[p_src] = texture; @@ -98,19 +87,9 @@ template <class T> static Ref<Texture2D> make_icon(T p_src) { Ref<ImageTexture> texture(memnew(ImageTexture)); Ref<Image> img = memnew(Image(p_src)); - if (scale > 1) { - Size2 orig_size = Size2(img->get_width(), img->get_height()); - - img->convert(Image::FORMAT_RGBA8); - img->expand_x2_hq2x(); - if (scale != 2.0) { - img->resize(orig_size.x * scale, orig_size.y * scale); - } - } else if (scale < 1) { - Size2 orig_size = Size2(img->get_width(), img->get_height()); - img->convert(Image::FORMAT_RGBA8); - img->resize(orig_size.x * scale, orig_size.y * scale); - } + const Size2 orig_size = Size2(img->get_width(), img->get_height()); + img->convert(Image::FORMAT_RGBA8); + img->resize(orig_size.x * scale, orig_size.y * scale); texture->create_from_image(img); return texture; diff --git a/thirdparty/README.md b/thirdparty/README.md index c000133fe7..821026e96a 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -386,7 +386,7 @@ Collection of single-file libraries used in Godot components. * License: Apache 2.0 - `r128.h` * Upstream: https://github.com/fahickman/r128 - * Version: 1.4.3 (2019) + * Version: git (423f693617faafd01de21e92818add4208eb8bd1, 2020) * License: Public Domain - `smaz.{c,h}` * Upstream: https://github.com/antirez/smaz diff --git a/thirdparty/misc/hq2x.cpp b/thirdparty/misc/hq2x.cpp deleted file mode 100644 index 9c089ba85c..0000000000 --- a/thirdparty/misc/hq2x.cpp +++ /dev/null @@ -1,2636 +0,0 @@ -/* - * Copyright 2016 Bruno Ribeiro - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include "hq2x.h" - -#include "core/math/math_funcs.h" - -static const uint32_t AMASK = 0xFF000000; -static const uint32_t YMASK = 0x00FF0000; -static const uint32_t UMASK = 0x0000FF00; -static const uint32_t VMASK = 0x000000FF; - -_FORCE_INLINE_ static uint32_t ARGBtoAYUV( - uint32_t value ) -{ - uint32_t A, R, G, B, Y, U, V; -//todo big endian check - A = value >> 24; - R = (value >> 16) & 0xFF; - G = (value >> 8) & 0xFF; - B = value & 0xFF; - - Y = Math::fast_ftoi( 0.299 * R + 0.587 * G + 0.114 * B); - U = Math::fast_ftoi(-0.169 * R - 0.331 * G + 0.5 * B) + 128; - V = Math::fast_ftoi( 0.5 * R - 0.419 * G - 0.081 * B) + 128; - return (A << 24) + (Y << 16) + (U << 8) + V; -} - - -/* - * Use this function for sharper images (good for cartoon style, used by DOSBOX) - */ - -_FORCE_INLINE_ static bool isDifferent( - uint32_t color1, - uint32_t color2, - uint32_t trY, - uint32_t trU, - uint32_t trV, - uint32_t trA ) -{ - color1 = ARGBtoAYUV(color1); - color2 = ARGBtoAYUV(color2); - - uint32_t value; - - value = ((color1 & YMASK) - (color2 & YMASK)); - value = (value ^ (value >> 31)) - (value >> 31); - if (value > trY) return true; - - value = ((color1 & UMASK) - (color2 & UMASK)); - value = (value ^ (value >> 31)) - (value >> 31); - if (value > trU) return true; - - value = ((color1 & VMASK) - (color2 & VMASK)); - value = (value ^ (value >> 31)) - (value >> 31); - if (value > trV) return true; - - value = ((color1 & AMASK) - (color2 & AMASK)); - value = (value ^ (value >> 31)) - (value >> 31); - if (value > trA) return true; - - return false; - -} - - - -#define MASK_RB 0x00FF00FF -#define MASK_G 0x0000FF00 -#define MASK_A 0xFF000000 - - -/** - * @brief Mixes two colors using the given weights. - */ -#define HQX_MIX_2(C0,C1,W0,W1) \ - ((((C0 & MASK_RB) * W0 + (C1 & MASK_RB) * W1) / (W0 + W1)) & MASK_RB) | \ - ((((C0 & MASK_G) * W0 + (C1 & MASK_G) * W1) / (W0 + W1)) & MASK_G) | \ - ((((((C0 & MASK_A) >> 8) * W0 + ((C1 & MASK_A) >> 8) * W1) / (W0 + W1)) << 8) & MASK_A) - -/** - * @brief Mixes three colors using the given weights. - */ -#define HQX_MIX_3(C0,C1,C2,W0,W1,W2) \ - ((((C0 & MASK_RB) * W0 + (C1 & MASK_RB) * W1 + (C2 & MASK_RB) * W2) / (W0 + W1 + W2)) & MASK_RB) | \ - ((((C0 & MASK_G) * W0 + (C1 & MASK_G) * W1 + (C2 & MASK_G) * W2) / (W0 + W1 + W2)) & MASK_G) | \ - ((((((C0 & MASK_A) >> 8) * W0 + ((C1 & MASK_A) >> 8) * W1 + ((C2 & MASK_A) >> 8) * W2) / (W0 + W1 + W2)) << 8) & MASK_A) - - -#define MIX_00_4 *output = w[4]; -#define MIX_00_MIX_00_4_0_3_1 *output = HQX_MIX_2(w[4],w[0],3U,1U); -#define MIX_00_4_3_3_1 *output = HQX_MIX_2(w[4],w[3],3U,1U); -#define MIX_00_4_1_3_1 *output = HQX_MIX_2(w[4],w[1],3U,1U); -#define MIX_00_3_1_1_1 *output = HQX_MIX_2(w[3],w[1],1U,1U); -#define MIX_00_4_3_1_2_1_1 *output = HQX_MIX_3(w[4],w[3],w[1],2U,1U,1U); -#define MIX_00_4_3_1_2_7_7 *output = HQX_MIX_3(w[4],w[3],w[1],2U,7U,7U); -#define MIX_00_4_0_1_2_1_1 *output = HQX_MIX_3(w[4],w[0],w[1],2U,1U,1U); -#define MIX_00_4_0_3_2_1_1 *output = HQX_MIX_3(w[4],w[0],w[3],2U,1U,1U); -#define MIX_00_4_1_3_5_2_1 *output = HQX_MIX_3(w[4],w[1],w[3],5U,2U,1U); -#define MIX_00_4_3_1_5_2_1 *output = HQX_MIX_3(w[4],w[3],w[1],5U,2U,1U); -#define MIX_00_4_3_1_6_1_1 *output = HQX_MIX_3(w[4],w[3],w[1],6U,1U,1U); -#define MIX_00_4_3_1_2_3_3 *output = HQX_MIX_3(w[4],w[3],w[1],2U,3U,3U); -#define MIX_00_MIX_00_4_0_3_10 *output = HQX_MIX_3(w[4],w[3],w[1],14U,1U,1U); - -#define MIX_01_4 *(output + 1) = w[4]; -#define MIX_01_4_2_3_1 *(output + 1) = HQX_MIX_2(w[4],w[2],3U,1U); -#define MIX_01_4_1_3_1 *(output + 1) = HQX_MIX_2(w[4],w[1],3U,1U); -#define MIX_01_1_4_3_1 *(output + 1) = HQX_MIX_2(w[1],w[4],3U,1U); -#define MIX_01_4_5_3_1 *(output + 1) = HQX_MIX_2(w[4],w[5],3U,1U); -#define MIX_01_4_1_7_1 *(output + 1) = HQX_MIX_2(w[4],w[1],7U,1U); -#define MIX_01_4_1_5_2_1_1 *(output + 1) = HQX_MIX_3(w[4],w[1],w[5],2U,1U,1U); -#define MIX_01_4_2_5_2_1_1 *(output + 1) = HQX_MIX_3(w[4],w[2],w[5],2U,1U,1U); -#define MIX_01_4_2_1_2_1_1 *(output + 1) = HQX_MIX_3(w[4],w[2],w[1],2U,1U,1U); -#define MIX_01_4_5_1_5_2_1 *(output + 1) = HQX_MIX_3(w[4],w[5],w[1],5U,2U,1U); -#define MIX_01_4_1_5_5_2_1 *(output + 1) = HQX_MIX_3(w[4],w[1],w[5],5U,2U,1U); -#define MIX_01_4_1_5_6_1_1 *(output + 1) = HQX_MIX_3(w[4],w[1],w[5],6U,1U,1U); -#define MIX_01_4_1_5_2_3_3 *(output + 1) = HQX_MIX_3(w[4],w[1],w[5],2U,3U,3U); -#define MIX_01_4_2_3_10 *(output + 1) = HQX_MIX_3(w[4],w[1],w[5],14U,1U,1U); - -#define MIX_02_4 *(output + 2) = w[4]; -#define MIX_02_4_2_3_1 *(output + 2) = HQX_MIX_2(w[4],w[2],3U,1U); -#define MIX_02_4_1_3_1 *(output + 2) = HQX_MIX_2(w[4],w[1],3U,1U); -#define MIX_02_4_5_3_1 *(output + 2) = HQX_MIX_2(w[4],w[5],3U,1U); -#define MIX_02_4_1_5_2_1_1 *(output + 2) = HQX_MIX_3(w[4],w[1],w[5],2U,1U,1U); -#define MIX_02_4_1_5_2_7_7 *(output + 2) = HQX_MIX_3(w[4],w[1],w[5],2U,7U,7U); -#define MIX_02_1_5_1_1 *(output + 2) = HQX_MIX_2(w[1],w[5],1U,1U); - -#define MIX_10_4 *(output + lineSize) = w[4]; -#define MIX_10_4_6_3_1 *(output + lineSize) = HQX_MIX_2(w[4],w[6],3U,1U); -#define MIX_10_4_7_3_1 *(output + lineSize) = HQX_MIX_2(w[4],w[7],3U,1U); -#define MIX_10_4_3_3_1 *(output + lineSize) = HQX_MIX_2(w[4],w[3],3U,1U); -#define MIX_10_4_7_3_2_1_1 *(output + lineSize) = HQX_MIX_3(w[4],w[7],w[3],2U,1U,1U); -#define MIX_10_4_6_3_2_1_1 *(output + lineSize) = HQX_MIX_3(w[4],w[6],w[3],2U,1U,1U); -#define MIX_10_4_6_7_2_1_1 *(output + lineSize) = HQX_MIX_3(w[4],w[6],w[7],2U,1U,1U); -#define MIX_10_4_3_7_5_2_1 *(output + lineSize) = HQX_MIX_3(w[4],w[3],w[7],5U,2U,1U); -#define MIX_10_4_7_3_5_2_1 *(output + lineSize) = HQX_MIX_3(w[4],w[7],w[3],5U,2U,1U); -#define MIX_10_4_7_3_6_1_1 *(output + lineSize) = HQX_MIX_3(w[4],w[7],w[3],6U,1U,1U); -#define MIX_10_4_7_3_2_3_3 *(output + lineSize) = HQX_MIX_3(w[4],w[7],w[3],2U,3U,3U); -#define MIX_10_4_6_3_10 *(output + lineSize) = HQX_MIX_3(w[4],w[7],w[3],14U,1U,1U); -#define MIX_10_4_3_7_1 *(output + lineSize) = HQX_MIX_2(w[4],w[3],7U,1U); -#define MIX_10_3_4_3_1 *(output + lineSize) = HQX_MIX_2(w[3],w[4],3U,1U); - -#define MIX_11_4 *(output + lineSize + 1) = w[4]; -#define MIX_11_4_8_3_1 *(output + lineSize + 1) = HQX_MIX_2(w[4],w[8],3U,1U); -#define MIX_11_4_5_3_1 *(output + lineSize + 1) = HQX_MIX_2(w[4],w[5],3U,1U); -#define MIX_11_4_7_3_1 *(output + lineSize + 1) = HQX_MIX_2(w[4],w[7],3U,1U); -#define MIX_11_4_5_7_2_1_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[5],w[7],2U,1U,1U); -#define MIX_11_4_8_7_2_1_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[8],w[7],2U,1U,1U); -#define MIX_11_4_8_5_2_1_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[8],w[5],2U,1U,1U); -#define MIX_11_4_7_5_5_2_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[7],w[5],5U,2U,1U); -#define MIX_11_4_5_7_5_2_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[5],w[7],5U,2U,1U); -#define MIX_11_4_5_7_6_1_1 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[5],w[7],6U,1U,1U); -#define MIX_11_4_5_7_2_3_3 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[5],w[7],2U,3U,3U); -#define MIX_11_4_8_3_10 *(output + lineSize + 1) = HQX_MIX_3(w[4],w[5],w[7],14U,1U,1U); - -#define MIX_12_4 *(output + lineSize + 2) = w[4]; -#define MIX_12_4_5_3_1 *(output + lineSize + 2) = HQX_MIX_2(w[4],w[5],3U,1U); -#define MIX_12_4_5_7_1 *(output + lineSize + 2) = HQX_MIX_2(w[4],w[5],7U,1U); -#define MIX_12_5_4_3_1 *(output + lineSize + 2) = HQX_MIX_2(w[5],w[4],3U,1U); - -#define MIX_20_4 *(output + lineSize + lineSize) = w[4]; -#define MIX_20_4_6_3_1 *(output + lineSize + lineSize) = HQX_MIX_2(w[4],w[6],3U,1U); -#define MIX_20_4_7_3_1 *(output + lineSize + lineSize) = HQX_MIX_2(w[4],w[7],3U,1U); -#define MIX_20_4_3_3_1 *(output + lineSize + lineSize) = HQX_MIX_2(w[4],w[3],3U,1U); -#define MIX_20_4_7_3_2_1_1 *(output + lineSize + lineSize) = HQX_MIX_3(w[4],w[7],w[3],2U,1U,1U); -#define MIX_20_4_7_3_2_7_7 *(output + lineSize + lineSize) = HQX_MIX_3(w[4],w[7],w[3],2U,7U,7U); -#define MIX_20_7_3_1_1 *(output + lineSize + lineSize) = HQX_MIX_2(w[7],w[3],1U,1U); - -#define MIX_21_4 *(output + lineSize + lineSize + 1) = w[4]; -#define MIX_21_4_7_3_1 *(output + lineSize + lineSize + 1) = HQX_MIX_2(w[4],w[7],3U,1U); -#define MIX_21_4_7_7_1 *(output + lineSize + lineSize + 1) = HQX_MIX_2(w[4],w[7],7U,1U); -#define MIX_21_7_4_3_1 *(output + lineSize + lineSize + 1) = HQX_MIX_2(w[7],w[4],3U,1U); - -#define MIX_22_4 *(output + lineSize + lineSize + 2) = w[4]; -#define MIX_22_4_8_3_1 *(output + lineSize + lineSize + 2) = HQX_MIX_2(w[4],w[8],3U,1U); -#define MIX_22_4_7_3_1 *(output + lineSize + lineSize + 2) = HQX_MIX_2(w[4],w[7],3U,1U); -#define MIX_22_4_5_3_1 *(output + lineSize + lineSize + 2) = HQX_MIX_2(w[4],w[5],3U,1U); -#define MIX_22_4_5_7_2_1_1 *(output + lineSize + lineSize + 2) = HQX_MIX_3(w[4],w[5],w[7],2U,1U,1U); -#define MIX_22_4_5_7_2_7_7 *(output + lineSize + lineSize + 2) = HQX_MIX_3(w[4],w[5],w[7],2U,7U,7U); -#define MIX_22_5_7_1_1 *(output + lineSize + lineSize + 2) = HQX_MIX_2(w[5],w[7],1U,1U); - - - -uint32_t *hq2x_resize( - const uint32_t *image, - uint32_t width, - uint32_t height, - uint32_t *output, - uint32_t trY, - uint32_t trU, - uint32_t trV, - uint32_t trA, - bool wrapX, - bool wrapY ) -{ - int lineSize = width * 2; - - int previous, next; - uint32_t w[9]; - - trY <<= 16; - trU <<= 8; - trA <<= 24; - - // iterates between the lines - for (uint32_t row = 0; row < height; row++) - { - /* - * Note: this function uses a 3x3 sliding window over the original image. - * - * +----+----+----+ - * | | | | - * | w0 | w1 | w2 | - * +----+----+----+ - * | | | | - * | w3 | w4 | w5 | - * +----+----+----+ - * | | | | - * | w6 | w7 | w8 | - * +----+----+----+ - */ - - // adjusts the previous and next line pointers - if (row > 0) - previous = -width; - else - { - if (wrapY) - previous = width * (height - 1); - else - previous = 0; - } - if (row < height - 1) - next = width; - else - { - if (wrapY) - next = -(width * (height - 1)); - else - next = 0; - } - - // iterates between the columns - for (uint32_t col = 0; col < width; col++) - { - w[1] = *(image + previous); - w[4] = *image; - w[7] = *(image + next); - - if (col > 0) - { - w[0] = *(image + previous - 1); - w[3] = *(image - 1); - w[6] = *(image + next - 1); - } - else - { - if (wrapX) - { - w[0] = *(image + previous + width - 1); - w[3] = *(image + width - 1); - w[6] = *(image + next + width - 1); - } - else - { - w[0] = w[1]; - w[3] = w[4]; - w[6] = w[7]; - } - } - - if (col < width - 1) - { - w[2] = *(image + previous + 1); - w[5] = *(image + 1); - w[8] = *(image + next + 1); - } - else - { - if (wrapX) - { - w[2] = *(image + previous - width + 1); - w[5] = *(image - width + 1); - w[8] = *(image + next - width + 1); - } - else - { - w[2] = w[1]; - w[5] = w[4]; - w[8] = w[7]; - } - } - - int pattern = 0; - - // computes the pattern to be used considering the neighbor pixels - for (int k = 0, flag = 1; k < 9; k++) - { - // ignores the central pixel - if (k == 4) continue; - - if (w[k] != w[4]) - if (isDifferent(w[4], w[k], trY, trU, trV, trA)) pattern |= flag; - flag <<= 1; - } - - switch (pattern) - { - case 0: - case 1: - case 4: - case 32: - case 128: - case 5: - case 132: - case 160: - case 33: - case 129: - case 36: - case 133: - case 164: - case 161: - case 37: - case 165: - MIX_00_4_3_1_2_1_1 - MIX_01_4_1_5_2_1_1 - MIX_10_4_7_3_2_1_1 - MIX_11_4_5_7_2_1_1 - break; - case 2: - case 34: - case 130: - case 162: - MIX_00_4_0_3_2_1_1 - MIX_01_4_2_5_2_1_1 - MIX_10_4_7_3_2_1_1 - MIX_11_4_5_7_2_1_1 - break; - case 16: - case 17: - case 48: - case 49: - MIX_00_4_3_1_2_1_1 - MIX_01_4_2_1_2_1_1 - MIX_10_4_7_3_2_1_1 - MIX_11_4_8_7_2_1_1 - break; - case 64: - case 65: - case 68: - case 69: - MIX_00_4_3_1_2_1_1 - MIX_01_4_1_5_2_1_1 - MIX_10_4_6_3_2_1_1 - MIX_11_4_8_5_2_1_1 - break; - case 8: - case 12: - case 136: - case 140: - MIX_00_4_0_1_2_1_1 - MIX_01_4_1_5_2_1_1 - MIX_10_4_6_7_2_1_1 - MIX_11_4_5_7_2_1_1 - break; - case 3: - case 35: - case 131: - case 163: - MIX_00_4_3_3_1 - MIX_01_4_2_5_2_1_1 - MIX_10_4_7_3_2_1_1 - MIX_11_4_5_7_2_1_1 - break; - case 6: - case 38: - case 134: - case 166: - MIX_00_4_0_3_2_1_1 - MIX_01_4_5_3_1 - MIX_10_4_7_3_2_1_1 - MIX_11_4_5_7_2_1_1 - break; - case 20: - case 21: - case 52: - case 53: - MIX_00_4_3_1_2_1_1 - MIX_01_4_1_3_1 - MIX_10_4_7_3_2_1_1 - MIX_11_4_8_7_2_1_1 - break; - case 144: - case 145: - case 176: - case 177: - MIX_00_4_3_1_2_1_1 - MIX_01_4_2_1_2_1_1 - MIX_10_4_7_3_2_1_1 - MIX_11_4_7_3_1 - break; - case 192: - case 193: - case 196: - case 197: - MIX_00_4_3_1_2_1_1 - MIX_01_4_1_5_2_1_1 - MIX_10_4_6_3_2_1_1 - MIX_11_4_5_3_1 - break; - case 96: - case 97: - case 100: - case 101: - MIX_00_4_3_1_2_1_1 - MIX_01_4_1_5_2_1_1 - MIX_10_4_3_3_1 - MIX_11_4_8_5_2_1_1 - break; - case 40: - case 44: - case 168: - case 172: - MIX_00_4_0_1_2_1_1 - MIX_01_4_1_5_2_1_1 - MIX_10_4_7_3_1 - MIX_11_4_5_7_2_1_1 - break; - case 9: - case 13: - case 137: - case 141: - MIX_00_4_1_3_1 - MIX_01_4_1_5_2_1_1 - MIX_10_4_6_7_2_1_1 - MIX_11_4_5_7_2_1_1 - break; - case 18: - case 50: - MIX_00_4_0_3_2_1_1 - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4_2_3_1 - } - else - { - MIX_01_4_1_5_2_1_1 - } - MIX_10_4_7_3_2_1_1 - MIX_11_4_8_7_2_1_1 - break; - case 80: - case 81: - MIX_00_4_3_1_2_1_1 - MIX_01_4_2_1_2_1_1 - MIX_10_4_6_3_2_1_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4_8_3_1 - } - else - { - MIX_11_4_5_7_2_1_1 - } - break; - case 72: - case 76: - MIX_00_4_0_1_2_1_1 - MIX_01_4_1_5_2_1_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4_6_3_1 - } - else - { - MIX_10_4_7_3_2_1_1 - } - MIX_11_4_8_5_2_1_1 - break; - case 10: - case 138: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_MIX_00_4_0_3_1 - } - else - { - MIX_00_4_3_1_2_1_1 - } - MIX_01_4_2_5_2_1_1 - MIX_10_4_6_7_2_1_1 - MIX_11_4_5_7_2_1_1 - break; - case 66: - MIX_00_4_0_3_2_1_1 - MIX_01_4_2_5_2_1_1 - MIX_10_4_6_3_2_1_1 - MIX_11_4_8_5_2_1_1 - break; - case 24: - MIX_00_4_0_1_2_1_1 - MIX_01_4_2_1_2_1_1 - MIX_10_4_6_7_2_1_1 - MIX_11_4_8_7_2_1_1 - break; - case 7: - case 39: - case 135: - MIX_00_4_3_3_1 - MIX_01_4_5_3_1 - MIX_10_4_7_3_2_1_1 - MIX_11_4_5_7_2_1_1 - break; - case 148: - case 149: - case 180: - MIX_00_4_3_1_2_1_1 - MIX_01_4_1_3_1 - MIX_10_4_7_3_2_1_1 - MIX_11_4_7_3_1 - break; - case 224: - case 228: - case 225: - MIX_00_4_3_1_2_1_1 - MIX_01_4_1_5_2_1_1 - MIX_10_4_3_3_1 - MIX_11_4_5_3_1 - break; - case 41: - case 169: - case 45: - MIX_00_4_1_3_1 - MIX_01_4_1_5_2_1_1 - MIX_10_4_7_3_1 - MIX_11_4_5_7_2_1_1 - break; - case 22: - case 54: - MIX_00_4_0_3_2_1_1 - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - } - else - { - MIX_01_4_1_5_2_1_1 - } - MIX_10_4_7_3_2_1_1 - MIX_11_4_8_7_2_1_1 - break; - case 208: - case 209: - MIX_00_4_3_1_2_1_1 - MIX_01_4_2_1_2_1_1 - MIX_10_4_6_3_2_1_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4 - } - else - { - MIX_11_4_5_7_2_1_1 - } - break; - case 104: - case 108: - MIX_00_4_0_1_2_1_1 - MIX_01_4_1_5_2_1_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - } - else - { - MIX_10_4_7_3_2_1_1 - } - MIX_11_4_8_5_2_1_1 - break; - case 11: - case 139: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - } - else - { - MIX_00_4_3_1_2_1_1 - } - MIX_01_4_2_5_2_1_1 - MIX_10_4_6_7_2_1_1 - MIX_11_4_5_7_2_1_1 - break; - case 19: - case 51: - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_00_4_3_3_1 - MIX_01_4_2_3_1 - } - else - { - MIX_00_4_1_3_5_2_1 - MIX_01_4_1_5_2_3_3 - } - MIX_10_4_7_3_2_1_1 - MIX_11_4_8_7_2_1_1 - break; - case 146: - case 178: - MIX_00_4_0_3_2_1_1 - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4_2_3_1 - MIX_11_4_7_3_1 - } - else - { - MIX_01_4_1_5_2_3_3 - MIX_11_4_5_7_5_2_1 - } - MIX_10_4_7_3_2_1_1 - break; - case 84: - case 85: - MIX_00_4_3_1_2_1_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_01_4_1_3_1 - MIX_11_4_8_3_1 - } - else - { - MIX_01_4_5_1_5_2_1 - MIX_11_4_5_7_2_3_3 - } - MIX_10_4_6_3_2_1_1 - break; - case 112: - case 113: - MIX_00_4_3_1_2_1_1 - MIX_01_4_2_1_2_1_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_10_4_3_3_1 - MIX_11_4_8_3_1 - } - else - { - MIX_10_4_7_3_5_2_1 - MIX_11_4_5_7_2_3_3 - } - break; - case 200: - case 204: - MIX_00_4_0_1_2_1_1 - MIX_01_4_1_5_2_1_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4_6_3_1 - MIX_11_4_5_3_1 - } - else - { - MIX_10_4_7_3_2_3_3 - MIX_11_4_7_5_5_2_1 - } - break; - case 73: - case 77: - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_00_4_1_3_1 - MIX_10_4_6_3_1 - } - else - { - MIX_00_4_3_1_5_2_1 - MIX_10_4_7_3_2_3_3 - } - MIX_01_4_1_5_2_1_1 - MIX_11_4_8_5_2_1_1 - break; - case 42: - case 170: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_MIX_00_4_0_3_1 - MIX_10_4_7_3_1 - } - else - { - MIX_00_4_3_1_2_3_3 - MIX_10_4_3_7_5_2_1 - } - MIX_01_4_2_5_2_1_1 - MIX_11_4_5_7_2_1_1 - break; - case 14: - case 142: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_MIX_00_4_0_3_1 - MIX_01_4_5_3_1 - } - else - { - MIX_00_4_3_1_2_3_3 - MIX_01_4_1_5_5_2_1 - } - MIX_10_4_6_7_2_1_1 - MIX_11_4_5_7_2_1_1 - break; - case 67: - MIX_00_4_3_3_1 - MIX_01_4_2_5_2_1_1 - MIX_10_4_6_3_2_1_1 - MIX_11_4_8_5_2_1_1 - break; - case 70: - MIX_00_4_0_3_2_1_1 - MIX_01_4_5_3_1 - MIX_10_4_6_3_2_1_1 - MIX_11_4_8_5_2_1_1 - break; - case 28: - MIX_00_4_0_1_2_1_1 - MIX_01_4_1_3_1 - MIX_10_4_6_7_2_1_1 - MIX_11_4_8_7_2_1_1 - break; - case 152: - MIX_00_4_0_1_2_1_1 - MIX_01_4_2_1_2_1_1 - MIX_10_4_6_7_2_1_1 - MIX_11_4_7_3_1 - break; - case 194: - MIX_00_4_0_3_2_1_1 - MIX_01_4_2_5_2_1_1 - MIX_10_4_6_3_2_1_1 - MIX_11_4_5_3_1 - break; - case 98: - MIX_00_4_0_3_2_1_1 - MIX_01_4_2_5_2_1_1 - MIX_10_4_3_3_1 - MIX_11_4_8_5_2_1_1 - break; - case 56: - MIX_00_4_0_1_2_1_1 - MIX_01_4_2_1_2_1_1 - MIX_10_4_7_3_1 - MIX_11_4_8_7_2_1_1 - break; - case 25: - MIX_00_4_1_3_1 - MIX_01_4_2_1_2_1_1 - MIX_10_4_6_7_2_1_1 - MIX_11_4_8_7_2_1_1 - break; - case 26: - case 31: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - } - else - { - MIX_00_4_3_1_2_1_1 - } - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - } - else - { - MIX_01_4_1_5_2_1_1 - } - MIX_10_4_6_7_2_1_1 - MIX_11_4_8_7_2_1_1 - break; - case 82: - case 214: - MIX_00_4_0_3_2_1_1 - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - } - else - { - MIX_01_4_1_5_2_1_1 - } - MIX_10_4_6_3_2_1_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4 - } - else - { - MIX_11_4_5_7_2_1_1 - } - break; - case 88: - case 248: - MIX_00_4_0_1_2_1_1 - MIX_01_4_2_1_2_1_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - } - else - { - MIX_10_4_7_3_2_1_1 - } - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4 - } - else - { - MIX_11_4_5_7_2_1_1 - } - break; - case 74: - case 107: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - } - else - { - MIX_00_4_3_1_2_1_1 - } - MIX_01_4_2_5_2_1_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - } - else - { - MIX_10_4_7_3_2_1_1 - } - MIX_11_4_8_5_2_1_1 - break; - case 27: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - } - else - { - MIX_00_4_3_1_2_1_1 - } - MIX_01_4_2_3_1 - MIX_10_4_6_7_2_1_1 - MIX_11_4_8_7_2_1_1 - break; - case 86: - MIX_00_4_0_3_2_1_1 - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - } - else - { - MIX_01_4_1_5_2_1_1 - } - MIX_10_4_6_3_2_1_1 - MIX_11_4_8_3_1 - break; - case 216: - MIX_00_4_0_1_2_1_1 - MIX_01_4_2_1_2_1_1 - MIX_10_4_6_3_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4 - } - else - { - MIX_11_4_5_7_2_1_1 - } - break; - case 106: - MIX_00_MIX_00_4_0_3_1 - MIX_01_4_2_5_2_1_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - } - else - { - MIX_10_4_7_3_2_1_1 - } - MIX_11_4_8_5_2_1_1 - break; - case 30: - MIX_00_MIX_00_4_0_3_1 - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - } - else - { - MIX_01_4_1_5_2_1_1 - } - MIX_10_4_6_7_2_1_1 - MIX_11_4_8_7_2_1_1 - break; - case 210: - MIX_00_4_0_3_2_1_1 - MIX_01_4_2_3_1 - MIX_10_4_6_3_2_1_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4 - } - else - { - MIX_11_4_5_7_2_1_1 - } - break; - case 120: - MIX_00_4_0_1_2_1_1 - MIX_01_4_2_1_2_1_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - } - else - { - MIX_10_4_7_3_2_1_1 - } - MIX_11_4_8_3_1 - break; - case 75: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - } - else - { - MIX_00_4_3_1_2_1_1 - } - MIX_01_4_2_5_2_1_1 - MIX_10_4_6_3_1 - MIX_11_4_8_5_2_1_1 - break; - case 29: - MIX_00_4_1_3_1 - MIX_01_4_1_3_1 - MIX_10_4_6_7_2_1_1 - MIX_11_4_8_7_2_1_1 - break; - case 198: - MIX_00_4_0_3_2_1_1 - MIX_01_4_5_3_1 - MIX_10_4_6_3_2_1_1 - MIX_11_4_5_3_1 - break; - case 184: - MIX_00_4_0_1_2_1_1 - MIX_01_4_2_1_2_1_1 - MIX_10_4_7_3_1 - MIX_11_4_7_3_1 - break; - case 99: - MIX_00_4_3_3_1 - MIX_01_4_2_5_2_1_1 - MIX_10_4_3_3_1 - MIX_11_4_8_5_2_1_1 - break; - case 57: - MIX_00_4_1_3_1 - MIX_01_4_2_1_2_1_1 - MIX_10_4_7_3_1 - MIX_11_4_8_7_2_1_1 - break; - case 71: - MIX_00_4_3_3_1 - MIX_01_4_5_3_1 - MIX_10_4_6_3_2_1_1 - MIX_11_4_8_5_2_1_1 - break; - case 156: - MIX_00_4_0_1_2_1_1 - MIX_01_4_1_3_1 - MIX_10_4_6_7_2_1_1 - MIX_11_4_7_3_1 - break; - case 226: - MIX_00_4_0_3_2_1_1 - MIX_01_4_2_5_2_1_1 - MIX_10_4_3_3_1 - MIX_11_4_5_3_1 - break; - case 60: - MIX_00_4_0_1_2_1_1 - MIX_01_4_1_3_1 - MIX_10_4_7_3_1 - MIX_11_4_8_7_2_1_1 - break; - case 195: - MIX_00_4_3_3_1 - MIX_01_4_2_5_2_1_1 - MIX_10_4_6_3_2_1_1 - MIX_11_4_5_3_1 - break; - case 102: - MIX_00_4_0_3_2_1_1 - MIX_01_4_5_3_1 - MIX_10_4_3_3_1 - MIX_11_4_8_5_2_1_1 - break; - case 153: - MIX_00_4_1_3_1 - MIX_01_4_2_1_2_1_1 - MIX_10_4_6_7_2_1_1 - MIX_11_4_7_3_1 - break; - case 58: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_MIX_00_4_0_3_1 - } - else - { - MIX_00_4_3_1_6_1_1 - } - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4_2_3_1 - } - else - { - MIX_01_4_1_5_6_1_1 - } - MIX_10_4_7_3_1 - MIX_11_4_8_7_2_1_1 - break; - case 83: - MIX_00_4_3_3_1 - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4_2_3_1 - } - else - { - MIX_01_4_1_5_6_1_1 - } - MIX_10_4_6_3_2_1_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4_8_3_1 - } - else - { - MIX_11_4_5_7_6_1_1 - } - break; - case 92: - MIX_00_4_0_1_2_1_1 - MIX_01_4_1_3_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4_6_3_1 - } - else - { - MIX_10_4_7_3_6_1_1 - } - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4_8_3_1 - } - else - { - MIX_11_4_5_7_6_1_1 - } - break; - case 202: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_MIX_00_4_0_3_1 - } - else - { - MIX_00_4_3_1_6_1_1 - } - MIX_01_4_2_5_2_1_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4_6_3_1 - } - else - { - MIX_10_4_7_3_6_1_1 - } - MIX_11_4_5_3_1 - break; - case 78: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_MIX_00_4_0_3_1 - } - else - { - MIX_00_4_3_1_6_1_1 - } - MIX_01_4_5_3_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4_6_3_1 - } - else - { - MIX_10_4_7_3_6_1_1 - } - MIX_11_4_8_5_2_1_1 - break; - case 154: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_MIX_00_4_0_3_1 - } - else - { - MIX_00_4_3_1_6_1_1 - } - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4_2_3_1 - } - else - { - MIX_01_4_1_5_6_1_1 - } - MIX_10_4_6_7_2_1_1 - MIX_11_4_7_3_1 - break; - case 114: - MIX_00_4_0_3_2_1_1 - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4_2_3_1 - } - else - { - MIX_01_4_1_5_6_1_1 - } - MIX_10_4_3_3_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4_8_3_1 - } - else - { - MIX_11_4_5_7_6_1_1 - } - break; - case 89: - MIX_00_4_1_3_1 - MIX_01_4_2_1_2_1_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4_6_3_1 - } - else - { - MIX_10_4_7_3_6_1_1 - } - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4_8_3_1 - } - else - { - MIX_11_4_5_7_6_1_1 - } - break; - case 90: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_MIX_00_4_0_3_1 - } - else - { - MIX_00_4_3_1_6_1_1 - } - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4_2_3_1 - } - else - { - MIX_01_4_1_5_6_1_1 - } - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4_6_3_1 - } - else - { - MIX_10_4_7_3_6_1_1 - } - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4_8_3_1 - } - else - { - MIX_11_4_5_7_6_1_1 - } - break; - case 55: - case 23: - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_00_4_3_3_1 - MIX_01_4 - } - else - { - MIX_00_4_1_3_5_2_1 - MIX_01_4_1_5_2_3_3 - } - MIX_10_4_7_3_2_1_1 - MIX_11_4_8_7_2_1_1 - break; - case 182: - case 150: - MIX_00_4_0_3_2_1_1 - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - MIX_11_4_7_3_1 - } - else - { - MIX_01_4_1_5_2_3_3 - MIX_11_4_5_7_5_2_1 - } - MIX_10_4_7_3_2_1_1 - break; - case 213: - case 212: - MIX_00_4_3_1_2_1_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_01_4_1_3_1 - MIX_11_4 - } - else - { - MIX_01_4_5_1_5_2_1 - MIX_11_4_5_7_2_3_3 - } - MIX_10_4_6_3_2_1_1 - break; - case 241: - case 240: - MIX_00_4_3_1_2_1_1 - MIX_01_4_2_1_2_1_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_10_4_3_3_1 - MIX_11_4 - } - else - { - MIX_10_4_7_3_5_2_1 - MIX_11_4_5_7_2_3_3 - } - break; - case 236: - case 232: - MIX_00_4_0_1_2_1_1 - MIX_01_4_1_5_2_1_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - MIX_11_4_5_3_1 - } - else - { - MIX_10_4_7_3_2_3_3 - MIX_11_4_7_5_5_2_1 - } - break; - case 109: - case 105: - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_00_4_1_3_1 - MIX_10_4 - } - else - { - MIX_00_4_3_1_5_2_1 - MIX_10_4_7_3_2_3_3 - } - MIX_01_4_1_5_2_1_1 - MIX_11_4_8_5_2_1_1 - break; - case 171: - case 43: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - MIX_10_4_7_3_1 - } - else - { - MIX_00_4_3_1_2_3_3 - MIX_10_4_3_7_5_2_1 - } - MIX_01_4_2_5_2_1_1 - MIX_11_4_5_7_2_1_1 - break; - case 143: - case 15: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - MIX_01_4_5_3_1 - } - else - { - MIX_00_4_3_1_2_3_3 - MIX_01_4_1_5_5_2_1 - } - MIX_10_4_6_7_2_1_1 - MIX_11_4_5_7_2_1_1 - break; - case 124: - MIX_00_4_0_1_2_1_1 - MIX_01_4_1_3_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - } - else - { - MIX_10_4_7_3_2_1_1 - } - MIX_11_4_8_3_1 - break; - case 203: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - } - else - { - MIX_00_4_3_1_2_1_1 - } - MIX_01_4_2_5_2_1_1 - MIX_10_4_6_3_1 - MIX_11_4_5_3_1 - break; - case 62: - MIX_00_MIX_00_4_0_3_1 - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - } - else - { - MIX_01_4_1_5_2_1_1 - } - MIX_10_4_7_3_1 - MIX_11_4_8_7_2_1_1 - break; - case 211: - MIX_00_4_3_3_1 - MIX_01_4_2_3_1 - MIX_10_4_6_3_2_1_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4 - } - else - { - MIX_11_4_5_7_2_1_1 - } - break; - case 118: - MIX_00_4_0_3_2_1_1 - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - } - else - { - MIX_01_4_1_5_2_1_1 - } - MIX_10_4_3_3_1 - MIX_11_4_8_3_1 - break; - case 217: - MIX_00_4_1_3_1 - MIX_01_4_2_1_2_1_1 - MIX_10_4_6_3_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4 - } - else - { - MIX_11_4_5_7_2_1_1 - } - break; - case 110: - MIX_00_MIX_00_4_0_3_1 - MIX_01_4_5_3_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - } - else - { - MIX_10_4_7_3_2_1_1 - } - MIX_11_4_8_5_2_1_1 - break; - case 155: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - } - else - { - MIX_00_4_3_1_2_1_1 - } - MIX_01_4_2_3_1 - MIX_10_4_6_7_2_1_1 - MIX_11_4_7_3_1 - break; - case 188: - MIX_00_4_0_1_2_1_1 - MIX_01_4_1_3_1 - MIX_10_4_7_3_1 - MIX_11_4_7_3_1 - break; - case 185: - MIX_00_4_1_3_1 - MIX_01_4_2_1_2_1_1 - MIX_10_4_7_3_1 - MIX_11_4_7_3_1 - break; - case 61: - MIX_00_4_1_3_1 - MIX_01_4_1_3_1 - MIX_10_4_7_3_1 - MIX_11_4_8_7_2_1_1 - break; - case 157: - MIX_00_4_1_3_1 - MIX_01_4_1_3_1 - MIX_10_4_6_7_2_1_1 - MIX_11_4_7_3_1 - break; - case 103: - MIX_00_4_3_3_1 - MIX_01_4_5_3_1 - MIX_10_4_3_3_1 - MIX_11_4_8_5_2_1_1 - break; - case 227: - MIX_00_4_3_3_1 - MIX_01_4_2_5_2_1_1 - MIX_10_4_3_3_1 - MIX_11_4_5_3_1 - break; - case 230: - MIX_00_4_0_3_2_1_1 - MIX_01_4_5_3_1 - MIX_10_4_3_3_1 - MIX_11_4_5_3_1 - break; - case 199: - MIX_00_4_3_3_1 - MIX_01_4_5_3_1 - MIX_10_4_6_3_2_1_1 - MIX_11_4_5_3_1 - break; - case 220: - MIX_00_4_0_1_2_1_1 - MIX_01_4_1_3_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4_6_3_1 - } - else - { - MIX_10_4_7_3_6_1_1 - } - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4 - } - else - { - MIX_11_4_5_7_2_1_1 - } - break; - case 158: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_MIX_00_4_0_3_1 - } - else - { - MIX_00_4_3_1_6_1_1 - } - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - } - else - { - MIX_01_4_1_5_2_1_1 - } - MIX_10_4_6_7_2_1_1 - MIX_11_4_7_3_1 - break; - case 234: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_MIX_00_4_0_3_1 - } - else - { - MIX_00_4_3_1_6_1_1 - } - MIX_01_4_2_5_2_1_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - } - else - { - MIX_10_4_7_3_2_1_1 - } - MIX_11_4_5_3_1 - break; - case 242: - MIX_00_4_0_3_2_1_1 - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4_2_3_1 - } - else - { - MIX_01_4_1_5_6_1_1 - } - MIX_10_4_3_3_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4 - } - else - { - MIX_11_4_5_7_2_1_1 - } - break; - case 59: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - } - else - { - MIX_00_4_3_1_2_1_1 - } - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4_2_3_1 - } - else - { - MIX_01_4_1_5_6_1_1 - } - MIX_10_4_7_3_1 - MIX_11_4_8_7_2_1_1 - break; - case 121: - MIX_00_4_1_3_1 - MIX_01_4_2_1_2_1_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - } - else - { - MIX_10_4_7_3_2_1_1 - } - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4_8_3_1 - } - else - { - MIX_11_4_5_7_6_1_1 - } - break; - case 87: - MIX_00_4_3_3_1 - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - } - else - { - MIX_01_4_1_5_2_1_1 - } - MIX_10_4_6_3_2_1_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4_8_3_1 - } - else - { - MIX_11_4_5_7_6_1_1 - } - break; - case 79: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - } - else - { - MIX_00_4_3_1_2_1_1 - } - MIX_01_4_5_3_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4_6_3_1 - } - else - { - MIX_10_4_7_3_6_1_1 - } - MIX_11_4_8_5_2_1_1 - break; - case 122: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_MIX_00_4_0_3_1 - } - else - { - MIX_00_4_3_1_6_1_1 - } - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4_2_3_1 - } - else - { - MIX_01_4_1_5_6_1_1 - } - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - } - else - { - MIX_10_4_7_3_2_1_1 - } - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4_8_3_1 - } - else - { - MIX_11_4_5_7_6_1_1 - } - break; - case 94: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_MIX_00_4_0_3_1 - } - else - { - MIX_00_4_3_1_6_1_1 - } - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - } - else - { - MIX_01_4_1_5_2_1_1 - } - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4_6_3_1 - } - else - { - MIX_10_4_7_3_6_1_1 - } - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4_8_3_1 - } - else - { - MIX_11_4_5_7_6_1_1 - } - break; - case 218: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_MIX_00_4_0_3_1 - } - else - { - MIX_00_4_3_1_6_1_1 - } - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4_2_3_1 - } - else - { - MIX_01_4_1_5_6_1_1 - } - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4_6_3_1 - } - else - { - MIX_10_4_7_3_6_1_1 - } - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4 - } - else - { - MIX_11_4_5_7_2_1_1 - } - break; - case 91: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - } - else - { - MIX_00_4_3_1_2_1_1 - } - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4_2_3_1 - } - else - { - MIX_01_4_1_5_6_1_1 - } - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4_6_3_1 - } - else - { - MIX_10_4_7_3_6_1_1 - } - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4_8_3_1 - } - else - { - MIX_11_4_5_7_6_1_1 - } - break; - case 229: - MIX_00_4_3_1_2_1_1 - MIX_01_4_1_5_2_1_1 - MIX_10_4_3_3_1 - MIX_11_4_5_3_1 - break; - case 167: - MIX_00_4_3_3_1 - MIX_01_4_5_3_1 - MIX_10_4_7_3_2_1_1 - MIX_11_4_5_7_2_1_1 - break; - case 173: - MIX_00_4_1_3_1 - MIX_01_4_1_5_2_1_1 - MIX_10_4_7_3_1 - MIX_11_4_5_7_2_1_1 - break; - case 181: - MIX_00_4_3_1_2_1_1 - MIX_01_4_1_3_1 - MIX_10_4_7_3_2_1_1 - MIX_11_4_7_3_1 - break; - case 186: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_MIX_00_4_0_3_1 - } - else - { - MIX_00_4_3_1_6_1_1 - } - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4_2_3_1 - } - else - { - MIX_01_4_1_5_6_1_1 - } - MIX_10_4_7_3_1 - MIX_11_4_7_3_1 - break; - case 115: - MIX_00_4_3_3_1 - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4_2_3_1 - } - else - { - MIX_01_4_1_5_6_1_1 - } - MIX_10_4_3_3_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4_8_3_1 - } - else - { - MIX_11_4_5_7_6_1_1 - } - break; - case 93: - MIX_00_4_1_3_1 - MIX_01_4_1_3_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4_6_3_1 - } - else - { - MIX_10_4_7_3_6_1_1 - } - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4_8_3_1 - } - else - { - MIX_11_4_5_7_6_1_1 - } - break; - case 206: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_MIX_00_4_0_3_1 - } - else - { - MIX_00_4_3_1_6_1_1 - } - MIX_01_4_5_3_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4_6_3_1 - } - else - { - MIX_10_4_7_3_6_1_1 - } - MIX_11_4_5_3_1 - break; - case 205: - case 201: - MIX_00_4_1_3_1 - MIX_01_4_1_5_2_1_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4_6_3_1 - } - else - { - MIX_10_4_7_3_6_1_1 - } - MIX_11_4_5_3_1 - break; - case 174: - case 46: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_MIX_00_4_0_3_1 - } - else - { - MIX_00_4_3_1_6_1_1 - } - MIX_01_4_5_3_1 - MIX_10_4_7_3_1 - MIX_11_4_5_7_2_1_1 - break; - case 179: - case 147: - MIX_00_4_3_3_1 - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4_2_3_1 - } - else - { - MIX_01_4_1_5_6_1_1 - } - MIX_10_4_7_3_2_1_1 - MIX_11_4_7_3_1 - break; - case 117: - case 116: - MIX_00_4_3_1_2_1_1 - MIX_01_4_1_3_1 - MIX_10_4_3_3_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4_8_3_1 - } - else - { - MIX_11_4_5_7_6_1_1 - } - break; - case 189: - MIX_00_4_1_3_1 - MIX_01_4_1_3_1 - MIX_10_4_7_3_1 - MIX_11_4_7_3_1 - break; - case 231: - MIX_00_4_3_3_1 - MIX_01_4_5_3_1 - MIX_10_4_3_3_1 - MIX_11_4_5_3_1 - break; - case 126: - MIX_00_MIX_00_4_0_3_1 - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - } - else - { - MIX_01_4_1_5_2_1_1 - } - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - } - else - { - MIX_10_4_7_3_2_1_1 - } - MIX_11_4_8_3_1 - break; - case 219: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - } - else - { - MIX_00_4_3_1_2_1_1 - } - MIX_01_4_2_3_1 - MIX_10_4_6_3_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4 - } - else - { - MIX_11_4_5_7_2_1_1 - } - break; - case 125: - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_00_4_1_3_1 - MIX_10_4 - } - else - { - MIX_00_4_3_1_5_2_1 - MIX_10_4_7_3_2_3_3 - } - MIX_01_4_1_3_1 - MIX_11_4_8_3_1 - break; - case 221: - MIX_00_4_1_3_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_01_4_1_3_1 - MIX_11_4 - } - else - { - MIX_01_4_5_1_5_2_1 - MIX_11_4_5_7_2_3_3 - } - MIX_10_4_6_3_1 - break; - case 207: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - MIX_01_4_5_3_1 - } - else - { - MIX_00_4_3_1_2_3_3 - MIX_01_4_1_5_5_2_1 - } - MIX_10_4_6_3_1 - MIX_11_4_5_3_1 - break; - case 238: - MIX_00_MIX_00_4_0_3_1 - MIX_01_4_5_3_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - MIX_11_4_5_3_1 - } - else - { - MIX_10_4_7_3_2_3_3 - MIX_11_4_7_5_5_2_1 - } - break; - case 190: - MIX_00_MIX_00_4_0_3_1 - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - MIX_11_4_7_3_1 - } - else - { - MIX_01_4_1_5_2_3_3 - MIX_11_4_5_7_5_2_1 - } - MIX_10_4_7_3_1 - break; - case 187: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - MIX_10_4_7_3_1 - } - else - { - MIX_00_4_3_1_2_3_3 - MIX_10_4_3_7_5_2_1 - } - MIX_01_4_2_3_1 - MIX_11_4_7_3_1 - break; - case 243: - MIX_00_4_3_3_1 - MIX_01_4_2_3_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_10_4_3_3_1 - MIX_11_4 - } - else - { - MIX_10_4_7_3_5_2_1 - MIX_11_4_5_7_2_3_3 - } - break; - case 119: - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_00_4_3_3_1 - MIX_01_4 - } - else - { - MIX_00_4_1_3_5_2_1 - MIX_01_4_1_5_2_3_3 - } - MIX_10_4_3_3_1 - MIX_11_4_8_3_1 - break; - case 237: - case 233: - MIX_00_4_1_3_1 - MIX_01_4_1_5_2_1_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - } - else - { - MIX_10_4_6_3_10 - } - MIX_11_4_5_3_1 - break; - case 175: - case 47: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - } - else - { - MIX_00_MIX_00_4_0_3_10 - } - MIX_01_4_5_3_1 - MIX_10_4_7_3_1 - MIX_11_4_5_7_2_1_1 - break; - case 183: - case 151: - MIX_00_4_3_3_1 - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - } - else - { - MIX_01_4_2_3_10 - } - MIX_10_4_7_3_2_1_1 - MIX_11_4_7_3_1 - break; - case 245: - case 244: - MIX_00_4_3_1_2_1_1 - MIX_01_4_1_3_1 - MIX_10_4_3_3_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4 - } - else - { - MIX_11_4_8_3_10 - } - break; - case 250: - MIX_00_MIX_00_4_0_3_1 - MIX_01_4_2_3_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - } - else - { - MIX_10_4_7_3_2_1_1 - } - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4 - } - else - { - MIX_11_4_5_7_2_1_1 - } - break; - case 123: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - } - else - { - MIX_00_4_3_1_2_1_1 - } - MIX_01_4_2_3_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - } - else - { - MIX_10_4_7_3_2_1_1 - } - MIX_11_4_8_3_1 - break; - case 95: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - } - else - { - MIX_00_4_3_1_2_1_1 - } - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - } - else - { - MIX_01_4_1_5_2_1_1 - } - MIX_10_4_6_3_1 - MIX_11_4_8_3_1 - break; - case 222: - MIX_00_MIX_00_4_0_3_1 - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - } - else - { - MIX_01_4_1_5_2_1_1 - } - MIX_10_4_6_3_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4 - } - else - { - MIX_11_4_5_7_2_1_1 - } - break; - case 252: - MIX_00_4_0_1_2_1_1 - MIX_01_4_1_3_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - } - else - { - MIX_10_4_7_3_2_1_1 - } - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4 - } - else - { - MIX_11_4_8_3_10 - } - break; - case 249: - MIX_00_4_1_3_1 - MIX_01_4_2_1_2_1_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - } - else - { - MIX_10_4_6_3_10 - } - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4 - } - else - { - MIX_11_4_5_7_2_1_1 - } - break; - case 235: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - } - else - { - MIX_00_4_3_1_2_1_1 - } - MIX_01_4_2_5_2_1_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - } - else - { - MIX_10_4_6_3_10 - } - MIX_11_4_5_3_1 - break; - case 111: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - } - else - { - MIX_00_MIX_00_4_0_3_10 - } - MIX_01_4_5_3_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - } - else - { - MIX_10_4_7_3_2_1_1 - } - MIX_11_4_8_5_2_1_1 - break; - case 63: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - } - else - { - MIX_00_MIX_00_4_0_3_10 - } - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - } - else - { - MIX_01_4_1_5_2_1_1 - } - MIX_10_4_7_3_1 - MIX_11_4_8_7_2_1_1 - break; - case 159: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - } - else - { - MIX_00_4_3_1_2_1_1 - } - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - } - else - { - MIX_01_4_2_3_10 - } - MIX_10_4_6_7_2_1_1 - MIX_11_4_7_3_1 - break; - case 215: - MIX_00_4_3_3_1 - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - } - else - { - MIX_01_4_2_3_10 - } - MIX_10_4_6_3_2_1_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4 - } - else - { - MIX_11_4_5_7_2_1_1 - } - break; - case 246: - MIX_00_4_0_3_2_1_1 - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - } - else - { - MIX_01_4_1_5_2_1_1 - } - MIX_10_4_3_3_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4 - } - else - { - MIX_11_4_8_3_10 - } - break; - case 254: - MIX_00_MIX_00_4_0_3_1 - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - } - else - { - MIX_01_4_1_5_2_1_1 - } - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - } - else - { - MIX_10_4_7_3_2_1_1 - } - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4 - } - else - { - MIX_11_4_8_3_10 - } - break; - case 253: - MIX_00_4_1_3_1 - MIX_01_4_1_3_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - } - else - { - MIX_10_4_6_3_10 - } - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4 - } - else - { - MIX_11_4_8_3_10 - } - break; - case 251: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - } - else - { - MIX_00_4_3_1_2_1_1 - } - MIX_01_4_2_3_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - } - else - { - MIX_10_4_6_3_10 - } - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4 - } - else - { - MIX_11_4_5_7_2_1_1 - } - break; - case 239: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - } - else - { - MIX_00_MIX_00_4_0_3_10 - } - MIX_01_4_5_3_1 - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - } - else - { - MIX_10_4_6_3_10 - } - MIX_11_4_5_3_1 - break; - case 127: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - } - else - { - MIX_00_MIX_00_4_0_3_10 - } - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - } - else - { - MIX_01_4_1_5_2_1_1 - } - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - { - MIX_10_4 - } - else - { - MIX_10_4_7_3_2_1_1 - } - MIX_11_4_8_3_1 - break; - case 191: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - } - else - { - MIX_00_MIX_00_4_0_3_10 - } - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - } - else - { - MIX_01_4_2_3_10 - } - MIX_10_4_7_3_1 - MIX_11_4_7_3_1 - break; - case 223: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - { - MIX_00_4 - } - else - { - MIX_00_4_3_1_2_1_1 - } - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - } - else - { - MIX_01_4_2_3_10 - } - MIX_10_4_6_3_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4 - } - else - { - MIX_11_4_5_7_2_1_1 - } - break; - case 247: - MIX_00_4_3_3_1 - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - { - MIX_01_4 - } - else - { - MIX_01_4_2_3_10 - } - MIX_10_4_3_3_1 - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - { - MIX_11_4 - } - else - { - MIX_11_4_8_3_10 - } - break; - case 255: - if (isDifferent(w[3], w[1], trY, trU, trV, trA)) - MIX_00_4 - else - MIX_00_MIX_00_4_0_3_10 - - if (isDifferent(w[1], w[5], trY, trU, trV, trA)) - MIX_01_4 - else - MIX_01_4_2_3_10 - - if (isDifferent(w[7], w[3], trY, trU, trV, trA)) - MIX_10_4 - else - MIX_10_4_6_3_10 - - if (isDifferent(w[5], w[7], trY, trU, trV, trA)) - MIX_11_4 - else - MIX_11_4_8_3_10 - break; - } - image++; - output += 2; - } - output += lineSize; - } - - return output; -} diff --git a/thirdparty/misc/hq2x.h b/thirdparty/misc/hq2x.h deleted file mode 100644 index bebd917950..0000000000 --- a/thirdparty/misc/hq2x.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef HQ2X_H -#define HQ2X_H - -#include "core/typedefs.h" - - -uint32_t *hq2x_resize( - const uint32_t *image, - uint32_t width, - uint32_t height, - uint32_t *output, - uint32_t trY = 0x30, - uint32_t trU = 0x07, - uint32_t trV = 0x06, - uint32_t trA = 0x50, - bool wrapX = false, - bool wrapY = false ); - -#endif // HQ2X_H diff --git a/thirdparty/misc/r128.h b/thirdparty/misc/r128.h index be7cd3024d..1f7aab78fb 100644 --- a/thirdparty/misc/r128.h +++ b/thirdparty/misc/r128.h @@ -665,7 +665,7 @@ static int r128__clz64(R128_U64 x) // 32*32->64 static R128_U64 r128__umul64(R128_U32 a, R128_U32 b) { -# if defined(_M_IX86) && !defined(R128_STDC_ONLY) +# if defined(_M_IX86) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__) return __emulu(a, b); # elif defined(_M_ARM) && !defined(R128_STDC_ONLY) return _arm_umull(a, b); @@ -680,7 +680,7 @@ static R128_U32 r128__udiv64(R128_U32 nlo, R128_U32 nhi, R128_U32 d, R128_U32 *r # if defined(_M_IX86) && (_MSC_VER >= 1920) && !defined(R128_STDC_ONLY) unsigned __int64 n = ((unsigned __int64)nhi << 32) | nlo; return _udiv64(n, d, rem); -# elif defined(_M_IX86) && !defined(R128_STDC_ONLY) +# elif defined(_M_IX86) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__) __asm { mov eax, nlo mov edx, nhi @@ -795,7 +795,7 @@ static void r128__umul128(R128 *dst, R128_U64 a, R128_U64 b) } // 128/64->64 -#if defined(_M_X64) && (_MSC_VER < 1920) && !defined(R128_STDC_ONLY) +#if defined(_M_X64) && (_MSC_VER < 1920) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__) // MSVC x64 provides neither inline assembly nor (pre-2019) a div intrinsic, so we do fake // "inline assembly" to avoid long division or outline assembly. #pragma code_seg(".text") @@ -810,7 +810,7 @@ static const r128__udiv128Proc r128__udiv128 = (r128__udiv128Proc)(void*)r128__u #else static R128_U64 r128__udiv128(R128_U64 nlo, R128_U64 nhi, R128_U64 d, R128_U64 *rem) { -#if defined(_M_X64) && !defined(R128_STDC_ONLY) +#if defined(_M_X64) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__) return _udiv128(nhi, nlo, d, rem); #elif defined(__x86_64__) && !defined(R128_STDC_ONLY) R128_U64 q, r; @@ -1602,7 +1602,7 @@ void r128Shl(R128 *dst, const R128 *src, int amount) R128_ASSERT(dst != NULL); R128_ASSERT(src != NULL); -#if defined(_M_IX86) && !defined(R128_STDC_ONLY) +#if defined(_M_IX86) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__) __asm { // load src mov edx, dword ptr[src] @@ -1664,7 +1664,7 @@ void r128Shr(R128 *dst, const R128 *src, int amount) R128_ASSERT(dst != NULL); R128_ASSERT(src != NULL); -#if defined(_M_IX86) && !defined(R128_STDC_ONLY) +#if defined(_M_IX86) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__) __asm { // load src mov edx, dword ptr[src] @@ -1726,7 +1726,7 @@ void r128Sar(R128 *dst, const R128 *src, int amount) R128_ASSERT(dst != NULL); R128_ASSERT(src != NULL); -#if defined(_M_IX86) && !defined(R128_STDC_ONLY) +#if defined(_M_IX86) && !defined(R128_STDC_ONLY) && !defined(__MINGW32__) __asm { // load src mov edx, dword ptr[src] |