summaryrefslogtreecommitdiff
path: root/drivers/png
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/png')
-rw-r--r--drivers/png/image_loader_png.cpp6
-rw-r--r--drivers/png/png_driver_common.cpp3
-rw-r--r--drivers/png/resource_saver_png.cpp6
3 files changed, 0 insertions, 15 deletions
diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp
index 4cb93a821c..8af58a7ed7 100644
--- a/drivers/png/image_loader_png.cpp
+++ b/drivers/png/image_loader_png.cpp
@@ -37,7 +37,6 @@
#include <string.h>
Error ImageLoaderPNG::load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear, float p_scale) {
-
const size_t buffer_size = f->get_len();
Vector<uint8_t> file_buffer;
Error err = file_buffer.resize(buffer_size);
@@ -55,12 +54,10 @@ Error ImageLoaderPNG::load_image(Ref<Image> p_image, FileAccess *f, bool p_force
}
void ImageLoaderPNG::get_recognized_extensions(List<String> *p_extensions) const {
-
p_extensions->push_back("png");
}
Ref<Image> ImageLoaderPNG::load_mem_png(const uint8_t *p_png, int p_size) {
-
Ref<Image> img;
img.instance();
@@ -71,7 +68,6 @@ Ref<Image> ImageLoaderPNG::load_mem_png(const uint8_t *p_png, int p_size) {
}
Ref<Image> ImageLoaderPNG::lossless_unpack_png(const Vector<uint8_t> &p_data) {
-
const int len = p_data.size();
ERR_FAIL_COND_V(len < 4, Ref<Image>());
const uint8_t *r = p_data.ptr();
@@ -80,7 +76,6 @@ Ref<Image> ImageLoaderPNG::lossless_unpack_png(const Vector<uint8_t> &p_data) {
}
Vector<uint8_t> ImageLoaderPNG::lossless_pack_png(const Ref<Image> &p_image) {
-
Vector<uint8_t> out_buffer;
// add Godot's own "PNG " prefix
@@ -104,7 +99,6 @@ Vector<uint8_t> ImageLoaderPNG::lossless_pack_png(const Ref<Image> &p_image) {
}
ImageLoaderPNG::ImageLoaderPNG() {
-
Image::_png_mem_loader_func = load_mem_png;
Image::lossless_unpacker = lossless_unpack_png;
Image::lossless_packer = lossless_pack_png;
diff --git a/drivers/png/png_driver_common.cpp b/drivers/png/png_driver_common.cpp
index 3f9c824e93..68faff30fc 100644
--- a/drivers/png/png_driver_common.cpp
+++ b/drivers/png/png_driver_common.cpp
@@ -59,7 +59,6 @@ static bool check_error(const png_image &image) {
}
Error png_to_image(const uint8_t *p_source, size_t p_size, Ref<Image> p_image) {
-
png_image png_img;
zeromem(&png_img, sizeof(png_img));
png_img.version = PNG_IMAGE_VERSION;
@@ -121,7 +120,6 @@ Error png_to_image(const uint8_t *p_source, size_t p_size, Ref<Image> p_image) {
}
Error image_to_png(const Ref<Image> &p_image, Vector<uint8_t> &p_buffer) {
-
Ref<Image> source_image = p_image->duplicate();
if (source_image->is_compressed())
@@ -179,7 +177,6 @@ Error image_to_png(const Ref<Image> &p_image, Vector<uint8_t> &p_buffer) {
ERR_FAIL_COND_V_MSG(check_error(png_img), FAILED, png_img.message);
}
if (!success) {
-
// buffer was big enough, must be some other error
ERR_FAIL_COND_V(compressed_size <= png_size_estimate, FAILED);
diff --git a/drivers/png/resource_saver_png.cpp b/drivers/png/resource_saver_png.cpp
index 2380c2685f..3a0b319a45 100644
--- a/drivers/png/resource_saver_png.cpp
+++ b/drivers/png/resource_saver_png.cpp
@@ -36,7 +36,6 @@
#include "scene/resources/texture.h"
Error ResourceSaverPNG::save(const String &p_path, const RES &p_resource, uint32_t p_flags) {
-
Ref<ImageTexture> texture = p_resource;
ERR_FAIL_COND_V_MSG(!texture.is_valid(), ERR_INVALID_PARAMETER, "Can't save invalid texture as PNG.");
@@ -50,7 +49,6 @@ Error ResourceSaverPNG::save(const String &p_path, const RES &p_resource, uint32
};
Error ResourceSaverPNG::save_image(const String &p_path, const Ref<Image> &p_img) {
-
Vector<uint8_t> buffer;
Error err = PNGDriverCommon::image_to_png(p_img, buffer);
ERR_FAIL_COND_V_MSG(err, err, "Can't convert image to PNG.");
@@ -72,7 +70,6 @@ Error ResourceSaverPNG::save_image(const String &p_path, const Ref<Image> &p_img
}
Vector<uint8_t> ResourceSaverPNG::save_image_to_buffer(const Ref<Image> &p_img) {
-
Vector<uint8_t> buffer;
Error err = PNGDriverCommon::image_to_png(p_img, buffer);
ERR_FAIL_COND_V_MSG(err, Vector<uint8_t>(), "Can't convert image to PNG.");
@@ -80,19 +77,16 @@ Vector<uint8_t> ResourceSaverPNG::save_image_to_buffer(const Ref<Image> &p_img)
}
bool ResourceSaverPNG::recognize(const RES &p_resource) const {
-
return (p_resource.is_valid() && p_resource->is_class("ImageTexture"));
}
void ResourceSaverPNG::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const {
-
if (Object::cast_to<ImageTexture>(*p_resource)) {
p_extensions->push_back("png");
}
}
ResourceSaverPNG::ResourceSaverPNG() {
-
Image::save_png_func = &save_image;
Image::save_png_buffer_func = &save_image_to_buffer;
};