From 0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 14 May 2020 13:23:58 +0200 Subject: Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027. --- modules/webp/image_loader_webp.cpp | 7 ------- modules/webp/image_loader_webp.h | 1 - modules/webp/register_types.cpp | 2 -- 3 files changed, 10 deletions(-) (limited to 'modules/webp') diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp index 6c778d2809..744b7ef8b9 100644 --- a/modules/webp/image_loader_webp.cpp +++ b/modules/webp/image_loader_webp.cpp @@ -39,7 +39,6 @@ #include static Vector _webp_lossy_pack(const Ref &p_image, float p_quality) { - ERR_FAIL_COND_V(p_image.is_null() || p_image->empty(), Vector()); Ref img = p_image->duplicate(); @@ -55,7 +54,6 @@ static Vector _webp_lossy_pack(const Ref &p_image, float p_quali uint8_t *dst_buff = nullptr; size_t dst_size = 0; if (img->get_format() == Image::FORMAT_RGB8) { - dst_size = WebPEncodeRGB(r, s.width, s.height, 3 * s.width, CLAMP(p_quality * 100.0, 0, 100.0), &dst_buff); } else { dst_size = WebPEncodeRGBA(r, s.width, s.height, 4 * s.width, CLAMP(p_quality * 100.0, 0, 100.0), &dst_buff); @@ -76,7 +74,6 @@ static Vector _webp_lossy_pack(const Ref &p_image, float p_quali } static Ref _webp_lossy_unpack(const Vector &p_buffer) { - int size = p_buffer.size() - 4; ERR_FAIL_COND_V(size <= 0, Ref()); const uint8_t *r = p_buffer.ptr(); @@ -113,7 +110,6 @@ static Ref _webp_lossy_unpack(const Vector &p_buffer) { } Error webp_load_image_from_buffer(Image *p_image, const uint8_t *p_buffer, int p_buffer_len) { - ERR_FAIL_NULL_V(p_image, ERR_INVALID_PARAMETER); WebPBitstreamFeatures features; @@ -141,7 +137,6 @@ Error webp_load_image_from_buffer(Image *p_image, const uint8_t *p_buffer, int p } static Ref _webp_mem_loader_func(const uint8_t *p_png, int p_size) { - Ref img; img.instance(); Error err = webp_load_image_from_buffer(img.ptr(), p_png, p_size); @@ -150,7 +145,6 @@ static Ref _webp_mem_loader_func(const uint8_t *p_png, int p_size) { } Error ImageLoaderWEBP::load_image(Ref p_image, FileAccess *f, bool p_force_linear, float p_scale) { - Vector src_image; int src_image_len = f->get_len(); ERR_FAIL_COND_V(src_image_len == 0, ERR_FILE_CORRUPT); @@ -168,7 +162,6 @@ Error ImageLoaderWEBP::load_image(Ref p_image, FileAccess *f, bool p_forc } void ImageLoaderWEBP::get_recognized_extensions(List *p_extensions) const { - p_extensions->push_back("webp"); } diff --git a/modules/webp/image_loader_webp.h b/modules/webp/image_loader_webp.h index 9206ca2525..49a7407600 100644 --- a/modules/webp/image_loader_webp.h +++ b/modules/webp/image_loader_webp.h @@ -34,7 +34,6 @@ #include "core/io/image_loader.h" class ImageLoaderWEBP : public ImageFormatLoader { - public: virtual Error load_image(Ref p_image, FileAccess *f, bool p_force_linear, float p_scale); virtual void get_recognized_extensions(List *p_extensions) const; diff --git a/modules/webp/register_types.cpp b/modules/webp/register_types.cpp index fe945b01d4..0788b06309 100644 --- a/modules/webp/register_types.cpp +++ b/modules/webp/register_types.cpp @@ -35,12 +35,10 @@ static ImageLoaderWEBP *image_loader_webp = nullptr; void register_webp_types() { - image_loader_webp = memnew(ImageLoaderWEBP); ImageLoader::add_image_format_loader(image_loader_webp); } void unregister_webp_types() { - memdelete(image_loader_webp); } -- cgit v1.2.3