summaryrefslogtreecommitdiffstats
path: root/core/image.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-05-29 11:37:26 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-05-29 11:37:52 -0300
commit3e8eb396d7cfec8a96efb78719c0556f1beccf68 (patch)
tree3f6e9adbac4c20989812b338ca7bc3a0b65f568d /core/image.cpp
parenta5777994cbc06183af7db7d8233434f245d5b089 (diff)
downloadredot-engine-3e8eb396d7cfec8a96efb78719c0556f1beccf68.tar.gz
Finalized DynamicFont implementation
-DynamicFont uses Freetype by default -Editor fonts are now scalable thanks to this -Cleaned up documentation browser and added fonts for this
Diffstat (limited to 'core/image.cpp')
-rw-r--r--core/image.cpp40
1 files changed, 39 insertions, 1 deletions
diff --git a/core/image.cpp b/core/image.cpp
index 8635aa1b29..57496683ef 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -30,7 +30,7 @@
#include "hash_map.h"
#include "core/io/image_loader.h"
#include "core/os/copymem.h"
-
+#include "hq2x.h"
#include "print_string.h"
#include <stdio.h>
@@ -901,6 +901,44 @@ static void _generate_po2_mipmap(const uint8_t* p_src, uint8_t* p_dst, uint32_t
}
+void Image::expand_x2_hq2x() {
+
+ ERR_FAIL_COND(format>=FORMAT_INDEXED);
+
+ Format current = format;
+ bool mipmaps=get_mipmaps();
+ if (mipmaps) {
+ clear_mipmaps();
+ }
+
+ if (current!=FORMAT_RGBA)
+ convert(FORMAT_RGBA);
+
+ DVector<uint8_t> dest;
+ dest.resize(width*2*height*2*4);
+
+ {
+ DVector<uint8_t>::Read r = data.read();
+ DVector<uint8_t>::Write w = dest.write();
+
+ hq2x_resize((const uint32_t*)r.ptr(),width,height,(uint32_t*)w.ptr());
+
+ }
+
+ width*=2;
+ height*=2;
+ data=dest;
+
+
+ if (current!=FORMAT_RGBA)
+ convert(current);
+
+ if (mipmaps) {
+ generate_mipmaps();
+ }
+
+}
+
void Image::shrink_x2() {
ERR_FAIL_COND(format==FORMAT_INDEXED || format==FORMAT_INDEXED_ALPHA);