From e055247b17dc9b9d7239b95da2207388d05fd770 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Thu, 1 Oct 2015 16:25:36 -0300 Subject: -Added ability to use cubic interpolation on image resize (little more quality on non-po2 resizing) -Added ability for exporter to shrink images to non-integer values. Helps if you want to convert your game artwork from 1080->720 or similar --- tools/editor/io_plugins/editor_texture_import_plugin.cpp | 8 ++++---- tools/editor/io_plugins/editor_texture_import_plugin.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'tools/editor/io_plugins') diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp index 436725f6fb..c0887ab40a 100644 --- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp @@ -828,7 +828,7 @@ Error EditorTextureImportPlugin::import(const String& p_path, const Ref &texture,int format, float quality,int flags,EditorExportPlatform::ImageCompression p_compr,int tex_flags,int shrink) { +Error EditorTextureImportPlugin::_process_texture_data(Ref &texture,int format, float quality,int flags,EditorExportPlatform::ImageCompression p_compr,int tex_flags,float shrink) { if (format==IMAGE_FORMAT_COMPRESS_DISK_LOSSLESS || format==IMAGE_FORMAT_COMPRESS_DISK_LOSSY) { @@ -866,7 +866,7 @@ Error EditorTextureImportPlugin::_process_texture_data(Ref &textur int orig_w=image.get_width(); int orig_h=image.get_height(); - image.resize(orig_w/shrink,orig_h/shrink); + image.resize(orig_w/shrink,orig_h/shrink,Image::INTERPOLATE_CUBIC); texture->create_from_image(image,tex_flags); texture->set_size_override(Size2(orig_w,orig_h)); @@ -926,7 +926,7 @@ Error EditorTextureImportPlugin::_process_texture_data(Ref &textur int orig_h=image.get_height(); if (shrink>1) { - image.resize(orig_w/shrink,orig_h/shrink); + image.resize(orig_w/shrink,orig_h/shrink,Image::INTERPOLATE_CUBIC); texture->create_from_image(image,tex_flags); texture->set_size_override(Size2(orig_w,orig_h)); } @@ -987,7 +987,7 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Refhas_option("shrink")) shrink=from->get_option("shrink"); diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.h b/tools/editor/io_plugins/editor_texture_import_plugin.h index 02d09d9e17..78383d1d77 100644 --- a/tools/editor/io_plugins/editor_texture_import_plugin.h +++ b/tools/editor/io_plugins/editor_texture_import_plugin.h @@ -70,7 +70,7 @@ private: static EditorTextureImportPlugin *singleton[MODE_MAX]; //used by other importers such as mesh - Error _process_texture_data(Ref &texture, int format, float quality, int flags,EditorExportPlatform::ImageCompression p_compr,int tex_flags,int shrink); + Error _process_texture_data(Ref &texture, int format, float quality, int flags,EditorExportPlatform::ImageCompression p_compr,int tex_flags,float shrink); void compress_image(EditorExportPlatform::ImageCompression p_mode,Image& image,bool p_smaller); public: -- cgit v1.2.3