瀏覽代碼

image: do not alter the pointer returned by Lock().

undefined
Sam Hocevar 10 年之前
父節點
當前提交
8329482cb9
共有 1 個檔案被更改,包括 6 行新增6 行删除
  1. +6
    -6
      src/image/codec/dummy-image.cpp

+ 6
- 6
src/image/codec/dummy-image.cpp 查看文件

@@ -40,15 +40,15 @@ bool DummyImageCodec::Load(Image *image, char const *path)
UNUSED(path);

image->SetSize(ivec2(256));
u8vec4 *pixels = image->Lock<PixelFormat::RGBA_8>();
u8vec4 *pixels = image->Lock<PixelFormat::RGBA_8>(), *tmp = pixels;
for (int j = 0; j < 256; j++)
for (int i = 0; i < 256; i++)
{
pixels->r = ((i ^ j) & 1) * 0xff;
pixels->g = (uint8_t)i;
pixels->b = (uint8_t)j;
pixels->a = (((i >> 4) ^ (j >> 4)) & 1) * 0xff;
++pixels;
tmp->r = ((i ^ j) & 1) * 0xff;
tmp->g = (uint8_t)i;
tmp->b = (uint8_t)j;
tmp->a = (((i >> 4) ^ (j >> 4)) & 1) * 0xff;
++tmp;
}
image->Unlock(pixels);



Loading…
取消
儲存