mirror of
https://github.com/Relintai/pandemonium_engine_minimal.git
synced 2024-11-17 22:17:19 +01:00
Moved png from drivers to a module.
This commit is contained in:
parent
9599e22768
commit
094ff36131
@ -30,27 +30,10 @@
|
||||
|
||||
#include "register_driver_types.h"
|
||||
|
||||
#include "drivers/png/image_loader_png.h"
|
||||
#include "drivers/png/resource_saver_png.h"
|
||||
|
||||
static ImageLoaderPNG *image_loader_png;
|
||||
static Ref<ResourceSaverPNG> resource_saver_png;
|
||||
|
||||
void register_core_driver_types() {
|
||||
image_loader_png = memnew(ImageLoaderPNG);
|
||||
ImageLoader::add_image_format_loader(image_loader_png);
|
||||
|
||||
resource_saver_png.instance();
|
||||
ResourceSaver::add_resource_format_saver(resource_saver_png);
|
||||
}
|
||||
|
||||
void unregister_core_driver_types() {
|
||||
if (image_loader_png) {
|
||||
memdelete(image_loader_png);
|
||||
}
|
||||
|
||||
ResourceSaver::remove_resource_format_saver(resource_saver_png);
|
||||
resource_saver_png.unref();
|
||||
}
|
||||
|
||||
void register_driver_types() {
|
||||
|
@ -93,7 +93,7 @@ if env["builtin_freetype"]:
|
||||
|
||||
# Also requires libpng headers
|
||||
if env["builtin_libpng"]:
|
||||
env_freetype.Prepend(CPPPATH=["#thirdparty/libpng"])
|
||||
env_freetype.Prepend(CPPPATH=["#modules/png/libpng"])
|
||||
|
||||
sfnt = thirdparty_dir + "src/sfnt/sfnt.c"
|
||||
# Must be done after all CPPDEFINES are being set so we can copy them.
|
||||
|
@ -1,5 +1,7 @@
|
||||
|
||||
def can_build(env, platform):
|
||||
env.module_add_dependencies("freetype", ["png"], False)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
Import("env")
|
||||
Import("env_modules")
|
||||
|
||||
env_png = env.Clone()
|
||||
env_png = env_modules.Clone()
|
||||
|
||||
# Thirdparty source files
|
||||
|
||||
@ -57,7 +58,7 @@ if env["builtin_libpng"]:
|
||||
neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/palette_neon_intrinsics.c"))
|
||||
thirdparty_obj += neon_sources
|
||||
|
||||
env.drivers_sources += thirdparty_obj
|
||||
env.modules_sources += thirdparty_obj
|
||||
|
||||
|
||||
# Pandemonium source files
|
||||
@ -65,7 +66,7 @@ if env["builtin_libpng"]:
|
||||
driver_obj = []
|
||||
|
||||
env_png.add_source_files(driver_obj, "*.cpp")
|
||||
env.drivers_sources += driver_obj
|
||||
env.modules_sources += driver_obj
|
||||
|
||||
# Needed to force rebuilding the driver files when the thirdparty library is updated.
|
||||
env.Depends(driver_obj, thirdparty_obj)
|
6
modules/png/config.py
Normal file
6
modules/png/config.py
Normal file
@ -0,0 +1,6 @@
|
||||
def can_build(env, platform):
|
||||
return True
|
||||
|
||||
|
||||
def configure(env):
|
||||
pass
|
@ -32,7 +32,7 @@
|
||||
|
||||
#include "core/os/os.h"
|
||||
#include "core/string/print_string.h"
|
||||
#include "drivers/png/png_driver_common.h"
|
||||
#include "png_driver_common.h"
|
||||
|
||||
#include <string.h>
|
||||
|
58
modules/png/register_types.cpp
Normal file
58
modules/png/register_types.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
/*************************************************************************/
|
||||
/* register_types.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "register_types.h"
|
||||
|
||||
#include "image_loader_png.h"
|
||||
#include "resource_saver_png.h"
|
||||
|
||||
static ImageLoaderPNG *image_loader_png = NULL;
|
||||
static Ref<ResourceSaverPNG> resource_saver_png;
|
||||
|
||||
void register_png_types(ModuleRegistrationLevel p_level) {
|
||||
if (p_level == MODULE_REGISTRATION_LEVEL_CORE) {
|
||||
image_loader_png = memnew(ImageLoaderPNG);
|
||||
ImageLoader::add_image_format_loader(image_loader_png);
|
||||
|
||||
resource_saver_png.instance();
|
||||
ResourceSaver::add_resource_format_saver(resource_saver_png);
|
||||
}
|
||||
}
|
||||
|
||||
void unregister_png_types(ModuleRegistrationLevel p_level) {
|
||||
if (p_level == MODULE_REGISTRATION_LEVEL_CORE) {
|
||||
if (image_loader_png) {
|
||||
memdelete(image_loader_png);
|
||||
}
|
||||
|
||||
ResourceSaver::remove_resource_format_saver(resource_saver_png);
|
||||
resource_saver_png.unref();
|
||||
}
|
||||
}
|
38
modules/png/register_types.h
Normal file
38
modules/png/register_types.h
Normal file
@ -0,0 +1,38 @@
|
||||
#ifndef PNG_REGISTER_TYPES_H
|
||||
#define PNG_REGISTER_TYPES_H
|
||||
/*************************************************************************/
|
||||
/* register_types.h */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/*************************************************************************/
|
||||
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
||||
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "modules/register_module_types.h"
|
||||
|
||||
void register_png_types(ModuleRegistrationLevel p_level);
|
||||
void unregister_png_types(ModuleRegistrationLevel p_level);
|
||||
|
||||
#endif // BMP_REGISTER_TYPES_H
|
@ -32,7 +32,7 @@
|
||||
|
||||
#include "core/io/image.h"
|
||||
#include "core/os/file_access.h"
|
||||
#include "drivers/png/png_driver_common.h"
|
||||
#include "png_driver_common.h"
|
||||
#include "scene/resources/texture.h"
|
||||
|
||||
Error ResourceSaverPNG::save(const String &p_path, const RES &p_resource, uint32_t p_flags) {
|
Loading…
Reference in New Issue
Block a user