diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-05-17 07:36:47 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-05-17 07:37:45 -0300 |
commit | 98a329670227c726a5d7a196e5cba8dbdd54301b (patch) | |
tree | 7346f7a3e38eb35b784ac1a68a227d07cc8881b4 /modules/jpg | |
parent | d801ff2b3db2de105c1b36a74ce116e360143d4e (diff) |
Removal of Image from Variant, converted to a Resource.
Diffstat (limited to 'modules/jpg')
-rw-r--r-- | modules/jpg/image_loader_jpegd.cpp | 11 | ||||
-rw-r--r-- | modules/jpg/image_loader_jpegd.h | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/modules/jpg/image_loader_jpegd.cpp b/modules/jpg/image_loader_jpegd.cpp index 83685d6446..0741dd198a 100644 --- a/modules/jpg/image_loader_jpegd.cpp +++ b/modules/jpg/image_loader_jpegd.cpp @@ -89,7 +89,7 @@ Error jpeg_load_image_from_buffer(Image *p_image, const uint8_t *p_buffer, int p return OK; } -Error ImageLoaderJPG::load_image(Image *p_image, FileAccess *f) { +Error ImageLoaderJPG::load_image(Ref<Image> p_image, FileAccess *f) { PoolVector<uint8_t> src_image; int src_image_len = f->get_len(); @@ -102,7 +102,7 @@ Error ImageLoaderJPG::load_image(Image *p_image, FileAccess *f) { f->close(); - Error err = jpeg_load_image_from_buffer(p_image, w.ptr(), src_image_len); + Error err = jpeg_load_image_from_buffer(p_image.ptr(), w.ptr(), src_image_len); w = PoolVector<uint8_t>::Write(); @@ -115,10 +115,11 @@ void ImageLoaderJPG::get_recognized_extensions(List<String> *p_extensions) const p_extensions->push_back("jpeg"); } -static Image _jpegd_mem_loader_func(const uint8_t *p_png, int p_size) { +static Ref<Image> _jpegd_mem_loader_func(const uint8_t *p_png, int p_size) { - Image img; - Error err = jpeg_load_image_from_buffer(&img, p_png, p_size); + Ref<Image> img; + img.instance(); + Error err = jpeg_load_image_from_buffer(img.ptr(), p_png, p_size); if (err) ERR_PRINT("Couldn't initialize ImageLoaderJPG with the given resource."); diff --git a/modules/jpg/image_loader_jpegd.h b/modules/jpg/image_loader_jpegd.h index d23e8a7d48..57d7a2bb1c 100644 --- a/modules/jpg/image_loader_jpegd.h +++ b/modules/jpg/image_loader_jpegd.h @@ -38,7 +38,7 @@ class ImageLoaderJPG : public ImageFormatLoader { public: - virtual Error load_image(Image *p_image, FileAccess *f); + virtual Error load_image(Ref<Image> p_image, FileAccess *f); virtual void get_recognized_extensions(List<String> *p_extensions) const; ImageLoaderJPG(); }; |