From 6aa5bc23470fbf82492a825663f3c13cde0d1323 Mon Sep 17 00:00:00 2001 From: mrawlingst Date: Thu, 7 Sep 2017 16:19:44 -0400 Subject: [PATCH] Change Color.to_32() to to_rgba32() and format as RGBA --- core/color.cpp | 12 ++++++------ core/color.h | 6 +++--- core/variant_call.cpp | 8 ++++---- doc/base/classes.xml | 4 ++-- modules/gdnative/gdnative/color.cpp | 8 ++++---- modules/gdnative/include/gdnative/color.h | 4 ++-- modules/svg/image_loader_svg.cpp | 4 ++-- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/core/color.cpp b/core/color.cpp index ab264d31d4eb..259a4988b1dc 100644 --- a/core/color.cpp +++ b/core/color.cpp @@ -34,7 +34,7 @@ #include "math_funcs.h" #include "print_string.h" -uint32_t Color::to_ARGB32() const { +uint32_t Color::to_argb32() const { uint32_t c = (uint8_t)(a * 255); c <<= 8; @@ -47,7 +47,7 @@ uint32_t Color::to_ARGB32() const { return c; } -uint32_t Color::to_ABGR32() const { +uint32_t Color::to_abgr32() const { uint32_t c = (uint8_t)(a * 255); c <<= 8; c |= (uint8_t)(b * 255); @@ -59,15 +59,15 @@ uint32_t Color::to_ABGR32() const { return c; } -uint32_t Color::to_32() const { +uint32_t Color::to_rgba32() const { - uint32_t c = (uint8_t)(a * 255); - c <<= 8; - c |= (uint8_t)(r * 255); + uint32_t c = (uint8_t)(r * 255); c <<= 8; c |= (uint8_t)(g * 255); c <<= 8; c |= (uint8_t)(b * 255); + c <<= 8; + c |= (uint8_t)(a * 255); return c; } diff --git a/core/color.h b/core/color.h index cd5510cf01b9..d3d5db09f9ee 100644 --- a/core/color.h +++ b/core/color.h @@ -51,9 +51,9 @@ struct Color { bool operator==(const Color &p_color) const { return (r == p_color.r && g == p_color.g && b == p_color.b && a == p_color.a); } bool operator!=(const Color &p_color) const { return (r != p_color.r || g != p_color.g || b != p_color.b || a != p_color.a); } - uint32_t to_32() const; - uint32_t to_ARGB32() const; - uint32_t to_ABGR32() const; + uint32_t to_rgba32() const; + uint32_t to_argb32() const; + uint32_t to_abgr32() const; float gray() const; float get_h() const; float get_s() const; diff --git a/core/variant_call.cpp b/core/variant_call.cpp index ad15f8f5cba4..bae280b14c70 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -428,8 +428,8 @@ struct _VariantCall { VCALL_LOCALMEM2R(Quat, slerpni); VCALL_LOCALMEM4R(Quat, cubic_slerp); - VCALL_LOCALMEM0R(Color, to_32); - VCALL_LOCALMEM0R(Color, to_ARGB32); + VCALL_LOCALMEM0R(Color, to_rgba32); + VCALL_LOCALMEM0R(Color, to_argb32); VCALL_LOCALMEM0R(Color, gray); VCALL_LOCALMEM0R(Color, inverted); VCALL_LOCALMEM0R(Color, contrasted); @@ -1523,8 +1523,8 @@ void register_variant_methods() { ADDFUNC2(QUAT, QUAT, Quat, slerpni, QUAT, "b", REAL, "t", varray()); ADDFUNC4(QUAT, QUAT, Quat, cubic_slerp, QUAT, "b", QUAT, "pre_a", QUAT, "post_b", REAL, "t", varray()); - ADDFUNC0(COLOR, INT, Color, to_32, varray()); - ADDFUNC0(COLOR, INT, Color, to_ARGB32, varray()); + ADDFUNC0(COLOR, INT, Color, to_rgba32, varray()); + ADDFUNC0(COLOR, INT, Color, to_argb32, varray()); ADDFUNC0(COLOR, REAL, Color, gray, varray()); ADDFUNC0(COLOR, COLOR, Color, inverted, varray()); ADDFUNC0(COLOR, COLOR, Color, contrasted, varray()); diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 8d1658572650..6ecf08d3cea3 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -12292,14 +12292,14 @@ Return the linear interpolation with another color. - + Convert the color to a 32 its integer (each byte represents a RGBA). - + diff --git a/modules/gdnative/gdnative/color.cpp b/modules/gdnative/gdnative/color.cpp index 3f8912d89669..2a5c0887a181 100644 --- a/modules/gdnative/gdnative/color.cpp +++ b/modules/gdnative/gdnative/color.cpp @@ -112,14 +112,14 @@ godot_string GDAPI godot_color_as_string(const godot_color *p_self) { return ret; } -godot_int GDAPI godot_color_to_32(const godot_color *p_self) { +godot_int GDAPI godot_color_to_rgba32(const godot_color *p_self) { const Color *self = (const Color *)p_self; - return self->to_32(); + return self->to_rgba32(); } -godot_int GDAPI godot_color_to_ARGB32(const godot_color *p_self) { +godot_int GDAPI godot_color_to_argb32(const godot_color *p_self) { const Color *self = (const Color *)p_self; - return self->to_ARGB32(); + return self->to_argb32(); } godot_real GDAPI godot_color_gray(const godot_color *p_self) { diff --git a/modules/gdnative/include/gdnative/color.h b/modules/gdnative/include/gdnative/color.h index 90dccf75aaba..14265466b928 100644 --- a/modules/gdnative/include/gdnative/color.h +++ b/modules/gdnative/include/gdnative/color.h @@ -69,9 +69,9 @@ godot_real godot_color_get_v(const godot_color *p_self); godot_string GDAPI godot_color_as_string(const godot_color *p_self); -godot_int GDAPI godot_color_to_32(const godot_color *p_self); +godot_int GDAPI godot_color_to_rgba32(const godot_color *p_self); -godot_int GDAPI godot_color_to_ARGB32(const godot_color *p_self); +godot_int GDAPI godot_color_to_argb32(const godot_color *p_self); godot_real GDAPI godot_color_gray(const godot_color *p_self); diff --git a/modules/svg/image_loader_svg.cpp b/modules/svg/image_loader_svg.cpp index f5c379d32e77..935a412ed114 100644 --- a/modules/svg/image_loader_svg.cpp +++ b/modules/svg/image_loader_svg.cpp @@ -75,8 +75,8 @@ void ImageLoaderSVG::_convert_colors(NSVGimage *p_svg_image, const Dictionary p_ if (r_c.get_type() == Variant::COLOR && n_c.get_type() == Variant::COLOR) { Color replace_color = r_c; Color new_color = n_c; - replace_colors_i.push_back(replace_color.to_ABGR32()); - new_colors_i.push_back(new_color.to_ABGR32()); + replace_colors_i.push_back(replace_color.to_abgr32()); + new_colors_i.push_back(new_color.to_abgr32()); } }