summaryrefslogtreecommitdiff
path: root/modules/pvr
diff options
context:
space:
mode:
Diffstat (limited to 'modules/pvr')
-rw-r--r--modules/pvr/image_compress_pvrtc.cpp10
-rw-r--r--modules/pvr/register_types.cpp2
-rw-r--r--modules/pvr/texture_loader_pvr.cpp2
3 files changed, 9 insertions, 5 deletions
diff --git a/modules/pvr/image_compress_pvrtc.cpp b/modules/pvr/image_compress_pvrtc.cpp
index d2d8976694..980cac17d3 100644
--- a/modules/pvr/image_compress_pvrtc.cpp
+++ b/modules/pvr/image_compress_pvrtc.cpp
@@ -31,7 +31,7 @@
#include "image_compress_pvrtc.h"
#include "core/io/image.h"
-#include "core/object/reference.h"
+#include "core/object/ref_counted.h"
#include <PvrTcEncoder.h>
#include <RgbaBitmap.h>
@@ -43,6 +43,10 @@ static void _compress_pvrtc1_4bpp(Image *p_img) {
if (!img->is_size_po2() || img->get_width() != img->get_height()) {
make_mipmaps = img->has_mipmaps();
img->resize_to_po2(true);
+ // Resizing can fail for some formats
+ if (!img->is_size_po2() || img->get_width() != img->get_height()) {
+ ERR_FAIL_MSG("Failed to resize the image for compression.");
+ }
}
img->convert(Image::FORMAT_RGBA8);
if (!img->has_mipmaps() && make_mipmaps) {
@@ -52,7 +56,7 @@ static void _compress_pvrtc1_4bpp(Image *p_img) {
bool use_alpha = img->detect_alpha();
Ref<Image> new_img;
- new_img.instance();
+ new_img.instantiate();
new_img->create(img->get_width(), img->get_height(), img->has_mipmaps(), use_alpha ? Image::FORMAT_PVRTC1_4A : Image::FORMAT_PVRTC1_4);
Vector<uint8_t> data = new_img->get_data();
@@ -65,7 +69,7 @@ static void _compress_pvrtc1_4bpp(Image *p_img) {
img->get_mipmap_offset_size_and_dimensions(i, ofs, size, w, h);
Javelin::RgbaBitmap bm(w, h);
void *dst = (void *)bm.GetData();
- copymem(dst, &r[ofs], size);
+ memcpy(dst, &r[ofs], size);
Javelin::ColorRgba<unsigned char> *dp = bm.GetData();
for (int j = 0; j < size / 4; j++) {
// Red and blue colors are swapped.
diff --git a/modules/pvr/register_types.cpp b/modules/pvr/register_types.cpp
index aeac564c93..ef72087d25 100644
--- a/modules/pvr/register_types.cpp
+++ b/modules/pvr/register_types.cpp
@@ -36,7 +36,7 @@
static Ref<ResourceFormatPVR> resource_loader_pvr;
void register_pvr_types() {
- resource_loader_pvr.instance();
+ resource_loader_pvr.instantiate();
ResourceLoader::add_resource_format_loader(resource_loader_pvr);
_register_pvrtc_compress_func();
diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp
index 83f032ca2b..cb12976090 100644
--- a/modules/pvr/texture_loader_pvr.cpp
+++ b/modules/pvr/texture_loader_pvr.cpp
@@ -30,7 +30,7 @@
#include "texture_loader_pvr.h"
-#include "core/os/file_access.h"
+#include "core/io/file_access.h"
static void _pvrtc_decompress(Image *p_img);