From 180e5d30286279c979507a571bf6d336aa49da9d Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Tue, 3 May 2022 01:43:50 +0200 Subject: Remove `RES` and `REF` typedefs in favor of spelled out `Ref<>` These typedefs don't save much typing compared to the full `Ref` and `Ref`, yet they sometimes introduce confusion among new contributors. --- drivers/png/resource_saver_png.cpp | 6 +++--- drivers/png/resource_saver_png.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/png') diff --git a/drivers/png/resource_saver_png.cpp b/drivers/png/resource_saver_png.cpp index 8633d2dc4e..704ddca726 100644 --- a/drivers/png/resource_saver_png.cpp +++ b/drivers/png/resource_saver_png.cpp @@ -35,7 +35,7 @@ #include "drivers/png/png_driver_common.h" #include "scene/resources/texture.h" -Error ResourceSaverPNG::save(const String &p_path, const RES &p_resource, uint32_t p_flags) { +Error ResourceSaverPNG::save(const String &p_path, const Ref &p_resource, uint32_t p_flags) { Ref texture = p_resource; ERR_FAIL_COND_V_MSG(!texture.is_valid(), ERR_INVALID_PARAMETER, "Can't save invalid texture as PNG."); @@ -72,11 +72,11 @@ Vector ResourceSaverPNG::save_image_to_buffer(const Ref &p_img) return buffer; } -bool ResourceSaverPNG::recognize(const RES &p_resource) const { +bool ResourceSaverPNG::recognize(const Ref &p_resource) const { return (p_resource.is_valid() && p_resource->is_class("ImageTexture")); } -void ResourceSaverPNG::get_recognized_extensions(const RES &p_resource, List *p_extensions) const { +void ResourceSaverPNG::get_recognized_extensions(const Ref &p_resource, List *p_extensions) const { if (Object::cast_to(*p_resource)) { p_extensions->push_back("png"); } diff --git a/drivers/png/resource_saver_png.h b/drivers/png/resource_saver_png.h index f39e52c7ec..1a681faaec 100644 --- a/drivers/png/resource_saver_png.h +++ b/drivers/png/resource_saver_png.h @@ -39,9 +39,9 @@ public: static Error save_image(const String &p_path, const Ref &p_img); static Vector save_image_to_buffer(const Ref &p_img); - virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0); - virtual bool recognize(const RES &p_resource) const; - virtual void get_recognized_extensions(const RES &p_resource, List *p_extensions) const; + virtual Error save(const String &p_path, const Ref &p_resource, uint32_t p_flags = 0); + virtual bool recognize(const Ref &p_resource) const; + virtual void get_recognized_extensions(const Ref &p_resource, List *p_extensions) const; ResourceSaverPNG(); }; -- cgit v1.2.3