summaryrefslogtreecommitdiffstats
path: root/src/common/image.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/image.cpp')
-rw-r--r--src/common/image.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/common/image.cpp b/src/common/image.cpp
index e9cf422..f241f83 100644
--- a/src/common/image.cpp
+++ b/src/common/image.cpp
@@ -21,6 +21,7 @@
#include "common/image.h"
#include "math/func.h"
+#include "common/resources/resourcemanager.h"
#include <stdlib.h>
#include <stdio.h>
@@ -384,7 +385,16 @@ bool CImage::Load(const std::string& fileName)
m_error = "";
- m_data->surface = IMG_Load(fileName.c_str());
+ SDL_RWops* pointer = CResourceManager::GetSDLFileHandler(fileName.c_str());
+ if (pointer == nullptr)
+ {
+ delete m_data;
+ m_data = nullptr;
+
+ m_error = "Unable to open file";
+ return false;
+ }
+ m_data->surface = IMG_Load_RW(pointer, 1);
if (m_data->surface == nullptr)
{
delete m_data;
@@ -461,4 +471,4 @@ void CImage::flipVertically(){
SDL_FreeSurface(m_data->surface);
m_data->surface = result;
-} \ No newline at end of file
+}