From 8329482cb9c1c4d58d2a9fa59968497a7bd8e1ce Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Mon, 25 Aug 2014 18:08:55 +0000 Subject: [PATCH] image: do not alter the pointer returned by Lock(). --- src/image/codec/dummy-image.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/image/codec/dummy-image.cpp b/src/image/codec/dummy-image.cpp index c544f4d0..a107ee3e 100644 --- a/src/image/codec/dummy-image.cpp +++ b/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(); + u8vec4 *pixels = image->Lock(), *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);