summaryrefslogtreecommitdiff
path: root/source/modules/asura-core/graphics/image.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-03-30 21:49:29 +0800
committerchai <chaifix@163.com>2019-03-30 21:49:29 +0800
commit8164adb15b76f537f8b6c78b9992786b61d61cc8 (patch)
tree6e42919e32258a3c495dcec54b0fda3e8e1977d8 /source/modules/asura-core/graphics/image.cpp
parentc270d033fa04873ee7a8925dbb00cae5edc4555c (diff)
*misc
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;
}
}