diff options
Diffstat (limited to 'drivers/png')
-rw-r--r-- | drivers/png/SCsub | 18 | ||||
-rw-r--r-- | drivers/png/image_loader_png.cpp | 10 | ||||
-rw-r--r-- | drivers/png/image_loader_png.h | 2 | ||||
-rw-r--r-- | drivers/png/resource_saver_png.cpp | 4 | ||||
-rw-r--r-- | drivers/png/resource_saver_png.h | 4 |
5 files changed, 21 insertions, 17 deletions
diff --git a/drivers/png/SCsub b/drivers/png/SCsub index 39480351a6..22fb1817d1 100644 --- a/drivers/png/SCsub +++ b/drivers/png/SCsub @@ -26,14 +26,24 @@ if env['builtin_libpng']: ] thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] - env_png.add_source_files(env.drivers_sources, thirdparty_sources) env_png.Append(CPPPATH=[thirdparty_dir]) + # Needed for drivers includes and in platform/javascript + env.Append(CPPPATH=[thirdparty_dir]) # Currently .ASM filter_neon.S does not compile on NT. import os - if ("neon_enabled" in env and env["neon_enabled"]) and os.name != "nt": + use_neon = "neon_enabled" in env and env["neon_enabled"] and os.name != "nt" + if use_neon: env_png.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=2"]) - env_neon = env_png.Clone() + else: + env_png.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=0"]) + + env_thirdparty = env_png.Clone() + env_thirdparty.disable_warnings() + env_thirdparty.add_source_files(env.drivers_sources, thirdparty_sources) + + if use_neon: + env_neon = env_thirdparty.Clone() if "S_compiler" in env: env_neon['CC'] = env['S_compiler'] neon_sources = [] @@ -41,8 +51,6 @@ if env['builtin_libpng']: neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon_intrinsics.c")) neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon.S")) env.drivers_sources += neon_sources - else: - env_png.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=0"]) # Godot source files env_png.add_source_files(env.drivers_sources, "*.cpp") diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp index 3f512af8d5..a4ea889d3b 100644 --- a/drivers/png/image_loader_png.cpp +++ b/drivers/png/image_loader_png.cpp @@ -30,8 +30,8 @@ #include "image_loader_png.h" -#include "os/os.h" -#include "print_string.h" +#include "core/os/os.h" +#include "core/print_string.h" #include <string.h> @@ -227,10 +227,7 @@ static void user_read_data(png_structp png_ptr, png_bytep data, png_size_t p_len PNGReadStatus *rstatus; rstatus = (PNGReadStatus *)png_get_io_ptr(png_ptr); - png_size_t to_read = p_length; - if (rstatus->size >= 0) { - to_read = MIN(p_length, rstatus->size - rstatus->offset); - } + png_size_t to_read = MIN(p_length, rstatus->size - rstatus->offset); memcpy(data, &rstatus->image[rstatus->offset], to_read); rstatus->offset += to_read; @@ -271,7 +268,6 @@ static void _write_png_data(png_structp png_ptr, png_bytep data, png_size_t p_le v.resize(vs + p_length); PoolVector<uint8_t>::Write w = v.write(); copymem(&w[vs], data, p_length); - //print_line("png write: "+itos(p_length)); } static PoolVector<uint8_t> _lossless_pack_png(const Ref<Image> &p_image) { diff --git a/drivers/png/image_loader_png.h b/drivers/png/image_loader_png.h index 48f48e6bea..5dff7e3902 100644 --- a/drivers/png/image_loader_png.h +++ b/drivers/png/image_loader_png.h @@ -31,7 +31,7 @@ #ifndef IMAGE_LOADER_PNG_H #define IMAGE_LOADER_PNG_H -#include "io/image_loader.h" +#include "core/io/image_loader.h" #include <png.h> diff --git a/drivers/png/resource_saver_png.cpp b/drivers/png/resource_saver_png.cpp index 270ae36e1e..c5729f70b2 100644 --- a/drivers/png/resource_saver_png.cpp +++ b/drivers/png/resource_saver_png.cpp @@ -31,8 +31,8 @@ #include "resource_saver_png.h" #include "core/image.h" -#include "os/file_access.h" -#include "project_settings.h" +#include "core/os/file_access.h" +#include "core/project_settings.h" #include "scene/resources/texture.h" #include <png.h> diff --git a/drivers/png/resource_saver_png.h b/drivers/png/resource_saver_png.h index 109b4801da..34950f6723 100644 --- a/drivers/png/resource_saver_png.h +++ b/drivers/png/resource_saver_png.h @@ -31,8 +31,8 @@ #ifndef RESOURCE_SAVER_PNG_H #define RESOURCE_SAVER_PNG_H -#include "image.h" -#include "io/resource_saver.h" +#include "core/image.h" +#include "core/io/resource_saver.h" class ResourceSaverPNG : public ResourceFormatSaver { public: |