summaryrefslogtreecommitdiff
path: root/source/modules/asura-core/graphics/image.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/modules/asura-core/graphics/image.cpp')
-rw-r--r--source/modules/asura-core/graphics/image.cpp31
1 files changed, 23 insertions, 8 deletions
diff --git a/source/modules/asura-core/graphics/image.cpp b/source/modules/asura-core/graphics/image.cpp
index e704945..e0528eb 100644
--- a/source/modules/asura-core/graphics/image.cpp
+++ b/source/modules/asura-core/graphics/image.cpp
@@ -1,6 +1,9 @@
-#include "Config.h"
-#include "Image.h"
-#include "GL.h"
+#include "../core_config.h"
+
+#include "image.h"
+#include "gl.h"
+
+using namespace AEIO;
namespace AsuraEngine
{
@@ -16,16 +19,28 @@ namespace AsuraEngine
}
//\Ϣ
- bool Image::Load(ImageData* data)
+ bool Image::Refresh(DecodedData* data)
{
ASSERT(data);
- glBindTexture(GL_TEXTURE_2D, mTextureHandle);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, data->width, data->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data->pixels);
+ ImageData* imgData = static_cast<ImageData*>(data);
+ ASSERT(imgData);
+
+ glBindTexture(GL_TEXTURE_2D, mTexHandle);
+
+ imgData->Lock();
+
+ int width = imgData->width;
+ int height = imgData->height;
+
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, imgData->pixels);
+ mImageData = imgData;
+
+ imgData->Unlock();
+
glBindTexture(GL_TEXTURE_2D, 0);
- return true;
- RRA(data, mImageData);
+ return true;
}
}