浏览代码

imlib2: Fix RGBA order in loader and use imlib_image_get_data_for_reading_only()

undefined
Jean-Yves Lamoureux Sam Hocevar <sam@hocevar.net> 10 年前
父节点
当前提交
cf72e40d62
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. +5
    -0
      src/image/codec/imlib2-image.cpp

+ 5
- 0
src/image/codec/imlib2-image.cpp 查看文件

@@ -68,6 +68,11 @@ bool Imlib2ImageCodec::Load(Image *image, char const *path)

image->SetSize(size);
u8vec4 *data = image->Lock<PixelFormat::RGBA_8>();
uint8_t *orig = (uint8_t*)imlib_image_get_data_for_reading_only();
for(int i = 0; i < size.x*size.y; i++) {
data[i] = ((u8vec4 *)&orig[i * 4])->bgra;
}

memcpy(data, imlib_image_get_data(), 4 * size.x * size.y);
image->Unlock(data);



正在加载...
取消
保存