diff options
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(); }; |